cancel
Showing results for 
Search instead for 
Did you mean: 

SPC570Sxx Bootloader: Check valid application

LeoC
Associate II

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

This discussion is locked. Please start a new topic to ask your question.
1 ACCEPTED SOLUTION

Accepted Solutions
zambrano.luigi
ST Employee

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

View solution in original post

2 REPLIES 2
zambrano.luigi
ST Employee

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

Dear Luigi,

It works!

Many thanks for support!

Leonardo

Announcement

We’re moving the ST Community to a new platform to give you a better and more reliable community experience.