Arm Community
Site
Search
User
Site
Search
User
Groups
Arm Research
DesignStart
Education Hub
Graphics and Gaming
High Performance Computing
Innovation
Multimedia
Open Source Software and Platforms
Physical
Processors
Security
System
Software Tools
TrustZone for Armv8-M
中文社区
Blog
Announcements
Artificial Intelligence
Automotive
Healthcare
HPC
Infrastructure
Innovation
Internet of Things
Machine Learning
Mobile
Smart Homes
Wearables
Forums
All developer forums
IP Product forums
Tool & Software forums
Pelion IoT Platform
Support
Open a support case
Documentation
Downloads
Training
Arm Approved program
Arm Design Reviews
Community Help
More
Cancel
Developer Community
Tools and Software
Software Tools
Jump...
Cancel
Software Tools
Arm Development Studio forum
Is there something like sizeof(function) ?
Tools, Software and IDEs blog
Forums
Videos & Files
Help
Jump...
Cancel
New
Replies
3 replies
Subscribers
127 subscribers
Views
1451 views
Users
0 members are here
Related
Is there something like sizeof(function) ?
Offline
zart zurt
over 7 years ago
Note: This was originally posted on 7th May 2009 at http://forums.arm.com
I want to do IAP (In-Application Programming). In order to do this, I will copy several C functions from IROM to IRAM and then execute them there. If there was a sizeof operator for functions than it would be trivial but AFAIK there is none.
To accomplish this, I have created dummy start_of_module & end_of_module marker functions to get addresses of them. That way, I can calculate the size of the module and copy all of functions and find their relative addresses, but I noticed that the compiled functions may be ordered different than they appear in source code. I see this by reading the assembly listing of the module.
Some functions are static but that is all there is...
Any info/suggestion , linker hack , whatever ?
Thanks In Advance...
EOT
Offline
zart zurt
over 7 years ago
Cancel
Up
0
Down
Reply
Cancel
Offline
Samar Samar
over 7 years ago
Cancel
Up
0
Down
Reply
Cancel
Offline
Peter Harris
over 7 years ago
Note: This was originally posted on 8th May 2009 at
http://forums.arm.com
> *SNIP*
You must NOT enable "Optimize for Time"
You must check ASM output for Optimized builds
The function must have 1 and only 1 exit point
The function can not have static & const variables
The function can not access non-local/non-param variables
The function can not have hidden const variable (note[0])
> *SNIP*
That's a pretty long list of things which won't work. If optimization for time causes things to break you may find other optimizations possible with O3 OSpace also cause problems.
Samar has the right idea. Linkers (generally) manage code and data references by manipulating sections and then fixing up inter-section references if the section moves (called relocations). Moving sections around (and performing appropriate relocations if they are needed) means that code stays functional relative to other addresses in the same section.
Cancel
Up
0
Down
Reply
Cancel
More questions in this forum
By title
By date
By reply count
By view count
By most asked
By votes
By quality
Descending
Ascending
All recent questions
Unread questions
Questions you've participated in
Questions you've asked
Unanswered questions
Answered questions
Questions with suggested answers
Questions with no replies
Suggested Answer
DS-5 bare metal wait error after run "debug"
0
DS-5 Development Studio
Debugging
Arm Compiler 5
Memory
21248
views
14
replies
Latest
1 day ago
by
prasadghole
Not Answered
DS-5 connect fail when cortex-r5 is in lock-step mode
0
357
views
4
replies
Latest
3 days ago
by
Jeffrey_lin
Suggested Answer
ARM development studio with ARM Juno r2 board
0
Juno Arm Development Platform
Arm Development Studio
Products
Arm Support
285
views
2
replies
Latest
5 days ago
by
Ronan Synnott
Answered
"Unable to execute remote query (response code 503) " issue
0
302
views
1
reply
Latest
8 days ago
by
Ronan Synnott
Not Answered
Where can I download DS-5 hardware firmware??
0
296
views
1
reply
Latest
8 days ago
by
Ronan Synnott
>
View all questions in Arm Development Studio forum