Reply by Art Johnson November 8, 20022002-11-08
Here's how we do that sort of thing here (an example from one of our products,
in the "linker.cmd" file):

In the "MEMORY" section:

.xExtUartA (RW) : ORIGIN = 0x4000, LENGTH = 0x0008
.xExtReservedA (RW) : ORIGIN = 0x4008, LENGTH = 0x0FF8
.xExtUartB (RW) : ORIGIN = 0x5000, LENGTH = 0x0008
.xExtReservedB (RW) : ORIGIN = 0x5008, LENGTH = 0x0FF8
.xExtFlash (RW) : ORIGIN = 0x6000, LENGTH = 0x1000
.xExtRTC (RW) : ORIGIN = 0x7000, LENGTH = 0x0010
.xExtReservedC (RW) : ORIGIN = 0x7010, LENGTH = 0x0FF0
.xExtRAM (RW) : ORIGIN = 0x8000, LENGTH = 0x7F80
.xExtRAM_Mirror (RWX) : ORIGIN = 0x8000, LENGTH = 0x7F80 In the "SECTIONS" section (at the end of the file):

FExtUartA = ADDR(.xExtUartA);
FExtUartB = ADDR(.xExtUartB);
FExtFlash = ADDR(.xExtFlash);
FExtRTC = ADDR(.xExtRTC);
FExtRAM = ADDR(.xExtRAM); In one (or more) of the header (.h) files in your program:

/* The location of the following structure is defined in linker.cmd */
extern XR16C2850_REGISTERS_T ExtUartA;
/* The location of the following structure is defined in linker.cmd */
extern XR16C2850_REGISTERS_T ExtUartB;
/* The location of the following array is defined in linker.cmd */
extern volatile WORD ExtFlash[];
/* The location of the following structure is defined in linker.cmd */
extern RTC7301SF_REGISTERS_T ExtRTC;
/* The location of the following array is defined in linker.cmd */
extern volatile WORD ExtRAM[]; The above system is one of our custom designs that uses the '807 chip, so your
memory map will be similar but NOT the same. What the above does is the
following:

1) Assigns the XR16C2850_REGISTERS_T structure "ExtUartA" to be at address
X:$4000
2) Assigns the XR16C2850_REGISTERS_T structure "ExtUartB" to be at address
X:$5000
3) Assigns the volatile WORD array "ExtFlash" to be at address X:$6000
4) Assigns the RTC7301SF_REGISTERS_T structure "ExtRTC" to be at address X:$7000
5) Assigns the volatile WORD array "ExtRAM" to be at address X:$8000

Please note that in every case, the Linker Command File "linker.cmd" has the
letter "F" added to the beginning of the variable name, this is a CodeWarrior
convention.

I am posting this message to the motoroladsp discussion group, as it contains
information that should be useful to other members.

I hope you find this information to be helpful.

Regards,

Art Johnson
Senior Systems Analyst
PMC Prime Mover Controls Inc.
3600 Gilmore Way
Burnaby, B.C., Canada
V5G 4R8
Phone: 604 433-4644
FAX: 604 433-5570
Email:
http://www.pmc-controls.com

