2023-02-05 05:54 AM
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.
please help me.
Solved! Go to Solution.
2023-02-06 02:21 AM
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
2023-02-06 02:21 AM
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
2023-02-06 08:32 AM
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