AnsweredAssumed Answered

K64 bootloader

Question asked by Aaron Dunkin on Aug 18, 2015
Latest reply on Aug 25, 2015 by Aaron Dunkin

I'm using UVision 5 with a Kinetis K64.  I am working on porting the Codewarrior USB host bootloader to the Keil environment.  I have successfully done this for K60 and am nearing completion for the K64. 


Using the bootloader, I am successfully recognizing the device attached, erasing the application sector space, and loading the new application.  But upon power up, when the bootloader successfully detects an image is present in flash, it's jumping to the program counter address stored in the 5th-8th byte of the binary, but then the application resets the processor which then enters bootloader mode and continues this in an indefinite reset.


My method for jumping to the application which is working with the K60 is:

((void (*)(void))New_pc)();

where New_pc is the address of the reset vector.


When I load the Codewarrior without touching the application, it successfully jumps to the application and runs.  The Codewarrior bootloader uses:



         ldr   r4,=New_sp

         ldr   sp, [r4]

         ldr   r4,=New_pc

         ldr   r5, [r4]

         blx   r5


but as you can see from above, the Keil bootloader does not set up the stack pointer.  But it works for K60 and I've read that the application sets up the stack pointer.


Do I need to set up the stack pointer?  If so, why didn't I have to with the Keil K60 bootloader, which works?  If not, is the continuous resetting a hint as to what is going on?