In this repository is where all of the OBC Software is housed. This is the final version that will be used on the satellite. The software runs on the Microchip ATSAMV71Q21B Microcontroller Unit, which is a 32-bit ARM Cortex-M7 core. We use FreeRTOS to handle the tasking of the MCU. More information regarding OBC can be found here.
The obc-software
repository can be built without any access to specialised hardware. We provide build
instructions for Linux (or WSL) command-line, and the CLion IDE.
The dependencies of this repository are managed through the conan package manager, with repositories from ConanCenter and SpaceDot's packages.
For more detailed installation instructions, including how to integrate with a microcontroller, visit the corresponding documentation page.
-
Install a modern C++ compiler, CMake, and Conan.
CMake >= 3.23 and Conan >= 2.0 are recommended. -
Clone the repository and enter the directory:
git clone [email protected]:acubesat/obc/obc-software.git cd obc-software
-
(If you haven't already) create a conan profile for your system:
conan profile detect
-
(If you haven't already) add the SpaceDot repository to conan:
conan remote add spacedot https://artifactory.spacedot.gr/artifactory/api/conan/conan
-
Download all dependencies and build the project through conan:
conan install . --output-folder=cmake-build-debug --build="*" -u -pr conan-arm-profile
-
Download all submodules:
conan source .
-
Add CMake flags:
cmake -B cmake-build-debug/build/Debug -DCMAKE_TOOLCHAIN_FILE=cmake-build-debug/build/Debug/generators/conan_toolchain.cmake -DCMAKE_CXX_COMPILER="/usr/bin/arm-none-eabi-g++" -DCMAKE_C_COMPILER="/usr/bin/arm-none-eabi-gcc" -DCMAKE_BUILD_TYPE=Debug .
-
Build the project:
cd cmake-build-debug/build/Debug make
CLion will automatically try to set up a CMake project for you. However, without the conan packages installed, this will quickly fail. Follow these steps to set up the conan project:
- Follow steps 1-6 from the CLI instructions above.
- Add the following to the CMake Options (File -> Settings -> Build, Execution, Deployment -> CMake -> CMake Options):
-DCMAKE_TOOLCHAIN_FILE=cmake-build-debug/build/Debug/generators/conan_toolchain.cmake -DCMAKE_CXX_COMPILER="/usr/bin/arm-none-eabi-g++" -DCMAKE_C_COMPILER="/usr/bin/arm-none-eabi-gcc"
- If your CMake project doesn't reload automatically, reload it manually (Tools -> CMake -> Reload CMake Project).
We do not recommend using a Conan plugin for your IDE, as it may tamper with the default configuration for this repository.
Prototypes of ECSS Services
- ST[01]
- ST[03]
- ST[17] (Not a task, since there isn't a need of periodic update. However, the MCU responds to TC[17,1] and TC[17,3])
- ST[20]
Peripherals:
- Internal MCU Temperature Sensor
- External (MCP9808) Temperature Sensor
- UART with DMA
- Parameter updating of ST[20]
minicom
is found in almost all package managers for Linux and macOS. For Linux you can use:
For Pop/Ubuntu/Debian derivatives
sudo apt install minicom
For Fedora
sudo dnf install minicom
For Arch
sudo pacman -S minicom
minicom
is a program that displays the serial input of a port on your computer. To run it, you must specify such a port.
On Linux systems, the serial ports for connected embedded devices are /dev/ttyACMX
, where X is a number. The first device you connect will start at 0, and each new device increases the number by 1. Note that removing a device "frees" the port, so if you have two devices connnected and you remove the first, /dev/ttyACM0
will be disconnected while /dev/ttyACM1
will be connected to the remaining target device. When using UART-to-USB
devices such as an FTDI
, the naming scheme changes and the devices will be at /dev/ttyUSBX
, however the above scheme remains the same.
You can use the command ls /dev/ttyACM*
to view all connected devices on the /dev/ttyACMX
spectrum.
If a device is connected to port /dev/ttyACM0
, you can use:
minicom -D /dev/ttyACM0
to get its ouput.
All actions inside the program require pressing the Meta
key first. If you want to exit the program, you need to press Meta
, then x
. On Linux the Meta
key is CTRL+A
, while on macOS it is Escape
. You can use Meta
, then z
to view a list of shortcuts.
Our embedded devices send only a \n
delimiter on the end of each log message. Thus, when you open the minicom
instance, you will see that each line starts at the end of the previous line. After a couple of log messages, the new lines will start at the right edge of the screen and the messages will be invisible. To control this, you can press Meta
, then u
to toggle interpreting \n
as \r\n
. Each new message will now start at the beginning of the next line.
In case you need to save the output of a session to a file, use the option -C filename.txt
when opening the program. For example:
minicom -D /dev/ttyACM0 -C output.txt
will save the logs to the file output.txt
in your current directory.
The internal watchdog has been disabled for debugging reasons.
To re-enable remove the line
WDT_REGS->WDT_MR = WDT_MR_WDDIS_Msk;
in initialization.c
. It's on line 148 at the time of writing. You should also uncomment WDT_Initialize()
below that.
To integrate Harmony3 with CLion, follow the steps below:
- Ensure you have downloaded Harmony3.
- Open CLion.
- Go to
Main Menu(three lines on the top left)
->file
->Settings
->Tools
->External Tools
->Add
. - A pop-up will appear as shown below:
- Fill out the sections as shown below:
- Name: Harmony3
- Description: Harmony Configurator
- Program: /bin/bash
- Arguments: ./Harmony3_Configurator.sh "path/to/Harmony3/mhc" as seen above (note: don't use
$HOME/
or~/
as the argument will not pass correctly.) - Working directory:
$ProjectFileDir$
- Click
OK
->Apply
->OK
. - Right-click on the main toolbar at the top.
- Click on
Customize Toolbar...
. - Click on the
+
at the top of the pop-up window. - Click on
Add Action...
. - Choose
External Tools
->External Tools
->Harmony3
(You can choose an icon for your new action in theIcon
section or leave the default). - Click
OK
. - Move the Harmony3 icon using your mouse to the left, right, or center of the bar.
- Click
OK
- You should now see an icon like the picture below.
- To use it, simply click on it.
Note: To close Harmony, simply click on the 'x' in the corner. Never click on the red button in CLion, as it will interrupt the procedure and the script will stop without running the rest of the commands.
- Run the command
sudo apt install meld
in a terminal. - Open Harmony3.
- Navigate to File -> Preferences -> Diff.
- In the 'Diff Tool Command' section, enter
/usr/bin/meld {0} {1}