2011-02-28 03:16 AM
Define an array in Flash
2011-05-17 05:26 AM
(stupid forum - spurious post)
2011-05-17 05:26 AM
Any var is just a pointer to memory
Array in RAM is a pointer If pointer points to flash memory address - the compiler will not create the ASM code that writes to flash2011-05-17 05:26 AM
You are missing the point:
The question was how to locate an array into flash; ie, how to store the content in flash.You can't do that just by setting a pointer.
2011-05-17 05:26 AM
@ANN can you specify your requirements in more detail? Are the array contents defined at compile time (const) or do you wish to change the array contents at run time? How big is the array, how big is your code, which device will you be using? Is it possible for reset or power down to occur while changing the array? If so can you live with the array being lost -- if not you will need to keep copies of flash pages before erasing pages and be able to detect and fix broken array at start up.
As you can see there are a lot of unknowns so you need to provide the detail2011-05-17 05:26 AM
2011-05-17 05:26 AM
Array content need not to be changed at the run time from the defined values. So i would like to keep them in flash not in RAM.
I am using STM32L and IAR combination.2011-05-17 05:26 AM
Can you post the code or maybe even the whole project as if the array is of significant size and is const (and not ''volatile'' or ''fast'' etc.) it should really end up in flash not RAM. What Andrew said is that const does not always force const variables to flash but in this case it should allow the compiler to do so unless I don't understand what you are trying to do (hence why you should post the code).