user2852294
user2852294

Reputation: 87

Is there a way to find the size of eclipse compiled C binary at runtime?

I'm compiling a C program for an embedded application using eclipse, but I need the code to know (at runtime) where exactly it ends in flash. What is the simplest way of doing this? Thanks

Upvotes: 1

Views: 377

Answers (2)

roger314
roger314

Reputation: 46

You will need to go into the linker command file and create some labels that mark the start and end of the .text section in memory then in the code take the difference.

Upvotes: 2

unwind
unwind

Reputation: 399753

You're probably going to have to involve the linker, to do this.

Read up on the tools you're using, and see if (and how) to make the linker set the value of symbols owned by the program.

For the GNU linker, the relevant manual section is Section Data Expressions.

Upvotes: 0

Related Questions