- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I ran out of SRAM in my application and so I have 4000 bytes of data that I'd like to store in Flash as an array.
I tried 'const int8 pgm[4000] = {0x4c, ....};'
However when I build the project the Output window shows that it was stored as SRAM.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Was the definition made within a function (main() is a function,too) or was it declared globally?
const only works globally or with static class.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This might help -
I would have liked to see a different solution like a "flash" qualifier, but GCC developers have choosen a different solution. Now the "const" qualifier has two different meanings depending on the context it appears.
Used in a parameter-list the consequences are: the parameter will not be modified by a direct assignment.
Used in a variable declaration and followed by an initialization the variable will be put into the code area which will be flash memory in all embeddeds.
This improvement is not ARM specific but works in GCC generally.
http://www.keil.com/support/docs/2829.htm Abs variable location Keil and ARM GCC
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
First define your structure / array:
typedef SettingsStruct {
unsigned char Setting1;
unsigned char Setting2;
}
For Keil:
const SettingsStruct code Settings = {0x00, 0x01};
And for GCC:
volatile SettingsStruct Settings __attribute__ ((section (".FlashData")));
And use this define in the Linker's Custom Flags (Project > Build Settings > ARM... > Command Line)
-Wl,--section-start=.FlashData=0x00010000
Regards,
Rolf
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I took a second look and Bob was right. I should have paid closer attention 😞
However, when I tried to use an EM_EEPROM I couldn't get it to work.
The example project seems to be for PSOC3 and the data sheet is rather anemic.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please post your Em_EEPROM project to let us have a look on. Remember Em_EEPROM is not supported for PSoC4 BLE!
Btw: When you right click on the component select "Find Example Project", select PSoC4 4200 you will get a project for your selected device. Defining a variable to be in the EEProm area is not quite easy and mya vary from compiler to compiler. More universal is to define a structure and a pointer to it, then assign the begin of the EEProm area to the pointer.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm using a PSOC5lp.
I blew away the project and can't remember exactly what I was doing.
When I get a chance I'll try it again and find an example for the 5lp.