AnsweredAssumed Answered

Bootloader to Application Transition Not Fully working.

Question asked by sotack.john.001 on Jan 31, 2013
Latest reply on Feb 1, 2013 by sotack.john.001
I have an application I build from Atollic True Studio that runs correctly stand alone on an STM32F407ZE processor. I am working to insert a boot loader that later branches to the application.  The boot loader runs fine on its own.  When branched to by the boot loader, the application apparently runs slowly and may be mising all interrupts from an external digital input  (or is just to slow to keep up).  My boot loader starts at the start of my prcessor's flash 0x0800000.  On reset Flash location 0x4 contains the reset vector also stored in the isr table at 0x08000004.  The boot loader uses the internal oscillator while my application uses an external osciallator  Ther version of the application that runs stand alone starts at 0x0800000 (ISR table location).  However, the version designed to coexist with the boot loader starts at Flash Bock 1 at 0x08004000 (Also ISR table location).  It builds and runs correctly when started from the debuger directory.  The problem occurs when branching to the application from the boot loader.

My boot loader, also an Atollic True Studio C/C++ application branches to the boot loader using an inline class method as follows:

__attribute__ ( ( always_inline ) ) static inline voidBranchToApplication()

{

asm volatile (

"movw r3, #0x4000\n\t"

 

"movt r3, #0x800\n\t"

 

"ldrsp, [r3, #0]\n\t"

 

"movw r3, #0x4004\n\t"

 

"movt r3, #0x800\n\t"

 

"ldr r3, [r3, #0]\n\t"

 

"bx r3"

);

It sets the stack pointer from the first location in the applications vector table, and then branches to the Rest_Handler address at the second location in the vector table.  My application uses a debug terminal which runs at the correct baud rate and works.
 
Is there a more effective way of branching to the application such that it will behave as though its Reset_Handler was called at power on?  Is there something I can do to initialize all non processor register and branch to my application's reset vector.

John

Outcomes