Skip to content

Commit

Permalink
Add build-time option for Pico to wait for a USB connection
Browse files Browse the repository at this point in the history
Pico SDK doesn't have idf.py monitor which allows to be connected from the boot.
Instead, it has an option that waits for an USB serial connection before
starting. Add a built-time setting to enable this feature.

Signed-off-by: Paul Guyot <[email protected]>
  • Loading branch information
pguyot committed Aug 25, 2023
1 parent cea1601 commit 64b116c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/platforms/rp2040/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ set(CMAKE_TRY_COMPILE_TARGET_TYPE EXECUTABLE)
option(AVM_DISABLE_SMP "Disable SMP support." OFF)
option(AVM_USE_32BIT_FLOAT "Use 32 bit floats." OFF)
option(AVM_VERBOSE_ABORT "Print module and line number on VM abort" OFF)

option(AVM_WAIT_FOR_USB_CONNECT "Wait for USB connection before starting" OFF)
option(AVM_REBOOT_ON_NOT_OK "Reboot Pico if result is not ok" OFF)

set(
Expand Down
4 changes: 4 additions & 0 deletions src/platforms/rp2040/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ if (AVM_REBOOT_ON_NOT_OK)
target_compile_definitions(AtomVM PRIVATE CONFIG_REBOOT_ON_NOT_OK)
endif()

if (AVM_WAIT_FOR_USB_CONNECT)
target_compile_definitions(AtomVM PRIVATE PICO_STDIO_USB_CONNECT_WAIT_TIMEOUT_MS=-1)
endif()

set(
PLATFORM_LIB_SUFFIX
${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}
Expand Down

0 comments on commit 64b116c

Please sign in to comment.