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

cFE Integration candidate: Caelum-rc4+dev33 #2232

Merged
merged 8 commits into from
Dec 20, 2022
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Development Build: v7.0.0-rc4+dev242
- EDS Updates to match the current mainline
- Update UTs to use correct cmd types
- Move CRC types and convert to enum
- See <https://github.com/nasa/cFE/pull/2231>, <https://github.com/nasa/cFE/pull/2229>, and <https://github.com/nasa/cFE/pull/2192>

## Development Build: v7.0.0-rc4+dev233
- Replace CFE_MSG_CommandHeader_t w/ CFE_TBL_NoArgsCmd_t
- See <https://github.com/nasa/cFE/pull/2226>
Expand Down
21 changes: 12 additions & 9 deletions cmake/sample_defs/sample_mission_cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,14 +258,16 @@
*/
#define CFE_MISSION_EVS_MAX_MESSAGE_LENGTH 122

#ifndef CFE_OMIT_DEPRECATED_6_8
/* These names have been converted to an enum in cfe_es_api_typedefs.h */

/** \name Checksum/CRC algorithm identifiers */
/** \{ */
#define CFE_MISSION_ES_CRC_8 1 /**< \brief CRC ( 8 bit additive - returns 32 bit total) (Currently not implemented) */
#define CFE_MISSION_ES_CRC_16 2 /**< \brief CRC (16 bit additive - returns 32 bit total) */
#define CFE_MISSION_ES_CRC_32 \
3 /**< \brief CRC (32 bit additive - returns 32 bit total) (Currently not implemented) \
*/
/** \} */

#define CFE_MISSION_ES_CRC_8 CFE_ES_CrcType_CRC_8 /* 1 */
#define CFE_MISSION_ES_CRC_16 CFE_ES_CrcType_CRC_16 /* 2 */
#define CFE_MISSION_ES_CRC_32 CFE_ES_CrcType_CRC_32 /* 3 */

#endif

/**
** \cfeescfg Mission Default CRC algorithm
Expand All @@ -276,9 +278,10 @@
** Table Image data integrity values.
**
** \par Limits
** Currently only CFE_MISSION_ES_CRC_16 is supported (see #CFE_MISSION_ES_CRC_16)
** Currently only CFE_ES_CrcType_CRC_16 is supported (see brief in CFE_ES_CrcType_Enum
** definition in cfe_es_api_typedefs.h)
*/
#define CFE_MISSION_ES_DEFAULT_CRC CFE_MISSION_ES_CRC_16
#define CFE_MISSION_ES_DEFAULT_CRC CFE_ES_CrcType_CRC_16

