Hi everyone,
I am trying to make a linker and I have an odd problem. In my linker , I assign certain addresses & length to different section, but when I run the program on the the DSP, the address I assigned in the linker aren't the same in the DSP.
Here is a bit of my code where I've tried to figure out what is going on.
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
file : lnkx.cmd
MEMORY
{
PAGE 0: /* ---- Unified Program/Data Address Space ---- */
MMR (RWIX): origin = 0x000000, length = 0x0000c0 /* MMRs */
DARAM0 (RWIX): origin = 0x0000c0, length = 0x00ff40 /* 64KB - MMRs */
SARAM0 (RWIX): origin = 0x010000, length = 0x010000 /* 64KB */
SARAM1 (RWIX): origin = 0x020000, length = 0x020000 /* 128KB */
SARAM2 (RWIX): origin = 0x040000, length = 0x00FE00 /* 64KB */
VECS (WRIX): origin = 0x04FE00, length = 0x000200 /* 512B */
PDROM (RIX): origin = 0xff8000, length = 0x008000 /* 32KB */
PAGE 2: /* -------- 64K-word I/O Address Space -------- */
SPIREG (RWI) : origin = 0x003000, length = 0x14
TESTREG (RWI) : origin = 0x1000, length = 0x100
TESTREG2 (RWI) : origin = 0x0500, length = 0x100
}
/* SPECIFY THE SECTIONS ALLOCATION INTO MEMORY */
SECTIONS
{
.text >> SARAM1|SARAM2|SARAM0 /* Code */
/* Both stacks must be on same physical memory page */
.stack > DARAM0 /* Primary system stack */
.sysstack > DARAM0 /* Secondary system stack */
.data >> DARAM0|SARAM0|SARAM1 /* Initialized vars */
.bss >> DARAM0|SARAM0|SARAM1 /* Global & static vars */
.const >> DARAM0|SARAM0|SARAM1 /* Constant data */
.sysmem > DARAM0|SARAM0|SARAM1 /* Dynamic memory (malloc) */
.switch > SARAM2 /* Switch statement tables */
.cinit > SARAM2 /* Auto-initialization tables */
.pinit > SARAM2 /* Initialization fn tables */
.cio > SARAM2 /* C I/O buffers */
.args > SARAM2 /* Arguments to main() */
vectors > VECS /* Interrupt vectors */
spireg > SPIREG PAGE 2 /* SPI REGISTER */
testreg > TESTREG PAGE 2
testreg2 > TESTREG2 PAGE 2
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
i've modified the last section. At first there was ioport, but with the odd error, i've tried to see what was going on so i temporarily removed it.
and here is a bit from my main.c file where I allocate the memory to some structures.
file : main .c
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma DATA_SECTION (SPIREG,"spireg") // check out linker
#pragma DATA_SECTION (TEST,"testreg")
#pragma DATA_SECTION (TEST2,"testreg2")
// Structure instanciation to map to memory
volatile struct spi SPIREG;
volatile struct spi TEST,TEST2;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
on the DSP , SPIREG is at 0x1800 @ I/O space ( should be 0x3000 @ I/O space according to linker)
TEST is at 0x800 @ I/O space (should be at 0x1000 @ I/O space according to linker)
TEST2 is at 0x280 @ I/O space ( should be at 0x500 @I/O space according to linker)
I am completely lost on what to do next. I 've tried to see if the address change was linear but doesnt seems so.
Any help would be appreciated
Thanks
Jean-Francois