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

Fix #583, ES start table #660

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
30 changes: 0 additions & 30 deletions cmake/sample_defs/cpu1_cfe_es_startup.scr

This file was deleted.

12 changes: 6 additions & 6 deletions cmake/sample_defs/cpu1_platform_cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -823,33 +823,33 @@


/**
** \cfeescfg ES Nonvolatile Startup Filename
** \cfeescfg ES Nonvolatile Startup Table Filename
**
** \par Description:
** The value of this constant defines the path and name of the file that
** The value of this constant defines the path and name of the table file that
** contains a list of modules that will be loaded and started by the cFE after
** the cFE finishes its startup sequence.
**
** \par Limits
** The length of each string, including the NULL terminator cannot exceed the
** #OS_MAX_PATH_LEN value.
*/
#define CFE_PLATFORM_ES_NONVOL_STARTUP_FILE "/cf/cfe_es_startup.scr"
#define CFE_PLATFORM_ES_NONVOL_TBL_FILE "/cf/cfe_es_start.tbl"


/**
** \cfeescfg ES Volatile Startup Filename
** \cfeescfg ES Volatile Startup Table Filename
**
** \par Description:
** The value of this constant defines the path and name of the file that
** The value of this constant defines the path and name of the table file that
** contains a list of modules that will be loaded and started by the cFE after
** the cFE finishes its startup sequence.
**
** \par Limits
** The length of each string, including the NULL terminator cannot exceed the
** #OS_MAX_PATH_LEN value.
*/
#define CFE_PLATFORM_ES_VOLATILE_STARTUP_FILE "/ram/cfe_es_startup.scr"
#define CFE_PLATFORM_ES_VOLATILE_TBL_FILE "/ram/cfe_es_start.tbl"

/**
** \cfeescfg Default Shell Filename
Expand Down
13 changes: 13 additions & 0 deletions cmake/sample_defs/f
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
** \cfeescfg ES Startup Table Filename
**
** \par Description:
** The value of this constant defines the path and name of the table file that
** contains a list of modules that will be loaded and started by the cFE after
** the cFE finishes its startup sequence.
**
** \par Limits
** The length of each string, including the NULL terminator cannot exceed the
** #OS_MAX_PATH_LEN value.
*/
#define CFE_PLATFORM_ES_TBL_FILE "/cf/cfe_es_start.tbl"
93 changes: 93 additions & 0 deletions cmake/sample_defs/tables/cpu1_cfe_es_start.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
/*
** 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:
** cfe_es_start.c
**
** Purpose:
** Provides the load-time configuration of which shared libraries and applications should
** be loaded into the cFS instance.
**
** References:
**
** Notes:
**
** Modification History:
**
*/

/*
** Required header files.
*/

#include "cfe_tbl_filedef.h" /* Required for the CFE_TBL_FILEDEF macro */
#include "cfe_es_table.h"

CFE_ES_AppLibTbl_t CFE_ES_AppLibTbl = {
/** Libraries **/
.Libs = {
/** { <name> <shared library file path>, <entry point> } **/
{ /* Lib #0 */
.Name = "SAMPLE_LIB",
.FileName = "/cf/sample_lib.so",
.EntryPoint = "SAMPLE_LibInit"
},
},
/** Applications **/
{
/** { <name>, <shared library file path>, <entry point>, <stack size>, <priority>,
<1 == reset processor on err> } **/
{ /* App #0 */
.Name = "SAMPLE_APP",
.FileName = "/cf/sample_app.so",
.EntryPoint = "SAMPLE_AppMain",
.StackSize = 16384,
.Priority = 50,
.ExceptionAction = 0
},
{ /* App #1 */
.Name = "CI_LAB",
.FileName = "/cf/ci_lab.so",
.EntryPoint = "CI_Lab_AppMain",
.StackSize = 16384,
.Priority = 60,
.ExceptionAction = 0
},
{ /* App #2 */
.Name = "TO_LAB",
.FileName = "/cf/to_lab.so",
.EntryPoint = "TO_Lab_AppMain",
.StackSize = 16384,
.Priority = 70,
.ExceptionAction = 0
},
{ /* App #3 */
.Name = "SCH_LAB_APP",
.FileName = "/cf/sch_lab.so",
.EntryPoint = "SCH_Lab_AppMain",
.StackSize = 16384,
.Priority = 80,
.ExceptionAction = 0
},
}
};

