Putting a variable in code memory
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-06-04 1:15 PM
Hi,
I want to declare an array of constant values and have them put into code memory.Something like this:const uint16_t my_array[4] = {0x3456, 0x789A, 0x1234, 0x9876};I want to be able to download the code and then start up STM32 ST-LINK Utility and search for one of the values and find the whole array.I'm pretty sure I can do it using #pragmas and/or attributes and maybe the scatter file ... but I just haven't figured out the right combo.I'm using Keil uvision and a STM32F401.I'd appreciate any help I can get.Mike- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-06-04 1:47 PM
const or static const should suffice, where does the .MAP file say the array is placed? Data copied to RAM might be compressed, but stuff held in ROM/FLASH should be visible
Are you searching for the right pattern? Try using some endian neutral values like 0x1111,0x2222, etcUp vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-06-04 3:34 PM
Thanks clive1 (as always). I had looked at the .map file and swear I couldn't find it but now ... of course I can. I think my main problem is that in the STM32 ST-LINK there is a window for Size and it was set to something less than the full code area so when I did a search it did not go to the end, duh! Anyway, setting it to const is enough, it shows up just like I thought it should.
Mike