cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F042K6 USB HID Library Size Problem

MSMorkan_R
Associate

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

1 ACCEPTED SOLUTION

Accepted Solutions

Hello

Change compiler optimizations for smaller code.

View solution in original post

3 REPLIES 3

Hello

Change compiler optimizations for smaller code.

MSMorkan_R
Associate

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

hello

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