2021-03-02 01:11 AM
hi I make my bootloader and app code.in bootloader I have assembly code for branch and in my app code i have a led.
I set app.ld for bootloader to 0.00000000 and set for app code to 0x00010000 address.
It cant be jump
please help me
asm volatile ("e_lis %r3, 0x00010000@h \t\n" //Load Immediate Shifted
"e_or2i %r3, 0x00010000@l \t\n" //OR Immediate
"mtctr %r3 \t\n" //Move To Count Register
"se_bctrl ");
Solved! Go to Solution.
2021-03-10 07:12 PM
Hi my friend
I find the solution. For a success jump the address must be after the last byte of the reset vector. Thank you for your guidance and patience.
2021-03-02 07:14 AM
Hi,
please, could you give a look to the example SPC560Bxx_RLA Bootloader Application for Discovery included in SPC5Studio? It shows how to jump from a Bootloader to the application previously programmed in the flash.
Regards,
Luigi
2021-03-02 10:55 PM
Hi Luigi thanks for your answer,
I checked this wizard and this is very good , But I have a problem to use if, I have to use of spc560b50 and this wizard
build for at least spc560b53.
My new qustion is how to use this wizard?
thanks for your time and your kind.
thanks a lot for your help,
ali
2021-03-02 11:00 PM
Hi Luigi thanks for your answer,
I checked this wizard and this is very good , But I have a problem to use if, I have to use of spc560b50 and this wizard
build for at least spc560b53.
My new qustion is how to use this wizard?
thanks for your time and your kind.
thanks a lot for your help,
ali
2021-03-02 11:29 PM
Hi Ali,
the aim of SPC5Studio is to provide reference code in order to show how to face some issues. The same reference code is generally available for a lot of platforms/cores, but we do not guarantee the full coverage. In your case, for example, the Bootloader test application is available for SPC560B54, but it is not available for the SPC560B50. In any case, you can use the Bootloader test application to understand the mechanism that we use to jump from the Bootloader to the application. Since the aim of jump is generally to run a new firmware that will re-initialize the core, before the jump you must be sure to disable all the drivers previously enabled by the Bootloader, disable the interrupts and move the core in DRUN mode.
About the wizard, if you want to see all the examples available for SPC560B50, you can run the app wizard and filter the application by core, as shown in the picture below.
Regards,
Luigi
2021-03-05 10:51 PM
Hi luigi..thanks for your answer.
yes your right .st wizard isnt for all of its product. I look deeper in bootloader code and I found Functions that must be until jump to speciefic address
code is :
SPCSetPeripheralClockMode(SPC5_PIT_PCTL, SPC5_PIT_STOP_PCTL);
/*
* disable interrupt
*/
irqIsrDisable();
/*
* Disable XOSC and set DRUN mode
*/
ME.DRUN.R = SPC5_ME_MC_SYSCLK_FIRC | SPC5_ME_MC_FIRCON | SPC5_ME_MC_XOSCON | SPC5_ME_MC_CFLAON_NORMAL | SPC5_ME_MC_MVRON;
if (SPCSetRunMode(SPC5_RUNMODE_DRUN) == CLOCK_FAILED) {
SPC5_CLOCK_FAILURE_HOOK();
}
asm volatile ("e_lis %r3, 0x00010000@h \t\n" //Load Immediate Shifted
"e_or2i %r3, 0x00010000@l \t\n" //OR Immediate
"mtctr %r3 \t\n" //Move To Count Register
"se_bctrl "); //Branch to Count Register & link
I tried this code and again my program didnt jump. as you said I disabled all driver, interrupts and move core to drun mode, Did I forget something?
Also I tried another way, I used this function that is for st bootloader
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 =0x0010000;
/*
* 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 */
}
and It also Doesnt work,
Do you have an opinion?
Please share it with me
thanks for your patience and kindness
2021-03-08 02:06 AM
Hi,
could you clarify me what do you mean when you say that it doesn't work? Is the jump not executed or is the code at address 0x0010000 not correctly executed? Is the project that you store at address 0x0010000 developed with SPC5Studio? Moreover, is it compiled to be executed from the address 0x0010000?
Regards,
Luigi
2021-03-10 07:12 PM
Hi my friend
I find the solution. For a success jump the address must be after the last byte of the reset vector. Thank you for your guidance and patience.