Reply by Matteo August 5, 20052005-08-05
Try to use this one as linker.cmd:
You should create, in your project, a file called appconst.c.
Into this file you can put all the constants you want to allocate into
the data flash memory.

Good luck!

P.S. I'm using a CodeWarrior older version than your: 4.5

# Linker.cmd file for DSP56807EVM
# using internal data memory only ( EX = 0, Boot Mode 0A )

#*************************************************
******************************
MEMORY {
.pInterruptVector (RX) : ORIGIN = 0x0000, LENGTH = 0x0086
.pFlash (RX) : ORIGIN = 0x0086, LENGTH = 0xEF7A
.pIntRAM (RWX) : ORIGIN = 0xF000, LENGTH = 0x0800
.pIntRAM_Mirror (RWX) : ORIGIN = 0xF000, LENGTH = 0x0800
.pBootFlash (RX) : ORIGIN = 0xF800, LENGTH = 0x0800

.xAvailable (RW) : ORIGIN = 0x0000, LENGTH = 0x0030
.xCWRegisters (RW) : ORIGIN = 0x0030, LENGTH = 0x0010
.xIntRAM (RW) : ORIGIN = 0x0040, LENGTH = 0x0E60
.xIntRAM_Mirror (RWX) : ORIGIN = 0x0040, LENGTH = 0x0E60
.xStack (RW) : ORIGIN = 0x0EA0, LENGTH = 0x0160
.xPeripherals (RW) : ORIGIN = 0x1000, LENGTH = 0x0800
.xReserved (R) : ORIGIN = 0x1800, LENGTH = 0x0800
.xFlash (R) : ORIGIN = 0x2000, LENGTH = 0x2000
.xExtRAM (R) : ORIGIN = 0x4000, LENGTH = 0xBF80
.xCoreRegisters (RW) : ORIGIN = 0xFF80, LENGTH = 0x0080

}
#*************************************************
******************************

# FORCE_ACTIVE {FhardwareAndWatchdogResetVector}
FORCE_ACTIVE {FconfigInterruptVector}

SECTIONS {

#*************************************************
******************************
.HardwareAndWatchdogResetVector :
{
# Vectors for Reset and One must be mapped to Boot Flash to be
programmed
# correctly since this area is shaddowed between 0x000-0x0003
and
# 0xF800-0xF803
# vectorreset.c (.text)

} > .pBootFlash

.ApplicationInterruptVector :
{
vector.c (.text)

} > .pInterruptVector
#*************************************************
******************************
.ApplicationCode :
{
# Place all code into Program Flash

* (.text)
* (rtlib.text)
* (fp_engine.text)
* (user.text)

} > .pFlash
#*************************************************
******************************
.InitializedDataForProgramRAM : AT (ADDR(.pFlash) + 1 +
SIZEOF(.pFlash) / 2)
{
# Define variables for C initialization code of Program RAM data

F_Pdata_start_addr_in_ROM = ADDR(.pFlash) + 1 + SIZEOF(.pFlash) / 2;
F_Pdata_start_addr_in_RAM = .;
_P_DATA_ADDR = .;

# SDK initialized data to be placed into Program RAM

pramdata.c (.data)
F_Pdata_ROMtoRAM_length = . - _P_DATA_ADDR;

} > .pIntRAM_Mirror
#*************************************************
******************************
.InitializedConstData :
{
const.c (.data)
appconst.c (.data)
} > .xFlash
#*************************************************
******************************
.ApplicationInitialzedData : AT (ADDR(.pFlash) + 1 +
SIZEOF(.pFlash) / 2 + SIZEOF(.pIntRAM_Mirror) / 2 + 1 )
{
# Define variables for C initialization code

F_Xdata_start_addr_in_ROM = ADDR(.pFlash) + 1 + SIZEOF(.pFlash) / 2
+ SIZEOF(.pIntRAM_Mirror) / 2 + 1;
F_StackAddr = ADDR(.xStack);
F_StackEndAddr = ADDR(.xStack) + SIZEOF(.xStack) / 2 -
1;
F_Xdata_start_addr_in_RAM = .;
_X_DATA_ADDR = .;

# Place rest of the data into Internal Data RAM

* (.data)
* (fp_state.data)
* (rtlib.data)

F_Xdata_ROMtoRAM_length = . - _X_DATA_ADDR;

} > .xIntRAM_Mirror
#*************************************************
******************************
.DataForProgramRAM :
{

# allocates space for .InitializedDataForProgramRAM section

. = (ADDR(.pIntRAM_Mirror) + SIZEOF(.pIntRAM_Mirror) / 2) + 1;

# Define variables for C initialization code of Program RAM bss

F_Pbss_start_addr = .;
_P_BSS_ADDR = .;

# SDK uninitialized data to be placed into Program RAM

pramdata.c (.bss)

F_Pbss_length = . - _P_BSS_ADDR;

} > .pIntRAM
#*************************************************
******************************
.DataForDataRAM :
{
# allocates space for .ApplicationInitializedData section

. = (ADDR(.xIntRAM_Mirror) + SIZEOF(.xIntRAM_Mirror) / 2);

# Define variables for C initialization code

F_Xbss_start_addr = .;
_X_BSS_ADDR = .;

# .bss sections

* (rtlib.bss.lo)
* (rtlib.bss)
* (.bss)

F_Xbss_length = . - _X_BSS_ADDR;

} > .xIntRAM
#*************************************************
******************************

FArchIO = ADDR(.xPeripherals);
FArchCore = ADDR(.xCoreRegisters);
}

