Hello all,
I would like to switch between BOOTLOADER and APPLICATION by setting the MC_ME_CADDR1 and restarting the Z4_0 via a "functional" reset.
The BOOTLOADER has its bootheader in 0x00FA0000 and its content in 0x01000000 (see linker script below). The APPLICATION is written from the raw binary file via CAN to 0x01200000 and the bootheader to 0x00FC0000. This write process works without errors. According to the BAF search sequence the APPLICATION is correctly executed after a reset (0x00FC0000 is fetched before 0x00FA0000).
Now I want to switch back to the BOOTLOADER with the following code:
MC_ME->CCTL1 = 0x00FC;
MC_ME->CADDR1 = 0x01200000 | 1;
MC_ME->MCTL = 0x00005AF0;
MC_ME->MCTL = 0x0000A50F;
But this doesn't work, instead the Z4_0 boots after the "functional" reset from the BAF, which leads to the start of the APPLICATION instead of the BOOTLOADER. If i delete the BAF section at 0x00FC0000, then the BOOTLOADER is starting again without any problems.
Thanks in advance.
Greetings René
Linker Scripts:
BOOTLOADER
* 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_ADD/R = 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 = 0x00FA0008;
RAPPID_BOOT_APP_KEY_ADDR = 0x00FA000C;
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
rappid_boot_data : org = 0x00FA0000+0x08, len = 0x8
m_text : org = FLASH_BASE_ADDR, len = FLASH_SIZE
m_data : org = SRAM_BASE_ADDR, len = SRAM_SIZE
}
APPLICATION
/* Define FLASH */
FLASH_BASE_ADDR = DEFINED(__flash_base_addr__) ? __flash_base_addr__ : 0x01200000;
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;
/* Define RAppID boot data address */
RAPPID_BOOT_APP_DELAY_ADDR = 0x00FC0008;
RAPPID_BOOT_APP_KEY_ADDR = 0x00FC000C;
MEMORY
{
flash_rchw : org = 0x00FC0000, len = 0x4
cpu0_reset_vec : org = 0x00FC0000+0x10, len = 0x4
cpu1_reset_vec : org = 0x00FC0000+0x14, len = 0x4
cpu2_reset_vec : org = 0x00FC0000+0x04, len = 0x4
rappid_boot_data : org = 0x00FC0000+0x08, len = 0x8
m_text : org = FLASH_BASE_ADDR, len = FLASH_SIZE
m_data : org = SRAM_BASE_ADDR, len = SRAM_SIZE
}
#MPC5748G