Hi.
Sorry, my English is poor.
I got a bootloader and a application, then i want to jump from bootlader to application。
when the bootloader is an empty project, I can use " (*(void (*)(void)) (0x01200000))();" to jump to the application. but when I added some functions to the bootloader, this method failed, Add I tried use " __asm__(" e_lis %r3, 0x0120");
__asm__(" e_ori %r3,%r3,0x0000");
__asm__(" se_mtlr %r3");
__asm__(" se_blr");", But this did not solve my problem。
And I confirmed that i did not erase the flash of the Application flash space when flashing the bootloader.
Why it does not work? How can i do this?
Here is detail configuration of my environment:
My Bootloader:
Bootloader FLASH_BASE_ADDR is 0x01000000;
Bootloader FLASH_SIZE is 2048K;
MEMORY
{
flash_rchw : org = 0x00F90000, len = 0x4
cpu0_reset_vec : org = 0x00F90000+0x10, len = 0x4
cpu1_reset_vec : org = 0x00F90000+0x14, len = 0x4
cpu2_reset_vec : org = 0x00F90000+0x04, len = 0x4
rappid_boot_data : org = 0x00F90000+0x08, len = 0x8
m_text : org = FLASH_BASE_ADDR, len = FLASH_SIZE
m_data : org = SRAM_BASE_ADDR, len = SRAM_SIZE
}
My Application:
/* Define FLASH */
/* FLASH_BASE_ADDR = DEFINED(__flash_base_addr__) ? __flash_base_addr__ : 0x01000000; */
/* FLASH_SIZE = DEFINED(__flash_size__) ? __flash_size__ : 1856K; */
FLASH_BASE_ADDR = 0x01200000;
FLASH_SIZE = 2048K;
/* Define SRAM */
SRAM_BASE_ADDR = DEFINED(__sram_base_addr__) ? __sram_base_addr__ : 0x40000000;
SRAM_SIZE = DEFINED(__sram_size__) ? __sram_size__ : 256K;
/* Define RAppID boot data address */
RAPPID_BOOT_APP_DELAY_ADDR = 0x00F9C008;
RAPPID_BOOT_APP_KEY_ADDR = 0x00F9C00C;
MEMORY
{
flash_rchw : org = 0x00F9C000, len = 0x4
cpu0_reset_vec : org = 0x00F9C000+0x10, len = 0x4
cpu1_reset_vec : org = 0x00F9C000+0x14, len = 0x4
cpu2_reset_vec : org = 0x00F9C000+0x04, len = 0x4
rappid_boot_data : org = 0x00F9C000+0x08, len = 0x8
m_text : org = FLASH_BASE_ADDR, len = FLASH_SIZE
m_data : org = SRAM_BASE_ADDR, len = SRAM_SIZE
}
Thanks in advance.
Hi,
it's highly recommended to put everything back to default reset state before jumping to user application. This is the most common reason.
There are two options:
- you can jump to the application right after reset
- or configure all used registers back to default state. The most important thing is to disable interrupts on all levels: by MSR[EE] bit in the core(s), by priorities in interrupt controller and by local enable bits in peripherals.
Regards,
Lukas