Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
6b36c1e
Allow use of reset interface with custom descriptors
will-v-pi Aug 5, 2025
2f2471a
Fix pico_config assertion error
will-v-pi Aug 6, 2025
186c37d
Create separate library for reset interface
will-v-pi Aug 6, 2025
9948e91
Move pico_usb_reset_interface library into separate folder
will-v-pi Aug 6, 2025
0125f0c
Fix bazel build
will-v-pi Aug 6, 2025
e40947e
Move ms_os_20_desc into header
will-v-pi Aug 13, 2025
483e7e3
CFG_TUD_VENDOR isn't actually used
will-v-pi Aug 14, 2025
ea37b13
Add documentation to usb_reset_interface.h
will-v-pi Aug 14, 2025
348376c
Change #if PICO_ON_DEVICE -> #if LIB_PICO_USB_RESET_INTERFACE
will-v-pi Aug 14, 2025
7d2a135
Rename publically accessible functions
will-v-pi Aug 15, 2025
b1b6468
Move LIB_PICO_USB_RESET_INTERFACE only headers into separate files
will-v-pi Aug 15, 2025
bc1a80a
Make new usb_reset_interface_device header so old usb_reset_interface…
will-v-pi Aug 15, 2025
a7ffbab
Review fixups
will-v-pi Aug 18, 2025
7b9266e
Merge remote-tracking branch 'origin/develop' into reset-lib
will-v-pi May 18, 2026
2c0f717
Remove STDIO from defines
will-v-pi May 18, 2026
ec402b7
Merge pico_stdio_usb: fix overlap between activity-LED GPIO and activ…
will-v-pi May 22, 2026
08d1c49
fix search & replace typo
will-v-pi May 22, 2026
2a4d315
Rename library to pico_usb_reset, and move headers into rp2_common
will-v-pi May 27, 2026
b13ad90
Fix bazel build, and remove some unnecessary backwards compatibility …
will-v-pi May 27, 2026
89b77e2
fix bazel formatting
will-v-pi May 27, 2026
8ad2840
Reorder pico_config defines
will-v-pi May 27, 2026
69e9880
Mention that active_low is ignored on RP2040
will-v-pi May 27, 2026
448402b
Make wValue parsing better match the comment
will-v-pi May 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/index.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,5 +128,6 @@
* \cond boot_picoboot_headers \defgroup boot_picoboot_headers boot_picoboot_headers \endcond
* \cond boot_uf2_headers \defgroup boot_uf2_headers boot_uf2_headers \endcond
* \cond pico_usb_reset_interface_headers \defgroup pico_usb_reset_interface_headers pico_usb_reset_interface_headers \endcond
* \cond pico_usb_reset \defgroup pico_usb_reset pico_usb_reset \endcond
* @}
*/
1 change: 1 addition & 0 deletions src/cmake/rp2_common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ if (NOT PICO_BARE_METAL)
endif()
pico_add_subdirectory(rp2_common/tinyusb)
pico_add_subdirectory(rp2_common/pico_stdio_usb)
pico_add_subdirectory(rp2_common/pico_usb_reset)
pico_add_subdirectory(rp2_common/pico_i2c_slave)

# networking libraries - note dependency order is important
Expand Down
4 changes: 3 additions & 1 deletion src/common/pico_usb_reset_interface_headers/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ package(default_visibility = ["//visibility:public"])

cc_library(
name = "pico_usb_reset_interface_headers",
hdrs = ["include/pico/usb_reset_interface.h"],
hdrs = [
"include/pico/usb_reset_interface.h",
],
includes = ["include"],
)
2 changes: 0 additions & 2 deletions src/common/pico_usb_reset_interface_headers/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# don't use pico_add_library here as picotool includes it directly
add_library(pico_usb_reset_interface_headers INTERFACE)
add_library(pico_usb_reset_interface INTERFACE)
target_link_libraries(pico_usb_reset_interface INTERFACE pico_usb_reset_interface_headers)

