2022-06-03 05:42 AM
Hello, is there a way to instruct the compiler to place a const value at a specific address in flash memory? On another toolchain I was able to use
const char array1[4] = {1,2,3,4} absolute 0x9D008000; // stored at flash address 0x9D008000
If not, is there another way to control the .hex file output in code. Thanks
Using STM32CubeIDE, gcc
2022-06-03 05:52 AM
Why?
You should really do this address level stuff in the linker, via sections in the linker script or scatter file.
Or think of better ways to do it that don't rely on absolute or AT address directives. ie have some abstraction or indirect methods of finding a structure,for example a reference in an unused vector table entry, or some file system or structured storage method for resources. Then pass the data via a pointer.