cancel
Showing results for 
Search instead for 
Did you mean: 

we were using bootloader code on stm32f429i disc1 where we could find that a hard fault when switching from bootloader to user application. We have changed main stack pointer as well as reset the handler before switching to the user application.

TGeor.1
Associate II
 
1 ACCEPTED SOLUTION

Accepted Solutions

I definitively wouldn't use printf() there.

Do you disable all potential interrupt source and bring all peripherals to reset state before calling this function?

Other than that, debug hardly as usually, search on this forum for hints how to do that.

JW

View solution in original post

10 REPLIES 10

Do you change VTOR register accordingly to the change of vector table address?

JW

This is how I switch to user application from bootloader.

0693W000006HItMQAW.png

I definitively wouldn't use printf() there.

Do you disable all potential interrupt source and bring all peripherals to reset state before calling this function?

Other than that, debug hardly as usually, search on this forum for hints how to do that.

JW

thanks ,

i as i removed removed printf debugger Break at address "0x20030000" but did not start executing user application.

In this code i haven't enabled any interrupts.0693W000006HIuFQAW.png

I'm talking about the interrupts in the bootloader. You essentially ought to revert everything you've done in the bootloader to the peripherals, but first of all you should stop any sources of interrupt.

The best to experiment is to use a "stub"/simplified "bootloader" which does nothing just jumps to "main". Then evolve from that.

I don't know what's the reason for what you see. Try to single-step in the disasm view, i.e. instruction-by-instruction, and observe the processor registers' content, to gain understanding of what your code does.

JW

0693W000006HMEIQA4.pngAfter jumping to reset handler,control goes to 0x20030000.

Ok, but what were the instructions that lead to this state? Place as breakpoint before the jump, single step and observe the processor registers content. Observe also the content of the applications vector table.

JW

the function, app_resert_handler() is called just before.

Dump the vector table content, and addresses of various stuctures and pointers.

C​hanging the stack pointer in C is problematic, try not changin the current one and setting the default one in the applications Reset_Handler

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..