diff --git a/Makefile b/Makefile index 31640064..8e19f4f8 100755 --- a/Makefile +++ b/Makefile @@ -3,18 +3,19 @@ # BUILDTYPE ?= debug INSTALLPREFIX ?= exe -FSWBUILDDIR ?= $(CURDIR)/fsw/build -GSWBUILDDIR ?= $(CURDIR)/gsw/build -SIMBUILDDIR ?= $(CURDIR)/sims/build +NOS3BUILDDIR ?= /tmp/nos3 +FSWBUILDDIR ?= $(NOS3BUILDDIR)/fsw +GSWBUILDDIR ?= $(NOS3BUILDDIR)/gsw +SIMBUILDDIR ?= $(NOS3BUILDDIR)/sims export CFS_APP_PATH = ../components -export MISSION_DEFS = ../cfg/build/ -export MISSIONCONFIG = ../cfg/build/nos3 +export MISSION_DEFS = /tmp/nos3/cfg/nos3_defs +export MISSIONCONFIG = nos3 # The "prep" step requires extra options that are specified via enviroment variables. # Certain special ones should be passed via cache (-D) options to CMake. # These are only needed for the "prep" target but they are computed globally anyway. -PREP_OPTS := +PREP_OPTS := -DMISSION_DEFS=$(MISSION_DEFS) ifneq ($(INSTALLPREFIX),) PREP_OPTS += -DCMAKE_INSTALL_PREFIX=$(INSTALLPREFIX) @@ -48,7 +49,7 @@ all: build-cryptolib: mkdir -p $(GSWBUILDDIR) - cd $(GSWBUILDDIR) && cmake $(PREP_OPTS) -DSUPPORT=1 ../../components/cryptolib + cd $(GSWBUILDDIR) && cmake -DSUPPORT=1 $(CURDIR)/components/cryptolib $(MAKE) --no-print-directory -C $(GSWBUILDDIR) build-fsw: @@ -56,13 +57,13 @@ ifeq ($(FLIGHT_SOFTWARE), fprime) cd fsw/fprime/fprime-nos3 && fprime-util generate && fprime-util build else mkdir -p $(FSWBUILDDIR) - cd $(FSWBUILDDIR) && cmake $(PREP_OPTS) ../cfe + cd $(FSWBUILDDIR) && cmake $(PREP_OPTS) $(CURDIR)/fsw/cfe $(MAKE) --no-print-directory -C $(FSWBUILDDIR) mission-install endif build-sim: mkdir -p $(SIMBUILDDIR) - cd $(SIMBUILDDIR) && cmake -DCMAKE_INSTALL_PREFIX=$(SIMBUILDDIR) .. + cd $(SIMBUILDDIR) && cmake -DCMAKE_INSTALL_PREFIX=$(SIMBUILDDIR) $(CURDIR)/sims $(MAKE) --no-print-directory -C $(SIMBUILDDIR) install build-test: @@ -70,7 +71,7 @@ ifeq ($(FLIGHT_SOFTWARE), fprime) # TODO else mkdir -p $(FSWBUILDDIR) - cd $(FSWBUILDDIR) && cmake $(PREP_OPTS) -DENABLE_UNIT_TESTS=true ../cfe + cd $(FSWBUILDDIR) && cmake $(PREP_OPTS) -DENABLE_UNIT_TESTS=true $(CURDIR)/fsw/cfe $(MAKE) --no-print-directory -C $(FSWBUILDDIR) mission-install endif @@ -81,22 +82,19 @@ clean: $(MAKE) clean-fsw $(MAKE) clean-sim $(MAKE) clean-gsw - rm -rf cfg/build + ./scripts/clean.sh clean-fsw: - rm -rf cfg/build/nos3_defs - rm -rf fsw/build rm -rf fsw/fprime/fprime-nos3/build-artifacts rm -rf fsw/fprime/fprime-nos3/build-fprime-automatic-native rm -rf fsw/fprime/fprime-nos3/fprime-venv + ./scripts/fsw/fsw_clean.sh clean-sim: - rm -rf sims/build + ./scripts/sim/sim_clean.sh clean-gsw: - rm -rf gsw/build - rm -rf gsw/cosmos/build - rm -rf /tmp/nos3 + ./scripts/gsw/gsw_clean.sh config: ./scripts/cfg/config.sh @@ -105,17 +103,17 @@ debug: ./scripts/debug.sh fsw: - ./cfg/build/fsw_build.sh + $(NOS3BUILDDIR)/cfg/fsw_build.sh $(CURDIR) gsw: ./scripts/gsw/build_cryptolib.sh - ./cfg/build/gsw_build.sh + $(NOS3BUILDDIR)/cfg/gsw_build.sh $(CURDIR) igniter: ./scripts/igniter_launch.sh launch: - ./cfg/build/launch.sh + $(NOS3BUILDDIR)/cfg/launch.sh $(CURDIR) log: ./scripts/log.sh @@ -130,7 +128,7 @@ prep-sat: ./scripts/cfg/prep_sat.sh sim: - ./scripts/build_sim.sh + ./scripts/sim/build_sim.sh start-gsw: ./scripts/gsw/launch_gsw.sh diff --git a/cfg/InOut/Inp_Graphics.txt b/cfg/InOut/Inp_Graphics.txt index 34966368..7aa7ae54 100644 --- a/cfg/InOut/Inp_Graphics.txt +++ b/cfg/InOut/Inp_Graphics.txt @@ -3,7 +3,7 @@ Skymap09.txt ! Star Catalog File Name TRUE ! Map Window Exists FALSE ! Orrery Window Exists -TRUE ! Unit Sphere Window Exists +FALSE ! Unit Sphere Window Exists ******************************* POV ********************************* FALSE ! Pause at Startup TRACK_HOST ! POV Mode (TRACK_HOST, TRACK_TARGET, FIXED_IN_HOST) diff --git a/cfg/nos3_defs/targets.cmake b/cfg/nos3_defs/targets.cmake index c5c220ee..7d13c421 100644 --- a/cfg/nos3_defs/targets.cmake +++ b/cfg/nos3_defs/targets.cmake @@ -97,7 +97,7 @@ list(APPEND MISSION_GLOBAL_APPLIST fm lc sbn - sbn_tcp + sbn/modules/protocol/sbn_tcp sbn_client sc sch diff --git a/scripts/cfg/config.sh b/scripts/cfg/config.sh index 5718fef6..6028f6bf 100755 --- a/scripts/cfg/config.sh +++ b/scripts/cfg/config.sh @@ -6,13 +6,19 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) source $SCRIPT_DIR/../env.sh -# Make flight software configuration directory -mkdir -p $BASE_DIR/cfg/build +# Make build directories +mkdir -p $USER_NOS3_BUILD_DIR/cfg +mkdir -p $USER_NOS3_BUILD_DIR/fsw +mkdir -p $USER_NOS3_BUILD_DIR/gsw +mkdir -p $USER_NOS3_BUILD_DIR/sims # Copy baseline configurations into build directory -cp -r $BASE_DIR/cfg/InOut $BASE_DIR/cfg/build/ -cp -r $BASE_DIR/cfg/nos3_defs $BASE_DIR/cfg/build/ -cp -r $BASE_DIR/cfg/sims $BASE_DIR/cfg/build/ +cp -r $BASE_DIR/cfg/InOut $USER_NOS3_BUILD_DIR/cfg/ +cp -r $BASE_DIR/cfg/nos3_defs $USER_NOS3_BUILD_DIR/cfg/ +cp -r $BASE_DIR/cfg/sims $USER_NOS3_BUILD_DIR/cfg/ # Configure flight software python3 $SCRIPT_DIR/cfg/configure.py + +# Set permissions +chmod 777 -R $USER_NOS3_BUILD_DIR diff --git a/scripts/cfg/configure.py b/scripts/cfg/configure.py old mode 100644 new mode 100755 index ccc27aee..49941c05 --- a/scripts/cfg/configure.py +++ b/scripts/cfg/configure.py @@ -24,12 +24,12 @@ if (fsw_cfg == 'fprime'): fsw_identified = 1 - os.system('cp ./scripts/fsw/fsw_fprime_build.sh ./cfg/build/fsw_build.sh') - os.system('cp ./scripts/fsw/fsw_fprime_launch.sh ./cfg/build/launch.sh') + os.system('cp ./scripts/fsw/fsw_fprime_build.sh /tmp/nos3/cfg/fsw_build.sh') + os.system('cp ./scripts/fsw/fsw_fprime_launch.sh /tmp/nos3/cfg/launch.sh') if (fsw_cfg == 'cfs'): fsw_identified = 1 - os.system('cp ./scripts/fsw/fsw_cfs_build.sh ./cfg/build/fsw_build.sh') - os.system('cp ./scripts/fsw/fsw_cfs_launch.sh ./cfg/build/launch.sh') + os.system('cp ./scripts/fsw/fsw_cfs_build.sh /tmp/nos3/cfg/fsw_build.sh') + os.system('cp ./scripts/fsw/fsw_cfs_launch.sh /tmp/nos3/cfg/launch.sh') if (fsw_identified == 0): print('Invalid FSW in configuration file!') print('Exiting due to error...') @@ -41,25 +41,25 @@ gsw_identified = 0 if (gsw_cfg == 'openc3'): - # Copy openc3 scripts into ./cfg/build + # Copy openc3 scripts into /tmp/nos3 gsw_identified = 1 - os.system('cp ./scripts/gsw/gsw_openc3_build.sh ./cfg/build/gsw_build.sh') - os.system('cp ./scripts/gsw/gsw_openc3_launch.sh ./cfg/build/gsw_launch.sh') + os.system('cp ./scripts/gsw/gsw_openc3_build.sh /tmp/nos3/cfg/gsw_build.sh') + os.system('cp ./scripts/gsw/gsw_openc3_launch.sh /tmp/nos3/cfg/gsw_launch.sh') if (gsw_cfg == 'cosmos'): - # Copy cosmos scripts into ./cfg/build + # Copy cosmos scripts into /tmp/nos3 gsw_identified = 1 - os.system('cp ./scripts/gsw/gsw_cosmos_build.sh ./cfg/build/gsw_build.sh') - os.system('cp ./scripts/gsw/gsw_cosmos_launch.sh ./cfg/build/gsw_launch.sh') + os.system('cp ./scripts/gsw/gsw_cosmos_build.sh /tmp/nos3/cfg/gsw_build.sh') + os.system('cp ./scripts/gsw/gsw_cosmos_launch.sh /tmp/nos3/cfg/gsw_launch.sh') if (gsw_cfg == 'fprime'): - # Copy fprime scripts into ./cfg/build + # Copy fprime scripts into /tmp/nos3 gsw_identified = 1 - os.system('cp ./scripts/gsw/gsw_fprime_build.sh ./cfg/build/gsw_build.sh') - os.system('cp ./scripts/gsw/gsw_fprime_launch.sh ./cfg/build/gsw_launch.sh') + os.system('cp ./scripts/gsw/gsw_fprime_build.sh /tmp/nos3/cfg/gsw_build.sh') + os.system('cp ./scripts/gsw/gsw_fprime_launch.sh /tmp/nos3/cfg/gsw_launch.sh') if (gsw_cfg == 'ait'): - # Copy ait scripts into ./cfg/build + # Copy ait scripts into /tmp/nos3 gsw_identified = 1 - os.system('cp ./scripts/gsw/gsw_ait_build.sh ./cfg/build/gsw_build.sh') - os.system('cp ./scripts/gsw/gsw_ait_launch.sh ./cfg/build/gsw_launch.sh') + os.system('cp ./scripts/gsw/gsw_ait_build.sh /tmp/nos3/cfg/gsw_build.sh') + os.system('cp ./scripts/gsw/gsw_ait_launch.sh /tmp/nos3/cfg/gsw_launch.sh') if (gsw_identified == 0): print('Invalid GSW in configuration file!') print('Exiting due to error...') @@ -242,7 +242,7 @@ lines.insert(sc_startup_eof, cf_line) # Write startup script file - with open('./cfg/build/nos3_defs/cpu1_cfe_es_startup.scr', 'w') as fp: + with open('/tmp/nos3/cfg/nos3_defs/cpu1_cfe_es_startup.scr', 'w') as fp: lines = "".join(lines) fp.write(lines) @@ -273,7 +273,7 @@ lines[date_index] = mission_start_time_utc.strftime('%m %d %Y') + ' ! Date (UTC) (Month, Day, Year)\n' lines[time_index] = mission_start_time_utc.strftime('%H %M %S') + ' ! Time (UTC) (Hr,Min,Sec)\n' - with open('./cfg/build/InOut/Inp_Sim.txt', 'w') as fp: + with open('/tmp/nos3/cfg/InOut/Inp_Sim.txt', 'w') as fp: lines = "".join(lines) fp.write(lines) @@ -288,7 +288,7 @@ lines[tipoff_index] = sc_orbit_tipoff_x + ' ' + sc_orbit_tipoff_y + ' ' + sc_orbit_tipoff_z + ' ! Ang Vel (deg/sec)\n' - with open('./cfg/build/InOut/SC_NOS3.txt', 'w') as fp: + with open('/tmp/nos3/cfg/InOut/SC_NOS3.txt', 'w') as fp: lines = "".join(lines) fp.write(lines) @@ -385,7 +385,7 @@ if (sc_thruster_en != 'true'): lines[thruster_index] = ipc_off - with open('./cfg/build/InOut/Inp_IPC.txt', 'w') as fp: + with open('/tmp/nos3/cfg/InOut/Inp_IPC.txt', 'w') as fp: lines = "".join(lines) fp.write(lines) @@ -408,7 +408,7 @@ torquer_index = 999 thruster_index = 999 - with open('./cfg/build/sims/nos3-simulator.xml', 'r') as fp: + with open('/tmp/nos3/cfg/sims/nos3-simulator.xml', 'r') as fp: lines = fp.readlines() for line in lines: if line.find('camsim') != -1: @@ -487,6 +487,6 @@ if (sc_thruster_en != 'true'): lines[thruster_index] = sim_disabled - with open('./cfg/build/sims/nos3-simulator.xml', 'w') as fp: + with open('/tmp/nos3/cfg/sims/nos3-simulator.xml', 'w') as fp: lines = "".join(lines) fp.write(lines) diff --git a/scripts/clean.sh b/scripts/clean.sh new file mode 100755 index 00000000..03713d5e --- /dev/null +++ b/scripts/clean.sh @@ -0,0 +1,19 @@ +#!/bin/bash -i +# +# Convenience script for NOS3 development +# Use with the Dockerfile in the deployment repository +# https://github.com/nasa-itc/deployment +# + +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +source $SCRIPT_DIR/env.sh + +# Check that NOS3 build directory exists +if [ -d $USER_NOS3_BUILD_DIR ]; then + + # Cleanup all build files + $DFLAGS -v $USER_NOS3_BUILD_DIR:$USER_NOS3_BUILD_DIR --name "nos_clean" -w $BASE_DIR $DBOX rm -rf $USER_NOS3_BUILD_DIR/* + + # Remove build directory + yes | rm -r $USER_NOS3_BUILD_DIR 2> /dev/null +fi diff --git a/scripts/debug.sh b/scripts/debug.sh index 05f479db..d5e18a79 100755 --- a/scripts/debug.sh +++ b/scripts/debug.sh @@ -9,4 +9,4 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) source $SCRIPT_DIR/env.sh mkdir -p $BASE_DIR/fsw/build -$DFLAGS_CPUS -v $BASE_DIR:$BASE_DIR -v $USER_NOS3_DIR:$USER_NOS3_DIR -w $BASE_DIR --sysctl fs.mqueue.msg_max=10000 --ulimit rtprio=99 --cap-add=sys_nice --name "nos3_debug" $DBOX bash +$DFLAGS_CPUS -v $BASE_DIR:$BASE_DIR -v $USER_NOS3_DIR:$USER_NOS3_DIR -v $USER_NOS3_BUILD_DIR:$USER_NOS3_BUILD_DIR -w $BASE_DIR --sysctl fs.mqueue.msg_max=10000 --ulimit rtprio=99 --cap-add=sys_nice --name "nos3_debug" $DBOX bash diff --git a/scripts/env.sh b/scripts/env.sh index 546eaa34..2d9a0f99 100755 --- a/scripts/env.sh +++ b/scripts/env.sh @@ -5,21 +5,24 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) BASE_DIR=$(cd `dirname $SCRIPT_DIR` && pwd) -FSW_DIR=$BASE_DIR/fsw/build/exe/cpu1 + +USERDIR=$(cd ~/ && pwd) +USER_NOS3_DIR=$USERDIR/.nos3 +USER_NOS3_BUILD_DIR=/tmp/nos3 + +FSW_DIR=$USER_NOS3_BUILD_DIR/fsw/exe/cpu1 GSW_BIN=$BASE_DIR/gsw/cosmos/build/openc3-cosmos-nos3 GSW_DIR=$BASE_DIR/gsw/cosmos -SIM_DIR=$BASE_DIR/sims/build +SIM_DIR=$USER_NOS3_BUILD_DIR/sims SIM_BIN=$SIM_DIR/bin -if [ -d $SIM_DIR/bin ]; then - SIMS=$(ls $SIM_BIN/nos3*simulator) -fi +#if [ -d $SIM_DIR/bin ]; then +# SIMS=$(ls $SIM_BIN/nos3*simulator) +#fi DATE=$(date "+%Y%m%d%H%M") NUM_CPUS="$( nproc )" -USERDIR=$(cd ~/ && pwd) -USER_NOS3_DIR=$(cd ~/ && pwd)/.nos3 OPENC3_DIR=$USER_NOS3_DIR/cosmos OPENC3_PATH=$OPENC3_DIR/openc3.sh @@ -39,7 +42,7 @@ INFLUXDB_ADMIN_PASSWORD=admin_password # DNETWORK="docker network" #else DCALL="docker" - DFLAGS="docker run --rm -it -v /etc/passwd:/etc/passwd:ro -v /etc/group:/etc/group:ro -u $(id -u $(stat -c '%U' $SCRIPT_DIR/env.sh)):$(getent group $(stat -c '%G' $SCRIPT_DIR/env.sh) | cut -d: -f3)" + DFLAGS="docker run --rm -it -v /etc/passwd:/etc/passwd:ro -v /etc/group:/etc/group:ro -u $(id -u):$(getent group $(stat -c '%G' $SCRIPT_DIR/env.sh) | cut -d: -f3)" DFLAGS_CPUS="$DFLAGS --cpus=$NUM_CPUS" DCREATE="docker create --rm -it" DNETWORK="docker network" diff --git a/scripts/fsw/fsw_cfs_build.sh b/scripts/fsw/fsw_cfs_build.sh index f9e4e261..b0566f6e 100755 --- a/scripts/fsw/fsw_cfs_build.sh +++ b/scripts/fsw/fsw_cfs_build.sh @@ -5,9 +5,8 @@ # https://github.com/nasa-itc/deployment # -# Note this is copied to ./cfg/build as part of `make config` -SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) -source $SCRIPT_DIR/../../scripts/env.sh +# Note the first argument passed is expected to be the BASE_DIR of the NOS3 repository +source $1/scripts/env.sh # Check that local NOS3 directory exists if [ ! -d $USER_NOS3_DIR ]; then @@ -18,15 +17,12 @@ if [ ! -d $USER_NOS3_DIR ]; then fi # Check that configure build directory exists -if [ ! -d $BASE_DIR/cfg/build ]; then +if [ ! -d $USER_NOS3_BUILD_DIR/cfg ]; then echo "" echo " Need to run make config first!" echo "" exit 1 fi -# Make flight software build directory -mkdir -p $BASE_DIR/fsw/build - # Build -$DFLAGS_CPUS -v $BASE_DIR:$BASE_DIR --name "nos_build_fsw" -w $BASE_DIR $DBOX make -j$NUM_CPUS -e FLIGHT_SOFTWARE=cfs build-fsw +$DFLAGS_CPUS -v $BASE_DIR:$BASE_DIR -v $USER_NOS3_BUILD_DIR:$USER_NOS3_BUILD_DIR --name "nos_build_fsw" -w $BASE_DIR $DBOX make -j$NUM_CPUS -e FLIGHT_SOFTWARE=cfs build-fsw diff --git a/scripts/fsw/fsw_cfs_launch.sh b/scripts/fsw/fsw_cfs_launch.sh index 9dd354a8..20ce8e29 100755 --- a/scripts/fsw/fsw_cfs_launch.sh +++ b/scripts/fsw/fsw_cfs_launch.sh @@ -5,9 +5,8 @@ # https://github.com/nasa-itc/deployment # -# Note this is copied to ./cfg/build as part of `make config` -SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) -source $SCRIPT_DIR/../../scripts/env.sh +# Note the first argument passed is expected to be the BASE_DIR of the NOS3 repository +source $1/scripts/env.sh # Check that local NOS3 directory exists if [ ! -d $USER_NOS3_DIR ]; then @@ -18,7 +17,7 @@ if [ ! -d $USER_NOS3_DIR ]; then fi # Check that configure build directory exists -if [ ! -d $BASE_DIR/cfg/build ]; then +if [ ! -d $USER_NOS3_BUILD_DIR/cfg ]; then echo "" echo " Need to run make config first!" echo "" @@ -53,7 +52,7 @@ echo "" echo "Launch GSW..." echo "" -source $BASE_DIR/cfg/build/gsw_launch.sh +source $USER_NOS3_BUILD_DIR/cfg/gsw_launch.sh $BASE_DIR echo "Create NOS interfaces..." export GND_CFG_FILE="-f nos3-simulator.xml" @@ -88,7 +87,7 @@ do echo $SC_NUM " - 42..." rm -rf $USER_NOS3_DIR/42/NOS3InOut - cp -r $BASE_DIR/cfg/build/InOut $USER_NOS3_DIR/42/NOS3InOut + cp -r $USER_NOS3_BUILD_DIR/cfg/InOut $USER_NOS3_DIR/42/NOS3InOut xhost +local:* gnome-terminal --tab --title=$SC_NUM" - 42" -- $DFLAGS -e DISPLAY=$DISPLAY -v $USER_NOS3_DIR:$USER_NOS3_DIR -v /tmp/.X11-unix:/tmp/.X11-unix:ro --name $SC_NUM"_fortytwo" -h fortytwo --network=$SC_NETNAME -w $USER_NOS3_DIR/42 -t $DBOX $USER_NOS3_DIR/42/42 NOS3InOut echo "" @@ -101,12 +100,12 @@ do cd $FSW_DIR # Debugging # Replace `--tab` with `--window-with-profile=KeepOpen` once you've created this gnome-terminal profile manually - gnome-terminal --title=$SC_NUM" - NOS3 Flight Software" -- $DFLAGS -v $BASE_DIR:$BASE_DIR --name $SC_NUM"_nos_fsw" -h nos_fsw --network=$SC_NETNAME -w $FSW_DIR --sysctl fs.mqueue.msg_max=10000 --ulimit rtprio=99 --cap-add=sys_nice $DBOX $SCRIPT_DIR/fsw/fsw_respawn.sh & + gnome-terminal --title=$SC_NUM" - NOS3 Flight Software" -- $DFLAGS -v $BASE_DIR:$BASE_DIR -v $USER_NOS3_BUILD_DIR:$USER_NOS3_BUILD_DIR --name $SC_NUM"_nos_fsw" -h nos_fsw --network=$SC_NETNAME -w $FSW_DIR --sysctl fs.mqueue.msg_max=10000 --ulimit rtprio=99 --cap-add=sys_nice $DBOX $SCRIPT_DIR/fsw/fsw_respawn.sh & #gnome-terminal --window-with-profile=KeepOpen --title=$SC_NUM" - NOS3 Flight Software" -- $DFLAGS -v $BASE_DIR:$BASE_DIR --name $SC_NUM"_nos_fsw" -h nos_fsw --network=$SC_NETNAME -w $FSW_DIR --sysctl fs.mqueue.msg_max=10000 --ulimit rtprio=99 --cap-add=sys_nice $DBOX $FSW_DIR/core-cpu1 -R PO & echo "" echo $SC_NUM " - CryptoLib..." - gnome-terminal --tab --title=$SC_NUM" - CryptoLib" -- $DFLAGS -v $BASE_DIR:$BASE_DIR --name $SC_NUM"_cryptolib" --network=$SC_NETNAME --network-alias=cryptolib -w $BASE_DIR/gsw/build $DBOX ./support/standalone + gnome-terminal --tab --title=$SC_NUM" - CryptoLib" -- $DFLAGS -v $USER_NOS3_BUILD_DIR:$USER_NOS3_BUILD_DIR --name $SC_NUM"_cryptolib" --network=$SC_NETNAME --network-alias=cryptolib -w $USER_NOS3_BUILD_DIR/gsw $DBOX ./support/standalone echo "" echo $SC_NUM " - Simulators..." diff --git a/scripts/fsw/fsw_clean.sh b/scripts/fsw/fsw_clean.sh new file mode 100755 index 00000000..38173093 --- /dev/null +++ b/scripts/fsw/fsw_clean.sh @@ -0,0 +1,15 @@ +#!/bin/bash -i +# +# Convenience script for NOS3 development +# Use with the Dockerfile in the deployment repository +# https://github.com/nasa-itc/deployment +# + +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +source $SCRIPT_DIR/env.sh + +# Check that NOS3 build directory exists +if [ -d $USER_NOS3_BUILD_DIR/fsw ]; then + # Cleanup all build files + $DFLAGS -v $USER_NOS3_BUILD_DIR:$USER_NOS3_BUILD_DIR --name "nos_clean" -w $BASE_DIR $DBOX rm -rf $USER_NOS3_BUILD_DIR/fsw/* +fi diff --git a/scripts/fsw/fsw_fprime_build.sh b/scripts/fsw/fsw_fprime_build.sh index 199c10be..c449364b 100755 --- a/scripts/fsw/fsw_fprime_build.sh +++ b/scripts/fsw/fsw_fprime_build.sh @@ -5,9 +5,8 @@ # https://github.com/nasa-itc/deployment # -SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[1]}" )/scripts" && pwd ) -source $SCRIPT_DIR/env.sh - +# Note the first argument passed is expected to be the BASE_DIR of the NOS3 repository +source $1/scripts/env.sh # Check that local NOS3 directory exists if [ ! -d $USER_NOS3_DIR ]; then @@ -18,7 +17,7 @@ if [ ! -d $USER_NOS3_DIR ]; then fi # Check that configure build directory exists -if [ ! -d $BASE_DIR/cfg/build ]; then +if [ ! -d $USER_NOS3_BUILD_DIR/cfg ]; then echo "" echo " Need to run make config first!" echo "" diff --git a/scripts/fsw/fsw_fprime_launch.sh b/scripts/fsw/fsw_fprime_launch.sh index 4d041f4d..3b60e1bc 100755 --- a/scripts/fsw/fsw_fprime_launch.sh +++ b/scripts/fsw/fsw_fprime_launch.sh @@ -5,9 +5,8 @@ # https://github.com/nasa-itc/deployment # -# Note this is copied to ./cfg/build as part of `make config` -SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) -source $SCRIPT_DIR/../../scripts/env.sh +# Note the first argument passed is expected to be the BASE_DIR of the NOS3 repository +source $1/scripts/env.sh # Check that local NOS3 directory exists if [ ! -d $USER_NOS3_DIR ]; then @@ -18,7 +17,7 @@ if [ ! -d $USER_NOS3_DIR ]; then fi # Check that configure build directory exists -if [ ! -d $BASE_DIR/cfg/build ]; then +if [ ! -d $USER_NOS3_BUILD_DIR/cfg ]; then echo "" echo " Need to run make config first!" echo "" @@ -51,8 +50,9 @@ $DNETWORK create \ nos3_core echo "" -#echo "Launch GSW..." -$BASE_DIR/cfg/build/gsw_launch.sh +echo "Launch GSW..." +echo "" +source $USER_NOS3_BUILD_DIR/cfg/gsw_launch.sh $BASE_DIR echo "" echo "Create NOS interfaces..." @@ -88,7 +88,7 @@ do echo $SC_NUM " - 42..." rm -rf $USER_NOS3_DIR/42/NOS3InOut - cp -r $BASE_DIR/cfg/build/InOut $USER_NOS3_DIR/42/NOS3InOut + cp -r $USER_NOS3_BUILD_DIR/cfg/InOut $USER_NOS3_DIR/42/NOS3InOut xhost +local:* gnome-terminal --tab --title=$SC_NUM" - 42" -- $DFLAGS -e DISPLAY=$DISPLAY -v $USER_NOS3_DIR:$USER_NOS3_DIR -v /tmp/.X11-unix:/tmp/.X11-unix:ro --name $SC_NUM"_fortytwo" -h fortytwo --network=$SC_NETNAME -w $USER_NOS3_DIR/42 -t $DBOX $USER_NOS3_DIR/42/42 NOS3InOut echo "" @@ -102,7 +102,7 @@ do # Replace `--tab` with `--window-with-profile=KeepOpen` once you've created this gnome-terminal profile manually echo $SC_NUM " - CryptoLib..." - gnome-terminal --tab --title=$SC_NUM" - CryptoLib" -- $DFLAGS -v $BASE_DIR:$BASE_DIR --name $SC_NUM"_cryptolib" --network=$SC_NETNAME --network-alias=cryptolib -w $BASE_DIR/gsw/build $DBOX ./support/standalone + gnome-terminal --tab --title=$SC_NUM" - CryptoLib" -- $DFLAGS -v $USER_NOS3_BUILD_DIR:$USER_NOS3_BUILD_DIR --name $SC_NUM"_cryptolib" --network=$SC_NETNAME --network-alias=cryptolib -w $USER_NOS3_BUILD_DIR/gsw $DBOX ./support/standalone echo "" echo $SC_NUM " - Simulators..." diff --git a/scripts/fsw/onair_launch.sh b/scripts/fsw/onair_launch.sh old mode 100644 new mode 100755 diff --git a/scripts/gsw/build_cryptolib.sh b/scripts/gsw/build_cryptolib.sh index c8f47e94..d03849ac 100755 --- a/scripts/gsw/build_cryptolib.sh +++ b/scripts/gsw/build_cryptolib.sh @@ -17,15 +17,12 @@ if [ ! -d $USER_NOS3_DIR ]; then fi # Check that configure build directory exists -if [ ! -d $BASE_DIR/cfg/build ]; then +if [ ! -d $USER_NOS3_BUILD_DIR/cfg ]; then echo "" echo " Need to run make config first!" echo "" exit 1 fi -# Make ground software build directory -mkdir -p $BASE_DIR/gsw/build - # Build -$DFLAGS_CPUS -v $BASE_DIR:$BASE_DIR --name "nos_build_cryptolib" -w $BASE_DIR $DBOX make -j$NUM_CPUS build-cryptolib +$DFLAGS_CPUS -v $BASE_DIR:$BASE_DIR -v $USER_NOS3_BUILD_DIR:$USER_NOS3_BUILD_DIR --name "nos_build_cryptolib" -w $BASE_DIR $DBOX make -j$NUM_CPUS build-cryptolib diff --git a/scripts/gsw/gsw_ait_build.sh b/scripts/gsw/gsw_ait_build.sh index 1ab46d11..73ed59aa 100755 --- a/scripts/gsw/gsw_ait_build.sh +++ b/scripts/gsw/gsw_ait_build.sh @@ -3,9 +3,8 @@ # Convenience script for NOS3 development # -CFG_BUILD_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) -SCRIPT_DIR=$CFG_BUILD_DIR/../../scripts -source $SCRIPT_DIR/env.sh +# Note the first argument passed is expected to be the BASE_DIR of the NOS3 repository +source $1/scripts/env.sh echo "AIT build..." $DCALL image pull ghcr.io/sphinxdefense/gsw-ait:main diff --git a/scripts/gsw/gsw_ait_launch.sh b/scripts/gsw/gsw_ait_launch.sh index 02d304e3..096bed69 100755 --- a/scripts/gsw/gsw_ait_launch.sh +++ b/scripts/gsw/gsw_ait_launch.sh @@ -3,9 +3,9 @@ # Convenience script for NOS3 development # -CFG_BUILD_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) -SCRIPT_DIR=$CFG_BUILD_DIR/../../scripts -source $SCRIPT_DIR/env.sh +# Note the first argument passed is expected to be the BASE_DIR of the NOS3 repository +source $1/scripts/env.sh + export GSW="ait" echo "AIT launch..." diff --git a/scripts/gsw/gsw_clean.sh b/scripts/gsw/gsw_clean.sh new file mode 100755 index 00000000..69e5ff57 --- /dev/null +++ b/scripts/gsw/gsw_clean.sh @@ -0,0 +1,15 @@ +#!/bin/bash -i +# +# Convenience script for NOS3 development +# Use with the Dockerfile in the deployment repository +# https://github.com/nasa-itc/deployment +# + +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +source $SCRIPT_DIR/env.sh + +# Check that NOS3 build directory exists +if [ -d $USER_NOS3_BUILD_DIR/gsw ]; then + # Cleanup all build files + $DFLAGS -v $USER_NOS3_BUILD_DIR:$USER_NOS3_BUILD_DIR --name "nos_clean" -w $BASE_DIR $DBOX rm -rf $USER_NOS3_BUILD_DIR/gsw/* +fi diff --git a/scripts/gsw/gsw_cosmos_build.sh b/scripts/gsw/gsw_cosmos_build.sh index 6f48393c..8300f801 100755 --- a/scripts/gsw/gsw_cosmos_build.sh +++ b/scripts/gsw/gsw_cosmos_build.sh @@ -3,9 +3,8 @@ # Convenience script for NOS3 development # -CFG_BUILD_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) -SCRIPT_DIR=$CFG_BUILD_DIR/../../scripts -source $SCRIPT_DIR/env.sh +# Note the first argument passed is expected to be the BASE_DIR of the NOS3 repository +source $1/scripts/env.sh echo "COSMOS build..." $DCALL image pull ballaerospace/cosmos:4.5.0 diff --git a/scripts/gsw/gsw_cosmos_launch.sh b/scripts/gsw/gsw_cosmos_launch.sh index 9d41b671..2b835ce3 100755 --- a/scripts/gsw/gsw_cosmos_launch.sh +++ b/scripts/gsw/gsw_cosmos_launch.sh @@ -3,9 +3,9 @@ # Convenience script for NOS3 development # -CFG_BUILD_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) -SCRIPT_DIR=$CFG_BUILD_DIR/../../scripts -source $SCRIPT_DIR/env.sh +# Note the first argument passed is expected to be the BASE_DIR of the NOS3 repository +source $1/scripts/env.sh + export GSW="cosmos_openc3-operator_1" # Debugging diff --git a/scripts/gsw/gsw_openc3_build.sh b/scripts/gsw/gsw_openc3_build.sh index c5c88e3f..d9b23ae0 100755 --- a/scripts/gsw/gsw_openc3_build.sh +++ b/scripts/gsw/gsw_openc3_build.sh @@ -3,9 +3,8 @@ # Convenience script for NOS3 development # -CFG_BUILD_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) -SCRIPT_DIR=$CFG_BUILD_DIR/../../scripts -source $SCRIPT_DIR/env.sh +# Note the first argument passed is expected to be the BASE_DIR of the NOS3 repository +source $1/scripts/env.sh # Check that local NOS3 directory exists if [ ! -d $USER_NOS3_DIR ]; then diff --git a/scripts/gsw/gsw_openc3_launch.sh b/scripts/gsw/gsw_openc3_launch.sh index 11d306a5..1529fbd6 100755 --- a/scripts/gsw/gsw_openc3_launch.sh +++ b/scripts/gsw/gsw_openc3_launch.sh @@ -3,9 +3,9 @@ # Convenience script for NOS3 development # -CFG_BUILD_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) -SCRIPT_DIR=$CFG_BUILD_DIR/../../scripts -source $SCRIPT_DIR/env.sh +# Note the first argument passed is expected to be the BASE_DIR of the NOS3 repository +source $1/scripts/env.sh + export GSW="cosmos_openc3-operator_1" # Debugging diff --git a/scripts/build_sim.sh b/scripts/sim/build_sim.sh similarity index 72% rename from scripts/build_sim.sh rename to scripts/sim/build_sim.sh index 92a33145..f2b612fe 100755 --- a/scripts/build_sim.sh +++ b/scripts/sim/build_sim.sh @@ -6,7 +6,7 @@ # SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) -source $SCRIPT_DIR/env.sh +source $SCRIPT_DIR/../env.sh # Check that local NOS3 directory exists if [ ! -d $USER_NOS3_DIR ]; then @@ -17,7 +17,7 @@ if [ ! -d $USER_NOS3_DIR ]; then fi # Check that configure build directory exists -if [ ! -d $BASE_DIR/cfg/build ]; then +if [ ! -d $USER_NOS3_BUILD_DIR/cfg ]; then echo "" echo " Need to run make config first!" echo "" @@ -26,4 +26,4 @@ fi chmod g+s $BASE_DIR/sims mkdir -p $BASE_DIR/sims/build -$DFLAGS_CPUS -v $BASE_DIR:$BASE_DIR --name "nos_build_sim" -w $BASE_DIR $DBOX make -j$NUM_CPUS build-sim +$DFLAGS_CPUS -v $BASE_DIR:$BASE_DIR -v $USER_NOS3_BUILD_DIR:$USER_NOS3_BUILD_DIR --name "nos_build_sim" -w $BASE_DIR $DBOX make -j$NUM_CPUS build-sim diff --git a/scripts/sim/sim_clean.sh b/scripts/sim/sim_clean.sh new file mode 100755 index 00000000..b9e8e4bf --- /dev/null +++ b/scripts/sim/sim_clean.sh @@ -0,0 +1,15 @@ +#!/bin/bash -i +# +# Convenience script for NOS3 development +# Use with the Dockerfile in the deployment repository +# https://github.com/nasa-itc/deployment +# + +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +source $SCRIPT_DIR/env.sh + +# Check that NOS3 build directory exists +if [ -d $USER_NOS3_BUILD_DIR/sim ]; then + # Cleanup all build files + $DFLAGS -v $USER_NOS3_BUILD_DIR:$USER_NOS3_BUILD_DIR --name "nos_clean" -w $BASE_DIR $DBOX rm -rf $USER_NOS3_BUILD_DIR/sim/* +fi diff --git a/scripts/stop.sh b/scripts/stop.sh index bcb11dcd..8def7b14 100755 --- a/scripts/stop.sh +++ b/scripts/stop.sh @@ -12,7 +12,7 @@ source $SCRIPT_DIR/env.sh rm -rf /tmp/gpio_fake # NOS3 Stored HK -rm -rf $BASE_DIR/fsw/build/exe/cpu1/scratch/* +#rm -rf $BASE_DIR/fsw/build/exe/cpu1/scratch/* # Docker stop cd $SCRIPT_DIR; $DFLAG compose down > /dev/null 2>&1 diff --git a/sims/CMakeLists.txt b/sims/CMakeLists.txt index 9eea63e5..098010c8 100644 --- a/sims/CMakeLists.txt +++ b/sims/CMakeLists.txt @@ -48,8 +48,8 @@ ENDFOREACH() # Install configuration files to bin set(sim_cfg - ../cfg/build/sims/nos_engine_server_config.json - ../cfg/build/sims/nos3-simulator.xml - ../cfg/build/sims/sim_log_config.xml + /tmp/nos3/cfg/sims/nos_engine_server_config.json + /tmp/nos3/cfg/sims/nos3-simulator.xml + /tmp/nos3/cfg/sims/sim_log_config.xml ) install(FILES ${sim_cfg} DESTINATION bin COMPONENT config)