0

I have a custom Leonardo board (mega32u4-based) that does not use at all the USB features. When I build my sketch (vscode and platformio) I read:

Compiling .pio/build/leonardo/FrameworkArduino/CDC.cpp.o
Indexing .pio/build/leonardo/libFrameworkArduinoVariant.a
Compiling .pio/build/leonardo/FrameworkArduino/HardwareSerial.cpp.o
Archiving .pio/build/leonardo/lib02e/libFadeLed.a
Compiling .pio/build/leonardo/FrameworkArduino/HardwareSerial0.cpp.o
Indexing .pio/build/leonardo/lib02e/libFadeLed.a
Compiling .pio/build/leonardo/FrameworkArduino/HardwareSerial1.cpp.o
Compiling .pio/build/leonardo/FrameworkArduino/HardwareSerial2.cpp.o
Compiling .pio/build/leonardo/FrameworkArduino/HardwareSerial3.cpp.o
Archiving .pio/build/leonardo/libfa3/libWire.a
Indexing .pio/build/leonardo/libfa3/libWire.a
Compiling .pio/build/leonardo/FrameworkArduino/IPAddress.cpp.o
Compiling .pio/build/leonardo/FrameworkArduino/PluggableUSB.cpp.o
Compiling .pio/build/leonardo/FrameworkArduino/Print.cpp.o
Compiling .pio/build/leonardo/FrameworkArduino/Stream.cpp.o
Compiling .pio/build/leonardo/FrameworkArduino/Tone.cpp.o
Compiling .pio/build/leonardo/FrameworkArduino/USBCore.cpp.o
Compiling .pio/build/leonardo/FrameworkArduino/WInterrupts.c.o
Compiling .pio/build/leonardo/FrameworkArduino/WMath.cpp.o
Compiling .pio/build/leonardo/FrameworkArduino/WString.cpp.o
Compiling .pio/build/leonardo/FrameworkArduino/abi.cpp.o
Compiling .pio/build/leonardo/FrameworkArduino/hooks.c.o
Compiling .pio/build/leonardo/FrameworkArduino/main.cpp.o
Compiling .pio/build/leonardo/FrameworkArduino/new.cpp.o
Compiling .pio/build/leonardo/FrameworkArduino/wiring.c.o
Compiling .pio/build/leonardo/FrameworkArduino/wiring_analog.c.o
Compiling .pio/build/leonardo/FrameworkArduino/wiring_digital.c.o
Compiling .pio/build/leonardo/FrameworkArduino/wiring_pulse.S.o
Compiling .pio/build/leonardo/FrameworkArduino/wiring_pulse.c.o
Compiling .pio/build/leonardo/FrameworkArduino/wiring_shift.c.o

I wonder if I can disable the USB support (CDC, PluggableUSB, USBCore) and also network stuff (IPAddress) in order to save flash space.

8
  • 2
    I think the optimizer will kick that stuff out when you don't use it. So that should already happen.
    – chrisl
    May 31, 2022 at 9:15
  • USBCore creates the com port for upload and handles the 1200 baud 'touch' for reset to bootloader before upload
    – Juraj
    May 31, 2022 at 9:43
  • @Juraj, yes but as I said I have no bootloader neither any USB com port
    – Mark
    May 31, 2022 at 12:56
  • @Juraj done. I can't find any entry about IPAddress but all the USB stuff is there
    – Mark
    May 31, 2022 at 17:47
  • main.cpp has USBDevice.attach();
    – Juraj
    May 31, 2022 at 18:04

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.