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

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

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

3,680件の閲覧回数
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?
 
 
ラベル(1)
0 件の賞賛
返信
3 返答(返信)

649件の閲覧回数
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 件の賞賛
返信

648件の閲覧回数
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 件の賞賛
返信

648件の閲覧回数
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 件の賞賛
返信