Skip to content

Commit

Permalink
Merge pull request #1022 from jphickey/fix-1004-min-stacksize
Browse files Browse the repository at this point in the history
Fix #1004, default stack size
  • Loading branch information
astrogeco committed Dec 1, 2020
2 parents 0edf8c2 + 8de17d7 commit 1f7a716
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 30 deletions.
24 changes: 14 additions & 10 deletions fsw/cfe-core/src/es/cfe_es_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,7 @@ int32 CFE_ES_StartAppCmd(const CFE_ES_StartApp_t *data)
int32 FilenameLen;
int32 AppEntryLen;
int32 AppNameLen;
size_t AppStackSize;
char LocalFile[OS_MAX_PATH_LEN];
char LocalEntryPt[OS_MAX_API_NAME];
char LocalAppName[OS_MAX_API_NAME];
Expand Down Expand Up @@ -898,13 +899,6 @@ int32 CFE_ES_StartAppCmd(const CFE_ES_StartApp_t *data)
CFE_EVS_SendEvent(CFE_ES_START_NULL_APP_NAME_ERR_EID, CFE_EVS_EventType_ERROR,
"CFE_ES_StartAppCmd: App Name is NULL.");
}
else if (cmd->StackSize < CFE_PLATFORM_ES_DEFAULT_STACK_SIZE)
{
CFE_ES_TaskData.CommandErrorCounter++;
CFE_EVS_SendEvent(CFE_ES_START_STACK_ERR_EID, CFE_EVS_EventType_ERROR,
"CFE_ES_StartAppCmd: Stack size is less than system Minimum: %d.",
CFE_PLATFORM_ES_DEFAULT_STACK_SIZE);
}
else if (cmd->Priority > OS_MAX_PRIORITY)
{
CFE_ES_TaskData.CommandErrorCounter++;
Expand All @@ -922,15 +916,25 @@ int32 CFE_ES_StartAppCmd(const CFE_ES_StartApp_t *data)
}
else
{
/* If stack size was provided, use it, otherwise use default. */
if (cmd->StackSize == 0)
{
AppStackSize = CFE_PLATFORM_ES_DEFAULT_STACK_SIZE;
}
else
{
AppStackSize = cmd->StackSize;
}

/*
** Invoke application loader/startup function.
*/
Result = CFE_ES_AppCreate(&AppID, LocalFile,
LocalEntryPt,
LocalAppName,
(uint32) cmd->Priority,
(uint32) cmd->StackSize,
(uint32) cmd->ExceptionAction);
cmd->Priority,
AppStackSize,
cmd->ExceptionAction);

/*
** Send appropriate event message
Expand Down
17 changes: 0 additions & 17 deletions fsw/cfe-core/src/inc/cfe_es_events.h
Original file line number Diff line number Diff line change
Expand Up @@ -488,23 +488,6 @@
**/
#define CFE_ES_START_NULL_APP_NAME_ERR_EID 29

/** \brief <tt> 'CFE_ES_StartAppCmd: Stack size is less than system Minimum: \%d.' </tt>
** \event <tt> 'CFE_ES_StartAppCmd: Stack size is less than system Minimum: \%d.' </tt>
**
** \par Type: ERROR
**
** \par Cause:
**
** This event message is generated for an error encountered in response
** to an Executive Services \link #CFE_ES_START_APP_CC Start Application Command \endlink.
**
** This message reports a command failure when the Application Stack Size parameter is
** less than the default stack size defined in the cfe_platform_cfg.h file: CFE_PLATFORM_ES_DEFAULT_STACK_SIZE.
**
** The \c 'd' term identifies the size of the stack that was given in the command.
**/
#define CFE_ES_START_STACK_ERR_EID 30

/** \brief <tt> 'CFE_ES_StartAppCmd: Priority is too large: \%d.' </tt>
** \event <tt> 'CFE_ES_StartAppCmd: Priority is too large: \%d.' </tt>
**
Expand Down
6 changes: 3 additions & 3 deletions fsw/cfe-core/unit-test/es_UT.c
Original file line number Diff line number Diff line change
Expand Up @@ -2963,7 +2963,7 @@ void TestTask(void)
"CFE_ES_StartAppCmd",
"Invalid exception action");

/* Test app create with a bad stack size */
/* Test app create with a default stack size */
ES_ResetUnitTest();
memset(&CmdBuf, 0, sizeof(CmdBuf));
strncpy((char *) CmdBuf.StartAppCmd.Payload.AppFileName, "filename",
Expand All @@ -2978,9 +2978,9 @@ void TestTask(void)
UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CFE_ES_StartApp_t),
UT_TPID_CFE_ES_CMD_START_APP_CC);
UT_Report(__FILE__, __LINE__,
UT_EventIsInHistory(CFE_ES_START_STACK_ERR_EID),
UT_EventIsInHistory(CFE_ES_START_INF_EID),
"CFE_ES_StartAppCmd",
"Stack size too small");
"Default Stack Size");

/* Test app create with a bad priority */
ES_ResetUnitTest();
Expand Down

0 comments on commit 1f7a716

Please sign in to comment.