AW: 56F826 - placing large constant data array in Program Flash

Started by Bende Georg June 10, 2003
First, you need to edit the linker_flash.cmd file, in order to create a section
in the pflash memory.
I do it like this: (56f803)
.pflash (RX) : ORIGIN = 0x0000, LENGTH = 0x6D00 # program flash memory
.pConst (RWX) : ORIGIN = 0x6D00, LENGTH = 0x1100 # constant fields

(the original was
.pflash (RX) : ORIGIN = 0x0000, LENGTH = 0x7E00 # program flash memory
)

If you select "Write constant data to .rodata section" in the CW5/FLASH settings
- Code Generation - M56800 Processor, then your constants will be placed
automatically in a section called ".rodata". Your fields need to be defined as
constants!
You have to place your .rodata section in the above created pConst section:

.pconst_data:
{
* (.rodata)
} > .pConst

Now you only need to gain access to your data, which cannot be done directly
from C. U need a snippet of assembly code:

UWord16 asm read_p_memory (int * addr)
{
move p:(r2)+,y0
rts
}

And then you will be able to access the data like
read_p_memory((int*)&int_field[index]); Best wishes,

Georg Bende
Softwareentwickler
Abteilung Elektronik
Dr. Fritz Faulhaber GmbH & Co KG
Daimlerstr. 23
71101 Schaich
Tel: +49 7031 638294

> -----Ursprgliche Nachricht-----
> Von: bmbmz123 [mailto:]
> Gesendet: Montag, 9. Juni 2003 16:37
> An:
> Betreff: [motoroladsp] 56F826 - placing large constant data array in
> Program Flash
>
> Hello all,
>
> I am using large constant data array tables.
> The const data extends beyond the 2k flash available in the data
> section.
> It may even extend beyond the 4k RAM available.
>
> I want to place the arrays in Program Flash, and read the data during
> runtime.
> An access using array-index is prferrable.
>
> Any suggestion?
>
> 10x
>
> bz >
>
> _____________________________________
> Note: If you do a simple "reply" with your email client, only the author
> of this message will receive your answer. You need to do a "reply all" if
> you want your answer to be distributed to the entire group.
>
> _____________________________________
> About this discussion group:
>
> To Join:
>
> To Post:
>
> To Leave:
>
> Archives: http://www.yahoogroups.com/group/motoroladsp
>
> More Groups: http://www.dsprelated.com/groups.php3 > ">http://docs.yahoo.com/info/terms/
>


First, you need to edit the linker_flash.cmd file, in order to create a section
in the pflash memory.
I do it like this: (56f803)
.pflash (RX) : ORIGIN = 0x0000, LENGTH = 0x6D00 # program flash memory
.pConst (RWX) : ORIGIN = 0x6D00, LENGTH = 0x1100 # constant fields

(the original was
.pflash (RX) : ORIGIN = 0x0000, LENGTH = 0x7E00 # program flash memory
)

If you select "Write constant data to .rodata section" in the CW5/FLASH settings
- Code Generation - M56800 Processor, then your constants will be placed
automatically in a section called ".rodata". Your fields need to be defined as
constants!
You have to place your .rodata section in the above created pConst section:

.pconst_data:
{
* (.rodata)
} > .pConst

Now you only need to gain access to your data, which cannot be done directly
from C. U need a snippet of assembly code:

UWord16 asm read_p_memory (int * addr)
{
move p:(r2)+,y0
rts
}

And then you will be able to access the data like
read_p_memory((int*)&int_field[index]); Best wishes,

Georg Bende
Softwareentwickler
Abteilung Elektronik
Dr. Fritz Faulhaber GmbH & Co KG
Daimlerstr. 23
71101 Schaich
Tel: +49 7031 638294

> -----Ursprgliche Nachricht-----
> Von: bmbmz123 [mailto:]
> Gesendet: Montag, 9. Juni 2003 16:37
> An:
> Betreff: [motoroladsp] 56F826 - placing large constant data array in
> Program Flash
>
> Hello all,
>
> I am using large constant data array tables.
> The const data extends beyond the 2k flash available in the data
> section.
> It may even extend beyond the 4k RAM available.
>
> I want to place the arrays in Program Flash, and read the data during
> runtime.
> An access using array-index is prferrable.
>
> Any suggestion?
>
> 10x
>
> bz >
>
> _____________________________________
> Note: If you do a simple "reply" with your email client, only the author
> of this message will receive your answer. You need to do a "reply all" if
> you want your answer to be distributed to the entire group.
>
> _____________________________________
> About this discussion group:
>
> To Join:
>
> To Post:
>
> To Leave:
>
> Archives: http://www.yahoogroups.com/group/motoroladsp
>
> More Groups: http://www.dsprelated.com/groups.php3 > ">http://docs.yahoo.com/info/terms/
>