Skip to content

Commit c8b5e00

Browse files
authored
Merge pull request #1431 from nasa/integration-candidate
cFE Integration candidate: 2021-04-27
2 parents 73c338d + c9735e5 commit c8b5e00

30 files changed

+562
-147
lines changed

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,27 @@ The detailed cFE user's guide can be viewed at <https://github.com/nasa/cFS/blob
1010

1111
## Version History
1212

13+
### Development Build: v6.8.0-rc1+dev540
14+
15+
16+
- Changes the type of pointer for `MemPtr` in `CFE_ES_PoolCreateNoSem` API from uint8* to void* to be more consistent and easier to use. Should be backward compatible.
17+
Updates the doxygen documentation for this parameter, as it was incorrectly specifying a 32-bit alignment requirement.
18+
- Adds new functional tests for ES Child Task API. Does not check edge cases. Fixed spelling mistake in `UtAssert_ResourceID_Undifeined` name
19+
- Removes BUILDDIR reference and an old comment. No behavior changes
20+
- Moves and renames `cfe_resourceid_basevalue.h` to `cfe_resourceid_basevalue.h`. Since it is is assumed/required that resource IDs follow the "osal compatible" pattern. Perhaps in a future version this could change, but
21+
- Ensures that the `CFE_SUCCESS` constant is of the `CFE_Status_t` type. Since an explicit cast is required on all error codes that are expected to be negative values.
22+
- Removes unused error codes: `CFE_ES_ERR_SHELL_CMD` and `CFE_SB_NO_MSG_RECV`. No impact to behavior.
23+
- When a startup file has a line with too many tokens the build script will generate a concise warning including an indicator of which line is causing the problem.
24+
- Confirm that the call to `CFE_ES_CDS_CachePreload` returns `CFE_SUCCESS` before continuing. No behavior changes. Now shows up as untested lines in the coverage report since error condition cannot be exercised through coverage.
25+
- [docs] Clarify that `CFE_ES_DeleteCDS` does not wipe or erase the block, it only returns resources to the pool for re-use.
26+
- [docs] Adds comments in `CFE_ES_RunExceptionScan` describing the logic when an exception cannot be traced back to a specific app, in that it should fall back to the PSP reset.
27+
- `CFE_ES_GenPoolInitialize` now returns ` CFE_ES_BAD_ARGUMENT` error if the `AlignSize` passed-in value is not actually a power of two instead of "fixing" the alignment mask,
28+
- Replace internal `CFE_ES_SYSLOG_APPEND` macro with the `CFE_ES_WriteToSysLog()` API since coding standards discourage use of multi-line macros.
29+
- [docs] Improve Resource IDs documentation. Specifically on use of the various helper functions and common patterns Documents that the "IsMatch()" functions accept NULL pointers so they can be used with initial validation (gatekeeper). All other helper functions assume a non-NULL pointer.
30+
- Compiler will catch if the `CFE_RESOURCEID_MAX` value changes in such a way that makes it not usable as a bit mask as intended. Add a compile time assert to ensure that `CFE_RESOURCEID_MAX` value is one less than a power of two (i.e. an LSB-justified bit mask). Notes in the comments that it serves as both a numeric limit and a mask.
31+
- See <https://github.com/nasa/cFE/pull/1431> and <https://github.com/nasa/cFS/pull/250>
32+
33+
1334
### Development Build: v6.8.0-rc1+dev509
1435

1536
- Separates the list of CFE core interface modules (e.g. core_api) from the list of CFE core implementation modules (e.g. msg). This allows the content of core_api to be expanded to locally include any additional modules the user has added to cFE core via the `MISSION_CORE_MODULES` list.

cmake/Makefile.sample

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# Core Flight Software CMake / GNU make wrapper
33
#
44
# ABOUT THIS MAKEFILE:
5-
# This is actually part of the CMake alternative build system.
65
# It is a GNU-make wrapper that calls the CMake tools appropriately
76
# so that setting up a new build is fast and easy with no need to
87
# learn the CMake commands. It also makes it easier to integrate
@@ -124,7 +123,7 @@ install:
124123

