Skip to main content
Associate
November 17, 2023
Question

Problem to compile program for stm32f042g6ux whit usb virtual com

  • November 17, 2023
  • 2 replies
  • 1588 views

I have problem to compile a simple progragram that use usb virtual com for mcu stm32F042G6Ux , i have create the file from stm32cubemx (.ioc file ) when build it i recive this error

STM32F042G6UX_PROVA.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.7-2018-q2-update.win32_1.0.0.201904181610\tools\arm-none-eabi\bin\ld.exe: region `RAM' overflowed by 328 bytes
collect2.exe: error: ld returned 1 exit status
make: *** [makefile:48: STM32F042G6UX_PROVA.elf] Error 1
"make -j4 all" terminated with exit code 2. Build might be incomplete.

17:58:11 Build Failed. 1 errors, 0 warnings. (took 6s.314ms)

i try to increase the minimun size heap but i have the same errorstm32f042.jpg

    This topic has been closed for replies.

    2 replies

    Visitor II
    November 17, 2023
    Tesla DeLorean
    Guru
    November 17, 2023

    The part only has 6KB of RAM, need to make some determination where your code is using it, for things like stack and heap, and perhaps shrink some of the global allocations if you aren't using them.

    This is hard to debug remotely. You can perhaps modify the linkers script to indicate it has more RAM so you can get closure from the linker, and inspect the .MAP file to see where you're using it in a successful build.

    But you need to understand YOUR CODE, and where and how you're using the finite resources you have in the chip you've chosen.

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