This page provide a tutorial on how to build and run the included ECI sample apps using both CFE 6.5 and 6.6. For conciseness, we will refer to the built CFS directory as cfs_dir and the location of the ECI files as eci_dir in this section.
ECI doesn't have any additional depedencies beyond the requirements of the CFS. For the purposes of this tutorial, we'll be using the CFE targeted for linux and so we assume the following are available on your machine:
The older CFE 6.5 utilizes a make-based build system, and so requires some tweaks to integrate the apps. If you're intending to just demo the ECI, we recommend using the build scripts located in the /ci directory of the ECI repo.
With the repository set to our 6.5 revision, we need to fetch the git submodules using:
If you'd like to run the UT Assert tests, you will probably also need to apply a fix to this version of UT Assert. We use the stream editor sed to modify these files while in the cloned CFS directory but if you've modified any of these files, the line numbers will most likely be incorrect.
sed -i '481s/.*/int32 CFE_ES_PoolCreate(CFE_ES_MemHandle_t *HandlePtr, uint8 *MemPtr, uint32 Size)/' tools/ut_assert/src/ut_cfe_es_stubs.c sed -i '489s/.*/return(Ut_CFE_ES_HookTable.CFE_ES_PoolCreate((uint32*)HandlePtr, MemPtr, Size));/' tools/ut_assert/src/ut_cfe_es_stubs.c sed -i '494s/.*/int32 CFE_ES_PoolCreateEx(CFE_ES_MemHandle_t *HandlePtr, uint8 *MemPtr, uint32 Size, uint32 NumBlockSizes, uint32 *BlockSizes, uint16 UseMutex)/' tools/ut_assert/src/ut_cfe_es_stubs.c sed -i '502s/.*/return(Ut_CFE_ES_HookTable.CFE_ES_PoolCreateEx((uint32*)HandlePtr, MemPtr, Size, NumBlockSizes, BlockSizes, UseMutex));/' tools/ut_assert/src/ut_cfe_es_stubs.c sed -i '91s/.*/export CFS_PROM_APPS:=$(CFS_PROM)/' ./build/cpu1/Makefile sed -i '871s/.*/#define CFE_ES_NONVOL_STARTUP_FILE "\/cf\/cfe_es_startup.scr"/' ./cfe/fsw/platform_inc/cpu1/cfe_platform_cfg.h sed -i 's/\/cf\/apps/\/cf/' build/cpu1/exe/cfe_es_startup.scr
This should give us a working version of CFE 6.5. Now we add our simple app.
mkdir <cfs_dir>/apps/simpleECIApp cp -r <eci_dir>/examples/simpleECIApp/* <cfs_dir>/apps/simpleECIApp/ mkdir -p <cfs_dir>/apps/eci/fsw cp -r <eci_dir>/fsw/* <cfs_dir>/apps/eci/fsw
sed -i '44a THE_APPS += simpleECIApp' <cfs_dir>/build/cpu1/Makefile sed -i '50a THE_TBLS += simpleECIApp' <cfs_dir>/build/cpu1/Makefile
sed -i '5a CFE_APP, /cf/simpleECIApp.so, sa_AppMain, SA_APP, 90, 8192, 0x0, 0;' <cfs_dir>/build/cpu1/exe/cfe_es_startup.scr sed -i '26a #include "simpleECI_app_msgids.h"' <cfs_dir>/apps/sch_lab/fsw/platform_inc/sch_lab_sched_tab.h sed -i '74a { SIMPLE_ECI_TICK_MID, 4, 0 },' <cfs_dir>/apps/sch_lab/fsw/platform_inc/sch_lab_sched_tab.h
cd <cfs_dir> . ./setvars.sh make config make
Navigate to the build directory and execute the CFS.
cd <cfs_dir>/build/cpu1/exe/ sudo ./core-linux.bin
You should see a message indicating that the CFS has loaded our simple app.
Building the CFE 6.6 has an additional dependency on cmake3, which must be availabe on your system. We use cmake to build/install our unit tests for 6.6 but this tutorial was meant to illustrate how to build to an arbitrary directory. If you're just interesting in building a fresh CFS with the simple eci app, look to the next section.
cp -r <eci_dir>/ci/simple_app/simpleECIApp_defs <cfs_dir>/ cp <eci_dir>/ci/common_defs <cfs_dir>/simpleECIApp_defs
cp <eci_dir>/ci/simple_app/to_lab/to_lab_sub_table.h <cfs_dir>/apps/to_lab/fsw/platform_inc cp <eci_dir>/ci/simple_app/sch_lab/CMakeLists.txt <cfs_dir>/apps/sch_lab/ cp <eci_dir>/ci/simple_app/sch_lab/sch_lab_sched_tab.h <cfs_dir>/apps/sch_lab/fsw/platform_inc mv <cfs_dir>/cfe/cmake/Makefile.sample <cfs_dir>/Makefile
mkdir -p <cfs_dir>/apps/eci/fsw cp <eci_dir>/fsw/* <cfs_dir>/apps/eci/fsw/
cp -r <eci_dir>/examples/simpleECIApp/ <cfs_dir>/apps/
cd <cfs_dir> make install
Run our built CFS
cd <cfs_dir>/build/exe/cpu1/ sudo ./core-cpu1
You should see a message indicating the CFS has started the simple app.
Even though the instructions for building and running our examples with cmake is much easier, we prefer to automate these steps for fast development/testing. We've included a CMakeLists file in each of the apps ci directories for convenience. To build a functioning CFS ecosystem using these directives...
mkdir <any_dir>/build
cmake <eci_dir>/ci/simple_app
cd ./cfs make install
cd ./build/exe/cpu1/ sudo ./core-cpu1