Hi all,
I'm designing a BootLoader program.The idea of the program is to receive new programs through serial ports, burn them into the FLASH according to SRC files, and then jump to execute the new program, but it doesn't run after jumping.
BootLoader:
/* define heap and stack size */
__HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x00000000;
__STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x00001000;
/* Define FLASH */
FLASH_BASE_ADDR = DEFINED(__flash_base_addr__) ? __flash_base_addr__ :0x014C0000;
FLASH_SIZE = DEFINED(__flash_size__) ? __flash_size__ : 1856K;
/* Define SRAM */
SRAM_BASE_ADDR = DEFINED(__sram_base_addr__) ? __sram_base_addr__ : 0x40000000;
SRAM_SIZE = DEFINED(__sram_size__) ? __sram_size__ : 768K;
MEMORY
{
flash_rchw : org = 0x00FA0000, len = 0x4
cpu0_reset_vec : org = 0x00FA0000+0x10, len = 0x4
cpu1_reset_vec : org = 0x00FA0000+0x14, len = 0x4
cpu2_reset_vec : org = 0x00FA0000+0x04, len = 0x4
m_text : org = FLASH_BASE_ADDR, len = FLASH_SIZE
m_data : org = SRAM_BASE_ADDR, len = SRAM_SIZE
}
...............................................................................................................................................................................
User APP:
/* Entry Point */
ENTRY(_start)
/* define heap and stack size */
__HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x00000000;
__STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x00001000;
/* Define FLASH */
FLASH_BASE_ADDR = DEFINED(__flash_base_addr__) ? __flash_base_addr__ : 0x01000000;
FLASH_SIZE = DEFINED(__flash_size__) ? __flash_size__ : 1856K;
/* Define SRAM */
SRAM_BASE_ADDR = DEFINED(__sram_base_addr__) ? __sram_base_addr__ : 0x40000000;
SRAM_SIZE = DEFINED(__sram_size__) ? __sram_size__ : 256K;
MEMORY
{
flash_rchw : org = 0x00FA0000, len = 0x4
cpu0_reset_vec : org = 0x00FA0000+0x10, len = 0x4
cpu1_reset_vec : org = 0x00FA0000+0x14, len = 0x4
cpu2_reset_vec : org = 0x00FA0000+0x04, len = 0x4
m_text : org = FLASH_BASE_ADDR, len = FLASH_SIZE
m_data : org = SRAM_BASE_ADDR, len = SRAM_SIZE
}
...............................................................................................................................................................................
Jump code
void iap_load_app(uint32_t appxaddr)
{
INT_SYS_DisableIRQ_MC_All(LINFLEXD10_RX_IRQn);
INT_SYS_DisableIRQ_MC_All(LINFLEXD10_TX_IRQn);
INT_SYS_DisableIRQ_MC_All(LINFLEXD10_ERR_IRQn);
INT_SYS_DisableIRQ_MC_All(STM0_Ch0_IRQn);
INT_SYS_DisableIRQ_MC_All(PIT_Ch15_IRQn);
INT_SYS_DisableIRQ_MC_All(SIUL_EIRQ_00_07_IRQn);
INT_SYS_DisableIRQ_MC_All(SIUL_EIRQ_08_15_IRQn);
INT_SYS_DisableIRQGlobal();
DISABLE_INTERRUPTS(); /*disable the CPU interrupt*/
// ((void (*)(void)) appxaddr)();
__asm__("e_lis %r12,0x0100");
__asm__("e_or2i %r12,0x0000");
// __asm__("e_lwz %r0,0(%r12) ");
// __asm__("mtlr %r0");
__asm__("mtlr %r12");
__asm__("se_blrl");
}
...............................................................................................................................................................................
before se_blrl
after se_blrl
Note:
S30900FA0000005A0002A0
S30900FA001001000000EB( in user APP srec file)
These two lines are not recorded in flash.
Please help to see what's wrong, or whether BootLoader's thinking is correct. Thank you very much!
Hi, Gong jun,
From the photos attached to you, your Bootloader flash size max is 768K not 1856K.
And please check if the srec file of App programmed to flash is correct though your Bootloader?
Best Regards,
Frank
Hi,Frank
Your help was very timely, and I finally found that the flash burned was different from the srec file.
and after jump need wait a moment. thank you!
Best Regards,
gong jun