CFE_TBL_FILEDEF(CFE_ES_AppLibTbl, CFE_ES.CFE_ES_AppLibTbl, ES App and Lib Table, cfe_es_start.tbl)
3 changes: 0 additions & 3 deletions cmake/sample_defs/targets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,12 @@ SET(FT_INSTALL_SUBDIR "host/functional-test")
# Each target board can have its own HW arch selection and set of included apps
SET(TGT1_NAME cpu1)
SET(TGT1_APPLIST sample_app sample_lib ci_lab to_lab sch_lab)
SET(TGT1_FILELIST cfe_es_startup.scr)

# CPU2/3 are duplicates of CPU1. These are not built by default anymore but are
# commented out to serve as an example of how one would configure multiple cpus.
#SET(TGT2_NAME cpu2)
#SET(TGT2_APPLIST sample_app ci_lab to_lab sch_lab)
#SET(TGT2_FILELIST cfe_es_startup.scr)

#SET(TGT3_NAME cpu3)
#SET(TGT3_APPLIST sample_app ci_lab to_lab sch_lab)
#SET(TGT3_FILELIST cfe_es_startup.scr)

2 changes: 1 addition & 1 deletion cmake/target/src/target_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Target_CfeConfigData GLOBAL_CFE_CONFIGDATA =
* Default values for Startup file.
* This is a suggested value, but the PSP may provide a different file
*/
.NonvolStartupFile = CFE_PLATFORM_ES_NONVOL_STARTUP_FILE,
.NonvolStartupFile = CFE_PLATFORM_ES_NONVOL_TBL_FILE,

/*
* Sizes of other memory segments
Expand Down
7 changes: 3 additions & 4 deletions docs/cFE Application Developers Guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -582,10 +582,9 @@ Reference cFE API documentation for more detail on reset types.
#### 5.5 Shared Libraries

The cFE contains support for shared libraries. For the current version
of the cFE, the shared libraries must be loaded on cFE startup (see the
cFE Deployment Guide on how to modify the cfe_es_startup.scr in order
to load a shared library at startup). The capability to add and remove
shared libraries during runtime will be available in a later build.
of the cFE, the shared libraries must be loaded on cFE startup.
The capability to add and remove shared libraries during runtime will
be available in a later build.

Reference sample_lib on Github for a “live” example.

Expand Down
98 changes: 28 additions & 70 deletions docs/src/cfe_es.dox
Original file line number Diff line number Diff line change
Expand Up @@ -122,66 +122,29 @@
**/

