diff --git a/ports/zephyr-cp/boards/raspberrypi/rpi_pico2_w_zephyr/autogen_board_info.toml b/ports/zephyr-cp/boards/raspberrypi/rpi_pico2_w_zephyr/autogen_board_info.toml index e55f5dc393b..207876cfdb8 100644 --- a/ports/zephyr-cp/boards/raspberrypi/rpi_pico2_w_zephyr/autogen_board_info.toml +++ b/ports/zephyr-cp/boards/raspberrypi/rpi_pico2_w_zephyr/autogen_board_info.toml @@ -1,5 +1,5 @@ # This file is autogenerated when a board is built. Do not edit. Do commit it to git. Other scripts use its info. -name = "Raspberry Pi Foundation Raspberry Pi Pico 2" +name = "Raspberry Pi Foundation Raspberry Pi Pico 2 W" [modules] __future__ = true diff --git a/ports/zephyr-cp/boards/raspberrypi/rpi_pico2_w_zephyr/circuitpython.toml b/ports/zephyr-cp/boards/raspberrypi/rpi_pico2_w_zephyr/circuitpython.toml index bd0e3ca07ca..2441882956e 100644 --- a/ports/zephyr-cp/boards/raspberrypi/rpi_pico2_w_zephyr/circuitpython.toml +++ b/ports/zephyr-cp/boards/raspberrypi/rpi_pico2_w_zephyr/circuitpython.toml @@ -1,5 +1,6 @@ CIRCUITPY_BUILD_EXTENSIONS = ["hex", "uf2"] BLOBS=["hal_infineon"] +NAME="Raspberry Pi Pico 2 W" # Non-Zephyr build of the same board; nvm and CIRCUITPY must sit where it puts them. counterpart = "raspberrypi/raspberry_pi_pico2_w" diff --git a/ports/zephyr-cp/boards/raspberrypi/rpi_pico_w_zephyr/autogen_board_info.toml b/ports/zephyr-cp/boards/raspberrypi/rpi_pico_w_zephyr/autogen_board_info.toml index 2290a8243d9..0d27e909592 100644 --- a/ports/zephyr-cp/boards/raspberrypi/rpi_pico_w_zephyr/autogen_board_info.toml +++ b/ports/zephyr-cp/boards/raspberrypi/rpi_pico_w_zephyr/autogen_board_info.toml @@ -1,5 +1,5 @@ # This file is autogenerated when a board is built. Do not edit. Do commit it to git. Other scripts use its info. -name = "Raspberry Pi Foundation Raspberry Pi Pico" +name = "Raspberry Pi Foundation Raspberry Pi Pico W" [modules] __future__ = true diff --git a/ports/zephyr-cp/boards/raspberrypi/rpi_pico_w_zephyr/circuitpython.toml b/ports/zephyr-cp/boards/raspberrypi/rpi_pico_w_zephyr/circuitpython.toml index 4b5d2df0800..73c240baeb5 100644 --- a/ports/zephyr-cp/boards/raspberrypi/rpi_pico_w_zephyr/circuitpython.toml +++ b/ports/zephyr-cp/boards/raspberrypi/rpi_pico_w_zephyr/circuitpython.toml @@ -1,5 +1,6 @@ CIRCUITPY_BUILD_EXTENSIONS = ["hex", "uf2"] BLOBS=["hal_infineon"] +NAME="Raspberry Pi Pico W" # Non-Zephyr build of the same board; nvm and CIRCUITPY must sit where it puts them. counterpart = "raspberrypi/raspberry_pi_pico_w" diff --git a/ports/zephyr-cp/common-hal/microcontroller/Processor.h b/ports/zephyr-cp/common-hal/microcontroller/Processor.h index f47f582a1ce..890bca2a2e8 100644 --- a/ports/zephyr-cp/common-hal/microcontroller/Processor.h +++ b/ports/zephyr-cp/common-hal/microcontroller/Processor.h @@ -6,7 +6,7 @@ #pragma once -#if CONFIG_HWINFO_NRF +#if CONFIG_HWINFO_NRF || CONFIG_HWINFO_RPI_PICO #define COMMON_HAL_MCU_PROCESSOR_UID_LENGTH 8 #else // Extra long and the remainder will be left empty. Will print out the actual length. diff --git a/ports/zephyr-cp/supervisor/port.c b/ports/zephyr-cp/supervisor/port.c index bcf4996772e..51dce2df063 100644 --- a/ports/zephyr-cp/supervisor/port.c +++ b/ports/zephyr-cp/supervisor/port.c @@ -47,6 +47,11 @@ #include #endif +#if defined(CONFIG_SOC_FAMILY_RPI_PICO) +#include +#include +#endif + #if defined(CONFIG_TRACING_PERFETTO) && defined(CONFIG_BOARD_NATIVE_SIM) #include "perfetto_encoder.h" #include @@ -254,6 +259,17 @@ void reset_cpu(void) { cp_retained_save(); #endif + #if defined(CONFIG_SOC_FAMILY_RPI_PICO) + // On RP2 the Arm system reset leaves the USB controller running, so the + // host never sees the board go away. Reset the whole chip through the + // watchdog instead, as pico-sdk's watchdog_reboot() does. Zephyr's + // hal_rpi_pico does not build watchdog.c, so write the registers here. + hw_clear_bits(&watchdog_hw->ctrl, WATCHDOG_CTRL_ENABLE_BITS); + watchdog_hw->scratch[4] = 0; + hw_set_bits(&psm_hw->wdsel, PSM_WDSEL_BITS & ~(PSM_WDSEL_ROSC_BITS | PSM_WDSEL_XOSC_BITS)); + hw_set_bits(&watchdog_hw->ctrl, WATCHDOG_CTRL_TRIGGER_BITS); + #endif + // Try a warm reboot first. It won't return if it works but isn't always // implemented. sys_reboot(SYS_REBOOT_WARM);