cancel
Showing results for 
Search instead for 
Did you mean: 

How to run code in RAM(STM32H7 MCU)

Edwin kaus
Associate II
Posted on June 10, 2018 at 14:28

Hello.,.,

I am using STM32H743 MCU in our application. Here I have a reuirement to run the program in RAM during debug session, I am using Keil 5 IDE. Presently the is flashing to MCU flash during debug also. 

Can anybody help how to make setup in keil IDE to run code in RAM during debugging time.

Thank you .,

#keil-mdk5 #stm32h7
1 ACCEPTED SOLUTION

Accepted Solutions
Posted on June 10, 2018 at 15:15

1) Configure the Target settings to build code for RAM

2) Disable 'Load Application at Startup'

3) Use 'Initialization File' to drive download/execution

Assuming an 0x20000000 SRAM address (Dbg_RAM.ini)

FUNC void Setup (void) {

  SP = _RDWORD(0x20000000);          // Setup Stack Pointer

  PC = _RDWORD(0x20000004);          // Setup Program Counter

  _WDWORD(0xE000ED08, 0x20000000);   // Setup Vector Table Offset Register

}

LOAD %L INCREMENTAL                  // load the application

Setup();                             // Setup for Running

g, main

For external memory you'll need to add setup code to stand up the clocks, peripheral, pins and memory

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

5 REPLIES 5
Posted on June 10, 2018 at 15:15

1) Configure the Target settings to build code for RAM

2) Disable 'Load Application at Startup'

3) Use 'Initialization File' to drive download/execution

Assuming an 0x20000000 SRAM address (Dbg_RAM.ini)

FUNC void Setup (void) {

  SP = _RDWORD(0x20000000);          // Setup Stack Pointer

  PC = _RDWORD(0x20000004);          // Setup Program Counter

  _WDWORD(0xE000ED08, 0x20000000);   // Setup Vector Table Offset Register

}

LOAD %L INCREMENTAL                  // load the application

Setup();                             // Setup for Running

g, main

For external memory you'll need to add setup code to stand up the clocks, peripheral, pins and memory

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on June 10, 2018 at 15:40

https://community.st.com/0D50X00009bMM79SAG

 

Although I have never tested it on H7.

Posted on June 10, 2018 at 15:59

>>Although I have never tested it on H7

The process should be the same, the addresses might change.

I'm sure this is ALL documented, and the mechanics are not particularly complicated. You have to walk the debugger through the steps you would normally do in software for external memory set up, which is usually board/chip specific.

Certain SRAM on the H7 will likely require clocks to be enabled.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on June 10, 2018 at 16:34

F7/H7 area scares me;) Had STM32F746-DISCO, played with the graphic and switched to Raspberry PI - like boards. I prefer simpler boards in ARM area.

I believe PC-like apps (complex graphic, Ethernet connectivity, flash storage) run better on PC-like boards...

Uwe Bonnes
Principal III
Posted on June 11, 2018 at 13:00

If you have a section of initialized variables that are changed during runtime, special considerations are needed  for a program in RAM to keep the initialisation values over reset. Normally, after reset the values would have the value set during runtime. So you must handle initialized, but variable datea in  the reset routine and load them to from a save area.