Skip to content

Commit

Permalink
Merge pull request #765 from nasa/integration-candidate
Browse files Browse the repository at this point in the history
Integration Candidate: 2020-06-24
  • Loading branch information
astrogeco authored Jul 26, 2020
2 parents a47abba + 343f60d commit deeb294
Show file tree
Hide file tree
Showing 33 changed files with 1,536 additions and 437 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ initialize_globals()

# Load the target configuration information (used by all builds)
# This is at the top level so all vars set in here will become globals.
# The "defaults" file is included first, which the user-supplied targets
# file may override as necessary.
include("cmake/mission_defaults.cmake")
include(${MISSION_DEFS}/targets.cmake)

# Scan the list of targets and organize by target system type.
Expand Down
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,21 @@ The detailed cFE user's guide can be viewed at <https://github.com/nasa/cFS/blob

## Version History

### Development Build: 6.7.0+dev289

- Update `CFE_SB_TimeStampMsg` to save the message pointer argument `UT_Stub_CopyFromLocal` so that unit tests can check it
- Only affects build system. Fully backward compatible. The defaults are applied if a user has nothing specifically configured in their `targets.cmake`. The defaults will select osal, cfe-core, and psp as before. The user now has the option to explicitly configure and control the inclusion of these modules and also provide mission-specific search paths to override them as desired.
- Note this only affects UT stubs. Change the internal names of some stub arguments to match prototype. Ensure that:
- All functions in the CFE public API have a stub function implemented
- All parameters to the stub function are registered in the context object, so the values will be available to hook functions.
- The names of all parameters match the prototype/documentation, so hook functions that use name-based argument value retrieval will work.
- Adds to table search path in `arch_build.cmake`
- Calls to OS_open() now use the OSAL-defined symbol, not the POSIX symbol.
- Defines new macros to report the build number and build baseline and new strings containing the version number of cFE and a combined string with the version number for OSAL, PSP, and CFE.
- Allow explicitly setting of the processor ID in `targets.cmake`. The `TGTx_PROCESSOR_ID` setting will be passed to the final build/link of CFE core as the CPU ID. If unspecified, then the CMake index value is used instead (backward compatible).
- `cmake` now detects conditions where no files were present to fulfill an config include file requirement and reports an error during `make prep` lists the files it checked for rather than generating an empty file.
- See <https://github.com/nasa/cFE/pull/765>

### Development Build: 6.7.21

- If a string is exactly the size of the field when using the `CFE_TBL_FILEDEF()` macro it will produce a compiler error
Expand Down
2 changes: 1 addition & 1 deletion cmake/Makefile.sample
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
# Establish default values for critical variables. Any of these may be overridden
# on the command line or via the make environment configuration in an IDE
O ?= build
ARCH ?= native
ARCH ?= native/default_cpu1
BUILDTYPE ?= debug
INSTALLPREFIX ?= /exe
DESTDIR ?= $(O)
Expand Down
129 changes: 60 additions & 69 deletions cmake/arch_build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ function(add_cfe_tables APP_NAME TBL_SRC_FILES)
set(TBL_SRC "${MISSION_DEFS}/tables/${TBLWE}.c")
elseif (EXISTS "${MISSION_SOURCE_DIR}/tables/${TBLWE}.c")
set(TBL_SRC "${MISSION_SOURCE_DIR}/tables/${TBLWE}.c")
elseif (EXISTS "${MISSION_DEFS}/${TGT}/tables/${TBLWE}.c")
set(TBL_SRC "${MISSION_DEFS}/${TGT}/tables/${TBLWE}.c")
elseif (IS_ABSOLUTE "${TBL}")
set(TBL_SRC "${TBL}")
else()
Expand Down Expand Up @@ -261,15 +263,12 @@ function(prepare)

# Choose the configuration file to use for OSAL on this system
set(OSAL_CONFIGURATION_FILE)
if (EXISTS "${MISSION_DEFS}/default_osconfig.cmake")
list(APPEND OSAL_CONFIGURATION_FILE "${MISSION_DEFS}/default_osconfig.cmake")
endif()
if (DEFINED OSAL_SYSTEM_OSCONFIG AND EXISTS "${MISSION_DEFS}/${OSAL_SYSTEM_OSCONFIG}_osconfig.cmake")
list(APPEND OSAL_CONFIGURATION_FILE "${MISSION_DEFS}/${OSAL_SYSTEM_OSCONFIG}_osconfig.cmake")
endif()
if (EXISTS "${MISSION_DEFS}/${TARGETSYSTEM}_osconfig.cmake")
list(APPEND OSAL_CONFIGURATION_FILE "${MISSION_DEFS}/${TARGETSYSTEM}_osconfig.cmake")
endif()
foreach(CONFIG ${BUILD_CONFIG_${TARGETSYSTEM}} ${OSAL_SYSTEM_OSCONFIG})
if (EXISTS "${MISSION_DEFS}/${CONFIG}_osconfig.cmake")
list(APPEND OSAL_CONFIGURATION_FILE "${MISSION_DEFS}/${CONFIG}_osconfig.cmake")
endif()
endforeach()
list(REVERSE OSAL_CONFIGURATION_FILE)
set(OSAL_CONFIGURATION_FILE ${OSAL_CONFIGURATION_FILE} PARENT_SCOPE)

