Skip to content

Commit

Permalink
Merge pull request #2526 from nasa/integration-candidate
Browse files Browse the repository at this point in the history
cFE Integration candidate: Equuleus-rc1+dev7
  • Loading branch information
dzbaker authored Mar 12, 2024
2 parents 4577b78 + 28150ff commit 5cffc39
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 14 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## Development Build: equuleus-rc1+dev107
- propagate stack pointer for child tasks
- add missing memset() for stack variables
- See <https://github.com/nasa/cFE/pull/2517> and <https://github.com/nasa/cFE/pull/2527>

## Development Build: equuleus-rc1+dev100
- Add runtime TopicId conversion routines to SB
- See <https://github.com/nasa/cFE/pull/2520>
Expand Down
70 changes: 69 additions & 1 deletion modules/cfe_testcase/src/es_task_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,66 @@ void TaskExitFunction(void)
}
}

#define UT_LOCAL_STACK_SIZE 4096
static unsigned long UT_LOCAL_STACK[UT_LOCAL_STACK_SIZE];

void TestCheckStackPointer(void)
{
int32 LocalVar;
cpuaddr VarAddress;
cpuaddr StackAddress;

OS_TaskDelay(10);

VarAddress = (cpuaddr)&LocalVar;
StackAddress = (cpuaddr)UT_LOCAL_STACK;

UtAssert_GT(cpuaddr, VarAddress, StackAddress);
UtAssert_LT(cpuaddr, VarAddress, StackAddress + sizeof(UT_LOCAL_STACK));

CFE_ES_ExitChildTask();
}

void TestCreateChildWithStack(void)
{
CFE_ES_TaskId_t TaskId = CFE_ES_TASKID_UNDEFINED;
int32 RetryCount;
const char * TaskName = "CHILD_W_STACK";
CFE_ES_StackPointer_t StackPointer = UT_LOCAL_STACK;
size_t StackSize = sizeof(UT_LOCAL_STACK);
CFE_ES_TaskPriority_Atom_t Priority = CFE_PLATFORM_ES_PERF_CHILD_PRIORITY;
uint32 Flags = 0;
char TaskNameBuf[16];

UtPrintf("Testing: CFE_ES_CreateChildTask with user-specified stack");

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

/* wait for task to exit itself */
RetryCount = 0;
while (RetryCount < 10)
{
/*
* poll until CFE_ES_GetTaskName() returns an error, then the task has exited
*
* NOTE: this intentionally does not Assert the status here, because the child task is
* also doing asserts at the time this loop is running. Once the child task finishes,
* it is OK to do asserts from this task again
*/
if (CFE_Assert_STATUS_STORE(CFE_ES_GetTaskName(TaskNameBuf, TaskId, sizeof(TaskNameBuf))) != CFE_SUCCESS)
{
break;
}
OS_TaskDelay(100);
++RetryCount;
}

/* Retroactively confirm that the previous call to CFE_ES_GetTaskName() returned RESOURCEID_NOT_VALID */
CFE_Assert_STATUS_MUST_BE(CFE_ES_ERR_RESOURCEID_NOT_VALID);
}

void TestCreateChild(void)
{
UtPrintf("Testing: CFE_ES_CreateChildTask");
Expand All @@ -114,7 +174,7 @@ void TestCreateChild(void)
while (CFE_FT_Global.Count != ExpectedCount && Index < 100)
{
OS_TaskDelay(10);
Index ++;
Index++;
}

UtAssert_INT32_GT(CFE_FT_Global.Count, ExpectedCount - 1);
Expand Down Expand Up @@ -292,4 +352,12 @@ void ESTaskTestSetup(void)
UtTest_Add(TestChildTaskName, NULL, NULL, "Test Child Task Name");
UtTest_Add(TestChildTaskDelete, NULL, NULL, "Test Child Tasks Delete");
UtTest_Add(TestExitChild, NULL, NULL, "Test Exit Child");

/*
* NOTE: The custom stack does not work on RTEMS, test is disabled on that platform
* for the time being (custom stack may be deprecated in future CFE release).
*/
#ifndef _RTEMS_OS_
UtTest_Add(TestCreateChildWithStack, NULL, NULL, "Test Child with Custom Stack");
#endif
}
12 changes: 6 additions & 6 deletions modules/core_api/fsw/inc/cfe_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@
#define CFE_VERSION_H

