Sign in

username:

password:



Not a member?

Search c3x



Search tips

Subscribe to c3x



c3x by Keywords

Boot | C31 | TMS320VC33 | VC33

Discussion Groups

Discussion Groups | TMS320C3x | Defining array in memory other than .bss

Technical discussions about the TI C3x DSPs (including the C31, C32 and C33 DSPs).

  

Post a new Thread

Defining array in memory other than .bss - engn...@yahoo.com - Aug 3 7:42:04 2007



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



(You need to be a member of c3x -- send a blank email to c3x-subscribe@yahoogroups.com )

Re: Defining array in memory other than .bss - Keith Larson - Aug 6 8:10:50 2007

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



(You need to be a member of c3x -- send a blank email to c3x-subscribe@yahoogroups.com )