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\$
1
  • 2
    \$\begingroup\$ Make sure that the application binary is compiled for the proper base address. \$\endgroup\$
    – filo
    Commented Sep 21, 2019 at 19:57

2 Answers 2

1
\$\begingroup\$

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

\$\endgroup\$
3
  • \$\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
1
\$\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\$
1
  • \$\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
    Commented Oct 4, 2019 at 11:03

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