--- In motoroladsp@moto..., Charlie W <charliewtx@y...> wrote:
> If i remember correctly. In your codewarrior
> stationery, there is a file called constant.c that was
> created by codewarrior is used to store constant in
> data flash.
>
> --- christian.epp@g... wrote:
>
> > Hi all
> >
> > On Friday 17 June 2005 01:52, Michael W. Mann wrote:
> >
> > > You can use data flash to store constants in flash
> > instead of data
> > > RAM. This can be done with a properly constructed
> > linker command
> >
> > Hmmm. I tried that last week! Didnt't work! (OK, I
> > have to admit, I use really
> > old Codewarrior for Motorola DSP56800 version 5.0.5)
> >
> > I tried "const data to .rodata section"-swich and
> > declared data "const". Added
> > * (.rodata) for the my .x.flash section -> linker
> > puts it in .data section
> > in X-RAM.
> >
> > I tried the OBJECT (data,file) directive in the
> > linker command file to put the
> > data in .x.flash memory-> linker puts it in .data
> > section in X-RAM.
> >
> > I tried lots of other things -> linker puts it in
> > .data section in X-RAM. He
> > really knowns what he wants. But he doesnt't know
> > what I want him to want :-)
> >
> > I even tried to use the X-FLASH as copy source for
> > initialized data (with the
> > AT() directive) -> even that didn't work. The
> > Motorola guys probably had a
> > reason to put the initialized data mirror in the
> > P-FLASH and copy it from
> > there (in their SDK).
> >
> > I must admit, I am not up to date with my
> > development suit. Is this a known
> > bug of the old linker ? Anyone heard of that ?
> >
> > Christian
> >
> >
> >
> >
> >
> >
> >
> > motoroladsp-unsubscribe@moto...
> >
> >
> >
> >
> >
>
> __________________________________
>


Reply by Litinas, Terry July 12, 20052005-07-12
Christian,

I use CodeWarrior 5.1.1 and have been able to place constants in 56F807 data
flash using the #pragmas define_section and section. Below is an example.

Hope this helps.

Terry Litinas

/***************************************************************************
*************************************/
/* Store these error code lookup tables in data flash */
#pragma define_section xFlash ".constants.data" RW

#pragma section xFlash begin
const SharcErrorLookup SharcSystemErrors[] =
{
{SYSTEM_ERR_BAD_PARAM, InternalBadParameter},
{SYSTEM_ERR_MATH, InternalMathError},
{SYSTEM_ERR_SDRAM_TEST_FAIL, SdramTestFailed},
{SYSTEM_ERR_FPGA_BANK1_TEST_FAIL, MainFpgaFailed},
{SYSTEM_ERR_APP_INIT_FAIL, NoHWError},
};

