Issue while jumping to an image in non default location

Hi,

Am working on ATMEL Sam4cms based board and trying to write a basic application (lets say bootloader) which will jump to an image placed in a different location.

Here is my scatter file for bootloader which starts at 0x1000000

; *************************************************************
; *** Scatter-Loading Description File generated by uVision ***
; *************************************************************

; load region
BOOTLOADER_IROM1 0x1000000 0x100000
{ ; Execution Region ER_IROM1 0x1000000 0xFFF0 { *.o(RESET, +First) *(InRoot$$Sections) * (.init_array) .ANY (+RO) }

; RW data RW_IRAM0 0x20000000 0x00002000 { .ANY (+RW +ZI) *(HEAP) }

RW_IRAM1 0x2003F000 UNINIT 0x00001000{ ; ZI data will not be initialized to zero *(NoInit) }

}

And for App which starts at 0x01010000

; *************************************************************
; *** Scatter-Loading Description File generated by uVision ***
; *************************************************************

APP_IROM1 0x1010000 NOCOMPRESS 0xF0000 { ; load region size_region ER_IROM1 0x1010000 0xF0000 { ; load address = execution address *.o(RESET, +First) *(InRoot$$Sections) * (.init_array) .ANY (+RO) }

RW_IRAM0 0x20002000 0x0003D000 { .ANY (+RW +ZI) *(HEAP) }

RW_IRAM1 0x2003F000 UNINIT 0x00001000{ ; ZI data will not be initialized to zero *(NoInit) }

}

and the code to jump

int main()
{ __disable_irq();

std::uint32_t i = 0;

// Disable IRQs
for (i = 0; i < 8; i ++) NVIC->ICER[i] = 0xFFFFFFFF;
// Clear pending IRQs
for (i = 0; i < 8; i ++) NVIC->ICPR[i] = 0xFFFFFFFF;
// -- Modify vector table location
// Barriars
__DSB();
__ISB();

_binExec(reinterpret_cast<void *>(0x1010000 ));
}

__asm__ void _binExec (void * l_code_addr)
{ mov r1, r0 ldr r0, [r1, #4] ldr sp, [r1] /*msr msp, [r1]*/ blx r0
}

Though the value shown at r0 is inline with map file's Reset_Handler, program counter doesnot jump to that address, it simply hangs.
Getting "No Synchronisation" as keil trace error.

Can anyone please help.

Regards
Prasad

Parents Reply Children
No data
More questions in this forum