# Allow sources to "ifdef" certain things if running on simulated hardware
Expand All @@ -294,6 +293,19 @@ function(prepare)

# Truncate the global TGTSYS_LIST to be only the target architecture
set(TGTSYS_LIST ${TARGETSYSTEM} PARENT_SCOPE)

# set the BUILD_CONFIG variable from the cached data
set(BUILD_CONFIG ${BUILD_CONFIG_${TARGETSYSTEM}})
list(REMOVE_AT BUILD_CONFIG 0)
set(BUILD_CONFIG ${BUILD_CONFIG} PARENT_SCOPE)

# Pull in any application-specific platform-scope configuration
# This may include user configuration files such as cfe_platform_cfg.h,
# or any other configuration/preparation that needs to happen at
# platform/arch scope.
foreach(DEP_NAME ${MISSION_DEPS})
include("${${DEP_NAME}_MISSION_DIR}/arch_build.cmake" OPTIONAL)
endforeach(DEP_NAME ${MISSION_DEPS})

endfunction(prepare)

Expand Down Expand Up @@ -344,7 +356,7 @@ function(process_arch SYSVAR)
include_directories(${CMAKE_BINARY_DIR}/inc)

# Configure OSAL target first, as it also determines important compiler flags
add_subdirectory(${MISSION_SOURCE_DIR}/osal osal)
add_subdirectory("${osal_MISSION_DIR}" osal)

# The OSAL displays its selected OS, so it is logical to display the selected PSP
# This can help with debugging if things go wrong.
Expand Down Expand Up @@ -392,56 +404,56 @@ function(process_arch SYSVAR)
if (NOT INSTALL_SUBDIR)
set(INSTALL_SUBDIR cf)
endif (NOT INSTALL_SUBDIR)

# Add any dependencies which MIGHT be required for subsequent apps/libs/tools
# The cfe-core and osal are handled explicitly since these have special extra config
foreach(DEP ${MISSION_DEPS})
if (NOT DEP STREQUAL "cfe-core" AND
NOT DEP STREQUAL "osal")
add_subdirectory(${${DEP}_MISSION_DIR} ${DEP})

# confirm that all dependencies have a MISSION_DIR defined that indicates the source.
# This should have been set up by the parent script. However, if any dir is not set,
# this may result in "add_subdirectory" of itself which causes a loop. This can happen
# if the variables/lists were modified unexpectedly.
foreach(DEP
${MISSION_CORE_MODULES}
${TGTSYS_${SYSVAR}_PSPMODULES}
${TGTSYS_${SYSVAR}_STATICAPPS}
${TGTSYS_${SYSVAR}_APPS})
if(NOT DEFINED ${DEP}_MISSION_DIR)
message(FATAL_ERROR "ERROR: core module ${DEP} has no MISSION_DIR defined")
endif()
endforeach(DEP ${MISSION_DEPS})

# Clear the app lists
set(ARCH_APP_SRCS)
foreach(APP ${TGTSYS_${SYSVAR}_APPS})
set(TGTLIST_${APP})
endforeach()
foreach(DRV ${TGTSYS_${SYSVAR}_DRIVERS})
set(TGTLIST_DRV_${DRV})
endforeach()

# INCLUDE_REFACTOR: apps and the PSP like to #include cfe_platform_cfg.h -- they shouldn't
# This will become unnecessary when dependency refactoring is merged in, but for now
# they need to be able to find it. Remove the next line once refactoring is merged.
# Also do not do this if more than one CPU shares this architecture - this hack can only
# be done if a 1:1 mapping between cpus and architectures (so all apps are rebuilt per-cpu)
list(LENGTH TGTSYS_${SYSVAR} ARCHLEN)
if (ARCHLEN EQUAL 1)
include_directories(${CMAKE_BINARY_DIR}/cfe_core_default_${TGT${TGTSYS_${SYSVAR}}_NAME}/inc)
endif (ARCHLEN EQUAL 1)


# Add all core modules
# The osal is handled explicitly (above) since this has special extra config
foreach(DEP ${MISSION_CORE_MODULES})
if(NOT DEP STREQUAL "osal")
message(STATUS "Building Core Module: ${DEP}")
add_subdirectory("${${DEP}_MISSION_DIR}" ${DEP})
endif(NOT DEP STREQUAL "osal")
endforeach(DEP ${MISSION_CORE_MODULES})

