diff --git a/.gitmodules b/.gitmodules index addbce0..ff711fc 100644 --- a/.gitmodules +++ b/.gitmodules @@ -34,3 +34,6 @@ [submodule "libs/fprime_cfs"] path = libs/fprime_cfs url = https://github.com/fprime-community/fprime_cfs.git +[submodule "apps/sch_lab"] + path = apps/sch_lab + url = https://github.com/nasa/sch_lab.git diff --git a/README.md b/README.md index f0f8f58..265be98 100644 --- a/README.md +++ b/README.md @@ -5,11 +5,15 @@ This repository contains a minimal cFS system that demonstrates the use of cFS a 1. `fprime_app`: A simple demonstration app showing how to construct cFS applications using F Prime 2. `fprime_gds`: An application that bridges the F Prime GDS to the cFS messaging bus +The system also includes the standard cFS `sch_lab` scheduler app, which publishes the 1 Hz tick +that drives the F Prime application's rate groups. + ```mermaid flowchart LR fprime_app(("fprime_app")) --- Bus[cFS Messaging Bus] fprime_gds(("fprime_gds")) --- Bus + sch_lab(("sch_lab")) --- Bus gds["F Prime GDS"] --- fprime_gds ``` @@ -51,6 +55,11 @@ make install ## Running the Reference +> [!NOTE] +> The F Prime application's rate groups are driven by a 1 Hz tick message (command MID `0x1890`, +> APID `0x090`) published by the `sch_lab` scheduler app included in this system. The schedule is +> configured in `fprime_cfs_reference_defs/tables/cpu1_sch_lab_table.c`. + The build is installed in `build-artifacts/exe/cpu1/`. You can run the reference system using the following command: ```bash diff --git a/apps/sch_lab b/apps/sch_lab new file mode 160000 index 0000000..bfc82af --- /dev/null +++ b/apps/sch_lab @@ -0,0 +1 @@ +Subproject commit bfc82af9dfec38722b8d68ff1cf232f1b58662d1 diff --git a/fprime_cfs_reference_defs/cpu1_cfe_es_startup.scr b/fprime_cfs_reference_defs/cpu1_cfe_es_startup.scr index b94432c..4e4f541 100644 --- a/fprime_cfs_reference_defs/cpu1_cfe_es_startup.scr +++ b/fprime_cfs_reference_defs/cpu1_cfe_es_startup.scr @@ -1,4 +1,5 @@ CFE_LIB, cfe_assert, CFE_Assert_LibInit, ASSERT_LIB, 0, 0, 0x0, 0; +CFE_APP, sch_lab, SCH_LAB_AppMain, SCH_LAB, 30, 16384, 0x0, 0; CFE_APP, fprime_gds, FPRIME_GDS_Main, FPRIME_GDS, 25, 16384, 0x0, 0; CFE_APP, fprime_app, FPRIME_APP_Main, FPRIME_APP, 25, 65536, 0x0, 0; ! diff --git a/fprime_cfs_reference_defs/tables/cpu1_sch_lab_table.c b/fprime_cfs_reference_defs/tables/cpu1_sch_lab_table.c new file mode 100644 index 0000000..677e2a5 --- /dev/null +++ b/fprime_cfs_reference_defs/tables/cpu1_sch_lab_table.c @@ -0,0 +1,27 @@ +/* +** Mission override of the sch_lab schedule table. +** +** Publishes the F Prime tick message: a cFS command with MID 0x1890 +** (command type bit + secondary header flag + APID 0x090, function code 0) +** once per second. The fprime_app CfsBridge subscribes to this message and +** routes it to the SchAppDriver, which cycles the F Prime rate groups. +*/ + +#include "cfe_tbl_filedef.h" /* Required to obtain the CFE_TBL_FILEDEF macro definition */ +#include "sch_lab_tbl.h" +#include "cfe_sb_api_typedefs.h" /* Required to use the CFE_SB_MSGID_WRAP_VALUE macro */ + +#include "cfe_msgids.h" + +/* F Prime tick: command MID for APID 0x090 (see fprime_app) */ +#define FPRIME_TICK_MID 0x1890 + +SCH_LAB_ScheduleTable_t Schedule = { + .TickRate = 100, /* 100 timer ticks per second */ + .Config = { + /* Send the F Prime tick once per second (every 100 ticks) */ + {CFE_SB_MSGID_WRAP_VALUE(FPRIME_TICK_MID), 100, 0}, + } +}; + +CFE_TBL_FILEDEF(Schedule, SCH_LAB.Schedule, Schedule Lab MsgID Table, sch_lab_table.tbl) diff --git a/fprime_cfs_reference_defs/targets.cmake b/fprime_cfs_reference_defs/targets.cmake index 4e679de..012e3c5 100644 --- a/fprime_cfs_reference_defs/targets.cmake +++ b/fprime_cfs_reference_defs/targets.cmake @@ -86,7 +86,7 @@ SET(SPACECRAFT_ID 0x42) # and must be loaded explicitly via startup script or command. # This list is effectively appended to every TGTx_APPLIST in targets.cmake. # Example: -list(APPEND MISSION_GLOBAL_APPLIST fprime fprime_cfs fprime_app fprime_gds) +list(APPEND MISSION_GLOBAL_APPLIST fprime fprime_cfs fprime_app fprime_gds sch_lab) # The "MISSION_GLOBAL_STATIC_APPLIST" is similar to MISSION_GLOBAL_APPLIST # but the apps are statically linked.