Skip to content

rp2: Bump pico-sdk to v2.3.1 - #19683

Draft
Gadgetoid wants to merge 2 commits into
micropython:masterfrom
pimoroni:rp2-sdk-2.3.1
Draft

Gadgetoid wants to merge 2 commits into
micropython:masterfrom
pimoroni:rp2-sdk-2.3.1

Conversation

@Gadgetoid

Copy link
Copy Markdown
Contributor

Summary

Bump Pico SDK to v2.3.1 - https://github.com/raspberrypi/pico-sdk/releases/tag/2.3.1

Testing

TBC

Trade-offs and Alternatives

Pico SDK's "bugfix" to linker scripts was walked back in raspberrypi/pico-sdk#3075 and our downstream divergences still preserve the SDK 2.3.0 behaviour. May require some consideration around deferring to upstream.

This bump also sets -mstrict-align on RISCV builds, so there may be a size difference.

Bugfixes may plausibly affect the following issues, but this is as of yet untested:

Generative AI

I used generative AI tools when creating this PR, but a human has checked the
code and is responsible for the code and the description above.

Signed-off-by: Phil Howard <github@gadgetoid.com>
@codecov

codecov Bot commented Sep 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.59%. Comparing base (0fd6c57) to head (3a07249).
⚠️ Report is 71 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #19683   +/-   ##
=======================================
  Coverage   98.58%   98.59%           
=======================================
  Files         182      182           
  Lines       23322    23335   +13     
  Branches        5        5           
=======================================
+ Hits        22993    23006   +13     
  Misses        328      328           
  Partials        1        1           
Flag Coverage Δ
unix-coverage-32bit 98.59% <ø> (+<0.01%) ⬆️
unix-coverage-64bit 98.52% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown

Code size report:

Reference:  rp2: Page-align the C heap ceiling. [11094ea]
Comparison: rp2: Document libc/mem-in-RAM divergence from pico-sdk 2.3.1. [merge of 3a07249]
  mpy-cross:    +0 +0.000% 
   bare-arm:    +0 +0.000% 
minimal x86:    +0 +0.000% 
   unix x64:    +0 +0.000% standard
      stm32:    +0 +0.000% PYBV10
      esp32:    +0 +0.000% ESP32_GENERIC
     mimxrt:    +0 +0.000% TEENSY40
        rp2:   -68 -0.007% RPI_PICO_W[incl -4(bss)]
       samd:    +0 +0.000% ADAFRUIT_ITSYBITSY_M4_EXPRESS
  qemu rv32:    +0 +0.000% VIRT_RV32

@Gadgetoid

Copy link
Copy Markdown
Contributor Author

Will have to poke that rp2 size difference and see if any of it is linker script wobbles versus the code refactor.

@octoprobe-bot

octoprobe-bot commented Sep 5, 2026

Copy link
Copy Markdown

Octoprobe PR report

