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?
2 Answers
\$\begingroup\$
\$\endgroup\$
3
It is far not enough. You need to disable all interrupts in the NVIC.
-
\$\begingroup\$ Why do you think that? \$\endgroup\$ Commented Sep 21, 2019 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\$ Commented Sep 21, 2019 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\$ Commented Oct 4, 2019 at 15:04
\$\begingroup\$
\$\endgroup\$
1
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.
-
\$\begingroup\$ Does anyone know how to neglect manual file alteration and where to put SCB->VTOR in application or how to disable it? \$\endgroup\$– suriyaCommented Oct 4, 2019 at 11:03