cancel
Showing results for 
Search instead for 
Did you mean: 

Hello, I AM working on the stm32f070c6 i have write a firmware of it , but it is showing heap and stack overflow ,i just put heap and stack 400, please help me how can i overcome this error please give suggestions thanks in advance.

RKUMA.2
Associate II
 
7 REPLIES 7
Mike_ST
ST Employee

Hello,

Have you tried greater values ?

Without the exact error, build log and context it is hard to know.

My guess is that this is occurring at the Linker level and already using too much memory, so making bigger won't help.

How large is the code being built?​

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

Use higher optimization settings. Maybe buy a bigger chip.

If you feel a post has answered your question, please click "Accept as Solution".

thanks for your reply @TDK​ , in the past also i got the same error , but it was removed by make some change in Stm cube IDE >> properties and made some settings so that the error was gone, recently i update stmcube ide , so the same problem occurring. I am using stm32f070c6t6 and heap=400 and stack =400,how can i remove this error. i am not finding the previous suggested pages in the forum.

the error details in consolr as below.

c:\st\stm32cubeide_1.3.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924\tools\arm-none-eabi\bin\ld.exe: LLUSBCDC.elf section `._user_heap_stack' will not fit in region `RAM'

c:\st\stm32cubeide_1.3.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.9-2020-q2-update.win32_1.5.0.202011040924\tools\arm-none-eabi\bin\ld.exe: region `RAM' overflowed by 1408 bytes

collect2.exe: error: ld returned 1 exit status

make: *** [makefile:69: LLUSBCDC.elf] Error 1

"make -j2 all" terminated with exit code 2. Build might be incomplete.

thanks for your response @Mike_ST​ , i have tried with changing the heap and stack values, memory flow error remains same but the size of the memory varying. previously i have the same problem , but it was remove by stm cube IDE >> properties settings , but I am not getting the same page in forum ,so please help me if you have an idea, Thanks in advance....

Already too big.

How much heap does it actually use? ie via malloc()/free() used anywhere in your code, or the library/example code.

What it eating up the memory? You could perhaps expand the RAM in the linker script, allowing completion/closure, and then reviewing/auditing the .MAP file,

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

This is a very conceptually simple problem. You can't fit more information into RAM than the chip has space for. You'll need to cut down on your RAM usage by reducing stack and/or heap size, or reducing use of global variables. There is no magic solution that you can enable that allows you to use more memory than the chip has.

You may also want to verify that the size of the RAM in your linker script correctly matches the size of the RAM given in the datasheet.

High optimization settings tend to help with this problem. Project -> Build Config -> Set Active -> Release.

If you feel a post has answered your question, please click "Accept as Solution".