/**
** \cfetblcfg Maximum Table Name Length
Expand Down
20 changes: 12 additions & 8 deletions docs/cFE Application Developers Guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -1293,24 +1293,28 @@ an API for a CRC calculation that can be used by all Applications on a mission.
This function looks like the following:

```c
uint32 CFE_ES_CalculateCRC(void *pData, uint32 DataLength, uint32 InputCRC, uint32 TypeCRC);
uint32 CFE_ES_CalculateCRC(const void *DataPtr, size_t DataLength, uint32 InputCRC, CFE_ES_CrcType_Enum_t TypeCRC);
```

where pData points to the first byte of an array of bytes that are to have
where DataPtr points to the first byte of an array of bytes that are to have
the CRC calculated on, DataLength specifies the number of sequential bytes to
include in the calculation, InputCRC is the initial value of the CRC and
TypeCRC identifies which of the standard CRC polynomials to be used. Currently,
there are the following types available:

```
CFE_MISSION_ES_CRC_8 – an 8-bit additive checksum calculation that returns a 32-bit value
CFE_MISSION_ES_CRC_16 – a 16-bit additive checksum calculation that returns a 32-bit value
CFE_MISSION_ES_CRC_32 – a 32-bit additive checksum calculation that returns a 32-bit value
CFE_MISSION_ES_DEFAULT_CRC – the mission specified default CRC calculation
CFE_ES_CrcType_CRC_8 – an 8-bit additive checksum calculation that returns a 32-bit value
CFE_ES_CrcType_CRC_16 – a 16-bit additive checksum calculation that returns a 32-bit value
CFE_ES_CrcType_CRC_32 – a 32-bit additive checksum calculation that returns a 32-bit value
CFE_MISSION_ES_DEFAULT_CRC – the mission specified default CRC calculation (currently
this is set to CFE_ES_CrcType_CRC_16 in sample_mission_cfg.h)
```

Unless there is a specific interface with a specified CRC calculation,
Applications must use the CFE_MISSION_ES_DEFAULT_CRC type.
Unless there is a specific interface with a specified CRC calculation, applications
must use the CFE_MISSION_ES_DEFAULT_CRC type.

Currently only CFE_ES_CrcType_CRC_16 is supported. CFE_ES_CrcType_CRC_8 and CFE_ES_CrcType_CRC_32 are yet
to be implemented.

## 5.11 File System Functions

Expand Down
85 changes: 85 additions & 0 deletions modules/cfe_testcase/eds/cfe_testcase.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--

GSC-18128-1, "Core Flight Executive Version 6.7"
LEW-19710-1, "CCSDS electronic data sheet implementation"

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.

This document adheres to the Electronic Data Sheet (EDS) XML schema
as prescribed in CCSDS book 876.0.

Purpose:
This describes all interface objects for the Executive Services (CFE_ES)
core application

-->
<PackageFile xmlns="http://www.ccsds.org/schema/sois/seds">
<Package name="CFE_TEST" shortDescription="CFE Functional Test (FT) Application Package">

<DataTypeSet>

<ContainerDataType name="TestTable" shortDescription="Example Table Definition">
<EntryList>
<Entry name="Int1" type="BASE_TYPES/uint16" shortDescription="Example integer 1" />
<Entry name="Int2" type="BASE_TYPES/uint16" shortDescription="Example integer 2" />
</EntryList>
</ContainerDataType>

<ContainerDataType name="TestCmd" baseType="CFE_HDR/CommandHeader" shortDescription="Test command message">
<EntryList>
<Entry name="CmdPayload" type="BASE_TYPES/uint64" shortDescription="Example Payload" />
</EntryList>
</ContainerDataType>

<ContainerDataType name="TestTlm" baseType="CFE_HDR/TelemetryHeader" shortDescription="Test housekeeping message">
<EntryList>
<Entry name="TlmPayload" type="BASE_TYPES/uint64" shortDescription="Example Payload" />
</EntryList>
</ContainerDataType>

</DataTypeSet>

<ComponentSet>
<Component name="Application">
<RequiredInterfaceSet>
<Interface name="CMD" shortDescription="Software bus telecommand interface" type="CFE_SB/Telecommand">
<GenericTypeMapSet>
<GenericTypeMap name="TelecommandDataType" type="TestCmd" />
</GenericTypeMapSet>
</Interface>
<Interface name="HK_TLM" shortDescription="Software bus housekeeping telemetry interface" type="CFE_SB/Telemetry">
<GenericTypeMapSet>
<GenericTypeMap name="TelemetryDataType" type="TestTlm" />
</GenericTypeMapSet>
</Interface>
</RequiredInterfaceSet>
<Implementation>
<VariableSet>
<Variable type="BASE_TYPES/uint16" readOnly="true" name="CmdTopicId" initialValue="${CFE_MISSION/TEST_CMD_TOPICID}" />
<Variable type="BASE_TYPES/uint16" readOnly="true" name="TlmTopicId" initialValue="${CFE_MISSION/TEST_HK_TLM_TOPICID}" />
</VariableSet>
<ParameterMapSet>
<ParameterMap interface="CMD" parameter="TopicId" variableRef="CmdTopicId" />
<ParameterMap interface="HK_TLM" parameter="TopicId" variableRef="TlmTopicId" />
</ParameterMapSet>
</Implementation>
</Component>
</ComponentSet>

</Package>
</PackageFile>
10 changes: 5 additions & 5 deletions modules/cfe_testcase/src/es_misc_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,19 @@ void TestCalculateCRC(void)
UtAssert_VOIDCALL(Result = CFE_ES_CalculateCRC(Data, sizeof(Data), 0, CFE_MISSION_ES_DEFAULT_CRC));
UtAssert_MIR("Confirm mission default CRC of \"%s\" is %lu", Data, (unsigned long)Result);

UtAssert_VOIDCALL(Result = CFE_ES_CalculateCRC(Data, sizeof(Data), inputCrc, CFE_MISSION_ES_CRC_16));
UtAssert_VOIDCALL(Result = CFE_ES_CalculateCRC(Data, sizeof(Data), inputCrc, CFE_ES_CrcType_CRC_16));
UtAssert_MIR("Confirm CRC16 of \"%s\" with input CRC of %lu is %lu", Data, (unsigned long)inputCrc,
(unsigned long)Result);

UtAssert_VOIDCALL(Result = CFE_ES_CalculateCRC(Data, sizeof(Data), 0, CFE_MISSION_ES_CRC_8));
UtAssert_VOIDCALL(Result = CFE_ES_CalculateCRC(Data, sizeof(Data), 0, CFE_ES_CrcType_CRC_8));
UtAssert_MIR("Confirm CRC8 of \"%s\" is %lu", Data, (unsigned long)Result);

UtAssert_VOIDCALL(Result = CFE_ES_CalculateCRC(Data, sizeof(Data), 0, CFE_MISSION_ES_CRC_32));
UtAssert_VOIDCALL(Result = CFE_ES_CalculateCRC(Data, sizeof(Data), 0, CFE_ES_CrcType_CRC_32));
UtAssert_MIR("Confirm CRC32 of \"%s\" is %lu", Data, (unsigned long)Result);

/* NULL input or 0 size returns input crc */
UtAssert_UINT32_EQ(CFE_ES_CalculateCRC(NULL, sizeof(Data), inputCrc, CFE_MISSION_ES_CRC_16), inputCrc);
UtAssert_UINT32_EQ(CFE_ES_CalculateCRC(Data, 0, inputCrc, CFE_MISSION_ES_CRC_16), inputCrc);
UtAssert_UINT32_EQ(CFE_ES_CalculateCRC(NULL, sizeof(Data), inputCrc, CFE_ES_CrcType_CRC_16), inputCrc);
UtAssert_UINT32_EQ(CFE_ES_CalculateCRC(Data, 0, inputCrc, CFE_ES_CrcType_CRC_16), inputCrc);
}

