boards/rp2040: support reboot bootloader via reset_usb_boot() - #20059
Merged
xiaoxiang781216 merged 1 commit intoSep 5, 2026
Conversation
Add reset_usb_boot ROM function typedef and wire it into board_reset() so that 'nsh> reboot bootloader' (BOARDIOC_SOFTRESETCAUSE_ENTER_BOOTLOADER) on RP2040 boards enters BOOTSEL USB mass-storage mode directly, matching the behavior already available on rp23xx boards. All other status values keep the existing up_systemreset() behavior. This affects all boards under boards/arm/rp2040/common (pico, pico-w, feather-rp2040, xiao-rp2040, w5500-evb-pico, etc.) since the change is in the shared board_reset() implementation. Assisted-by: GitHubCopilot:claude-4.6-opus Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
JianyuWang0623
marked this pull request as ready for review
September 4, 2026 16:07
acassis
approved these changes
Sep 4, 2026
xiaoxiang781216
approved these changes
Sep 5, 2026
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.
Note: Please adhere to Contributing Guidelines.
Summary
RP2040 defines
ROM_RESET_USB_BOOTinarch/arm/src/rp2040/rp2040_rom.h(the bootrom
reset_usb_boot()entry point), but it was never wired up.board_reset()inboards/arm/rp2040/common/src/rp2040_reset.cwas astub that always called
up_systemreset()regardless of the requestedreset reason, so RP2040 boards had no way to re-enter the USB
mass-storage BOOTSEL bootloader from software.
This matches the pattern already implemented for rp23xx
(
boards/arm/rp23xx/common/src/rp23xx_reset.candboards/risc-v/rp23xx-rv/common/src/rp23xx_reset.c), which look up aROM reboot function and call it when the reset reason is
BOARDIOC_SOFTRESETCAUSE_ENTER_BOOTLOADER.Changes:
arch/arm/src/rp2040/rp2040_rom.h: add therom_reset_usb_boot_fnfunction pointer typedef for the bootrom
reset_usb_boot(uint32_t, uint32_t)entry (signature matches the official pico-sdkpico/bootrom.h).boards/arm/rp2040/common/src/rp2040_reset.c: inboard_reset(),when
status == BOARDIOC_SOFTRESETCAUSE_ENTER_BOOTLOADER, look upROM_RESET_USB_BOOTviaROM_LOOKUP()and call it with(0, 0)(no GPIO activity LED, no interfaces disabled). All otherstatus values keep the existing
up_systemreset()behavior.Impact
boards/arm/rp2040/common/, so it affects everyRP2040 board that selects
CONFIG_BOARDCTL_RESET(
raspberrypi-pico,raspberrypi-pico-w,adafruit-feather-rp2040,seeed-xiao-rp2040,w5500-evb-pico,waveshare-rp2040-lcd-1.28, etc.).nsh> reboot/reboot assert/reboot panic/ etc. is unchanged.nsh> reboot bootloadernow re-enters the RP2040BOOTSEL USB mass-storage bootloader directly, without needing to
hold the physical BOOTSEL button.
Testing
Host: Ubuntu,
arm-none-eabi-gcctoolchain.Build
Compiled cleanly for both:
raspberrypi-pico:nshwaveshare-rp2040-lcd-1.28:usbnsh(the board actually flashed forhardware testing below)
tools/nxstylereports no issues on either changed file.Hardware test (Waveshare RP2040-LCD-1.28, RP2040, flash id
0xE4634C65670D202F)Flashed
waveshare-rp2040-lcd-1.28:usbnsh(includes this change) viapicotool load -x. Board enumerates as expected:Connected to
/dev/ttyACM4and got an nsh prompt:Sent
reboot bootloaderover the USB serial console. The consoleconnection was torn down immediately (device disconnected):
Polling
lsusb/lsblkafterwards shows the board re-enumerated asthe RP2040 ROM USB bootloader, with no physical BOOTSEL button
pressed at any point during this test:
This confirms
nsh> reboot bootloaderre-enters BOOTSEL purely insoftware, matching the behavior of
boards/arm/rp23xx/boards/risc-v/rp23xx-rv. After the test, the same firmware imagewas reflashed and the board returned to normal nsh operation.
Plain
nsh> reboot(no argument) was not re-tested after the finalreadability changes (using
BOARDIOC_SOFTRESETCAUSE_ENTER_BOOTLOADERinstead of a raw literal is logically a no-op change), but the
elsebranch callingup_systemreset()is unchanged from upstream.