How can I place an array of constants in program memory?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How can I place an array of constants in program memory?

3,908 Views
Mel1949
Contributor I
DSP56F805 (DSP56800 series)
CW 5.6.1.1658 - DSP56800-R7.0
 
I need to move a "large" (2k) array out of data memory and place it in program memory.  In the DSP56800E version there is a __pmem modifier to cause variables to be place in program memory but this is unavailable on the 56800 version.  Could I use  inline asm code and org it P the create the array.  If so, how do I reference a variable created in assembly from the main program?
 
 
Labels (1)
0 Kudos
Reply
3 Replies

877 Views
Mel1949
Contributor I
Thanks Jeff
 
I was getting a linker error Segment Overflow with the pRom-xRam target.  Changed target to xRom-xRam and it links fine.
0 Kudos
Reply

876 Views
glenn_calmotion
Contributor I
We have a similar problem but we have arrays that are 16K+ in total size.  The linker wants to move this array into data flash or data ram but there isn't enough space.
 
We just want to keep all of our arrays in program flash and access it there since there is 128K flash there.  Nothing works, constants, __pmem, making our own memory sections...
 
Anyone have the answer to this simple need?
0 Kudos
Reply

876 Views
imajeff
Contributor III
It seems to me that you can declare a const variable, which would go into flash in the section (or whatever it's called in CW) for read-only data (I call ".rodata"). If needed, you would use pragma to direct it to any other section.
0 Kudos
Reply