So I am working on bigger project with quite a few external dependencies. It seems that despite -Os some of these still have quite the code bloat and my T4 is running out of memory.
These seem to be the biggest offenders at the moment:
Forking each of these libraries and removing things I don't need/use (like removing the Opus from the Codecs library) could be an option, but I wonder if the compiler could be smart enough to do that. I think with LTO (at least in theory) it should have all the information to remove unsued objects. I tried adding it to my build flags but it doesn't seem to work:
Saw similar errors mentioned here and the fix was to make the static const. That cannnot be used with __attribute__((weak)) though...
Did anybody manage to make LTO work with latest Teensyduino 1.58 toolchain? And, more generally, any tips besides using PROGMEM (can't use that in external libraries everywhere) to reduce size of my firmware? Could priobably experiment with --gc-sections as well.
These seem to be the biggest offenders at the moment:
Forking each of these libraries and removing things I don't need/use (like removing the Opus from the Codecs library) could be an option, but I wonder if the compiler could be smart enough to do that. I think with LTO (at least in theory) it should have all the information to remove unsued objects. I tried adding it to my build flags but it doesn't seem to work:
C:\Users\X\.platformio\packages\framework-arduinoteensy@src-0883a3d713cdb3613f9056dcc751d771\cores\teensy4\EventResponder.cpp:45:9: error: '_serialEvent_default' causes a section type conflict with 'usb_config_descriptor_12'
45 | uint8_t _serialEvent_default __attribute__((weak)) PROGMEM = 0 ;
| ^
C:\Users\X\.platformio\packages\framework-arduinoteensy@src-0883a3d713cdb3613f9056dcc751d771\cores\teensy4\usb_desc.c:1669:23: note: 'usb_config_descriptor_12' was declared here
1669 | PROGMEM const uint8_t usb_config_descriptor_12[CONFIG_DESC_SIZE] = {
| ^
lto-wrapper.exe: fatal error: arm-none-eabi-g++ returned 1 exit status
Saw similar errors mentioned here and the fix was to make the static const. That cannnot be used with __attribute__((weak)) though...
Did anybody manage to make LTO work with latest Teensyduino 1.58 toolchain? And, more generally, any tips besides using PROGMEM (can't use that in external libraries everywhere) to reduce size of my firmware? Could priobably experiment with --gc-sections as well.