const SharcErrorLookup SharcEncoderErrors[] =
{
{ENC_ERROR_ALREADY_INIT, DuplicateInit},
{ENC_ERROR_BAD_MODE, InvalidCountMode},
{ENC_ERROR_BAD_EDGE, InvalidCaptureEdge},
{ENC_ERROR_WRITE_TO_READ_ONLY_REGISTER, InvalidWriteAccess},
{ENC_ERROR_BAD_INDEX, InvalidSyncSelect},
{APP_BAD_ENC_INTERRUPT_ERROR, InvalidInterrupt},
};

#pragma section xFlash end
/***************************************************************************
*************************************/

If i remember correctly. In your codewarrior
stationery, there is a file called constant.c that was
created by codewarrior is used to store constant in
data flash.

--- christian.epp@chri... wrote:

> Hi all
>
> On Friday 17 June 2005 01:52, Michael W. Mann wrote:
>
> > You can use data flash to store constants in flash
> instead of data
> > RAM. This can be done with a properly constructed
> linker command
>
> Hmmm. I tried that last week! Didnt't work! (OK, I
> have to admit, I use really
> old Codewarrior for Motorola DSP56800 version 5.0.5)
>
> I tried "const data to .rodata section"-swich and
> declared data "const". Added
> * (.rodata) for the my .x.flash section -> linker
> puts it in .data section
> in X-RAM.
>
> I tried the OBJECT (data,file) directive in the
> linker command file to put the
> data in .x.flash memory-> linker puts it in .data
> section in X-RAM.
>
> I tried lots of other things -> linker puts it in
> .data section in X-RAM. He
> really knowns what he wants. But he doesnt't know
> what I want him to want :-)
>
> I even tried to use the X-FLASH as copy source for
> initialized data (with the
> AT() directive) -> even that didn't work. The
> Motorola guys probably had a
> reason to put the initialized data mirror in the
> P-FLASH and copy it from
> there (in their SDK).
>
> I must admit, I am not up to date with my
> development suit. Is this a known
> bug of the old linker ? Anyone heard of that ?
>
> Christian


Reply by Charlie W July 2, 20052005-07-02
If i remember correctly. In your codewarrior
stationery, there is a file called constant.c that was
created by codewarrior is used to store constant in
data flash.

--- christian.epp@chri... wrote:

> Hi all
>
> On Friday 17 June 2005 01:52, Michael W. Mann wrote:
>
> > You can use data flash to store constants in flash
> instead of data
> > RAM. This can be done with a properly constructed
> linker command
>
> Hmmm. I tried that last week! Didnt't work! (OK, I
> have to admit, I use really
> old Codewarrior for Motorola DSP56800 version 5.0.5)
>
> I tried "const data to .rodata section"-swich and
> declared data "const". Added
> * (.rodata) for the my .x.flash section -> linker
> puts it in .data section
> in X-RAM.
>
> I tried the OBJECT (data,file) directive in the
> linker command file to put the
> data in .x.flash memory-> linker puts it in .data
> section in X-RAM.
>
> I tried lots of other things -> linker puts it in
> .data section in X-RAM. He
> really knowns what he wants. But he doesnt't know
> what I want him to want :-)
>
> I even tried to use the X-FLASH as copy source for
> initialized data (with the
> AT() directive) -> even that didn't work. The
> Motorola guys probably had a
> reason to put the initialized data mirror in the
> P-FLASH and copy it from
> there (in their SDK).
>
> I must admit, I am not up to date with my
> development suit. Is this a known
> bug of the old linker ? Anyone heard of that ?
>
> Christian >
>
> motoroladsp-unsubscribe@moto...

__________________________________


Reply by Yochum, William June 17, 20052005-06-17
Christian,

I'm using CodeWarrior 4.1. We had the same problem.

The (.rodata) section wasn't supported.

My solution was a bit of a kludge. I created a special linker
section that explicitly listed all files that contained constant data.

MEMORY
{
...
.dflash (R) : ORIGIN = 0x2000, LENGTH = 0x1FFF # DATA FLASH
...
}

#
# Build a constants section
# manually insert files here (as needed)
#
.constants :
{
file1.c (.data)
file2.c (.data)
fileN.c (.data)
* (.rodata)
} > .dflash

