Skip to content

Commit 1d6f66f

Browse files
Shrink flash and RAM usage even more (#627)
Remove MIDI support from the core's main TinyUSB. MIDI is still supported using the Adafruit TinyUSB library, just like before (the core never did use it). Compile the Pico-SDK using `-Os` Remove unneeded warning in UF2 upload Blink.ino shows a savings of 3.5KB flash and 400 bytes of RAM. For comparison, with this PR blink.ino reports: ```` Sketch uses 49908 bytes (3%) of program storage space. Maximum is 1568768 bytes. Global variables use 7024 bytes (2%) of dynamic memory, leaving 255120 bytes for local variables. Maximum is 262144 bytes. ```` As comparison, using the MBED core blink.ino reports: ```` Sketch uses 78882 bytes (0%) of program storage space. Maximum is 16777216 bytes. Global variables use 42780 bytes (15%) of dynamic memory, leaving 227556 bytes for local variables. Maximum is 270336 bytes. ```` So, with this PR we use **37% less flash** and and **87% less RAM** for simple sketches.
1 parent 3fb8cbf commit 1d6f66f

File tree

4 files changed

+3
-2
lines changed

4 files changed

+3
-2
lines changed

lib/libpico.a

-234 KB
Binary file not shown.

tools/libpico/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ target_compile_definitions(pico PUBLIC
2121

2222
target_compile_options(pico PUBLIC
2323
-fno-exceptions
24+
-Os
2425
$<$<COMPILE_LANGUAGE:CXX>:-fno-rtti>
2526
)
2627

tools/libpico/tusb_config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
#define CFG_TUD_HID (2)
7474
#define CFG_TUD_CDC (1)
7575
#define CFG_TUD_MSC (0)
76-
#define CFG_TUD_MIDI (1)
76+
#define CFG_TUD_MIDI (0)
7777
#define CFG_TUD_VENDOR (0)
7878

7979
#define CFG_TUD_CDC_RX_BUFSIZE (256)

tools/uf2conv.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ def error(msg):
350350
ser = serial.Serial(args.serial, 1200)
351351
ser.dtr = False
352352
except:
353-
print("Caught exception during reset!")
353+
pass # Ignore error in the case it is already in upload mode
354354
except:
355355
pass
356356
if args.list:

0 commit comments

Comments
 (0)