125124
prep $(O)/.prep:
126125
mkdir -p "$(O)"
127-
(cd "$(O)/$(BUILDDIR)" && cmake $(PREP_OPTS) "$(CURDIR)/cfe")
126+
(cd "$(O)" && cmake $(PREP_OPTS) "$(CURDIR)/cfe")
128127
echo "$(PREP_OPTS)" > "$(O)/.prep"
129128

130129
clean:

cmake/sample_defs/cpu1_cfe_es_startup.scr

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,3 @@ CFE_APP, sch_lab, SCH_Lab_AppMain, SCH_LAB_APP, 80, 16384, 0x0, 0;
3131
! 3. The filename field (2) no longer requires a fully-qualified filename; the path and extension
3232
! may be omitted. If omitted, the standard virtual path (/cf) and a platform-specific default
3333
! extension will be used, which is derived from the build system.
34-

modules/cfe_testcase/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
add_cfe_app(cfe_testcase
44
src/cfe_test.c
55
src/es_info_test.c
6+
src/es_task_test.c
67
)
78

89
# register the dependency on cfe_assert

modules/cfe_testcase/src/cfe_test.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ void CFE_TestMain(void)
5151
* Register test cases in UtAssert
5252
*/
5353
ESInfoTestSetup();
54+
ESTaskTestSetup();
5455

