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

Fix #345, Add CFE_PSP_StatusToString and CFE_PSP_STATUS_C #347

Merged
merged 1 commit into from
Jun 22, 2022

Conversation

skliper
Copy link
Contributor

@skliper skliper commented Jun 6, 2022

Checklist (Please check before submitting)

Describe the contribution

Testing performed
Added a few calls in cFE startup to exercise the function and it worked. PSP coverage for shared doesn't look to be fully implemented so didn't add tests yet.

Expected behavior changes
None, just adds an a useful API

System(s) tested on

  • Hardware: i5/wsl
  • OS: Ubuntu 18.04
  • Versions: Bundle main + this change + a few calls to exercise the new PSP API
diff --git a/modules/es/fsw/src/cfe_es_start.c b/modules/es/fsw/src/cfe_es_start.c
index f90a248..9aef09c 100644
--- a/modules/es/fsw/src/cfe_es_start.c
+++ b/modules/es/fsw/src/cfe_es_start.c
@@ -36,6 +36,7 @@
 */

 #include "cfe_es_module_all.h"
+#include "cfe_psp.h"

 #include <stdio.h>
 #include <string.h>
@@ -255,6 +256,12 @@ void CFE_ES_SetupResetVariables(uint32 StartType, uint32 StartSubtype, uint32 Bo
     */
     PspStatus = CFE_PSP_GetResetArea(&ResetDataAddr, &resetAreaSize);

+    CFE_PSP_StatusString_t pspstatusstring;
+    OS_printf("TEST_PSP_STATUS: success %s\n", *CFE_PSP_StatusToString(PspStatus, &pspstatusstring));
+    OS_printf("TEST_PSP_STATUS: error %s\n", *CFE_PSP_StatusToString(CFE_PSP_ERROR, &pspstatusstring));
+    OS_printf("TEST_PSP_STATUS: error %s\n", *CFE_PSP_StatusToString(INT32_MAX, &pspstatusstring));
+    OS_printf("TEST_PSP_STATUS: error %s\n", *CFE_PSP_StatusToString(INT32_MIN, &pspstatusstring));
+
     /*
     ** Make sure the status is OK or size is big enough
     */

Additional context
None

Third party code
None

Contributor Info - All information REQUIRED for consideration of pull request
Jacob Hageman - NASA/GSFC

@skliper skliper added the CCB:Ready Pull request is ready for discussion at the Configuration Control Board (CCB) label Jun 6, 2022
fsw/shared/src/cfe_psp_error.c Fixed Show fixed Hide fixed
fsw/shared/src/cfe_psp_error.c Fixed Show fixed Hide fixed
fsw/shared/src/cfe_psp_error.c Fixed Show fixed Hide fixed
fsw/shared/src/cfe_psp_error.c Fixed Show fixed Hide fixed
fsw/shared/src/cfe_psp_error.c Fixed Show fixed Hide fixed
@skliper skliper added this to the Draco milestone Jun 6, 2022
@skliper skliper force-pushed the fix345-add_statustostring branch from 605ec72 to 9a0554b Compare June 6, 2022 23:21

if (status_string != NULL)
{
snprintf(*status_string, sizeof(*status_string), "%ld", (long)status);

Check warning

Code scanning / CodeQL-coding-standard

Unchecked return value

The return value of non-void function [snprintf](1) is not checked.

if (status_string != NULL)
{
snprintf(*status_string, sizeof(*status_string), "%ld", (long)status);

Check warning

Code scanning / CodeQL-coding-standard

Unchecked function argument

This use of parameter status has not been checked.
* See description in API and header file for detail
*
*-----------------------------------------------------------------*/
char *CFE_PSP_StatusToString(CFE_PSP_Status_t status, CFE_PSP_StatusString_t *status_string)

Check notice

Code scanning / CodeQL-coding-standard

Use of basic integral type

CFE_PSP_StatusToString uses the basic integral type char rather than a typedef with size and signedness.
* See description in API and header file for detail
*
*-----------------------------------------------------------------*/
char *CFE_PSP_StatusToString(CFE_PSP_Status_t status, CFE_PSP_StatusString_t *status_string)

Check notice

Code scanning / CodeQL-coding-standard

Use of basic integral type

status uses the basic integral type signed int rather than a typedef with size and signedness.
* See description in API and header file for detail
*
*-----------------------------------------------------------------*/
char *CFE_PSP_StatusToString(CFE_PSP_Status_t status, CFE_PSP_StatusString_t *status_string)

Check notice

Code scanning / CodeQL-coding-standard

Use of basic integral type

status_string uses the basic integral type char rather than a typedef with size and signedness.
*-----------------------------------------------------------------*/
char *CFE_PSP_StatusToString(CFE_PSP_Status_t status, CFE_PSP_StatusString_t *status_string)
{
char *string = NULL;

Check notice

Code scanning / CodeQL-coding-standard

Use of basic integral type

string uses the basic integral type char rather than a typedef with size and signedness.
@astrogeco
Copy link
Contributor

CCB:2022-06-08 APPROVED

@astrogeco astrogeco added CCB:Approved Indicates Approval by CCB and removed CCB:Ready Pull request is ready for discussion at the Configuration Control Board (CCB) labels Jun 8, 2022
astrogeco added a commit to nasa/cFS that referenced this pull request Jun 10, 2022
nasa/PSP#347, Add CFE_PSP_StatusToString and CFE_PSP_STATUS_C
astrogeco added a commit to nasa/cFS that referenced this pull request Jun 22, 2022
*Combines:*

cFE  v7.0.0-rc4+dev143
osal osal v6.0.0-rc4+dev87
psp v1.6.0-rc4+dev

ci_lab v2.5.0-rc4+dev22
to_lab v2.5.0-rc4+dev21
sample_app v1.3.0-rc4+dev21

**Includes:**

- nasa/cFE#2119, Endian macro mask before shift to avoid shift overflow warning
- nasa/cFE#2115, Add macro for initializing command header

*Add StatusToString API*
- nasa/osal#1259, Add OS_StatusToString API
- nasa/PSP#347, Add CFE_PSP_StatusToString and CFE_PSP_STATUS_C
- nasa/cFE#2113, Add CFE_ES_StatusToString and CFE_STATUS_C

*Remove registration of empty EVS filters*
- nasa/ci_lab#111, Remove registration of empty EVS filters
- nasa/to_lab#122, Remove registration of empty EVS filters
- nasa/sample_app#175, Remove registration of empty event filters
astrogeco added a commit to nasa/cFS that referenced this pull request Jun 22, 2022
*Combines:*

cFE  v7.0.0-rc4+dev143
osal osal v6.0.0-rc4+dev87
psp v1.6.0-rc4+dev

ci_lab v2.5.0-rc4+dev22
to_lab v2.5.0-rc4+dev21
sample_app v1.3.0-rc4+dev21

**Includes:**

- nasa/cFE#2119, Endian macro mask before shift to avoid shift overflow warning
- nasa/cFE#2115, Add macro for initializing command header

*Add StatusToString API*
- nasa/osal#1259, Add OS_StatusToString API
- nasa/PSP#347, Add CFE_PSP_StatusToString and CFE_PSP_STATUS_C
- nasa/cFE#2113, Add CFE_ES_StatusToString and CFE_STATUS_C

*Remove registration of empty EVS filters*
- nasa/ci_lab#111, Remove registration of empty EVS filters
- nasa/to_lab#122, Remove registration of empty EVS filters
- nasa/sample_app#175, Remove registration of empty event filters

Co-authored-by: Jacob Hageman <[email protected]>
@astrogeco astrogeco merged commit aa25819 into nasa:main Jun 22, 2022
@skliper skliper deleted the fix345-add_statustostring branch September 19, 2022 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CCB:Approved Indicates Approval by CCB
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add PSP_Status_t and associated macros/wrappers/APIs
2 participants