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
1484 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
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
Offline
Samar Samar
over 7 years ago
Cancel
Up
0
Down
Reply
Cancel
Offline
zart zurt
over 7 years ago
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
Positioning a function in a Position Independent Executable for ARMV8
0
5720
views
3
replies
Latest
1 month ago
by
Stephen Theobald
Answered
Link a pure binary file to image with scatter file
0
5676
views
3
replies
Latest
1 month ago
by
Ronan Synnott
Answered
Failed to read contents of Internal RAM L1-I_DATA in ARM DS
0
Arm Development Studio
Cache
Debug and Trace Services Layer (DTSL)
9916
views
23
replies
Latest
1 month ago
by
Boon Khai
Suggested Answer
DS-5 connect fail when cortex-r5 is in lock-step mode
0
8274
views
10
replies
Latest
2 months ago
by
Stuart Hirons
Suggested Answer
On Cortex-M4F microcontrollers: is fixed point math faster or floating point?
0
7927
views
10
replies
Latest
2 months ago
by
Ronan Synnott
<
>
View all questions in Arm Development Studio forum