I'm developing a bare-metal application using starterware. There no malloc()/calloc() exists, thus I have no other possibility to allocate a large memory buffer by defining a large global array (e.g. an unsigned char array).
The big disadvantage: using such an array the resulting .bin-file is blown up to a really huge size. So my next idea: I do not use a global array but parts of the really huge memory by pointing to an address in RAM that is unused. I know that my program is loaded to 0x80000000 but I do not know its size, so that I'm not sure at which memory address I can start with my buffer.
So is there a possibility to modify the linker command file in a way so that it writes the total size of my program into a variable that is accessible from within my program? Or is there any other way to evaluate the resulting binaries size without compiling it twice (once for checking the size and once with a modified constant that incorporates the size in order to use it out of the program)?
Thanks!