From d2d38fb0b367b517e66682ced1ca7b49a83caacd Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 13 Jul 2021 11:04:31 +0200 Subject: [PATCH] updated cmake scripts --- CMakeLists.txt | 34 +++++++++---------- .../Hosted/vs2019/create_cmake_debug_cfg.sh | 28 --------------- .../Hosted/vs2019/create_cmake_release_cfg.sh | 28 --------------- cmake/scripts/Linux/make_debug_cfg.sh | 26 -------------- cmake/scripts/Linux/make_reldef_cfg.sh | 26 -------------- cmake/scripts/Linux/make_release_cfg.sh | 26 -------------- cmake/scripts/Linux/make_size_cfg.sh | 26 -------------- cmake/scripts/Linux/ninja_debug_cfg.sh | 26 -------------- ...e_cmake_debug_cfg.sh => make_debug_cfg.sh} | 11 ++++-- ..._relwithdeb_cfg.sh => make_release_cfg.sh} | 11 +++--- ..._cmake_release_cfg.sh => make_size_cfg.sh} | 11 ++++-- ...e_relwithdeb_cfg.sh => ninja_debug_cfg.sh} | 15 ++++---- 12 files changed, 46 insertions(+), 222 deletions(-) delete mode 100644 cmake/scripts/Hosted/vs2019/create_cmake_debug_cfg.sh delete mode 100644 cmake/scripts/Hosted/vs2019/create_cmake_release_cfg.sh delete mode 100755 cmake/scripts/Linux/make_debug_cfg.sh delete mode 100755 cmake/scripts/Linux/make_reldef_cfg.sh delete mode 100755 cmake/scripts/Linux/make_release_cfg.sh delete mode 100755 cmake/scripts/Linux/make_size_cfg.sh delete mode 100755 cmake/scripts/Linux/ninja_debug_cfg.sh rename cmake/scripts/{Hosted/create_cmake_debug_cfg.sh => make_debug_cfg.sh} (66%) rename cmake/scripts/{Hosted/create_cmake_relwithdeb_cfg.sh => make_release_cfg.sh} (74%) rename cmake/scripts/{Hosted/create_cmake_release_cfg.sh => make_size_cfg.sh} (66%) rename cmake/scripts/{Hosted/vs2019/create_cmake_relwithdeb_cfg.sh => ninja_debug_cfg.sh} (60%) mode change 100644 => 100755 diff --git a/CMakeLists.txt b/CMakeLists.txt index 43d111c..d9e2eda 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,26 +32,10 @@ project(fsfw-example-stm32h7-freertos ASM C CXX) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED True) -find_package(CMSIS COMPONENTS STM32H743ZI STM32H7_M7 RTOS REQUIRED) -find_package(FreeRTOS COMPONENTS STM32H7 ARM_CM7 REQUIRED) -find_package(HAL COMPONENTS STM32H7M7 STM32H743ZI RCC GPIO UART TIM CORTEX ETH SPI DMA REQUIRED) -find_package(LwIP REQUIRED) set(TGT_BSP "arm/stm32h743zi-nucleo") set(FREERTOS_NAMESPACE FreeRTOS::STM32::H7::M7) -# These need to be set for the FSFW so the sources are compiled with the ABI flags -# and to compile FreeRTOS first -set(LIB_OS_NAME ${FREERTOS_NAMESPACE}::ARM_CM7) -# This target is used because a custom linker script is used -set(CMSIS_LINK_TARGET CMSIS::STM32::H743xx::M7) -set(FSFW_ADDITIONAL_LINK_LIBS ${CMSIS_LINK_TARGET}) -set(FSFW_HAL_LINK_LIBS - HAL::STM32::H7::M7::CORTEX - ${CMSIS_LINK_TARGET} - ${LIB_OS_NAME} -) - # Set names and variables set(TARGET_NAME ${CMAKE_PROJECT_NAME}) set(LIB_FSFW_NAME fsfw) @@ -68,8 +52,24 @@ set(FSFW_CONFIG_PATH "${BSP_PATH}/fsfwconfig") set(BSP_NUCLEO_PATH "${BSP_PATH}/NUCLEO-H743ZI") set(BSP_NUCLEO_INC_PATH "${BSP_NUCLEO_PATH}/Inc") -set(FSFW_HAL_ADDITIONAL_INC_PATHS ${BSP_NUCLEO_INC_PATH}) +# See stm32-cmake documentation for more information +find_package(CMSIS COMPONENTS STM32H743ZI STM32H7_M7 RTOS REQUIRED) +find_package(FreeRTOS COMPONENTS STM32H7 ARM_CM7 REQUIRED) +find_package(HAL COMPONENTS STM32H7M7 STM32H743ZI RCC GPIO UART TIM CORTEX ETH SPI DMA REQUIRED) +find_package(LwIP REQUIRED) +# These need to be set for the FSFW so the sources are compiled with the ABI flags +# and to compile FreeRTOS first +set(LIB_OS_NAME ${FREERTOS_NAMESPACE}::ARM_CM7) +# This target is used because a custom linker script is used +set(CMSIS_LINK_TARGET CMSIS::STM32::H743xx::M7) +set(FSFW_ADDITIONAL_LINK_LIBS ${CMSIS_LINK_TARGET}) +set(FSFW_HAL_LINK_LIBS + HAL::STM32::H7::M7::CORTEX + ${CMSIS_LINK_TARGET} + ${LIB_OS_NAME} +) +set(FSFW_HAL_ADDITIONAL_INC_PATHS ${BSP_NUCLEO_INC_PATH}) set(FSFW_ADDITIONAL_INC_PATHS "${COMMON_CONFIG_PATH}" "${CMAKE_CURRENT_BINARY_DIR}" diff --git a/cmake/scripts/Hosted/vs2019/create_cmake_debug_cfg.sh b/cmake/scripts/Hosted/vs2019/create_cmake_debug_cfg.sh deleted file mode 100644 index 8b6aa92..0000000 --- a/cmake/scripts/Hosted/vs2019/create_cmake_debug_cfg.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -counter=0 -while [ ${counter} -lt 5 ] -do - cd .. - if [ -f "cmake_build_config.py" ];then - break - fi - counter=$((counter=counter + 1)) -done - -if [ "${counter}" -ge 5 ];then - echo "create_cmake_cfg.sh not found in upper directories!" - exit 1 -fi - -build_generator="" -os_fsfw="host" -builddir="Debug-VS2019" - -if [ "${OS}" = "Windows_NT" ]; then - build_generator="Visual Studio 16 2019" -# Could be other OS but this works for now. -else - build_generator="Unix Makefiles" -fi - -python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "debug" -l "${builddir}" diff --git a/cmake/scripts/Hosted/vs2019/create_cmake_release_cfg.sh b/cmake/scripts/Hosted/vs2019/create_cmake_release_cfg.sh deleted file mode 100644 index 9ac0f0a..0000000 --- a/cmake/scripts/Hosted/vs2019/create_cmake_release_cfg.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -counter=0 -while [ ${counter} -lt 5 ] -do - cd .. - if [ -f "cmake_build_config.py" ];then - break - fi - counter=$((counter=counter + 1)) -done - -if [ "${counter}" -ge 5 ];then - echo "create_cmake_cfg.sh not found in upper directories!" - exit 1 -fi - -build_generator="" -os_fsfw="host" -builddir="Release-VS2019" - -if [ "${OS}" = "Windows_NT" ]; then - build_generator="Visual Studio 16 2019" -# Could be other OS but this works for now. -else - build_generator="Unix Makefiles" -fi - -python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "release" -l "${builddir}" diff --git a/cmake/scripts/Linux/make_debug_cfg.sh b/cmake/scripts/Linux/make_debug_cfg.sh deleted file mode 100755 index 39c9652..0000000 --- a/cmake/scripts/Linux/make_debug_cfg.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh -counter=0 -while [ ${counter} -lt 5 ] -do - cd .. - if [ -f "cmake_build_config.py" ];then - break - fi - counter=$((counter=counter + 1)) -done - -if [ "${counter}" -ge 5 ];then - echo "create_cmake_cfg.sh not found in upper directories!" - exit 1 -fi - -build_generator="Unix Makefiles" -os_fsfw="linux" -builddir="build-Debug" - -echo "Running command (without the leading +):" -set -x # Print command -python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "debug" \ - -t "host/none" -l "${builddir}" -# Use this if commands are added which should not be printed -# set +x diff --git a/cmake/scripts/Linux/make_reldef_cfg.sh b/cmake/scripts/Linux/make_reldef_cfg.sh deleted file mode 100755 index 228df8a..0000000 --- a/cmake/scripts/Linux/make_reldef_cfg.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh -counter=0 -while [ ${counter} -lt 5 ] -do - cd .. - if [ -f "cmake_build_config.py" ];then - break - fi - counter=$((counter=counter + 1)) -done - -if [ "${counter}" -ge 5 ];then - echo "create_cmake_cfg.sh not found in upper directories!" - exit 1 -fi - -build_generator="Unix Makefiles" -os_fsfw="linux" -builddir="build-Release" - -echo "Running command (without the leading +):" -set -x # Print command -python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "reldeb" \ - -t "host/none" -l "${builddir}" -# Use this if commands are added which should not be printed -# set +x diff --git a/cmake/scripts/Linux/make_release_cfg.sh b/cmake/scripts/Linux/make_release_cfg.sh deleted file mode 100755 index 4003a98..0000000 --- a/cmake/scripts/Linux/make_release_cfg.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh -counter=0 -while [ ${counter} -lt 5 ] -do - cd .. - if [ -f "cmake_build_config.py" ];then - break - fi - counter=$((counter=counter + 1)) -done - -if [ "${counter}" -ge 5 ];then - echo "create_cmake_cfg.sh not found in upper directories!" - exit 1 -fi - -build_generator="Unix Makefiles" -os_fsfw="linux" -builddir="build-Release" - -echo "Running command (without the leading +):" -set -x # Print command -python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "release" \ - -t "host/none" -l "${builddir}" -# Use this if commands are added which should not be printed -# set +x diff --git a/cmake/scripts/Linux/make_size_cfg.sh b/cmake/scripts/Linux/make_size_cfg.sh deleted file mode 100755 index 7c5cc17..0000000 --- a/cmake/scripts/Linux/make_size_cfg.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh -counter=0 -while [ ${counter} -lt 5 ] -do - cd .. - if [ -f "cmake_build_config.py" ];then - break - fi - counter=$((counter=counter + 1)) -done - -if [ "${counter}" -ge 5 ];then - echo "create_cmake_cfg.sh not found in upper directories!" - exit 1 -fi - -build_generator="Unix Makefiles" -os_fsfw="linux" -builddir="build-Release" - -echo "Running command (without the leading +):" -set -x # Print command -python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "size"\ - -t "host/none" -l "${builddir}" -# Use this if commands are added which should not be printed -# set +x diff --git a/cmake/scripts/Linux/ninja_debug_cfg.sh b/cmake/scripts/Linux/ninja_debug_cfg.sh deleted file mode 100755 index e8bd483..0000000 --- a/cmake/scripts/Linux/ninja_debug_cfg.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh -counter=0 -while [ ${counter} -lt 5 ] -do - cd .. - if [ -f "cmake_build_config.py" ];then - break - fi - counter=$((counter=counter + 1)) -done - -if [ "${counter}" -ge 5 ];then - echo "create_cmake_cfg.sh not found in upper directories!" - exit 1 -fi - -build_generator="Ninja" -os_fsfw="linux" -builddir="build-Debug" - -echo "Running command (without the leading +):" -set -x # Print command -python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "debug" \ - -t "host/none" -l "${builddir}" -# Use this if commands are added which should not be printed -# set +x diff --git a/cmake/scripts/Hosted/create_cmake_debug_cfg.sh b/cmake/scripts/make_debug_cfg.sh similarity index 66% rename from cmake/scripts/Hosted/create_cmake_debug_cfg.sh rename to cmake/scripts/make_debug_cfg.sh index 5acad0f..fbced84 100755 --- a/cmake/scripts/Hosted/create_cmake_debug_cfg.sh +++ b/cmake/scripts/make_debug_cfg.sh @@ -2,11 +2,11 @@ counter=0 while [ ${counter} -lt 5 ] do - cd .. if [ -f "cmake_build_config.py" ];then break fi counter=$((counter=counter + 1)) + cd .. done if [ "${counter}" -ge 5 ];then @@ -15,13 +15,18 @@ if [ "${counter}" -ge 5 ];then fi build_generator="" -os_fsfw="host" +os_fsfw="freertos" builddir="build-Debug" if [ "${OS}" = "Windows_NT" ]; then build_generator="MinGW Makefiles" + python="py" # Could be other OS but this works for now. else build_generator="Unix Makefiles" + python="python3" fi -python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "debug" -l "${builddir}" +echo "Running command (without the leading +):" +set -x # Print command +${python} cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "debug" -l "${builddir}" +# set +x \ No newline at end of file diff --git a/cmake/scripts/Hosted/create_cmake_relwithdeb_cfg.sh b/cmake/scripts/make_release_cfg.sh similarity index 74% rename from cmake/scripts/Hosted/create_cmake_relwithdeb_cfg.sh rename to cmake/scripts/make_release_cfg.sh index 5260f1e..7b213a4 100755 --- a/cmake/scripts/Hosted/create_cmake_relwithdeb_cfg.sh +++ b/cmake/scripts/make_release_cfg.sh @@ -2,11 +2,11 @@ counter=0 while [ ${counter} -lt 5 ] do - cd .. if [ -f "cmake_build_config.py" ];then break fi counter=$((counter=counter + 1)) + cd .. done if [ "${counter}" -ge 5 ];then @@ -15,17 +15,18 @@ if [ "${counter}" -ge 5 ];then fi build_generator="" -os_fsfw="host" +os_fsfw="freertos" builddir="build-Release" if [ "${OS}" = "Windows_NT" ]; then build_generator="MinGW Makefiles" + python="py" # Could be other OS but this works for now. else build_generator="Unix Makefiles" + python="python3" fi echo "Running command (without the leading +):" set -x # Print command -python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "reldeb" -l "${builddir}" -# Use this if commands are added which should not be printed -# set +x +${python} cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "release" -l "${builddir}" +# set +x \ No newline at end of file diff --git a/cmake/scripts/Hosted/create_cmake_release_cfg.sh b/cmake/scripts/make_size_cfg.sh similarity index 66% rename from cmake/scripts/Hosted/create_cmake_release_cfg.sh rename to cmake/scripts/make_size_cfg.sh index 1aaef15..146e00d 100755 --- a/cmake/scripts/Hosted/create_cmake_release_cfg.sh +++ b/cmake/scripts/make_size_cfg.sh @@ -2,11 +2,11 @@ counter=0 while [ ${counter} -lt 5 ] do - cd .. if [ -f "cmake_build_config.py" ];then break fi counter=$((counter=counter + 1)) + cd .. done if [ "${counter}" -ge 5 ];then @@ -15,13 +15,18 @@ if [ "${counter}" -ge 5 ];then fi build_generator="" -os_fsfw="host" +os_fsfw="freertos" builddir="build-Release" if [ "${OS}" = "Windows_NT" ]; then build_generator="MinGW Makefiles" + python="py" # Could be other OS but this works for now. else build_generator="Unix Makefiles" + python="python3" fi -python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "release" -l "${builddir}" +echo "Running command (without the leading +):" +set -x # Print command +${python} cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "size" -l "${builddir}" +# set +x \ No newline at end of file diff --git a/cmake/scripts/Hosted/vs2019/create_cmake_relwithdeb_cfg.sh b/cmake/scripts/ninja_debug_cfg.sh old mode 100644 new mode 100755 similarity index 60% rename from cmake/scripts/Hosted/vs2019/create_cmake_relwithdeb_cfg.sh rename to cmake/scripts/ninja_debug_cfg.sh index a0f7242..d4c2dc7 --- a/cmake/scripts/Hosted/vs2019/create_cmake_relwithdeb_cfg.sh +++ b/cmake/scripts/ninja_debug_cfg.sh @@ -2,11 +2,11 @@ counter=0 while [ ${counter} -lt 5 ] do - cd .. if [ -f "cmake_build_config.py" ];then break fi counter=$((counter=counter + 1)) + cd .. done if [ "${counter}" -ge 5 ];then @@ -15,18 +15,17 @@ if [ "${counter}" -ge 5 ];then fi build_generator="" -os_fsfw="host" -builddir="RelWithDeb-VS2019" - +os_fsfw="freertos" +builddir="build-Debug" +build_generator="Ninja" if [ "${OS}" = "Windows_NT" ]; then - build_generator="Visual Studio 16 2019" + python="py" # Could be other OS but this works for now. else - build_generator="Unix Makefiles" + python="python3" fi echo "Running command (without the leading +):" set -x # Print command -python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "reldeb" -l "${builddir}" -# Use this if commands are added which should not be printed +${python} cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "debug" -l "${builddir}" # set +x \ No newline at end of file