Skip to content

firmware flash --uf2: accept RP2350 images, and copy to unmounted WSL drives - #219

Merged
bdbarnett merged 2 commits into
mainfrom
uf2-multi-run
Nov 10, 2026
Merged

bdbarnett merged 2 commits into
mainfrom
uf2-multi-run

Conversation

@bdbarnett

Copy link
Copy Markdown
Collaborator

Fixes #218.

RP2350 UF2 files from picotool start with one absolute-family block (the RP2350-E10 workaround) that declares two blocks and carries only itself. parse_uf2 compared that first header with the count for the whole file, so every such image was refused. Runs are now checked each against their own header, and the absolute block stays in the file so the bootloader still sees it. A run that falls short of its header is still refused.

While proving it on a Pico Plus 2 W from WSL I found a second problem: when Windows has the bootloader drive but WSL never mounted it, the copy raised, and the check for the volume (which cannot see the drive either) took that for the board having rebooted, so mpftp reported a flash that never happened. Reading, probing and copying for such a drive now go through PowerShell, and a failed copy is an error unless the drive really went away.

Checked: tests/test_uf2.py and tests/test_uf2_flash.py pass, including a synthetic two-run file, a short image run, and a cached 4452-block RP2350 image. On a Pico Plus 2 W, machine.bootloader() (via mpftp bootloader) enters BOOTSEL by itself, and mpftp firmware flash --uf2 found the drive, copied 2,279,424 bytes and saw it unmount. The board came back on the same MicroPython version with its files intact. I did not run the full suite or test on Linux or macOS with a mounted drive.

… drives

picotool's RP2350 images open with one absolute-family block that declares
two blocks and carries only itself, so the whole-file block count never
matched. Each run of blocks is now checked against its own header, and the
absolute block stays in the file for the bootloader.

From WSL, a bootloader drive that Windows has but WSL never mounted could
not be written or probed, and the failed write was reported as a reboot.
Reads, probes and the copy now go through PowerShell for such a drive.

Tested with synthetic multi-run files and a cached Pico Plus 2 W image
(4452 blocks), and flashed a Pimoroni Pico Plus 2 W from WSL.
@bdbarnett
bdbarnett merged commit dff1c36 into main Nov 10, 2026
8 checks passed
@bdbarnett
bdbarnett deleted the uf2-multi-run branch November 10, 2026 01:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

firmware flash --uf2 refuses RP2350 UF2 files

1 participant