Skip to main content
1123
Associate II
May 22, 2019
Solved

How to use stm32l4 from IAP jump to bootloader

  • May 22, 2019
  • 5 replies
  • 1862 views

I have bootloader initial position 0x08000000 and IAP 0x08004000 now.

First, I form bootloader jump to IAP code and it works fine.

But my jump back to bootloader will stop.

Maybe I have a lot of IAP function enable.

So I want to ask, besides __disable_irq() close NVIC, and any other way to deinit other functions?

Because I use __disable_irq(),but it seem isn't effect.

when i back to bootloader code of GPIO inti funaction , it already haven't stop.

This topic has been closed for replies.
Best answer by Alex R

Please take a look at the following information:

ARM: How to write a bootloader

http://www.keil.com/support/docs/3913.htm

5 replies

Tesla DeLorean
Guru
May 22, 2019

Understand that __disable_irq() has a different effect than actually disabling the interrupts in the peripherals which you have enabled.

You're going to need an __enable_irq() somewhere if you ever want to see them again.

The loader/app need to set SCB->VTOR appropriately.

You can't transfer control from within an IRQ Handler, or related Callback function. Similarly an RTOS using System/User execution contexts.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Alex R
Alex RBest answer
Associate II
May 22, 2019

Please take a look at the following information:

ARM: How to write a bootloader

http://www.keil.com/support/docs/3913.htm

1123
1123Author
Associate II
May 23, 2019

Thank you, the problem has been solved.

Alex R
Associate II
May 23, 2019

Good!

Please let us know how you fixed the issue, as this helps the community if someone runs into the same issue in the future.

Thanks.

1123
1123Author
Associate II
May 24, 2019

I refer to the URL provided by Alex: How to write a bootloader

Before the jump,first you must Disable all enabled interrupts in NVIC.

code : NVIC->ICER[ 0~7 ] = 0xFFFFFFFF ;

After Disable SysTick and clear its exception pending bit, if it is used in the bootloader.

code : SysTick->CTRL = 0 ;

SCB->ICSR |= SCB_ICSR_PENDSTCLR_Msk ;

finally the user application into SCB->VTOR register.

This site has more detailed content.

If you are interested, you can refer to it.

THX.