How to add the Checksum App to cFS and COSMOS

Preliminary Trainings

This document assumes you have completed the following cFS and cFS + COSMOS trainings

cFS training

cFS + COSMOS Training

COSMOS

cFS

Checksum App

Add Checksum App to cFS

Inside ./cFS/apps do git clone https://github.com/nasa/CS.git

Then just like exercise 7 from the cFS training add CS to the ./sample_defs/targets.cmake file as part of the cpu1 APPLIST. Also add an entry in the cpu1 startup script ./sample_defs/cpu1_cfe_es_startup.scr to launch the checksum app.

targets.cmake: targets-cmake-CS cpu1_cfe_es_startup.scr: cpu-startup-CS

Enable Checksum App Telemetry Output

The changes in the previous step are sufficient to build and launch the checksum app when you run make install and run ./core_cpu1, but there will not be any telemetry output going to the COSMOS ground station when we configure it in the next step. Before we configure COSMOS, we need to add the checksum housekeeping telemetry to both sch_lab and to_lab.

sch_lab

Firstly, the checksum header files need to be included in sch_lab/CMakeLists.txt. Otherwise, sch_lab won't be able to access anything.

include_directories(${CS_MISSION_DIR}/fsw/platform_inc)

Now we need to add an entry to the scheduler that will command the checksum app to send housekeeping telemetry.

First include the checksum message IDs header file inside sch_lab/fsw/platform_inc/sch_lab_sched_tab.h

#include "cs_msgids.h"

Then add the following entry to the schedule table .Config inside sch_lab/fsw/src/sch_lab_table.c. Note: CS_SEND_HK_MID is defined in the header file we just included.

{CFE_SB_MSGID_WRAP_VALUE(CS_SEND_HK_MID), 4},

to_lab

Now that we have housekeeping telemetry being sent by the checksum app, we need to tell the to_lab to output the telemetry, so that the COSMOS ground system can access it.

Just like before the to_lab/CMakeLists.txt needs to include the checksum header files

include_directories(${CS_MISSION_DIR}/fsw/platform_inc)

Now in to_lab/fsw/src/to_lab_sub.c we need to include the checksum message IDs header and add a subscriber to the checksum housekeeping telemetry messages.

Right below the sample app message IDs include add

#include "cs_msgids.h"

Then add the following to the .Subs list

{CFE_SB_MSGID_WRAP_VALUE(CS_HK_TLM_MID), {0, 0}, 4},

Add Checksum App to COSMOS

Now that the checksum app is fully configured in cFS we can add it to COSMOS.

Add a new target called CS just like in the cFS + COSMOS training.

  • Declare the target in system/system.txt
  • Add the CS target to the LOCAL interface in tools/cmd_tlm_server/cmd_tlm_server.txt

Add Checksum Telemetry to COSMOS

Now in targets/CS/cmd_tlm/tlm.txt you need to add the really large housekeeping message definition defined in cFS/apps/CS/fsw/src/cs_msg.h.

# CHECKSUM Telemetry
TELEMETRY CS CS_HK BIG_ENDIAN "CS_APP housekeeping telemetry"
  APPEND_ID_ITEM  STREAM_ID               16  UINT  0x08A4  ""
  APPEND_ITEM     SEQUENCE                16  UINT          ""
  APPEND_ITEM     PKT_LEN                 16  UINT          ""
  APPEND_ITEM     SECONDS                 32  UINT          ""
  APPEND_ITEM     SUBSECS                 16  UINT          ""
  APPEND_ITEM     CMD_CNT                 8   UINT          "Command Counter"
  APPEND_ITEM     CMD_ERRS                8   UINT          "Command Error Count"
  APPEND_ITEM     CS_STATE                8   UINT          "Checksum State"
  APPEND_ITEM     EEPROM_CS_STATE         8   UINT          "Eeprom Checksum State"
  APPEND_ITEM     MEMORY_CS_STATE         8   UINT          "Memory Checksum State"
  APPEND_ITEM     APP_CS_STATE            8   UINT          "App Checksum State"
  APPEND_ITEM     TABLES_CS_STATE         8   UINT          "Tables Checksum State"
  APPEND_ITEM     OS_CS_STATE             8   UINT          "OS Checksum State"
  APPEND_ITEM     CFE_CORE_CS_STATE       8   UINT          "Cfe Core Checksum State"
  APPEND_ITEM     RECOMPUTE_IN_PROGRESS   8   UINT          "Recompute In Progress"
  APPEND_ITEM     ONE_SHOT_IN_PROGRESS    8   UINT          "One Shot In Progress"
  APPEND_ITEM     FILLER_8                8   UINT          ""
  APPEND_ITEM     EEPROM_CS_ERRS          16  UINT          "Eeprom Checksum Error Counter"
  APPEND_ITEM     MEMORY_CS_ERRS          16  UINT          "Memory Checksum Error Counter"
  APPEND_ITEM     APP_CS_ERRS             16  UINT          "App Checksum Error Counter"
  APPEND_ITEM     TABLES_CS_ERRS          16  UINT          "Tables Checksum Error Counter"
  APPEND_ITEM     CFE_CORE_CS_ERRS        16  UINT          "Cfe Core Checksum Error Counter"
  APPEND_ITEM     OS_CS_ERRS              16  UINT          "OS Checksum Error Counter"
  APPEND_ITEM     CURRENT_CS_TABLE        16  UINT          "Current CS Table"
  APPEND_ITEM     CURRENT_ENTRY_IN_TABLE  16  UINT          "Current Entry in Table"
  APPEND_ITEM     EEPROM_BASELINE         32  UINT          "Eeprom Baseline"
  APPEND_ITEM     OS_BASELINE             32  UINT          "OS Baseline"
  APPEND_ITEM     CFE_CORE_BASELINE       32  UINT          "Cfe Core Baseline"
  APPEND_ITEM     LAST_ONE_SHOT_ADDR      32  UINT          "Last One Shot Address"
  APPEND_ITEM     LAST_ONE_SHOT_SIZE      32  UINT          "Last One Shot Size"
  APPEND_ITEM     LAST_ONE_SHOT_MAX_BYTES 32  UINT          "Last One Shot Max Bytes Per Cycle"
  APPEND_ITEM     LAST_ONE_SHOT_CHECKSUM  32  UINT          "Last One Shot Checksum"
  APPEND_ITEM     PASS_COUNTER            32  UINT          "Pass Counter"

With this telemetry definition in COSMOS you can now launch cFS, launch COSMOS, send the enable TO output command you created in the cFS + COSMOS training, then you should see the CS_HK packets packet count start to increment CS_HK-packet-count

You can also view the housekeeping packets received from the checksum app in the packet viewer. checksum-hk-packet