From 3f177d3321cadf80bf933bc1b8567cb9364fc9c5 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 30 Jun 2021 15:18:41 +0200 Subject: [PATCH] simple mode implemented --- CMakeLists.txt | 4 +++ bsp_q7s/CMakeLists.txt | 2 -- bsp_q7s/boardconfig/q7sConfig.h.in | 1 + bsp_q7s/core/CMakeLists.txt | 3 ++ bsp_q7s/{ => core}/InitMission.cpp | 0 bsp_q7s/{ => core}/InitMission.h | 0 bsp_q7s/{ => core}/ObjectFactory.cpp | 0 bsp_q7s/{ => core}/ObjectFactory.h | 0 bsp_q7s/core/obsw.cpp | 25 ++++++++++++++ bsp_q7s/core/obsw.h | 10 ++++++ bsp_q7s/main.cpp | 32 +++++------------ bsp_q7s/simple/simple.cpp | 5 +++ bsp_q7s/simple/simple.h | 10 ++++++ cmake/scripts/Q7S/make_debug_cfg.sh | 8 ++++- cmake/scripts/Q7S/make_release_cfg.sh | 11 ++++-- cmake/scripts/Q7S/ninja_debug_cfg.sh | 23 ------------- ...reldeb_cfg.sh => simple_make_debug_cfg.sh} | 12 +++++-- cmake/scripts/Q7S/simple_ninja_debug_cfg.sh | 34 +++++++++++++++++++ 18 files changed, 125 insertions(+), 55 deletions(-) rename bsp_q7s/{ => core}/InitMission.cpp (100%) rename bsp_q7s/{ => core}/InitMission.h (100%) rename bsp_q7s/{ => core}/ObjectFactory.cpp (100%) rename bsp_q7s/{ => core}/ObjectFactory.h (100%) create mode 100644 bsp_q7s/core/obsw.cpp create mode 100644 bsp_q7s/core/obsw.h create mode 100644 bsp_q7s/simple/simple.cpp create mode 100644 bsp_q7s/simple/simple.h delete mode 100755 cmake/scripts/Q7S/ninja_debug_cfg.sh rename cmake/scripts/Q7S/{make_reldeb_cfg.sh => simple_make_debug_cfg.sh} (59%) create mode 100755 cmake/scripts/Q7S/simple_ninja_debug_cfg.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index 33c6edfc..10149bb6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,6 +15,10 @@ cmake_minimum_required(VERSION 3.13) set(CMAKE_SCRIPT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") +if(TGT_BSP MATCHES "arm/q7s") + option(Q7S_SIMPLE_MODE OFF "Simple mode with a minimal main function") +endif() + option(ADD_ETL_LIB "Add ETL library" ON) if(NOT OS_FSFW) set(OS_FSFW host CACHE STRING "OS for the FSFW.") diff --git a/bsp_q7s/CMakeLists.txt b/bsp_q7s/CMakeLists.txt index ce790656..ca260250 100644 --- a/bsp_q7s/CMakeLists.txt +++ b/bsp_q7s/CMakeLists.txt @@ -1,7 +1,5 @@ target_sources(${TARGET_NAME} PUBLIC - InitMission.cpp main.cpp - ObjectFactory.cpp ) add_subdirectory(boardconfig) diff --git a/bsp_q7s/boardconfig/q7sConfig.h.in b/bsp_q7s/boardconfig/q7sConfig.h.in index 81b96a7e..6ee84821 100644 --- a/bsp_q7s/boardconfig/q7sConfig.h.in +++ b/bsp_q7s/boardconfig/q7sConfig.h.in @@ -1,6 +1,7 @@ #ifndef BSP_Q7S_BOARDCONFIG_Q7S_CONFIG_H_ #define BSP_Q7S_BOARDCONFIG_Q7S_CONFIG_H_ +#cmakedefine01 Q7S_SIMPLE_MODE #define Q7S_ADD_RTD_DEVICES 0 /* Only one of those 2 should be enabled! */ diff --git a/bsp_q7s/core/CMakeLists.txt b/bsp_q7s/core/CMakeLists.txt index 4b2364c1..fc397f2f 100644 --- a/bsp_q7s/core/CMakeLists.txt +++ b/bsp_q7s/core/CMakeLists.txt @@ -1,3 +1,6 @@ target_sources(${TARGET_NAME} PRIVATE CoreController.cpp + obsw.cpp + InitMission.cpp + ObjectFactory.cpp ) diff --git a/bsp_q7s/InitMission.cpp b/bsp_q7s/core/InitMission.cpp similarity index 100% rename from bsp_q7s/InitMission.cpp rename to bsp_q7s/core/InitMission.cpp diff --git a/bsp_q7s/InitMission.h b/bsp_q7s/core/InitMission.h similarity index 100% rename from bsp_q7s/InitMission.h rename to bsp_q7s/core/InitMission.h diff --git a/bsp_q7s/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp similarity index 100% rename from bsp_q7s/ObjectFactory.cpp rename to bsp_q7s/core/ObjectFactory.cpp diff --git a/bsp_q7s/ObjectFactory.h b/bsp_q7s/core/ObjectFactory.h similarity index 100% rename from bsp_q7s/ObjectFactory.h rename to bsp_q7s/core/ObjectFactory.h diff --git a/bsp_q7s/core/obsw.cpp b/bsp_q7s/core/obsw.cpp new file mode 100644 index 00000000..f813bcae --- /dev/null +++ b/bsp_q7s/core/obsw.cpp @@ -0,0 +1,25 @@ +#include "obsw.h" +#include "OBSWVersion.h" +#include "InitMission.h" +#include "fsfw/tasks/TaskFactory.h" +#include + +int obsw::obsw() { + std::cout << "-- EIVE OBSW --" << std::endl; +#if TE0720 == 0 + std::cout << "-- Compiled for Linux (Xiphos Q7S) --" << std::endl; +#else + std::cout << "-- Compiled for Linux (TE0720) --" << std::endl; +#endif + std::cout << "-- Software version " << SW_NAME << " v" << SW_VERSION << "." + << SW_SUBVERSION << "." << SW_SUBSUBVERSION << " -- " << std::endl; + std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl; + + initmission::initMission(); + + for(;;) { + /* Suspend main thread by sleeping it. */ + TaskFactory::delayTask(5000); + } + return 0; +} diff --git a/bsp_q7s/core/obsw.h b/bsp_q7s/core/obsw.h new file mode 100644 index 00000000..c2d974ae --- /dev/null +++ b/bsp_q7s/core/obsw.h @@ -0,0 +1,10 @@ +#ifndef BSP_Q7S_CORE_OBSW_H_ +#define BSP_Q7S_CORE_OBSW_H_ + +namespace obsw { + +int obsw(); + +}; + +#endif /* BSP_Q7S_CORE_OBSW_H_ */ diff --git a/bsp_q7s/main.cpp b/bsp_q7s/main.cpp index 06f454c2..93968b76 100644 --- a/bsp_q7s/main.cpp +++ b/bsp_q7s/main.cpp @@ -1,11 +1,10 @@ -#include "InitMission.h" -#include -#include -#include "OBSWConfig.h" +#include "q7sConfig.h" -#include - -#include +#if Q7S_SIMPLE_MODE == 0 +#include "core/obsw.h" +#else +#include "simple/simple.h" +#endif /** * @brief This is the main program for the target hardware. @@ -13,22 +12,9 @@ */ int main(void) { - std::cout << "-- EIVE OBSW --" << std::endl; -#if TE0720 == 0 - std::cout << "-- Compiled for Linux (Xiphos Q7S) --" << std::endl; +#if Q7S_SIMPLE_MODE == 0 + return obsw::obsw(); #else - std::cout << "-- Compiled for Linux (TE0720) --" << std::endl; + return simple::simple(); #endif - std::cout << "-- Software version " << SW_NAME << " v" << SW_VERSION << "." - << SW_SUBVERSION << "." << SW_SUBSUBVERSION << " -- " << std::endl; - std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl; - - initmission::initMission(); - - for(;;) { - /* Suspend main thread by sleeping it. */ - TaskFactory::delayTask(5000); - } } - - diff --git a/bsp_q7s/simple/simple.cpp b/bsp_q7s/simple/simple.cpp new file mode 100644 index 00000000..6261bfe3 --- /dev/null +++ b/bsp_q7s/simple/simple.cpp @@ -0,0 +1,5 @@ +#include "simple.h" + +int simple::simple() { + return 0; +} diff --git a/bsp_q7s/simple/simple.h b/bsp_q7s/simple/simple.h new file mode 100644 index 00000000..096a7b7c --- /dev/null +++ b/bsp_q7s/simple/simple.h @@ -0,0 +1,10 @@ +#ifndef BSP_Q7S_SIMPLE_SIMPLE_H_ +#define BSP_Q7S_SIMPLE_SIMPLE_H_ + +namespace simple { + +int simple(); + +} + +#endif /* BSP_Q7S_SIMPLE_SIMPLE_H_ */ diff --git a/cmake/scripts/Q7S/make_debug_cfg.sh b/cmake/scripts/Q7S/make_debug_cfg.sh index 4875c59a..4613d36a 100755 --- a/cmake/scripts/Q7S/make_debug_cfg.sh +++ b/cmake/scripts/Q7S/make_debug_cfg.sh @@ -20,10 +20,16 @@ build_dir="build-Debug-Q7S" build_generator="" 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" -t "${tgt_bsp}" \ +echo "Running command (without the leading +):" +set -x # Print command +${python} cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "debug" -t "${tgt_bsp}" \ -l"${build_dir}" +# set +x + diff --git a/cmake/scripts/Q7S/make_release_cfg.sh b/cmake/scripts/Q7S/make_release_cfg.sh index 0e2c543c..9d7992f3 100755 --- a/cmake/scripts/Q7S/make_release_cfg.sh +++ b/cmake/scripts/Q7S/make_release_cfg.sh @@ -16,14 +16,19 @@ fi os_fsfw="linux" tgt_bsp="arm/q7s" -build_dir="build-Release-Q7S" +build_dir="build-Debug-Q7S" build_generator="" 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" -t "${tgt_bsp}" \ - -l"${build_dir}" +echo "Running command (without the leading +):" +set -x # Print command +${python} cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "debug" -t "${tgt_bsp}" \ + -l"${build_dir}" +# set +x diff --git a/cmake/scripts/Q7S/ninja_debug_cfg.sh b/cmake/scripts/Q7S/ninja_debug_cfg.sh deleted file mode 100755 index 3a8ac631..00000000 --- a/cmake/scripts/Q7S/ninja_debug_cfg.sh +++ /dev/null @@ -1,23 +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 "cmake_build_config.py not found in upper directories!" - exit 1 -fi - -os_fsfw="linux" -tgt_bsp="arm/q7s" -build_dir="build-Debug-Q7S" -build_generator="Ninja" - -python3 cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "debug" -t "${tgt_bsp}" \ - -l"${build_dir}" diff --git a/cmake/scripts/Q7S/make_reldeb_cfg.sh b/cmake/scripts/Q7S/simple_make_debug_cfg.sh similarity index 59% rename from cmake/scripts/Q7S/make_reldeb_cfg.sh rename to cmake/scripts/Q7S/simple_make_debug_cfg.sh index 121f2d7e..2ca0ab79 100755 --- a/cmake/scripts/Q7S/make_reldeb_cfg.sh +++ b/cmake/scripts/Q7S/simple_make_debug_cfg.sh @@ -16,14 +16,20 @@ fi os_fsfw="linux" tgt_bsp="arm/q7s" -build_dir="build-Release-Q7S" +build_dir="build-Debug-Q7S" build_generator="" +definitions="Q7S_SIMPLE_MODE=On" 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 "reldeb" -t "${tgt_bsp}" \ - -l"${build_dir}" +echo "Running command (without the leading +):" +set -x # Print command +${python} cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "debug" -t "${tgt_bsp}" \ + -l"${build_dir}" -d "${definitions} +# set +x diff --git a/cmake/scripts/Q7S/simple_ninja_debug_cfg.sh b/cmake/scripts/Q7S/simple_ninja_debug_cfg.sh new file mode 100755 index 00000000..0ec8a155 --- /dev/null +++ b/cmake/scripts/Q7S/simple_ninja_debug_cfg.sh @@ -0,0 +1,34 @@ +#!/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 "cmake_build_config.py not found in upper directories!" + exit 1 +fi + +os_fsfw="linux" +tgt_bsp="arm/q7s" +build_dir="build-Debug-Q7S" +build_generator="Ninja" +definitions="Q7S_SIMPLE_MODE=On" +if [ "${OS}" = "Windows_NT" ]; then + python="py" +# Could be other OS but this works for now. +else + python="python3" +fi + +echo "Running command (without the leading +):" +set -x # Print command +${python} cmake_build_config.py -o "${os_fsfw}" -g "${build_generator}" -b "debug" -t "${tgt_bsp}" \ + -l"${build_dir}" -d "${definitions} +# set +x +