From 043b6081ccd69bbd8cafa0115488158ff157b18c Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Wed, 7 Oct 2020 17:40:10 -0400 Subject: [PATCH 1/2] Fix #940, Add module suffix and core name to configdata Add the system-specific module suffix (.o, .so, .obj, etc) and the default CFE core executable name to the configdata structure. This information has several useful purposes. --- cmake/target/CMakeLists.txt | 2 ++ cmake/target/inc/target_config.h | 3 +++ cmake/target/src/target_config.c | 2 ++ 3 files changed, 7 insertions(+) diff --git a/cmake/target/CMakeLists.txt b/cmake/target/CMakeLists.txt index 46a27a253..6ef722b6a 100644 --- a/cmake/target/CMakeLists.txt +++ b/cmake/target/CMakeLists.txt @@ -47,6 +47,8 @@ file (REMOVE "${CMAKE_CURRENT_BINARY_DIR}/cfs_static_symbol_list.inc.tmp") add_executable(core-${TGTNAME} src/target_config.c) target_compile_definitions(core-${TGTNAME} PRIVATE + CFE_DEFAULT_MODULE_EXTENSION="${CMAKE_SHARED_MODULE_SUFFIX}" + CFE_DEFAULT_CORE_FILENAME="$" CFE_CPU_NAME_VALUE="${TGTNAME}" CFE_SPACECRAFT_ID_VALUE=${SPACECRAFT_ID} CFE_CPU_ID_VALUE=${${TGTNAME}_PROCESSORID} diff --git a/cmake/target/inc/target_config.h b/cmake/target/inc/target_config.h index 71c6082cc..c4af5307f 100644 --- a/cmake/target/inc/target_config.h +++ b/cmake/target/inc/target_config.h @@ -143,6 +143,9 @@ typedef const struct uint16 Default_CpuId; /**< Compile-time value for CPU number */ uint16 Default_SpacecraftId; /**< Compile-time value for Spacecraft ID (mission-wide) */ + const char *Default_ModuleExtension; /**< Default system extension for dynamic modules */ + const char *Default_CoreFilename; /**< Default file name for CFE core executable/library */ + Target_CfeConfigData *CfeConfig; /**< CFE configuration sub-structure */ Target_PspConfigData *PspConfig; /**< PSP configuration sub-structure */ CFE_StaticModuleLoadEntry_t *PspModuleList; /**< List of PSP modules (API structures) statically linked into the core EXE */ diff --git a/cmake/target/src/target_config.c b/cmake/target/src/target_config.c index f15233450..9ba74d59f 100644 --- a/cmake/target/src/target_config.c +++ b/cmake/target/src/target_config.c @@ -139,6 +139,8 @@ Target_ConfigData GLOBAL_CONFIGDATA = .Default_CpuName = CFE_CPU_NAME_VALUE, .Default_CpuId = CFE_CPU_ID_VALUE, .Default_SpacecraftId = CFE_SPACECRAFT_ID_VALUE, + .Default_ModuleExtension = CFE_DEFAULT_MODULE_EXTENSION, + .Default_CoreFilename = CFE_DEFAULT_CORE_FILENAME, .CfeConfig = &GLOBAL_CFE_CONFIGDATA, .PspConfig = &GLOBAL_PSP_CONFIGDATA, .PspModuleList = GLOBAL_PSP_MODULELIST, From 655a66c05f250c97db5c1ca022dd4a14e967f40a Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Thu, 8 Oct 2020 09:05:59 -0400 Subject: [PATCH 2/2] Update #940, add ifndef values for new fields Adds an #ifndef empty string for the two new fields, which at the very least prevents IDEs (e.g. Eclipse) from redlining the value as an undefined symbol. (It is always passed in on command line when building via CMake) --- cmake/target/src/target_config.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmake/target/src/target_config.c b/cmake/target/src/target_config.c index 9ba74d59f..bbf33104b 100644 --- a/cmake/target/src/target_config.c +++ b/cmake/target/src/target_config.c @@ -54,6 +54,13 @@ #define CFE_SPACECRAFT_ID_VALUE 0x42 #endif +#ifndef CFE_DEFAULT_MODULE_EXTENSION +#define CFE_DEFAULT_MODULE_EXTENSION "" +#endif + +#ifndef CFE_DEFAULT_CORE_FILENAME +#define CFE_DEFAULT_CORE_FILENAME "" +#endif Target_CfeConfigData GLOBAL_CFE_CONFIGDATA = {