Test Tests
passed
Tests
skipped
Tests
xfailed
Tests
failed
format flash 4
run-tests.py 3839 446
run-tests.py --via-mpy --emit native 3795 490
run-tests.py --via-mpy 3839 446
run-perfbench.py 96
run-natmodtests.py 288 34 6
run-mpremote-tests.sh 84 24
run-tests.py --test-dirs=extmod_hardware 18 72 30
run-tests.py --test-dirs=extmod_hardware --emit-native 18 72 30
run-tests.py --test-dirs=net_hosted 28 8 4
run-tests.py --test-dirs=net_inet 28 2
run-multitests.py multi_bluetooth/*.py 131 48 35 2
run-multitests.py multi_net/*.py 148 12
Total 12316 1630 101 30
Failures

Group: run-mpremote-tests.sh

Test rp2
5334-
RPI_PICO2
rp2
5334-
RPI_PICO2-
RISCV
rp2
552b-
RPI_PICO2_W
rp2
6038-
RPI_PICO_W
test_unicode.sh FAIL FAIL FAIL FAIL FAIL FAIL FAIL FAIL FAIL FAIL FAIL FAIL
test_mount.sh FAIL FAIL FAIL FAIL FAIL FAIL FAIL FAIL FAIL FAIL FAIL FAIL

Group: run-multitests.py multi_bluetooth/*.py

Reference: 6038-RPI_PICO_W

Test rp2
552b-
RPI_PICO2_W-
instance0
rp2
552b-
RPI_PICO2_W-
instance1
rp2
5f2c-
RPI_PICO_W-
instance0
rp2
5f2c-
RPI_PICO_W-
instance1
multi_bluetooth/ble_gattc_discover_services.py pass pass pass pass pass pass pass pass pass pass pass FAIL
multi_bluetooth/ble_irq_calls.py pass pass pass pass pass pass pass pass pass FAIL pass pass

Group: run-tests.py --test-dirs=net_hosted

Test rp2
552b-
RPI_PICO2_W
rp2
5f2c-
RPI_PICO_W
net_hosted/ssl_verify_callback.py FAIL FAIL FAIL FAIL

@dpgeorge

dpgeorge commented Sep 9, 2026

Copy link
Copy Markdown
Member

Regarding the above Octoprobe results (the second edit to the comment):

  • the mpremote test failures seem to be specific to the Octoprobe setup, I cannot reproduce them locally (tested on RPI_PICO2 and RPI_PICO2-RISCV)
  • the BLE failures are a flaky test that failed 1/3 times and can be considered a pass (would also probably be flaky on pico-sdk 2.3.0)
  • the net_hosted/ssl_verify_callback.py failure is a true failure that also happens on master and is not related to this PR

pico-sdk 2.3.1 narrowed default_text_excludes.incl to libgcc and libm,
which would move libc.a and the newlib mem* objects back to flash.

The rp2 override keeps them in SRAM; this is now a deliberate
divergence. Note that libc.a only matches on RISC-V builds, where
newlib is linked from libc.a rather than libg.a.

Signed-off-by: Phil Howard <github@gadgetoid.com>
@Gadgetoid

Gadgetoid commented Sep 19, 2026

Copy link
Copy Markdown
Contributor Author

I've dropped an extra linker .incl which was in this PR but was not only doing basically nothing but would have exploded SRAM usage on RISC-V with a C++ module linked.

The *libc.a divergence (which still works) never matched anything on Arm builds; all the newlib symbols resolve from libg.a. For RISC-V it moves the following into SRAM (and always has afaik):

Object Size (bytes) Pattern
libc_a-strcmp.o 286 *libc.a:
libc_a-strchr.o 238 *libc.a:
libc_a-memcpy.o 232 *lib*_a-mem*.o
libc_a-memmove-stub.o 218 *lib*_a-mem*.o
libc_a-memset.o 168 *lib*_a-mem*.o
libc_a-strncmp.o 122 *libc.a:
libc_a-strcpy.o 118 *libc.a:
libc_a-strlen.o 100 *libc.a:
libc_a-memcmp.o 72 *lib*_a-mem*.o
libc_a-strcspn.o 64 *libc.a:
libc_a-strspn.o 54 *libc.a:
Total 1672
via *libc.a: 982 lost if the pattern is stripped
via *lib*_a-mem*.o 690 kept regardless

If we were to fix it for Arm, I'd use roughly ~1.2 KB SRAM which is a per-board decision a downstream vendor (like us) might want to make (at least before we ran out of SRAM), but not a suitable cost for RP2 in general.

The perf boost isn't all that great anyway (that wild misc_mandel swing is a particularly egregious case of flash placement lottery):

Benchmark PSRAM on PSRAM off
bm_chaos +0.81% +1.50%
bm_fannkuch -0.03% +0.85%
bm_fft -2.57% +1.80%
bm_float +2.73% +4.56%
bm_hexiom +0.22% -4.16%
bm_nqueens -2.74% +5.28%
bm_pidigits -3.11% +1.57%
bm_wordcount -0.34% -0.05%
misc_aes +2.76% +1.91%
misc_mandel +1.85% +12.15%
misc_pystone +2.43% +1.16%
misc_raytrace +2.91% -0.36%
mean +0.41% +2.18%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants