Running a C application from a different address than 0

0

I have two applications one is just starting the second application on the adress 0x20000 I can debug in the first application and it reaches the line that will redirect to the 0x20000 the address.

The code from the first application looks like this:

uint32_t a_StartAddress = (uint32_t)(uint32_t *)0x20000;
((void (*)(void))a_StartAddress)();

Both applications are developed in CCS for TMS570LS033x, but when the application is started at 0x20000 nothing happens. Is there a setting that I am missing to let the code start from a different address then 0? I am happy for suggestions, thanks in advance

(There is enough room in flash for both programs, the Application runs if I flash it on address 0x00000).

Disassembly on the code

  280 uint32_t a_StartAddress = (uint32_t)(uint32_t *)0x20000;
  00005618: E3A0C802 mov r12, #0x20000
  0000561c: E58DC010 str r12, [sp, #0x10]

  281 ((void (*)(void))a_StartAddress)();
  00005620: E59DC010 ldr r12, [sp, #0x10]
  00005624: E12FFF3C blx r12

sys_link.cmd

MEMORY
{
VECTORS (X) : origin=0x00000000 length=0x00000020 vfill = 0xFFFFFFFF
FLASH0 (RWX) : origin=0x00000020 length=0x0001FFE0 fill = 0xFFFFFFFF 
STACKS (RW) : origin=0x08000000 length=0x00001500
SRAM (RWX) : origin=0x08001500 length=0x00006B00
}

SECTIONS
{
.intvecs : {} > VECTORS

.TI.ramfunc : {} load=FLASH0, run=SRAM, table(BINIT)

.text : {} palign=8 > FLASH0
.const : {} palign=8 > FLASH0
.cinit : {} palign=8 > FLASH0
.pinit : {} palign=8 > FLASH0
.data : {} > SRAM
.bss : {} > SRAM
.sysmem : {} > SRAM
.binit : {} > FLASH0
}
c
code-composer
tms570
asked on Stack Overflow Aug 20, 2020 by Tobias Forsén • edited Aug 20, 2020 by Tobias Forsén

1 Answer

0

I fixed it, The issue was in the linker file! i needed to change the linker file as such:

MEMORY
{
VECTORS (X) : origin=0x00020000 length=0x00000020 vfill = 0xFFFFFFFF
FLASH0 (RWX) : origin=0x00020020 length=0x0001FFE0 fill = 0xFFFFFFFF 
STACKS (RW) : origin=0x08000000 length=0x00001500
SRAM (RWX) : origin=0x08001500 length=0x00006B00
answered on Stack Overflow Aug 24, 2020 by Tobias Forsén

User contributions licensed under CC BY-SA 3.0