Skip to content

turbo: SAMD21 boards loader enable native .mpy default - #11397

Closed
mikeysklar wants to merge 1 commit into
adafruit:mainfrom
mikeysklar:load-native-samd21
Closed

mikeysklar wants to merge 1 commit into
adafruit:mainfrom
mikeysklar:load-native-samd21

Conversation

@mikeysklar

Copy link
Copy Markdown
Collaborator

What

Enables the turbo loader (CIRCUITPY_LOAD_NATIVE) by default on SAMD21.

25 of 75 boards fit. The other 50 opt out in mpconfigboard.mk.

Follows #11332, #11355, #11356 and #11360.

How I tested it

Hardware ran 10.4.0-alpha.1-30-g5762872053 on an Ubuntu host.

Test Board Result
vsum bytecode vs viper .mpy, 4 KB buffer Metro M0 Express 122.9 ms vs 4.2 ms
pixels viper .mpy vs @native .mpy Metro M0 Express 1,176 ms vs 23,648 ms
@micropython.viper in source Metro M0 Express SyntaxError
xtensawin .mpy Metro M0 Express ValueError: incompatible .mpy arch
build, loader on 3 tightest kept boards all fit, see below

Metro M0 Express opts out. It ran an en_US build with the loader forced on (416 B free).

vsum used a 4 KB buffer, since 25.6 KB does not fit in 32 KB RAM. Medians of 5 runs.

Boards were picked from main's Build CI flash free bytes at 82b255fe56, all languages. The loader costs about 1.9 KB.

Tightest boards with the loader Language Flash free with the loader
adafruit_proxlight_trinkey_m0 ru 412 B
adafruit_pixel_trinkey_m0 ru 412 B
hallowing_m0_express de_DE 732 B
other 22 boards 2.7 to 63 KB before the loader
50 opt-outs, flash free on main without the loader
Opt-out Language Free without the loader
catwan_usbstick ru 2,176 B
sensebox_mcu ru 1,984 B
dynossat_edu_eps de_DE 1,932 B
pewpew10 ru 1,788 B
circuitplayground_express_displayio de_DE 1,732 B
stringcar_m0_express de_DE 1,680 B
escornabot_makech ru 1,652 B
meowmeow ru 1,600 B
feather_m0_rfm9x ru 1,324 B
cp_sapling_m0 ru 1,312 B
bast_pro_mini_m0 ru 1,304 B
feather_m0_rfm69 ru 1,284 B
circuitbrains_basic_m0 de_DE 1,228 B
stackrduino_m0_pro de_DE 1,180 B
picoplanet ru 1,156 B
gemma_m0 ru 1,072 B
feather_m0_supersized de_DE 1,036 B
feather_m0_express de_DE 1,004 B
fluff_m0 ru 956 B
adafruit_trrs_trinkey_m0 ru 940 B
shirtty ru 916 B
arduino_nano_33_iot ru 880 B
trinket_m0 ru 780 B
metro_m0_express de_DE 752 B
datum_light ru 720 B
datum_weather ru 716 B
sparkfun_redboard_turbo de_DE 716 B
datum_distance ru 712 B
itsybitsy_m0_express de_DE 700 B
sparkfun_qwiic_micro_no_flash ru 644 B
ndgarage_ndbit6_v2 ru 632 B
cp_sapling_m0_revb ru 612 B
uchip ru 568 B
snekboard de_DE 492 B
huntercat_nfc de_DE 476 B
qtpy_m0 ru 460 B
ndgarage_ndbit6 ru 424 B
sparkfun_samd21_mini ru 424 B
feather_m0_basic ru 412 B
pyruler ru 408 B
trinket_m0_haxpress de_DE 360 B
seeeduino_xiao ru 352 B
arduino_mkrzero ru 328 B
datum_imu ru 312 B
sparkfun_samd21_dev ru 308 B
qtpy_m0_haxpress de_DE 300 B
arduino_mkr1300 ru 224 B
arduino_zero ru 196 B
feather_m0_adalogger ru 148 B
pewpew_lcd de_DE 64 B

AI assistance

Claude Code was used.

Turn on CIRCUITPY_LOAD_NATIVE for SAMD21 boards. It fits on 25 of them.
The other fifty have too little flash to spare and opt out in their own
mpconfigboard.mk:

  adafruit_trrs_trinkey_m0, arduino_mkr1300, arduino_mkrzero,
  arduino_nano_33_iot, arduino_zero, bast_pro_mini_m0, catwan_usbstick,
  circuitbrains_basic_m0, circuitplayground_express_displayio,
  cp_sapling_m0, cp_sapling_m0_revb, datum_distance, datum_imu,
  datum_light, datum_weather, dynossat_edu_eps, escornabot_makech,
  feather_m0_adalogger, feather_m0_basic, feather_m0_express,
  feather_m0_rfm69, feather_m0_rfm9x, feather_m0_supersized, fluff_m0,
  gemma_m0, huntercat_nfc, itsybitsy_m0_express, meowmeow,
  metro_m0_express, ndgarage_ndbit6, ndgarage_ndbit6_v2, pewpew_lcd,
  pewpew10, picoplanet, pyruler, qtpy_m0, qtpy_m0_haxpress,
  seeeduino_xiao, sensebox_mcu, shirtty, snekboard,
  sparkfun_qwiic_micro_no_flash, sparkfun_redboard_turbo,
  sparkfun_samd21_dev, sparkfun_samd21_mini, stackrduino_m0_pro,
  stringcar_m0_express, trinket_m0, trinket_m0_haxpress, uchip

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@dhalbert

Copy link
Copy Markdown
Collaborator

Closing this for now. We can revisit whether native .mpy loading makes sense on certain SAMD21 boards despite the limited RAM.

@dhalbert dhalbert closed this Sep 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants