SPC570Sxx Bootloader: Check valid application
Hi,
My setup:
- SP570S-DISP Demo Board Evaluation
- uC: SPC570S50E1
- IDE: SPC5Studio 5.8.1
I'm using example "SPC570Sxx_RLA Bootloader Application for Discovery".
Function "updater_jump()" In "firmware_updater.c" file, jump to application image without checking if there is valid application image.
So, if there isn't a valid application image, bootloader stucks and the only way to restore bootloader functionality is to perform a "physical" reset using button RESET of SPC570S-DISP board.
void updater_jump(void) {
void (*fptr)(void);
uint32_t jump_address_pointer;
vuint32_t jump_address;
jump_address_pointer = updater_config.codeimage1.address + 4UL;
jump_address = *((vuint32_t*)(jump_address_pointer));
/*
* stop peripherals
*/
#if (SPC5_UPDATER_CONN == SPC5_UPDATER_CONN_CAN)
can_lld_stop (updater_config.can_driver);
#else
sd_lld_stop(updater_config.serial_driver);
#endif
#if (SPC5_UPDATER_ACT == SPC5_UPDATER_ACT_TIMER)
stm_lld_stop(updater_config.stm_driver);
#endif
updater_lld_stop();
/*lint -e9074 */
fptr = (void (*)(void))jump_address;
fptr();
/*lint +e9074 */
}I have tried to inspect, using debugger, what happens when microcontroller jump in an address that contain no valid instructions.
I noticed that no exceptions are triggered, microcontroller remains blocked in a memory location with "unknown instruction".
I have tried to enable all IVOR interrupts, but no IVOR condition is triggered.
I would expect to see "IVO6 - Program Interrupt" because there is an "illegal instruction".
My questions:
- Why no IVOR condition is triggered when microcontroller jump in an "unknown instruction"?
- Please, could you suggest me any approach to check if there is a valid application in "which" jump before perform application image jump?
Thanks,
Regards
