This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 71499bd66ea boards/rp2040: support reboot bootloader via 
reset_usb_boot()
71499bd66ea is described below

commit 71499bd66ea1eb8220bcf7983c5bd97506e3f9c0
Author: wangjianyu3 <[email protected]>
AuthorDate: Fri Sep 4 22:09:18 2026 +0800

    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 <[email protected]>
---
 arch/arm/src/rp2040/rp2040_rom.h            |  2 ++
 boards/arm/rp2040/common/src/rp2040_reset.c | 17 ++++++++++++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/arch/arm/src/rp2040/rp2040_rom.h b/arch/arm/src/rp2040/rp2040_rom.h
index 40eacb6ff22..8e89ac417d4 100644
--- a/arch/arm/src/rp2040/rp2040_rom.h
+++ b/arch/arm/src/rp2040/rp2040_rom.h
@@ -63,3 +63,5 @@
  ****************************************************************************/
 
 typedef void *(*rom_table_lookup_fn)(uint16_t *table, uint32_t code);
+typedef void (*rom_reset_usb_boot_fn)(uint32_t usb_activity_gpio_pin_mask,
+                                      uint32_t disable_interface_mask);
diff --git a/boards/arm/rp2040/common/src/rp2040_reset.c 
b/boards/arm/rp2040/common/src/rp2040_reset.c
index e59d2d65d90..97f382be2e0 100644
--- a/boards/arm/rp2040/common/src/rp2040_reset.c
+++ b/boards/arm/rp2040/common/src/rp2040_reset.c
@@ -28,6 +28,10 @@
 #include <nuttx/board.h>
 #include <nuttx/arch.h>
 
+#include <sys/boardctl.h>
+
+#include "rp2040_rom.h"
+
 #ifdef CONFIG_BOARDCTL_RESET
 
 /****************************************************************************
@@ -56,7 +60,18 @@
 
 int board_reset(int status)
 {
-  up_systemreset();
+  if (status == BOARDIOC_SOFTRESETCAUSE_ENTER_BOOTLOADER)
+    {
+      rom_reset_usb_boot_fn reset_usb_boot;
+
+      reset_usb_boot = (rom_reset_usb_boot_fn)ROM_LOOKUP(ROM_RESET_USB_BOOT);
+      reset_usb_boot(0, 0);
+    }
+  else
+    {
+      up_systemreset();
+    }
+
   return 0;
 }
 

Reply via email to