From 2530ee380477e21dd9bc193c2993f2f3db8fc296 Mon Sep 17 00:00:00 2001 From: key Date: Mon, 18 Oct 2021 15:15:28 +0200 Subject: [PATCH] I was able to automatically use the corrspondig headers by #ifdef in main.hpp and -D C_DEF in /bsl/XXX/bslConfig.cmake > not totally convinced < --- CMakeLists.txt | 1 + bsl/nucleo_f042k6/bslConfig.cmake | 1 + bsl/raspberry/bslConfig.cmake | 4 +++- main.cpp | 3 --- main.hpp | 8 ++++++++ 5 files changed, 13 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a0ecd86..bcaaca9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,7 @@ set(INTERFACES_DIR ${CMAKE_SOURCE_DIR}/bsl/csl/interfaces) include(${PROJECT_DEFS}) add_subdirectory(bsl) +set(BSL_HEADER_FILE ${CMAKE_SOURCE_DIR}/bsl/raspberry/bsl_raspberry.hpp) message("${BoldBlue}Project Info ${ColourReset}") message("${Blue} |--> Exec Name \t: ${EXECUTABLE} ${ColourReset}") diff --git a/bsl/nucleo_f042k6/bslConfig.cmake b/bsl/nucleo_f042k6/bslConfig.cmake index 0fc5771..f7dfb43 100644 --- a/bsl/nucleo_f042k6/bslConfig.cmake +++ b/bsl/nucleo_f042k6/bslConfig.cmake @@ -40,6 +40,7 @@ set(C_FLAGS $<$:-O -g -gdwarf-2>) set(C_DEFS + -DARM_MCU #Defined by kerem to auto configure headers in main.hpp -DUSE_FULL_LL_DRIVER -DSTM32F042x6 -DHSE_VALUE=8000000 diff --git a/bsl/raspberry/bslConfig.cmake b/bsl/raspberry/bslConfig.cmake index 010ec3a..e062ff7 100644 --- a/bsl/raspberry/bslConfig.cmake +++ b/bsl/raspberry/bslConfig.cmake @@ -17,7 +17,9 @@ set(C_FLAGS -fdiagnostics-color=always $<$:-O -g -gdwarf-2>) -set(C_DEFS -DSET_ALARM) +set(C_DEFS + -DRASPBERRY #Defined by kerem to auto configure headers in main.hpp + ) set (CPP_INCLUDES ${CMAKE_SOURCE_DIR}) set (CPP_FLAGS ${C_FLAGS}) diff --git a/main.cpp b/main.cpp index fa01c41..103300d 100644 --- a/main.cpp +++ b/main.cpp @@ -1,8 +1,5 @@ #include"main.hpp" -#include "bsl/raspberry/bsl_raspberry.hpp" -//#include "bsl/nucleo_f042k6/bsl_nucleo_f042k6.hpp" - int main(int argc, char *argv[]) { startBSL(); diff --git a/main.hpp b/main.hpp index 3917c0f..a6a4577 100644 --- a/main.hpp +++ b/main.hpp @@ -1,4 +1,12 @@ #ifndef MAIN_H #define MAIN_H +#ifdef RASPBERRY + #include "bsl/raspberry/bsl_raspberry.hpp" +#endif + +#ifdef ARM_MCU + #include "bsl/nucleo_f042k6/bsl_nucleo_f042k6.hpp" +#endif + #endif /* MAIN_H */