diff --git a/cmake/FindBSP.cmake b/cmake/FindBSP.cmake index 951c6321..0089c8cf 100644 --- a/cmake/FindBSP.cmake +++ b/cmake/FindBSP.cmake @@ -267,10 +267,21 @@ foreach(COMP ${BSP_FIND_COMPONENTS}) endif() if(NOT STM32_CUBE_${FAMILY}_PATH) - set(STM32_CUBE_${FAMILY}_PATH /opt/STM32Cube${FAMILY} CACHE PATH "Path to STM32Cube${FAMILY}") - message(STATUS "No STM32_CUBE_${FAMILY}_PATH specified using default: ${STM32_CUBE_${FAMILY}_PATH}") + set(DEFAULT_STM32_CUBE_${FAMILY}_PATH "/opt/STM32Cube${FAMILY}") + if(EXISTS ${DEFAULT_STM32_CUBE_${FAMILY}_PATH}) + set(STM32_CUBE_${FAMILY}_PATH ${DEFAULT_STM32_CUBE_${FAMILY}_PATH} CACHE PATH "Path to STM32Cube${FAMILY}") + message(STATUS "No STM32_CUBE_${FAMILY}_PATH specified. " + "Using default STM32_CUBE_${FAMILY}_PATH: ${STM32_CUBE_${FAMILY}_PATH}") + else() + message(STATUS "No STM32_CUBE_${FAMILY}_PATH specified. " + "default STM32_CUBE_${FAMILY}_PATH: ${DEFAULT_STM32_CUBE_${FAMILY}_PATH} does not exist. Leaving empty.") + endif() endif() - + + if((BSP_FIND_REQUIRED_${COMP}) AND (NOT EXISTS ${STM32_CUBE_${FAMILY}_PATH})) + message(WARNING "For REQUIRED COMPONENT: ${COMP}, STM32_CUBE_${FAMILY}_PATH: '${STM32_CUBE_${FAMILY}_PATH}' Does not Exist") + endif() + find_path(BSP_${FAMILY}_PATH NAMES Components/Common/io.h PATHS "${STM32_CUBE_${FAMILY}_PATH}/Drivers/BSP" diff --git a/cmake/FindCMSIS.cmake b/cmake/FindCMSIS.cmake index 3821538f..db1db92b 100644 --- a/cmake/FindCMSIS.cmake +++ b/cmake/FindCMSIS.cmake @@ -76,10 +76,21 @@ foreach(COMP ${CMSIS_FIND_COMPONENTS}) endif() if((NOT STM32_CMSIS_${FAMILY}_PATH) AND (NOT STM32_CUBE_${FAMILY}_PATH)) - set(STM32_CUBE_${FAMILY}_PATH /opt/STM32Cube${FAMILY} CACHE PATH "Path to STM32Cube${FAMILY}") - message(STATUS "Neither STM32_CUBE_${FAMILY}_PATH nor STM32_CMSIS_${FAMILY}_PATH specified using default STM32_CUBE_${FAMILY}_PATH: ${STM32_CUBE_${FAMILY}_PATH}") + set(DEFAULT_STM32_CUBE_${FAMILY}_PATH "/opt/STM32Cube${FAMILY}") + if(EXISTS ${DEFAULT_STM32_CUBE_${FAMILY}_PATH}) + set(STM32_CUBE_${FAMILY}_PATH ${DEFAULT_STM32_CUBE_${FAMILY}_PATH} CACHE PATH "Path to STM32Cube${FAMILY}") + message(STATUS "Neither STM32_CUBE_${FAMILY}_PATH nor STM32_CMSIS_${FAMILY}_PATH specified." + "Using default STM32_CUBE_${FAMILY}_PATH: ${STM32_CUBE_${FAMILY}_PATH}") + else() + message(STATUS "Neither STM32_CUBE_${FAMILY}_PATH nor STM32_CMSIS_${FAMILY}_PATH specified. " + "default STM32_CUBE_${FAMILY}_PATH: ${DEFAULT_STM32_CUBE_${FAMILY}_PATH} does not exist. Leaving empty.") + endif() endif() - + + if ((CMSIS_FIND_REQUIRED_${COMP}) AND (NOT EXISTS ${STM32_CMSIS_${FAMILY}_PATH}) AND (NOT EXISTS ${STM32_CUBE_${FAMILY}_PATH}})) + message(WARNING "For REQUIRED COMPONENT: ${COMP}, Neither STM32_CUBE_${FAMILY}_PATH: '${STM32_CUBE_${FAMILY}_PATH}' nor STM32_CMSIS_${FAMILY}_PATH: '${STM32_CMSIS_${FAMILY}_PATH}' Exists") + endif() + find_path(CMSIS_${FAMILY}${CORE_U}_CORE_PATH NAMES Include/cmsis_gcc.h PATHS "${STM32_CMSIS_PATH}" "${STM32_CUBE_${FAMILY}_PATH}/Drivers/CMSIS" diff --git a/cmake/FindFreeRTOS.cmake b/cmake/FindFreeRTOS.cmake index 0bd61010..372092a4 100644 --- a/cmake/FindFreeRTOS.cmake +++ b/cmake/FindFreeRTOS.cmake @@ -12,8 +12,18 @@ if(NOT FREERTOS_PATH) endif() if(NOT FREERTOS_PATH) - set(FREERTOS_PATH /opt/FreeRTOS CACHE PATH "Path to FreeRTOS") - message(STATUS "No FREERTOS_PATH specified using default: ${FREERTOS_PATH}") + set(DEFAULT_FREERTOS_PATH "/opt/FreeRTOS") + if (EXISTS ${DEFAULT_FREERTOS_PATH}) + set(FREERTOS_PATH ${DEFAULT_FREERTOS_PATH} CACHE PATH "Path to FreeRTOS") + message(STATUS "No FREERTOS_PATH specified using default: ${FREERTOS_PATH}") + else() + message(STATUS "No FREERTOS_PATH specified." + "default FREERTOS_PATH: ${DEFAULT_FREERTOS_PATH} does not exist. Leaving Empty.") + endif() +endif() + +if ((FREERTOS_FIND_REQUIRED) AND (NOT EXISTS ${FREERTOS_PATH})) + message(WARNING "FREERTOS_PATH: '${FREERTOS_PATH}' Does not Exist") endif() find_path(FreeRTOS_COMMON_INCLUDE diff --git a/cmake/FindHAL.cmake b/cmake/FindHAL.cmake index 655d19e3..b7f6c3ff 100644 --- a/cmake/FindHAL.cmake +++ b/cmake/FindHAL.cmake @@ -242,8 +242,19 @@ foreach(COMP ${HAL_FIND_COMPONENTS_FAMILIES}) endif() if((NOT STM32_HAL_${FAMILY}_PATH) AND (NOT STM32_CUBE_${FAMILY}_PATH)) - set(STM32_CUBE_${FAMILY}_PATH /opt/STM32Cube${FAMILY} CACHE PATH "Path to STM32Cube${FAMILY}") - message(STATUS "Neither STM32_CUBE_${FAMILY}_PATH nor STM32_HAL_${FAMILY}_PATH specified using default STM32_CUBE_${FAMILY}_PATH: ${STM32_CUBE_${FAMILY}_PATH}") + set(DEFAULT_STM32_CUBE_${FAMILY}_PATH "/opt/STM32Cube${FAMILY}") + if(EXISTS ${DEFAULT_STM32_CUBE_${FAMILY}_PATH}) + set(STM32_CUBE_${FAMILY}_PATH ${DEFAULT_STM32_CUBE_${FAMILY}_PATH} CACHE PATH "Path to STM32Cube${FAMILY}") + message(STATUS "Neither STM32_CUBE_${FAMILY}_PATH nor STM32_HAL_${FAMILY}_PATH specified." + "Using default STM32_CUBE_${FAMILY}_PATH: ${STM32_CUBE_${FAMILY}_PATH}") + elseif() + message(STATUS "Neither STM32_CUBE_${FAMILY}_PATH nor STM32_HAL_${FAMILY}_PATH specified. " + "default STM32_CUBE_${FAMILY}_PATH: ${DEFAULT_STM32_CUBE_${FAMILY}_PATH} does not exist. Leaving empty.") + endif() + endif() + + if((HAL_FIND_REQUIRED_${COMP}) AND (NOT EXISTS ${STM32_HAL_${FAMILY}_PATH}) AND (NOT EXISTS ${STM32_CUBE_${FAMILY}_PATH})) + message(WARNING "For REQUIRED COMPONENT: ${COMP}, Neither STM32_CUBE_${FAMILY}_PATH: '${STM32_CUBE_${FAMILY}_PATH}' nor STM32_HAL_${FAMILY}_PATH: '${STM32_HAL_${FAMILY}_PATH}' Exists.") endif() #Checking HAL patch or release version diff --git a/tests/bsp/CMakeLists.txt b/tests/bsp/CMakeLists.txt index cf62092e..55f107fe 100644 --- a/tests/bsp/CMakeLists.txt +++ b/tests/bsp/CMakeLists.txt @@ -4,6 +4,7 @@ set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/stm32_gcc.cmake if(NOT TEST_FAMILIES) # Can't test H7 because it needs some non-free components set(TEST_FAMILIES F0 F1 F2 F3 F4 F7 G0 G4 L0 L1 L4) + message(STATUS "No Test Families, running with TEST_FAMILIES=[${TEST_FAMILIES}]") endif() # Nucleo boards can have different devices on it @@ -41,9 +42,12 @@ if(FETCH_ST_SOURCES) stm32_fetch_cube(${TEST_FAMILIES}) endif() -find_package(CMSIS REQUIRED) -find_package(HAL REQUIRED) -find_package(BSP REQUIRED) +set(COMP_LIST ${TEST_FAMILIES}) +list(TRANSFORM COMP_LIST PREPEND STM32) + +find_package(CMSIS COMPONENTS ${COMP_LIST} REQUIRED) +find_package(HAL COMPONENTS ${COMP_LIST} REQUIRED) +find_package(BSP COMPONENTS ${COMP_LIST} REQUIRED) set(SOURCES main.c) diff --git a/tests/cmsis/CMakeLists.txt b/tests/cmsis/CMakeLists.txt index 847d3440..7c375469 100644 --- a/tests/cmsis/CMakeLists.txt +++ b/tests/cmsis/CMakeLists.txt @@ -3,6 +3,7 @@ set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/stm32_gcc.cmake if(NOT TEST_FAMILIES) set(TEST_FAMILIES F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5) + message(STATUS "No Test Families, running with TEST_FAMILIES=[${TEST_FAMILIES}]") endif() project(cmsis-test C ASM) @@ -11,7 +12,10 @@ if(FETCH_ST_SOURCES) stm32_fetch_cmsis(${TEST_FAMILIES}) endif() -find_package(CMSIS REQUIRED) +set(COMP_LIST ${TEST_FAMILIES}) +list(TRANSFORM COMP_LIST PREPEND STM32) + +find_package(CMSIS COMPONENTS ${COMP_LIST} REQUIRED) set(SOURCES main.c) diff --git a/tests/fetch/CMakeLists.txt b/tests/fetch/CMakeLists.txt index 66f4b807..5e9ed4dd 100644 --- a/tests/fetch/CMakeLists.txt +++ b/tests/fetch/CMakeLists.txt @@ -3,6 +3,7 @@ set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/stm32_gcc.cmake if(NOT TEST_FAMILIES) set(TEST_FAMILIES F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5) + message(STATUS "No Test Families, running with TEST_FAMILIES=[${TEST_FAMILIES}]") endif() project(fetch-test C ASM) @@ -11,8 +12,11 @@ set(CMAKE_INCLUDE_CURRENT_DIR TRUE) stm32_fetch_cmsis(${TEST_FAMILIES}) stm32_fetch_hal(${TEST_FAMILIES}) -find_package(CMSIS REQUIRED) -find_package(HAL REQUIRED) +set(COMP_LIST ${TEST_FAMILIES}) +list(TRANSFORM COMP_LIST PREPEND STM32) + +find_package(CMSIS COMPONENTS ${COMP_LIST} REQUIRED) +find_package(HAL COMPONENTS ${COMP_LIST} REQUIRED) set(SOURCES main.c) diff --git a/tests/hal/CMakeLists.txt b/tests/hal/CMakeLists.txt index b28482ba..844cd87c 100644 --- a/tests/hal/CMakeLists.txt +++ b/tests/hal/CMakeLists.txt @@ -3,6 +3,7 @@ set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/stm32_gcc.cmake if(NOT TEST_FAMILIES) set(TEST_FAMILIES F0 F1 F2 F3 F4 F7 G0 G4 H7 L0 L1 L4 L5) + message(STATUS "No Test Families, running with TEST_FAMILIES=[${TEST_FAMILIES}]") endif() project(hal-test C ASM) @@ -13,8 +14,11 @@ if(FETCH_ST_SOURCES) stm32_fetch_hal(${TEST_FAMILIES}) endif() -find_package(CMSIS REQUIRED) -find_package(HAL REQUIRED) +set(COMP_LIST ${TEST_FAMILIES}) +list(TRANSFORM COMP_LIST PREPEND STM32) + +find_package(CMSIS COMPONENTS ${COMP_LIST} REQUIRED) +find_package(HAL COMPONENTS ${COMP_LIST} REQUIRED) set(SOURCES main.c)