This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to determine the END of the program at runtime?

Hi!

I switched to the SiLabs variety of 8051s, and now I can actually flash parts of the memory from inside my application to store some configuration data.

But: I'd like to safeguard my function against overwriting /erasing actual program code. So I need to find a way to determine the end of the code at runtime in order to prevent any accesses to flash below the boundary.

The BL51 pretty much mixxes all the code around in memory - if there was a way to tell him "Put THISVERYOBJECT at the end" I had a way to determine the End-of-Code-address.

Alternatively, is there a way to tell the linker to turn the statistics into runtime-accessable symbols? In "Ye Olden Days" (and on a different platform) I had a linker thet generated symbols like __CODESIZE__ and __DATASIZE__ that could easily be accessed from C.

Are there other paths to determine the code size? I thought about a script gobbling the linker map file and turning the "Program Size:"-line into C source, but this would imply the need for multiple compilation runs (and including a project related tool in the source repository, etc.), which I'd like to avoid.

Help!

Yours, Christian Treczoks

0