0
\$\begingroup\$

I am working on IAP in STM32F4. I received .bin file using uart and flash it in 0x08004000 address successfully and disable irq , set msp , set vector, deinit hal , reset the systick registers but the jump is not working, It just freezes there. Can anyone help me with this?

define APP_ADDRESS 0x08004000

snip of jump code

\$\endgroup\$
  • 2
    \$\begingroup\$ Make sure that the application binary is compiled for the proper base address. \$\endgroup\$ – filo Sep 21 '19 at 19:57
1
\$\begingroup\$

It is far not enough. You need to disable all interrupts in the NVIC.

\$\endgroup\$
  • \$\begingroup\$ Why do you think that? \$\endgroup\$ – Brian Carlton Sep 21 '19 at 18:47
  • 1
    \$\begingroup\$ Because if the application reenables the interrupts the enabled in the NVIC interrupt might not be handled by the app code causing the HF. Rule of thumb: before passing the control to the app make sure that the uC is in the same state as after the reset \$\endgroup\$ – P__J__ Sep 21 '19 at 19:34
  • \$\begingroup\$ While it may not have been the immediate issue here, there is truth to this concern. So much, in fact, that the best practice when a bootloader has used the chip in a more than trivial way is generally considered to be to set a flag in the RCC or ram, perform a reset, see the flag, and branch to the application code before doing any configuration which would then have to be undone. \$\endgroup\$ – Chris Stratton Oct 4 '19 at 15:04
0
\$\begingroup\$

I solved it. The problem is with the user application. I build the application at correct address but the SCB->VTOR register is overwritten to offset zero from the call of SystemInit() in the application code. So I changed the VECT_OFFSET value in system_stm32f4xx.c file and everything works fine. Anyway, thank you for all the suggested answers.

\$\endgroup\$
  • \$\begingroup\$ Does anyone know how to neglect manual file alteration and where to put SCB->VTOR in application or how to disable it? \$\endgroup\$ – suriya Oct 4 '19 at 11:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.