2017-11-20 10:12 PM
Hi,
my STM32F302R8 Device with 64KByte FLASH, 16KByte RAM.
I configured
Min_Heap_Size and Min_Stack_Size in file '
stm32_flash.ld' as below._Min_Heap_Size = 0x400;
_Min_Stack_Size = 0x1000;While build the project codes, below error was happened.
----------------------------------------
--------------------------------------------------------------------------------
c:/emb_tool/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld.exe: ./Release/my_app.elf section `._user_heap_stack' will not fit in region `RAM'
c:/emb_tool/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld.exe: region `RAM' overflowed by 96 bytescollect2.exe: error: ld returned 1 exit statusmake: *** [all] Error 1----------------------------------------
----------------------------------------
----------------------------------------
After changed
_Min_Heap_Size from 0x400 to 0x200, re-bulid it and no more error.
Actually, I didn't know how to figure out the _Min_Heap_Size and _Min_Stack_Size.
Does any expert share the experience how to figure out the
_Min_Heap_Size and
_Min_Stack_Size?
Thanks.
Solved! Go to Solution.
2017-11-20 10:42 PM
Basically, the usage is the same as with compilers in a OS environment.
Heap is used for allocated memory (malloc, new), and the stack for call parameters and local variables.
Depending on your project, 1k of heap and 4k of stack seems quite a lot.
I do rarely use allocated memory, thus heap size is zero for most of my projects.
Some IDEs start out with a default setting of 128 bytes of stack.
c:/emb_tool/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld.exe: ./Release/my_app.elf section `._user_heap_stack' will not fit in region `RAM'
Strange message - actually, heap and stack alone do fit.
In most cases, the linker puts heap and stack first, and complains about 'user' variables overflowing.
2017-11-20 10:42 PM
Basically, the usage is the same as with compilers in a OS environment.
Heap is used for allocated memory (malloc, new), and the stack for call parameters and local variables.
Depending on your project, 1k of heap and 4k of stack seems quite a lot.
I do rarely use allocated memory, thus heap size is zero for most of my projects.
Some IDEs start out with a default setting of 128 bytes of stack.
c:/emb_tool/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld.exe: ./Release/my_app.elf section `._user_heap_stack' will not fit in region `RAM'
Strange message - actually, heap and stack alone do fit.
In most cases, the linker puts heap and stack first, and complains about 'user' variables overflowing.
2017-11-27 08:43 PM
Hi AvaTar,
Thanks a lot.