cancel
Showing results for 
Search instead for 
Did you mean: 

it cant jump to application after bootloader

PLEE.2
Associate II

Hello,

i use spc58ec80e1 in our project. (spc5studio)

the bootloader code is flashed in address 0x00fc0000 (Boot Mode : copy in flash),

and application code is flashed in address 0x01000000.(Boot Mode : Excute from flash)

After the bootloader starts to operate after power,

it wants to jump to the application code using timeout using PIT.

but it does not work.

Looking at the community and so on,

void application()

{

void (*user_application)(void);

uint32_t jump_address_pointer;

vuint32_t jump_address;

jump_address_pointer = (0x01000000 + 0x4);

jump_address = *((vuint32_t*)(jump_address_pointer));

SPC5_PIT0_DISABLE_CLOCK();

/*

* disable interrupt

*/

irqIsrDisable();

/*

* Disable XOSC and set DRUN mode

*/

MC_ME.DRUN_MC.R = SPC5_ME_MC_SYSCLK_IRC | SPC5_ME_MC_IRCON | SPC5_ME_MC_XOSCON | SPC5_ME_MC_FLAON_NORMAL | SPC5_ME_MC_MVRON;

if (SPCSetRunMode(SPC5_RUNMODE_DRUN) == CLOCK_FAILED) {

SPC5_CLOCK_FAILURE_HOOK();

}

user_application = (void(*)(void))jump_address;

user_application();

}

I've tried it, but it don't jump either.

I saw to do "jump after the last byte of reset vector" in the community, but I didn't understand this.

(refer https://community.st.com/s/question/0D53W00000bfzI5SAI/spc560bcant-jump-from-my-bootloader-to-app-code)

please help me.

1 ACCEPTED SOLUTION

Accepted Solutions
Erwan YVIN
ST Employee

Hello ,

Why do you disable the PIT0 before jumping ?

PIT0 is the tick of the system.

i recommend you to check on the debugger your session PC,R14,R13

There is a nice example SPC58ECxx_RLA Bootloader Application for Discovery in SPC5Studio

Best regards

Erwan

View solution in original post

2 REPLIES 2
Erwan YVIN
ST Employee

Hello ,

Why do you disable the PIT0 before jumping ?

PIT0 is the tick of the system.

i recommend you to check on the debugger your session PC,R14,R13

There is a nice example SPC58ECxx_RLA Bootloader Application for Discovery in SPC5Studio

Best regards

Erwan

hello. i refered SPC58ECxx_RLA Bootloader Application for Discovery in SPC5Studio

void updater_jump{

 void (*fptr)(void);

 uint32_t jump_address_pointer;

 vuint32_t jump_address;

 jump_address_pointer = 0x1000000 + 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);

=> instead lin_ldd_stop($LIN_SLAVE);

#endif

#if (SPC5_UPDATER_ACT == SPC5_UPDATER_ACT_TIMER)

 stm_lld_stop(updater_config.stm_driver);

​==> must be stop??? i dont use STM

#endif

 updater_lld_stop();

=> in function {

SPC5_PIT0_DISABLE_CLOCK();

irqIsrDisable();

MC_ME.DRUN_MC.R = SPC5_ME_MC_SYSCLK_IRC | SPC5_ME_MC_IRCON | SPC5_ME_MC_XOSCON | SPC5_ME_MC_FLAON_NORMAL | SPC5_ME_MC_MVRON;

if (SPCSetRunMode(SPC5_RUNMODE_DRUN) == CLOCK_FAILED) {

SPC5_CLOCK_FAILURE_HOOK();

}

​ }

 /*lint -e9074 */

 fptr = (void (*)(void))jump_address;

 fptr();

 /*lint +e9074 */

}

In my opinion, it seems to have been implemented in the same way as above.

But. not jump;.

thanks.

PLEE