nasa / skeleton_app

fork of sample_app
Apache License 2.0
11 stars 9 forks source link

Add integration instructions #2

Open fletching opened 3 years ago

fletching commented 3 years ago

For a new user, it would be very helpful to include some instructions in README.md on how to add the skeleton_app to nasa/cFS. I have not been able to get it working.

I simply tried to duplicate all of the lines that referenced sample_app and apply them to skeleton_app. The result is in this repo and summarized below.

  1. Add #include "skeleton_app_msgids.h in sch_lab_sched_tab.h
  2. Add {CFE_SB_MSGID_WRAP_VALUE(SKELETON_APP_SEND_HK_MID), 4}, to SCH_TBL_Structure.Config in sch_lab_table.c
  3. Add include_directories(${skeleton_app_MISSION_DIR}/fsw/platform_inc) to apps/sch_lab/CMakeLists.txt
  4. Add {CFE_SB_MSGID_WRAP_VALUE(SKELETON_APP_HK_TLM_MID), {0, 0}, 4}, to TO_LAB_Subs.Subs, and include associated header, in to_lab_sub.c
  5. Add include_directories(${skeleton_app_MISSION_DIR}/fsw/platform_inc) to apps/to_lab/CMakeLists.txt
  6. Duplicate sample_app line for skeleton_app in cpu1_cfe_es_startup.scr
  7. Add skeleton_app to list in targets.cmake
  8. Make message IDs in skeleton_app_msgids.h unique

After making these changes, the program builds successfully. But when running ./core-cpu1, the skeleton_app fails with the following messages.

