Thank you for your timely reply with examples.
This is helpful, but not quite what I am looking for.
I have a large data structure on the order of 132K uint_32t, or 512K bytes.
If I declare this array const, the compiler allocates it in flash, which is what I want.
If I am not mistaken, the code that accesses this array in flash is identical to the code that accesses the same array in sram if it were not compiled with the const modifier. The arm must have some way to map the memory accesses to flash.
If I write the data to flash and use the flash API to read it into sram, then I have to pay the price of the storage twice – once in flash, and again in sram – if it will even fit in sram.
What I am looking for is a way to provision the data in flash with one app and then access the data from another app as if it were a compiled const array.
Is this possible?
The example you gave me is very useful for a different purpose – for storing a small amount of persistent configuration data. I have one question about this: how do I know it will not be overwritten by compiler const data?
Thank you for your help. I really appreciate it.