2020-04-10 05:57 AM
Hi,
My setup:
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:
Thanks,
Regards
Solved! Go to Solution.
2020-04-22 07:58 AM
Hi,
if the new application is designed with SPC5Studio and is compiled to be executed starting from 0x1000000 (as in the example SPC570Sxx_RLA Bootloader Application for Discovery), the first word at address 0x1000000 will be to 0x005A0000 (first word in boot.S) if a valid application is already present to 0x1000000. So, it is possible to check if a valid application is present verifying if the value to the address updater_config.codeimage1.address is to 0x005A0000.
Please, feel free to contact me for any other clarification.
Regards,
Luigi
2020-04-22 07:58 AM
Hi,
if the new application is designed with SPC5Studio and is compiled to be executed starting from 0x1000000 (as in the example SPC570Sxx_RLA Bootloader Application for Discovery), the first word at address 0x1000000 will be to 0x005A0000 (first word in boot.S) if a valid application is already present to 0x1000000. So, it is possible to check if a valid application is present verifying if the value to the address updater_config.codeimage1.address is to 0x005A0000.
Please, feel free to contact me for any other clarification.
Regards,
Luigi
2020-04-22 09:06 AM
Dear Luigi,
It works!
Many thanks for support!
Leonardo