Skip to content

Commit ce9fc53

Browse files
boards/rp2040: support reboot bootloader via reset_usb_boot()
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>
1 parent 673b424 commit ce9fc53

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

arch/arm/src/rp2040/rp2040_rom.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,5 @@
6363
****************************************************************************/
6464

6565
typedef void *(*rom_table_lookup_fn)(uint16_t *table, uint32_t code);
66+
typedef void (*rom_reset_usb_boot_fn)(uint32_t usb_activity_gpio_pin_mask,
67+
uint32_t disable_interface_mask);

boards/arm/rp2040/common/src/rp2040_reset.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828
#include <nuttx/board.h>
2929
#include <nuttx/arch.h>
3030

31+
#include <sys/boardctl.h>
32+
33+
#include "rp2040_rom.h"
34+
3135
#ifdef CONFIG_BOARDCTL_RESET
3236

3337
/****************************************************************************
@@ -56,7 +60,18 @@
5660

5761
int board_reset(int status)
5862
{
59-
up_systemreset();
63+
if (status == BOARDIOC_SOFTRESETCAUSE_ENTER_BOOTLOADER)
64+
{
65+
rom_reset_usb_boot_fn reset_usb_boot;
66+
67+
reset_usb_boot = (rom_reset_usb_boot_fn)ROM_LOOKUP(ROM_RESET_USB_BOOT);
68+
reset_usb_boot(0, 0);
69+
}
70+
else
71+
{
72+
up_systemreset();
73+
}
74+
6075
return 0;
6176
}
6277

0 commit comments

Comments
 (0)