STM32CubeIDE and Const variables in Flash memory
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-05-31 2: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.
- Labels:
-
STM32CubeIDE
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-05-31 3: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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-05-31 2:41 AM
Do you actually use the array somewhere in the code? If not then the compiler/linker can and should remove it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-05-31 2: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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-05-31 2: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"?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-05-31 2: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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-05-31 3: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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-05-31 3:05 AM
Thanks - now I know where to look. I was assuming CubeIDE sorted out all these things automatically but obviously not.
