Showing results for 
Search instead for 
Did you mean: 

Run code from ram of STM32H7

Associate II

I have a customized bootloader app which needs to update itself.

I think if linking all the code to RAM and run code in RAM, then it should able to update itself as it does not require accessing flash.

my thought is changing all section with flash (>FLASH) to RAM (>RAM AT> FLASH), ideally it should work.

But it does not, system even not run at all, and cannot set break point.

may I know if this strategy works and may I know how to put entire program into ram and run?

if there is an example, then that will be great.



Update 2022: after recent HAL update also must uncomment


in Core/Src/system_stm32xxx.c

see Run code from RAM on STM32H7 ( for details.

I have developed a custom bootloader that works both from FLASH and RAM of STM32H7. What you need is:

  1. Go to Project → Properties → C/C++ Build → Settings → Tool Settings tab → MCU GCC Linker
  2. Set Linker Script to ${workspace_loc:/${ProjName}/STM32H750VBTX_RAM.ld}
  3. Go to Project → Properties → C/C++ General → Paths and Symbols → Symbols tab
  4. Add symbol VECT_TAB_SRAM
  5. Then you can run your program through Debug.

Make sure you arrange memory regions right if you use DMA. Google on VECT_TAB_SRAM to get more related information.


Pavel A.
Evangelist III

Even if your app runs from RAM you need to put it on the flash.

The bootloader (running off the flash) will copy it into RAM and jump to it.

Then the app can rewrite its copy in the flash.