Skip to main content
Xses
Associate
December 1, 2021
Solved

USB HID device on STM32F042F4 using CubeMX - FLASH overflow.

  • December 1, 2021
  • 2 replies
  • 1323 views

Hi,

When I set the USB class to anything in CubeMX, the compiler gives me the error - FLASH overflow. It happens even with a completely empty main.c file, so is there a way to make it work, or should I choose MCU with 32kB flash (it will fit then)? The current one has 16kB.

This topic has been closed for replies.
Best answer by TDK

You can try turning on optimization to see if it reduces the code size enough. Change the build configuration to Release.

Project -> Build Configurations -> Set Active -> Release

Generally, CubeMX and HAL wasn't created for chips with small FLASH sizes.

2 replies

TDK
TDKBest answer
December 1, 2021

You can try turning on optimization to see if it reduces the code size enough. Change the build configuration to Release.

Project -> Build Configurations -> Set Active -> Release

Generally, CubeMX and HAL wasn't created for chips with small FLASH sizes.

"If you feel a post has answered your question, please click ""Accept as Solution""."
Xses
XsesAuthor
Associate
December 1, 2021

That actually worked, thx