-----Original Message-----
From: joyee_zrr1023 [mailto:]
Sent: Thursday, November 07, 2002 7:43 PM
To: Art Johnson
Subject: Re: RE: Help!About location of global variable using
CodeWarrior[motoroladsp5 Hi, how are you!
Thank you for your answers! I have put my global variables which
need to be located at the External Ram, listed as follow:

********* extram_data.c *******************
#define ADCHANNEL 36
#define NSAMPLE 24
#define ADBUFSIZE ADCHANNEL+2
#define NPHASOR 4
#define PHASORBUFSIZE ADCHANNEL*2+2

int Configure[5];
int CurrentValid[3];
int ADState1[8];
int ADBuf1Flag;
int ADBuf1[NSAMPLE][ADBUFSIZE];
int PhasorBuf1Flag;
int PhasorBuf1[NPHASOR][PHASORBUFSIZE];
int ADState2[8];
int ADBuf2Flag;
int ADBuf2[NSAMPLE][ADBUFSIZE];
int PhasorBuf2Flag;
int PhasorBuf2[NPHASOR][PHASORBUFSIZE];

And after debug, I found they are located at the External Ram showed
in the file M56800.elf.xMAP , listed as follow:

# .DataForExtDataRAM
00006000 00000128 .bss FPhasorBuf2 (extram_data.c)
00006128 00000001 .bss FPhasorBuf2Flag (extram_data.c)
00006129 00000390 .bss FADBuf2 (extram_data.c)
000064B9 00000001 .bss FADBuf2Flag (extram_data.c)
000064BA 00000008 .bss FADState2 (extram_data.c)
000064C2 00000128 .bss FPhasorBuf1 (extram_data.c)
000065EA 00000001 .bss FPhasorBuf1Flag (extram_data.c)
000065EB 00000390 .bss FADBuf1 (extram_data.c)
0000697B 00000001 .bss FADBuf1Flag (extram_data.c)
0000697C 00000008 .bss FADState1 (extram_data.c)
00006984 00000003 .bss FCurrentValid (extram_data.c)
00006987 00000005 .bss FConfigure (extram_data.c)

But I have another question, how can I put the arrays at the
designated location, for example,
the Configure[5] at 0x6000-0xt6004, and the CurrentValid[3] at 0x6010-
0x6012,etc.?

Eager for a bone!:( Thank you!:)
>Please see the attached messages for an explanation of how to do
this. All of these messages were posted to the motoroladsdp
discussion group on Yahoo.
>
>Regards,
>
>Art Johnson
>Senior Systems Analyst
>PMC Prime Mover Controls Inc.
>3600 Gilmore Way
>Burnaby, B.C., Canada
>V5G 4R8
>Phone: 604 433-4644
>FAX: 604 433-5570
>Email:
>http://www.pmc-controls.com >
>-----Original Message-----
>From: joyee_zrr1023 [mailto:]
>Sent: Wednesday, November 06, 2002 10:55 PM
>To: Art Johnson
>Subject: Help!!About location of global variable using CodeWarrior
>[motoroladsp56f807] >Hi! I am new to the motorola dsp56f807. Maybe my question is easy to
>answer but it puzzled me very much!
>
>In my main.c, I want to specify some global variables which need to
>be located at x.external, listed as follow:
>
>********** main.c **********
>int Configure[5];
>int CurrentValid[3];
>int ADState1[8];
>int ADBuf1Flag;
>int ADBuf1[NSAMPLE][ADBUFSIZE];
>int PhasorBuf1Flag;
>int PhasorBuf1[NPHASOR][PHASORBUFSIZE];
>int ADState2[8];
>int ADBuf2Flag;
>int ADBuf2[NSAMPLE][ADBUFSIZE];
>int PhasorBuf2Flag;
>int PhasorBuf2[NPHASOR][PHASORBUFSIZE];
>
>I set several sections for these global variable and appointed the
>addresses to them, listed as follow:
>
>********** linker.cmd **********
>MEMORY {
> .text (RWX) : ORIGIN = 0x1000, LENGTH = 0x00000000
> .data (RW) : ORIGIN = 0x0000, LENGTH = 0x00000000
> .temp1 (RW) : ORIGIN = 0x6000, LENGTH = 0x00000000
> .temp2 (RW) : ORIGIN = 0x6010, LENGTH = 0x00000000
> .temp3 (RW) : ORIGIN = 0x6020, LENGTH = 0x00000000
> .temp4 (RW) : ORIGIN = 0x6030, LENGTH = 0x00000000
> .temp5 (RW) : ORIGIN = 0x6031, LENGTH = 0x00000000
> .temp6 (RW) : ORIGIN = 0x63C1, LENGTH = 0x00000000
> .temp7 (RW) : ORIGIN = 0x63C2, LENGTH = 0x00000000
> .temp8 (RW) : ORIGIN = 0x6820, LENGTH = 0x00000000
> .temp9 (RW) : ORIGIN = 0x6830, LENGTH = 0x00000000
> .temp10 (RW) : ORIGIN = 0x6831, LENGTH = 0x00000000
> .temp11 (RW) : ORIGIN = 0x6BC1, LENGTH = 0x00000000
> .temp12 (RW) : ORIGIN = 0x6BC2, LENGTH = 0x00000000
>} >SECTIONS {
> .main_application :
> {
> # .text sections
>
> * (.text)
> * (rtlib.text)
> * (fp_engine.text)
> * (user.text)
> } > .text
>
> .main_application_data :
> {
> # .data sections
> * (.data)
> * (fp_state.data)
> * (rtlib.data)
>
> # .bss sections
>
> * (rtlib.bss.lo)
> * (.bss)
> } > .data
>
> FConfigure = ADDR(.temp1);
> FCurrentValid = ADDR(.temp2);
> FADState1 = ADDR(.temp3);
> FADBuf1Flag = ADDR(.temp4);
> FADBuf1 = ADDR(.temp5);
> FPhasorBuf1Flag = ADDR(.temp6);
> FPhasorBuf1 = ADDR(.temp7);
> FADState2 = ADDR(.temp8);
> FADBuf2Flag = ADDR(.temp9);
> FADBuf2 = ADDR(.temp10);
> FPhasorBuf2Flag = ADDR(.temp11);
> FPhasorBuf2 = ADDR(.temp12);
>} >But I found they still occupy the x.ram in the file M56800.elf.xMAP
>while they also located at the x.external, listed as follow:
>
>00000680 00000128 .bss FPhasorBuf2 (dft0.c)
>000007A8 00000001 .bss FPhasorBuf2Flag (dft0.c)
>000007A9 00000390 .bss FADBuf2 (dft0.c)
>00000B39 00000001 .bss FADBuf2Flag (dft0.c)
>00000B3A 00000008 .bss FADState2 (dft0.c)
>00000B42 00000128 .bss FPhasorBuf1 (dft0.c)
>00000C6A 00000001 .bss FPhasorBuf1Flag (dft0.c)
>00000C6B 00000390 .bss FADBuf1 (dft0.c)
>00000FFB 00000001 .bss FADBuf1Flag (dft0.c)
>00000FFC 00000008 .bss FADState1 (dft0.c)
>00001004 00000003 .bss FCurrentValid (dft0.c)
>
># Memory map:
>00006000 00000000 .temp1
>00006010 00000000 .temp2
>00006020 00000000 .temp3
>00006030 00000000 .temp4
>00006031 00000000 .temp5
>000063C1 00000000 .temp6
>000063C2 00000000 .temp7
>00006820 00000000 .temp8
>00006830 00000000 .temp9
>00006831 00000000 .temp10
>00006BC1 00000000 .temp11
>00006BC2 00000000 .temp12
>
>I think maybe I use a wrong method to locate these global variables,
>eager for a correct bone!
>Thank you very much!
>------------------------
>From: "Art Johnson" <>
>To: "Gonggh" <>
> <>
>Subject: RE: [motoroladsp] A question about SDK?
>Date: Wed18 Sep 2002 08:35:39 -0800
>
>You can use the Flash target without any changes. Although the
Linker Command File "linker.cmd" states that:
>"# Linker.cmd file for DSP56803EVM/DSP56805EVM
> # using internal data memory only ( EX = 0, Boot Mode
0A )",
>the fact that the EX bit is 0 does not prevent you from using
external xRAM.
>
>You can put xRAM .bss sections into the external xRAM by doing the
following in your Linker Command File "linker.cmd":
>
>In the "MEMORY" section:
> .xExtRAM (RW) : ORIGIN = 0x2000, LENGTH = 0xDF80
> .xExtRAM_Mirror (RWX) : ORIGIN = 0x2000, LENGTH = 0xDF80
>
>In the "SECTIONS" section:
>#********************************************************************
***********
> .DataForExtDataRAM :
> {
>
> # .bss sections
>
> extram_data.c (.bss)
>
> } > .xExtRAM_Mirror
>#********************************************************************
***********
>
>The above will put all uninitialized data (.bss) from the
file "extram_data.c" into the external xRAM area. We have done this
and it works for us in our projects. It is much more difficult to
put the initialized data (.data) section into external xRAM because
you would have to modify the startup code in the SDK file "arch.c",
and somehow differentiate between .data going to internal xRAM
and .data going to external xRAM. We don't think it is worth all the
effort that would be involved, so we just put the selected .bss
sections into the external xRAM.
>
>I hope this helps, please let me know if you have any questions
about this.
>
>Regards,
>
>Art Johnson
>Senior Systems Analyst
>PMC Prime Mover Controls Inc.
>3600 Gilmore Way
>Burnaby, B.C., Canada
>V5G 4R8
>Phone: 604 433-4644
>FAX: 604 433-5570
>Email:
>http://www.pmc-controls.com >> -----Original Message-----
>> From: Gonggh [mailto:]
>> Sent: Wednesday, September 18, 2002 8:22 AM
>> To:
>> Subject: [motoroladsp] A question about SDK?
>>
>> HI all:
>> Using Codewarrier for 56800 5.0 and Motorola SDK2.5, can I
create a project using internal pFLASH and external xRAM on
DSP56805EVM. The default setting from SDK is just flash( use
internal memory only) and external RAM (use external memory only )
while CW5.0 can provide such a target setting.
>> Any suggestion is welcome.
>> ggh
>------------------------
>------------------------
>From: "Art Johnson" <>
>To: "Gonggh" <>
>Subject: RE: [motoroladsp] A question about SDK?
>Date: Fri20 Sep 2002 04:19:13 -0800
>
>Yes, put in all the file names where you want the uninitialized data
(.bss) placed into the external xRAM area.
>
>We have found it to be very convenient to add a file
named "extram_data.c" to all of our projects, because then it is
easier to put the .bss data into the external xRAM area. If you put
all of the .bss data into the file "extram_data.c", then you do not
have to edit the "linker.cmd" file each time you add another .c file
to your project.
>

>
>