Reply by Keith Larson August 6, 20072007-08-06
Hello Najam

This is a pretty common task given that you may need to access memory
mapped registers or change interrupt vectors. Never the less there are a
number of ways to do this. Therefor you should also be considering if
this is to be done in assembler, C, or the linker, and does this require
pre-initializeation? Being a dual port ram (DPR) my guess is you will
likely want to use the linker to create a reserved memory section.

//---------
// Create a named location in ASSIGN.ASM
//---------
.sect "DPRAM" ; section name for linker
.global _DPR ; symbol name
_DPR .word 0 ; remember to underscore for C access
.text ; flip back to normal section

//---------
// Access the array in MYCODE.C
//---------
extern unsigned long DPR[];
void main(void)
{
unsigned long *dprptr
//-------------
// Simple acess the array
//-------------
DPR[0]=1; // poke in a value
//-------------
// Another method is to set a pointer. In this
// case you dont even need the ASM or linker.
// The danger is that DPR is not known to the
// linker, so you could overlap with other data.
// (Not a big problem for a good programmer?)
//-------------
dprptr = (unsigned long *)0x5000033;
dprptr = 2; // poke in another value
}

//---------
// Place DPARRAY using MYLINK.CMD
// assumes compiler & assembler have been called
// to creat the OBJ files
//---------
mycode.obj assign.obj
-cr
-o par_eq.out
-l rts30.lib
-heap 32
-stack 32
MEMORY
{
BOOTRSRV : org=0x809800, len=0x0002 /* Dont load here if bootloading */
EXTLOW : org=0x000000, len=0x4000 /* External RAM for EVM */
RAM0 : org=0x809802, len=0x06fd /* INTERNAL BLK 0 */
KERNEL : org=0x809F00, len=0x00C0 /* INTERNAL BLK 1 */
BRNCHTBL : org=0x809FC5, len=0x0010 /* INTERNAL BLK 1 */
RAM2 : org=0x800000, len=0x4000 /* INTERNAL BLK 2 */
RAM3 : org=0x804000, len=0x4000 /* INTERNAL BLK 3 */
}
SECTIONS
{
.text : {} > RAM0
.cinit : {} > RAM2
.data : {} > RAM2
.bss : {} > RAM2
.sysmem : {} > RAM2
.const : {} > RAM2
.stack : {} > RAM2
BRTBL : {} > BRNCHTBL
VECTS : {} > EXTLOW
DPRAM : {} > RAM3 /* <-- DPR placed here */
}

======================================================e...@yahoo.com wrote:

Hi,

i want to memory map an array variable in a external memory at
specicific location.

My memory DPR is maped at address 0x5000000 and i want to declare an
array at address 0x5000033

suppose

unsigned int myarray[100];

How can i memory map it at address 0x5000033.?

Regards.

N a j a m
Reply by engn...@yahoo.com August 3, 20072007-08-03
Hi,

i want to memory map an array variable in a external memory at specicific location.

My memory DPR is maped at address 0x5000000
and i want to declare an array at address 0x5000033

suppose

unsigned int myarray[100];

How can i memory map it at address 0x5000033.?

Regards.

N a j a m