diff --git a/cmake/arch_build.cmake b/cmake/arch_build.cmake index db99d03e9..9ad7425c0 100644 --- a/cmake/arch_build.cmake +++ b/cmake/arch_build.cmake @@ -155,7 +155,10 @@ function(add_cfe_tables APP_NAME TBL_SRC_FILES) # current content of a dependency (rightfully so). add_custom_command( OUTPUT "${TABLE_DESTDIR}/${TBLWE}.tbl" - COMMAND ${CMAKE_C_COMPILER} ${TBL_CFLAGS} -c -o ${TBLWE}.o ${TBL_SRC} + COMMAND ${CMAKE_C_COMPILER} ${TBL_CFLAGS} + -DCFE_PLATFORM_CPU_ID=${${TGT}_PROCESSORID} + -DCFE_PLATFORM_CPU_NAME="${TGT}" + -c -o ${TBLWE}.o ${TBL_SRC} COMMAND ${MISSION_BINARY_DIR}/tools/elf2cfetbl/elf2cfetbl ${TBLWE}.o DEPENDS ${MISSION_BINARY_DIR}/tools/elf2cfetbl/elf2cfetbl ${TBL_SRC} WORKING_DIRECTORY ${TABLE_DESTDIR} @@ -326,14 +329,7 @@ function(process_arch SYSVAR) endif() # Generate a list of targets that share this system architecture - set(INSTALL_TARGET_LIST) - foreach(TGTID ${TGTSYS_${SYSVAR}}) - set(TGTNAME ${TGT${TGTID}_NAME}) - if(NOT TGTNAME) - set(TGTNAME "cpu${TGTID}") - endif(NOT TGTNAME) - list(APPEND INSTALL_TARGET_LIST ${TGTNAME}) - endforeach() + set(INSTALL_TARGET_LIST ${TGTSYS_${SYSVAR}}) # Assume use of an OSAL BSP of the same name as the CFE PSP # This can be overridden by the PSP-specific build_options but normally this is expected. @@ -454,20 +450,14 @@ function(process_arch SYSVAR) set(TGTLIST_${APP}) endforeach() - foreach(TGTID ${TGTSYS_${SYSVAR}}) + foreach(TGTNAME ${TGTSYS_${SYSVAR}}) - set(TGTNAME ${TGT${TGTID}_NAME}) - if(NOT TGTNAME) - set(TGTNAME "cpu${TGTID}") - set(TGT${TGTID}_NAME "${TGTNAME}") - endif(NOT TGTNAME) - # Append to the app install list for this CPU - foreach(APP ${TGT${TGTID}_APPLIST}) - set(TGTLIST_${APP} ${TGTLIST_${APP}} ${TGTNAME}) - endforeach(APP ${TGT${TGTID}_APPLIST}) + foreach(APP ${${TGTNAME}_APPLIST}) + list(APPEND TGTLIST_${APP} ${TGTNAME}) + endforeach(APP ${${TGTNAME}_APPLIST}) - endforeach(TGTID ${TGTSYS_${SYSVAR}}) + endforeach(TGTNAME ${TGTSYS_${SYSVAR}}) # Process each app that is used on this system architecture foreach(APP ${TGTSYS_${SYSVAR}_APPS}) @@ -478,14 +468,12 @@ function(process_arch SYSVAR) # Process each target that shares this system architecture # Second Pass: Build and link final target executable - foreach(TGTID ${TGTSYS_${SYSVAR}}) + foreach(TGTNAME ${TGTSYS_${SYSVAR}}) - set(TGTNAME ${TGT${TGTID}_NAME}) - # Target to generate the actual executable file add_subdirectory(cmake/target ${TGTNAME}) - foreach(INSTFILE ${TGT${TGTID}_FILELIST}) + foreach(INSTFILE ${${TGTNAME}_FILELIST}) if(EXISTS ${MISSION_DEFS}/${TGTNAME}_${INSTFILE}) set(FILESRC ${MISSION_DEFS}/${TGTNAME}_${INSTFILE}) elseif(EXISTS ${MISSION_DEFS}/${INSTFILE}) @@ -498,9 +486,8 @@ function(process_arch SYSVAR) else(FILESRC) message("WARNING: Install file ${INSTFILE} for ${TGTNAME} not found") endif (FILESRC) - endforeach(INSTFILE ${TGT${TGTID}_FILELIST}) - endforeach(TGTID ${TGTSYS_${SYSVAR}}) - + endforeach(INSTFILE ${${TGTNAME}_FILELIST}) + endforeach(TGTNAME ${TGTSYS_${SYSVAR}}) endfunction(process_arch SYSVAR) diff --git a/cmake/global_functions.cmake b/cmake/global_functions.cmake index 71813f397..975d32892 100644 --- a/cmake/global_functions.cmake +++ b/cmake/global_functions.cmake @@ -145,30 +145,61 @@ function(read_targetconfig) set(TGTSYS_LIST) set(MISSION_APPS) set(MISSION_PSPMODULES) + + # This while loop checks for a sequential set of variables prefixed with TGT_ + # where is a sequence number starting with 1. The first "gap" (undefined name) + # is treated as the end of list. + # This is the historical way of specifying CPU configs. New/future development should + # prefer the name-based specification. This translates the sequential TGT variable + # to a name-based variable. set(TGTID 0) while(1) math(EXPR TGTID "${TGTID} + 1") if (NOT DEFINED TGT${TGTID}_NAME) break() endif() - if (NOT DEFINED TGT${TGTID}_SYSTEM) - set(TGT${TGTID}_SYSTEM "cpu${TGTID}") - set(TGT${TGTID}_SYSTEM "${TGT${TGTID}_SYSTEM}" PARENT_SCOPE) - endif() - if (NOT DEFINED TGT${TGTID}_PLATFORM) - set(TGT${TGTID}_PLATFORM "default" "${TGT${TGTID}_NAME}") - set(TGT${TGTID}_PLATFORM "${TGT${TGTID}_PLATFORM}" PARENT_SCOPE) - endif() + set(CPUNAME ${TGT${TGTID}_NAME}) + # by default if PROCESSORID isn't specified, then use TGTID number. + if(NOT DEFINED TGT${TGTID}_PROCESSORID) + set(TGT${TGTID}_PROCESSORID ${TGTID}) + endif() - if (SIMULATION) + # Translate the TGT prefix to the CPU name prefix + # also propagate the value to parent scope + foreach(PROP PROCESSORID + APPLIST + STATIC_APPLIST + STATIC_SYMLIST + PSP_MODULELIST + FILELIST + EMBED_FILELIST + SYSTEM + PLATFORM) + set(${CPUNAME}_${PROP} ${TGT${TGTID}_${PROP}}) + set(${CPUNAME}_${PROP} ${${CPUNAME}_${PROP}} PARENT_SCOPE) + endforeach() + list(APPEND MISSION_CPUNAMES ${CPUNAME}) + endwhile() + + foreach(CPUNAME ${MISSION_CPUNAMES}) + if (DEFINED SIMULATION) # if simulation use simulation system architecture for all targets set(TOOLCHAIN_NAME "${SIMULATION}") - else (SIMULATION) + elseif (DEFINED ${CPUNAME}_SYSTEM) # get the target system arch identifier string - set(TOOLCHAIN_NAME "${TGT${TGTID}_SYSTEM}") - endif (SIMULATION) + set(TOOLCHAIN_NAME "${${CPUNAME}_SYSTEM}") + else() + # assume a toolchain name matching the CPU name + set(TOOLCHAIN_NAME "${CPUNAME}") + set(${CPUNAME}_SYSTEM ${TOOLCHAIN_NAME} PARENT_SCOPE) + endif () + + if (NOT DEFINED ${CPUNAME}_PLATFORM) + set(${CPUNAME}_PLATFORM "default" "${CPUNAME}") + set(${CPUNAME}_PLATFORM "${${CPUNAME}_PLATFORM}" PARENT_SCOPE) + endif() - set(BUILD_CONFIG ${TOOLCHAIN_NAME} ${TGT${TGTID}_PLATFORM}) + set(BUILD_CONFIG ${TOOLCHAIN_NAME} ${${CPUNAME}_PLATFORM}) # convert to a the string which is safe for a variable name string(REGEX REPLACE "[^A-Za-z0-9]" "_" SYSVAR "${BUILD_CONFIG}") @@ -178,25 +209,25 @@ function(read_targetconfig) # if the "global" applist is not empty, append to every CPU applist if (MISSION_GLOBAL_APPLIST) - list(APPEND TGT${TGTID}_APPLIST ${MISSION_GLOBAL_APPLIST}) - set(TGT${TGTID}_APPLIST ${TGT${TGTID}_APPLIST} PARENT_SCOPE) + list(APPEND ${CPUNAME}_APPLIST ${MISSION_GLOBAL_APPLIST}) + set(${CPUNAME}_APPLIST ${${CPUNAME}_APPLIST} PARENT_SCOPE) endif (MISSION_GLOBAL_APPLIST) if (MISSION_GLOBAL_STATIC_APPLIST) - list(APPEND TGT${TGTID}_STATIC_APPLIST ${MISSION_GLOBAL_STATIC_APPLIST}) - set(TGT${TGTID}_STATIC_APPLIST ${TGT${TGTID}_STATIC_APPLIST} PARENT_SCOPE) + list(APPEND ${CPUNAME}_STATIC_APPLIST ${MISSION_GLOBAL_STATIC_APPLIST}) + set(${CPUNAME}_STATIC_APPLIST ${${CPUNAME}_STATIC_APPLIST} PARENT_SCOPE) endif (MISSION_GLOBAL_STATIC_APPLIST) # Append to global lists list(APPEND TGTSYS_LIST "${SYSVAR}") - list(APPEND TGTSYS_${SYSVAR} "${TGTID}") - list(APPEND TGTSYS_${SYSVAR}_APPS ${TGT${TGTID}_APPLIST}) - list(APPEND TGTSYS_${SYSVAR}_STATICAPPS ${TGT${TGTID}_STATIC_APPLIST}) - list(APPEND TGTSYS_${SYSVAR}_PSPMODULES ${TGT${TGTID}_PSP_MODULELIST}) - list(APPEND MISSION_APPS ${TGT${TGTID}_APPLIST} ${TGT${TGTID}_STATIC_APPLIST}) - list(APPEND MISSION_PSPMODULES ${TGT${TGTID}_PSP_MODULELIST}) + list(APPEND TGTSYS_${SYSVAR} "${CPUNAME}") + list(APPEND TGTSYS_${SYSVAR}_APPS ${${CPUNAME}_APPLIST}) + list(APPEND TGTSYS_${SYSVAR}_STATICAPPS ${${CPUNAME}_STATIC_APPLIST}) + list(APPEND TGTSYS_${SYSVAR}_PSPMODULES ${${CPUNAME}_PSP_MODULELIST}) + list(APPEND MISSION_APPS ${${CPUNAME}_APPLIST} ${${CPUNAME}_STATIC_APPLIST}) + list(APPEND MISSION_PSPMODULES ${${CPUNAME}_PSP_MODULELIST}) - endwhile() + endforeach() # Remove duplicate entries in the generated lists list(REMOVE_DUPLICATES TGTSYS_LIST) @@ -211,6 +242,7 @@ function(read_targetconfig) set(TGTSYS_LIST ${TGTSYS_LIST} PARENT_SCOPE) set(MISSION_APPS ${MISSION_APPS} PARENT_SCOPE) set(MISSION_PSPMODULES ${MISSION_PSPMODULES} PARENT_SCOPE) + set(MISSION_CPUNAMES ${MISSION_CPUNAMES} PARENT_SCOPE) foreach(SYSVAR ${TGTSYS_LIST}) set(TGTSYS_${SYSVAR} ${TGTSYS_${SYSVAR}} PARENT_SCOPE) @@ -226,7 +258,7 @@ function(read_targetconfig) list(REMOVE_DUPLICATES TGTSYS_${SYSVAR}_PSPMODULES) set(TGTSYS_${SYSVAR}_PSPMODULES ${TGTSYS_${SYSVAR}_PSPMODULES} PARENT_SCOPE) endif(TGTSYS_${SYSVAR}_PSPMODULES) - endforeach(SYSVAR IN LISTS TGTSYS_LIST) + endforeach(SYSVAR ${TGTSYS_LIST}) endfunction(read_targetconfig) diff --git a/cmake/sample_defs/cpu1_platform_cfg.h b/cmake/sample_defs/cpu1_platform_cfg.h index 5299cd790..f0d0458ca 100644 --- a/cmake/sample_defs/cpu1_platform_cfg.h +++ b/cmake/sample_defs/cpu1_platform_cfg.h @@ -41,16 +41,6 @@ */ #include "cfe_mission_cfg.h" -/* -** CPU Id for target Processor -*/ -#define CFE_PLATFORM_CPU_ID 1 - -/* -** CPU Name for target Processor -*/ -#define CFE_PLATFORM_CPU_NAME "CPU1" - /** ** \cfesbcfg Maximum Number of Unique Message IDs SB Routing Table can hold ** @@ -1786,7 +1776,7 @@ ** \par Limits ** This value can be any 32 bit unsigned integer. */ -#define CFE_PLATFORM_TBL_VALID_PRID_1 (CFE_PLATFORM_CPU_ID) +#define CFE_PLATFORM_TBL_VALID_PRID_1 (10) #define CFE_PLATFORM_TBL_VALID_PRID_2 (CFE_PLATFORM_TBL_U32FROM4CHARS('a', 'b', 'c', 'd')) #define CFE_PLATFORM_TBL_VALID_PRID_3 0 #define CFE_PLATFORM_TBL_VALID_PRID_4 0 diff --git a/cmake/sample_defs/targets.cmake b/cmake/sample_defs/targets.cmake index d43dcac02..7b5baca0e 100644 --- a/cmake/sample_defs/targets.cmake +++ b/cmake/sample_defs/targets.cmake @@ -1,70 +1,70 @@ ###################################################################### -# +# # Master config file for cFS target boards # # This file indicates the architecture and configuration of the # target boards that will run core flight software. # -# The following variables are defined per board, where is the +# The following variables are defined per board, where is the # CPU number starting with 1: # -# TGT_NAME : the user-friendly name of the cpu. Should be simple +# _NAME : the user-friendly name of the cpu. Should be simple # word with no punctuation. This MUST be specified. -# TGT_APPLIST : list of applications to build and install on the CPU. +# _APPLIST : list of applications to build and install on the CPU. # These are built as dynamically-loaded applications and installed # as files in the non-volatile storage of the target, and loaded # at runtime via the startup script or commands. -# TGT_STATIC_APPLIST : list of applications to build and statically +# _STATIC_APPLIST : list of applications to build and statically # link with the CFE executable. This is similar to the "APPLIST" # except the application is built with STATIC linkage, and it is # included directly when linking the CFE core executable itself. -# No separate application file is generated for these apps. -# TGT_STATIC_SYMLIST : list of symbols to include in the OSAL static +# No separate application file is generated for these apps. +# _STATIC_SYMLIST : list of symbols to include in the OSAL static # symbol lookup table. Each entry is a comma-separated pair containing -# the symbol name and virtual module/app name, such as +# the symbol name and virtual module/app name, such as # My_C_Function_Name,MY_APP # The first item must be a publicly-exposed C symbol name available to # the linker at static link time, generally the entry point/main function # of the a module or library (see STATIC_APPLIST). The second item is the -# module name that should match the name used in the CFE startup script +# module name that should match the name used in the CFE startup script # (4th parameter). -# IMPORTANT: For this to work, the OS_STATIC_LOADER configuration option +# IMPORTANT: For this to work, the OS_STATIC_LOADER configuration option # must be specified in the osconfig.h for that CPU. -# TGT_PSP_MODULELIST : additional PSP "modules" to link into the +# _PSP_MODULELIST : additional PSP "modules" to link into the # CFE executable for this target. These can be device drivers or # other bits of modular PSP functionality that provide I/O or other # low level functions. -# TGT_FILELIST : list of extra files to copy onto the target. No +# _FILELIST : list of extra files to copy onto the target. No # modifications of the file will be made. In order to differentiate # between different versions of files with the same name, priority # will be given to a file named _ to be installed # as simply on that cpu (prefix will be removed). These # files are intended to be copied to the non-volatile storage on the # target for use during runtime. -# TGT_EMBED_FILELIST : list of extra files which are to be converted -# into data arrays and linked with/embedded into the CFE executable, +# _EMBED_FILELIST : list of extra files which are to be converted +# into data arrays and linked with/embedded into the CFE executable, # so the content of the files can be available at runtime on systems # that do not have run time non-volatile storage. The format of each # list entry is a comma-separated pair of variable and file name: # VARIABLE_NAME,FILE_NAME # The binary contents of the file will subsequently be available as: -# extern const char VARIABLE_NAME_DATA[] and +# extern const char VARIABLE_NAME_DATA[] and # extern const unsigned long VARIABLE_NAME_SIZE # The same prefix-based filename mapping as used on FILELIST is also -# employed here, allowing CPU-specific data files to be used. -# TGT_SYSTEM : the toolchain to use for building all code. This +# employed here, allowing CPU-specific data files to be used. +# _SYSTEM : the toolchain to use for building all code. This # will map to a CMake toolchain file called "toolchain-" # If not specified then it will default to "cpu" so that # each CPU will have a dedicated toolchain file and no objects -# will be shared across CPUs. -# Otherwise any code built using the same toolchain may be +# will be shared across CPUs. +# Otherwise any code built using the same toolchain may be # copied to multiple CPUs for more efficient builds. -# TGT_PLATFORM : configuration for the CFE core to use for this +# _PLATFORM : configuration for the CFE core to use for this # cpu. This determines the cfe_platform_cfg.h to use during the # build. Multiple files/components may be concatenated together -# allowing the config to be generated in a modular fashion. If +# allowing the config to be generated in a modular fashion. If # not specified then it will be assumed as "default ". -# +# # The MISSION_NAME will be compiled into the target build data structure # as well as being passed to "git describe" to filter the tags when building @@ -98,17 +98,15 @@ list(APPEND MISSION_GLOBAL_APPLIST sample_app sample_lib) SET(FT_INSTALL_SUBDIR "host/functional-test") # Each target board can have its own HW arch selection and set of included apps -SET(TGT1_NAME cpu1) -SET(TGT1_APPLIST ci_lab to_lab sch_lab) -SET(TGT1_FILELIST cfe_es_startup.scr) +SET(MISSION_CPUNAMES cpu1) + +SET(cpu1_PROCESSORID 10) +SET(cpu1_APPLIST ci_lab to_lab sch_lab) +SET(cpu1_FILELIST cfe_es_startup.scr) # CPU2/3 are duplicates of CPU1. These are not built by default anymore but are # commented out to serve as an example of how one would configure multiple cpus. -#SET(TGT2_NAME cpu2) -#SET(TGT2_APPLIST ci_lab to_lab sch_lab) -#SET(TGT2_FILELIST cfe_es_startup.scr) - -#SET(TGT3_NAME cpu3) -#SET(TGT3_APPLIST ci_lab to_lab sch_lab) -#SET(TGT3_FILELIST cfe_es_startup.scr) +SET(cpu2_PROCESSORID 11) +SET(cpu2_APPLIST ci_lab to_lab sch_lab) +SET(cpu2_FILELIST cfe_es_startup.scr) diff --git a/cmake/target/CMakeLists.txt b/cmake/target/CMakeLists.txt index 35935cb4a..46a27a253 100644 --- a/cmake/target/CMakeLists.txt +++ b/cmake/target/CMakeLists.txt @@ -12,13 +12,22 @@ project(CFETARGET C) +# Sanity check on inputs - these should be set in the parent script(s) +if (NOT DEFINED TGTNAME) + message(FATAL_ERROR "TGTNAME must be defined to link a final exe") +endif (NOT DEFINED TGTNAME) + +if (NOT DEFINED ${TGTNAME}_PROCESSORID) + message(FATAL_ERROR "${TGTNAME}_PROCESSORID must be defined to link a final exe") +endif (NOT DEFINED ${TGTNAME}_PROCESSORID) + # Create a file for the statically-linked module list for this target # do this for both PSP and CFS static modules file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/psp_module_list.inc.tmp" "/* Automatically generated based on target config */\n") -foreach(PSPMOD ${TGT${TGTID}_PSP_MODULELIST}) +foreach(PSPMOD ${${TGTNAME}_PSP_MODULELIST}) file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/psp_module_list.inc.tmp" "LOAD_PSP_MODULE(${PSPMOD})\n") -endforeach(PSPMOD ${TGT${TGTID}_PSP_MODULELIST}) +endforeach(PSPMOD ${${TGTNAME}_PSP_MODULELIST}) execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_BINARY_DIR}/psp_module_list.inc.tmp" "${CMAKE_CURRENT_BINARY_DIR}/psp_module_list.inc") @@ -26,32 +35,28 @@ file (REMOVE "${CMAKE_CURRENT_BINARY_DIR}/psp_module_list.inc.tmp") file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/cfs_static_symbol_list.inc.tmp" "/* Automatically generated based on target config */\n") -foreach(CFSSYM ${TGT${TGTID}_STATIC_SYMLIST}) +foreach(CFSSYM ${${TGTNAME}_STATIC_SYMLIST}) file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/cfs_static_symbol_list.inc.tmp" "STATIC_CFS_SYMBOL(${CFSSYM})\n") -endforeach(CFSSYM ${TGT${TGTID}_STATIC_SYMLIST}) +endforeach(CFSSYM ${${TGTNAME}_STATIC_SYMLIST}) execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_BINARY_DIR}/cfs_static_symbol_list.inc.tmp" "${CMAKE_CURRENT_BINARY_DIR}/cfs_static_symbol_list.inc") file (REMOVE "${CMAKE_CURRENT_BINARY_DIR}/cfs_static_symbol_list.inc.tmp") - -# Include the current binary dir for the driver list -include_directories(${CMAKE_CURRENT_BINARY_DIR}) - -# The CPU ID and name are defined by the build scripts for this target -if (DEFINED TGTID) - add_definitions(-DCFE_CPU_ID_VALUE=${TGTID}) -endif() -if (DEFINED SPACECRAFT_ID) - add_definitions(-DCFE_SPACECRAFT_ID_VALUE=${SPACECRAFT_ID}) -endif() -if (DEFINED TGTNAME) - add_definitions(-DCFE_CPU_NAME_VALUE="${TGTNAME}") -endif() - # Target for the final executable add_executable(core-${TGTNAME} src/target_config.c) +target_compile_definitions(core-${TGTNAME} PRIVATE + CFE_CPU_NAME_VALUE="${TGTNAME}" + CFE_SPACECRAFT_ID_VALUE=${SPACECRAFT_ID} + CFE_CPU_ID_VALUE=${${TGTNAME}_PROCESSORID} +) + +target_include_directories(core-${TGTNAME} PRIVATE + "${CMAKE_CURRENT_BINARY_DIR}" + "${CMAKE_BINARY_DIR}/${CFE_CORE_TARGET}/inc" +) + # This next section provides a method for adding the "-u" switch to the # linker in order to make sure the linker includes certain symbols in the link. # This problem may exist for the entry point or other symbols if the @@ -68,7 +73,7 @@ set_target_properties(core-${TGTNAME} PROPERTIES LINK_FLAGS "${TARGET_LINK_FLAGS # (enabled by the ENABLE_EXPORTS property) does not apply to static libs on the link line # This is only a concern when relying on the dynamic module loader, if we are statically # linking the entire CFE system into a single binary then no special help is needed. -if (TGT${TGTID}_APPLIST) +if (${TGTNAME}_APPLIST) set_target_properties(core-${TGTNAME} PROPERTIES ENABLE_EXPORTS TRUE) @@ -96,7 +101,7 @@ if (TGT${TGTID}_APPLIST) set(STOP_WHOLE_ARCHIVE "${COMPILER_LINKER_OPTION_PREFIX}${STOP_WHOLE_ARCHIVE}") endif() -endif (TGT${TGTID}_APPLIST) +endif (${TGTNAME}_APPLIST) # Collect any additional libraries that should be included on the link line # This depends on whether any special features are included or not @@ -104,15 +109,15 @@ set(CFE_LINK_WHOLE_LIBS ${MISSION_CORE_MODULES} ) set(CFE_LINK_NORMAL_LIBS - ${TGT${TGTID}_PSP_MODULELIST} - ${TGT${TGTID}_STATIC_APPLIST} + ${${TGTNAME}_PSP_MODULELIST} + ${${TGTNAME}_STATIC_APPLIST} ) # Handle the list of "embedded files" that should be linked into CFE. # These are arbitrary files in the mission config that are converted # into C data structures and linked with the executable. This is # a helpful feature for use when statically linking the CFE. -if (DEFINED TGT${TGTID}_EMBED_FILELIST) +if (DEFINED ${TGTNAME}_EMBED_FILELIST) set(EMBFILE_GENSRC_LIST) # a list of C source files to compile set(EMBFILE_CONTENT_LIST) # a list of content targets for dependencies @@ -123,7 +128,7 @@ if (DEFINED TGT${TGTID}_EMBED_FILELIST) # Where "VARIABLE_NAME" indicates the name to use for the # generated C data structure, and FILE_NAME is the data file # that it is sourced from (no paths, it will be searched). - foreach(LISTENT ${TGT${TGTID}_EMBED_FILELIST}) + foreach(LISTENT ${${TGTNAME}_EMBED_FILELIST}) string(REPLACE "," ";" LISTENT ${LISTENT}) # split on the comma list(GET LISTENT 0 EMBNAME) # EMBNAME => C variable name list(GET LISTENT 1 EMBFILE) # EMBFILE => File name @@ -159,7 +164,7 @@ if (DEFINED TGT${TGTID}_EMBED_FILELIST) list(APPEND EMBFILE_GENSRC_LIST "${CMAKE_CURRENT_BINARY_DIR}/embed/${EMBNAME}.c") list(APPEND EMBFILE_CONTENT_LIST "${CMAKE_CURRENT_BINARY_DIR}/embed/${EMBNAME}.inc") - endforeach(LISTENT ${TGT${TGTID}_EMBED_FILELIST}) + endforeach(LISTENT ${${TGTNAME}_EMBED_FILELIST}) # Finally, generate a static library that contains all embeded binary files # and add this to the list of libraries that the CFE will be linked with. @@ -170,7 +175,7 @@ if (DEFINED TGT${TGTID}_EMBED_FILELIST) add_dependencies(${TGTNAME}_embed_files ${TGTNAME}_embed_content) list(APPEND CFE_LINK_NORMAL_LIBS ${TGTNAME}_embed_files) -endif (DEFINED TGT${TGTID}_EMBED_FILELIST) +endif (DEFINED ${TGTNAME}_EMBED_FILELIST) target_link_libraries(core-${TGTNAME} # The following libs should be included whole, even if they diff --git a/fsw/cfe-core/unit-test/CMakeLists.txt b/fsw/cfe-core/unit-test/CMakeLists.txt index 3c90521c4..f8d5ebcf6 100644 --- a/fsw/cfe-core/unit-test/CMakeLists.txt +++ b/fsw/cfe-core/unit-test/CMakeLists.txt @@ -69,7 +69,9 @@ foreach(MODULE ${CFE_CORE_MODULES}) ut_assert) add_test(${UT_TARGET_NAME}_UT ${UT_TARGET_NAME}_UT) - install(TARGETS ${UT_TARGET_NAME}_UT DESTINATION ${TGTNAME}/${UT_INSTALL_SUBDIR}) + foreach(TGTNAME ${TGTSYS_${SYSVAR}}) + install(TARGETS ${UT_TARGET_NAME}_UT DESTINATION ${TGTNAME}/${UT_INSTALL_SUBDIR}) + endforeach(TGTNAME ${TGTSYS_${SYSVAR}}) endforeach(MODULE ${CFE_CORE_MODULES}) # Generate the FS test input files