Skip to main content
MSMorkan_R
Associate
Dec 14, 2020 11:02 AM UTC
Solved

STM32F042K6 USB HID Library Size Problem

Hi,

I have created a CubeMx project for STM32F042K6. I am using following components:

  • USB
  • TSC
  • IWDG
  • GPIO
  • TOUCHSENSING
  • USB_DEVICE

I just defined the pins and tried to compile but compiler says FLASH overflows around 2.5K

I didn't even write one line of code. Then I realized USB HID library takes a lot of space (around 21K) on the FLASH.

How can I reduce this size? Is there anyway to use it as Keyboard+Mouse without using entire library? Or is there any 'Lite' libray for USB HID?

Thanks

This topic has been closed for replies.
Vangelis Fortounas
Associate II
Dec 14, 2020 12:22 PM UTC

Hello

Change compiler optimizations for smaller code.

3 replies

Vangelis Fortounas
Associate II
Dec 14, 2020 12:22 PM UTC

Hello

Change compiler optimizations for smaller code.

MSMorkan_R
Associate
Dec 14, 2020 12:52 PM UTC

Thanks! It solved the problem. Code size reduced to half (around 16K). Does this method has any side effects?

Vangelis Fortounas
Associate II
Dec 14, 2020 2:51 PM UTC

hello

When reduce size , depending on the code, results varies. May observed slower execution.