2019-04-18 11:54 PM
Hi,
I have to to run my code in RAM on STM32H7 and debug it.
I put my code in RAM_D1 (start address = 0x24000004) changing the linker file in this way:
/* The program code and other data goes into FLASH */
_sl_my_Code = LOADADDR(.my_Code); /* pnt to the flash */
.my_Code :
{
. = ALIGN(4);
_smy_Code = .; /* define a global symbols at start of code */
*(.my_Code)
*(.my_Code*)
. = ALIGN(4);
_emy_Code = .; /* define a global symbols at end of code */
} > RAM_D1 /* code execute in ram */
.my_Code is the code that I wish to run in RAM.
The debug does not work and the code execution goes in Error Handler status.
2019-04-19 02:31 AM
Hello @ADion ,
Could you please check whether your vector table is relocated into internal SRAM. This is done by uncommenting "/* #define VECT_TAB_SRAM */" in "system_stm32h7xx.c" file.
Khouloud.
2019-04-19 11:26 AM
Just changing the Linker Script is not sufficient to get data into RAM, you need to add code in startup.s to unpack this code/data from FLASH and into RAM.
Some H7 RAMs require clocks to be enabled too. GNU/GCC does a really poor job of managing load regions and unpacking automatically.