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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2020-12-31 1:02 AM
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2021-01-01 12:59 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2020-12-31 3:39 AM
Do you change VTOR register accordingly to the change of vector table address?
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2021-01-01 12:18 AM
This is how I switch to user application from bootloader.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2021-01-01 12:59 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2021-01-01 1:19 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2021-01-01 5:44 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2021-01-03 9:17 PM
After jumping to reset handler,control goes to 0x20030000.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2021-01-03 11:40 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2021-01-04 2:02 AM
the function, app_resert_handler() is called just before.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2021-01-04 2:19 AM
Dump the vector table content, and addresses of various stuctures and pointers.
Changing the stack pointer in C is problematic, try not changin the current one and setting the default one in the applications Reset_Handler
Up vote any posts that you find helpful, it shows what's working..
