The Satellite of the University of Chile for Aerospace Investigation (SUCHAI) 는 칠레대학교(Physics and Mechanical Engineering Departments of the Faculty of Physical and Mathematical Sciences (FCFM) at University of Chile)에서 만든 CubeSat 오픈소스다.
이 suchai를 설치하는 방법에 대해 정리한다.
빌드 디펜던시 설치
sudo apt install libzmq3-dev
sudo apt install pkg-config
libcsp 빌드
CSP(CubeSat Protocol)는 CubeSat과 같은 소형 우주선에서의 통신을 위해 설계된 소형 네트워크 계층 프로토콜이다.
libcsp는 바로 이 csp 기능들을 담아둔 라이브러리이다.
설치 : https://libcsp.github.io/libcsp/INSTALL.html
- Current implementation uses the LibCSP to communicate subsytems and the ground station. Linux port can use the LibCSP with ZMQ interface. (본문발췌)
sudo apt install cmake sudo apt install gcc sudo apt install make sudo apt install python sudo apt install libzmq3-dev sudo apt install pkg-config git clone https://github.com/libcsp/libcsp cd libcsp sudo apt install meson meson setup builddir cd builddir ninja ninja install
위와 같이 설치해주면 된다.
Trouble Shooting 1 - csp/csp.h 못 찾는 경우 (fatal error : csp/csp.h)
ninja 후 ninja install 을 안해줘서 그렇다. 빌드는 잘됐는데 install을 해주면 해결된다.
Trouble Shooting 2 - csp/csp_endian.h 못 찾는 경우 (fatal error : csp/csp_endian.h)
아래 디펜던시들을 설치해주면된다.
sudo apt install libzmq3-dev
sudo apt install pkg-config
suchai 빌드
위 과정을 잘 따라왔다
아래와 같이 설치후 빌드 및 실행하면된다.
git clone https://gitlab.com/spel-uchile/suchai-flight-software
cmake -B build -DAPP=simple
cmake --build build
cd build/apps/simple
./suchai-app
i#!/usr/bin/env bash
# Script for automated test running.
#
# The results of each test can be found on log files that generate after execution.
#
# These logs will generate inside each test's directory.
#
# Authors: Tamara Gutierrez R.
# Diego Ortego P.
# Carlos Gonzalez C.
test_build_enabled=1
test_unit_enabled=1
test_cmd_enabled=1
test_bug_delay_enabled=0
test_load_enabled=1
test_sgp4_enabled=1
test_tm_io_enabled=1
test_file_enabled=0
while getopts ":b:u:c:d:l:s:t:f:h" opt; do
case ${opt} in
b )
test_build_enabled=$OPTARG
;;
u )
test_unit_enabled=$OPTARG
;;
c )
test_cmd_enabled=$OPTARG
;;
d )
test_bug_delay_enabled=$OPTARG
;;
l )
test_load_enabled=$OPTARG
;;
s )
test_sgp4_enabled=$OPTARG
;;
t )
test_tm_io_enabled=$OPTARG
;;
f )
test_file_enabled=$OPTARG
;;
\? )
echo "Invalid option: $OPTARG" 1>&2
;;
: )
echo "Invalid option: $OPTARG requires an argument" 1>&2
;;
esac
done
shift $((OPTIND -1))
# Gets the current execution directory (the absolute path to this script)
SCRIPT_PATH="$( cd "$(dirname "$0")" ; pwd -P )"
WORKSPACE=${SCRIPT_PATH}
# Prints the current workspace path, for debugging purposes
echo ${WORKSPACE}
# ---------------- --TEST BUILD ------------------
# The test log is called test_unit_log.txt
# Tests for all storage modes
if [ $test_build_enabled -eq 1 ]
then
TEST_NAME="test_build"
for ARCH in "X86" "RPI"
do
for ST_MODE in "RAM" "SQLITE" "FLASH"
do
echo ""
echo "**** Testing ${TEST_NAME} for arch ${ARCH}, storage ${ST_MODE} ****"
rm -rf build_test
# Just build the simple app with the test's parameters
cmake -B build_test -G Ninja -DSCH_OS=LINUX -DSCH_ARCH=${ARCH} -DAPP=simple -DTEST=0 -DSCH_ST_MODE=${ST_MODE} -DSCH_STORAGE_TRIPLE_WR=1 && cmake --build build_test -j4
status=$?
[ $status -eq 0 ] || exit 1
done
done
cd ${WORKSPACE}
fi
# ---------------- --TEST_UNIT ------------------
# The test log is called test_unit_log.txt
# Tests for all storage modes
if [ $test_unit_enabled -eq 1 ]
then
TEST_NAME="test_unit"
for ST_MODE in "RAM" "SQLITE" "FLASH"
do
echo ""
echo "**** Testing ${TEST_NAME} for storage ${ST_MODE} ****"
rm -rf build_test
# build the unitest with the test's parameters
cmake -B build_test -G Ninja -DSCH_OS=LINUX -DSCH_ARCH=X86 -DAPP=${TEST_NAME} -DTEST=1 -DSCH_ST_MODE=${ST_MODE} -DSCH_STORAGE_TRIPLE_WR=1 && cmake --build build_test -j4
[ $? -eq 0 ] || exit $?
# Runs the test, saving a log file
cd build_test/test/${TEST_NAME}
rm -f ${TEST_NAME}_${ST_MODE}_log.txt
./suchai-test #| cat >> ${TEST_NAME}_${ST_MODE}_log.txt
[ $? -eq 0 ] || exit $?
echo ""
cd -
done
cd ${WORKSPACE}
fi
## ---------------- --TEST_INT_CMD ------------------
#
## The main test log is called test_int_cmd_log.txt
## That log is compares with test_int_cmd_log_base.txt
## The result of the comparison is in test_int_cmd_comparator_log.txt
#
if [ $test_cmd_enabled -eq 1 ]
then
TEST_NAME="test_int_cmd"
rm -rf build_test
# build the cmdtest with the test's parameters
cmake -B build_test -G Ninja -DSCH_OS=LINUX -DSCH_ARCH=X86 -DAPP=${TEST_NAME} -DTEST=1 -DSCH_ST_MODE=RAM && cmake --build build_test -j4
[ $? -eq 0 ] || exit $?
# Runs the test, saving a log file
rm -f /test/${TEST_NAME}/${TEST_NAME}_log.txt
./build_test/test/${TEST_NAME}/suchai-test > test/${TEST_NAME}/${TEST_NAME}_log.txt
[ $? -eq 0 ] || exit $?
echo ""
cd -
cd ${WORKSPACE}
#
## Makes result comparison
cd test/${TEST_NAME}
rm -f ${TEST_NAME}_comparator_log.txt
python logs_comparator.py | cat >> ${TEST_NAME}_comparator_log.txt
echo ""
cd ${WORKSPACE}
#
fi
## ---------------- --TEST_LOAD ------------------
#
## The test log is called test_int_load_log.txt
#
if [ $test_load_enabled -eq 1 ]
then
TEST_NAME="test_int_load"
echo ""
echo "**** Testing ${TEST_NAME} ****"
rm -rf build_test
# build the test with the test's parameters
cmake -B build_test -G Ninja -DSCH_OS=LINUX -DSCH_ARCH=X86 -DAPP=${TEST_NAME} -DTEST=1 -DSCH_ST_MODE=RAM && cmake --build build_test -j4
[ $? -eq 0 ] || exit $?
./build_test/test/${TEST_NAME}/suchai-test > test/${TEST_NAME}/${TEST_NAME}_log.txt
[ $? -eq 0 ] || exit $?
echo ""
cd -
cd ${WORKSPACE}
fi
## ---------------- --TEST_INT_BUG_DELAY ------------------
#
## The test log is called test_int_bug_delay_log.txt
if [ $test_bug_delay_enabled -eq 1 ]
then
TEST_NAME="test_int_bug_delay"
echo ""
echo "**** Testing ${TEST_NAME} ****"
rm -rf build_test
# build the test with the test's parameters
cmake -B build_test -G Ninja -DSCH_OS=LINUX -DSCH_ARCH=X86 -DAPP=${TEST_NAME} -DTEST=1 -DSCH_ST_MODE=RAM && cmake --build build_test -j4
[ $? -eq 0 ] || exit $?
./build_test/test/${TEST_NAME}/suchai-test > test/${TEST_NAME}/${TEST_NAME}_log.txt
[ $? -eq 0 ] || exit $?
echo ""
cd -
cd ${WORKSPACE}
fi
## ---------------- --TEST_INT_SGP4 ------------------
#
## The test log is called test_int_sgp4_log.txt
if [ $test_sgp4_enabled -eq 1 ]
then
TEST_NAME="test_int_sgp4"
echo ""
echo "**** Testing ${TEST_NAME} ****"
rm -rf build_test
# build the test with the test's parameters
cmake -B build_test -G Ninja -DSCH_OS=LINUX -DSCH_ARCH=X86 -DAPP=${TEST_NAME} -DTEST=1 -DSCH_ST_MODE=RAM && cmake --build build_test -j4
[ $? -eq 0 ] || exit $?
./build_test/test/${TEST_NAME}/suchai-test > test/${TEST_NAME}/${TEST_NAME}_log.txt
[ $? -eq 0 ] || exit $?
echo ""
cd -
cd ${WORKSPACE}
fi
## ---------------- --TEST_INT_TM_IO ------------------
#
## The test log is called test_int_tm_io_log.txt
if [ $test_tm_io_enabled -eq 1 ]
then
TEST_NAME="test_int_tm_io"
echo ""
echo "**** Testing ${TEST_NAME} ****"
rm -rf build_test
# build the test with the test's parameters
cmake -B build_test -G Ninja -DSCH_OS=LINUX -DSCH_ARCH=X86 -DAPP=${TEST_NAME} -DTEST=1 -DSCH_ST_MODE=RAM -DSCH_COMM_NODE=3 && cmake --build build_test -j4
[ $? -eq 0 ] || exit $?
./build_test/test/${TEST_NAME}/suchai-test > test/${TEST_NAME}/${TEST_NAME}_log.txt
[ $? -eq 0 ] || exit $?
echo ""
cd -
cd ${WORKSPACE}
fi
## ---------------- --TEST_INT_FILE-- ------------------
#
## The test log is called test_int_file_log.txt
if [ $test_file_enabled -eq 1 ]
then
TEST_NAME="test_int_file"
echo ""
echo "**** Testing ${TEST_NAME} ****"
rm -rf build_test
# build the test with the test's parameters
cmake -B build_test -G Ninja -DSCH_OS=LINUX -DSCH_ARCH=X86 -DAPP=${TEST_NAME} -DTEST=1 -DSCH_COMM_NODE=3 && cmake --build build_test -j4
[ $? -eq 0 ] || exit $?
./build_test/test/${TEST_NAME}/suchai-test > test/${TEST_NAME}/${TEST_NAME}_log.txt
[ $? -eq 0 ] || exit $?
echo ""
cd -
cd ${WORKSPACE}
fi
#TODO: DELETE THIS EXIT AFTER FIXING THE REST OF THE TESTS!
exit 0
#TODO: REMEMBER TO DELETE THIS EXIT!
'공부 > SPACE' 카테고리의 다른 글
cFS 커맨드 추가하는 방법 (Add a command to sample_app 실습) (0) | 2024.06.27 |
---|---|
SUCHAI-FS-Fuzzy-Testing 빌드 및 실행 (0) | 2024.06.05 |
DEF CON 29 Aerospace Village - Fuzzing NASA Core Flight System Software, Ronald Brobert Reproduce (3) | 2024.06.04 |
cFS 설치 및 실행하는방법 (0) | 2024.04.22 |