5556
/*
5657
* Execute the tests

modules/cfe_testcase/src/cfe_test.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,11 @@
4949
CFE_RESOURCEID_TO_ULONG(actual), #expect, CFE_RESOURCEID_TO_ULONG(expect))
5050

5151
/* Check if a Resource ID is Undefined */
52-
#define UtAssert_ResourceID_Undifeined(id) \
52+
#define UtAssert_ResourceID_Undefined(id) \
5353
UtAssert_True(!CFE_RESOURCEID_TEST_DEFINED(id), "%s (%lu) not defined", #id, CFE_RESOURCEID_TO_ULONG(id))
5454

5555
void CFE_TestMain(void);
5656
void ESInfoTestSetup(void);
57+
void ESTaskTestSetup(void);
5758

5859
#endif /* CFE_TEST_H */

modules/cfe_testcase/src/es_info_test.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ void TestAppInfo(void)
122122
UtAssert_True(ESAppInfo.NumOfChildTasks > 0, "ES App Info -> Child Tasks = %d", (int)ESAppInfo.NumOfChildTasks);
123123

124124
UtAssert_INT32_EQ(CFE_ES_GetAppIDByName(&AppIdByName, INVALID_APP_NAME), CFE_ES_ERR_NAME_NOT_FOUND);
125-
UtAssert_ResourceID_Undifeined(AppIdByName);
125+
UtAssert_ResourceID_Undefined(AppIdByName);
126126
UtAssert_INT32_EQ(CFE_ES_GetAppID(NULL), CFE_ES_BAD_ARGUMENT);
127127
UtAssert_INT32_EQ(CFE_ES_GetAppIDByName(NULL, TEST_EXPECTED_APP_NAME), CFE_ES_BAD_ARGUMENT);
128128
UtAssert_INT32_EQ(CFE_ES_GetAppName(AppNameBuf, CFE_ES_APPID_UNDEFINED, sizeof(AppNameBuf)),
@@ -205,7 +205,7 @@ void TestLibInfo(void)
205205

206206
UtAssert_INT32_EQ(LibInfo.ExceptionAction, 0);
207207
UtAssert_True(LibInfo.Priority == 0, "Lib Info -> Priority = %d", (int)LibInfo.Priority);
208-
UtAssert_ResourceID_Undifeined(LibInfo.MainTaskId);
208+
UtAssert_ResourceID_Undefined(LibInfo.MainTaskId);
209209
UtAssert_True(LibInfo.ExecutionCounter == 0, "Lib Info -> ExecutionCounter = %d", (int)LibInfo.ExecutionCounter);
210210
UtAssert_True(strlen(LibInfo.MainTaskName) == 0, "Lib Info -> Task Name = %s", LibInfo.MainTaskName);
211211
UtAssert_True(LibInfo.NumOfChildTasks == 0, "Lib Info -> Child Tasks = %d", (int)LibInfo.NumOfChildTasks);
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
/*************************************************************************
2+
**
3+
** GSC-18128-1, "Core Flight Executive Version 6.7"
4+
**
5+
** Copyright (c) 2006-2019 United States Government as represented by
6+
** the Administrator of the National Aeronautics and Space Administration.
7+
** All Rights Reserved.
8+
**
9+
** Licensed under the Apache License, Version 2.0 (the "License");
10+
** you may not use this file except in compliance with the License.
11+
** You may obtain a copy of the License at
12+
**
13+
** http://www.apache.org/licenses/LICENSE-2.0
14+
**
15+
** Unless required by applicable law or agreed to in writing, software
16+
** distributed under the License is distributed on an "AS IS" BASIS,
17+
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18+
** See the License for the specific language governing permissions and
19+
** limitations under the License.
20+
**
21+
** File: es_task_test.c
22+
**
23+
** Purpose:
24+
** Functional test of basic ES Child Tasks APIs
25+
**
26+
** Demonstration of how to register and use the UT assert functions.
27+
**
28+
*************************************************************************/
29+
30+
/*
31+
* Includes
32+
*/
33+
34+
#include "cfe_test.h"
35+
36+
uint32 count = 0;
37+
38+
void TaskFunction(void)
39+
{
40+
while (count < 200)
41+
{
42+
count += 1;
43+
OS_TaskDelay(100);
44+
}
45+
return;
46+
}
47+
48+
void TaskExitFunction(void)
49+
{
50+
while (count < 200)
51+
{
52+
count += 1;
53+
CFE_ES_ExitChildTask();
54+
}
55+
return;
56+
}
57+
58+
void TestCreateChild(void)
59+
{
60+
UtPrintf("Testing: CFE_ES_CreateChildTask, CFE_ES_GetTaskIDByName, CFE_ES_GetTaskName, CFE_ES_DeleteChildTask");
61+
62+
CFE_ES_TaskId_t TaskId;
63+
const char * TaskName = "CHILD_TASK_1";
64+
CFE_ES_TaskId_t TaskIdByName;
65+
char TaskNameBuf[OS_MAX_API_NAME + 4];
66+
CFE_ES_StackPointer_t StackPointer = CFE_ES_TASK_STACK_ALLOCATE;
67+
size_t StackSize = CFE_PLATFORM_ES_PERF_CHILD_STACK_SIZE;
68+
CFE_ES_TaskPriority_Atom_t Priority = CFE_PLATFORM_ES_PERF_CHILD_PRIORITY;
69+
uint32 Flags = 0;
70+
int countCopy;
71+
72+
UtAssert_INT32_EQ(CFE_ES_CreateChildTask(&TaskId, TaskName, TaskFunction, StackPointer, StackSize, Priority, Flags),
73+
CFE_SUCCESS);
74+
75+
UtAssert_INT32_EQ(CFE_ES_GetTaskIDByName(&TaskIdByName, TaskName), CFE_SUCCESS);
76+
UtAssert_ResourceID_EQ(TaskIdByName, TaskId);
77+
78+
UtAssert_INT32_EQ(CFE_ES_GetTaskName(TaskNameBuf, TaskId, sizeof(TaskNameBuf)), CFE_SUCCESS);
79+
UtAssert_StrCmp(TaskNameBuf, TaskName, "CFE_ES_GetTaskName() = %s", TaskNameBuf);
80+
81+
OS_TaskDelay(500);
82+
83+
countCopy = count;
84+
85+
UtAssert_INT32_EQ(CFE_ES_DeleteChildTask(TaskId), CFE_SUCCESS);
86+
87+
OS_TaskDelay(500);
88+
89+
UtAssert_True(countCopy == count || countCopy == count + 1, "countCopy (%d) == count (%d)", countCopy, count);
90+
}
91+
92+
void TestExitChild(void)
93+
{
94+
UtPrintf("Testing: CFE_ES_ExitChildTask");
95+
96+
CFE_ES_TaskId_t TaskId;
97+
const char * TaskName = "CHILD_TASK_1";
98+
CFE_ES_StackPointer_t StackPointer = CFE_ES_TASK_STACK_ALLOCATE;
99+
size_t StackSize = CFE_PLATFORM_ES_PERF_CHILD_STACK_SIZE;
100+
CFE_ES_TaskPriority_Atom_t Priority = CFE_PLATFORM_ES_PERF_CHILD_PRIORITY;
101+
uint32 Flags = 0;
102+
count = 0;
103+
104+
UtAssert_INT32_EQ(
105+
CFE_ES_CreateChildTask(&TaskId, TaskName, TaskExitFunction, StackPointer, StackSize, Priority, Flags),
106+
CFE_SUCCESS);
107+
OS_TaskDelay(500);
108+
UtAssert_INT32_EQ(count, 1);
109+
}
110+
111+
void ESTaskTestSetup(void)
112+
{
113+
UtTest_Add(TestCreateChild, NULL, NULL, "Test Create Child");
114+
UtTest_Add(TestExitChild, NULL, NULL, "Test Exit Child");
115+
}

modules/core_api/fsw/inc/cfe_error.h

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ typedef int32 CFE_Status_t;
117117
*
118118
* Operation was performed successfully
119119
*/
120-
#define CFE_SUCCESS (0)
120+
#define CFE_SUCCESS ((CFE_Status_t)0)
121121

122122
/**
123123
* @brief No Counter Increment
@@ -347,14 +347,6 @@ typedef int32 CFE_Status_t;
347347
*/
348348
#define CFE_ES_ERR_CHILD_TASK_REGISTER ((CFE_Status_t)0xc400000b)
349349

350-
/**
351-
* @brief Shell Command Error
352-
*
353-
* Error occured ehen trying to pass a system call to the OS shell
354-
*
355-
*/
356-
#define CFE_ES_ERR_SHELL_CMD ((CFE_Status_t)0xc400000c)
357-
358350
/**
359351
* @brief CDS Already Exists
360352
*
@@ -825,15 +817,6 @@ typedef int32 CFE_Status_t;
825817
*/
826818
#define CFE_SB_BUFFER_INVALID ((CFE_Status_t)0xca00000e)
827819

828-
/**
829-
* @brief No Message Recieved
830-
*
831-
* When trying to determine the last senders ID, this return
832-
* value indicates that there was not a message recived on the pipe.
833-
*
834-
*/
835-
#define CFE_SB_NO_MSG_RECV ((CFE_Status_t)0xca00000f)
836-
837820
/**
838821
* @brief Not Implemented
839822
*

modules/core_api/fsw/inc/cfe_es.h

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,10 +1184,12 @@ CFE_Status_t CFE_ES_RestoreFromCDS(void *RestoreToMemory, CFE_ES_CDSHandle_t Han
11841184
** \param[in, out] PoolID A pointer to the variable the caller wishes to have the memory pool handle kept in.
11851185
** PoolID is the memory pool handle.
11861186
**
1187-
** \param[in] MemPtr A Pointer to the pool of memory created by the calling application. This address must
1188-
** be on a 32-bit boundary.
1187+
** \param[in] MemPtr A Pointer to the pool of memory created by the calling application. This address must
1188+
** be aligned suitably for the processor architecture. The #CFE_ES_STATIC_POOL_TYPE
1189+
** macro may be used to assist in creating properly aligned memory pools.
11891190
**
1190-
** \param[in] Size The size of the pool of memory. Note that this must be an integral number of 32 bit words.
1191+
** \param[in] Size The size of the pool of memory. Note that this must be an integral multiple of the
1192+
** memory alignment of the processor architecture.
11911193
**
11921194
** \return Execution status, see \ref CFEReturnCodes
11931195
** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS
@@ -1196,7 +1198,7 @@ CFE_Status_t CFE_ES_RestoreFromCDS(void *RestoreToMemory, CFE_ES_CDSHandle_t Han
11961198
** \sa #CFE_ES_PoolCreate, #CFE_ES_PoolCreateEx, #CFE_ES_GetPoolBuf, #CFE_ES_PutPoolBuf, #CFE_ES_GetMemPoolStats
11971199
**
11981200
******************************************************************************/
1199-
CFE_Status_t CFE_ES_PoolCreateNoSem(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, size_t Size);
1201+
CFE_Status_t CFE_ES_PoolCreateNoSem(CFE_ES_MemHandle_t *PoolID, void *MemPtr, size_t Size);
12001202

12011203
/*****************************************************************************/
12021204
/**
@@ -1214,10 +1216,12 @@ CFE_Status_t CFE_ES_PoolCreateNoSem(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, s
12141216
** \param[in, out] PoolID A pointer to the variable the caller wishes to have the memory pool handle kept in.
12151217
** PoolID is the memory pool handle.
12161218
**
1217-
** \param[in] MemPtr A Pointer to the pool of memory created by the calling application. This address must
1218-
** be on a 32-bit boundary.
1219+
** \param[in] MemPtr A Pointer to the pool of memory created by the calling application. This address must
1220+
** be aligned suitably for the processor architecture. The #CFE_ES_STATIC_POOL_TYPE
1221+
** macro may be used to assist in creating properly aligned memory pools.
12191222
**
1220-
** \param[in] Size The size of the pool of memory. Note that this must be an integral number of 32 bit words.
1223+
** \param[in] Size The size of the pool of memory. Note that this must be an integral multiple of the
1224+
** memory alignment of the processor architecture.
12211225
**
12221226
** \return Execution status, see \ref CFEReturnCodes
12231227
** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS
@@ -1226,7 +1230,7 @@ CFE_Status_t CFE_ES_PoolCreateNoSem(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, s
12261230
** \sa #CFE_ES_PoolCreateNoSem, #CFE_ES_PoolCreateEx, #CFE_ES_GetPoolBuf, #CFE_ES_PutPoolBuf, #CFE_ES_GetMemPoolStats
12271231
**
12281232
******************************************************************************/
1229-
CFE_Status_t CFE_ES_PoolCreate(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, size_t Size);
1233+
CFE_Status_t CFE_ES_PoolCreate(CFE_ES_MemHandle_t *PoolID, void *MemPtr, size_t Size);
12301234

12311235
/*****************************************************************************/
12321236
/**
@@ -1240,14 +1244,15 @@ CFE_Status_t CFE_ES_PoolCreate(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, size_t
12401244
** -# The start address of the pool must be 32-bit aligned
12411245
** -# 168 bytes are used for internal bookkeeping, therefore, they will not be available for allocation.
12421246
**
1243-
** \param[in, out] PoolID A pointer to the variable the caller wishes to have the memory pool handle kept in.
1244-
** PoolID is the memory pool handle.
1247+
** \param[in, out] PoolID A pointer to the variable the caller wishes to have the memory pool handle kept in.
1248+
** PoolID is the memory pool handle.
12451249
**
12461250
** \param[in] MemPtr A Pointer to the pool of memory created by the calling application. This address must
1247-
** be on a 32-bit boundary.
1251+
** be aligned suitably for the processor architecture. The #CFE_ES_STATIC_POOL_TYPE
1252+
** macro may be used to assist in creating properly aligned memory pools.
12481253
**
1249-
** \param[in] Size The size of the pool of memory. Note that this must be an integral number of 32 bit
1250-
** words.
1254+
** \param[in] Size The size of the pool of memory. Note that this must be an integral multiple of the
1255+
** memory alignment of the processor architecture.
12511256
**
12521257
** \param[in] NumBlockSizes The number of different block sizes specified in the \c BlockSizes array. If set equal to
12531258
** zero or if greater than 17, then default block sizes are used.
@@ -1266,7 +1271,7 @@ CFE_Status_t CFE_ES_PoolCreate(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, size_t
12661271
** \sa #CFE_ES_PoolCreate, #CFE_ES_PoolCreateNoSem, #CFE_ES_GetPoolBuf, #CFE_ES_PutPoolBuf, #CFE_ES_GetMemPoolStats
12671272
**
12681273
******************************************************************************/
1269-
CFE_Status_t CFE_ES_PoolCreateEx(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, size_t Size, uint16 NumBlockSizes,
1274+
CFE_Status_t CFE_ES_PoolCreateEx(CFE_ES_MemHandle_t *PoolID, void *MemPtr, size_t Size, uint16 NumBlockSizes,
12701275
const size_t *BlockSizes, bool UseMutex);
12711276

12721277
/*****************************************************************************/

0 commit comments

Comments
 (0)