cancel
Showing results for 
Search instead for 
Did you mean: 

How to use stm32l4 from IAP jump to bootloader

1123
Associate II

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Alex R
Senior

Please take a look at the following information:

ARM: How to write a bootloader

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

View solution in original post

5 REPLIES 5

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
Up vote any posts that you find helpful, it shows what's working..
Alex R
Senior

Please take a look at the following information:

ARM: How to write a bootloader

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

1123
Associate II

Thank you, the problem has been solved.

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
Associate II

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.