void TestWriteToSysLog(void)
Expand Down
38 changes: 0 additions & 38 deletions modules/core_api/eds/base_types.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,44 +102,6 @@
<StringDataType name="ApiName" length="${CFE_MISSION/MAX_API_LEN}" />
<StringDataType name="PathName" length="${CFE_MISSION/MAX_PATH_LEN}" />

<!--
CPU memory addresses in messages can be either 32 or 64 bits.
This depends on specific CPUs in use, but it should be consistent
across all cpus.
-->
<IntegerDataType name="CpuAddress" shortDescription="CPU memory address">
<IntegerDataEncoding sizeInBits="${CFE_MISSION/MAX_CPU_ADDRESS_SIZE} * 8" encoding="unsigned" byteOrder="${CFE_MISSION/DATA_BYTE_ORDER}" />
<Range>
<MinMaxRange max="2 ^ (8 * ${CFE_MISSION/MAX_CPU_ADDRESS_SIZE})" min="0" rangeType="inclusiveMinExclusiveMax"/>
</Range>
</IntegerDataType>

<!--
The following data types are a test/example of how 20-bit microseconds
can be used in outgoing telemetry packets. It defines a container with
a 20 bit "Micros" field followed by 12 bits of padding to create 32 bits.
If this is desired then two configuration parameters need to change:
- Set the 'TELEMETRY_SUBSECONDS_TYPE' EDS directive
- Set the 'CFE_SB_PACKET_TIME_SUBSECONDS_UNITS' config directive
And uncomment these types...


<IntegerDataType name="MicrosecondsValue">
<IntegerDataEncoding sizeInBits="20" encoding="unsigned" />
</IntegerDataType>
<IntegerDataType name="MicrosecondsPad">
<IntegerDataEncoding sizeInBits="12" encoding="unsigned" />
</IntegerDataType>

<ContainerDataType name="TlmMicrosecs">
<EntryList>
<Entry name="Micros" type="MicrosecondsValue" />
<Entry name="Pad" type="MicrosecondsPad" />
</EntryList>
</ContainerDataType>

-->

</DataTypeSet>

