From 07cd8614491bd5f77776bc1dafdd66e30104971f Mon Sep 17 00:00:00 2001 From: Alex Campbell Date: Mon, 1 Mar 2021 10:08:33 -0500 Subject: [PATCH 01/10] Fix #246, remove unused code. --- fsw/pc-rtems/src/cfe_psp_memory.c | 21 --------------------- 1 file changed, 21 deletions(-) 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"); -} From 23a33b79a453158678761ae388b4562e297e91cb Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Wed, 3 Mar 2021 11:11:44 -0500 Subject: [PATCH 02/10] Fix #254, use CMake to publish interface details Use target_include_directories and target_compile_definitions to propagate the interface details for PSP --- CMakeLists.txt | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ffe77156..298d0be8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,15 +18,33 @@ add_definitions(-D_CFE_PSP_) # 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) +include_directories( + fsw/inc + fsw/shared/inc # all local stuff + ${CFE_SOURCE_DIR}/cmake/target/inc # for sysconfig + $ # headers from OSAL +) + add_subdirectory(fsw/${CFE_PSP_TARGETNAME} ${CFE_PSP_TARGETNAME}-impl) +target_compile_definitions(psp-${CFE_PSP_TARGETNAME}-impl PUBLIC + $ # defs from OSAL +) + add_subdirectory(fsw/shared ${CFE_PSP_TARGETNAME}-shared) +target_compile_definitions(psp-${CFE_PSP_TARGETNAME}-shared PUBLIC + $ # defs from OSAL +) add_library(psp-${CFE_PSP_TARGETNAME} STATIC $ $ ) - + +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) From 2670eefc84a11281b12349abc9a89ad0eecbca4f Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Wed, 3 Mar 2021 11:25:48 -0500 Subject: [PATCH 03/10] Fix #256, add PSP version API Add a PSP implementation of the version API discussed in nasa/cFS#200 --- fsw/inc/cfe_psp.h | 55 +++++++++++++++++++++ fsw/inc/cfe_psp_configdata.h | 12 +++-- fsw/shared/src/cfe_psp_version.c | 83 +++++++++++++++++++++++++++++++ ut-stubs/ut_psp_stubs.c | 85 ++++++++++++++++++++++++++++++++ 4 files changed, 230 insertions(+), 5 deletions(-) create mode 100644 fsw/shared/src/cfe_psp_version.c 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/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/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; +} From ceb4b1f25b56e117501ff057060d6289ae680521 Mon Sep 17 00:00:00 2001 From: Ariel Adams Date: Fri, 5 Mar 2021 08:45:50 -0600 Subject: [PATCH 04/10] Fix #258, Add Testing Tools to the Security Policy --- SECURITY.md | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) 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. From 215807e7f761cb8fe6fb392089559619b2c67507 Mon Sep 17 00:00:00 2001 From: Jacob Hageman Date: Fri, 5 Mar 2021 17:36:41 -0500 Subject: [PATCH 05/10] IC-20210305, Update readme and version --- README.md | 8 ++++++++ fsw/mcp750-vxworks/inc/psp_version.h | 2 +- fsw/pc-linux/inc/psp_version.h | 2 +- fsw/pc-rtems/inc/psp_version.h | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index dfa1bd63..1da825a0 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,14 @@ This is a collection of APIs abstracting platform specific functionality to be l ## Version History +### Development Build: 1.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/fsw/mcp750-vxworks/inc/psp_version.h b/fsw/mcp750-vxworks/inc/psp_version.h index c425ccdb..d48abdbb 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 76 #define CFE_PSP_IMPL_BUILD_BASELINE "v1.5.0-rc1" /* diff --git a/fsw/pc-linux/inc/psp_version.h b/fsw/pc-linux/inc/psp_version.h index 398ec7ad..3c73e607 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 76 #define CFE_PSP_IMPL_BUILD_BASELINE "v1.5.0-rc1" /* diff --git a/fsw/pc-rtems/inc/psp_version.h b/fsw/pc-rtems/inc/psp_version.h index 4f1b8d0e..09c40e4d 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 76 #define CFE_PSP_IMPL_BUILD_BASELINE "v1.5.0-rc1" /* From 0ccebedaa3c042c3c798cc1c51516c36b1d875e9 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Mon, 8 Mar 2021 17:40:17 -0500 Subject: [PATCH 06/10] Fix #261, add psp_module_api interface target Adds a new target for PSP modules and use this to propagate the compile definitions and include directories for all PSP code. --- CMakeLists.txt | 29 +++++++++---------- fsw/mcp750-vxworks/CMakeLists.txt | 8 ++--- fsw/pc-linux/CMakeLists.txt | 7 +++-- fsw/pc-rtems/CMakeLists.txt | 7 +++-- fsw/shared/CMakeLists.txt | 7 +++-- .../mcp750-vxworks/CMakeLists.txt | 1 + .../mcp750-vxworks/adaptors/CMakeLists.txt | 5 ++++ unit-test-coverage/ut-stubs/CMakeLists.txt | 10 +++++++ ut-stubs/CMakeLists.txt | 5 +++- 9 files changed, 51 insertions(+), 28 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 298d0be8..a7765f0e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,29 +11,28 @@ 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_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 + ${CFE_SOURCE_DIR}/cmake/target/inc # for sysconfig + $ # use headers from OSAL +) + # 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 "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/inc - fsw/shared/inc # all local stuff - ${CFE_SOURCE_DIR}/cmake/target/inc # for sysconfig - $ # headers from OSAL -) - add_subdirectory(fsw/${CFE_PSP_TARGETNAME} ${CFE_PSP_TARGETNAME}-impl) -target_compile_definitions(psp-${CFE_PSP_TARGETNAME}-impl PUBLIC - $ # defs from OSAL -) - add_subdirectory(fsw/shared ${CFE_PSP_TARGETNAME}-shared) -target_compile_definitions(psp-${CFE_PSP_TARGETNAME}-shared PUBLIC - $ # defs from OSAL -) add_library(psp-${CFE_PSP_TARGETNAME} STATIC $ diff --git a/fsw/mcp750-vxworks/CMakeLists.txt b/fsw/mcp750-vxworks/CMakeLists.txt index e57cdb0e..1cfb39ec 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,7 @@ 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_include_directories(psp-${CFE_PSP_TARGETNAME}-impl PRIVATE inc) +target_link_libraries(psp-${CFE_PSP_TARGETNAME}-impl PRIVATE psp_module_api) diff --git a/fsw/pc-linux/CMakeLists.txt b/fsw/pc-linux/CMakeLists.txt index 0a5aed0a..19344b36 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,7 @@ 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) +target_link_libraries(psp-${CFE_PSP_TARGETNAME}-impl PRIVATE psp_module_api) diff --git a/fsw/pc-rtems/CMakeLists.txt b/fsw/pc-rtems/CMakeLists.txt index 1014f67b..fb736cf0 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,8 @@ 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_include_directories(psp-${CFE_PSP_TARGETNAME}-impl PRIVATE inc) +target_link_libraries(psp-${CFE_PSP_TARGETNAME}-impl PRIVATE psp_module_api) diff --git a/fsw/shared/CMakeLists.txt b/fsw/shared/CMakeLists.txt index 08b28bcc..0f9ab127 100644 --- a/fsw/shared/CMakeLists.txt +++ b/fsw/shared/CMakeLists.txt @@ -10,8 +10,6 @@ # 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 @@ -24,3 +22,8 @@ add_library(psp-${CFE_PSP_TARGETNAME}-shared OBJECT src/cfe_psp_port.c src/cfe_psp_ram.c ) + +target_include_directories(psp-${CFE_PSP_TARGETNAME}-shared PRIVATE + $ +) +target_link_libraries(psp-${CFE_PSP_TARGETNAME}-shared PRIVATE psp_module_api) 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/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 +) From 0800544eb1820ba5698f18343b544a507d74fa72 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Fri, 12 Mar 2021 13:23:07 -0500 Subject: [PATCH 07/10] HOTFIX 20210312, updates to work with older CMake Certain operations in the recent baseline were dependent on a recent version of CMake. In particular object libraries cannot be used in the intended way in the older versions. This adds workarounds for those cases. Tested against CMake versions 3.5.1, 3.10.2, and 3.16.3. --- CMakeLists.txt | 1 + fsw/mcp750-vxworks/CMakeLists.txt | 11 +++++++++-- fsw/pc-linux/CMakeLists.txt | 8 ++++++-- fsw/pc-rtems/CMakeLists.txt | 12 ++++++++++-- fsw/shared/CMakeLists.txt | 8 ++++++-- 5 files changed, 32 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a7765f0e..5482b0ae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,6 +21,7 @@ target_compile_definitions(psp_module_api INTERFACE 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 ) diff --git a/fsw/mcp750-vxworks/CMakeLists.txt b/fsw/mcp750-vxworks/CMakeLists.txt index 1cfb39ec..1b6972fa 100644 --- a/fsw/mcp750-vxworks/CMakeLists.txt +++ b/fsw/mcp750-vxworks/CMakeLists.txt @@ -18,5 +18,12 @@ add_library(psp-${CFE_PSP_TARGETNAME}-impl OBJECT src/cfe_psp_timer.c src/cfe_psp_watchdog.c ) -target_include_directories(psp-${CFE_PSP_TARGETNAME}-impl PRIVATE inc) -target_link_libraries(psp-${CFE_PSP_TARGETNAME}-impl PRIVATE psp_module_api) +target_compile_definitions(psp-${CFE_SYSTEM_PSPNAME}-impl PRIVATE + $ +) + +target_include_directories(psp-${CFE_PSP_TARGETNAME}-impl PRIVATE + inc + $ +) + diff --git a/fsw/pc-linux/CMakeLists.txt b/fsw/pc-linux/CMakeLists.txt index 19344b36..5918683d 100644 --- a/fsw/pc-linux/CMakeLists.txt +++ b/fsw/pc-linux/CMakeLists.txt @@ -23,7 +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 + $ +) + +target_include_directories(psp-${CFE_PSP_TARGETNAME}-impl PRIVATE + inc + $ ) -target_include_directories(psp-${CFE_PSP_TARGETNAME}-impl PRIVATE inc) -target_link_libraries(psp-${CFE_PSP_TARGETNAME}-impl PRIVATE psp_module_api) diff --git a/fsw/pc-rtems/CMakeLists.txt b/fsw/pc-rtems/CMakeLists.txt index fb736cf0..4d55fffc 100644 --- a/fsw/pc-rtems/CMakeLists.txt +++ b/fsw/pc-rtems/CMakeLists.txt @@ -18,6 +18,14 @@ add_library(psp-${CFE_PSP_TARGETNAME}-impl OBJECT src/cfe_psp_timer.c src/cfe_psp_watchdog.c ) -target_include_directories(psp-${CFE_PSP_TARGETNAME}-impl PRIVATE inc) -target_link_libraries(psp-${CFE_PSP_TARGETNAME}-impl PRIVATE psp_module_api) + +target_compile_definitions(psp-${CFE_SYSTEM_PSPNAME}-impl PRIVATE + $ +) + +target_include_directories(psp-${CFE_PSP_TARGETNAME}-impl PRIVATE + inc + $ +) + diff --git a/fsw/shared/CMakeLists.txt b/fsw/shared/CMakeLists.txt index 0f9ab127..05806af0 100644 --- a/fsw/shared/CMakeLists.txt +++ b/fsw/shared/CMakeLists.txt @@ -23,7 +23,11 @@ add_library(psp-${CFE_PSP_TARGETNAME}-shared OBJECT src/cfe_psp_ram.c ) +target_compile_definitions(psp-${CFE_SYSTEM_PSPNAME}-shared PRIVATE + $ +) + target_include_directories(psp-${CFE_PSP_TARGETNAME}-shared PRIVATE - $ + $ ) -target_link_libraries(psp-${CFE_PSP_TARGETNAME}-shared PRIVATE psp_module_api) + From 10c8b390cfe3c135ef2f6b825f5597239ffdf4a3 Mon Sep 17 00:00:00 2001 From: Jacob Hageman Date: Fri, 12 Mar 2021 13:57:09 -0500 Subject: [PATCH 08/10] IC 20210312, Update readme and version --- README.md | 7 ++++++- fsw/mcp750-vxworks/inc/psp_version.h | 2 +- fsw/pc-linux/inc/psp_version.h | 2 +- fsw/pc-rtems/inc/psp_version.h | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1da825a0..4d0f2dca 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,12 @@ This is a collection of APIs abstracting platform specific functionality to be l ## Version History -### Development Build: 1.5.0-rc1+dev76 +### Development Build: v1.5.0-rc1+dev80 + +- 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 diff --git a/fsw/mcp750-vxworks/inc/psp_version.h b/fsw/mcp750-vxworks/inc/psp_version.h index d48abdbb..81a169df 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 76 +#define CFE_PSP_IMPL_BUILD_NUMBER 80 #define CFE_PSP_IMPL_BUILD_BASELINE "v1.5.0-rc1" /* diff --git a/fsw/pc-linux/inc/psp_version.h b/fsw/pc-linux/inc/psp_version.h index 3c73e607..ec0ced14 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 76 +#define CFE_PSP_IMPL_BUILD_NUMBER 80 #define CFE_PSP_IMPL_BUILD_BASELINE "v1.5.0-rc1" /* diff --git a/fsw/pc-rtems/inc/psp_version.h b/fsw/pc-rtems/inc/psp_version.h index 09c40e4d..376e4efc 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 76 +#define CFE_PSP_IMPL_BUILD_NUMBER 80 #define CFE_PSP_IMPL_BUILD_BASELINE "v1.5.0-rc1" /* From 0f39a13538476ad6f46f4d84879aaf81ac256ad2 Mon Sep 17 00:00:00 2001 From: "Gerardo E. Cruz-Ortiz" <59618057+astrogeco@users.noreply.github.com> Date: Mon, 15 Mar 2021 16:38:40 -0400 Subject: [PATCH 09/10] Bump to v1.5.0-rc1+dev82 (#269) Update Readme, fix URL for IC-2021-03-12 entry in changelog --- README.md | 4 ++-- fsw/mcp750-vxworks/inc/psp_version.h | 2 +- fsw/pc-linux/inc/psp_version.h | 2 +- fsw/pc-rtems/inc/psp_version.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 4d0f2dca..a2aa689e 100644 --- a/README.md +++ b/README.md @@ -9,10 +9,10 @@ This is a collection of APIs abstracting platform specific functionality to be l ## Version History -### Development Build: v1.5.0-rc1+dev80 +### Development Build: v1.5.0-rc1+dev82 - HOTFIX 20210312, updates to work with older CMake -- See +- See ### Development Build: v1.5.0-rc1+dev76 diff --git a/fsw/mcp750-vxworks/inc/psp_version.h b/fsw/mcp750-vxworks/inc/psp_version.h index 81a169df..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 80 +#define CFE_PSP_IMPL_BUILD_NUMBER 82 #define CFE_PSP_IMPL_BUILD_BASELINE "v1.5.0-rc1" /* diff --git a/fsw/pc-linux/inc/psp_version.h b/fsw/pc-linux/inc/psp_version.h index ec0ced14..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 80 +#define CFE_PSP_IMPL_BUILD_NUMBER 82 #define CFE_PSP_IMPL_BUILD_BASELINE "v1.5.0-rc1" /* diff --git a/fsw/pc-rtems/inc/psp_version.h b/fsw/pc-rtems/inc/psp_version.h index 376e4efc..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 80 +#define CFE_PSP_IMPL_BUILD_NUMBER 82 #define CFE_PSP_IMPL_BUILD_BASELINE "v1.5.0-rc1" /* From 3d15b72c753ee5fe5391ba3bb2ce951eea61c5b5 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Tue, 9 Mar 2021 15:12:40 -0500 Subject: [PATCH 10/10] Fix #263, selectable eeprom implementation Use the PSP module feature to allow selection/override of EEPROM accessors. The current code is converted to an "eeprom_direct" module which is included only on platforms where it is valid (e.g. mcp750, no mmu). --- CMakeLists.txt | 24 +++++++++++++++++-- cmake/module_list.c.in | 12 ++++++++++ fsw/mcp750-vxworks/psp_module_list.cmake | 4 ++++ fsw/modules/eeprom_direct/CMakeLists.txt | 3 +++ .../eeprom_direct/cfe_psp_eeprom_direct.c} | 9 +++++++ .../cfe_psp_eeprom_mmap_file.c | 6 ++++- fsw/modules/eeprom_stub/cfe_psp_eeprom_stub.c | 3 ++- fsw/pc-linux/psp_module_list.cmake | 4 ++++ fsw/pc-rtems/psp_module_list.cmake | 4 ++++ fsw/shared/CMakeLists.txt | 1 - fsw/shared/inc/cfe_psp_module.h | 7 ++++++ fsw/shared/src/cfe_psp_module.c | 22 +++++++++++++---- .../ut-stubs/src/cfe-configdata-stubs.c | 2 ++ 13 files changed, 92 insertions(+), 9 deletions(-) create mode 100644 cmake/module_list.c.in create mode 100644 fsw/mcp750-vxworks/psp_module_list.cmake create mode 100644 fsw/modules/eeprom_direct/CMakeLists.txt rename fsw/{shared/src/cfe_psp_eeprom.c => modules/eeprom_direct/cfe_psp_eeprom_direct.c} (96%) create mode 100644 fsw/pc-linux/psp_module_list.cmake create mode 100644 fsw/pc-rtems/psp_module_list.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 5482b0ae..79bdb5bc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,19 +26,39 @@ target_include_directories(psp_module_api INTERFACE $ # 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 two parts, consisting of a fully platform-specific -# module combined with a shared component which is built for multiple targets. +# 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. 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 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/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/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/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/shared/CMakeLists.txt b/fsw/shared/CMakeLists.txt index 05806af0..b977467c 100644 --- a/fsw/shared/CMakeLists.txt +++ b/fsw/shared/CMakeLists.txt @@ -14,7 +14,6 @@ # 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 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/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 = { /**