Hi all,
Is it possible to get the memory location of the end of a memory section such as the location of _etext?,
Regards,
Graham
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi all,
Is it possible to get the memory location of the end of a memory section such as the location of _etext?,
Regards,
Graham
Try the following (COFF):
In your linker command file, have things like
MEMORY { ... RAM: o = 0x00800000 l = 0x00020000 ... }
SECTIONS { ... .text > RAM, RUN_START(_TEXT_START), RUN_END(_TEXT_END), RUN_SIZE(_TEXT_SIZE) ... }
Then in your code:
#include <assert.h> extern char const TEXT_START[]; extern char const TEXT_END[]; extern char const TEXT_SIZE[]; int main(void) { char const * start = TEXT_START; char const * end = TEXT_END; unsigned int len = (unsigned int) TEXT_SIZE; assert(end-start == len); return 0; }
The way to do this might be a bit different for EABI.
For related info, see here.