Skip to main content
MSMorkan_R
Associate
December 14, 2020
Solved

STM32F042K6 USB HID Library Size Problem

  • December 14, 2020
  • 3 replies
  • 995 views

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.
Best answer by Vangelis Fortounas

Hello

Change compiler optimizations for smaller code.

3 replies

Vangelis Fortounas
Associate II
December 14, 2020

Hello

Change compiler optimizations for smaller code.

MSMorkan_R
Associate
December 14, 2020

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

Vangelis Fortounas
Associate II
December 14, 2020

hello

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