Skip to main content
Xses
Associate
Dec 1, 2021 4:11 PM UTC
Solved

USB HID device on STM32F042F4 using CubeMX - FLASH overflow.

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.
TDK
TDKBest answer
Dec 1, 2021 4:52 PM UTC

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""."

2 replies

TDK
TDKBest answer
Dec 1, 2021 4:52 PM UTC

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
Dec 1, 2021 5:05 PM UTC

That actually worked, thx