cancel
Showing results for 
Search instead for 
Did you mean: 

evspin32f0601s1 code not building

Amit G
Associate II

 

I am trying to build the code on STM32CUBE IDE Version: 1.13.0. This code for evspin32f0601s1 is generated by CubeMX.

It is throwing up 3 errors as below:


C:\Program Files\STMicroelectronics\STM32CubeIDE_1.13.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.11.3.rel1.win32_1.1.0.202305231506\tools\arm-none-eabi\bin\ld.exe: FOX1HV.elf section `._user_heap_stack' will not fit in region `RAM'

C:\Program Files\STMicroelectronics\STM32CubeIDE_1.13.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.11.3.rel1.win32_1.1.0.202305231506\tools\arm-none-eabi\bin\ld.exe: region `RAM' overflowed by 16 bytes

make: *** [makefile:66: FOX1HV.elf] Error 1

Any solution for this?

 

8 REPLIES 8
OlivierR
ST Employee

Hello,

 

According to what I found in EVSPIN32F0601S1 - EVSPIN32F0601S1 3-phase inverter based on STSPIN32F0601 - STMicroelectronics

  • Rom size is 32K (0x08000000..0x08007FFF)
  • Ram size is 4K   (0x20000000..0x20000FFF)
  • cstack = 0x400
  • heap = 0x200

define symbol __ICFEDIT_region_ROM_start__ = 0x08000000;
define symbol __ICFEDIT_region_ROM_end__   = 0x08007FFF;
define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
define symbol __ICFEDIT_region_RAM_end__   = 0x20000FFF;
/*-Sizes-*/
define symbol __ICFEDIT_size_cstack__ = 0x400;
define symbol __ICFEDIT_size_heap__ = 0x200;

 

You can try to adjust memory mapping size (heap, stack) in file used by linker.

File name should be something like xxxflash.ld (STM32CubeIde) or xxxflash.icf (EWARM)

 

Olivier

 

Here is the code in the linker file STM32F031C6TX_FLASH.ld. Any suggested changes?

 

/* Entry Point */

ENTRY(Reset_Handler)

 

/* Highest address of the user mode stack */

_estack = ORIGIN(RAM) + LENGTH(RAM); /* end of "RAM" Ram type memory */

 

_Min_Heap_Size = 0x1280 ; /* required amount of heap */

_Min_Stack_Size = 0x400 ; /* required amount of stack */

 

/* Memories definition */

MEMORY

{

RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 4K

FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 32K

}

OlivierR
ST Employee

This parameter is too large for me:

_Min_Heap_Size = 0x1280 ; /* required amount of heap */

Try _Min_Heap_Size = 0x400 ;

Olivier

Tried reducing the heap size down to 400, 200,100 ... nothng works. The build errors remain the same.

OlivierR
ST Employee

Hello, 

I compile EVALSTSPIN32F0H60 example using STM32CubeIde and following setup to save space on flash/ram:

  • On linker file size are:

/* Entry Point */

ENTRY(Reset_Handler)

/* Highest address of the user mode stack */

_estack = ORIGIN(RAM) + LENGTH(RAM); /* end of "RAM" Ram type memory */

_Min_Heap_Size = 0x200; /* required amount of heap */

_Min_Stack_Size = 0x400; /* required amount of stack */

/* Memories definition */

MEMORY

{

RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 4K

FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 32K

}

  • On Tool Settings / MCU GCC Compiler / Debugging: Debug Level = None
  • On Tool Settings / MCU GCC Compiler / Optimization: Optimization Level = Optimize more (-O2)

This latest update is key to reduce RAM/FLASH size.

 

 

If it still doesn't work on your side, try:

  • On Tool Settings / MCU GCC Compiler / Optimization: Optimization Level = None (-O0)

 

 

If it still doesn't work, try to increase (For test purpose only!!!) RAM/FLASH/Heap/Stask:

_Min_Heap_Size = 0x2000; /* required amount of heap */

_Min_Stack_Size = 0x4000; /* required amount of stack */

/* Memories definition */

MEMORY

{

RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 256K

FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 256K

}

After this, check and locate the culprit using "Build Analyzer" / "Memory Details" / Flash and Ram tools.

It will help to understand where RAM/FLASH are used.

OlivierR_0-1692717102456.pngOlivierR_1-1692717132669.png

When you will locate the culprit, and solved this size issue, came back to original FLASH/RAM setup.

 

 

Hello, 

I compile EVALSTSPIN32F0H60 example using STM32CubeIde and following setup to save space on flash/ram:

  • On linker file size are:

/* Entry Point */

ENTRY(Reset_Handler)

/* Highest address of the user mode stack */

_estack = ORIGIN(RAM) + LENGTH(RAM); /* end of "RAM" Ram type memory */

_Min_Heap_Size = 0x200; /* required amount of heap */

_Min_Stack_Size = 0x400; /* required amount of stack */

/* Memories definition */

MEMORY

{

RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 4K

FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 32K

}

  • On Tool Settings / MCU GCC Compiler / Debugging: Debug Level = None
  • On Tool Settings / MCU GCC Compiler / Optimization: Optimization Level = Optimize more (-O2)

This latest update is key to reduce RAM/FLASH size.

 

 

If it still doesn't work on your side, try:

  • On Tool Settings / MCU GCC Compiler / Optimization: Optimization Level = None (-O0)

 

 

If it still doesn't work, try to increase (For test purpose only!!!) RAM/FLASH/Heap/Stask:

_Min_Heap_Size = 0x2000; /* required amount of heap */

_Min_Stack_Size = 0x4000; /* required amount of stack */

/* Memories definition */

MEMORY

{

RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 256K

FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 256K

}

After this, check and locate the culprit using "Build Analyzer" / "Memory Details" / Flash and Ram tools.

It will help to understand where RAM/FLASH are used.

OlivierR_0-1692717102456.pngOlivierR_1-1692717132669.png

When you will locate the culprit, and solved this size issue, came back to original FLASH/RAM setup.

I tried with the below setting:

RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 256K

FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 256K

It compiled successfully, but I am still not able to figure out what needs to be changed?

 

AmitG_0-1692725323765.png

 

I tried the below:

RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 256K

FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 256K

It compiled without errors. I am still not able to figure out what needs to be changed to get it right. Below is the screen shot of the bug analyser

 

AmitG_1-1692725575542.png