summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorHa Thach <[email protected]>2023-11-29 15:34:05 +0700
committerGitHub <[email protected]>2023-11-29 15:34:05 +0700
commit9c9ebb342d2d3cb0396ff4ad8c7b09acd2aee75e (patch)
tree25c1bdd8a9f5e74cd32448b0a79d32d184ce86cc /hw
parent390c109aed6afe69285fb68cd7f778fa7f6a47b0 (diff)
parentb8d1acd1049d0535c9c2ef8f63a7aea82abd9cbd (diff)
Merge pull request #2355 from hathach/update-hil-rp2040
Update hil test for rp2040 on self-hosted PI4
Diffstat (limited to 'hw')
-rw-r--r--hw/bsp/family_support.cmake16
-rw-r--r--hw/bsp/rp2040/family.cmake2
2 files changed, 18 insertions, 0 deletions
diff --git a/hw/bsp/family_support.cmake b/hw/bsp/family_support.cmake
index 930237fea..bd072e89d 100644
--- a/hw/bsp/family_support.cmake
+++ b/hw/bsp/family_support.cmake
@@ -395,6 +395,22 @@ function(family_flash_stlink TARGET)
endfunction()
+# Add flash openocd target
+function(family_flash_openocd TARGET CLI_OPTIONS)
+ if (NOT DEFINED OPENOCD)
+ set(OPENOCD openocd)
+ endif ()
+
+ separate_arguments(CLI_OPTIONS_LIST UNIX_COMMAND ${CLI_OPTIONS})
+
+ # note skip verify since it has issue with rp2040
+ add_custom_target(${TARGET}-openocd
+ DEPENDS ${TARGET}
+ COMMAND ${OPENOCD} ${CLI_OPTIONS_LIST} -c "program $<TARGET_FILE:${TARGET}> reset exit"
+ VERBATIM
+ )
+endfunction()
+
# Add flash pycod target
function(family_flash_pyocd TARGET)
if (NOT DEFINED PYOC)
diff --git a/hw/bsp/rp2040/family.cmake b/hw/bsp/rp2040/family.cmake
index 53e2add56..77d8029d9 100644
--- a/hw/bsp/rp2040/family.cmake
+++ b/hw/bsp/rp2040/family.cmake
@@ -12,6 +12,7 @@ include(${CMAKE_CURRENT_LIST_DIR}/pico_sdk_import.cmake)
# include basic family CMake functionality
set(FAMILY_MCUS RP2040)
set(JLINK_DEVICE rp2040_m0_0)
+set(OPENOCD_OPTION "-f interface/cmsis-dap.cfg -f target/rp2040.cfg -c \"adapter speed 5000\"")
include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
@@ -158,6 +159,7 @@ function(family_configure_target TARGET RTOS)
pico_enable_stdio_uart(${TARGET} 1)
target_link_libraries(${TARGET} PUBLIC pico_stdlib pico_bootsel_via_double_reset tinyusb_board${RTOS_SUFFIX} tinyusb_additions)
+ family_flash_openocd(${TARGET} ${OPENOCD_OPTION})
family_flash_jlink(${TARGET})
endfunction()