Any files appearing in the ".constants" section, now take initialized
data and treat it as a data flash constant. But be careful because
this places a special burden on the program files to PREVENT use of
initialized variables unless those variables are treated as constants!

William C. Yochum Microwave Data Systems Inc.
Principal Eng./Software 175 Science Parkway
Phone: (585) 242-8319 Rochester, NY 14620
FAX: (585) 241-5590 USA
> -----Original Message-----
> From: christian.epp@chri... [mailto:christian.epp@chri...]
> Sent: Friday, June 17, 2005 2:32 AM
> To: motoroladsp@moto...
> Subject: Re: [motoroladsp] Re: how to use data_flash of dsp56f807 ? > Hi all
>
> On Friday 17 June 2005 01:52, Michael W. Mann wrote:
>
> > You can use data flash to store constants in flash instead of data
> > RAM. This can be done with a properly constructed linker command
>
> Hmmm. I tried that last week! Didnt't work! (OK, I have to
> admit, I use really
> old Codewarrior for Motorola DSP56800 version 5.0.5)
>
> I tried "const data to .rodata section"-swich and declared
> data "const". Added
> * (.rodata) for the my .x.flash section -> linker puts it in
> .data section
> in X-RAM.
>
> I tried the OBJECT (data,file) directive in the linker
> command file to put the
> data in .x.flash memory-> linker puts it in .data section in X-RAM.
>
> I tried lots of other things -> linker puts it in .data
> section in X-RAM. He
> really knowns what he wants. But he doesnt't know what I want
> him to want :-)
>
> I even tried to use the X-FLASH as copy source for
> initialized data (with the
> AT() directive) -> even that didn't work. The Motorola guys
> probably had a
> reason to put the initialized data mirror in the P-FLASH and
> copy it from
> there (in their SDK).
>
> I must admit, I am not up to date with my development suit.
> Is this a known
> bug of the old linker ? Anyone heard of that ?
>
> Christian

The information contained in this message is confidential and intended only
for use of the designated recipient(s) named above. If the reader of this
message is not the intended recipient or an agent responsible for delivering
it to the intended recipient, you are hereby notified that you have received
this message in error, and that any review, dissemination, distribution,
copying, or alteration of this message is strictly prohibited. If you have
received this communication in error, please notify the originator
immediately and remove it from your system.


Reply by chri...@gmx.net June 17, 20052005-06-17
Hi all

On Friday 17 June 2005 01:52, Michael W. Mann wrote:

> You can use data flash to store constants in flash instead of data
> RAM. This can be done with a properly constructed linker command

Hmmm. I tried that last week! Didnt't work! (OK, I have to admit, I use really
old Codewarrior for Motorola DSP56800 version 5.0.5)

I tried "const data to .rodata section"-swich and declared data "const". Added
* (.rodata) for the my .x.flash section -> linker puts it in .data section
in X-RAM.

I tried the OBJECT (data,file) directive in the linker command file to put the
data in .x.flash memory-> linker puts it in .data section in X-RAM.

I tried lots of other things -> linker puts it in .data section in X-RAM. He
really knowns what he wants. But he doesnt't know what I want him to want :-)

I even tried to use the X-FLASH as copy source for initialized data (with the
AT() directive) -> even that didn't work. The Motorola guys probably had a
reason to put the initialized data mirror in the P-FLASH and copy it from
there (in their SDK).

I must admit, I am not up to date with my development suit. Is this a known
bug of the old linker ? Anyone heard of that ?

Christian


Reply by Michael W. Mann June 16, 20052005-06-16
--- In motoroladsp@moto..., "wysxtrue88" <wy_sx88@s...> wrote:
> Hi,
> I want to use data_flash as non volatile memory. How can i do to read
> and write variables in data_flash of dsp56f807 ?
> Thanks.

You can use data flash to store constants in flash instead of data
RAM. This can be done with a properly constructed linker command file.

If you want to store new data after boot, remember that unused flash
words are all 0xFFFF. Programming flash means writing zeros. You can
program individual words but have to erase flash a page at a time.

You can use the flash primitives found in Processor Expert.



Reply by wysxtrue88 June 15, 20052005-06-15
Hi,
I want to use data_flash as non volatile memory. How can i do to read
and write variables in data_flash of dsp56f807 ?
Thanks.