From 7cbd75cc9a02023d292f56f00d1293266ba7b9e3 Mon Sep 17 00:00:00 2001 From: PonomarevDA Date: Thu, 19 Dec 2024 00:58:02 +0300 Subject: [PATCH] move NUM_OF_CAN_BUSES from toolchain to the root cmake file --- CMakeLists.txt | 8 ++++---- cmake/Toolchain-arm-none-eabi.cmake | 2 -- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dcce0ab..8c8e634 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,15 +31,15 @@ elseif(USE_PLATFORM_NODE_V3) set(APP_PLATFORM stm32g0b1) set(PLATFORM_NAME v3) include(${CMAKE_DIR}/stm32g0b1.cmake) + add_compile_definitions(CYPHAL_NUM_OF_CAN_BUSES=2) else() message(SEND_ERROR "Platform Error: Either v2 (stm32f103), v3 (stm32g0) or SITL (Linux) should be specified.") endif() # Option 2. Choose the protocol -if(CAN_PROTOCOL STREQUAL "dronecan" OR CAN_PROTOCOL STREQUAL "cyphal" OR CAN_PROTOCOL STREQUAL "both") - set(APPLICATION_DIR ${ROOT_DIR}/Src/applications/${CAN_PROTOCOL}) -else() - message(SEND_ERROR "CAN_PROTOCOL is unknown.") +set(APPLICATION_DIR ${ROOT_DIR}/Src/applications/${CAN_PROTOCOL}) +if(NOT (EXISTS ${APPLICATION_DIR} AND IS_DIRECTORY ${APPLICATION_DIR})) + message(FATAL_ERROR "CAN_PROTOCOL '${CAN_PROTOCOL}' is unknown.") endif() # Set build dir based on hardware version and protocol diff --git a/cmake/Toolchain-arm-none-eabi.cmake b/cmake/Toolchain-arm-none-eabi.cmake index b3d126b..247aafa 100644 --- a/cmake/Toolchain-arm-none-eabi.cmake +++ b/cmake/Toolchain-arm-none-eabi.cmake @@ -29,6 +29,4 @@ set(CMAKE_EXE_LINKER_FLAGS "-mcpu=${TARGET_ARCHITECTURE} -mthumb -lc -lm -lnosys add_compile_definitions( USE_HAL_DRIVER ${CPU} - CYPHAL_NUM_OF_CAN_BUSES=2 - NUM_OF_CAN_BUSES=2 )