We have developed the MPC5748G serial bootloader which is able to flash the APP at the desired address and also able to execute the APP after jumping to the same.
We are using the default Serial line LINFlexD_UART2 on Devkit for this whole purpose and before jumping to the APP, we are closing the UART line and de-initializing it, so that APP runs smoothly, which is happening.
But, our concern is whenever we press the reset button, it's always the APP that is running first, but not the Bootloader. We want the reverse to happen. We have kept the Bootheader address of BL as 0x00FC0000 and APP as 0x00FA0000 which is searched by BAF where the BL Bootheader comes first (increasing order, high priority)
BootLoader linker Setting's :
/* Define FLASH */
FLASH_BASE_ADDR = DEFINED(__flash_base_addr__) ? __flash_base_addr__ : 0x01200000;
FLASH_SIZE = DEFINED(__flash_size__) ? __flash_size__ : 256k;
/* 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
}
APP Linker Setting's :
/* 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;
/* 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
}
Where are we doing wrong, it is not clear, we want the Bootloader should run first and then APP,as in the case of normal BL application.