1980-012-14:03:23.26064 ES Startup: Loading file: /cf/skeleton_app.so, APP: SKELETON_APP
1980-012-14:03:23.26075 ES Startup: SKELETON_APP loaded and created EVS Port1 42/1/CFE_SB 4: CreatePipeErr:OS_QueueCreate returned -11,app SKELETON_APP
1980-012-14:03:23.26083 Skeleton App: Error creating pipe, RC = 0xFFFFFFFFCA000005
1980-012-14:03:23.26084 Application SKELETON_APP called CFE_ES_ExitApp
The full output is here. ``` OS_BSP_Initialize():Maximum user msg queue depth = 500 CFE_PSP: Default Reset SubType = 1 CFE_PSP: Default CPU ID = 1 CFE_PSP: Default Spacecraft ID = 42 CFE_PSP: Default CPU Name: cpu1 OS_Posix_GetSchedulerParams():195:Policy 1: available, min-max: 1-99 OS_Posix_GetSchedulerParams():195:Policy 2: available, min-max: 1-99 OS_Posix_TaskAPI_Impl_Init():381:Selected policy 2 for RT tasks, root task = 99 CFE_PSP: Starting the cFE with a POWER ON reset. CFE_PSP: Clearing out CFE CDS Shared memory segment. CFE_PSP: Clearing out CFE Reset Shared memory segment. CFE_PSP: Clearing out CFE User Reserved Shared memory segment. 1980-001-02:16:00.49803 POWER ON RESET due to Power Cycle (Power Cycle). 1980-001-02:16:00.49809 ES Startup: CFE_ES_Main in EARLY_INIT state CFE_PSP: CFE_PSP_AttachExceptions Called 1980-001-02:16:00.49889 ES Startup: CFE_ES_Main entering CORE_STARTUP state 1980-001-02:16:00.49891 ES Startup: Starting Object Creation calls. 1980-001-02:16:00.49892 ES Startup: Calling CFE_ES_CDSEarlyInit 1980-001-02:16:00.49912 ES Startup: Calling CFE_EVS_EarlyInit 1980-001-02:16:00.49918 Event Log cleared following power-on reset 1980-001-02:16:00.49920 ES Startup: Calling CFE_SB_EarlyInit 1980-001-02:16:00.49924 SB internal message format: CCSDS Space Packet Protocol version 1 1980-001-02:16:00.49925 ES Startup: Calling CFE_TIME_EarlyInit 1980-012-14:03:20.00000 ES Startup: Calling CFE_TBL_EarlyInit 1980-012-14:03:20.00008 ES Startup: Calling CFE_FS_EarlyInit 1980-012-14:03:20.00016 ES Startup: Core App: CFE_EVS created. App ID: 0 EVS Port1 42/1/CFE_EVS 1: cFE EVS Initialized. cFE Version 6.7.21.0 EVS Port1 42/1/CFE_EVS 14: No subscribers for MsgId 0x808,sender CFE_EVS 1980-012-14:03:20.05030 ES Startup: Core App: CFE_SB created. App ID: 1 1980-012-14:03:20.05040 SB:Registered 4 events for filtering EVS Port1 42/1/CFE_SB 1: cFE SB Initialized EVS Port1 42/1/CFE_SB 14: No subscribers for MsgId 0x808,sender CFE_SB 1980-012-14:03:20.10062 ES Startup: Core App: CFE_ES created. App ID: 2 EVS Port1 42/1/CFE_ES 1: cFE ES Initialized EVS Port1 42/1/CFE_SB 14: No subscribers for MsgId 0x808,sender CFE_ES EVS Port1 42/1/CFE_ES 2: Versions:cFE 6.7.21.0, OSAL 5.0.21.0, PSP 1.4.14.0, chksm 45160 EVS Port1 42/1/CFE_SB 14: No subscribers for MsgId 0x808,sender CFE_ES EVS Port1 42/1/CFE_ES 91: Mission 6.7.19-eval-26-g5c095a6.sample, CFE: 6.7.3-bv-270-g7b93466, OSAL: 5.0.3-bv-216-g9eaf83b EVS Port1 42/1/CFE_SB 14: No subscribers for MsgId 0x808,sender CFE_ES EVS Port1 42/1/CFE_ES 92: Build 202007171051 jp@cfs-test-mint-xfce 1980-012-14:03:20.15078 ES Startup: Core App: CFE_TIME created. App ID: 3 EVS Port1 42/1/CFE_TIME 1: cFE TIME Initialized 1980-012-14:03:20.20101 ES Startup: Core App: CFE_TBL created. App ID: 4 EVS Port1 42/1/CFE_TBL 1: cFE TBL Initialized. cFE Version 6.7.21.0 1980-012-14:03:20.25125 ES Startup: Finished ES CreateObject table entries. 1980-012-14:03:20.25126 ES Startup: CFE_ES_Main entering CORE_READY state 1980-012-14:03:20.25130 ES Startup: Opened ES App Startup file: /cf/cfe_es_startup.scr 1980-012-14:03:20.25160 ES Startup: Loading shared library: /cf/sample_lib.so SAMPLE Lib Initialized. Version 1.1.4.0 1980-012-14:03:20.25200 ES Startup: Loading file: /cf/sample_app.so, APP: SAMPLE_APP 1980-012-14:03:20.25212 ES Startup: SAMPLE_APP loaded and created EVS Port1 42/1/SAMPLE_APP 1: SAMPLE App Initialized. Version 1.1.11.0 1980-012-14:03:20.25247 ES Startup: Loading file: /cf/skeleton_app.so, APP: SKELETON_APP 1980-012-14:03:20.25262 ES Startup: SKELETON_APP loaded and created EVS Port1 42/1/CFE_SB 4: CreatePipeErr:OS_QueueCreate returned -11,app SKELETON_APP 1980-012-14:03:20.25266 Skeleton App: Error creating pipe, RC = 0xFFFFFFFFCA000005 1980-012-14:03:20.25267 Application SKELETON_APP called CFE_ES_ExitApp 1980-012-14:03:20.25293 ES Startup: Loading file: /cf/ci_lab.so, APP: CI_LAB_APP 1980-012-14:03:20.25303 ES Startup: CI_LAB_APP loaded and created 1980-012-14:03:20.25328 CI_LAB listening on UDP port: 1234 EVS Port1 42/1/CI_LAB_APP 3: CI Lab Initialized. Version 2.3.5.0 1980-012-14:03:20.25349 ES Startup: Loading file: /cf/to_lab.so, APP: TO_LAB_APP 1980-012-14:03:20.25360 ES Startup: TO_LAB_APP loaded and created EVS Port1 42/1/CFE_SB 7: Duplicate Subscription,MsgId 0x0 on TO_LAB_TLM_PIPE pipe,app TO_LAB_APP EVS Port1 42/1/CFE_SB 7: Duplicate Subscription,MsgId 0x0 on TO_LAB_TLM_PIPE pipe,app TO_LAB_APP EVS Port1 42/1/CFE_SB 7: Duplicate Subscription,MsgId 0x0 on TO_LAB_TLM_PIPE pipe,app TO_LAB_APP EVS Port1 42/1/CFE_SB 7: Duplicate Subscription,MsgId 0x0 on TO_LAB_TLM_PIPE pipe,app TO_LAB_APP 1980-012-14:03:20.25405 ES Startup: Loading file: /cf/sch_lab.so, APP: SCH_LAB_APP 1980-012-14:03:20.25422 ES Startup: SCH_LAB_APP loaded and created SCH Lab Initialized. Version 2.3.7.0 EVS Port1 42/1/TO_LAB_APP 1: TO Lab Initialized. Version 2.3.7.0 Awaiting enable command. 1980-012-14:03:20.30446 ES Startup: CFE_ES_Main entering APPS_INIT state 1980-012-14:03:20.30448 ES Startup: CFE_ES_Main entering OPERATIONAL state EVS Port1 42/1/CFE_ES 14: Exit Application SKELETON_APP on Error Completed. EVS Port1 42/1/CFE_TIME 21: Stop FLYWHEEL ```
fletching commented 3 years ago

This problem was caused by strcpy(SKELETON_AppData.PipeName, "SKELETON_CMD_PIPE"); overflowing the defined length of 16 characters of the string and modifying SKELETON_AppData.PipeDepth to be greater than OS_MAX_QUEUES. By increasing the length to 18, the app runs correctly.

However, some instructions for new users would still be quite helpful.

tstern-masten commented 2 years ago

Thank you so much! This has been a huge help getting the CF app updated to use cmake.

I did notice that one part of the integration instructions is now slightly outdated so I am updating that below:

I don't yet have the app working (depreciated api calls) but I do have cmake attempting to compile the code so this was very helpful.