Files
paparazzi/sw/ext
alexandre bustico 6cf27208f3
Issues due date / Add labels to issues (push) Has been cancelled
Doxygen / build (push) Has been cancelled
[chibios] Features/chibios 2026 resync (#3628)
* chibios: update submodule to stable_21.11.x and sync HAL config

Switch the ChibiOS submodule to the upstream stable_21.11.x branch,
update the submodule URL, and adjust the Paparazzi ChibiOS config files
to match the newer HAL layout.

This commit is intentionally limited to the submodule/config update and is
known to leave Paparazzi in a non-building state until the follow-up RTOS
monitor compatibility fix lands.

* rtos_mon: fix ChibiOS 21.11 build break and sample CPU load by interval

Update the RTOS monitor to use the current ChibiOS kernel statistics API,
fix the thread bookkeeping regressions introduced by the submodule update,
and compute CPU/thread load from deltas between monitoring samples instead
of lifetime cumulative counters.

This restores compilation of rtos_mon_arch.c with the updated ChibiOS tree
and makes the reported CPU load reliable over the reporting window.

* chibios: enable BDMA for H7 ADC3

Configure ADC3 on STM32H7 to use the BDMA path expected by the
updated ChibiOS ADCv4 driver, and provide the companion DMA/BDMA
stream definitions used by the new configuration checks.

This fixes H7 builds that fail with STM32_ADC_ADC3_DMA_STREAM being
referenced while ADC3 is intended to run on BDMA.

* rtos_mon: use the ChibiOS 21.11 core memory API

Adjust rtos_mon_arch.c to the current chCoreGetStatusX() API, which now
returns the amount of free core memory directly instead of filling a
memory_area_t structure.

This fixes the remaining build break in the RTOS monitor with the updated
ChibiOS tree.

* tawaki: enable BDMA for H7 ADC3

Mirror the H7 ADC3 configuration fix in the Tawaki board mcuconf so the
updated ChibiOS ADCv4 driver takes the ADC3 BDMA path expected on STM32H7.

* shell: fix ChibiOS 21.11 core memory query API

* matek: enable BDMA for H7 ADC3

* chibios: include newlib syscall bindings

* can: use ChibiOS 21.11 FDCAN defaults and API

* chibios: restore submodule URL to paparazzi fork
2026-04-14 10:47:31 +02:00
..
2022-05-18 17:38:58 +02:00
2023-01-25 12:06:46 +01:00
2022-10-26 23:26:37 +02:00

External Libraries and Tools

This directory contains git submodules referencing external libraries and tools used by Paparazzi. These modules provide essential functionality for communications, flight control, simulation, cryptography, and more.

Table of Contents


Quick Start

Initialize and build all external modules:

make -C sw/ext

This will checkout and compile all dependencies automatically.


Installing All Modules

To install and build all external modules at once:

make -C sw/ext

This runs the complete build chain for all modules that require compilation (chibios, fatfs, libsbp, TRICAL, hacl-c, key_generator, rustlink, ecl, matrix, mavlink, dronecan, and unifiedmocaprouter).


Installing Individual Modules

To install or update only a specific module, run:

make -C sw/ext <module-name>

Example:

make -C sw/ext chibios
make -C sw/ext mavlink

Each module target will sync and update the git submodule, then build if required.


Available Modules

See the main Makefile in this directory for the complete list of modules and their build targets. Common modules include:

  • chibios — Operating system for embedded systems
  • fatfs — FAT filesystem library
  • mavlink — MAVLink message definitions and code generation
  • pprzlink — Paparazzi-specific communications protocol
  • libsbp — Swift Binary Protocol for GNSS/RTK
  • TRICAL — Magnetometer automatic calibration
  • opencv_bebop — Computer vision library (see detailed instructions below)
  • dronecan — DroneCAN protocol support
  • And many more... — See Makefile for details

OpenCV Bebop Setup

This module provides advanced computer vision capabilities for Bebop drones.

Prerequisites

This guide has been tested on Ubuntu 22.04. For Ubuntu 20.04 instructions, see: conf/modules/cv_opencvdemo.xml

Building OpenCV Bebop

From the paparazzi source directory:

cd sw/ext
make opencv_bebop

Verify Installation

After a successful build, you should have these directories:

sw/ext/opencv_bebop/build_arm/
sw/ext/opencv_bebop/build_pc/
sw/ext/opencv_bebop/install_arm/
sw/ext/opencv_bebop/install_pc/

These contain compiled binaries for ARM (autopilot) and PC (simulation) targets.

Configuring Your Airframe Module

To use OpenCV in your airframe, configure your module XML with build flags for both autopilot (ap) and simulation (nps) targets.

Example airframe module configuration:

<makefile target="ap">
    <file name="opencv_example.cpp"/>
    <file name="opencv_image_functions.cpp"/>
    <flag name="CXXFLAGS" value="I$(PAPARAZZI_SRC)/sw/ext/opencv_bebop/install_arm/include/opencv4"/>
    
    <flag name="LDFLAGS" value="L$(PAPARAZZI_HOME)/sw/ext/opencv_bebop/install_arm/lib"/>
    <flag name="LDFLAGS" value="lopencv_world"/>
    <flag name="LDFLAGS" value="L$(PAPARAZZI_HOME)/sw/ext/opencv_bebop/install_arm/lib/opencv4/3rdparty"/>
    <flag name="LDFLAGS" value="llibprotobuf"/>
    <flag name="LDFLAGS" value="llibjpeg-turbo"/>
    <flag name="LDFLAGS" value="llibpng"/>
    <flag name="LDFLAGS" value="llibtiff"/>
    <flag name="LDFLAGS" value="llibopenjp2"/>
    <flag name="LDFLAGS" value="lzlib"/>
    <flag name="LDFLAGS" value="lade"/>
    <flag name="LDFLAGS" value="ldl"/>
    <flag name="LDFLAGS" value="lm"/>
    <flag name="LDFLAGS" value="lpthread"/>
    <flag name="LDFLAGS" value="lrt"/>
  </makefile>
  <makefile target="nps">
    <file name="opencv_example.cpp"/>
    <file name="opencv_image_functions.cpp"/>
    
    <flag name="CXXFLAGS" value="I$(PAPARAZZI_SRC)/sw/ext/opencv_bebop/install_pc/include/opencv4"/>
    
    <flag name="LDFLAGS" value="L$(PAPARAZZI_HOME)/sw/ext/opencv_bebop/install_pc/lib"/>
    <flag name="LDFLAGS" value="lopencv_world"/>
    <flag name="LDFLAGS" value="L$(PAPARAZZI_HOME)/sw/ext/opencv_bebop/install_pc/lib/opencv4/3rdparty"/>
    <flag name="LDFLAGS" value="llibprotobuf"/>
    <flag name="LDFLAGS" value="lade"/>
    <flag name="LDFLAGS" value="L/usr/lib/x86_64-linux-gnu"/>
    <flag name="LDFLAGS" value="ljpeg"/>
    <flag name="LDFLAGS" value="lpng"/>
    <flag name="LDFLAGS" value="ltiff"/>
    <flag name="LDFLAGS" value="lopenjp2"/>
    <flag name="LDFLAGS" value="L/usr/lib/x86_64-linux-gnu/hdf5/serial"/>
    <flag name="LDFLAGS" value="lhdf5"/>
    <flag name="LDFLAGS" value="lcrypto"/>
    <flag name="LDFLAGS" value="lcurl"/>
    <flag name="LDFLAGS" value="lpthread"/>
    <flag name="LDFLAGS" value="lsz"/>
    <flag name="LDFLAGS" value="lz"/>
    <flag name="LDFLAGS" value="ldl"/>
    <flag name="LDFLAGS" value="lm"/>
    <flag name="LDFLAGS" value="lfreetype"/>
    <flag name="LDFLAGS" value="lharfbuzz"/>
    <flag name="LDFLAGS" value="lrt"/>

  </makefile>
</module>

Using OpenCV in C++ Code

Include the OpenCV headers in your C++ files:

#include "opencv_image_functions.h"

using namespace std;
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
using namespace cv;

You can then use provided wrapper functions like grayscale_opencv_to_yuv422() in your code:

// Convert and process images
Mat image = imread("image.jpg");
Mat gray;
cvtColor(image, gray, COLOR_BGR2GRAY);
// ... your vision processing

Team Consistency

Important: Ensure all team members use the same build environment and configuration. Inconsistent builds can lead to compatibility issues during testing and deployment, leading to high dependency on one laptop/person.


Troubleshooting

Build Failures

  • Module not found: Ensure you're running make from the paparazzi root or using make -C sw/ext
  • Dependency errors: Check that required packages are installed (see individual module documentation)
  • Python build issues: Some modules (mavlink, dronecan) require Python packages. See Makefile for details on MY_MAVLINKTOOLS and MY_DRONECANTOOLS

Submodule Issues

If a submodule is in a bad state, reinitialize it:

# Sync and reset a specific module
cd <paparazzi-root>
git submodule sync sw/ext/<module-name>
git submodule update --init --recursive sw/ext/<module-name>

# Or reset all modules
git submodule update --init --recursive