# For the PSP it may define the FSW as either
# "psp-${CFE_SYSTEM_PSPNAME}" or just simply "psp"
if (NOT TARGET psp)
add_library(psp ALIAS psp-${CFE_SYSTEM_PSPNAME})
endif (NOT TARGET psp)

# Process each PSP module that is referenced on this system architecture (any cpu)
foreach(PSPMOD ${TGTSYS_${SYSVAR}_PSPMODULES})
message(STATUS "Building PSP Module: ${PSPMOD}")
add_subdirectory(${${PSPMOD}_MISSION_DIR} psp/${PSPMOD})
add_subdirectory("${${PSPMOD}_MISSION_DIR}" psp/${PSPMOD})
endforeach()

# Process each app that is used on this system architecture
set(APP_INSTALL_LIST)
foreach(APP ${TGTSYS_${SYSVAR}_STATICAPPS})
message(STATUS "Building Static App: ${APP}")
add_subdirectory(${${APP}_MISSION_DIR} apps/${APP})
add_subdirectory("${${APP}_MISSION_DIR}" apps/${APP})
endforeach()

# Configure the selected PSP
# The naming convention allows more than one PSP per arch,
# however in practice this gets too complicated so it is
# currently a 1:1 relationship. This may change at some point.
add_subdirectory(${MISSION_SOURCE_DIR}/psp psp/${CFE_SYSTEM_PSPNAME})

# Process each target that shares this system architecture
# First Pass: Assemble the list of apps that should be compiled
foreach(APP ${TGTSYS_${SYSVAR}_APPS})
set(TGTLIST_${APP})
endforeach()

foreach(TGTID ${TGTSYS_${SYSVAR}})

set(TGTNAME ${TGT${TGTID}_NAME})
Expand All @@ -461,36 +473,15 @@ function(process_arch SYSVAR)
foreach(APP ${TGTSYS_${SYSVAR}_APPS})
set(APP_INSTALL_LIST ${TGTLIST_${APP}})
message(STATUS "Building App: ${APP} install=${APP_INSTALL_LIST}")
add_subdirectory(${${APP}_MISSION_DIR} apps/${APP})
add_subdirectory("${${APP}_MISSION_DIR}" apps/${APP})
endforeach()

# If unit test is enabled, build a generic ut stub library for CFE
if (ENABLE_UNIT_TESTS)
add_subdirectory(${cfe-core_MISSION_DIR}/ut-stubs ut_cfe_core_stubs)
endif (ENABLE_UNIT_TESTS)

# Process each target that shares this system architecture
# Second Pass: Build cfe-core and link final target executable
# Second Pass: Build and link final target executable
foreach(TGTID ${TGTSYS_${SYSVAR}})

set(TGTNAME ${TGT${TGTID}_NAME})
set(TGTPLATFORM ${TGT${TGTID}_PLATFORM})
if(NOT TGTPLATFORM)
set(TGTPLATFORM "default" ${TGTNAME})
endif(NOT TGTPLATFORM)

string(REPLACE ";" "_" CFE_CORE_TARGET "cfe_core_${TGTPLATFORM}")
if (NOT TARGET ${CFE_CORE_TARGET})

# Generate wrapper file for the requisite cfe_platform_cfg.h file
generate_config_includefile("${CFE_CORE_TARGET}/inc/cfe_msgids.h" msgids.h ${TGTPLATFORM})
generate_config_includefile("${CFE_CORE_TARGET}/inc/cfe_platform_cfg.h" platform_cfg.h ${TGTPLATFORM})

# Actual core library is a subdirectory
add_subdirectory(${MISSION_SOURCE_DIR}/cfe/fsw/cfe-core ${CFE_CORE_TARGET})

endif (NOT TARGET ${CFE_CORE_TARGET})

set(TGTNAME ${TGT${TGTID}_NAME})

# Target to generate the actual executable file
add_subdirectory(cmake/target ${TGTNAME})

Expand Down
1 change: 1 addition & 0 deletions cmake/cfe-common.doxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ STRIP_FROM_PATH = @MISSION_SOURCE_DIR@
# This is applicable to both users guide and detail design outputs
IMAGE_PATH += @MISSION_SOURCE_DIR@/cfe/docs/src
INPUT += @MISSION_SOURCE_DIR@/cfe/docs/src/cfe_glossary.dox
INPUT += @MISSION_SOURCE_DIR@/cfe/docs/src/cfs_versions.dox
INPUT += @MISSION_SOURCE_DIR@/cfe/docs/src/cfe_api.dox
INPUT += @MISSION_SOURCE_DIR@/cfe/docs/src/cfe_es.dox
INPUT += @MISSION_SOURCE_DIR@/cfe/docs/src/cfe_evs.dox
Expand Down
5 changes: 5 additions & 0 deletions cmake/cfe_generated_file.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@GENERATED_FILE_HEADER@

@GENERATED_FILE_CONTENT@

@GENERATED_FILE_TRAILER@
Loading

0 comments on commit deeb294

Please sign in to comment.