cancel
Showing results for 
Search instead for 
Did you mean: 

I am trying to jump from my application into the bootloader. It works as long as I pull the pin BOOT0 high, which in my case means setting a jumper. Is there a way to get into the bootloader while BOOT0 is pulled low? My device is STM32L412.

SBros.1
Associate II

Device: STM32L412

Code:

typedef void (*pFunction)(void);
 
volatile uint32_t addr = 0x1FFF0000;
uint32_t JumpAddress = *(__IO uint32_t*) (addr + 4);
pFunction Jump_To_Boot = (pFunction) JumpAddress;
 
#if defined(USE_HAL_DRIVER)
	HAL_RCC_DeInit();
#endif /* defined(USE_HAL_DRIVER) */
#if defined(USE_STDPERIPH_DRIVER)
	RCC_DeInit();
#endif /* defined(USE_STDPERIPH_DRIVER) */
 
SysTick->CTRL = 0;
SysTick->LOAD = 0;
SysTick->VAL = 0;
 
__disable_irq();
 
__HAL_SYSCFG_REMAPMEMORY_SYSTEMFLASH();
 
__set_MSP(*(__IO uint32_t*) addr);
 
Jump_To_Boot();
 

SOURCE: https://stm32f4-discovery.net/2017/04/tutorial-jump-system-memory-software-stm32/

I also tried configuring BOOT0 pin as ouput and setting it high before Jump_To_Boot() but without success.

2 REPLIES 2
berendi
Principal

The hardware method

Add some external components to the pin so it can hold its state for a couple of microseconds.

0690X00000BvZWPQA3.png

The software method

Boot pins can be overridden by the nSWBOOT0, nBOOT0, nBOOT1 user option bits

0690X00000BvZZTQA3.png

but then you'll have to change them back through the DFU or serial bootloader interface to be able to boot from main flash again.

SBros.1
Associate II

Thank you for this very fast and accurate response. Amazing!

��

(I will implement the hardware method on the next board revision.)