I wrote a bootloader for S32R274,it can download app project files to flash, but when I jump to the app, it seems that only Z7 works,Z4_0 does not have any log output。Is there a problem with my method of jumping to the app?who can help me?thanks..
#define APP_StartAddr (*(uint32_t*)0x01000004)
void app_entry(void)
{
UART_Deinit(&uart_pal1_instance);
INT_SYS_DisableIRQGlobal();
(*(void (*)(void))(APP_StartAddr))();
while(1);
}
the flash allocation is as follows:
bootloader linker_flash.ld:
MEMORY
{
flash_rchw : org = 0x00F98000, len = 0x4
cpu0_reset_vec : org = 0x00F98000+0x04, len = 0x4
m_text : org = 0x00F99000, len = 92K
m_data : org = 0x40000000, len = 426K
local_dmem : org = 0x50800000, len = 64K
}
app linker_flash.ld
MEMORY
{
/*Boot flash areas*/
flash_rchw : org = 0x01000000, len = 0x4
cpu0_reset_vec : org = 0x01000004, len = 0x4
/*...it could go all the way up to 0x00FFFFFF*/
/* Flash memory areas for each core */
c0_flash : org = 0x01001000, len = 508K
c1_flash : org = 0x01001000+ LENGTH(c0_flash), len = 512K
c2_flash : org = 0x01001000+ LENGTH(c0_flash)+LENGTH(c1_flash), len = 1K
common_flash : org = 0x01001000+ LENGTH(c0_flash)+LENGTH(c1_flash)+LENGTH(c2_flash), len = 256K
...
}
Found through debugging that the program is stuck at init_data_bss() in Startup.c when copy initialized table。I also found that the Z7 core started unexpectedly,the function to open the z7 core is not executed。
Hi Chen,
I'm used to recommend these two things:
- the best way: use software reset and jump to the application right after reset (using asm code in startup files) before initialization of bootloader's resources.
- completely de-init everything before jump. Most important - disable interrupts on all levels - by MSR[EE], by local enable bits in peripherals, by priority registers. I would also put all used peripherals back to default reset state.
This can save a lot of debugging and headache.
Regards,
Lukas
Hi Lukas,
Thank you very much for the solution,my bootloader can now run normally.
Regards,
Chen