Skip to content

CineRat 06 Development Setup

Till Blaha edited this page Aug 28, 2024 · 3 revisions

Simulation

Indiflight multicopter software in the loop and hardwware in the loop simulations are available at https://github.com/tudelft/indiflightSupport

Raspberry Pi cross compiler

A cross compilation toolchain has been tested and works quite nicely for deploying applications on the raspberry pi. Building on the raspberry pi is super annoying, because it takes long, your have to copy over the source files, the pi becomes stateful (which version did i build now? Did it have my latest changes? Why doesn't it build on the PI, am I missing libraries?). With a cross-compilation and deployment toolchain, this is should become easier. The concept is to build a CMake application inside a docker-container that contains the cross-compiler for ARM64, the appropriate userland and GLIBC version of the target system (Raspberry PI OS Bullseye), and keeps a synchronized copy of the libraries sources/headers available on the target system. For instance, the optitrack relay installed previously has been compiled this way.

The work flow is:

  • define a CMakeLists.txt that describes the application. (currently only C and C++ have been tested)
  • (with a single command,) start a docker container and run a script inside it, which:
    • copies in the CMakeLists.txt and sources files of the current directory
    • (optional) syncronises the available libraries from the PI into a local docker-volume, so they can be used for compilation/linking. Requires wifi connection to pi.
    • Cross-compiles the application using CMake and moves the result into build-aarch64-linux-gnu in the current directory
    • (optional) deploys the application onto the raspberry PI. Require wifi connection to the pi

Instructions on how to do this is described on https://github.com/tudelft/indiflightSupport/tree/main/Groundstation/Cross-Compiler

VS Code setup

VSCode extensions

I recommend installing.

  • Makefile Tools
  • CMake
  • CMake Tools
  • C/C++
  • Cortex-Debug (if you want to use live debugging of the FC via Wifi/SWD)

Optional

  • C/C++ Extension Pack
  • C/C++ Themes
  • Pylance
  • Python

SWD debugging

The indiflight repository, as downloaded in CineRat -- 04 Software Installation and Setup, also contains VScode tasks and launch configurations to facilitate debugging of indiflight as it runs on the FC hardware. This enables setting break-points, inspecting variables, and even a periodic live-readout of any global variable. Of course, this only works if the SWD interfaces has been wired and the Development Laptop is connected to the raspberry pi via wifi. Open the INDIflight repo using VSCode (make sure the extensions above are installed), and then run the "Cortex OpenOCD" launch configuration from the Debug panel (CTRL+SHIFT+D)

More info at https://github.com/tudelft/racebian/blob/main/README_SWD.md

#todo