cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F042K6 - USB Library too big for device?

PP11
Associate II

 

Hello everyone,

 

I am using the STM32F042K6 for a small project where I don't have much space. Therefore, I rely on the small package and the "crystal-less USB" function. The hardware arrived today, but unfortunately, I had to realize that the USB library seems to be too large for the chip. I created a new, empty project in CUBE IDE, with only I2C and USB (COM PORT) enabled, and I get the following error message:

 

"c:\st\stm32cubeide_.2.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.200.202301161003\tools\arm-none-eabi\bin\ld.exe: Test_Project.elf section .data' will not fit in region FLASH'
 
c:\st\stm32cubeide_1.2.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.200.202301161003\tools\arm-none-eabi\bin\ld.exe: region `FLASH' overflowed by 12 bytes"

 

 

This is quite frustrating when it is advertised and then doesn't work "out of the box." What can I do?
 
Best regards,
Paul

 

10 REPLIES 10

After 12 months spent on a STM32H7 spaceship I thought integrating a tiny STM32F042G6 in a new design for my company would have been a breeze. Sadly I didn't realized how tiny it was untile I received the very first prototype. Sigh.

Started a project in STM32CubeIDE, configured internal clock, I2C1, ADC, USART2, USB pins, some IOs, optimize more for size (-Oz), with only a blank code...

Spaghetto_0-1756911299888.png

Suddenly I felt worried. I added than the: Middleware>USB_DEVICE>Communication Device Class (Virtual Port Com)

Spaghetto_1-1756911398618.png

This destroyed me.

I spent more than an hour in full desperation mode sailing the internet looking for help than I come up with your post: the 512 bytes worked flawlessly.

Thanks for saving my donkey.