diff --git a/CMakeLists.txt b/CMakeLists.txt index 7412aca00fb..1be8b902cbd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -104,6 +104,10 @@ list(APPEND CMAKE_MODULE_PATH add_subdirectory(extern) if(MBED_IS_STANDALONE) + + # Always print output on test failure + list(APPEND CMAKE_CTEST_ARGUMENTS --output-on-failure) + include(CTest) if((NOT MBED_BUILD_GREENTEA_TESTS) AND MBED_ENABLE_TESTING) diff --git a/connectivity/drivers/wifi/COMPONENT_WHD/wifi-host-driver/CMakeLists.txt b/connectivity/drivers/wifi/COMPONENT_WHD/wifi-host-driver/CMakeLists.txt index df87905d238..2ae3e9d47bd 100644 --- a/connectivity/drivers/wifi/COMPONENT_WHD/wifi-host-driver/CMakeLists.txt +++ b/connectivity/drivers/wifi/COMPONENT_WHD/wifi-host-driver/CMakeLists.txt @@ -119,6 +119,13 @@ target_sources(mbed-wifi src/bus_protocols/whd_bus_spi_protocol.c ) +if("TARGET_CY_EXTERNAL_WIFI_FW" IN_LIST MBED_TARGET_DEFINITIONS) + # For Cypress targets, add additional resource driver for external wifi firmware + target_sources(mbed-wifi PRIVATE + resources/resource_imp/cy_ext_wifi_fw_resources.c) + target_link_libraries(mbed-wifi PUBLIC mbed-cy-external-wifi-fw) +endif() + target_compile_definitions(mbed-wifi PUBLIC MBED_CONF_CY_PSOC6_WHD_PRESENT=1 diff --git a/targets/TARGET_Cypress/TARGET_PSOC6/ext-wifi-fw/cy_ext_wifi_fw_resources.c b/connectivity/drivers/wifi/COMPONENT_WHD/wifi-host-driver/resources/resource_imp/cy_ext_wifi_fw_resources.c similarity index 100% rename from targets/TARGET_Cypress/TARGET_PSOC6/ext-wifi-fw/cy_ext_wifi_fw_resources.c rename to connectivity/drivers/wifi/COMPONENT_WHD/wifi-host-driver/resources/resource_imp/cy_ext_wifi_fw_resources.c diff --git a/storage/kvstore/kv_config/CMakeLists.txt b/storage/kvstore/kv_config/CMakeLists.txt index 1e203875f31..f3897c30412 100644 --- a/storage/kvstore/kv_config/CMakeLists.txt +++ b/storage/kvstore/kv_config/CMakeLists.txt @@ -29,4 +29,9 @@ target_link_libraries(mbed-storage-kv-config if("DEVICE_FLASH=1" IN_LIST MBED_TARGET_DEFINITIONS) target_link_libraries(mbed-storage-kv-config PUBLIC mbed-storage-flashiap) -endif() \ No newline at end of file +endif() + +if("TARGET_CY_EXTERNAL_WIFI_FW" IN_LIST MBED_TARGET_DEFINITIONS) + # On some Cypress PSOC6 targets, the external wifi fw library provides the definition of get_other_blockdevice() + target_link_libraries(mbed-storage-kv-config PUBLIC mbed-cy-external-wifi-fw) +endif() diff --git a/storage/platform/CMakeLists.txt b/storage/platform/CMakeLists.txt index 3987e88b757..c05f6673cf3 100644 --- a/storage/platform/CMakeLists.txt +++ b/storage/platform/CMakeLists.txt @@ -14,6 +14,11 @@ list(APPEND mbed-storage-libs mbed-storage-littlefs-v2 ) +if("TARGET_CY_EXTERNAL_WIFI_FW" IN_LIST MBED_TARGET_DEFINITIONS) + # On some Cypress PSOC6 targets, the external wifi fw library provides the definition of BlockDevice::get_default_instance() + target_link_libraries(mbed-storage PUBLIC mbed-cy-external-wifi-fw) +endif() + if("COMPONENT_DATAFLASH=1" IN_LIST MBED_TARGET_DEFINITIONS) list(APPEND mbed-storage-libs mbed-storage-dataflash) endif() diff --git a/targets/TARGET_Cypress/CMakeLists.txt b/targets/TARGET_Cypress/CMakeLists.txt index 4fd9dc77e90..b17a885706f 100644 --- a/targets/TARGET_Cypress/CMakeLists.txt +++ b/targets/TARGET_Cypress/CMakeLists.txt @@ -3,12 +3,4 @@ add_subdirectory(TARGET_PSOC6 EXCLUDE_FROM_ALL) -add_library(mbed-cy-external-wifi-fw INTERFACE) -target_compile_definitions(mbed-cy-external-wifi-fw - INTERFACE - "CY_ENABLE_XIP_PROGRAM" - "CY_STORAGE_WIFI_DATA=\".cy_xip\"" - "CY_STORAGE_WIFI_DATA_OUTPUT=cy_xip" - "CY_EXT_WIFI_FW_STORAGE=QSPIF" -) diff --git a/targets/TARGET_Cypress/TARGET_PSOC6/CMakeLists.txt b/targets/TARGET_Cypress/TARGET_PSOC6/CMakeLists.txt index 5be31d4d688..372f443f0bd 100644 --- a/targets/TARGET_Cypress/TARGET_PSOC6/CMakeLists.txt +++ b/targets/TARGET_Cypress/TARGET_PSOC6/CMakeLists.txt @@ -2,6 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 add_subdirectory(COMPONENT_SCL EXCLUDE_FROM_ALL) +add_subdirectory(ext-wifi-fw EXCLUDE_FROM_ALL) add_library(mbed-cat1a INTERFACE) diff --git a/targets/TARGET_Cypress/TARGET_PSOC6/ext-wifi-fw/CMakeLists.txt b/targets/TARGET_Cypress/TARGET_PSOC6/ext-wifi-fw/CMakeLists.txt new file mode 100644 index 00000000000..66d1c9e67bf --- /dev/null +++ b/targets/TARGET_Cypress/TARGET_PSOC6/ext-wifi-fw/CMakeLists.txt @@ -0,0 +1,15 @@ +add_library(mbed-cy-external-wifi-fw STATIC + cy_ext_wifi_fw_reserved_region_bd.cpp + CyReservedRegionBlockDevice.cpp) + +target_include_directories(mbed-cy-external-wifi-fw PUBLIC .) + +target_link_libraries(mbed-cy-external-wifi-fw PUBLIC + mbed-core-flags + mbed-storage-qspif) + +# Force linking of the cy_ext_wifi_fw_reserved_region_bd.o object file to correctly resolve weak symbols +target_link_options(mbed-cy-external-wifi-fw + INTERFACE + LINKER:--undefined=force_link_cy_ext_wifi_fw_reserved_region_bd_o +) \ No newline at end of file diff --git a/targets/TARGET_Cypress/TARGET_PSOC6/reserved-region-bd/CyReservedRegionBlockDevice.cpp b/targets/TARGET_Cypress/TARGET_PSOC6/ext-wifi-fw/CyReservedRegionBlockDevice.cpp similarity index 100% rename from targets/TARGET_Cypress/TARGET_PSOC6/reserved-region-bd/CyReservedRegionBlockDevice.cpp rename to targets/TARGET_Cypress/TARGET_PSOC6/ext-wifi-fw/CyReservedRegionBlockDevice.cpp diff --git a/targets/TARGET_Cypress/TARGET_PSOC6/reserved-region-bd/CyReservedRegionBlockDevice.h b/targets/TARGET_Cypress/TARGET_PSOC6/ext-wifi-fw/CyReservedRegionBlockDevice.h similarity index 99% rename from targets/TARGET_Cypress/TARGET_PSOC6/reserved-region-bd/CyReservedRegionBlockDevice.h rename to targets/TARGET_Cypress/TARGET_PSOC6/ext-wifi-fw/CyReservedRegionBlockDevice.h index be30b3e151a..67d7196e1e9 100644 --- a/targets/TARGET_Cypress/TARGET_PSOC6/reserved-region-bd/CyReservedRegionBlockDevice.h +++ b/targets/TARGET_Cypress/TARGET_PSOC6/ext-wifi-fw/CyReservedRegionBlockDevice.h @@ -27,6 +27,7 @@ #define CY_RESERVED_REGION_BLOCK_DEVICE_H #include "mbed.h" +#include "BlockDevice.h" /** * Block device for working via an underlying block device without altering diff --git a/targets/TARGET_Cypress/TARGET_PSOC6/ext-wifi-fw/cy_ext_wifi_fw_reserved_region_bd.cpp b/targets/TARGET_Cypress/TARGET_PSOC6/ext-wifi-fw/cy_ext_wifi_fw_reserved_region_bd.cpp index b149d4025ac..00dc39cbf78 100644 --- a/targets/TARGET_Cypress/TARGET_PSOC6/ext-wifi-fw/cy_ext_wifi_fw_reserved_region_bd.cpp +++ b/targets/TARGET_Cypress/TARGET_PSOC6/ext-wifi-fw/cy_ext_wifi_fw_reserved_region_bd.cpp @@ -86,3 +86,15 @@ BlockDevice *BlockDevice::get_default_instance() } #endif /* defined(CY_EXT_WIFI_FW_STORAGE) && !MBED_CONF_TARGET_XIP_ENABLE */ + +/* + * With e.g. GCC linker option "--undefined=", pull in this + * object file anyway for being able to override weak symbol successfully + * even though from static library. See: + * https://stackoverflow.com/questions/42588983/what-does-the-gnu-ld-undefined-option-do + * + * NOTE: For C++ name mangling, 'extern "C"' is necessary to match the + * symbol correctly. + */ +extern "C" void force_link_cy_ext_wifi_fw_reserved_region_bd_o() +{} diff --git a/connectivity/drivers/wifi/COMPONENT_WHD/whd-bsp-integration/cy_wifi_fw_section.h b/targets/TARGET_Cypress/TARGET_PSOC6/ext-wifi-fw/cy_wifi_fw_section.h old mode 100755 new mode 100644 similarity index 100% rename from connectivity/drivers/wifi/COMPONENT_WHD/whd-bsp-integration/cy_wifi_fw_section.h rename to targets/TARGET_Cypress/TARGET_PSOC6/ext-wifi-fw/cy_wifi_fw_section.h diff --git a/targets/targets.json5 b/targets/targets.json5 index ab79c466a4d..2d45a366c5f 100644 --- a/targets/targets.json5 +++ b/targets/targets.json5 @@ -9087,8 +9087,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "forced_reset_timeout": 5, "overrides": { "deep-sleep-latency": "CY_CFG_PWR_DEEPSLEEP_LATENCY" - }, - "is_mcu_family_target": true + } }, "MCU_PSOC6_M4": { "inherits": [ @@ -9113,6 +9112,18 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", "full", "bare-metal" ] }, + "MCU_PSOC62_CM4": { + "inherits": [ + "MCU_PSOC6_M4" + ], + "is_mcu_family_target": true + }, + "MCU_PSOC64_CM4": { + "inherits": [ + "MCU_PSOC6_M4" + ], + "is_mcu_family_target": true + }, "CY_EXTERNAL_WIFI_FW": { "public": false, "macros_add": [ @@ -9124,7 +9135,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", }, "CY8CPROTO_062_4343W": { "inherits": [ - "MCU_PSOC6_M4" + "MCU_PSOC62_CM4" ], "features": [ "BLE" @@ -9173,7 +9184,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", }, "CY8CKIT_062S2_43012": { "inherits": [ - "MCU_PSOC6_M4" + "MCU_PSOC62_CM4" ], "features": [ "BLE" @@ -9218,7 +9229,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", }, "CY8CPROTO_062S3_4343W": { "inherits": [ - "MCU_PSOC6_M4", + "MCU_PSOC62_CM4", "CY_EXTERNAL_WIFI_FW" ], "features": [ @@ -9261,7 +9272,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", }, "CY8CKIT_062_WIFI_BT": { // AKA PSoC 6 WiFi-BT Pioneer Kit "inherits": [ - "MCU_PSOC6_M4" + "MCU_PSOC62_CM4" ], "features": [ "BLE" @@ -9313,7 +9324,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", }, "CY8CKIT_062_BLE": { // AKA PSoC 6 BLE Pioneer Kit "inherits": [ - "MCU_PSOC6_M4" + "MCU_PSOC62_CM4" ], "device_has_remove": [ "USBDEVICE" @@ -9352,7 +9363,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", }, "CYW9P62S1_43438EVB_01": { // AKA CYW9P62S1-43438EVB-01 PSoC 62S1 Wi-Fi BT Pioneer Kit "inherits": [ - "MCU_PSOC6_M4" + "MCU_PSOC62_CM4" ], "features": [ "BLE" @@ -9406,7 +9417,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", }, "CYW9P62S1_43012EVB_01": { // AKA CYW9P62S1-43012EVB-01 PSoC 62S1 Wi-Fi BT Pioneer Kit "inherits": [ - "MCU_PSOC6_M4" + "MCU_PSOC62_CM4" ], "features": [ "BLE" @@ -9453,7 +9464,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", }, "CY8CKIT064B0S2_4343W": { // AKA CY8CKIT-064B0S2-4343W PSoC 64 Secure Boot Wi-Fi BT Pioneer Kit "inherits": [ - "MCU_PSOC6_M4" + "MCU_PSOC64_CM4" ], "supported_form_factors": [ "ARDUINO_UNO" @@ -9507,7 +9518,7 @@ mode is recommended for target MCUs with small amounts of flash and RAM.", }, "CYTFM_064B0S2_4343W": { // Same as "inherits": [ - "MCU_PSOC6_M4" + "MCU_PSOC64_CM4" ], "supported_form_factors": [ "ARDUINO_UNO" diff --git a/targets/upload_method_cfg/ARDUINO_GIGA_CM7.cmake b/targets/upload_method_cfg/ARDUINO_GIGA_CM7.cmake index 0e531c32c20..20bff65effc 100644 --- a/targets/upload_method_cfg/ARDUINO_GIGA_CM7.cmake +++ b/targets/upload_method_cfg/ARDUINO_GIGA_CM7.cmake @@ -1,6 +1,6 @@ # Mbed OS upload method configuration file for target ARDUINO_GIGA_CM7. # To change any of these parameters from their default values, set them in your build script between where you -# include app.cmake and where you add mbed os as a subdirectory. +# include mbed_toolchain_setup and where you add mbed os as a subdirectory. # Notes: # 1. To use this target with PyOCD, you need to install a pack: `pyocd pack install STM32H747XIHx`. diff --git a/targets/upload_method_cfg/ARDUINO_NANO33BLE.cmake b/targets/upload_method_cfg/ARDUINO_NANO33BLE.cmake index 6f44168bee6..4adec4eeee5 100644 --- a/targets/upload_method_cfg/ARDUINO_NANO33BLE.cmake +++ b/targets/upload_method_cfg/ARDUINO_NANO33BLE.cmake @@ -1,6 +1,6 @@ # Mbed OS upload method configuration file for target ARDUINO_NANO33BLE. # To change any of these parameters from their default values, set them in your build script between where you -# include app.cmake and where you add mbed os as a subdirectory. +# include mbed_toolchain_setup and where you add mbed os as a subdirectory. # General config parameters # ------------------------------------------------------------- diff --git a/targets/upload_method_cfg/ARDUINO_NANO33BLE_SWD.cmake b/targets/upload_method_cfg/ARDUINO_NANO33BLE_SWD.cmake index 1ac0fe9f2ec..b0797e5cec5 100644 --- a/targets/upload_method_cfg/ARDUINO_NANO33BLE_SWD.cmake +++ b/targets/upload_method_cfg/ARDUINO_NANO33BLE_SWD.cmake @@ -1,6 +1,6 @@ # Mbed OS upload method configuration file for target ARDUINO_NANO33BLE_SWD. # To change any of these parameters from their default values, set them in your build script between where you -# include app.cmake and where you add mbed os as a subdirectory. +# include mbed_toolchain_setup and where you add mbed os as a subdirectory. # Notes: # 1. Using pyocd with this device requires installing a pack: `pyocd pack install nrf52`. @@ -22,6 +22,6 @@ set(PYOCD_CLOCK_SPEED 4000k) set(OPENOCD_UPLOAD_ENABLED TRUE) set(OPENOCD_CHIP_CONFIG_COMMANDS - -f ${OpenOCD_SCRIPT_DIR}/interface/cmsis-dap.cfg + -f interface/cmsis-dap.cfg -c "transport select swd" - -f ${OpenOCD_SCRIPT_DIR}/target/nrf52.cfg) \ No newline at end of file + -f target/nrf52.cfg) \ No newline at end of file diff --git a/targets/upload_method_cfg/ARDUINO_NICLA_SENSE_ME.cmake b/targets/upload_method_cfg/ARDUINO_NICLA_SENSE_ME.cmake index 30bba7d18d9..c9fcd1eb2c1 100644 --- a/targets/upload_method_cfg/ARDUINO_NICLA_SENSE_ME.cmake +++ b/targets/upload_method_cfg/ARDUINO_NICLA_SENSE_ME.cmake @@ -1,6 +1,6 @@ # Mbed OS upload method configuration file for target ARDUINO_NANO33BLE_SWD. # To change any of these parameters from their default values, set them in your build script between where you -# include app.cmake and where you add mbed os as a subdirectory. +# include mbed_toolchain_setup and where you add mbed os as a subdirectory. # Notes: # 1. Using pyocd with this device requires installing a pack: `pyocd pack install nrf52`. @@ -22,6 +22,6 @@ set(PYOCD_CLOCK_SPEED 4000k) set(OPENOCD_UPLOAD_ENABLED TRUE) set(OPENOCD_CHIP_CONFIG_COMMANDS - -f ${OpenOCD_SCRIPT_DIR}/interface/cmsis-dap.cfg + -f interface/cmsis-dap.cfg -c "transport select swd" - -f ${OpenOCD_SCRIPT_DIR}/target/nrf52.cfg) \ No newline at end of file + -f target/nrf52.cfg) \ No newline at end of file diff --git a/targets/upload_method_cfg/ARDUINO_PORTENTA_H7_M7.cmake b/targets/upload_method_cfg/ARDUINO_PORTENTA_H7_M7.cmake index 07f4ce4c097..22c6555c92d 100644 --- a/targets/upload_method_cfg/ARDUINO_PORTENTA_H7_M7.cmake +++ b/targets/upload_method_cfg/ARDUINO_PORTENTA_H7_M7.cmake @@ -1,6 +1,6 @@ # Mbed OS upload method configuration file for target ARDUINO_PORTENTA_H7_M7. # To change any of these parameters from their default values, set them in your build script between where you -# include app.cmake and where you add mbed os as a subdirectory. +# include mbed_toolchain_setup and where you add mbed os as a subdirectory. # Notes: # 1. To use this target with PyOCD, you need to install a pack: `pyocd pack install STM32H747XIHx`. diff --git a/targets/upload_method_cfg/BLACKPILL_F411CE.cmake b/targets/upload_method_cfg/BLACKPILL_F411CE.cmake index 78397a4c2e0..4fadd229db7 100644 --- a/targets/upload_method_cfg/BLACKPILL_F411CE.cmake +++ b/targets/upload_method_cfg/BLACKPILL_F411CE.cmake @@ -1,6 +1,6 @@ # Mbed OS upload method configuration file for target BLACKPILL_F411CE. # To change any of these parameters from their default values, set them in your build script between where you -# include app.cmake and where you add mbed os as a subdirectory. +# include mbed_toolchain_setup and where you add mbed os as a subdirectory. # Notes: # 1. Keep in mind the Blackpill does not contain any on-board debugger, so all upload methods counts with external debugger, usually ST-Link. @@ -39,7 +39,7 @@ set(PYOCD_CLOCK_SPEED 4000k) set(OPENOCD_UPLOAD_ENABLED TRUE) set(OPENOCD_CHIP_CONFIG_COMMANDS - -f ${OpenOCD_SCRIPT_DIR}/board/st_nucleo_f4.cfg) + -f board/st_nucleo_f4.cfg) # Config options for STM32Cube # ------------------------------------------------------------- diff --git a/targets/upload_method_cfg/B_U585I_IOT02A.cmake b/targets/upload_method_cfg/B_U585I_IOT02A.cmake index 24d04bc4efc..593b0f77a4b 100644 --- a/targets/upload_method_cfg/B_U585I_IOT02A.cmake +++ b/targets/upload_method_cfg/B_U585I_IOT02A.cmake @@ -1,6 +1,6 @@ # Mbed OS upload method configuration file for target B_U585_IOT02A. # To change any of these parameters from their default values, set them in your build script between where you -# include app.cmake and where you add mbed os as a subdirectory. +# include mbed_toolchain_setup and where you add mbed os as a subdirectory. # Notes: # 1. To use this target with PyOCD, you need to install a pack: `pyocd pack install STM32U585AIIxQ`. diff --git a/targets/upload_method_cfg/CY8CPROTO_062S3_4343W.cmake b/targets/upload_method_cfg/CY8CPROTO_062S3_4343W.cmake new file mode 100644 index 00000000000..1bdc1261df4 --- /dev/null +++ b/targets/upload_method_cfg/CY8CPROTO_062S3_4343W.cmake @@ -0,0 +1,51 @@ +# Mbed OS upload method configuration file for target CY8CPROTO_062S3_4343W. +# To change any of these parameters from their default values, set them in your build script between where you +# include mbed_toolchain_setup and where you add mbed os as a subdirectory. + +# Notes: +# 1. The KitProg3 programmer on this board boots up in KitProg mode. To enable mass storage device mode, press the +# button labeled "MODE" near the USB port to switch to DAPLink mode. The MBED and PYOCD upload methods need +# the board to be in DAPLink mode (which is deprecated by Infineon). +# 2. Mbed upload method seems VERY slow on this board (takes like 1 minute to flash!). +# 3. PyOCD is tested working correctly in DAPLink mode. In KitProg mode it can flash but debugging does +# not appear to work correctly. +# 4. Infineon's fork of OpenOCD must be used to program this device as they have not yet upstreamed their +# changes. This can be downloaded from here: https://github.com/Infineon/openocd/releases +# Then configure CMake to use it with `-DOpenOCD=/path/to/infineon/openocd` +# 5. If using the wi-fi module on this board, you need to flash the wi-fi module firmware to the QSPI flash. +# This is done automatically via Infineon's OpenOCD scripts when flashing any project that uses wifi with OpenOCD. +# Flashing via other methods will likely not work for wifi projects. + +# General config parameters +# ------------------------------------------------------------- +set(UPLOAD_METHOD_DEFAULT MBED) + +# Generally we are only interested in the CM4 core which is index 1 +set(MBED_DEBUG_CORE_INDEX 1) + +# Config options for MBED +# ------------------------------------------------------------- + +set(MBED_UPLOAD_ENABLED TRUE) +set(MBED_RESET_BAUDRATE 115200) + +# Config options for PYOCD +# ------------------------------------------------------------- + +set(PYOCD_UPLOAD_ENABLED TRUE) +set(PYOCD_TARGET_NAME cy8c6xx5) +set(PYOCD_CLOCK_SPEED 4000k) + +# Config options for OpenOCD +# ------------------------------------------------------------- + +set(OPENOCD_UPLOAD_ENABLED TRUE) +set(OPENOCD_CHIP_CONFIG_COMMANDS + -s ${CMAKE_CURRENT_LIST_DIR}/openocd_cfgs/CY8CPROTO_062S3_4343W + -f ${CMAKE_CURRENT_LIST_DIR}/openocd_cfgs/infineon_psoc62_c8cxx5.cfg) + +# Seems like a regular 'monitor reset' does not work correctly for this chip. This is the command sequence +# used by ModusToolbox IDE. +set(OPENOCD_GDB_RESET_SEQUENCE + "monitor reset run" + "monitor psoc6 reset_halt sysresetreq") \ No newline at end of file diff --git a/targets/upload_method_cfg/DISCO_F469NI.cmake b/targets/upload_method_cfg/DISCO_F469NI.cmake index 8e6a8ffbe79..7df4ace65db 100644 --- a/targets/upload_method_cfg/DISCO_F469NI.cmake +++ b/targets/upload_method_cfg/DISCO_F469NI.cmake @@ -1,6 +1,6 @@ # Mbed OS upload method configuration file for target DISCO_F469NI. # To change any of these parameters from their default values, set them in your build script between where you -# include app.cmake and where you add mbed os as a subdirectory. +# include mbed_toolchain_setup and where you add mbed os as a subdirectory. # Notes: # 1. Using the JLINK upload method with your dev board requires converting its ST-LINK into a J-Link. See here for details: https://www.segger.com/products/debug-probes/j-link/models/other-j-links/st-link-on-board/ @@ -36,7 +36,7 @@ set(PYOCD_CLOCK_SPEED 4000k) set(OPENOCD_UPLOAD_ENABLED TRUE) set(OPENOCD_CHIP_CONFIG_COMMANDS - -f ${OpenOCD_SCRIPT_DIR}/board/stm32f4discovery.cfg) + -f board/stm32f4discovery.cfg) # Config options for STM32Cube # ------------------------------------------------------------- diff --git a/targets/upload_method_cfg/DISCO_F746NG.cmake b/targets/upload_method_cfg/DISCO_F746NG.cmake index 5fca6ed14c2..1c3f362c1dc 100644 --- a/targets/upload_method_cfg/DISCO_F746NG.cmake +++ b/targets/upload_method_cfg/DISCO_F746NG.cmake @@ -1,6 +1,6 @@ # Mbed OS upload method configuration file for target DISCO_F746NG. # To change any of these parameters from their default values, set them in your build script between where you -# include app.cmake and where you add mbed os as a subdirectory. +# include mbed_toolchain_setup and where you add mbed os as a subdirectory. # Notes: # 1. Using the JLINK upload method with your dev board requires converting its ST-LINK into a J-Link. See here for details: https://www.segger.com/products/debug-probes/j-link/models/other-j-links/st-link-on-board/ @@ -35,7 +35,7 @@ set(PYOCD_CLOCK_SPEED 4000k) set(OPENOCD_UPLOAD_ENABLED TRUE) set(OPENOCD_CHIP_CONFIG_COMMANDS - -f ${OpenOCD_SCRIPT_DIR}/board/stm32f7discovery.cfg) + -f board/stm32f7discovery.cfg) # Config options for STM32Cube # ------------------------------------------------------------- diff --git a/targets/upload_method_cfg/DISCO_F769NI.cmake b/targets/upload_method_cfg/DISCO_F769NI.cmake index 08c5344f43a..397d75280b8 100644 --- a/targets/upload_method_cfg/DISCO_F769NI.cmake +++ b/targets/upload_method_cfg/DISCO_F769NI.cmake @@ -1,6 +1,6 @@ # Mbed OS upload method configuration file for target DISCO_F769NI. # To change any of these parameters from their default values, set them in your build script between where you -# include app.cmake and where you add mbed os as a subdirectory. +# include mbed_toolchain_setup and where you add mbed os as a subdirectory. # Notes: # 1. Using the JLINK upload method with your dev board requires converting its ST-LINK into a J-Link. See here for details: https://www.segger.com/products/debug-probes/j-link/models/other-j-links/st-link-on-board/ @@ -35,7 +35,7 @@ set(PYOCD_CLOCK_SPEED 4000k) set(OPENOCD_UPLOAD_ENABLED TRUE) set(OPENOCD_CHIP_CONFIG_COMMANDS - -f ${OpenOCD_SCRIPT_DIR}/board/stm32f769i-disco.cfg) + -f board/stm32f769i-disco.cfg) # Config options for STM32Cube # ------------------------------------------------------------- diff --git a/targets/upload_method_cfg/DISCO_H573I.cmake b/targets/upload_method_cfg/DISCO_H573I.cmake index 40f108254c1..140e8f1e72f 100644 --- a/targets/upload_method_cfg/DISCO_H573I.cmake +++ b/targets/upload_method_cfg/DISCO_H573I.cmake @@ -1,6 +1,6 @@ # Mbed OS upload method configuration file for target DISCO_H573I # To change any of these parameters from their default values, set them in your build script between where you -# include app.cmake and where you add mbed os as a subdirectory. +# include mbed_toolchain_setup and where you add mbed os as a subdirectory. # Notes: # 1. If your target is not natively supported by the pyOCD, then you need install a keil package for family of your target by hands. Type "pyocd pack show" to console and you will see a list of already installed packages. diff --git a/targets/upload_method_cfg/DISCO_L072CZ_LRWAN1.cmake b/targets/upload_method_cfg/DISCO_L072CZ_LRWAN1.cmake index 3f1973e7585..fc37c88011e 100644 --- a/targets/upload_method_cfg/DISCO_L072CZ_LRWAN1.cmake +++ b/targets/upload_method_cfg/DISCO_L072CZ_LRWAN1.cmake @@ -1,6 +1,6 @@ # Mbed OS upload method configuration file for target DISCO_L072CZ_LRWAN1. # To change any of these parameters from their default values, set them in your build script between where you -# include app.cmake and where you add mbed os as a subdirectory. +# include mbed_toolchain_setup and where you add mbed os as a subdirectory. # Notes: # 1. To use this target with PyOCD, you need to install a pack: `python -m pyocd pack install STM32L072CZTx`. @@ -37,7 +37,7 @@ set(PYOCD_CLOCK_SPEED 4000k) set(OPENOCD_UPLOAD_ENABLED TRUE) set(OPENOCD_CHIP_CONFIG_COMMANDS --f ${OpenOCD_SCRIPT_DIR}/board/st_nucleo_l073rz.cfg) +-f board/st_nucleo_l073rz.cfg) # Config options for STM32Cube # ------------------------------------------------------------- diff --git a/targets/upload_method_cfg/FF_LPC546XX.cmake b/targets/upload_method_cfg/FF_LPC546XX.cmake index efa5c33ba79..55284bdac33 100644 --- a/targets/upload_method_cfg/FF_LPC546XX.cmake +++ b/targets/upload_method_cfg/FF_LPC546XX.cmake @@ -1,6 +1,6 @@ # Mbed OS upload method configuration file for target FF_LPC546XX. # To change any of these parameters from their default values, set them in your build script between where you -# include app.cmake and where you add mbed os as a subdirectory. +# include mbed_toolchain_setup and where you add mbed os as a subdirectory. # # Notes: # 1. PyOCD support for this device requires installing a pack: diff --git a/targets/upload_method_cfg/K64F.cmake b/targets/upload_method_cfg/K64F.cmake index 8723b494155..a180f8ca66b 100644 --- a/targets/upload_method_cfg/K64F.cmake +++ b/targets/upload_method_cfg/K64F.cmake @@ -1,6 +1,6 @@ # Mbed OS upload method configuration file for target K64F. # To change any of these parameters from their default values, set them in your build script between where you -# include app.cmake and where you add mbed os as a subdirectory. +# include mbed_toolchain_setup and where you add mbed os as a subdirectory. # # Notes: # 1. Be sure to update the DAPLink firmware on the board via these instructions: https://os.mbed.com/blog/entry/DAPLink-bootloader-update/ diff --git a/targets/upload_method_cfg/KL25Z.cmake b/targets/upload_method_cfg/KL25Z.cmake index 553553d49c4..2e75f1139e8 100644 --- a/targets/upload_method_cfg/KL25Z.cmake +++ b/targets/upload_method_cfg/KL25Z.cmake @@ -1,6 +1,6 @@ # Mbed OS upload method configuration file for target KL25Z. # To change any of these parameters from their default values, set them in your build script between where you -# include app.cmake and where you add mbed os as a subdirectory. +# include mbed_toolchain_setup and where you add mbed os as a subdirectory. # Note that KL25Z boards generally need a firmware update to DAPLink interface firmware before they can be used with modern tools. # The following steps worked for me on a Windows 11 PC: diff --git a/targets/upload_method_cfg/LPC1768.cmake b/targets/upload_method_cfg/LPC1768.cmake index 248633964b3..5bcc4eca221 100644 --- a/targets/upload_method_cfg/LPC1768.cmake +++ b/targets/upload_method_cfg/LPC1768.cmake @@ -1,6 +1,6 @@ # Mbed OS upload method configuration file for target LPC1768. # To change any of these parameters from their default values, set them in your build script between where you -# include app.cmake and where you add mbed os as a subdirectory. +# include mbed_toolchain_setup and where you add mbed os as a subdirectory. # Notes: # 1. LPC1768 is supposed to be supported by LinkServer, and I am able to get through flashing it, but it errors out at the end. diff --git a/targets/upload_method_cfg/LPCXPRESSO_LPC1769.cmake b/targets/upload_method_cfg/LPCXPRESSO_LPC1769.cmake index 824dc08f1ad..71a157cc13d 100644 --- a/targets/upload_method_cfg/LPCXPRESSO_LPC1769.cmake +++ b/targets/upload_method_cfg/LPCXPRESSO_LPC1769.cmake @@ -1,6 +1,6 @@ # Mbed OS upload method configuration file for target Embedded Artists LPCXPRESSO_LPC1768. # To change any of these parameters from their default values, set them in your build script between where you -# include app.cmake and where you add mbed os as a subdirectory. +# include mbed_toolchain_setup and where you add mbed os as a subdirectory. # General config parameters # ------------------------------------------------------------- diff --git a/targets/upload_method_cfg/MAX32670EVKIT.cmake b/targets/upload_method_cfg/MAX32670EVKIT.cmake index 69fddd763de..fe1fb890ffa 100644 --- a/targets/upload_method_cfg/MAX32670EVKIT.cmake +++ b/targets/upload_method_cfg/MAX32670EVKIT.cmake @@ -1,6 +1,6 @@ # Mbed OS upload method configuration file for target MAX32670EVKIT. # To change any of these parameters from their default values, set them in your build script between where you -# include app.cmake and where you add mbed os as a subdirectory. +# include mbed_toolchain_setup and where you add mbed os as a subdirectory. # Notes: # 1. For the MBED upload method to work, you may need to update the DAPLink firmware as described here: diff --git a/targets/upload_method_cfg/MIMXRT1050_EVK.cmake b/targets/upload_method_cfg/MIMXRT1050_EVK.cmake index 24510fbe1f0..e79668b421c 100644 --- a/targets/upload_method_cfg/MIMXRT1050_EVK.cmake +++ b/targets/upload_method_cfg/MIMXRT1050_EVK.cmake @@ -1,6 +1,6 @@ # Mbed OS upload method configuration file for target MIMXRT1050_EVK. # To change any of these parameters from their default values, set them in your build script between where you -# include app.cmake and where you add mbed os as a subdirectory. +# include mbed_toolchain_setup and where you add mbed os as a subdirectory. # 1. Most debuggers cannot connect to this CPU after it does an NVIC system reset. See Mbed CE bug #83. # However, a workaround has been implemented for PyOCD. diff --git a/targets/upload_method_cfg/MIMXRT1060_EVK.cmake b/targets/upload_method_cfg/MIMXRT1060_EVK.cmake index b2b08dd366f..f208a23eff3 100644 --- a/targets/upload_method_cfg/MIMXRT1060_EVK.cmake +++ b/targets/upload_method_cfg/MIMXRT1060_EVK.cmake @@ -1,6 +1,6 @@ # Mbed OS upload method configuration file for target MIMXRT1060_EVK. # To change any of these parameters from their default values, set them in your build script between where you -# include app.cmake and where you add mbed os as a subdirectory. +# include mbed_toolchain_setup and where you add mbed os as a subdirectory. # # Notes: # 1. Using the JLINK upload method requires either converting the board's LPC-Link into a J-Link, or diff --git a/targets/upload_method_cfg/NRF52840_DK.cmake b/targets/upload_method_cfg/NRF52840_DK.cmake index 5e9df0f77f6..17b812a72ce 100644 --- a/targets/upload_method_cfg/NRF52840_DK.cmake +++ b/targets/upload_method_cfg/NRF52840_DK.cmake @@ -1,6 +1,6 @@ # Mbed OS upload method configuration file for target NRF52840_DK. # To change any of these parameters from their default values, set them in your build script between where you -# include app.cmake and where you add mbed os as a subdirectory. +# include mbed_toolchain_setup and where you add mbed os as a subdirectory. # Notes: # 1. If you have multiple Mbed devices plugged in to your machine, the MBED upload method only diff --git a/targets/upload_method_cfg/NUCLEO_F303K8.cmake b/targets/upload_method_cfg/NUCLEO_F303K8.cmake index 9822ab517a0..9e026eb38d8 100644 --- a/targets/upload_method_cfg/NUCLEO_F303K8.cmake +++ b/targets/upload_method_cfg/NUCLEO_F303K8.cmake @@ -1,6 +1,6 @@ # Mbed OS upload method configuration file for target NUCLEO_F303K8. # To change any of these parameters from their default values, set them in your build script between where you -# include app.cmake and where you add mbed os as a subdirectory. +# include mbed_toolchain_setup and where you add mbed os as a subdirectory. # Notes: # 1. Using the JLINK upload method with your dev board requires converting its ST-LINK into a J-Link. See here for details: https://www.segger.com/products/debug-probes/j-link/models/other-j-links/st-link-on-board/ @@ -38,7 +38,7 @@ set(PYOCD_CLOCK_SPEED 4000k) set(OPENOCD_UPLOAD_ENABLED TRUE) set(OPENOCD_CHIP_CONFIG_COMMANDS - -f ${OpenOCD_SCRIPT_DIR}/board/st_nucleo_f3.cfg) + -f board/st_nucleo_f3.cfg) # Config options for STM32Cube # ------------------------------------------------------------- diff --git a/targets/upload_method_cfg/NUCLEO_F303RE.cmake b/targets/upload_method_cfg/NUCLEO_F303RE.cmake index 3aee24154f2..a0785dde8a2 100644 --- a/targets/upload_method_cfg/NUCLEO_F303RE.cmake +++ b/targets/upload_method_cfg/NUCLEO_F303RE.cmake @@ -1,6 +1,6 @@ # Mbed OS upload method configuration file for target NUCLEO_F303RE. # To change any of these parameters from their default values, set them in your build script between where you -# include app.cmake and where you add mbed os as a subdirectory. +# include mbed_toolchain_setup and where you add mbed os as a subdirectory. # Notes: # 1. Using the JLINK upload method with your dev board requires converting its ST-LINK into a J-Link. See here for details: https://www.segger.com/products/debug-probes/j-link/models/other-j-links/st-link-on-board/ @@ -37,7 +37,7 @@ set(PYOCD_CLOCK_SPEED 4000k) set(OPENOCD_UPLOAD_ENABLED TRUE) set(OPENOCD_CHIP_CONFIG_COMMANDS - -f ${OpenOCD_SCRIPT_DIR}/board/st_nucleo_f3.cfg) + -f board/st_nucleo_f3.cfg) # Config options for STM32Cube # ------------------------------------------------------------- diff --git a/targets/upload_method_cfg/NUCLEO_F429ZI.cmake b/targets/upload_method_cfg/NUCLEO_F429ZI.cmake index 9f9b1afdbaf..d3dfd32509e 100644 --- a/targets/upload_method_cfg/NUCLEO_F429ZI.cmake +++ b/targets/upload_method_cfg/NUCLEO_F429ZI.cmake @@ -1,6 +1,6 @@ # Mbed OS upload method configuration file for target NUCLEO_F429ZI. # To change any of these parameters from their default values, set them in your build script between where you -# include app.cmake and where you add mbed os as a subdirectory. +# include mbed_toolchain_setup and where you add mbed os as a subdirectory. # Notes: # 1. Using the JLINK upload method with your dev board requires converting its ST-LINK into a J-Link. See here for details: https://www.segger.com/products/debug-probes/j-link/models/other-j-links/st-link-on-board/ diff --git a/targets/upload_method_cfg/NUCLEO_F446RE.cmake b/targets/upload_method_cfg/NUCLEO_F446RE.cmake index 5b355b79b98..0144a0b8c0f 100644 --- a/targets/upload_method_cfg/NUCLEO_F446RE.cmake +++ b/targets/upload_method_cfg/NUCLEO_F446RE.cmake @@ -1,6 +1,6 @@ # Mbed OS upload method configuration file for target NUCLEO_F446RE. # To change any of these parameters from their default values, set them in your build script between where you -# include app.cmake and where you add mbed os as a subdirectory. +# include mbed_toolchain_setup and where you add mbed os as a subdirectory. # Notes: # 1. Using the JLINK upload method with your dev board requires converting its ST-LINK into a J-Link. See here for details: https://www.segger.com/products/debug-probes/j-link/models/other-j-links/st-link-on-board/ @@ -39,7 +39,7 @@ set(PYOCD_CLOCK_SPEED 4000k) set(OPENOCD_UPLOAD_ENABLED TRUE) set(OPENOCD_CHIP_CONFIG_COMMANDS - -f ${OpenOCD_SCRIPT_DIR}/board/st_nucleo_f4.cfg) + -f board/st_nucleo_f4.cfg) # Config options for STM32Cube # ------------------------------------------------------------- diff --git a/targets/upload_method_cfg/NUCLEO_F746ZG.cmake b/targets/upload_method_cfg/NUCLEO_F746ZG.cmake index 30d21396781..9e9b481a7dc 100644 --- a/targets/upload_method_cfg/NUCLEO_F746ZG.cmake +++ b/targets/upload_method_cfg/NUCLEO_F746ZG.cmake @@ -1,6 +1,6 @@ # Mbed OS upload method configuration file for target NUCLEO_F746ZG. # To change any of these parameters from their default values, set them in your build script between where you -# include app.cmake and where you add mbed os as a subdirectory. +# include mbed_toolchain_setup and where you add mbed os as a subdirectory. # Notes: # 1. Using the JLINK upload method with your dev board requires converting its ST-LINK into a J-Link. See here for details: https://www.segger.com/products/debug-probes/j-link/models/other-j-links/st-link-on-board/ @@ -35,7 +35,7 @@ set(PYOCD_CLOCK_SPEED 4000k) set(OPENOCD_UPLOAD_ENABLED TRUE) set(OPENOCD_CHIP_CONFIG_COMMANDS - -f ${OpenOCD_SCRIPT_DIR}/board/st_nucleo_f7.cfg) + -f board/st_nucleo_f7.cfg) # Config options for STM32Cube # ------------------------------------------------------------- diff --git a/targets/upload_method_cfg/NUCLEO_F767ZI.cmake b/targets/upload_method_cfg/NUCLEO_F767ZI.cmake index 1504747e6a8..5a5419df14e 100644 --- a/targets/upload_method_cfg/NUCLEO_F767ZI.cmake +++ b/targets/upload_method_cfg/NUCLEO_F767ZI.cmake @@ -1,6 +1,6 @@ # Mbed OS upload method configuration file for target NUCLEO_F767ZI. # To change any of these parameters from their default values, set them in your build script between where you -# include app.cmake and where you add mbed os as a subdirectory. +# include mbed_toolchain_setup and where you add mbed os as a subdirectory. # Notes: # 1. Using the JLINK upload method with your dev board requires converting its ST-LINK into a J-Link. See here for details: https://www.segger.com/products/debug-probes/j-link/models/other-j-links/st-link-on-board/ @@ -35,7 +35,7 @@ set(PYOCD_CLOCK_SPEED 4000k) set(OPENOCD_UPLOAD_ENABLED TRUE) set(OPENOCD_CHIP_CONFIG_COMMANDS - -f ${OpenOCD_SCRIPT_DIR}/board/st_nucleo_f7.cfg) + -f board/st_nucleo_f7.cfg) # Config options for STM32Cube # ------------------------------------------------------------- diff --git a/targets/upload_method_cfg/NUCLEO_H503RB.cmake b/targets/upload_method_cfg/NUCLEO_H503RB.cmake index 0a45f368ded..a9c9f4e29ba 100644 --- a/targets/upload_method_cfg/NUCLEO_H503RB.cmake +++ b/targets/upload_method_cfg/NUCLEO_H503RB.cmake @@ -1,6 +1,6 @@ # Mbed OS upload method configuration file for target NUCLEO_H503RB. # To change any of these parameters from their default values, set them in your build script between where you -# include app.cmake and where you add mbed os as a subdirectory. +# include mbed_toolchain_setup and where you add mbed os as a subdirectory. # Notes: # 1. If your target is not natively supported by the pyOCD, then you need install a keil package for family of your target by hands. Type "pyocd pack show" to console and you will see a list of already installed packages. diff --git a/targets/upload_method_cfg/NUCLEO_H563ZI.cmake b/targets/upload_method_cfg/NUCLEO_H563ZI.cmake index 5a1477cc84e..17be447c01e 100644 --- a/targets/upload_method_cfg/NUCLEO_H563ZI.cmake +++ b/targets/upload_method_cfg/NUCLEO_H563ZI.cmake @@ -1,6 +1,6 @@ # Mbed OS upload method configuration file for target NUCLEO_H563ZI. # To change any of these parameters from their default values, set them in your build script between where you -# include app.cmake and where you add mbed os as a subdirectory. +# include mbed_toolchain_setup and where you add mbed os as a subdirectory. # Notes: # 1. If your target is not natively supported by the pyOCD, then you need install a keil package for family of your target by hands. Type "pyocd pack show" to console and you will see a list of already installed packages. diff --git a/targets/upload_method_cfg/NUCLEO_H723ZG.cmake b/targets/upload_method_cfg/NUCLEO_H723ZG.cmake index 3b7ad8a865e..2fea190d7b7 100644 --- a/targets/upload_method_cfg/NUCLEO_H723ZG.cmake +++ b/targets/upload_method_cfg/NUCLEO_H723ZG.cmake @@ -1,6 +1,6 @@ # Mbed OS upload method configuration file for target NUCLEO_H723ZG. # To change any of these parameters from their default values, set them in your build script between where you -# include app.cmake and where you add mbed os as a subdirectory. +# include mbed_toolchain_setup and where you add mbed os as a subdirectory. # Notes: # 1. To use this target with PyOCD, you need to install a pack: `pyocd pack install STM32H723ZGTx`. diff --git a/targets/upload_method_cfg/NUCLEO_H743ZI2.cmake b/targets/upload_method_cfg/NUCLEO_H743ZI2.cmake index 93d74739e5a..f80000c8556 100644 --- a/targets/upload_method_cfg/NUCLEO_H743ZI2.cmake +++ b/targets/upload_method_cfg/NUCLEO_H743ZI2.cmake @@ -1,6 +1,6 @@ # Mbed OS upload method configuration file for target NUCLEO_H743ZI. # To change any of these parameters from their default values, set them in your build script between where you -# include app.cmake and where you add mbed os as a subdirectory. +# include mbed_toolchain_setup and where you add mbed os as a subdirectory. # Notes: # 1. Using the JLINK upload method with your dev board requires converting its ST-LINK into a J-Link, but it is not possible to do that with ST-link V3! I will try regular J-link in the future. @@ -37,7 +37,7 @@ set(PYOCD_CLOCK_SPEED 4000k) set(OPENOCD_UPLOAD_ENABLED TRUE) set(OPENOCD_CHIP_CONFIG_COMMANDS - -f ${OpenOCD_SCRIPT_DIR}/board/st_nucleo_h743zi.cfg) + -f board/st_nucleo_h743zi.cfg) # Config options for STM32Cube # ------------------------------------------------------------- diff --git a/targets/upload_method_cfg/NUCLEO_L152RE.cmake b/targets/upload_method_cfg/NUCLEO_L152RE.cmake index 6f3c93a3d4e..1daaf6a6bb4 100644 --- a/targets/upload_method_cfg/NUCLEO_L152RE.cmake +++ b/targets/upload_method_cfg/NUCLEO_L152RE.cmake @@ -1,6 +1,6 @@ # Mbed OS upload method configuration file for target NUCLEO_L152RE. # To change any of these parameters from their default values, set them in your build script between where you -# include app.cmake and where you add mbed os as a subdirectory. +# include mbed_toolchain_setup and where you add mbed os as a subdirectory. # Notes: # 1. Using the JLINK upload method with your dev board requires converting its ST-LINK into a J-Link. See here for details: https://www.segger.com/products/debug-probes/j-link/models/other-j-links/st-link-on-board/ @@ -39,7 +39,7 @@ set(PYOCD_CLOCK_SPEED 4000k) set(OPENOCD_UPLOAD_ENABLED TRUE) set(OPENOCD_CHIP_CONFIG_COMMANDS --f ${OpenOCD_SCRIPT_DIR}/board/st_nucleo_l1.cfg) +-f board/st_nucleo_l1.cfg) # Config options for STM32Cube # ------------------------------------------------------------- diff --git a/targets/upload_method_cfg/NUCLEO_L432KC.cmake b/targets/upload_method_cfg/NUCLEO_L432KC.cmake index d461cef640f..7e886266ae8 100644 --- a/targets/upload_method_cfg/NUCLEO_L432KC.cmake +++ b/targets/upload_method_cfg/NUCLEO_L432KC.cmake @@ -1,6 +1,6 @@ # Mbed OS upload method configuration file for target NUCLEO_L432KC. # To change any of these parameters from their default values, set them in your build script between where you -# include app.cmake and where you add mbed os as a subdirectory. +# include mbed_toolchain_setup and where you add mbed os as a subdirectory. # Notes: # 1. Using the JLINK upload method with your dev board requires converting its ST-LINK into a J-Link. See here for details: https://www.segger.com/products/debug-probes/j-link/models/other-j-links/st-link-on-board/ @@ -38,7 +38,7 @@ set(PYOCD_CLOCK_SPEED 4000k) set(OPENOCD_UPLOAD_ENABLED TRUE) set(OPENOCD_CHIP_CONFIG_COMMANDS --f ${OpenOCD_SCRIPT_DIR}/board/st_nucleo_l4.cfg) +-f board/st_nucleo_l4.cfg) # Config options for STM32Cube # ------------------------------------------------------------- diff --git a/targets/upload_method_cfg/NUCLEO_L452RE_P.cmake b/targets/upload_method_cfg/NUCLEO_L452RE_P.cmake index 10e2034df1a..364c38824df 100644 --- a/targets/upload_method_cfg/NUCLEO_L452RE_P.cmake +++ b/targets/upload_method_cfg/NUCLEO_L452RE_P.cmake @@ -1,6 +1,6 @@ # Mbed OS upload method configuration file for target NUCLEO_F429ZI. # To change any of these parameters from their default values, set them in your build script between where you -# include app.cmake and where you add mbed os as a subdirectory. +# include mbed_toolchain_setup and where you add mbed os as a subdirectory. # Notes: # 1. Using the JLINK upload method with your dev board requires converting its ST-LINK into a J-Link. See here for details: https://www.segger.com/products/debug-probes/j-link/models/other-j-links/st-link-on-board/ diff --git a/targets/upload_method_cfg/NUCLEO_U083RC.cmake b/targets/upload_method_cfg/NUCLEO_U083RC.cmake index 44041145938..e0c5aad092e 100644 --- a/targets/upload_method_cfg/NUCLEO_U083RC.cmake +++ b/targets/upload_method_cfg/NUCLEO_U083RC.cmake @@ -1,6 +1,6 @@ # Mbed OS upload method configuration file for target NUCLEO_U083RC. # To change any of these parameters from their default values, set them in your build script between where you -# include app.cmake and where you add mbed os as a subdirectory. +# include mbed_toolchain_setup and where you add mbed os as a subdirectory. # Notes: # 1. If your target is not natively supported by the pyOCD, then you need install a keil package for family of your target by hands. Type "pyocd pack show" to console and you will see a list of already installed packages. diff --git a/targets/upload_method_cfg/NUCLEO_U575ZI_Q.cmake b/targets/upload_method_cfg/NUCLEO_U575ZI_Q.cmake index 66d25bce4e2..fea82965b7b 100644 --- a/targets/upload_method_cfg/NUCLEO_U575ZI_Q.cmake +++ b/targets/upload_method_cfg/NUCLEO_U575ZI_Q.cmake @@ -1,6 +1,6 @@ # Mbed OS upload method configuration file for target NUCLEO_U575ZI_Q. # To change any of these parameters from their default values, set them in your build script between where you -# include app.cmake and where you add mbed os as a subdirectory. +# include mbed_toolchain_setup and where you add mbed os as a subdirectory. # Notes: # 1. To use this target with PyOCD, you need to install a pack: `pyocd pack install STM32U575ZITxQ`. diff --git a/targets/upload_method_cfg/NUMAKER_IOT_M252.cmake b/targets/upload_method_cfg/NUMAKER_IOT_M252.cmake index 75e33f5394d..5704b5f663b 100644 --- a/targets/upload_method_cfg/NUMAKER_IOT_M252.cmake +++ b/targets/upload_method_cfg/NUMAKER_IOT_M252.cmake @@ -1,6 +1,6 @@ # Mbed OS upload method configuration file for target NUMAKER_IOT_M252. # To change any of these parameters from their default values, set them in your build script between where you -# include app.cmake and where you add mbed os as a subdirectory. +# include mbed_toolchain_setup and where you add mbed os as a subdirectory. # General config parameters # ------------------------------------------------------------- diff --git a/targets/upload_method_cfg/NUMAKER_IOT_M263A.cmake b/targets/upload_method_cfg/NUMAKER_IOT_M263A.cmake index 7b483f05ef0..87bdebc95da 100644 --- a/targets/upload_method_cfg/NUMAKER_IOT_M263A.cmake +++ b/targets/upload_method_cfg/NUMAKER_IOT_M263A.cmake @@ -1,6 +1,6 @@ # Mbed OS upload method configuration file for target NUMAKER_IOT_M263A. # To change any of these parameters from their default values, set them in your build script between where you -# include app.cmake and where you add mbed os as a subdirectory. +# include mbed_toolchain_setup and where you add mbed os as a subdirectory. # General config parameters # ------------------------------------------------------------- diff --git a/targets/upload_method_cfg/NUMAKER_IOT_M467.cmake b/targets/upload_method_cfg/NUMAKER_IOT_M467.cmake index af769c889f4..69cc189a09f 100644 --- a/targets/upload_method_cfg/NUMAKER_IOT_M467.cmake +++ b/targets/upload_method_cfg/NUMAKER_IOT_M467.cmake @@ -1,6 +1,6 @@ # Mbed OS upload method configuration file for target NUMAKER_IOT_M467. # To change any of these parameters from their default values, set them in your build script between where you -# include app.cmake and where you add mbed os as a subdirectory. +# include mbed_toolchain_setup and where you add mbed os as a subdirectory. # General config parameters # ------------------------------------------------------------- diff --git a/targets/upload_method_cfg/NUMAKER_IOT_M487.cmake b/targets/upload_method_cfg/NUMAKER_IOT_M487.cmake index fa5bd7b185d..f26bbd23a4c 100644 --- a/targets/upload_method_cfg/NUMAKER_IOT_M487.cmake +++ b/targets/upload_method_cfg/NUMAKER_IOT_M487.cmake @@ -1,6 +1,6 @@ # Mbed OS upload method configuration file for target NUMAKER_IOT_M487. # To change any of these parameters from their default values, set them in your build script between where you -# include app.cmake and where you add mbed os as a subdirectory. +# include mbed_toolchain_setup and where you add mbed os as a subdirectory. # Notes: # 1. The Nuvoton fork of OpenOCD is required: https://github.com/OpenNuvoton/OpenOCD-Nuvoton/releases . diff --git a/targets/upload_method_cfg/NUMAKER_PFM_M453.cmake b/targets/upload_method_cfg/NUMAKER_PFM_M453.cmake index fd6f99cb6ca..9a8ba6e3ddf 100644 --- a/targets/upload_method_cfg/NUMAKER_PFM_M453.cmake +++ b/targets/upload_method_cfg/NUMAKER_PFM_M453.cmake @@ -1,6 +1,6 @@ # Mbed OS upload method configuration file for target NUMAKER_PFM_M453. # To change any of these parameters from their default values, set them in your build script between where you -# include app.cmake and where you add mbed os as a subdirectory. +# include mbed_toolchain_setup and where you add mbed os as a subdirectory. # General config parameters # ------------------------------------------------------------- diff --git a/targets/upload_method_cfg/NUMAKER_PFM_M487.cmake b/targets/upload_method_cfg/NUMAKER_PFM_M487.cmake index e1a0c242943..621446f0126 100644 --- a/targets/upload_method_cfg/NUMAKER_PFM_M487.cmake +++ b/targets/upload_method_cfg/NUMAKER_PFM_M487.cmake @@ -1,6 +1,6 @@ # Mbed OS upload method configuration file for target NUMAKER_PFM_M487. # To change any of these parameters from their default values, set them in your build script between where you -# include app.cmake and where you add mbed os as a subdirectory. +# include mbed_toolchain_setup and where you add mbed os as a subdirectory. # Notes: # 1. The Nuvoton fork of OpenOCD is required: https://github.com/OpenNuvoton/OpenOCD-Nuvoton/releases . diff --git a/targets/upload_method_cfg/NUMAKER_PFM_NANO130.cmake b/targets/upload_method_cfg/NUMAKER_PFM_NANO130.cmake index 9f32ef12033..6eb34c64786 100644 --- a/targets/upload_method_cfg/NUMAKER_PFM_NANO130.cmake +++ b/targets/upload_method_cfg/NUMAKER_PFM_NANO130.cmake @@ -1,6 +1,6 @@ # Mbed OS upload method configuration file for target NUMAKER_PFM_NANO130. # To change any of these parameters from their default values, set them in your build script between where you -# include app.cmake and where you add mbed os as a subdirectory. +# include mbed_toolchain_setup and where you add mbed os as a subdirectory. # General config parameters # ------------------------------------------------------------- diff --git a/targets/upload_method_cfg/NUMAKER_PFM_NUC472.cmake b/targets/upload_method_cfg/NUMAKER_PFM_NUC472.cmake index b0fcaa85f7a..9da101a6be9 100644 --- a/targets/upload_method_cfg/NUMAKER_PFM_NUC472.cmake +++ b/targets/upload_method_cfg/NUMAKER_PFM_NUC472.cmake @@ -1,6 +1,6 @@ # Mbed OS upload method configuration file for target NUMAKER_PFM_NUC472. # To change any of these parameters from their default values, set them in your build script between where you -# include app.cmake and where you add mbed os as a subdirectory. +# include mbed_toolchain_setup and where you add mbed os as a subdirectory. # General config parameters # ------------------------------------------------------------- diff --git a/targets/upload_method_cfg/NU_M2354.cmake b/targets/upload_method_cfg/NU_M2354.cmake index 92b00d6af23..e8a7e48eb14 100644 --- a/targets/upload_method_cfg/NU_M2354.cmake +++ b/targets/upload_method_cfg/NU_M2354.cmake @@ -1,6 +1,6 @@ # Mbed OS upload method configuration file for target NU_M2354. # To change any of these parameters from their default values, set them in your build script between where you -# include app.cmake and where you add mbed os as a subdirectory. +# include mbed_toolchain_setup and where you add mbed os as a subdirectory. # General config parameters # ------------------------------------------------------------- diff --git a/targets/upload_method_cfg/RASPBERRY_PI_PICO.cmake b/targets/upload_method_cfg/RASPBERRY_PI_PICO.cmake index d5952a69ea0..5b71364fb27 100644 --- a/targets/upload_method_cfg/RASPBERRY_PI_PICO.cmake +++ b/targets/upload_method_cfg/RASPBERRY_PI_PICO.cmake @@ -3,7 +3,7 @@ # into bootloader mode whenever you wish to program it. # Note: If you have a debugger connected to your board, you should be using the RASPBERRY_PI_PICO_SWD target instead. # To change any of these parameters from their default values, set them in your build script between where you -# include app.cmake and where you add mbed os as a subdirectory. +# include mbed_toolchain_setup and where you add mbed os as a subdirectory. # General config parameters # ------------------------------------------------------------- diff --git a/targets/upload_method_cfg/RASPBERRY_PI_PICO_SWD.cmake b/targets/upload_method_cfg/RASPBERRY_PI_PICO_SWD.cmake index b2e215e6bd4..30bf578399e 100644 --- a/targets/upload_method_cfg/RASPBERRY_PI_PICO_SWD.cmake +++ b/targets/upload_method_cfg/RASPBERRY_PI_PICO_SWD.cmake @@ -4,7 +4,7 @@ # another SWD debugger like a Pitaya-Link. # To change any of these parameters from their default values, set them in your build script between where you -# include app.cmake and where you add mbed os as a subdirectory. +# include mbed_toolchain_setup and where you add mbed os as a subdirectory. # General config parameters # ------------------------------------------------------------- @@ -22,8 +22,8 @@ set(PYOCD_CLOCK_SPEED 4000k) set(OPENOCD_UPLOAD_ENABLED TRUE) set(OPENOCD_CHIP_CONFIG_COMMANDS - -f ${OpenOCD_SCRIPT_DIR}/interface/cmsis-dap.cfg - -f ${OpenOCD_SCRIPT_DIR}/target/rp2040.cfg + -f interface/cmsis-dap.cfg + -f target/rp2040.cfg -c "set USE_CORE 0" # Don't pause core 1 as that causes weird effects like keeping the TIMER stuck at 0: https://github.com/raspberrypi/picoprobe/issues/45 -c "adapter speed 4000" ) diff --git a/targets/upload_method_cfg/WIO_H725AE.cmake b/targets/upload_method_cfg/WIO_H725AE.cmake index e5c82d5d1ec..b59c0a0dc3c 100644 --- a/targets/upload_method_cfg/WIO_H725AE.cmake +++ b/targets/upload_method_cfg/WIO_H725AE.cmake @@ -1,6 +1,6 @@ # Mbed OS upload method configuration file for target WIO_H725AE # To change any of these parameters from their default values, set them in your build script between where you -# include app.cmake and where you add mbed os as a subdirectory. +# include mbed_toolchain_setup and where you add mbed os as a subdirectory. # Notes: # 1. Keep in mind the WIO_H725AE does not contain any on-board debugger, so all upload methods counts with external debugger, usually ST-Link. diff --git a/targets/upload_method_cfg/openocd_cfgs/CY8CPROTO_062S3_4343W/qspi_config.cfg b/targets/upload_method_cfg/openocd_cfgs/CY8CPROTO_062S3_4343W/qspi_config.cfg new file mode 100644 index 00000000000..2e7a528303f --- /dev/null +++ b/targets/upload_method_cfg/openocd_cfgs/CY8CPROTO_062S3_4343W/qspi_config.cfg @@ -0,0 +1,29 @@ +################################################################################ +# File Name: qspi_config.cfg +# +# Description: +# This file contains a SMIF Bank layout for use with OpenOCD. +# This file was automatically generated and should not be modified. +# QSPI Configurator: 4.50.0.2481 +# +################################################################################ +# Copyright 2025 Cypress Semiconductor Corporation (an Infineon company) or +# an affiliate of Cypress Semiconductor Corporation. +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +################################################################################ + +set SMIF_BANKS { + 0 {addr 0x18000000 size 0x4000000 psize 0x00000200 esize 0x00040000} +} diff --git a/targets/upload_method_cfg/openocd_cfgs/infineon_psoc62_c8cxx5.cfg b/targets/upload_method_cfg/openocd_cfgs/infineon_psoc62_c8cxx5.cfg new file mode 100644 index 00000000000..e68c9079a8f --- /dev/null +++ b/targets/upload_method_cfg/openocd_cfgs/infineon_psoc62_c8cxx5.cfg @@ -0,0 +1,8 @@ +# This config file generated by Infineon ModusToolbox + +source [find interface/kitprog3.cfg] + +transport select swd + +source [find target/infineon/cy8cxx5.cfg] +psoc6 sflash_restrictions 1 diff --git a/tools/cmake/UploadMethodManager.cmake b/tools/cmake/UploadMethodManager.cmake index be3ff13bee9..4275750f695 100644 --- a/tools/cmake/UploadMethodManager.cmake +++ b/tools/cmake/UploadMethodManager.cmake @@ -8,42 +8,35 @@ # bootloader or TF-M enabled which need to post-build process images. # 2. "load .bin" is not considered because GDB load command # doesn't support binary format. -# -# NOTE: Place at the very start so that it can override by the below loaded -# upload method if need be. -function(mbed_adjust_upload_debug_commands target) - # MBED_UPLOAD_LAUNCH_COMMANDS_BAK = first version of MBED_UPLOAD_LAUNCH_COMMANDS - if(DEFINED MBED_UPLOAD_LAUNCH_COMMANDS_BAK) - # Need first version for fresh adjust - set(MBED_UPLOAD_LAUNCH_COMMANDS ${MBED_UPLOAD_LAUNCH_COMMANDS_BAK}) - elseif(DEFINED MBED_UPLOAD_LAUNCH_COMMANDS) - # No FORCE for saving first version only - set(MBED_UPLOAD_LAUNCH_COMMANDS_BAK ${MBED_UPLOAD_LAUNCH_COMMANDS} CACHE INTERNAL "") - else() - return() - endif() +function(mbed_get_upload_launch_commands_for target result_var) + + set(${result_var} ${MBED_UPLOAD_LAUNCH_COMMANDS}) + + # .hex for debug launch load + set(HEX_FILE ${CMAKE_CURRENT_BINARY_DIR}/$.hex) + # GDB load command in MBED_UPLOAD_LAUNCH_COMMANDS? list(FIND MBED_UPLOAD_LAUNCH_COMMANDS "load" LOAD_INDEX) - if(${LOAD_INDEX} LESS "0") - return() + if(${LOAD_INDEX} GREATER_EQUAL 0) + # "load" -> "load .hex" + # + # GDB load command doesn't support binary format. Ignore OUTPUT_EXT + # and fix to Intel Hex format. + # + # NOTE: The .hex file name needs to be quoted (\") to pass along + # to gdb correctly. + list(TRANSFORM ${result_var} APPEND " \"${HEX_FILE}\"" AT ${LOAD_INDEX}) endif() - # .hex for debug launch load - set(HEX_FILE ${CMAKE_CURRENT_BINARY_DIR}/$.hex) - - # "load" -> "load .hex" - # - # GDB load command doesn't support binary format. Ignore OUTPUT_EXT - # and fix to Intel Hex format. - # - # NOTE: The .hex file name needs to be quoted (\") to pass along - # to gdb correctly. - list(TRANSFORM MBED_UPLOAD_LAUNCH_COMMANDS APPEND " \"${HEX_FILE}\"" AT ${LOAD_INDEX}) + # 'monitor program' command in MBED_UPLOAD_LAUNCH_COMMANDS? + list(FIND MBED_UPLOAD_LAUNCH_COMMANDS "monitor program" MON_PROG_INDEX) + if(${MON_PROG_INDEX} GREATER_EQUAL 0) + list(TRANSFORM ${result_var} APPEND " \"${HEX_FILE}\"" AT ${MON_PROG_INDEX}) + endif() - # Update MBED_UPLOAD_LAUNCH_COMMANDS in cache - set(MBED_UPLOAD_LAUNCH_COMMANDS ${MBED_UPLOAD_LAUNCH_COMMANDS} CACHE INTERNAL "" FORCE) -endfunction() + set(${result_var} ${${result_var}} PARENT_SCOPE) +endfunction(mbed_get_upload_launch_commands_for) # ---------------------------------------------- # Common upload method options @@ -94,6 +87,11 @@ if(NOT DEFINED MBED_UPLOAD_BASE_ADDR OR "${MBED_UPLOAD_BASE_ADDR}" STREQUAL "") endif() endif() +## Debug core index +if(NOT DEFINED MBED_DEBUG_CORE_INDEX) + set(MBED_DEBUG_CORE_INDEX 0) +endif() + # ---------------------------------------------- # Load the upload method. # Upload methods are expected to refer to the following variables: diff --git a/tools/cmake/mbed_ide_debug_cfg_generator.cmake b/tools/cmake/mbed_ide_debug_cfg_generator.cmake index 01741071db6..8e1e4ce3bbf 100644 --- a/tools/cmake/mbed_ide_debug_cfg_generator.cmake +++ b/tools/cmake/mbed_ide_debug_cfg_generator.cmake @@ -138,7 +138,8 @@ elseif(MBED_GENERATE_VS_CODE_DEBUG_CFGS) set(CONFIG_NAME "Debug ${CMAKE_TARGET} ${MBED_TARGET} ${CMAKE_BUILD_TYPE}") # Escape quotes in the launch commands - string(REPLACE "\"" "\\\"" UPLOAD_LAUNCH_COMMANDS_FOR_JSON "${MBED_UPLOAD_LAUNCH_COMMANDS}") + mbed_get_upload_launch_commands_for(${target} TARGET_UPLOAD_LAUNCH_COMMANDS) + string(REPLACE "\"" "\\\"" UPLOAD_LAUNCH_COMMANDS_FOR_JSON "${TARGET_UPLOAD_LAUNCH_COMMANDS}") string(REPLACE "\"" "\\\"" UPLOAD_RESTART_COMMANDS_FOR_JSON "${MBED_UPLOAD_RESTART_COMMANDS}") # Convert CMake lists to json @@ -270,12 +271,14 @@ elseif(MBED_UPLOAD_SUPPORTS_DEBUG) set(UPLOAD_GDB_REMOTE_KEYWORD "remote") endif() - list(JOIN MBED_UPLOAD_LAUNCH_COMMANDS "\n" MBED_UPLOAD_LAUNCH_COMMANDS_FOR_GDBINIT) + mbed_get_upload_launch_commands_for(${target} TARGET_UPLOAD_LAUNCH_COMMANDS) + + list(JOIN TARGET_UPLOAD_LAUNCH_COMMANDS "\n" UPLOAD_LAUNCH_COMMANDS_FOR_GDBINIT) file(GENERATE OUTPUT ${CMAKE_BINARY_DIR}/$.gdbinit CONTENT "# connect to GDB server target ${UPLOAD_GDB_REMOTE_KEYWORD} 127.0.0.1:${MBED_GDB_PORT} -${MBED_UPLOAD_LAUNCH_COMMANDS_FOR_GDBINIT} +${UPLOAD_LAUNCH_COMMANDS_FOR_GDBINIT} c" ) diff --git a/tools/cmake/mbed_target_functions.cmake b/tools/cmake/mbed_target_functions.cmake index e785e06139a..645d15563f2 100644 --- a/tools/cmake/mbed_target_functions.cmake +++ b/tools/cmake/mbed_target_functions.cmake @@ -188,13 +188,6 @@ function(mbed_set_post_build target) endif() mbed_generate_map_file(${target}) - - # Give chance to adjust MBED_UPLOAD_LAUNCH_COMMANDS or MBED_UPLOAD_RESTART_COMMANDS - # for debug launch - if(COMMAND mbed_adjust_upload_debug_commands) - mbed_adjust_upload_debug_commands(${target}) - endif() - mbed_generate_upload_target(${target}) mbed_generate_ide_debug_configuration(${target}) endfunction() diff --git a/tools/cmake/upload_methods/FindOpenOCD.cmake b/tools/cmake/upload_methods/FindOpenOCD.cmake index c3d51ec37eb..369ee529134 100644 --- a/tools/cmake/upload_methods/FindOpenOCD.cmake +++ b/tools/cmake/upload_methods/FindOpenOCD.cmake @@ -7,7 +7,6 @@ # # This module defines: # OpenOCD - full path to OpenOCD executable -# OpenOCD_SCRIPT_DIR - Path containing OpenOCD scripts # OpenOCD_FOUND - whether or not the OpenOCD executable was found set(OpenOCD_PATHS "") @@ -28,35 +27,28 @@ endif() find_program(OpenOCD NAMES openocd PATHS ${OpenOCD_PATHS} DOC "Path to the openocd executable") -# guess a script dir based on the executable path -set(OpenOCD_SCRIPT_DIR_HINTS "") -if(EXISTS ${OpenOCD}) - get_filename_component(OpenOCD_EXECUTABLE_DIR ${OpenOCD} DIRECTORY) - - # on Windows it's in ../scripts, on Linux it's in ../share/openocd/scripts - set(OpenOCD_SCRIPT_DIR_HINTS HINTS ${OpenOCD_EXECUTABLE_DIR}/../scripts ${OpenOCD_EXECUTABLE_DIR}/../share/openocd/scripts) -endif() - -find_path(OpenOCD_SCRIPT_DIR - NAMES interface/cmsis-dap.cfg - ${OpenOCD_SCRIPT_DIR_HINTS} - PATHS /usr/share/openocd/scripts/ - DOC "Path to OpenOCD scripts folder. Should contain interface/cmsis-dap.cfg.") - if(OpenOCD AND EXISTS "${OpenOCD}") - # Detect version (it writes to stderr) + # Detect version. Most versions write to stderr but some (Infineon OpenOCD) write to stdout execute_process(COMMAND ${OpenOCD} --version - ERROR_VARIABLE OpenOCD_VERSION_OUTPUT) + ERROR_VARIABLE OpenOCD_VERSION_ERROR_OUTPUT + OUTPUT_VARIABLE OpenOCD_VERSION_OUTPUT + COMMAND_ERROR_IS_FATAL ANY) # Use a regex to grab the version number - string(REGEX MATCH "Open On-Chip Debugger ([^ ]+)" OpenOCD_VERSION_UNUSED_MATCH "${OpenOCD_VERSION_OUTPUT}") - set(OpenOCD_VERSION ${CMAKE_MATCH_1}) + if("${OpenOCD_VERSION_ERROR_OUTPUT}" MATCHES "Open On-Chip Debugger ([^ ]+)") + set(OpenOCD_VERSION ${CMAKE_MATCH_1}) + elseif("${OpenOCD_VERSION_OUTPUT}" MATCHES "Open On-Chip Debugger ([^ ]+)") + set(OpenOCD_VERSION ${CMAKE_MATCH_1}) + else() + message(WARNING "Unable to determine OpenOCD version") + endif() + endif() find_package_handle_standard_args(OpenOCD HANDLE_VERSION_RANGE FOUND_VAR OpenOCD_FOUND VERSION_VAR OpenOCD_VERSION - REQUIRED_VARS OpenOCD OpenOCD_SCRIPT_DIR) + REQUIRED_VARS OpenOCD) diff --git a/tools/cmake/upload_methods/UploadMethodOPENOCD.cmake b/tools/cmake/upload_methods/UploadMethodOPENOCD.cmake index 7dee8d8cfa0..7727ff6278c 100644 --- a/tools/cmake/upload_methods/UploadMethodOPENOCD.cmake +++ b/tools/cmake/upload_methods/UploadMethodOPENOCD.cmake @@ -9,6 +9,8 @@ # This method creates the following options: # OPENOCD_VERSION_RANGE - Acceptable version range of OpenOCD. This may be a single version, in which case it is treated as # a minimum, or a versionMin... ] gets an item from the list by index. + -c "[lindex [target names] ${MBED_DEBUG_CORE_INDEX}] configure -event gdb-detach {shutdown}" + -c "gdb_port ${OPENOCD_GDB_PORT}") # request extended-remote GDB sessions set(UPLOAD_WANTS_EXTENDED_REMOTE TRUE) +if(NOT DEFINED OPENOCD_GDB_RESET_SEQUENCE) + set(OPENOCD_GDB_RESET_SEQUENCE "monitor reset halt") +endif() + # Reference: https://github.com/Marus/cortex-debug/blob/056c03f01e008828e6527c571ef5c9adaf64083f/src/openocd.ts#L100 set(UPLOAD_LAUNCH_COMMANDS - "monitor reset halt" + ${OPENOCD_GDB_RESET_SEQUENCE} # For targets which support semihosting, prevent GDB from stopping when a semihosting event happens. # AFAIK, semihosting is only used to communicate between the interface chip and the CPU; we never @@ -83,12 +105,15 @@ set(UPLOAD_LAUNCH_COMMANDS # the user can't inspect peripheral registers. "set mem inaccessible-by-default off" - "load" + # OpenOCD provides the 'monitor program' command as an alternative to 'load'. Seems like it does basically the same thing, except + # that on certain devices (e.g. PSoC 62) it works while 'load' does not. + "monitor program" + "tbreak main" - "monitor reset halt" + ${OPENOCD_GDB_RESET_SEQUENCE} ) set(UPLOAD_RESTART_COMMANDS - "monitor reset halt" + ${OPENOCD_GDB_RESET_SEQUENCE} # The following will force an sync between gdb and openocd "monitor gdb_sync" diff --git a/tools/cmake/upload_methods/UploadMethodPYOCD.cmake b/tools/cmake/upload_methods/UploadMethodPYOCD.cmake index f0e93716c06..6a8cb72a158 100644 --- a/tools/cmake/upload_methods/UploadMethodPYOCD.cmake +++ b/tools/cmake/upload_methods/UploadMethodPYOCD.cmake @@ -43,6 +43,15 @@ function(gen_upload_target TARGET_NAME BINARY_FILE) endfunction(gen_upload_target) ### Commands to run the debug server. + +# PyOCD has some rather odd behavior where if the MCU has multiple asymmetric cores, it will increment the +# GDB server port for each core -- e.g. core 0 will have its GDB server started on the passed port number, +# and core 1 will have its GDB server started on the passed port number plus one. This happens *even if* +# you tell it to only debug one core via passing an option like `--core 1`. +# So, since the IDE will always be connecting on MBED_GDB_PORT, we have to decrease the port number passed to +# PyOCD according to the core index we want to connect to. +math(EXPR PYOCD_GDB_PORT "${MBED_GDB_PORT} - ${MBED_DEBUG_CORE_INDEX}") + set(UPLOAD_GDBSERVER_DEBUG_COMMAND ${Python3_EXECUTABLE} -m pyocd @@ -51,9 +60,13 @@ set(UPLOAD_GDBSERVER_DEBUG_COMMAND -t ${PYOCD_TARGET_NAME} ${PYOCD_PROBE_ARGS} -f ${PYOCD_CLOCK_SPEED} - -p ${MBED_GDB_PORT} + -p ${PYOCD_GDB_PORT} ${PYOCD_EXTRA_OPTIONS}) +if(NOT MBED_DEBUG_CORE_INDEX EQUAL 0) + list(APPEND UPLOAD_GDBSERVER_DEBUG_COMMAND -Oprimary_core=${MBED_DEBUG_CORE_INDEX}) +endif() + # Reference: https://github.com/Marus/cortex-debug/blob/056c03f01e008828e6527c571ef5c9adaf64083f/src/pyocd.ts#L40 set(UPLOAD_LAUNCH_COMMANDS "monitor reset halt"