/**
\page cfeesugstartupterm "Startup Script"

The startup script is a text file, written by the user that contains a list of
entries (one entry for each application) and is used by the ES application for
automating the startup of applications. For a processor reset, ES checks
for the CFE_PLATFORM_ES_VOLATILE_STARTUP_FILE first, and if it doesn't exist
or for a power on reset ES uses the file passed in to #CFE_ES_Main
(typically CFE_PLATFORM_ES_NONVOL_STARTUP_FILE but dependent on the PSP).

The fields in a single entry include:
<TABLE>
<TR>
<TD> Object Type
<TD> <tt>CFE_APP</tt> for an Application, or <tt>CFE_LIB</tt> for a library.
<TR>
<TD> Path/Filename
<TD> This is a cFE Virtual filename, not a vxWorks device/pathname
<TR>
<TD> Entry Point
<TD> This is the name of the "main" function for App.
<TR>
<TD> CFE Name
<TD> The cFE name for the APP or Library
<TR>
<TD> Priority
<TD> This is the Priority of the App, not used for a Library
<TR>
<TD> Stack Size
<TD> This is the Stack size for the App, not used for a Library
<TR>
<TD> Load Address
<TD> This is the Optional Load Address for the App or Library. It is currently
not implemented so it should always be 0x0.
<TR>
<TD> Exception Action
<TD> This is the Action the cFE should take if the Application has an exception. <BR>
<UL>
<LI> 0 = Do a cFE Processor Reset <BR>
<LI> Non-Zero = Just restart the Application
</UL>
</TABLE>
\page cfeesugstartupterm "Startup Table"

The startup table is a CFE table that contains two arrays, one for libraries
and a second for applications for automating the startup of applications by ES.
For a processor reset, ES checks for the CFE_PLATFORM_ES_VOLATILE_TBL_FILE
first, and if it doesn't exist or for a power on reset ES uses the table passed
in to #CFE_ES_Main (typically CFE_PLATFORM_ES_NONVOL_TBL_FILE but dependent on
the PSP).

The structure of the table is defined in \ref cfe_es_table.h .

Immediately after the cFE completes its initialization, the ES Application first
looks for the volatile startup script. The location in the file system is defined
by the cFE platform configuration parameter named #CFE_ES_VOLATILE_STARTUP_FILE.
This configuration parameter contains a path as well as a filename. If the file
is found, ES begins to startup the applications that are listed in the file. If
ES does not find the file, it attempts to open the #CFE_ES_NONVOL_STARTUP_FILE.
looks for the volatile startup table. If the table
is found, ES loads the libraries (in order), then begins to startup the applications
(also in order). If ES does not find the table, it attempts to open the
non-volatile startup table.

If ES finds the volatile startup script, the attempt to open the nonvolatile startup
script is bypassed.

Any errors encountered in the startup script processing are written to the
Any errors encountered in the startup table processing are written to the
\ref cfeesugsyslogsrv. The \ref cfeesugsyslogsrv
may also contain positive acknowledge messages regarding the startup script processing.
may also contain positive acknowledge messages regarding the startup table processing.

Refer to the CFS Deployment Guide for more
information regarding the startup script. The startup script delivered with the
cFE (<tt>cfe_es_startup.scr</tt>) also has some detailed information about the fields
and the settings.
information regarding the startup table.

Next: \ref cfeesugswreset <BR>
Prev: \ref cfeesugappstart <BR>
Expand Down Expand Up @@ -277,7 +240,7 @@
application through an API call.

This provides a way for the user to load a set of library
routines, (via the startup script) without starting a corresponding
routines, (via the startup table) without starting a corresponding
task. See the section related to library routines for more detail.

The ES task maintains a counter for the number of registered
Expand All @@ -293,15 +256,12 @@
\page cfeesugappstart Starting an Application

There are two ways to start an application, through the ground
command #CFE_ES_START_APP_CC or through the startup script. In
command #CFE_ES_START_APP_CC or through the startup table. In
either case, the object file must be loaded on board before the
command is sent or before the startup script is executed. The
startup script contains a list of applications and library
routines to load and start immediately after the cFE finishes
its startup sequence. The parameters in the command, match the
elements of an entry in the startup script. See the cFE Deployment
Guide for more information about starting applications by way of
the startup script.
command is sent or before the startup table is executed.

See the cFE Deployment Guide for more information about starting
applications by way of the startup table.

The format of the Start Application command, is defined in the
structure #CFE_ES_StartApp_t. The members of the structure
Expand Down Expand Up @@ -369,7 +329,7 @@
The #CFE_ES_RESTART_APP_CC command is used to restart an application.
This command stops and restarts an application using the parameters
defined when the application was originally started, either through
the startup script or by way of the #CFE_ES_START_APP_CC command.
the startup table or by way of the #CFE_ES_START_APP_CC command.

Next: \ref cfeesugappreload <BR>
Prev: \ref cfeesugappstop <BR>
Expand All @@ -383,7 +343,7 @@
This command stops the application, unloads the object file, loads
the new object file specified in the command and starts the application
again using the parameters defined when the application was originally
started, either through the startup script or by way of the
started, either through the startup table or by way of the
#CFE_ES_START_APP_CC command.

Next: \ref cfeesugapplist <BR>
Expand Down Expand Up @@ -459,13 +419,11 @@
/**
\page cfeesugloadlibs Loading Common Libraries

Library routines may be loaded only through the startup script. There
Library routines may be loaded only through the startup table. There
is an option that allows a library routine initialization function
to be executed after the library is loaded. Refer to the cFE Application
Developers Guide for more information regarding Library Routines and
startup scripts. The startup script delivered with the cFE
(<tt>cfe_es_startup.scr</tt>) also has some detailed information
about library routines.
startup table.

Next: \ref cfeesugfilesrv <BR>
Prev: \ref cfeesugtasklist <BR>
Expand Down Expand Up @@ -684,7 +642,7 @@
memory. These block size definitions simply give the memory pool a set of
sizes to choose from. They do not configure the memory pool in any way and
they do not affect the size of the pool. The cFE defines a default set of
block sizes in the cfe_platform_cfg.h file.
block sizes in the \ref cfe_platform_cfg.h file.

If the default block sizes are used, the application will create the pool
using the simpler #CFE_ES_PoolCreate API. This API takes a pointer to the
Expand Down
Loading