Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration candidate: 2021-03-05 #260

Merged
merged 6 commits into from
Mar 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
$<TARGET_PROPERTY:osal,INTERFACE_INCLUDE_DIRECTORIES> # headers from OSAL
)

add_subdirectory(fsw/${CFE_PSP_TARGETNAME} ${CFE_PSP_TARGETNAME}-impl)
target_compile_definitions(psp-${CFE_PSP_TARGETNAME}-impl PUBLIC
$<TARGET_PROPERTY:osal,INTERFACE_COMPILE_DEFINITIONS> # defs from OSAL
)

add_subdirectory(fsw/shared ${CFE_PSP_TARGETNAME}-shared)
target_compile_definitions(psp-${CFE_PSP_TARGETNAME}-shared PUBLIC
$<TARGET_PROPERTY:osal,INTERFACE_COMPILE_DEFINITIONS> # defs from OSAL
)

add_library(psp-${CFE_PSP_TARGETNAME} STATIC
$<TARGET_OBJECTS:psp-${CFE_PSP_TARGETNAME}-shared>
$<TARGET_OBJECTS:psp-${CFE_PSP_TARGETNAME}-impl>
)


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)
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://github.com/nasa/PSP/pull/260>

### 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.
Expand Down
30 changes: 28 additions & 2 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
55 changes: 55 additions & 0 deletions fsw/inc/cfe_psp.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_ */
12 changes: 7 additions & 5 deletions fsw/inc/cfe_psp_configdata.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down
2 changes: 1 addition & 1 deletion fsw/mcp750-vxworks/inc/psp_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"

/*
Expand Down
2 changes: 1 addition & 1 deletion fsw/pc-linux/inc/psp_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"

/*
Expand Down
2 changes: 1 addition & 1 deletion fsw/pc-rtems/inc/psp_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"

/*
Expand Down
21 changes: 0 additions & 21 deletions fsw/pc-rtems/src/cfe_psp_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
83 changes: 83 additions & 0 deletions fsw/shared/src/cfe_psp_version.c
Original file line number Diff line number Diff line change
@@ -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 <cfe_psp.h>
#include <cfe_psp_configdata.h>

/*----------------------------------------------------------------
*
* 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;
}
85 changes: 85 additions & 0 deletions ut-stubs/ut_psp_stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}