diff --git a/CMakeLists.txt b/CMakeLists.txt index ffe77156..79bdb5bc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,22 +11,60 @@ if (NOT CFE_SYSTEM_PSPNAME) endif() set(CFE_PSP_TARGETNAME "${CFE_SYSTEM_PSPNAME}") -add_definitions(-D_CFE_PSP_) +add_definitions(-D_CFE_PSP_) # macro to indicate PSP scope -# The PSP is currently built in two parts, consisting of a fully platform-specific -# module combined with a shared component which is built for multiple targets. +# The "psp_module_api" defines the interface between internal PSP components +add_library(psp_module_api INTERFACE) +target_compile_definitions(psp_module_api INTERFACE + $ # use defs from OSAL +) +target_include_directories(psp_module_api INTERFACE + fsw/inc # public API + fsw/shared/inc # all PSP shared headers + fsw/${CFE_PSP_TARGETNAME}/inc # all impl headers + ${CFE_SOURCE_DIR}/cmake/target/inc # for sysconfig + $ # use headers from OSAL +) + +# Translate the CFE_PSP_TARGETNAME to a set of additional modules to build +file(STRINGS "${CMAKE_CURRENT_LIST_DIR}/fsw/${CFE_PSP_TARGETNAME}/psp_module_list.cmake" PSP_TARGET_MODULE_LIST REGEX "^[a-zA-Z]") + +# The PSP is currently built in modular parts, consisting of a platform-specific +# module(s) combined with a shared component which is built for multiple targets. # The "shared" component is compiled using headers from the platform-specific module # so it is still ultimately a platform-specific binary, and it all gets wrapped into # a single PSP static library target. -include_directories(fsw/shared/inc) add_subdirectory(fsw/${CFE_PSP_TARGETNAME} ${CFE_PSP_TARGETNAME}-impl) add_subdirectory(fsw/shared ${CFE_PSP_TARGETNAME}-shared) +# Generate a list of PSP modules along with a pointer to its API structure/entry point +set(GENERATED_EXTERNS) +set(GENERATED_KEYVALS) +foreach(PSPMOD ${PSP_TARGET_MODULE_LIST}) + add_subdirectory(fsw/modules/${PSPMOD} ${PSPMOD}-${CFE_PSP_TARGETNAME}-impl) + list(APPEND GENERATED_EXTERNS "extern CFE_PSP_ModuleApi_t CFE_PSP_${PSPMOD}_API;\n") + list(APPEND GENERATED_KEYVALS "{ .Name = \"${PSPMOD}\", .Api = &CFE_PSP_${PSPMOD}_API },\n") +endforeach() + +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/module_list.c.in ${CMAKE_CURRENT_BINARY_DIR}/${CFE_PSP_TARGETNAME}_module_list.c @ONLY) + add_library(psp-${CFE_PSP_TARGETNAME} STATIC + ${CMAKE_CURRENT_BINARY_DIR}/${CFE_PSP_TARGETNAME}_module_list.c $ $ ) - +target_link_libraries(psp-${CFE_PSP_TARGETNAME} PUBLIC + ${PSP_TARGET_MODULE_LIST} +) +target_link_libraries(psp-${CFE_PSP_TARGETNAME} PRIVATE + psp_module_api +) + +target_include_directories(psp-${CFE_PSP_TARGETNAME} INTERFACE + fsw/inc +) + + if (ENABLE_UNIT_TESTS) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/ut-stubs) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/unit-test-coverage) diff --git a/README.md b/README.md index dfa1bd63..a2aa689e 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,19 @@ This is a collection of APIs abstracting platform specific functionality to be l ## Version History +### Development Build: v1.5.0-rc1+dev82 + +- HOTFIX 20210312, updates to work with older CMake +- See + +### Development Build: v1.5.0-rc1+dev76 + +- Fix #246, remove unused code. +- Fix #254, use CMake to publish interface details +- Fix #256, add PSP version API +- Fix #258, Add Testing Tools to the Security Policy +- See + ### Development Build: 1.5.0-rc1+dev68 - Updates continuous integration workfow by adding static analysis with timeout and code format check. Adds status badges to ReadMe and removes old TravisCI artifacts. diff --git a/SECURITY.md b/SECURITY.md index 43d94643..fd381864 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -8,8 +8,34 @@ For general cFS vulnerabilities please [open a cFS framework issue](https://gith In either case please use the "Bug Report" template and provide as much information as possible. Apply appropraite labels for each report. For security related reports, tag the issue with the "security" label. +## Testing + +**Disclaimer: nasa/PSP is not responsible for any liability incurred under the [Apache License 2.0](https://github.com/nasa/PSP/blob/main/LICENSE).** + +Testing is an important aspect our team values to improve PSP. + +To view tools used for the cFS bundle, see our [top-level security policy](https://github.com/nasa/cFS/security/policy). + +### CodeQL + +The [PSP CodeQL GitHub Actions workflow](https://github.com/nasa/PSP/actions/workflows/codeql-build.yml) is available to the public. To review the results, fork the PSP repository and run the CodeQL workflow. + +CodeQL is ran for every push and pull-request on all branches of PSP in GitHub Actions. + +For the CodeQL GitHub Actions setup, visit https://github.com/github/codeql-action. + +### Cppcheck + +The [PSP Cppcheck GitHub Actions workflow and results](https://github.com/nasa/PSP/actions/workflows/static-analysis.yml) are available to the public. To view the results, select a workflow and download the artifacts. + +Cppcheck is ran for every push on the main branch and every pull request on all branches of PSP in Github Actions. + +For more information about Cppcheck, visit http://cppcheck.sourceforge.net/. + ## Additional Support -For additional support, email us at cfs-program@lists.nasa.gov. For help using OSAL and cFS, [subscribe to our mailing list](https://lists.nasa.gov/mailman/listinfo/cfs-community) that includes all the community members/users of the NASA core Flight Software (cFS) product line. The mailing list is used to communicate any information related to the cFS product such as current releases, bug findings and fixes, enhancement requests, community meeting notifications, sending out meeting minutes, etc. +For additional support, submit a GitHub issue. You can also email the cfs community at cfs-community@lists.nasa.gov. + +You can subscribe to the mailing list [here](https://lists.nasa.gov/mailman/listinfo/cfs-community) that includes all the community members/users of the NASA core Flight Software (cFS) product line. The mailing list is used to communicate any information related to the cFS product such as current releases, bug findings and fixes, enhancement requests, community meeting notifications, sending out meeting minutes, etc. -If you wish to report a cybersecurity incident or concern please contact the NASA Security Operations Center either by phone at 1-877-627-2732 or via email address soc@nasa.gov. +If you wish to report a cybersecurity incident or concern, please contact the NASA Security Operations Center either by phone at 1-877-627-2732 or via email address soc@nasa.gov. diff --git a/cmake/module_list.c.in b/cmake/module_list.c.in new file mode 100644 index 00000000..6795cd6d --- /dev/null +++ b/cmake/module_list.c.in @@ -0,0 +1,12 @@ +/* This file is generated via CMake - do not edit in place */ +#include "cfe_psp_module.h" + +@GENERATED_EXTERNS@ + +CFE_StaticModuleLoadEntry_t CFE_PSP_BASE_MODULE_LIST[] = +{ +@GENERATED_KEYVALS@ +{ NULL } +}; + +/* END OF FILE */ diff --git a/fsw/inc/cfe_psp.h b/fsw/inc/cfe_psp.h index 608517c1..47202913 100644 --- a/fsw/inc/cfe_psp.h +++ b/fsw/inc/cfe_psp.h @@ -410,4 +410,59 @@ int32 CFE_PSP_EepromWriteDisable(uint32 Bank); int32 CFE_PSP_EepromPowerUp(uint32 Bank); int32 CFE_PSP_EepromPowerDown(uint32 Bank); +/** + * \brief Obtain the PSP version/baseline identifier string + * + * This retrieves the PSP version identifier string without extra info + * + * \returns Version string. This is a fixed string and cannot be NULL. + */ +const char *CFE_PSP_GetVersionString(void); + +/** + * \brief Obtain the version code name + * + * This retrieves the PSP code name. This is a compatibility indicator for the + * overall NASA CFS ecosystem. All modular components which are intended to + * interoperate should report the same code name. + * + * \returns Code name. This is a fixed string and cannot be NULL. + */ +const char *CFE_PSP_GetVersionCodeName(void); + +/** + * \brief Obtain the PSP numeric version numbers as uint8 values + * + * This retrieves the numeric PSP version identifier as an array of 4 uint8 values. + * + * The array of numeric values is in order of precedence: + * [0] = Major Number + * [1] = Minor Number + * [2] = Revision Number + * [3] = Mission Revision + * + * The "Mission Revision" (last output) also indicates whether this is an + * official release, a patched release, or a development version. + * 0 indicates an official release + * 1-254 local patch level (reserved for mission use) + * 255 indicates a development build + * + * \param[out] VersionNumbers A fixed-size array to be filled with the version numbers + */ +void CFE_PSP_GetVersionNumber(uint8 VersionNumbers[4]); + +/** + * \brief Obtain the PSP library numeric build number + * + * The build number is a monotonically increasing number that (coarsely) + * reflects the number of commits/changes that have been merged since the + * epoch release. During development cycles this number should increase + * after each subsequent merge/modification. + * + * Like other version information, this is a fixed number assigned at compile time. + * + * \returns The OSAL library build number + */ +uint32 CFE_PSP_GetBuildNumber(void); + #endif /* _cfe_psp_ */ diff --git a/fsw/inc/cfe_psp_configdata.h b/fsw/inc/cfe_psp_configdata.h index 0dacd68c..d7285592 100644 --- a/fsw/inc/cfe_psp_configdata.h +++ b/fsw/inc/cfe_psp_configdata.h @@ -39,11 +39,13 @@ */ typedef const struct { - uint8 MajorVersion; - uint8 MinorVersion; - uint8 Revision; - uint8 MissionRev; - char VersionString[32]; + uint8 MajorVersion; + uint8 MinorVersion; + uint8 Revision; + uint8 MissionRev; + const char *VersionString; /**< The simple semantic version identifier */ + const char *VersionCodeName; /**< Cross-module compatiblity indicator */ + uint32 BuildNumber; } CFE_PSP_VersionInfo_t; /** diff --git a/fsw/mcp750-vxworks/CMakeLists.txt b/fsw/mcp750-vxworks/CMakeLists.txt index e57cdb0e..1b6972fa 100644 --- a/fsw/mcp750-vxworks/CMakeLists.txt +++ b/fsw/mcp750-vxworks/CMakeLists.txt @@ -7,8 +7,6 @@ # This contains the fully platform-specific code to # run CFE on this target. -include_directories(inc) - # Build the mcp750-vxworks implementation as a library add_library(psp-${CFE_PSP_TARGETNAME}-impl OBJECT src/cfe_psp_exception.c @@ -18,5 +16,14 @@ add_library(psp-${CFE_PSP_TARGETNAME}-impl OBJECT src/cfe_psp_start.c src/cfe_psp_support.c src/cfe_psp_timer.c - src/cfe_psp_watchdog.c) + src/cfe_psp_watchdog.c +) +target_compile_definitions(psp-${CFE_SYSTEM_PSPNAME}-impl PRIVATE + $ +) + +target_include_directories(psp-${CFE_PSP_TARGETNAME}-impl PRIVATE + inc + $ +) diff --git a/fsw/mcp750-vxworks/inc/psp_version.h b/fsw/mcp750-vxworks/inc/psp_version.h index c425ccdb..e0c17ec5 100644 --- a/fsw/mcp750-vxworks/inc/psp_version.h +++ b/fsw/mcp750-vxworks/inc/psp_version.h @@ -29,7 +29,7 @@ /* * Development Build Macro Definitions */ -#define CFE_PSP_IMPL_BUILD_NUMBER 68 +#define CFE_PSP_IMPL_BUILD_NUMBER 82 #define CFE_PSP_IMPL_BUILD_BASELINE "v1.5.0-rc1" /* diff --git a/fsw/mcp750-vxworks/psp_module_list.cmake b/fsw/mcp750-vxworks/psp_module_list.cmake new file mode 100644 index 00000000..ba9cd802 --- /dev/null +++ b/fsw/mcp750-vxworks/psp_module_list.cmake @@ -0,0 +1,4 @@ +# This is a list of modules that is included as a fixed/base set +# when this PSP is selected. They must exist under fsw/modules + +eeprom_direct diff --git a/fsw/modules/eeprom_direct/CMakeLists.txt b/fsw/modules/eeprom_direct/CMakeLists.txt new file mode 100644 index 00000000..fe7a9a57 --- /dev/null +++ b/fsw/modules/eeprom_direct/CMakeLists.txt @@ -0,0 +1,3 @@ + +# Create the module +add_psp_module(eeprom_direct cfe_psp_eeprom_direct.c) diff --git a/fsw/shared/src/cfe_psp_eeprom.c b/fsw/modules/eeprom_direct/cfe_psp_eeprom_direct.c similarity index 96% rename from fsw/shared/src/cfe_psp_eeprom.c rename to fsw/modules/eeprom_direct/cfe_psp_eeprom_direct.c index 3bf74294..57ab14de 100644 --- a/fsw/shared/src/cfe_psp_eeprom.c +++ b/fsw/modules/eeprom_direct/cfe_psp_eeprom_direct.c @@ -38,6 +38,15 @@ #include #include "cfe_psp.h" +#include "cfe_psp_module.h" + +CFE_PSP_MODULE_DECLARE_SIMPLE(eeprom_direct); + +void eeprom_direct_Init(uint32 PspModuleId) +{ + /* Inform the user that this module is in use */ + printf("CFE_PSP: Using DIRECT memory mapped EEPROM implementation\n"); +} /* ** global memory diff --git a/fsw/modules/eeprom_mmap_file/cfe_psp_eeprom_mmap_file.c b/fsw/modules/eeprom_mmap_file/cfe_psp_eeprom_mmap_file.c index f4915b66..63505926 100644 --- a/fsw/modules/eeprom_mmap_file/cfe_psp_eeprom_mmap_file.c +++ b/fsw/modules/eeprom_mmap_file/cfe_psp_eeprom_mmap_file.c @@ -174,6 +174,9 @@ void eeprom_mmap_file_Init(uint32 PspModuleId) cpuaddr eeprom_address; uint32 eeprom_size; + /* Inform the user that this module is in use */ + printf("CFE_PSP: Using MMAP simulated EEPROM implementation\n"); + /* ** Create the simulated EEPROM segment by mapping a memory segment to a file. ** Since the file will be saved, the "EEPROM" contents will be preserved. @@ -187,7 +190,8 @@ void eeprom_mmap_file_Init(uint32 PspModuleId) /* ** Install the 2nd memory range as the mapped file ( EEPROM ) */ - Status = CFE_PSP_MemRangeSet(1, CFE_PSP_MEM_EEPROM, eeprom_address, eeprom_size, CFE_PSP_MEM_SIZE_DWORD, 0); + Status = CFE_PSP_MemRangeSet(1, CFE_PSP_MEM_EEPROM, eeprom_address, eeprom_size, CFE_PSP_MEM_SIZE_DWORD, + CFE_PSP_MEM_ATTR_READWRITE); OS_printf("CFE_PSP: EEPROM Range (2) created: Start Address = %08lX, Size = %08X Status = %d\n", (unsigned long)eeprom_address, (unsigned int)eeprom_size, Status); } diff --git a/fsw/modules/eeprom_stub/cfe_psp_eeprom_stub.c b/fsw/modules/eeprom_stub/cfe_psp_eeprom_stub.c index a2df1424..ca9d936f 100644 --- a/fsw/modules/eeprom_stub/cfe_psp_eeprom_stub.c +++ b/fsw/modules/eeprom_stub/cfe_psp_eeprom_stub.c @@ -34,7 +34,8 @@ CFE_PSP_MODULE_DECLARE_SIMPLE(eeprom_stub); void eeprom_stub_Init(uint32 PspModuleId) { - /* Nothing to init */ + /* Inform the user that this module is in use */ + printf("CFE_PSP: Using STUB EEPROM implementation\n"); } int32 CFE_PSP_EepromWrite32(cpuaddr MemoryAddress, uint32 uint32Value) diff --git a/fsw/pc-linux/CMakeLists.txt b/fsw/pc-linux/CMakeLists.txt index 0a5aed0a..5918683d 100644 --- a/fsw/pc-linux/CMakeLists.txt +++ b/fsw/pc-linux/CMakeLists.txt @@ -7,8 +7,6 @@ # This contains the fully platform-specific code to # run CFE on this target. -include_directories(inc) - # Build the pc-linux implementation as a library add_library(psp-${CFE_PSP_TARGETNAME}-impl OBJECT src/cfe_psp_exception.c @@ -25,4 +23,11 @@ add_library(psp-${CFE_PSP_TARGETNAME}-impl OBJECT # Code outside the pc-linux PSP should _not_ depend on this. target_compile_definitions(psp-${CFE_SYSTEM_PSPNAME}-impl PRIVATE _GNU_SOURCE -) \ No newline at end of file + $ +) + +target_include_directories(psp-${CFE_PSP_TARGETNAME}-impl PRIVATE + inc + $ +) + diff --git a/fsw/pc-linux/inc/psp_version.h b/fsw/pc-linux/inc/psp_version.h index 398ec7ad..15fd40a7 100644 --- a/fsw/pc-linux/inc/psp_version.h +++ b/fsw/pc-linux/inc/psp_version.h @@ -29,7 +29,7 @@ /* * Development Build Macro Definitions */ -#define CFE_PSP_IMPL_BUILD_NUMBER 68 +#define CFE_PSP_IMPL_BUILD_NUMBER 82 #define CFE_PSP_IMPL_BUILD_BASELINE "v1.5.0-rc1" /* diff --git a/fsw/pc-linux/psp_module_list.cmake b/fsw/pc-linux/psp_module_list.cmake new file mode 100644 index 00000000..54ffb4c5 --- /dev/null +++ b/fsw/pc-linux/psp_module_list.cmake @@ -0,0 +1,4 @@ +# This is a list of modules that is included as a fixed/base set +# when this PSP is selected. They must exist under fsw/modules + +eeprom_mmap_file diff --git a/fsw/pc-rtems/CMakeLists.txt b/fsw/pc-rtems/CMakeLists.txt index 1014f67b..4d55fffc 100644 --- a/fsw/pc-rtems/CMakeLists.txt +++ b/fsw/pc-rtems/CMakeLists.txt @@ -7,8 +7,6 @@ # This contains the fully platform-specific code to # run CFE on this target. -include_directories(inc) - # Build the pc-rtems implementation as a library add_library(psp-${CFE_PSP_TARGETNAME}-impl OBJECT src/cfe_psp_exception.c @@ -18,5 +16,16 @@ add_library(psp-${CFE_PSP_TARGETNAME}-impl OBJECT src/cfe_psp_start.c src/cfe_psp_support.c src/cfe_psp_timer.c - src/cfe_psp_watchdog.c) + src/cfe_psp_watchdog.c +) + +target_compile_definitions(psp-${CFE_SYSTEM_PSPNAME}-impl PRIVATE + $ +) + +target_include_directories(psp-${CFE_PSP_TARGETNAME}-impl PRIVATE + inc + $ +) + diff --git a/fsw/pc-rtems/inc/psp_version.h b/fsw/pc-rtems/inc/psp_version.h index 4f1b8d0e..9b0dc5fb 100644 --- a/fsw/pc-rtems/inc/psp_version.h +++ b/fsw/pc-rtems/inc/psp_version.h @@ -29,7 +29,7 @@ /* * Development Build Macro Definitions */ -#define CFE_PSP_IMPL_BUILD_NUMBER 68 +#define CFE_PSP_IMPL_BUILD_NUMBER 82 #define CFE_PSP_IMPL_BUILD_BASELINE "v1.5.0-rc1" /* diff --git a/fsw/pc-rtems/psp_module_list.cmake b/fsw/pc-rtems/psp_module_list.cmake new file mode 100644 index 00000000..38b24e37 --- /dev/null +++ b/fsw/pc-rtems/psp_module_list.cmake @@ -0,0 +1,4 @@ +# This is a list of modules that is included as a fixed/base set +# when this PSP is selected. They must exist under fsw/modules + +eeprom_stub diff --git a/fsw/pc-rtems/src/cfe_psp_memory.c b/fsw/pc-rtems/src/cfe_psp_memory.c index 52bbb260..53f557d4 100644 --- a/fsw/pc-rtems/src/cfe_psp_memory.c +++ b/fsw/pc-rtems/src/cfe_psp_memory.c @@ -528,24 +528,3 @@ int32 CFE_PSP_GetCFETextSegmentInfo(cpuaddr *PtrToCFESegment, uint32 *SizeOfCFES return (return_code); } - -// extern int rtems_shell_main_wkspace_info(int argc,char *argv[]); -// extern int rtems_shell_main_malloc_info( int argc, char *argv[]); - -void CFE_PSP_MemReport(char *message) -{ - - // int MemStatus; - // char *malloc_argv[] = {"malloc", "info"}; - // char *wkspace_argv[] = {"wkspace", "info"}; - - OS_printf("------------------------ Memory Stat Report ----------------------------\n"); - OS_printf(" Called from: %s\n", message); - OS_printf("------------------------ Dumping Malloc Stats: ----------------------------\n"); - // MemStatus = rtems_shell_main_malloc_info(2, malloc_argv); - // OS_printf("rtems_shell_main_malloc_info() rc=%d\n",(int)MemStatus); - OS_printf("------------------------ Dumping Wkspace Stats: ----------------------------\n"); - // MemStatus = rtems_shell_main_wkspace_info(2, wkspace_argv); - // OS_printf("rtems_shell_main_wkspace_info() rc=%d\n",(int)MemStatus); - OS_printf("------------------------ Done ----------------- ----------------------------\n"); -} diff --git a/fsw/shared/CMakeLists.txt b/fsw/shared/CMakeLists.txt index 08b28bcc..b977467c 100644 --- a/fsw/shared/CMakeLists.txt +++ b/fsw/shared/CMakeLists.txt @@ -10,13 +10,10 @@ # Note this shared PSP code is currently built against headers provided by the # target implementation. This makes it implementation-specific even though # the same source code is used with multiple targets. -include_directories("${CFEPSP_SOURCE_DIR}/fsw/${CFE_PSP_TARGETNAME}/inc") -include_directories(inc) # Build the shared implementation as a library add_library(psp-${CFE_PSP_TARGETNAME}-shared OBJECT src/cfe_psp_configdata.c - src/cfe_psp_eeprom.c src/cfe_psp_exceptionstorage.c src/cfe_psp_memrange.c src/cfe_psp_memutils.c @@ -24,3 +21,12 @@ add_library(psp-${CFE_PSP_TARGETNAME}-shared OBJECT src/cfe_psp_port.c src/cfe_psp_ram.c ) + +target_compile_definitions(psp-${CFE_SYSTEM_PSPNAME}-shared PRIVATE + $ +) + +target_include_directories(psp-${CFE_PSP_TARGETNAME}-shared PRIVATE + $ +) + diff --git a/fsw/shared/inc/cfe_psp_module.h b/fsw/shared/inc/cfe_psp_module.h index ee4e6157..f24dcdc4 100644 --- a/fsw/shared/inc/cfe_psp_module.h +++ b/fsw/shared/inc/cfe_psp_module.h @@ -111,4 +111,11 @@ int32 CFE_PSP_Module_FindByName(const char *ModuleName, uint32 *PspModuleId); */ int32 CFE_PSP_Module_GetAPIEntry(uint32 PspModuleId, CFE_PSP_ModuleApi_t **API); +/** + * \brief A list of fixed/base modules associated with the PSP + * + * This list should be generated by the build system based on the user-selected PSP + */ +extern CFE_StaticModuleLoadEntry_t CFE_PSP_BASE_MODULE_LIST[]; + #endif /* CFE_PSP_MODULE_H_ */ diff --git a/fsw/shared/src/cfe_psp_module.c b/fsw/shared/src/cfe_psp_module.c index 5e2c0830..1854ee96 100644 --- a/fsw/shared/src/cfe_psp_module.c +++ b/fsw/shared/src/cfe_psp_module.c @@ -47,11 +47,11 @@ static uint32 CFE_PSP_ModuleCount = 0; /*************************************************** - * Function Name: CFE_PSP_ModuleInit + * Function Name: CFE_PSP_ModuleInitList * - * See prototype for full description + * Helper function to initalize a list of modules (not externally called) */ -void CFE_PSP_ModuleInit(void) +void CFE_PSP_ModuleInitList(CFE_StaticModuleLoadEntry_t *ListPtr) { CFE_StaticModuleLoadEntry_t *Entry; CFE_PSP_ModuleApi_t * ApiPtr; @@ -59,7 +59,7 @@ void CFE_PSP_ModuleInit(void) /* * Call the init function for all statically linked modules */ - Entry = GLOBAL_CONFIGDATA.PspModuleList; + Entry = ListPtr; if (Entry != NULL) { while (Entry->Name != NULL) @@ -75,6 +75,20 @@ void CFE_PSP_ModuleInit(void) } } +/*************************************************** + * Function Name: CFE_PSP_ModuleInit + * + * See prototype for full description + */ +void CFE_PSP_ModuleInit(void) +{ + /* First initialize the fixed set of modules for this PSP */ + CFE_PSP_ModuleInitList(CFE_PSP_BASE_MODULE_LIST); + + /* Then initialize any user-selected extension modules */ + CFE_PSP_ModuleInitList(GLOBAL_CONFIGDATA.PspModuleList); +} + /*************************************************** * Function Name: CFE_PSP_Module_GetAPIEntry * diff --git a/fsw/shared/src/cfe_psp_version.c b/fsw/shared/src/cfe_psp_version.c new file mode 100644 index 00000000..ff3b28af --- /dev/null +++ b/fsw/shared/src/cfe_psp_version.c @@ -0,0 +1,83 @@ +/* +** GSC-18128-1, "Core Flight Executive Version 6.7" +** +** Copyright (c) 2006-2019 United States Government as represented by +** the Administrator of the National Aeronautics and Space Administration. +** All Rights Reserved. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +/** + * \file cfe_psp_version.c + * + * Defines API that obtains the values of the various version identifiers + */ + +#include +#include + +/*---------------------------------------------------------------- + * + * Function: CFE_PSP_GetVersionString + * + * Purpose: Implemented per public OSAL API + * See description in API and header file for detail + * + *-----------------------------------------------------------------*/ +const char *CFE_PSP_GetVersionString(void) +{ + return GLOBAL_PSP_CONFIGDATA.PSP_VersionInfo.VersionString; +} + +/*---------------------------------------------------------------- + * + * Function: CFE_PSP_GetVersionCodeName + * + * Purpose: Implemented per public OSAL API + * See description in API and header file for detail + * + *-----------------------------------------------------------------*/ +const char *CFE_PSP_GetVersionCodeName(void) +{ + return GLOBAL_PSP_CONFIGDATA.PSP_VersionInfo.VersionCodeName; +} + +/*---------------------------------------------------------------- + * + * Function: CFE_PSP_GetVersionNumber + * + * Purpose: Implemented per public OSAL API + * See description in API and header file for detail + * + *-----------------------------------------------------------------*/ +void CFE_PSP_GetVersionNumber(uint8 VersionNumbers[4]) +{ + VersionNumbers[0] = GLOBAL_PSP_CONFIGDATA.PSP_VersionInfo.MajorVersion; + VersionNumbers[1] = GLOBAL_PSP_CONFIGDATA.PSP_VersionInfo.MinorVersion; + VersionNumbers[2] = GLOBAL_PSP_CONFIGDATA.PSP_VersionInfo.Revision; + VersionNumbers[3] = GLOBAL_PSP_CONFIGDATA.PSP_VersionInfo.MissionRev; +} + +/*---------------------------------------------------------------- + * + * Function: CFE_PSP_GetBuildNumber + * + * Purpose: Implemented per public OSAL API + * See description in API and header file for detail + * + *-----------------------------------------------------------------*/ +uint32 CFE_PSP_GetBuildNumber(void) +{ + return GLOBAL_PSP_CONFIGDATA.PSP_VersionInfo.BuildNumber; +} diff --git a/unit-test-coverage/mcp750-vxworks/CMakeLists.txt b/unit-test-coverage/mcp750-vxworks/CMakeLists.txt index cbf826da..a701b10d 100644 --- a/unit-test-coverage/mcp750-vxworks/CMakeLists.txt +++ b/unit-test-coverage/mcp750-vxworks/CMakeLists.txt @@ -49,6 +49,7 @@ add_executable(coverage-${CFE_PSP_TARGETNAME}-testrunner target_link_libraries(coverage-${CFE_PSP_TARGETNAME}-testrunner ${UT_COVERAGE_LINK_FLAGS} ut-adaptor-${CFE_PSP_TARGETNAME} + psp_module_api ut_psp_cfe_stubs ut_psp_libc_stubs ut_osapi_stubs diff --git a/unit-test-coverage/mcp750-vxworks/adaptors/CMakeLists.txt b/unit-test-coverage/mcp750-vxworks/adaptors/CMakeLists.txt index d6b2f777..c670ddd3 100644 --- a/unit-test-coverage/mcp750-vxworks/adaptors/CMakeLists.txt +++ b/unit-test-coverage/mcp750-vxworks/adaptors/CMakeLists.txt @@ -31,3 +31,8 @@ target_include_directories(ut-adaptor-${CFE_PSP_TARGETNAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/inc ${PSPCOVERAGE_SOURCE_DIR}/shared/adaptors/inc ) + +target_link_libraries(ut-adaptor-${CFE_PSP_TARGETNAME} PRIVATE + psp_module_api + ut_assert +) \ No newline at end of file diff --git a/unit-test-coverage/ut-stubs/CMakeLists.txt b/unit-test-coverage/ut-stubs/CMakeLists.txt index edb75797..c9c1c91d 100644 --- a/unit-test-coverage/ut-stubs/CMakeLists.txt +++ b/unit-test-coverage/ut-stubs/CMakeLists.txt @@ -54,7 +54,17 @@ add_library(ut_psp_libc_stubs STATIC EXCLUDE_FROM_ALL target_include_directories(ut_libc_stubs PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/inc ) + +target_link_libraries(ut_psp_libc_stubs PRIVATE + psp_module_api + ut_assert +) add_library(ut_psp_cfe_stubs STATIC EXCLUDE_FROM_ALL src/cfe-configdata-stubs.c +) + +target_link_libraries(ut_psp_cfe_stubs PRIVATE + psp_module_api + ut_assert ) \ No newline at end of file diff --git a/unit-test-coverage/ut-stubs/src/cfe-configdata-stubs.c b/unit-test-coverage/ut-stubs/src/cfe-configdata-stubs.c index 7deb1f8b..f59e9fbc 100644 --- a/unit-test-coverage/ut-stubs/src/cfe-configdata-stubs.c +++ b/unit-test-coverage/ut-stubs/src/cfe-configdata-stubs.c @@ -19,6 +19,8 @@ #include +CFE_StaticModuleLoadEntry_t CFE_PSP_BASE_MODULE_LIST[] = {{NULL}}; + Target_CfeConfigData GLOBAL_CFE_CONFIGDATA = { /** diff --git a/ut-stubs/CMakeLists.txt b/ut-stubs/CMakeLists.txt index 6e803585..55bab45c 100644 --- a/ut-stubs/CMakeLists.txt +++ b/ut-stubs/CMakeLists.txt @@ -1,2 +1,5 @@ -include_directories(${osal_MISSION_DIR}/ut_assert/inc) add_library(ut_psp-${CFE_PSP_TARGETNAME}_stubs ut_psp_stubs.c) +target_link_libraries(ut_psp-${CFE_PSP_TARGETNAME}_stubs PRIVATE + psp_module_api + ut_assert +) diff --git a/ut-stubs/ut_psp_stubs.c b/ut-stubs/ut_psp_stubs.c index 872d3022..72e8b7b1 100644 --- a/ut-stubs/ut_psp_stubs.c +++ b/ut-stubs/ut_psp_stubs.c @@ -733,3 +733,88 @@ int32 CFE_PSP_Exception_CopyContext(uint32 ContextLogId, void *ContextBuf, uint3 return status; } + +/*---------------------------------------------------------------- + * + * Function: CFE_PSP_GetVersionString + * + * Purpose: Implemented per public OSAL API + * See description in API and header file for detail + * + *-----------------------------------------------------------------*/ +const char *CFE_PSP_GetVersionString(void) +{ + static const char DEFAULT[] = "UT"; + void * Buffer; + const char * RetVal; + + UT_GetDataBuffer(UT_KEY(CFE_PSP_GetVersionString), &Buffer, NULL, NULL); + if (Buffer == NULL) + { + RetVal = DEFAULT; + } + else + { + RetVal = Buffer; + } + + return RetVal; +} + +/*---------------------------------------------------------------- + * + * Function: CFE_PSP_GetVersionCodeName + * + * Purpose: Implemented per public OSAL API + * See description in API and header file for detail + * + *-----------------------------------------------------------------*/ +const char *CFE_PSP_GetVersionCodeName(void) +{ + static const char DEFAULT[] = "UT"; + void * Buffer; + const char * RetVal; + + UT_GetDataBuffer(UT_KEY(CFE_PSP_GetVersionCodeName), &Buffer, NULL, NULL); + if (Buffer == NULL) + { + RetVal = DEFAULT; + } + else + { + RetVal = Buffer; + } + + return RetVal; +} + +/*---------------------------------------------------------------- + * + * Function: CFE_PSP_GetVersionNumber + * + * Purpose: Implemented per public OSAL API + * See description in API and header file for detail + * + *-----------------------------------------------------------------*/ +void CFE_PSP_GetVersionNumber(uint8 VersionNumbers[4]) +{ + UT_Stub_RegisterContext(UT_KEY(CFE_PSP_GetVersionNumber), VersionNumbers); + UT_DEFAULT_IMPL(VersionNumbers); +} + +/*---------------------------------------------------------------- + * + * Function: CFE_PSP_GetBuildNumber + * + * Purpose: Implemented per public OSAL API + * See description in API and header file for detail + * + *-----------------------------------------------------------------*/ +uint32 CFE_PSP_GetBuildNumber(void) +{ + int32 status; + + status = UT_DEFAULT_IMPL(CFE_PSP_GetBuildNumber); + + return status; +}