target_include_directories(pico_usb_reset_interface_headers SYSTEM INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include)
4 changes: 1 addition & 3 deletions src/rp2_common/pico_stdio_usb/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ cc_library(
cc_library(
name = "pico_stdio_usb_enabled",
srcs = [
"reset_interface.c",
"stdio_usb.c",
"stdio_usb_descriptors.c",
],
Expand All @@ -72,10 +71,9 @@ cc_library(
"//src/common/pico_binary_info",
"//src/common/pico_sync",
"//src/rp2_common/hardware_irq",
"//src/rp2_common/hardware_watchdog",
"//src/rp2_common/pico_bootrom",
"//src/rp2_common/pico_stdio:pico_stdio_headers",
"//src/rp2_common/pico_unique_id",
"//src/rp2_common/pico_usb_reset_interface",
],
# Ensure `stdio_usb_descriptors.c` isn't affected by link order.
alwayslink = True,
Expand Down
3 changes: 1 addition & 2 deletions src/rp2_common/pico_stdio_usb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ if (TARGET tinyusb_device_unmarked)
target_include_directories(pico_stdio_usb_headers SYSTEM INTERFACE ${CMAKE_CURRENT_LIST_DIR}/include)

target_sources(pico_stdio_usb INTERFACE
${CMAKE_CURRENT_LIST_DIR}/reset_interface.c
${CMAKE_CURRENT_LIST_DIR}/stdio_usb.c
${CMAKE_CURRENT_LIST_DIR}/stdio_usb_descriptors.c
)
Expand All @@ -13,7 +12,7 @@ if (TARGET tinyusb_device_unmarked)
pico_stdio
pico_time
pico_unique_id
pico_usb_reset_interface
pico_usb_reset
)
target_link_libraries(pico_stdio_usb INTERFACE
tinyusb_device_unmarked
Expand Down
61 changes: 0 additions & 61 deletions src/rp2_common/pico_stdio_usb/include/pico/stdio_usb.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,6 @@
#endif
#endif

// PICO_CONFIG: PICO_STDIO_USB_ENABLE_RESET_VIA_BAUD_RATE, Enable/disable resetting into BOOTSEL mode if the host sets the baud rate to a magic value (PICO_STDIO_USB_RESET_MAGIC_BAUD_RATE), type=bool, default=1 if application is not using TinyUSB directly, group=pico_stdio_usb
#ifndef PICO_STDIO_USB_ENABLE_RESET_VIA_BAUD_RATE
#if !LIB_TINYUSB_HOST && !LIB_TINYUSB_DEVICE
#define PICO_STDIO_USB_ENABLE_RESET_VIA_BAUD_RATE 1
#else
#define PICO_STDIO_USB_ENABLE_RESET_VIA_BAUD_RATE 0
#endif
#endif

// PICO_CONFIG: PICO_STDIO_USB_RESET_MAGIC_BAUD_RATE, Baud rate that if selected causes a reset into BOOTSEL mode (if PICO_STDIO_USB_ENABLE_RESET_VIA_BAUD_RATE is set), default=1200, group=pico_stdio_usb
#ifndef PICO_STDIO_USB_RESET_MAGIC_BAUD_RATE
#define PICO_STDIO_USB_RESET_MAGIC_BAUD_RATE 1200
#endif

// PICO_CONFIG: PICO_STDIO_USB_CONNECT_WAIT_TIMEOUT_MS, Maximum number of milliseconds to wait during initialization for a CDC connection from the host (negative means indefinite) during initialization, default=0, group=pico_stdio_usb
#ifndef PICO_STDIO_USB_CONNECT_WAIT_TIMEOUT_MS
#define PICO_STDIO_USB_CONNECT_WAIT_TIMEOUT_MS 0
Expand All @@ -91,53 +77,6 @@
#define PICO_STDIO_USB_DEINIT_DELAY_MS 110
#endif

// PICO_CONFIG: PICO_STDIO_USB_RESET_BOOTSEL_ACTIVITY_LED, Optionally define a pin to use as bootloader activity LED when BOOTSEL mode is entered via USB (either VIA_BAUD_RATE or VIA_VENDOR_INTERFACE), type=int, min=0, max=47 on RP2350B, 29 otherwise, group=pico_stdio_usb

// PICO_CONFIG: PICO_STDIO_USB_RESET_BOOTSEL_ACTIVITY_LED_ACTIVE_LOW, Whether pin to use as bootloader activity LED when BOOTSEL mode is entered via USB (either VIA_BAUD_RATE or VIA_VENDOR_INTERFACE) is active low, type=bool, default=0, group=pico_stdio_usb
#ifndef PICO_STDIO_USB_RESET_BOOTSEL_ACTIVITY_LED_ACTIVE_LOW
#define PICO_STDIO_USB_RESET_BOOTSEL_ACTIVITY_LED_ACTIVE_LOW 0
#endif

// PICO_CONFIG: PICO_STDIO_USB_RESET_BOOTSEL_FIXED_ACTIVITY_LED, Whether the pin specified by PICO_STDIO_USB_RESET_BOOTSEL_ACTIVITY_LED is fixed or can be modified by picotool over the VENDOR USB interface, type=bool, default=0, group=pico_stdio_usb
#ifndef PICO_STDIO_USB_RESET_BOOTSEL_FIXED_ACTIVITY_LED
#define PICO_STDIO_USB_RESET_BOOTSEL_FIXED_ACTIVITY_LED 0
#endif

// Any modes disabled here can't be re-enabled by picotool via VENDOR_INTERFACE.
// PICO_CONFIG: PICO_STDIO_USB_RESET_BOOTSEL_INTERFACE_DISABLE_MASK, Optionally disable either the mass storage interface (bit 0) or the PICOBOOT interface (bit 1) when entering BOOTSEL mode via USB (either VIA_BAUD_RATE or VIA_VENDOR_INTERFACE), type=int, min=0, max=3, default=0, group=pico_stdio_usb
#ifndef PICO_STDIO_USB_RESET_BOOTSEL_INTERFACE_DISABLE_MASK
#define PICO_STDIO_USB_RESET_BOOTSEL_INTERFACE_DISABLE_MASK 0u
#endif

// PICO_CONFIG: PICO_STDIO_USB_ENABLE_RESET_VIA_VENDOR_INTERFACE, Enable/disable resetting into BOOTSEL mode via an additional VENDOR USB interface - enables picotool based reset, type=bool, default=1 if application is not using TinyUSB directly, group=pico_stdio_usb
#ifndef PICO_STDIO_USB_ENABLE_RESET_VIA_VENDOR_INTERFACE
#if !LIB_TINYUSB_HOST && !LIB_TINYUSB_DEVICE
#define PICO_STDIO_USB_ENABLE_RESET_VIA_VENDOR_INTERFACE 1
#else
#define PICO_STDIO_USB_ENABLE_RESET_VIA_VENDOR_INTERFACE 0
#endif
#endif

// PICO_CONFIG: PICO_STDIO_USB_RESET_INTERFACE_SUPPORT_RESET_TO_BOOTSEL, If vendor reset interface is included allow rebooting to BOOTSEL mode, type=bool, default=1, group=pico_stdio_usb
#ifndef PICO_STDIO_USB_RESET_INTERFACE_SUPPORT_RESET_TO_BOOTSEL
#define PICO_STDIO_USB_RESET_INTERFACE_SUPPORT_RESET_TO_BOOTSEL 1
#endif

// PICO_CONFIG: PICO_STDIO_USB_RESET_INTERFACE_SUPPORT_RESET_TO_FLASH_BOOT, If vendor reset interface is included allow rebooting with regular flash boot, type=bool, default=1, group=pico_stdio_usb
#ifndef PICO_STDIO_USB_RESET_INTERFACE_SUPPORT_RESET_TO_FLASH_BOOT
#define PICO_STDIO_USB_RESET_INTERFACE_SUPPORT_RESET_TO_FLASH_BOOT 1
#endif

// PICO_CONFIG: PICO_STDIO_USB_RESET_INTERFACE_SUPPORT_MS_OS_20_DESCRIPTOR, If vendor reset interface is included add support for Microsoft OS 2.0 Descriptor, type=bool, default=1, group=pico_stdio_usb
#ifndef PICO_STDIO_USB_RESET_INTERFACE_SUPPORT_MS_OS_20_DESCRIPTOR
#define PICO_STDIO_USB_RESET_INTERFACE_SUPPORT_MS_OS_20_DESCRIPTOR 1
#endif

// PICO_CONFIG: PICO_STDIO_USB_RESET_RESET_TO_FLASH_DELAY_MS, Delay in ms before rebooting via regular flash boot, default=100, group=pico_stdio_usb
#ifndef PICO_STDIO_USB_RESET_RESET_TO_FLASH_DELAY_MS
#define PICO_STDIO_USB_RESET_RESET_TO_FLASH_DELAY_MS 100
#endif

// PICO_CONFIG: PICO_STDIO_USB_USE_DEFAULT_DESCRIPTORS, Whether `pico_stdio_usb` provides the USB descriptors needed for USB communication, type=bool, default=1 if the application is not using tinyUSB directly, group=pico_stdio_usb
#ifndef PICO_STDIO_USB_USE_DEFAULT_DESCRIPTORS
#if !LIB_TINYUSB_HOST && !LIB_TINYUSB_DEVICE
Expand Down
7 changes: 0 additions & 7 deletions src/rp2_common/pico_stdio_usb/include/tusb_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,7 @@
#endif

// We use a vendor specific interface but with our own driver
// Vendor driver only used for Microsoft OS 2.0 descriptor
#if !PICO_STDIO_USB_RESET_INTERFACE_SUPPORT_MS_OS_20_DESCRIPTOR
#define CFG_TUD_VENDOR (0)
#else
#define CFG_TUD_VENDOR (1)
#define CFG_TUD_VENDOR_RX_BUFSIZE (256)
#define CFG_TUD_VENDOR_TX_BUFSIZE (256)
#endif
#endif

#endif
188 changes: 0 additions & 188 deletions src/rp2_common/pico_stdio_usb/reset_interface.c

This file was deleted.

Loading
Loading