We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello,
I'm working on a bootloader for the lpc1754. This bootloader downloads an application to flash (address 0x6000). When download is succesfull, it has start the new software from address 0x6000.
For the application, I've used the following code:
int main (void) { cpu_clock (12); SystemInit (); timer_init (); // initialize timer /* turn light on and off */ BlinkLight(); /* endless loop */ while(1) { // Every time timer elapses, the light turns on/off timer_scheduler (); } }
The light blinks when building for IROM1=0x0, IRAM1=0x10000000. I want to download this application to address 0x6000, so I build this application with IROM1=0x6000, IRAM1=0x10000000 (when downloading this build, the application does of course not work, for starting from address 0x6000).
I download this application (with IROM1=0x6000) to address 0x6000 succesfully. The bootloader jumps to address 0x6000. After this, the application does not start up.
#define _APPLIC_ADDR 0x00006000 void execute_user_code(void) { SCB->VTOR = (_APPLIC_ADDR & 0x1FFFFF80); // set vector table to this address. // bit 29 = 0, because address is FLASH boot_jump(_APPLIC_ADDR); // jump to address. } __asm void boot_jump( uint32_t address ) { LDR SP, [R0] ;Load new stack pointer address LDR PC, [R0, #4] ;Load new program counter address }
When debugging, we go to the 'execute_user_code' function and go to the function 'boot_jump'.
In debugging, the following secuency takes place after the boot_jump function: _rt_exit, rt_lib_shutdown, rt_lib_shutdown_user_alloc_1, rt_exit_exit, _sys_exit.
In _sys_exit, the program gets stuck at BKPT.
_sys_exit: 0x00002844 4901 LDR r1,[pc,#4] ; @0x0000284C 0x00002846 2018 MOVS r0,#0x18 0x00002848 BEAB BKPT 0xAB 0x0000284A E7FE B 0x0000284A 0x0000284C 0026 MOVS r6,r4 0x0000284E 0002 MOVS r2,r0
Is there someone who can help me on this issue?
I am need to implement a boot loader on 0x0000 and jumps to desired application at 0x3000. The first app, read the external data flash and copies the new code to 0x3000 area and after that jumps to it.
Any help ?