We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi,
using a SMT32F103 processor, I want to install an bootloader as well as an application. Two different projects, so that the bootloader (usb) is able to erase / update the application on this processor.
Is it possible to debug the application when the bootloader is starting first?
Is this a proper way to jump from the bootloader app to the application?
// switch to supervisor mode so that stacks in the next startup file can be set (once is // user mode, only an exception can bring the processor out of it. SWI is such an exception.) void __swi(0) jump_to_application_code(void); void __SWI_0 (void) { void (*lp_application_start)(void); // interrupt vectors are mapped using the RAM_INTVEC REMAP RAM_MODE macros in the ASM tab of uv3 lp_application_start = (void (*)(void))APPLICATION_FLASH_START; lp_application_start(); } int main(void) { jump_to_application_code() ; }
Do I have to do additional things for the normal application? for example: that all interrupts will work in the application?
best regards Harald
Yes - of course. But you cannot "debug" both at the same time. The best you can hope for the debug one's source, and place a breakpoint in the disassembly of the other, assuming debug information is used.
No. You need to extract the reset vector and the stack pointer from the interrupt vector first, like this:
__asm void jump_to_application(void) { ; program stack pointer of application LDR R0, =0x1000 LDR SP, [R0] ; extract entry point into application LDR R0, =0x1004 ; jump LDR PC, [R0] }
assuming your application starts at 0x1000.
I've tested your code, and it is working; but I'm not able to init any kind of timer in the second programm (not in the bootloader)....
Is there any specific thing I've to consider?