STM32H743ZI - jump issue with custom bootloader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-04-17 2:50 AM
any body have example code for jump to application code for bootloader, or any specific settings need to made.
#define BPC_APPL_START_ADDRESS 0x08080000
U_INT32 JumpAddress = *(__IO U_INT32*)(BPC_APPL_START_ADDRESS+4);
pFunction Jump = (pFunction)JumpAddress;
osThreadSuspendAll();
SysTick->CTRL = 0;
SysTick->LOAD = 0;
SysTick->VAL = 0;
HAL_RCC_DeInit();
__set_MSP(*(__IO U_INT32*)BPC_APPL_START_ADDRESS);
__disable_irq();
SCB->VTOR = BPC_APPL_START_ADDRESS;
Jump();
while(1);
In ASW, linker filer , ASW address is set as 0x08080000
can anybody please share the problem with above code, jump is no working and from dissembler i could see, hard fault handler is serviced.
- Labels:
-
Bootloader
-
STM32H7 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-04-17 3:33 AM
try address 0x1FF09800, see here: https://community.st.com/s/article/STM32H7-bootloader-jump-from-application
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-04-17 3:54 AM
The __IO's aren't necessary.
The app should probably config its own SCB_VTOR.
The osThreadSuspendAll and disabling systick aren't necessary if the app's SCB_VTOR and systick are configured before it reenables interrupts.
None of the above solve the hard fault though.
Disable interrupts before changing the stack pointer, de-init'ing clocks or de-init'ing systick too.
Does the app vector table's and stack and reset-handler pointers look good in memory, and does the reset-handler look good in memory (before jumping to it)?
Have you any MPU regions configured? Boot code unprivileged and reset-handler privileged would be bad. Reset-handler executable? Vector table readable? Stack read-writable, .bss and .data addresses writable, etc?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-04-17 4:30 AM
hi @alister​ ,yes, app is configured as its own SCB_VTOR = 0x08080000
- disabled interrupts , deinit clock and systick too before changing SCB_VTOR.
- app vector table is fine and located at 0x08080000, yes reset handlers looks fine and located at 0x080824b4.(breakpoint is hit here while executing jump())
- MPU regions from boot is not configured but from asw , its configured for ethernet
- what does it mean "Boot code unprivileged and reset-handler privileged would be bad"? how to fix this?
- Reset handler is executable, after that jumping into hardfault.
- vector table readable, could see from disassember with debug mode.
- how to verify stack read/write, yes .bss,.data aritable , i use stm work bench.
Thank you in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-04-17 4:31 AM
hi, i use custom bootloader for jumping into Aapplication.
Above solution is good for system boot,
Thanks.
Anandh ram.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-04-17 5:32 AM
Look at what code specifically​ is faulting.
Have a proper Hard Fault Handler that can output actionable data. MCU can provide much detail.
​
If fault is in your loader​ then you likely have an interrupt. At the very least figure out which routines fault.
​
Sanity check the SP/PC values. Output telemetry and diagnostic messages.
​
Try doing the hand-off early to see if your loader/RTOS is creating a toxic environment.​
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-04-17 6:46 AM
hello all, thank you everyone for your support.
my jump to application from the boot i developed is working fine.
I am posting the working code, this may help others.
#define APPL_START_ADDRESS 0x08080000
void jump_appl()
{
U_INT32 JumpAddress = *(__IO U_INT32*)(APPL_START_ADDRESS+4);
pFunction Jump = (pFunction)JumpAddress;
uint32_t i=0;
__disable_irq();
SysTick->CTRL = 0;
SysTick->LOAD = 0;
SysTick->VAL = 0;
HAL_RCC_DeInit();
for (i=0;i<5;i++)
{
NVIC->ICER[i]=0xFFFFFFFF;
NVIC->ICPR[i]=0xFFFFFFFF;
}
__set_MSP(*(__IO U_INT32*)APPL_START_ADDRESS);
SCB->VTOR = BPC_APPL_START_ADDRESS;
Jump();
while(1);
}
