Tutorial – Jump to system memory from software on STM32

One of you are already familiar with STM32 feature of embedded bootloader for software download to flash.

This memory is called system memory and is normally accessible with BOOT configuration (either pin hardware or option bytes (later OB) in flash software).

Normally, if you want to jump to system memory, you have to setup pin/OB and reset device. If you have OB setup, this is ok, but since you need at least one BOOT pin in hardware, this can lead to hardware problems.

This tutorial will cover, how to jump to system memory from current program in STM32. This is a way, how to start STM32 internal bootloader for software update.


This tutorial will cover STM32F4 family, but the same principle works for any other family.

In application note for hardware start for STM32F4 (AN4488) you can find a table showing you how to setup boot pins for different configuration.

STM32F4 boot configuration

STM32F4 boot configuration

BOOT0 pin is dedicated on device, while BOOT1 is shared with PB2. When (normally) main flash memory is used, only BOOT0 configuration is required, BOOT1 pin does not care. To make hardware development easier, we can set BOOT0 pin to GND and force device to always jump to main flash memory.

Since we know system memory is available, we also know that it is somewhere in memory on specific memory location. Now, each device has this on different address, but on STM32F429, which I use, it is available on memory location 0x1FFF0000.

Application note (AN2606)describe bootloader in details and also gives you information on where is memory location for specific device [Table 110].

Since now we know where our memory address is, we have to perform jump to that location and if possible, reflect system memory to 0x00000000 address so that MCU sees this at start address.

Steps for jumping to system memory

If you wish to just from main program to system memory at anytime, some important steps needs to be performed first:

  • Find system memory location for specific STM32 in AN2606
  • Set RCC to default values (the same as on startup) [Internal clock, no PLL, etc.)
  • Disable SysTick interrupt and reset it to default
  • Disable all interrupts
  • Map system memory to 0x00000000 location
  • Set jump location to memory location + 4 bytes offset
  • Set main stack pointer to value stored at system memory location address
  • Call virtual function assigned before

To test this code, set boot configuration to main flash memory (default on all STM32 evaluation boards) and run program and call function above when desired.

To test, if jump was successful, open STM32 Flash loader demonstrator software and try to connect via UART with external USB<->UART transceiver.


Owner of this site. Application engineer, currently employed by STMicroelectronics. Exploring latest technologies and owner of different libraries posted on Github.

You may also like...