2018-06-11 03:44 AM
Hello everyone?
I have an issue with bootLoader development?I have debug the bootLoader successfully with SPC560P44, but I am not quite sure about how to jump to bootloader from the application program?
our conventional method is putting the boot function at the absolute address?and we can jump to bootloader by call the function pointer?but in the SPC5Studio we don't know how to put the function at the absolute address?Can anyone know this ?Appreciate
to receive your reply?#bootloaderSolved! Go to Solution.
2018-06-13 03:07 AM
Hello,
you can perform the jump in two wa using the following codes
if application to program is compiled with spc5studio please take into consideration:
vuint32_t jump_address;
jump_address_pointer = 'address where you have programmed you binary' + 4UL;
jump_address = *((vuint32_t*)(jump_address_pointer));Regards,
Procolo
2018-06-13 03:07 AM
Hello,
you can perform the jump in two wa using the following codes
if application to program is compiled with spc5studio please take into consideration:
vuint32_t jump_address;
jump_address_pointer = 'address where you have programmed you binary' + 4UL;
jump_address = *((vuint32_t*)(jump_address_pointer));Regards,
Procolo
2018-06-13 05:37 AM
Hello Wang,
There should be no correlation.
SPC5_CLOCK_FAILURE_HOOK(); is called when there is a failure during spc_clock_init(void) which is a function called before the main().
There are many point inside this function where the hook is called, so we have to understand which is the correct point where fail happen and which is the status of ME.GS.R register.
anyway, if you are using PLL in your app, you should turn them off when seting DRUN mode before jump.
ME.DRUN.R = SPC5_ME_MC_SYSCLK_IRC | SPC5_ME_MC_IRCON | \
SPC5_ME_MC_XOSC0ON | SPC5_ME_MC_CFLAON_NORMAL | \ SPC5_ME_MC_DFLAON_NORMAL | SPC5_ME_MC_MVRON; if (SPCSetRunMode(SPC5_RUNMODE_DRUN) == CLOCK_FAILED) { SPC5_CLOCK_FAILURE_HOOK(); }Ragards,
Procolo
2018-06-13 05:46 AM
Hello Procolo?
Thank you for your reply?I have jumped successfully from bootloader to application program?and it was run well?but I have problems jumping form APP to bootloader which has a function located at 0xb800?I used the same jumping function. and I could find it already jumped to the address 0xb800 through the PC pointer?however it seems failed at the initialization func ?and the PC pointer stop at 0x00000c14 which was put the vectors seen from the map doc.
SPC5_CLOCK_FAILURE_HOOK();
and I found it was really curious that if I close everything in APP ,only the jump func left , it could jump successfully. Is there any connections between the PC pointer address which the jump func located and the aim bootloader func address which I need to jump to?Do I describe clearly?I need your help?thank you so much again?
linker file
destination
the jump code
2018-06-13 07:30 AM
Hello,
before jumping, could you please try to disable interrupts after stopping the peripherals?
actually , some stop functions re enable when exit , so if you disable interrupt before stopping peripherals they may be re enabled when jumping.
Redards,
Procolo
2018-06-13 08:36 AM
Hello
Procolo:
I have copied your code when I jump,but it did‘t work, I disabled all the peripheral and find that the if the adc_lld_stop_conversion(&ADCD1); was disabled ,then it worked。But if I tired more ,I found it did not run successfully everytime, I traced the PC in CPU window ,found that the PC was sometimes in IVOR6 or sometimes in IVOR1,what should I do to find the problem?many thanks�
2018-06-13 09:43 PM
Hello
Procolo?
I think I have disabled the interrupts after
stopping peripherals?but it still entered the IVOR6, I can?t find where the problem is?here are my application code and the bootloader code? I copy the code from your answers?and is I don't init any
peripherals
in app? it can jump successfully? it is so weird. There are only peripherals of can and timer.
2018-06-13 11:11 PM
Hello,
my idea is that there is some peripheral which is not correctly stopping and lead to an error when jumping.
we should understand which one is. could you try to enable one peripheral at a time and check when it does not work?
also, please try to set DRUN mode as last operation before jumping:
Regards,
2018-06-14 01:07 AM
Hello,
let's investigate. I need the following infomation, could you please provide them?:
Thanks and best regards,
Procolo
2018-06-14 02:16 AM
Hello procolo:
Thank you for your tips. I have changed my code as your proposal,Then I initialized my peripheral one by one , and found it maybe the CAN does the effect, if there is only initialization and TX message, it is OK to jump, but if there are message for rx, the program enters IVOR6 even if I have stopped the CAN module.Do you have any opinion to solve this?