From 05a57dc62cac1fa9db4936f766229d9a18c8d4d7 Mon Sep 17 00:00:00 2001 From: Jamie Smith Date: Tue, 26 Sep 2023 23:28:35 -0700 Subject: [PATCH] Replace REDLINK upload method with LINKSERVER (#186) * Replace REDLINK upload method with LINKSERVER * Fix sleep test failure on MIMXRT, fix failure to debug * Remove no longer needed XML files --- .../mbed_hal/reset_reason/CMakeLists.txt | 5 + .../TESTS/mbed_hal/rtc_reset/CMakeLists.txt | 2 +- hal/tests/TESTS/mbed_hal/sleep/main.cpp | 4 +- .../TESTS/mbed_hal/sleep/sleep_test_utils.h | 6 ++ .../TESTS/mbed_hal/sleep_manager/main.cpp | 6 -- .../upload_method_cfg/MIMXRT1050_EVK.cmake | 15 +-- .../upload_method_cfg/MIMXRT1060_EVK.cmake | 14 +-- .../redlink_cfgs/MIMXRT1052xxxxB.xml | 5 - .../redlink_cfgs/MIMXRT1052xxxxB_part.xml | 3 - .../redlink_cfgs/MIMXRT1062xxxxA.xml | 5 - .../redlink_cfgs/MIMXRT1062xxxxA_part.xml | 2 - tools/cmake/UploadMethodManager.cmake | 2 +- .../cmake/upload_methods/FindLinkServer.cmake | 31 +++++++ tools/cmake/upload_methods/FindRedlink.cmake | 57 ------------ .../UploadMethodLINKSERVER.cmake | 66 +++++++++++++ .../upload_methods/UploadMethodREDLINK.cmake | 92 ------------------- 16 files changed, 119 insertions(+), 196 deletions(-) delete mode 100644 targets/upload_method_cfg/redlink_cfgs/MIMXRT1052xxxxB.xml delete mode 100644 targets/upload_method_cfg/redlink_cfgs/MIMXRT1052xxxxB_part.xml delete mode 100644 targets/upload_method_cfg/redlink_cfgs/MIMXRT1062xxxxA.xml delete mode 100644 targets/upload_method_cfg/redlink_cfgs/MIMXRT1062xxxxA_part.xml create mode 100644 tools/cmake/upload_methods/FindLinkServer.cmake delete mode 100644 tools/cmake/upload_methods/FindRedlink.cmake create mode 100644 tools/cmake/upload_methods/UploadMethodLINKSERVER.cmake delete mode 100644 tools/cmake/upload_methods/UploadMethodREDLINK.cmake diff --git a/hal/tests/TESTS/mbed_hal/reset_reason/CMakeLists.txt b/hal/tests/TESTS/mbed_hal/reset_reason/CMakeLists.txt index 9d10ae7a733..29d8ba42e8c 100644 --- a/hal/tests/TESTS/mbed_hal/reset_reason/CMakeLists.txt +++ b/hal/tests/TESTS/mbed_hal/reset_reason/CMakeLists.txt @@ -5,6 +5,11 @@ if(NOT "DEVICE_RESET_REASON=1" IN_LIST MBED_TARGET_DEFINITIONS) set(TEST_SKIPPED "Reset Reason is not supported for this target") endif() +if("TARGET_MIMXRT105X" IN_LIST MBED_TARGET_DEFINITIONS) + # This test causes this target to die. See https://github.com/mbed-ce/mbed-os/issues/83 + set(TEST_SKIPPED "Temporarily disabled for this target, see #83") +endif() + mbed_greentea_add_test( TEST_NAME mbed-hal-reset-reason diff --git a/hal/tests/TESTS/mbed_hal/rtc_reset/CMakeLists.txt b/hal/tests/TESTS/mbed_hal/rtc_reset/CMakeLists.txt index 35db19933cc..5aeb485ef78 100644 --- a/hal/tests/TESTS/mbed_hal/rtc_reset/CMakeLists.txt +++ b/hal/tests/TESTS/mbed_hal/rtc_reset/CMakeLists.txt @@ -5,7 +5,7 @@ if(NOT "DEVICE_RTC=1" IN_LIST MBED_TARGET_DEFINITIONS) set(TEST_SKIPPED "RTC is not supported for this target") endif() -if(MBED_TARGET STREQUAL "MIMXRT1050_EVK") +if("TARGET_MIMXRT105X" IN_LIST MBED_TARGET_DEFINITIONS) # This test causes this target to die. See https://github.com/mbed-ce/mbed-os/issues/83 set(TEST_SKIPPED "Temporarily disabled for this target, see #83") endif() diff --git a/hal/tests/TESTS/mbed_hal/sleep/main.cpp b/hal/tests/TESTS/mbed_hal/sleep/main.cpp index bbd8b6659da..06b0d416d5b 100644 --- a/hal/tests/TESTS/mbed_hal/sleep/main.cpp +++ b/hal/tests/TESTS/mbed_hal/sleep/main.cpp @@ -192,11 +192,11 @@ void deepsleep_high_speed_clocks_turned_off_test() /* High freqency ticker should be disabled in deep-sleep mode. We expect that time difference between * ticker reads before and after the sleep represents only code execution time between calls. * Since we went to sleep for about 20 ms check if time counted by high frequency timer does not - * exceed 1 ms. + * exceed the deep sleep enter/exit time. */ const unsigned int us_ticks_diff = (us_ticks_before_sleep <= us_ticks_after_sleep) ? (us_ticks_after_sleep - us_ticks_before_sleep) : (us_ticker_mask - us_ticks_before_sleep + us_ticks_after_sleep + 1); - TEST_ASSERT_UINT32_WITHIN(1000, 0, ticks_to_us(us_ticks_diff, us_ticker_freq)); + TEST_ASSERT_UINT32_WITHIN(DEEP_SLEEP_TOLERANCE_US, 0, ticks_to_us(us_ticks_diff, us_ticker_freq)); sprintf(info, "Delta ticks: %u, Ticker width: %u, Expected wake up tick: %" PRIu32 ", Actual wake up tick: %d\n", us_to_ticks(deepsleep_mode_delta_us, lp_ticker_freq), lp_ticker_width, wakeup_time, lp_ticks_after_sleep); diff --git a/hal/tests/TESTS/mbed_hal/sleep/sleep_test_utils.h b/hal/tests/TESTS/mbed_hal/sleep/sleep_test_utils.h index 593e94e8222..dcb62918abf 100644 --- a/hal/tests/TESTS/mbed_hal/sleep/sleep_test_utils.h +++ b/hal/tests/TESTS/mbed_hal/sleep/sleep_test_utils.h @@ -45,6 +45,12 @@ */ #define SERIAL_FLUSH_TIME_MS 150 +// Tolerance for extra sleep time in the deep sleep test. +// This accounts for the time that the processor spends going to sleep and waking up. +// The hal_deepsleep() docs specify this to be less than 10ms +// Current leader is the MIMXRT105x, which takes almost 6ms to enter/exit deep sleep. +#define DEEP_SLEEP_TOLERANCE_US 6000ULL + #define US_PER_S 1000000 unsigned int ticks_to_us(unsigned int ticks, unsigned int freq) diff --git a/hal/tests/TESTS/mbed_hal/sleep_manager/main.cpp b/hal/tests/TESTS/mbed_hal/sleep_manager/main.cpp index a3c9b3e91ae..cbe6d527d51 100644 --- a/hal/tests/TESTS/mbed_hal/sleep_manager/main.cpp +++ b/hal/tests/TESTS/mbed_hal/sleep_manager/main.cpp @@ -31,12 +31,6 @@ #define SLEEP_DURATION_US 50000ULL -// Tolerance for extra sleep time in the deep sleep test. -// This accounts for the time that the processor spends going to sleep and waking up. -// The hal_deepsleep() docs specify this to be less than 10ms -// Current leader is the MIMXRT105x, which takes almost 5ms to enter/exit deep sleep. -#define DEEP_SLEEP_TOLERANCE_US 5000ULL - #define DEEP_SLEEP_TEST_CHECK_WAIT_US 2000 // As sleep_manager_can_deep_sleep_test_check() is based on wait_ns // and wait_ns can be up to 40% slower, use a 50% delta here. diff --git a/targets/upload_method_cfg/MIMXRT1050_EVK.cmake b/targets/upload_method_cfg/MIMXRT1050_EVK.cmake index 58b1088baa1..c5360f60c12 100644 --- a/targets/upload_method_cfg/MIMXRT1050_EVK.cmake +++ b/targets/upload_method_cfg/MIMXRT1050_EVK.cmake @@ -17,15 +17,8 @@ set(PYOCD_UPLOAD_ENABLED TRUE) set(PYOCD_TARGET_NAME mimxrt1050_hyperflash) # Note: change to "mimxrt1050_quadspi" if onboard QSPI flash is used set(PYOCD_CLOCK_SPEED 4000k) -# Config options for REDLINK +# Config options for LINKSERVER # ------------------------------------------------------------- -set(REDLINK_UPLOAD_ENABLED TRUE) -set(REDLINK_PART_NUMBER MIMXRT1052xxxxB) -set(REDLINK_PART_XML_DIR ${CMAKE_CURRENT_LIST_DIR}/redlink_cfgs) -set(REDLINK_CLOCK_SPEED 4000) -set(REDLINK_CONNECT_ARGS - --connectscript=RT1050_connect.scp - --reset= - --coreindex 0 - --cache disable - --no-packed) \ No newline at end of file +set(LINKSERVER_UPLOAD_ENABLED TRUE) +# note: might need to change the below to MIMXRT1052xxxxx:EVK-IMXRT1050 if you have an EVK rev A +set(LINKSERVER_DEVICE MIMXRT1052xxxxB:EVKB-IMXRT1050) diff --git a/targets/upload_method_cfg/MIMXRT1060_EVK.cmake b/targets/upload_method_cfg/MIMXRT1060_EVK.cmake index cc7a65bb335..8d8533d1739 100644 --- a/targets/upload_method_cfg/MIMXRT1060_EVK.cmake +++ b/targets/upload_method_cfg/MIMXRT1060_EVK.cmake @@ -27,15 +27,7 @@ set(PYOCD_UPLOAD_ENABLED TRUE) set(PYOCD_TARGET_NAME mimxrt1060) # Note: This seems to use QSPI. There does not seem to be a pyocd equivalent for hyperflash. set(PYOCD_CLOCK_SPEED 4000k) -# Config options for REDLINK +# Config options for LINKSERVER # ------------------------------------------------------------- -set(REDLINK_UPLOAD_ENABLED TRUE) -set(REDLINK_PART_NUMBER MIMXRT1062xxxxA) -set(REDLINK_PART_XML_DIR ${CMAKE_CURRENT_LIST_DIR}/redlink_cfgs) -set(REDLINK_CLOCK_SPEED 4000) -set(REDLINK_CONNECT_ARGS - --connectscript=RT1060_connect.scp - --reset= - --coreindex 0 - --cache disable - --no-packed) \ No newline at end of file +set(LINKSERVER_UPLOAD_ENABLED TRUE) +set(LINKSERVER_DEVICE MIMXRT1062xxxxx:MIMXRT1060-EVKB) diff --git a/targets/upload_method_cfg/redlink_cfgs/MIMXRT1052xxxxB.xml b/targets/upload_method_cfg/redlink_cfgs/MIMXRT1052xxxxB.xml deleted file mode 100644 index 22a0405a0ec..00000000000 --- a/targets/upload_method_cfg/redlink_cfgs/MIMXRT1052xxxxB.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/targets/upload_method_cfg/redlink_cfgs/MIMXRT1052xxxxB_part.xml b/targets/upload_method_cfg/redlink_cfgs/MIMXRT1052xxxxB_part.xml deleted file mode 100644 index 5c7e71043d7..00000000000 --- a/targets/upload_method_cfg/redlink_cfgs/MIMXRT1052xxxxB_part.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - MIMXRT1052xxxxB MIMXRT1050 NXP Cortex-M7 Cortex-M diff --git a/targets/upload_method_cfg/redlink_cfgs/MIMXRT1062xxxxA.xml b/targets/upload_method_cfg/redlink_cfgs/MIMXRT1062xxxxA.xml deleted file mode 100644 index 80f96411628..00000000000 --- a/targets/upload_method_cfg/redlink_cfgs/MIMXRT1062xxxxA.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/targets/upload_method_cfg/redlink_cfgs/MIMXRT1062xxxxA_part.xml b/targets/upload_method_cfg/redlink_cfgs/MIMXRT1062xxxxA_part.xml deleted file mode 100644 index 14417fd37d9..00000000000 --- a/targets/upload_method_cfg/redlink_cfgs/MIMXRT1062xxxxA_part.xml +++ /dev/null @@ -1,2 +0,0 @@ - - MIMXRT1062xxxxA MIMXRT1060 NXP Cortex-M7 Cortex-M diff --git a/tools/cmake/UploadMethodManager.cmake b/tools/cmake/UploadMethodManager.cmake index 39ea312ee36..4aa336d6f0b 100644 --- a/tools/cmake/UploadMethodManager.cmake +++ b/tools/cmake/UploadMethodManager.cmake @@ -28,7 +28,7 @@ endif() # UPLOAD_GDBSERVER_DEBUG_COMMAND - Command to start a new GDB server # UPLOAD_WANTS_EXTENDED_REMOTE - True iff GDB should use "target extended-remote" to connect to the GDB server # UPLOAD_LAUNCH_COMMANDS - List of GDB commands to run after launching GDB. -# UPLOAD_RESTART_COMMANDS - List of commands to run when the "restart chip" function is used. +# UPLOAD_RESTART_COMMANDS - List of GDB commands to run when the "restart chip" function is used. # See here for more info: https://github.com/mbed-ce/mbed-os/wiki/Debugger-Commands-and-State-in-Upload-Methods include(UploadMethod${UPLOAD_METHOD}) diff --git a/tools/cmake/upload_methods/FindLinkServer.cmake b/tools/cmake/upload_methods/FindLinkServer.cmake new file mode 100644 index 00000000000..5bbf90527ab --- /dev/null +++ b/tools/cmake/upload_methods/FindLinkServer.cmake @@ -0,0 +1,31 @@ +# Copyright (c) 2023 ARM Limited. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# ---------------------------------------------- +# CMake finder for LinkServer, the NXP command-line flash and debug tool +# +# This module defines: +# LinkServer - Whether the reqested tools were found. +# LinkServer_PATH - full path to the LinkServer command line tool. + +# Check for LinkServer install folders on Windows +if("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows") + # On Windows, LinkServer by default is installed into a subdirectory of + # C:/nxp + file(GLOB LINKSERVER_HINTS LIST_DIRECTORIES TRUE "C:/nxp/LinkServer_*") +elseif("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Darwin") + # On Mac, it was observed to install into /Applications/LinkServer_1.2.45/dist + file(GLOB LINKSERVER_HINTS LIST_DIRECTORIES TRUE "/Applications/LinkServer_*/dist") +else() + set(LINKSERVER_HINTS /usr/local/LinkServer) # Linux package install location +endif() + +find_program(LinkServer_PATH + NAMES LinkServer + DOC "Path to the LinkServer executable." + HINTS ${LINKSERVER_HINTS} +) + +find_package_handle_standard_args(LinkServer REQUIRED_VARS LinkServer_PATH) + + diff --git a/tools/cmake/upload_methods/FindRedlink.cmake b/tools/cmake/upload_methods/FindRedlink.cmake deleted file mode 100644 index 2ce1d1964d9..00000000000 --- a/tools/cmake/upload_methods/FindRedlink.cmake +++ /dev/null @@ -1,57 +0,0 @@ -# Copyright (c) 2022 ARM Limited. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 - -# ---------------------------------------------- -# CMake finder for Redlink, the NXP MCUXpresso debug tool -# -# This module defines: -# Redlink_FOUND - Whether the reqested tools were found. -# crt_emu_cm_redlink_PATH - full path to the Redlink command line tool (crt_emu_cm_redlink). -# REDLINK_FLASH_LOADER_PATH - path to the directory where flash loaders are (contains MIMXRT1050_SFDP_HYPERFLASH.cfx) - -# first try to locate MCUXpresso IDE in its default location -set(MCUXPRESSO_IDE_LINUX_HINTS "") -set(MCUXPRESSO_IDE_WINDOWS_HINTS "") -if(EXISTS "C:/nxp/") - # On Windows, MCUXpresso by default is installed into a subdirectory of - # C:/nxp - file(GLOB MCUXPRESSO_IDE_WINDOWS_HINTS LIST_DIRECTORIES TRUE "C:/nxp/MCUXpressoIDE_*/ide") -endif() - -find_path(MCUXPRESSO_IDE_PATH - NAMES mcuxpressoide.ini - DOC "Path to MCUXPresso IDE. This directory should contain mcuxpressoide.ini. Used to find Redlink" - PATHS - ${MCUXPRESSO_IDE_WINDOWS_HINTS} # Windows - /usr/local/mcuxpressoide/ide # Linux - /Applications/MCUXpressoIDE.app/Contents/Eclipse # OS X - ) - -set(Redlink_HINTS "") -if(EXISTS "${MCUXPRESSO_IDE_PATH}") - message(STATUS "Located MCUXpresso IDE: ${MCUXPRESSO_IDE_PATH}") - - # find install dirs inside IDE, which also have version numbers - file(GLOB REDLINK_INSTALL_DIRS LIST_DIRECTORIES TRUE "${MCUXPRESSO_IDE_PATH}/plugins/com.nxp.mcuxpresso.tools.bin.*/binaries") - list(GET REDLINK_INSTALL_DIRS 0 REDLINK_INSTALL_DIR) # If glob returns multiple just pick one - if(EXISTS "${REDLINK_INSTALL_DIR}") - list(APPEND Redlink_HINTS ${REDLINK_INSTALL_DIR}) - endif() -elseif() - message(WARNING "Failed to find MCUXpresso IDE, will still look for Redlink (crt_emu_cm_redlink) on your PATH. Recommend setting MCUXPRESSO_IDE_PATH to the location of MCUXpresso IDE.") -endif() - -find_program(crt_emu_cm_redlink_PATH - NAMES crt_emu_cm_redlink - DOC "Path to the Redlink crt_emu_cm_redlink executable." - HINTS ${Redlink_HINTS}) - -find_path(REDLINK_FLASH_LOADER_PATH - NAMES MIMXRT1050_SFDP_HYPERFLASH.cfx - DOC "Path to the directory where the Redlink flash loaders are (contains MIMXRT1050_SFDP_HYPERFLASH.cfx)." - HINTS ${Redlink_HINTS} - PATH_SUFFIXES Flash) - -find_package_handle_standard_args(Redlink REQUIRED_VARS crt_emu_cm_redlink_PATH REDLINK_FLASH_LOADER_PATH) - - diff --git a/tools/cmake/upload_methods/UploadMethodLINKSERVER.cmake b/tools/cmake/upload_methods/UploadMethodLINKSERVER.cmake new file mode 100644 index 00000000000..07f8dffd980 --- /dev/null +++ b/tools/cmake/upload_methods/UploadMethodLINKSERVER.cmake @@ -0,0 +1,66 @@ +# Copyright (c) 2022 ARM Limited. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +### NXP LinkServer Upload Method +# This method needs the following parameters: +# LINKSERVER_DEVICE - Chip name and board to connect to, separated by a colon. +# LINKSERVER_PROBE_SN - Serial number, or serial number substring, of the debug probe to connect to. If blank, will connect to any probe. + +set(UPLOAD_SUPPORTS_DEBUG TRUE) + +### Handle options +set(LINKSERVER_PROBE_SN "" CACHE STRING "Serial number, or serial number substring, of the debug probe to connect to. If blank, will connect to any probe.") + +if("${LINKSERVER_PROBE_SN}" STREQUAL "") + # This argument causes Redlink to connect to the first available debug probe + set(LINKSERVER_PROBE_ARGS "" CACHE INTERNAL "" FORCE) +else() + set(LINKSERVER_PROBE_ARGS --probe ${LINKSERVER_PROBE_SN} CACHE INTERNAL "" FORCE) +endif() + +if("${LINKSERVER_DEVICE}" STREQUAL "") + message(FATAL_ERROR "You must set LINKSERVER_DEVICE in your CMake scripts to use REDLINK") +endif() + +### Check if upload method can be enabled on this machine +find_package(LinkServer) +set(UPLOAD_LINKSERVER_FOUND ${LinkServer_FOUND}) + +### Function to generate upload target + +function(gen_upload_target TARGET_NAME BIN_FILE HEX_FILE) + + add_custom_target(flash-${TARGET_NAME} + COMMENT "Flashing ${TARGET_NAME} with LinkServer..." + COMMAND ${LinkServer_PATH} + flash + ${LINKSERVER_PROBE_ARGS} + ${LINKSERVER_DEVICE} + load + $) + + add_dependencies(flash-${TARGET_NAME} ${TARGET_NAME}) + +endfunction(gen_upload_target) + +### Commands to run the debug server. +set(UPLOAD_GDBSERVER_DEBUG_COMMAND + ${LinkServer_PATH} + gdbserver + ${LINKSERVER_PROBE_ARGS} + --gdb-port ${GDB_PORT} + ${LINKSERVER_DEVICE} +) + +# request extended-remote GDB sessions +set(UPLOAD_WANTS_EXTENDED_REMOTE TRUE) + +set(UPLOAD_LAUNCH_COMMANDS + "monitor reset" # undocumented, but works + "load" + "break main" + "monitor reset" +) +set(UPLOAD_RESTART_COMMANDS + "monitor reset" +) \ No newline at end of file diff --git a/tools/cmake/upload_methods/UploadMethodREDLINK.cmake b/tools/cmake/upload_methods/UploadMethodREDLINK.cmake deleted file mode 100644 index e2914db737d..00000000000 --- a/tools/cmake/upload_methods/UploadMethodREDLINK.cmake +++ /dev/null @@ -1,92 +0,0 @@ -# Copyright (c) 2022 ARM Limited. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 - -### Redlink Upload Method -# This method needs the following parameters: -# REDLINK_PART_NUMBER - Part number (-p) argument to pass to the upload tool -# REDLINK_PART_XML_DIR - Directory where the XML files for this MCU can be found. -# REDLINK_CLOCK_SPEED - JTAG/SWD clock speed to talk to the target at. -# REDLINK_CONNECT_ARGS - Extra connect arguments to pass to Redlink tool. These can be gotten by watching the command that MCUXpresso IDE executes when you start a debug session. -# This method creates the following options: -# REDLINK_PROBE_SN - Serial number of the debug probe to connect to. If blank, will connect to any probe. - -set(UPLOAD_SUPPORTS_DEBUG TRUE) - -### Handle options -set(REDLINK_PROBE_SN "" CACHE STRING "Serial number of the debug probe to connect to for Redlink. Set to empty to detect any matching adapter.") - -if("${REDLINK_PROBE_SN}" STREQUAL "") - # This argument causes Redlink to connect to the first available debug probe - set(REDLINK_PROBE_ARGS --probehandle 1 CACHE INTERNAL "" FORCE) -else() - set(REDLINK_PROBE_ARGS --probeserial ${REDLINK_PROBE_SN} CACHE INTERNAL "" FORCE) -endif() - -if("${REDLINK_PART_NUMBER}" STREQUAL "") - message(FATAL_ERROR "You must set REDLINK_PART_NUMBER in your CMake scripts to use REDLINK") -endif() - -if("${REDLINK_PART_XML_DIR}" STREQUAL "") - message(FATAL_ERROR "You must set REDLINK_PART_XML_DIR in your CMake scripts to use REDLINK") -endif() - -if("${REDLINK_CLOCK_SPEED}" STREQUAL "") - message(FATAL_ERROR "You must set REDLINK_CLOCK_SPEED in your CMake scripts to use REDLINK") -endif() - -### Check if upload method can be enabled on this machine -find_package(Redlink) -set(UPLOAD_REDLINK_FOUND ${Redlink_FOUND}) - -### Function to generate upload target - -function(gen_upload_target TARGET_NAME BIN_FILE HEX_FILE) - - add_custom_target(flash-${TARGET_NAME} - COMMENT "Flashing ${TARGET_NAME} with Redlink..." - COMMAND ${crt_emu_cm_redlink_PATH} - -p ${REDLINK_PART_NUMBER} - --flash-hashing - -x ${REDLINK_PART_XML_DIR} - --flash-dir ${REDLINK_FLASH_LOADER_PATH} - -g - -s ${REDLINK_CLOCK_SPEED} - ${REDLINK_CONNECT_ARGS} - ${REDLINK_PROBE_ARGS} - --flash-load-exec $) - - add_dependencies(flash-${TARGET_NAME} ${TARGET_NAME}) - -endfunction(gen_upload_target) - -### Commands to run the debug server. -set(UPLOAD_GDBSERVER_DEBUG_COMMAND - ${crt_emu_cm_redlink_PATH} - -p ${REDLINK_PART_NUMBER} - --flash-hashing - -x ${REDLINK_PART_XML_DIR} - --flash-dir ${REDLINK_FLASH_LOADER_PATH} - -g - -s ${REDLINK_CLOCK_SPEED} - -2 - ${REDLINK_CONNECT_ARGS} - ${REDLINK_PROBE_ARGS} - --server :${GDB_PORT} - --vc - --connect-reset system - --kill-server # Close Redlink when GDB exits -) - - -# request extended-remote GDB sessions -set(UPLOAD_WANTS_EXTENDED_REMOTE TRUE) - -set(UPLOAD_LAUNCH_COMMANDS - "monitor reset" # undocumented, but works - "load" - "break main" - "monitor reset" -) -set(UPLOAD_RESTART_COMMANDS - "monitor reset" -) \ No newline at end of file