DSPRelated.com
Forums

RE: Writing to external Program memory

Started by Art Johnson December 9, 2002
Hi Roger,

Here's how we do that sort of thing here (an example from one of our products,
in the "linker.cmd" file). This example is for an '807 chip and external Data
(X) memory, but the same thing will work for external P memory on the '803 and
'805 chips. You do have to remember to use the SDK P memory access functions
like memReadP16(), memWriteP16(), etc. when accessing any data in P memory, or
to write your interface functions in assembler and use the P memory addressing
modes when accessing this data.

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: Roger Flor [mailto:]
Sent: Sunday, December 08, 2002 8:25 PM
To: Art Johnson
Subject: Writing to external Program memory Hello Art,

I need some help. I am going to use a DSP56F803 but at the moment I am doing exploratory
programming in a DSP56F805 EVM.

I want to operate in Mode 0B and EX=0 mode. I want both program and data
mamories to have external extensions.

How do I write to external program memory using C (SDK)?

I don't actually have an SRAM for external program memory (my SRAM is only
for external data memory). I want to map an LCD controller to external
program memory instead. That's why I need to write data to external program
memory. I dont want to do address decoding, that's why I am not mapping the
LCD controller to external data memory. I will be using the /PS signal as my
LCD controller enable signal. Thanks in advance.

Roger

PS. If you feel that this might be useful in the yahoogroup, please feel
free to post this in the group. Thanks. _________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.
http://join.msn.com/?pageatures/virus