2023-07-28 12:31 AM
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?
2023-07-28 01:16 AM - edited 2023-07-28 01:24 AM
Hello,
According to what I found in EVSPIN32F0601S1 - EVSPIN32F0601S1 3-phase inverter based on STSPIN32F0601 - STMicroelectronics
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
2023-07-28 01:40 AM
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
}
2023-07-28 04:47 AM
This parameter is too large for me:
_Min_Heap_Size = 0x1280 ; /* required amount of heap */
Try _Min_Heap_Size = 0x400 ;
Olivier
2023-07-28 08:44 AM
Tried reducing the heap size down to 400, 200,100 ... nothng works. The build errors remain the same.
2023-08-22 08:12 AM - edited 2023-08-22 08:17 AM
Hello,
I compile EVALSTSPIN32F0H60 example using STM32CubeIde and following setup to save space on flash/ram:
/* 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
}
This latest update is key to reduce RAM/FLASH size.
If it still doesn't work on your side, try:
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.
When you will locate the culprit, and solved this size issue, came back to original FLASH/RAM setup.
2023-08-22 08:18 AM
Hello,
I compile EVALSTSPIN32F0H60 example using STM32CubeIde and following setup to save space on flash/ram:
/* 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
}
This latest update is key to reduce RAM/FLASH size.
If it still doesn't work on your side, try:
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.
When you will locate the culprit, and solved this size issue, came back to original FLASH/RAM setup.
2023-08-22 10:31 AM
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?
2023-08-22 10:33 AM
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