</Package>
Expand Down
8 changes: 4 additions & 4 deletions modules/core_api/fsw/inc/cfe_es.h
Original file line number Diff line number Diff line change
Expand Up @@ -999,20 +999,20 @@ CFE_Status_t CFE_ES_WriteToSysLog(const char *SpecStringPtr, ...) OS_PRINTF(1, 2
** a single value. Nominally, the user should set this value to zero.
**
** \param[in] TypeCRC One of the following CRC algorithm selections:
** \arg \c CFE_MISSION_ES_CRC_8 - (Not currently implemented)
** \arg \c CFE_MISSION_ES_CRC_16 - CRC-16/ARC <BR>
** \arg \c CFE_ES_CrcType_CRC_8 - (Not currently implemented)
** \arg \c CFE_ES_CrcType_CRC_16 - CRC-16/ARC <BR>
** Polynomial: 0x8005 <BR>
** Initialization: 0x0000 <BR>
** Reflect Input/Output: true <BR>
** XorOut: 0x0000
** \arg \c CFE_MISSION_ES_CRC_32 - (not currently implemented)
** \arg \c CFE_ES_CrcType_CRC_32 - (not currently implemented)
**
** \return The result of the CRC calculation on the specified memory block.
** If the TypeCRC is unimplemented will return 0.
** If DataPtr is null or DataLength is 0, will return InputCRC
**
******************************************************************************/
uint32 CFE_ES_CalculateCRC(const void *DataPtr, size_t DataLength, uint32 InputCRC, uint32 TypeCRC);
uint32 CFE_ES_CalculateCRC(const void *DataPtr, size_t DataLength, uint32 InputCRC, CFE_ES_CrcType_Enum_t TypeCRC);

/*****************************************************************************/
/**
Expand Down
12 changes: 12 additions & 0 deletions modules/core_api/fsw/inc/cfe_es_api_typedefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,18 @@ typedef CFE_ES_TaskEntryFuncPtr_t CFE_ES_ChildTaskMainFuncPtr_t;
*/
typedef void *CFE_ES_StackPointer_t; /* aka osal_stackptr_t in proposed OSAL change */

/**
* \brief Checksum/CRC algorithm identifiers
*
* Currently only CFE_ES_CrcType_CRC_16 is supported.
*/
typedef enum CFE_ES_CrcType_Enum
{
CFE_ES_CrcType_CRC_8 = 1, /**< \brief CRC ( 8 bit additive - returns 32 bit total) (Not currently implemented) */
CFE_ES_CrcType_CRC_16 = 2, /**< \brief CRC (16 bit additive - returns 32 bit total) */
CFE_ES_CrcType_CRC_32 = 3 /**< \brief CRC (32 bit additive - returns 32 bit total) (Not currently implemented) */
} CFE_ES_CrcType_Enum_t;

/**
* \brief Pool Alignment
*
Expand Down
2 changes: 1 addition & 1 deletion modules/core_api/fsw/inc/cfe_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#define CFE_VERSION_H

/* Development Build Macro Definitions */
#define CFE_BUILD_NUMBER 233 /**< @brief Development: Number of development git commits since CFE_BUILD_BASELINE */
#define CFE_BUILD_NUMBER 242 /**< @brief Development: Number of development git commits since CFE_BUILD_BASELINE */
#define CFE_BUILD_BASELINE "v7.0.0-rc4" /**< @brief Development: Reference git tag for build number */

/* See \ref cfsversions for definitions */
Expand Down
4 changes: 2 additions & 2 deletions modules/core_api/ut-stubs/src/cfe_es_stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ void CFE_ES_BackgroundWakeup(void)
* Generated stub function for CFE_ES_CalculateCRC()
* ----------------------------------------------------
*/
uint32 CFE_ES_CalculateCRC(const void *DataPtr, size_t DataLength, uint32 InputCRC, uint32 TypeCRC)
uint32 CFE_ES_CalculateCRC(const void *DataPtr, size_t DataLength, uint32 InputCRC, CFE_ES_CrcType_Enum_t TypeCRC)

Check notice

Code scanning / CodeQL-coding-standard

Long function without assertion

All functions of more than 10 lines should have at least one assertion.

Check notice

Code scanning / CodeQL-coding-standard

Function too long

CFE_ES_CalculateCRC has too many lines (69, while 60 are allowed).
{
UT_GenStub_SetupReturnBuffer(CFE_ES_CalculateCRC, uint32);

UT_GenStub_AddParam(CFE_ES_CalculateCRC, const void *, DataPtr);
UT_GenStub_AddParam(CFE_ES_CalculateCRC, size_t, DataLength);
UT_GenStub_AddParam(CFE_ES_CalculateCRC, uint32, InputCRC);
UT_GenStub_AddParam(CFE_ES_CalculateCRC, uint32, TypeCRC);
UT_GenStub_AddParam(CFE_ES_CalculateCRC, CFE_ES_CrcType_Enum_t, TypeCRC);

UT_GenStub_Execute(CFE_ES_CalculateCRC, Basic, NULL);

Expand Down
Loading