/* Development Build Macro Definitions */
#define CFE_BUILD_NUMBER 100 /**< @brief Development: Number of development git commits since CFE_BUILD_BASELINE */
#define CFE_BUILD_NUMBER 107 /**< @brief Development: Number of development git commits since CFE_BUILD_BASELINE */
#define CFE_BUILD_BASELINE "equuleus-rc1" /**< @brief Development: Reference git tag for build number */
#define CFE_BUILD_DEV_CYCLE "equuleus-rc2" /**< @brief Development: Release name for current development cycle */
#define CFE_BUILD_CODENAME "Equuleus" /**< @brief: Development: Code name for the current build */
#define CFE_BUILD_CODENAME "Equuleus" /**< @brief: Development: Code name for the current build */

/* See \ref cfsversions for definitions */
#define CFE_MAJOR_VERSION 6 /*!< @brief Major version number */
#define CFE_MINOR_VERSION 7 /*!< @brief Minor version number */
#define CFE_REVISION 0 /*!< @brief Revision version number. Value of 0 indicates a development version.*/
#define CFE_MAJOR_VERSION 6 /*!< @brief Major version number */
#define CFE_MINOR_VERSION 7 /*!< @brief Minor version number */
#define CFE_REVISION 0 /*!< @brief Revision version number. Value of 0 indicates a development version.*/

/**
* @brief Last official release.
Expand Down Expand Up @@ -63,7 +63,7 @@

/**
* @brief Max Version String length.
*
*
* Maximum length that a cFE version string can be.
*/
#define CFE_CFG_MAX_VERSION_STR_LEN 256
Expand Down
1 change: 1 addition & 0 deletions modules/es/fsw/src/cfe_es_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -1259,6 +1259,7 @@ CFE_Status_t CFE_ES_CreateChildTask(CFE_ES_TaskId_t *TaskIdPtr, const char *Task
memset(&Params, 0, sizeof(Params));
Params.Priority = Priority;
Params.StackSize = StackSize;
Params.StackPtr = StackPtr;

/*
** Validate some of the arguments
Expand Down
16 changes: 9 additions & 7 deletions modules/es/fsw/src/cfe_es_apps.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,8 @@ int32 CFE_ES_ParseFileEntry(const char **TokenList, uint32 NumTokens)
int32 Status;
CFE_ES_AppStartParams_t ParamBuf;

memset(&ParamBuf, 0, sizeof(ParamBuf));

/*
** Check to see if the correct number of items were parsed
*/
Expand Down Expand Up @@ -585,13 +587,13 @@ int32 CFE_ES_StartAppTask(CFE_ES_TaskId_t *TaskIdPtr, const char *TaskName, CFE_
/*
* Create the primary task for the newly loaded task
*/
OsStatus = OS_TaskCreate(&OsalTaskId, /* task id */
TaskName, /* task name matches app name for main task */
CFE_ES_TaskEntryPoint, /* task function pointer */
OSAL_TASK_STACK_ALLOCATE, /* stack pointer (allocate) */
Params->StackSize, /* stack size */
Params->Priority, /* task priority */
OS_FP_ENABLED); /* task options */
OsStatus = OS_TaskCreate(&OsalTaskId, /* task id */
TaskName, /* task name matches app name for main task */
CFE_ES_TaskEntryPoint, /* task function pointer */
Params->StackPtr, /* stack pointer (allocate if NULL) */
Params->StackSize, /* stack size */
Params->Priority, /* task priority */
OS_FP_ENABLED); /* task options */

CFE_ES_LockSharedData(__func__, __LINE__);

Expand Down
1 change: 1 addition & 0 deletions modules/es/fsw/src/cfe_es_apps.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ typedef struct
typedef struct
{
size_t StackSize;
CFE_ES_StackPointer_t StackPtr;
CFE_ES_TaskPriority_Atom_t Priority;
} CFE_ES_TaskStartParams_t;

Expand Down
2 changes: 2 additions & 0 deletions modules/es/fsw/src/cfe_es_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,8 @@ int32 CFE_ES_StartAppCmd(const CFE_ES_StartAppCmd_t *data)
char LocalAppName[OS_MAX_API_NAME];
CFE_ES_AppStartParams_t StartParams;

memset(&StartParams, 0, sizeof(StartParams));

/* Create local copies of all input strings and ensure null termination */
Result = CFE_FS_ParseInputFileNameEx(StartParams.BasicInfo.FileName, cmd->AppFileName,
sizeof(StartParams.BasicInfo.FileName), sizeof(cmd->AppFileName), NULL,
Expand Down

0 comments on commit 5cffc39

Please sign in to comment.