Skip to content

Commit

Permalink
Update to Ubuntu 18.04 and CentOS 7.6; Add AIT as ground station option;
Browse files Browse the repository at this point in the history
  • Loading branch information
jlucas9 committed Jul 29, 2019
1 parent e51f9d3 commit 5956880
Show file tree
Hide file tree
Showing 106 changed files with 20,399 additions and 1,224 deletions.
83 changes: 59 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,58 +1,67 @@
# NASA Operational Simulator for Small Satellites
The NASA Operational Simulator for Small Satellites (NOS3) is a suite of tools developed by NASA's Katherine Johnson Independent Verification and Validation (IV&V) Facility to aid in areas such as software development, integration & test (I&T), mission operations/training, verification and validation (V&V), and software systems check-out.
NOS3 provides a software development environment, a multi-target build system, an operator interface/ground station, dynamics and environment simulations, and software-based hardware models.

## Getting Started
This repository allows the user to generate a VM in which to develop and test utilizing Vagrant and Virtual Box enabling every user to have an identical environment.

Various open source packages have been utilized and will be installed, these are explained minimally below:
* 42 - Spacecraft dynamics and visualization, NASA GSFC
* AMMOS Instrument Toolkit (AIT) - Ground Station from NASA JPL
* cFS - core Flight System, NASA GSFC
* COSMOS - Ball Aerospace
* COSMOS - Ground Station from Ball Aerospace
* ITC Common - Loggers and developer tools, NASA IV&V ITC
* NOS Engine - Middleware bus simulator, NASA IV&V ITC

