Skip to content

Commit

Permalink
Merge pull request #1431 from nasa/integration-candidate
Browse files Browse the repository at this point in the history
cFE Integration candidate: 2021-04-27
  • Loading branch information
astrogeco authored Apr 29, 2021
2 parents 73c338d + c9735e5 commit c8b5e00
Show file tree
Hide file tree
Showing 30 changed files with 562 additions and 147 deletions.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,27 @@ The detailed cFE user's guide can be viewed at <https://github.com/nasa/cFS/blob

## Version History

### Development Build: v6.8.0-rc1+dev540


- 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.
Updates the doxygen documentation for this parameter, as it was incorrectly specifying a 32-bit alignment requirement.
- Adds new functional tests for ES Child Task API. Does not check edge cases. Fixed spelling mistake in `UtAssert_ResourceID_Undifeined` name
- Removes BUILDDIR reference and an old comment. No behavior changes
- 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
- 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.
- Removes unused error codes: `CFE_ES_ERR_SHELL_CMD` and `CFE_SB_NO_MSG_RECV`. No impact to behavior.
- 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.
- 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.
- [docs] Clarify that `CFE_ES_DeleteCDS` does not wipe or erase the block, it only returns resources to the pool for re-use.
- [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.
- `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,
- Replace internal `CFE_ES_SYSLOG_APPEND` macro with the `CFE_ES_WriteToSysLog()` API since coding standards discourage use of multi-line macros.
- [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.
- 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.
- See <https://github.com/nasa/cFE/pull/1431> and <https://github.com/nasa/cFS/pull/250>


### Development Build: v6.8.0-rc1+dev509

- 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.
Expand Down
3 changes: 1 addition & 2 deletions cmake/Makefile.sample
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# Core Flight Software CMake / GNU make wrapper
#
# ABOUT THIS MAKEFILE:
# This is actually part of the CMake alternative build system.
# It is a GNU-make wrapper that calls the CMake tools appropriately
# so that setting up a new build is fast and easy with no need to
# learn the CMake commands. It also makes it easier to integrate
Expand Down Expand Up @@ -124,7 +123,7 @@ install:

prep $(O)/.prep:
mkdir -p "$(O)"
(cd "$(O)/$(BUILDDIR)" && cmake $(PREP_OPTS) "$(CURDIR)/cfe")
(cd "$(O)" && cmake $(PREP_OPTS) "$(CURDIR)/cfe")
echo "$(PREP_OPTS)" > "$(O)/.prep"

clean:
Expand Down
1 change: 0 additions & 1 deletion cmake/sample_defs/cpu1_cfe_es_startup.scr
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,3 @@ CFE_APP, sch_lab, SCH_Lab_AppMain, SCH_LAB_APP, 80, 16384, 0x0, 0;
! 3. The filename field (2) no longer requires a fully-qualified filename; the path and extension
! may be omitted. If omitted, the standard virtual path (/cf) and a platform-specific default
! extension will be used, which is derived from the build system.

1 change: 1 addition & 0 deletions modules/cfe_testcase/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
add_cfe_app(cfe_testcase
src/cfe_test.c
src/es_info_test.c
src/es_task_test.c
)

# register the dependency on cfe_assert
Expand Down
1 change: 1 addition & 0 deletions modules/cfe_testcase/src/cfe_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ void CFE_TestMain(void)
* Register test cases in UtAssert
*/
ESInfoTestSetup();
ESTaskTestSetup();

/*
* Execute the tests
Expand Down
3 changes: 2 additions & 1 deletion modules/cfe_testcase/src/cfe_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,11 @@
CFE_RESOURCEID_TO_ULONG(actual), #expect, CFE_RESOURCEID_TO_ULONG(expect))

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

void CFE_TestMain(void);
void ESInfoTestSetup(void);
void ESTaskTestSetup(void);

#endif /* CFE_TEST_H */
4 changes: 2 additions & 2 deletions modules/cfe_testcase/src/es_info_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ void TestAppInfo(void)
UtAssert_True(ESAppInfo.NumOfChildTasks > 0, "ES App Info -> Child Tasks = %d", (int)ESAppInfo.NumOfChildTasks);

UtAssert_INT32_EQ(CFE_ES_GetAppIDByName(&AppIdByName, INVALID_APP_NAME), CFE_ES_ERR_NAME_NOT_FOUND);
UtAssert_ResourceID_Undifeined(AppIdByName);
UtAssert_ResourceID_Undefined(AppIdByName);
UtAssert_INT32_EQ(CFE_ES_GetAppID(NULL), CFE_ES_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_ES_GetAppIDByName(NULL, TEST_EXPECTED_APP_NAME), CFE_ES_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_ES_GetAppName(AppNameBuf, CFE_ES_APPID_UNDEFINED, sizeof(AppNameBuf)),
Expand Down Expand Up @@ -205,7 +205,7 @@ void TestLibInfo(void)

UtAssert_INT32_EQ(LibInfo.ExceptionAction, 0);
UtAssert_True(LibInfo.Priority == 0, "Lib Info -> Priority = %d", (int)LibInfo.Priority);
UtAssert_ResourceID_Undifeined(LibInfo.MainTaskId);
UtAssert_ResourceID_Undefined(LibInfo.MainTaskId);
UtAssert_True(LibInfo.ExecutionCounter == 0, "Lib Info -> ExecutionCounter = %d", (int)LibInfo.ExecutionCounter);
UtAssert_True(strlen(LibInfo.MainTaskName) == 0, "Lib Info -> Task Name = %s", LibInfo.MainTaskName);
UtAssert_True(LibInfo.NumOfChildTasks == 0, "Lib Info -> Child Tasks = %d", (int)LibInfo.NumOfChildTasks);
Expand Down
115 changes: 115 additions & 0 deletions modules/cfe_testcase/src/es_task_test.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
/*************************************************************************
**
** 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: es_task_test.c
**
** Purpose:
** Functional test of basic ES Child Tasks APIs
**
** Demonstration of how to register and use the UT assert functions.
**
*************************************************************************/

/*
* Includes
*/

#include "cfe_test.h"

uint32 count = 0;

void TaskFunction(void)
{
while (count < 200)
{
count += 1;
OS_TaskDelay(100);
}
return;
}

void TaskExitFunction(void)
{
while (count < 200)
{
count += 1;
CFE_ES_ExitChildTask();
}
return;
}

void TestCreateChild(void)
{
UtPrintf("Testing: CFE_ES_CreateChildTask, CFE_ES_GetTaskIDByName, CFE_ES_GetTaskName, CFE_ES_DeleteChildTask");

CFE_ES_TaskId_t TaskId;
const char * TaskName = "CHILD_TASK_1";
CFE_ES_TaskId_t TaskIdByName;
char TaskNameBuf[OS_MAX_API_NAME + 4];
CFE_ES_StackPointer_t StackPointer = CFE_ES_TASK_STACK_ALLOCATE;
size_t StackSize = CFE_PLATFORM_ES_PERF_CHILD_STACK_SIZE;
CFE_ES_TaskPriority_Atom_t Priority = CFE_PLATFORM_ES_PERF_CHILD_PRIORITY;
uint32 Flags = 0;
int countCopy;

UtAssert_INT32_EQ(CFE_ES_CreateChildTask(&TaskId, TaskName, TaskFunction, StackPointer, StackSize, Priority, Flags),
CFE_SUCCESS);

UtAssert_INT32_EQ(CFE_ES_GetTaskIDByName(&TaskIdByName, TaskName), CFE_SUCCESS);
UtAssert_ResourceID_EQ(TaskIdByName, TaskId);

UtAssert_INT32_EQ(CFE_ES_GetTaskName(TaskNameBuf, TaskId, sizeof(TaskNameBuf)), CFE_SUCCESS);
UtAssert_StrCmp(TaskNameBuf, TaskName, "CFE_ES_GetTaskName() = %s", TaskNameBuf);

OS_TaskDelay(500);

countCopy = count;

UtAssert_INT32_EQ(CFE_ES_DeleteChildTask(TaskId), CFE_SUCCESS);

OS_TaskDelay(500);

UtAssert_True(countCopy == count || countCopy == count + 1, "countCopy (%d) == count (%d)", countCopy, count);
}

void TestExitChild(void)
{
UtPrintf("Testing: CFE_ES_ExitChildTask");

CFE_ES_TaskId_t TaskId;
const char * TaskName = "CHILD_TASK_1";
CFE_ES_StackPointer_t StackPointer = CFE_ES_TASK_STACK_ALLOCATE;
size_t StackSize = CFE_PLATFORM_ES_PERF_CHILD_STACK_SIZE;
CFE_ES_TaskPriority_Atom_t Priority = CFE_PLATFORM_ES_PERF_CHILD_PRIORITY;
uint32 Flags = 0;
count = 0;

UtAssert_INT32_EQ(
CFE_ES_CreateChildTask(&TaskId, TaskName, TaskExitFunction, StackPointer, StackSize, Priority, Flags),
CFE_SUCCESS);
OS_TaskDelay(500);
UtAssert_INT32_EQ(count, 1);
}

void ESTaskTestSetup(void)
{
UtTest_Add(TestCreateChild, NULL, NULL, "Test Create Child");
UtTest_Add(TestExitChild, NULL, NULL, "Test Exit Child");
}
19 changes: 1 addition & 18 deletions modules/core_api/fsw/inc/cfe_error.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ typedef int32 CFE_Status_t;
*
* Operation was performed successfully
*/
#define CFE_SUCCESS (0)
#define CFE_SUCCESS ((CFE_Status_t)0)

/**
* @brief No Counter Increment
Expand Down Expand Up @@ -347,14 +347,6 @@ typedef int32 CFE_Status_t;
*/
#define CFE_ES_ERR_CHILD_TASK_REGISTER ((CFE_Status_t)0xc400000b)

/**
* @brief Shell Command Error
*
* Error occured ehen trying to pass a system call to the OS shell
*
*/
#define CFE_ES_ERR_SHELL_CMD ((CFE_Status_t)0xc400000c)

/**
* @brief CDS Already Exists
*
Expand Down Expand Up @@ -825,15 +817,6 @@ typedef int32 CFE_Status_t;
*/
#define CFE_SB_BUFFER_INVALID ((CFE_Status_t)0xca00000e)

/**
* @brief No Message Recieved
*
* When trying to determine the last senders ID, this return
* value indicates that there was not a message recived on the pipe.
*
*/
#define CFE_SB_NO_MSG_RECV ((CFE_Status_t)0xca00000f)

/**
* @brief Not Implemented
*
Expand Down
33 changes: 19 additions & 14 deletions modules/core_api/fsw/inc/cfe_es.h
Original file line number Diff line number Diff line change
Expand Up @@ -1184,10 +1184,12 @@ CFE_Status_t CFE_ES_RestoreFromCDS(void *RestoreToMemory, CFE_ES_CDSHandle_t Han
** \param[in, out] PoolID A pointer to the variable the caller wishes to have the memory pool handle kept in.
** PoolID is the memory pool handle.
**
** \param[in] MemPtr A Pointer to the pool of memory created by the calling application. This address must
** be on a 32-bit boundary.
** \param[in] MemPtr A Pointer to the pool of memory created by the calling application. This address must
** be aligned suitably for the processor architecture. The #CFE_ES_STATIC_POOL_TYPE
** macro may be used to assist in creating properly aligned memory pools.
**
** \param[in] Size The size of the pool of memory. Note that this must be an integral number of 32 bit words.
** \param[in] Size The size of the pool of memory. Note that this must be an integral multiple of the
** memory alignment of the processor architecture.
**
** \return Execution status, see \ref CFEReturnCodes
** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS
Expand All @@ -1196,7 +1198,7 @@ CFE_Status_t CFE_ES_RestoreFromCDS(void *RestoreToMemory, CFE_ES_CDSHandle_t Han
** \sa #CFE_ES_PoolCreate, #CFE_ES_PoolCreateEx, #CFE_ES_GetPoolBuf, #CFE_ES_PutPoolBuf, #CFE_ES_GetMemPoolStats
**
******************************************************************************/
CFE_Status_t CFE_ES_PoolCreateNoSem(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, size_t Size);
CFE_Status_t CFE_ES_PoolCreateNoSem(CFE_ES_MemHandle_t *PoolID, void *MemPtr, size_t Size);

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

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

/*****************************************************************************/
Expand Down
8 changes: 7 additions & 1 deletion modules/core_api/fsw/inc/cfe_es_core_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,14 @@ int32 CFE_ES_RegisterCDSEx(CFE_ES_CDSHandle_t *HandlePtr, size_t UserBlockSize,
** Removes the record of the specified CDS from the CDS Registry and
** frees the associated CDS memory for future use.
**
** This operation invalidates the registry entry and returns
** the underlying data storage back to the CDS pool for re-use.
**
** \par Assumptions, External Events, and Notes:
** None
** The actual data block is not modified by this call. Specifically, this does not
** "wipe" or otherwise overwrite the data block. If the application needs to ensure
** that the data is actually erased, it should explicitly do so (by e.g. writing all
** zeros or all ones) before deleting the block.
**
** \param[in] CDSName - Pointer to character string containing complete
** CDS Name (of the format "AppName.CDSName").
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 @@ -28,7 +28,7 @@
#define CFE_VERSION_H

/* Development Build Macro Definitions */
#define CFE_BUILD_NUMBER 509 /*!< Development Build: Number of commits since baseline */
#define CFE_BUILD_NUMBER 540 /*!< Development Build: Number of commits since baseline */
#define CFE_BUILD_BASELINE \
"v6.8.0-rc1" /*!< Development Build: git tag that is the base for the current development \
*/
Expand Down
6 changes: 3 additions & 3 deletions modules/core_api/ut-stubs/src/ut_es_stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ int32 CFE_ES_GetPoolBuf(CFE_ES_MemPoolBuf_t *BufPtr, CFE_ES_MemHandle_t PoolID,
** Returns either a user-defined status flag or OS_SUCCESS.
**
******************************************************************************/
CFE_Status_t CFE_ES_PoolCreate(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, size_t Size)
CFE_Status_t CFE_ES_PoolCreate(CFE_ES_MemHandle_t *PoolID, void *MemPtr, size_t Size)
{
UT_Stub_RegisterContext(UT_KEY(CFE_ES_PoolCreate), PoolID);
UT_Stub_RegisterContext(UT_KEY(CFE_ES_PoolCreate), MemPtr);
Expand Down Expand Up @@ -568,7 +568,7 @@ CFE_Status_t CFE_ES_PoolCreate(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, size_t
** Returns OS_SUCCESS.
**
******************************************************************************/
CFE_Status_t CFE_ES_PoolCreateNoSem(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, size_t Size)
CFE_Status_t CFE_ES_PoolCreateNoSem(CFE_ES_MemHandle_t *PoolID, void *MemPtr, size_t Size)
{
UT_Stub_RegisterContext(UT_KEY(CFE_ES_PoolCreateNoSem), PoolID);
UT_Stub_RegisterContext(UT_KEY(CFE_ES_PoolCreateNoSem), MemPtr);
Expand Down Expand Up @@ -606,7 +606,7 @@ CFE_Status_t CFE_ES_PoolCreateNoSem(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, s
** Returns either a user-defined status flag or CFE_SUCCESS.
**
******************************************************************************/
CFE_Status_t CFE_ES_PoolCreateEx(CFE_ES_MemHandle_t *PoolID, uint8 *MemPtr, size_t Size, uint16 NumBlockSizes,
CFE_Status_t CFE_ES_PoolCreateEx(CFE_ES_MemHandle_t *PoolID, void *MemPtr, size_t Size, uint16 NumBlockSizes,
const size_t *BlockSizes, bool UseMutex)
{
UT_Stub_RegisterContext(UT_KEY(CFE_ES_PoolCreateEx), PoolID);
Expand Down
Loading

0 comments on commit c8b5e00

Please sign in to comment.