2019-05-31 02:33 AM
I've created a large (8192 byte) array I want to put in Flash memory with the code, It compiles fine but the data doesn't appear in any of the output files.
Is there a switch or something I'm missing in STM32CubeIDE ?
It's in the main declarations so doesn't need static.
const uint16_t LogSine[4096] = {32768,32963,33155,33345,33532,33717 ........ };
Solved! Go to Solution.
2019-05-31 03:03 AM
So your program doesn't get the right values? I think the data should be in a rodata section.
Maybe you should check that the rodata-section placement in the linker script?
Consts should be there even if you didn't use C runtime libraries. Initialized globals won't be.
2019-05-31 02:41 AM
Do you actually use the array somewhere in the code? If not then the compiler/linker can and should remove it.
2019-05-31 02:46 AM
Yes
R2 = LogSine[(Oscptr->OscAM_Phase >> 20) & 0x00000FFF] * Oscptr->OscAM_Level;
I've checked the .list file and it's definitely being accessed.
2019-05-31 02:51 AM
Well then that's strange. Do you see the values of the array in the debugger? And how exactly are you checking that "the data doesn't appear in any of the output files"?
2019-05-31 02:56 AM
I haven't programmed the device yet as the data is obviously not there - 8192 bytes of data tends to show up in any file format
2019-05-31 03:03 AM
So your program doesn't get the right values? I think the data should be in a rodata section.
Maybe you should check that the rodata-section placement in the linker script?
Consts should be there even if you didn't use C runtime libraries. Initialized globals won't be.
2019-05-31 03:05 AM
Thanks - now I know where to look. I was assuming CubeIDE sorted out all these things automatically but obviously not.