Hello,
I have some code where I use a local variable to do a few operations on memory before writing it out to memory in the CE0 space, but for some reason the local variables are being stored at memory location 0x00 which is a reserved area for registers. Because of this, the values arent stored/read correctly and it's causing issues. Some example code is
volatile unsigned long *addr;
void display_write(volatile unsigned long offset, char pixel) {
addr = display_base_address+offset;
addr = (volatile unsigned long*)(((volatile unsigned long)addr)>>1);
*addr = pixel;
}
It stores addr at 0x00 in this case. Here is my memory map
MEMORY CONFIGURATION
name origin length used unused attr fill
(bytes) (bytes) (bytes) (bytes)
---------------------- -------- --------- -------- -------- ---- --------
PAGE 0:
DARAM01 00000100 00003f00 000004eb 00003a15 RWIX
PAGE 1:
DARAM23 00004000 00004000 00000000 00004000 RWIX
SECTION ALLOCATION MAP
(Addresses surrounded by []'s are displayed for convenience only!)
output attributes/
section page orgn(bytes) orgn(words) len(bytes) len(words) input sections
-------- ---- ----------- ----------- ---------- ---------- --------------
.cinit 0 [ 00000100 ] 00000080 * 00000000 UNINITIALIZED
.text 0 00000100 [ 00000080 ] 000004b7 *
00000100 [ 00000080 ] 0000020a * McBSP.obj (.text)
0000030a [ 00000185 ] 000000e8 * EMIF.obj (.text)
000003f2 [ 000001f9 ] 000000a3 * main.obj (.text)
00000495 [ 0000024a+] 0000009d * GPIO.obj (.text)
00000532 [ 00000299 ] 00000067 * display.obj (.text)
00000599 [ 000002cc+] 0000001d * CLOCK.obj (.text)
000005b6 [ 000002db ] 00000001 * --HOLE-- [fill = 20]
.bss 0 [ 000005b8 ] 000002dc * 0000001a UNINITIALIZED
[ 000005b8 ] 000002dc * 00000010 EMIF.obj (.bss)
[ 000005d8 ] 000002ec * 00000006 display.obj (.bss)
[ 000005e4 ] 000002f2 * 00000004 main.obj (.bss)
.data 1 [ 00004000 ] 00002000 * 00000000 UNINITIALIZED
and my linker cmd file is
/****************************************************************************/
/* C5501.cmd */
/* Copyright (c) 2010 Texas Instruments Incorporated */
/* */
/* Description: This file is a sample linker command file that can be */
/* used for linking programs built with the C compiler and */
/* running the resulting .out file on a C5502. */
/* Use it as a guideline. You will want to */
/* change the memory layout to match your specific */
/* target system. You may want to change the allocation */
/* scheme according to the size of your program. */
/* */
/****************************************************************************/
-heap 0x1000
-stack 0x1000
MEMORY
{
PAGE 0 :
DARAM01 : origin = 0x000100, length = 0x003F00
PAGE 1 :
DARAM23 : origin = 0x004000, length = 0x004000
}
SECTIONS
{
.cinit > DARAM01 PAGE 0
.text > DARAM01 PAGE 0
.stack > DARAM23 PAGE 1
.sysstack > DARAM23 PAGE 1
.sysmem > DARAM23 PAGE 1
.data > DARAM23 PAGE 1
.cio > DARAM01 PAGE 0
.bss > DARAM01 PAGE 0
.const > DARAM01 PAGE 0
}