Hi.
I am currently working on the CAN bootloader which is based on the TI CAN bootloader as available from TI website. I have the bootloader up and running and able to perform bootload. However, I am in a bit of a struggle to figure out a good way how to indicate that a bootload should be performed on next startup. The physical pin option as in the TI example does not suit the application.
I thought that I could just scramble the "verification" code in the flash for the bootloader, but I seem to be having some problems doing that from the application code. In the application I use the F021 library to read and write to the EEPROM bank of the MCU, So I thought that it might be simple to just switch from the eeprom bank (7) bank to the flash bank (0). However, when I try to do this it generates undefEntry interrupt.
So I have two options: 1) Solve the issue with the main program flash access 2) Find another way how to notify the bootloader that bootload should be performed. I would appreciate help with either of the options.
static Fapi_StatusType set_active_flash_btl_sector (void)
{
Fapi_StatusType set_active_sectors_status = Fapi_Status_Success;
set_active_sectors_status = Fapi_setActiveFlashBank(BOOTLOAD_FLASH_BANK); //BOOTLOAD_FLAS_BANK=Fapi_FlashBank0
if (Fapi_Status_Success == set_active_sectors_status)//never comes here the Fapi_setActiveFlashBank causes to go to undefEntry interrupt vector
{
set_active_sectors_status = Fapi_enableMainBankSectors((uint16_t)((uint16_t)1U << BOOTLOAD_FLAG_SECTOR)); //BOOTLOAD_FLAG_SECTOR=13
}
if (Fapi_Status_Success == set_active_sectors_status)
{
while (FAPI_CHECK_FSM_READY_BUSY != Fapi_Status_FsmReady)
{
}
}
return set_active_sectors_status;
}
Using TMS570LS033x MCU.
Thanks,
Ringolds