From 9d8807c7feadc8b73fc9569b35f9edc282408958 Mon Sep 17 00:00:00 2001 From: Felipe Torrezan Date: Fri, 17 Feb 2023 11:07:31 +0100 Subject: [PATCH] Enhanced support for CSpyBat (#22) Added improved detection scheme for CSpyBat in the CTest functionality for arm. --- .gitignore | 1 + examples/arm/iar-cspy-arm.cmake | 27 +++++++++++++++++++++++---- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 7d0207e..b85a80b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ _build* +build* hello-world Testing diff --git a/examples/arm/iar-cspy-arm.cmake b/examples/arm/iar-cspy-arm.cmake index 162903f..2e18ae1 100644 --- a/examples/arm/iar-cspy-arm.cmake +++ b/examples/arm/iar-cspy-arm.cmake @@ -2,13 +2,32 @@ # to execute the `IAR C-SPY Command-line Utility (cspybat.exe)` function(iar_cspy_add_test TARGET TEST_NAME EXPECTED_OUTPUT) + find_program(CSPY_BAT + NAMES cspybat CSpyBat + PATHS ${TOOLKIT_DIR}/../common + PATH_SUFFIXES bin + REQUIRED ) + + # Check if C-SPY is being run from BX + if(WIN32) + set(libPREFIX "") + set(libPROCsuffix proc.dll) + set(libSIM2suffix sim2.dll) + set(libBATsuffix bat.dll) + else() + set(libPREFIX lib) + set(libPROCsuffix PROC.so) + set(libSIM2suffix SIM2.so) + set(libBATsuffix Bat.so) + endif() + # Add a test for CTest add_test(NAME ${TEST_NAME} - COMMAND ${TOOLKIT_DIR}/../common/bin/cspybat --silent + COMMAND ${CSPY_BAT} --silent # C-SPY drivers - "${TOOLKIT_DIR}/bin/${CMAKE_SYSTEM_PROCESSOR}proc.dll" - "${TOOLKIT_DIR}/bin/${CMAKE_SYSTEM_PROCESSOR}sim2.dll" - "--plugin=${TOOLKIT_DIR}/bin/${CMAKE_SYSTEM_PROCESSOR}bat.dll" + "${TOOLKIT_DIR}/bin/${libPREFIX}${CMAKE_SYSTEM_PROCESSOR}${libPROCsuffix}" + "${TOOLKIT_DIR}/bin/${libPREFIX}${CMAKE_SYSTEM_PROCESSOR}${libSIM2suffix}" + "--plugin=${TOOLKIT_DIR}/bin/${libPREFIX}${CMAKE_SYSTEM_PROCESSOR}${libBATsuffix}" --debug_file=$ $>,--device_macro=$,> # C-SPY macros settings