Skip to content

Commit 9edc9fa

Browse files
committed
ci: build targets: package cannode artifacts into artifact/cannode/<target>/*.uavcan.bin
Releases were include the .px4 file for cannodes. This file cannot be flashed and instead the .uavcan.bin file must be used. Updated build script to only package .px4 binaries for non-cannodes and to only package .uavcan.bin binaries for cannodes.
1 parent d85994b commit 9edc9fa

File tree

3 files changed

+77
-3
lines changed

3 files changed

+77
-3
lines changed

.github/workflows/build_all_targets.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,4 +170,6 @@ jobs:
170170
uses: softprops/action-gh-release@v2
171171
with:
172172
draft: true
173-
files: artifacts/*.px4
173+
files: |
174+
artifacts/*.px4
175+
artifacts/cannode/**/*.uavcan.bin

Tools/ci/package_build_artifacts.sh

Lines changed: 64 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,73 @@
11
#!/bin/bash
22

33
mkdir artifacts
4-
cp **/**/*.px4 artifacts/
5-
cp **/**/*.elf artifacts/
4+
mkdir -p artifacts/cannode
5+
6+
# Function to check if a build is a CAN node
7+
is_cannode() {
8+
local build_path=$1
9+
local boardconfig="$build_path/boardconfig"
10+
11+
if [ -f "$boardconfig" ]; then
12+
# Check if CONFIG_BOARD_ROMFSROOT is set to "cannode"
13+
if grep -q '^CONFIG_BOARD_ROMFSROOT="cannode"' "$boardconfig"; then
14+
return 0
15+
fi
16+
fi
17+
return 1
18+
}
19+
20+
# First pass: identify and package CAN nodes
21+
for build_dir_path in build/*/ ; do
22+
# Remove trailing slash
23+
build_dir_path=${build_dir_path::${#build_dir_path}-1}
24+
build_dir=${build_dir_path#*/}
25+
26+
if is_cannode "$build_dir_path"; then
27+
# Find the .uavcan.bin file
28+
uavcan_bin=$(find "$build_dir_path" -maxdepth 1 -name "*.uavcan.bin" -type f)
29+
30+
if [ -n "$uavcan_bin" ]; then
31+
# Extract the target name (e.g., ark_can-flow from ark_can-flow_default)
32+
target_name=${build_dir%_default}
33+
34+
# Create a directory for this CAN node
35+
mkdir -p "artifacts/cannode/$target_name"
36+
37+
# Copy the .uavcan.bin file
38+
cp "$uavcan_bin" "artifacts/cannode/$target_name/"
39+
40+
echo "Packaged CAN node: $target_name"
41+
fi
42+
fi
43+
done
44+
45+
# Second pass: package regular firmware binaries (excluding CAN nodes)
46+
for build_dir_path in build/*/ ; do
47+
build_dir_path=${build_dir_path::${#build_dir_path}-1}
48+
49+
# Skip CAN nodes
50+
if is_cannode "$build_dir_path"; then
51+
continue
52+
fi
53+
54+
# Copy .px4 files
55+
find "$build_dir_path" -maxdepth 1 -name "*.px4" -type f -exec cp {} artifacts/ \;
56+
57+
# Copy .elf files
58+
find "$build_dir_path" -maxdepth 1 -name "*.elf" -type f -exec cp {} artifacts/ \;
59+
done
60+
61+
# Third pass: package metadata for each non-CAN node build directory
662
for build_dir_path in build/*/ ; do
763
build_dir_path=${build_dir_path::${#build_dir_path}-1}
864
build_dir=${build_dir_path#*/}
65+
66+
# Skip CAN node builds for metadata packaging (they only need the .uavcan.bin)
67+
if is_cannode "$build_dir_path"; then
68+
continue
69+
fi
70+
971
mkdir artifacts/$build_dir
1072
find artifacts/ -maxdepth 1 -type f -name "*$build_dir*"
1173
# Airframe

docs/en/dronecan/px4_cannode_fw.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@ make ark_can-flow_default
2020

2121
This will create an output in **build/ark_can-flow_default** named **XX-X.X.XXXXXXXX.uavcan.bin**. Follow the instructions at [DroneCAN firmware update](index.md#firmware-update) to flash the firmware.
2222

23+
## Downloading Pre-built Firmware
24+
25+
Pre-built CAN node firmware binaries are available in PX4 releases. The binaries are packaged in the `cannode/` folder, with each target in its own named directory containing the `.uavcan.bin` file.
26+
27+
For example, to download firmware for the Ark Flow:
28+
1. Go to the [PX4 releases page](https://github.com/PX4/PX4-Autopilot/releases)
29+
2. Download the release assets
30+
3. Navigate to `cannode/ark_can-flow/`
31+
4. Use the `.uavcan.bin` file for flashing
32+
2333
## Developer Information
2434

2535
This section has information that is relevant to developers who want to add support for new DroneCAN hardware to the PX4 Autopilot.

0 commit comments

Comments
 (0)