Repository navigation
firmware flash --uf2: accept RP2350 images, and copy to unmounted WSL drives - #219
Merged
Merged
Conversation
… 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_uf2compared 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()(viampftp bootloader) enters BOOTSEL by itself, andmpftp firmware flash --uf2found 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.