### Prerequisites
Each of the applications listed below are required prior to performing the installation procedure:
* [Git 1.8+](https://git-scm.com/)
* [Vagrant 1.9+](https://www.vagrantup.com/)
* [VirtualBox 5.1+](https://www.virtualbox.org/)
* [Vagrant 2.2.3+](https://www.vagrantup.com/)
* [VirtualBox 6.0+](https://www.virtualbox.org/)

### Installing
1. Open a terminal
2. Navigate to the desired location for the repository
3. Clone the repository
4. Navigate to `/nos3/support`
5. Run `vagrant up` and wait to return to a prompt
6. Run `vagrant reload` and wait for the VM to restart
7. Login to the nos3 user using the password `nos3123!` and get to work!
- This can take anywhere from 20 minutes to hours depending on internet speeds and host PC specs
- The VM will reboot multiple times in order to finish install packages for you automatically so wait for that prompt!
6. Login to the nos3 user using the password `nos3123!` and get to work!
7. Try building and running following the instructions below

### Running
In both CentOS and Ubuntu, scripts are located on the desktop that enable the user to easily work:
* `nos3-build.sh` - Build FSW and simulators
* `nos3-run.sh` - Launch the ground station, FSW, and simulators
* `nos3-stop.sh` - Safely stop all components
Note that in Ubuntu the toolbar may be right clicked to select one of these options and defaults to simply running.

### Directory Layout
* `~/nos3/` contains the repository at the time of the build locally in the VM.
* /apps - the open source cFS apps
* /build - the unarchived build directory
* /cfe - the core flight system (cFS) source files
* /docs - documentation related to cFS
* /osal - operating system abstraction layer (OSAL), enables building for linux and flight OS
* /psp - platform support package (PSP), enables use on multiple types of boards
* /support - all the files needed for ground stations, ION, and installation
- /apps - the open source cFS apps
- /cfe - the core flight system (cFS) source files
- /components - the hardware component apps
- /osal - operating system abstraction layer (OSAL), enables building for linux and flight OS
- /psp - platform support package (PSP), enables use on multiple types of boards
- /sims - the component simulators
- /support - all the files needed for ground stations, and installation
* /ait - AIT database files
* /cosmos - COSMOS database files
* /installers - installation scripts
* /packages - installation packages
* /planning - pass planning software
* /VirtualMachine - files directly releated to the VM, such as desktop scripts and launchers
* `Vagrantfile` - main provisioner file used to generate the VM
* /tools - standard cFS provided tools
* `.gitignore` - list of files and directories to be ommitted from git
* `.gitmodules` - list of git submodules utilized
* `CMakeLists.txt` - top level cmake file to be used from inside the build directory
* `README.md` - this file
- /tools - standard cFS provided tools
- `.gitignore` - list of files and directories to be ommitted from git
- `CMakeLists.txt` - top level make file wrapping CMake functions for ease of use
- `README.md` - this file

## Development
Work occurs inside the VM, via shared folders, or on the host. This repository is copied into the `~/nos3` directory on installation, but can be moved / shared to a different location. Note that changing this directory will cause the scripts provided on the desktop to malfunction.
Work occurs inside the VM, via shared folders, or on the host.
This repository is copied into the `~/nos3` directory on installation, but can be moved / shared to a different location.
Note that changing this directory will cause the scripts provided on the desktop to malfunction.

### Git Flow
The following flow for development should be adhered to when possible:
Expand All @@ -68,13 +77,13 @@ The following flow for development should be adhered to when possible:
* Commits direct to this branch are only to be hot fixes and are not desired

* Feature Branch
* Have a Gitlab issue describing the end goal and path forward
* Have an issue describing the end goal and path forward
* Based out of development and merged back in after testing

### Example Flow
Note that the git command line may be substitued for a GUI tool without issue.
Note that the git command line may be substituted for a GUI tool without issue.

1. Create GitLab issue describing the goal and the path forward
1. Create an issue describing the goal and the path forward
2. Open a terminal
2. Navigate to the top level directory of the working tree.
4. Checkout the development branch
Expand All @@ -92,12 +101,38 @@ Note that the git command line may be substitued for a GUI tool without issue.
10. Merge feature branch into development
- `git merge ##-Example-Issue`

### Versioning
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the tags on this repository.

## Support
If this project interests you or if you have any questions, please feel free to contact any developer directly or email `[email protected]`.

### Frequently Asked Questions
* A GUI environment hasn't shown up after an extended period (> 1.5 hours), what should I do?
- Stop the provision, delete the existing VM (if it was created), and try again
- `CTRL + C`, `vagrant destroy`, `y`, `vagrant up`, wait, `vagrant reload`
* What is the root username and password?
- `vagrant` with password `vagrant`
* Why doesn't the shared clipboard work?
- You will most likely need to re-install / update the guest additions and reboot for this to function properly
- In the VirtualBox menu select: Devices -> Insert Guest Additions CD Image...
- Follow the instructions provided
* How can I mount a shared folder so that I edit on my host and compile / run in the VM?
- In the VirtualBox menu select: Devices -> Shared Folders -> Shared Folders Settings...
- Select the folder with a plus sign to add your folder
* Provide the path, name, mount point inside the VM
* Select `Auto-mount`, `Make Permanent`, and `OK`
* Additional libraries / tools are needed for a specific mission, how can I include them during the provisioning process?
- The `support/installers/$OS/*_CUSTOM.sh` script is designed specifically for this purpose
* How can I run 42 without the GUI?
- Edit the `~/Desktop/nos3-42/NOS3-42InOut/Inp_Sim.txt` and set Graphics Front End to `FALSE`
* NOS Engine Standalone server reports `NOSEngine.Uart - close uart port failed` error?
- This isn't actually an error and is scheduled to be removed, proceed as usual.
* `core-linux` fails with a `__pthread_mutex_lock_full` error repeatedly?
- This is a known issue that is being investigated, for now simply try to run `core-linux` again.
* `core-linux` hangs with a `NAV_LibInit()` call?
- This is another known issue that is under investigation, for now simply try to run `core-linux` again.

### Versioning
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the tags on this repository.

### License
This project is licensed under the NOSA (NASA Open Source Agreement) License.

Expand Down
2 changes: 1 addition & 1 deletion apps/hk/fsw/src/hk_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,8 @@ int32 HK_AppInit(void)
"Error Creating Memory Pool,RC=0x%08X",Status);
return (Status);
}
HK_AppData.RunStatus = CFE_ES_APP_RUN; // TODO: How did this value change in `CFE_ES_PoolCreate`?

HK_AppData.RunStatus = CFE_ES_APP_RUN;
HK_ResetHkData ();


Expand Down
1 change: 1 addition & 0 deletions apps/to_lab/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ include_directories(fsw/mission_inc)
include_directories(fsw/platform_inc)
include_directories(${ci_lab_MISSION_DIR}/fsw/platform_inc)
include_directories(${sample_app_MISSION_DIR}/fsw/platform_inc)
include_directories(${hk_MISSION_DIR}/fsw/platform_inc)

include_directories(${arducam_MISSION_DIR}/fsw/platform_inc
${novatel_oem615_MISSION_DIR}/fsw/platform_inc)
Expand Down
4 changes: 3 additions & 1 deletion apps/to_lab/fsw/platform_inc/to_lab_sub_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
//#include "sample_app_msgids.h"
#include "cam_msgids.h"
#include "nav_msgids.h"
#include "hk_msgids.h"

#if 0
#include "hs_msgids.h"
Expand All @@ -46,7 +47,8 @@ static TO_subsciption_t TO_SubTable[] =
{CAM_HK_TLM_MID, {0,0}, 10},
{CAM_EXP_TLM_MID, {0,0}, 100},
{NAV_SEND_HK_TLM, {0,0}, 10},
{TO_UNUSED, {0,0}, 0},
{HK_HK_TLM_MID, {0,0}, 24},
{HK_COMBINED_PKT1_MID, {0,0}, 20},

#if 0
/* Add these if needed */
Expand Down
4 changes: 2 additions & 2 deletions components/hwlib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ include_directories(fsw/mission_inc

# freertos include directories for flight configuration
IF(CFE_SYSTEM_PSPNAME STREQUAL FLIGHT_PSPNAME)
message(STATUS "FLIGHT configuration")
message(STATUS "hwlib: FLIGHT configuration")
#include_directories(flight needed includes here)
else()
message(STATUS "NON-FLIGHT configuration")
message(STATUS "hwlib: NON-FLIGHT configuration")
ENDIF()

# create the hwlib app module
Expand Down
4 changes: 2 additions & 2 deletions components/hwlib/fsw/src/hwlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ int32 hwlib_Init(void)
}
else
{
CFE_EVS_SendEvent(HWLIB_INIT_EID, CFE_EVS_ERROR, "CAM Lib HW Init ERROR = 0x%lx\n", status);
CFE_EVS_SendEvent(HWLIB_INIT_EID, CFE_EVS_ERROR, "CAM Lib HW Init ERROR = 0x%dx\n", status);
}

/* Initialize the NAV Lib */
Expand All @@ -91,7 +91,7 @@ int32 hwlib_Init(void)
}
else
{
CFE_EVS_SendEvent(HWLIB_INIT_EID, CFE_EVS_ERROR, "NAV Lib HW Init ERROR = 0x%lx", status);
CFE_EVS_SendEvent(HWLIB_INIT_EID, CFE_EVS_ERROR, "NAV Lib HW Init ERROR = 0x%dx", status);
}

return OS_SUCCESS;
Expand Down
15 changes: 15 additions & 0 deletions components/hwlib/sim/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
project(noslink C)
cmake_minimum_required(VERSION 2.6.4)

include(CMakeParseArguments)

# find itc cmake module path
find_path(_ITC_CMAKE_MODULES_
NAMES FindITC_Common.cmake
PATHS ${ITC_CMAKE_MODULES}
${ITC_DEV_ROOT}/cmake/modules
$ENV{ITC_DEV_ROOT}/cmake/modules
/usr/local/cmake/modules
/usr/cmake/modules)
if(NOT _ITC_CMAKE_MODULES_)
message(WARNING "Unable to find ITC CMake Modules")
endif()
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${_ITC_CMAKE_MODULES_})

set(CXX_11 ON)

find_package(NOSENGINE REQUIRED COMPONENTS uart i2c spi)
Expand Down
5 changes: 3 additions & 2 deletions components/hwlib/sim/src/libuart.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ void nos_init_usart_link(void)
/* destroy nos engine usart link */
void nos_destroy_usart_link(void)
{
int i;

OS_MutSemTake(nos_usart_mutex);

/* clean up usart buses */
int i;
for(i = 0; i <= NUM_USARTS; i++)
{
NE_Uart *dev = usart_device[i];
Expand Down Expand Up @@ -137,11 +137,12 @@ int32 uart_write_port(int32 handle, uint8 data[], const uint32 numBytes)
int32 uart_read_port(int32 handle, uint8 data[], const uint32 numBytes)
{
char c = 0;
int i;
NE_Uart *dev = nos_get_usart_device((int)handle);
if(dev)
{
OS_MutSemTake(nos_usart_mutex);
for (int i = 0; i < (int)numBytes; i++)
for (i = 0; i < (int)numBytes; i++)
{
NE_uart_getc(dev, (uint8_t*)&c);
data[i] = c;
Expand Down
2 changes: 1 addition & 1 deletion nasa_defs/cfe_es_startup.scr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ CFE_APP, /cf/ci_lab.so, CI_Lab_AppMain, CI_LAB_APP, 50,
CFE_APP, /cf/to_lab.so, TO_Lab_AppMain, TO_LAB_APP, 50, 8192, 0x0, 0;
CFE_APP, /cf/hk.so, HK_AppMain, HK, 50, 8192, 0x0, 0;

CFE_LIB, /cf/hwlib.so, HW_LibInit, HW_LIB, 0, 0, 0x0, 0;
CFE_LIB, /cf/hwlib.so, hwlib_Init, HW_LIB, 0, 0, 0x0, 0;

CFE_APP, /cf/cam.so, CAM_AppMain, CAM, 50, 8192, 0x0, 0;
CFE_APP, /cf/novatel_oem615.so, novatel_oem615_Main, NOVATEL_OEM615, 50, 8192, 0x0, 0;
Expand Down
1 change: 0 additions & 1 deletion nasa_defs/tables/hk_cpy_tbl.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
#include "hk_msgids.h"
#include "hk_tbldefs.h"
#include "cfe_tbl_filedef.h"
#include "cfe_msgids.h"

hk_copy_table_entry_t HK_CopyTable[HK_COPY_TABLE_ENTRIES] =
{
Expand Down
9 changes: 5 additions & 4 deletions nasa_defs/tables/sch_def_msgtbl.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@

#include "cfe_msgids.h"
#include "ci_lab_msgids.h"
#include "hk_msgids.h"
#include "sch_msgids.h"
/* #include "sc_msgids.h" */
/* #include "cs_msgids.h" */
Expand Down Expand Up @@ -133,8 +134,8 @@ SCH_MessageEntry_t SCH_DefaultMessageTable[SCH_MAX_MESSAGES] =
/*{ { HTONS(FM_SEND_HK_MID), HTONS(0xC000), HTONS(0x0001), HTONS(0x0000) } }, */
{ { HTONS(SCH_UNUSED_MID) } },
/* command ID #9 - Housekeeping HK Request */
/*{ { HTONS(HK_SEND_HK_MID), HTONS(0xC000), HTONS(0x0001), HTONS(0x0000) } }, */
{ { HTONS(SCH_UNUSED_MID) } },
{ { HTONS(HK_SEND_HK_MID), HTONS(0xC000), HTONS(0x0001), HTONS(0x0000) } },
/*{ { HTONS(SCH_UNUSED_MID) } },*/

/* command ID #10 - Health & Safety HK Request */
/*{ { HTONS(HS_SEND_HK_MID), HTONS(0xC000), HTONS(0x0001), HTONS(0x0000) } }, */
Expand All @@ -158,8 +159,8 @@ SCH_MessageEntry_t SCH_DefaultMessageTable[SCH_MAX_MESSAGES] =
** CFS routine messages
*/
/* command ID #16 - HK Send Combined Housekeeping Msg #1 */
/*{ { HTONS(HK_SEND_COMBINED_PKT_MID), HTONS(0xC000), HTONS(0x0003), HTONS(0x0000), HTONS(HK_COMBINED_PKT1_MID) } }, */
{ { HTONS(SCH_UNUSED_MID) } },
{ { HTONS(HK_SEND_COMBINED_PKT_MID), HTONS(0xC000), HTONS(0x0003), HTONS(0x0000), HK_COMBINED_PKT1_MID } },
/*{ { HTONS(SCH_UNUSED_MID) } },*/
/* command ID #17 - HK Send Combined Housekeeping Msg #2 */
/*{ { HTONS(HK_SEND_COMBINED_PKT_MID), HTONS(0xC000), HTONS(0x0003), HTONS(0x0000), HTONS(HK_COMBINED_PKT2_MID) } }, */
{ { HTONS(SCH_UNUSED_MID) } },
Expand Down
7 changes: 4 additions & 3 deletions nasa_defs/tables/sch_def_schtbl.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,10 @@ SCH_ScheduleEntry_t SCH_DefaultScheduleTable[SCH_TABLE_ENTRIES] =

/* slot #0 */
/*{ SCH_DISABLED, SCH_ACTIVITY_SEND_MSG, 1, 0, 24, SCH_GROUP_MD_WAKEUP }, */ /* MD Wakeup */
{ SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE},
{ SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE},
{ SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE},
{ SCH_ENABLED, SCH_ACTIVITY_SEND_MSG, 5, 0, 37, SCH_GROUP_NONE},
{ SCH_ENABLED, SCH_ACTIVITY_SEND_MSG, 1, 0, 9, SCH_GROUP_NONE},
{ SCH_ENABLED, SCH_ACTIVITY_SEND_MSG, 1, 0, 16, SCH_GROUP_NONE},
/*{ SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE}, */
{ SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE},
{ SCH_UNUSED, 0, 0, 0, 0, SCH_GROUP_NONE},

Expand Down
2 changes: 1 addition & 1 deletion nasa_defs/toolchain-linux.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ SET(CFE_SYSTEM_PSPNAME "nos-linux")

SET(OSAL_SYSTEM_OSTYPE "posix")

SET(CMAKE_C_FLAGS_INIT "-g -Wfatal-errors -Wformat=0" CACHE STRING "C Flags required by platform")
SET(CMAKE_C_FLAGS_INIT "-g -Wfatal-errors -Wformat=0 -m32" CACHE STRING "C Flags required by platform")

2 changes: 1 addition & 1 deletion nasa_defs/toolchain-linux.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ SET(CFE_SYSTEM_PSPNAME "${AUTO_LINUX_PSPNAME}")

SET(OSAL_SYSTEM_OSTYPE "posix")

SET(CMAKE_C_FLAGS_INIT "-g -Wfatal-errors -Wformat=0" CACHE STRING "C Flags required by platform")
SET(CMAKE_C_FLAGS_INIT "-g -Wfatal-errors -Wformat=0 -m32" CACHE STRING "C Flags required by platform")

19 changes: 17 additions & 2 deletions psp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
project(CFEPSP C)

include(CMakeParseArguments)

# find itc cmake module path
find_path(_ITC_CMAKE_MODULES_
NAMES FindITC_Common.cmake
PATHS ${ITC_CMAKE_MODULES}
${ITC_DEV_ROOT}/cmake/modules
$ENV{ITC_DEV_ROOT}/cmake/modules
/usr/local/cmake/modules
/usr/cmake/modules)
if(NOT _ITC_CMAKE_MODULES_)
message(WARNING "Unable to find ITC CMake Modules")
endif()
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${_ITC_CMAKE_MODULES_})

if (NOT CFE_SYSTEM_PSPNAME)
message(FATAL_ERROR "CFE_SYSTEM_PSPNAME is not defined - do not know which to build")
endif()
Expand All @@ -10,7 +25,7 @@ if (CFE_SYSTEM_PSPNAME STREQUAL "nos-linux")
find_package(NOSENGINE REQUIRED COMPONENTS client)
include_directories(include
${NOSENGINE_INCLUDE_DIRS}
${noslink_SOURCE_DIR}/inc)
${CMAKE_CURRENT_SOURCE_DIR}/../components/hwlib/sim/inc)
message(STATUS "Set NOS Engine Includes")
endif()

Expand All @@ -31,6 +46,6 @@ aux_source_directory(fsw/${CFE_SYSTEM_PSPNAME}/src PSPFILES)
add_library(psp-${CFE_SYSTEM_PSPNAME} STATIC ${PSPFILES})

if (CFE_SYSTEM_PSPNAME STREQUAL "nos-linux")
target_link_libraries(psp-${CFE_SYSTEM_PSPNAME} ${NOSENGINE_LIBRARIES})
target_link_libraries(psp-${CFE_SYSTEM_PSPNAME} ${NOSENGINE_LIBRARIES} noslink)
message(STATUS "Set NOS Engine Libraries")
endif()
Loading

0 comments on commit 5956880

Please sign in to comment.