Files
PX4-Autopilot/Tools/ci/build_all_runner.sh
Jacob Dahl b4b36a2748 fix(nuttx): unblock multi-board and protected builds (#27360)
* fix(ci): wipe NuttX submodule state between boards in build_all_runner

NuttX .o and lib*.a live in the shared submodule trees under
platforms/nuttx/NuttX/{nuttx,apps}, not in per-board build/<board>/.
NuttX's recursive make doesn't treat PX4's per-board defconfig changes
as a reason to recompile, so consecutive board builds in one workspace
were linking stale objects from an earlier board (e.g. stm32_spi.o from
fmu-v2 linked into fmu-v4pro, which doesn't enable SPI4).

Run git clean -dXf on both NuttX submodules between iterations to drop
gitignored build state. This mirrors what make clean already does for
submodules and preserves the incremental-build wins for single-board
use.

* fix(cmake): isolate kernel mm/libc objects with BINDIR=kbin

mm and libs/libc compile the same sources for both the kernel and user
passes in protected builds. Without separate output dirs the kernel
objects clobber bin/*.o and the user-mode libmm.a/libc.a end up pulling
in kernel-only symbols (nxsem_wait, g_current_regs, nx_read, nx_write,
g_mmheap, ...) at link time. Matches NuttX's own tools/LibTargets.mk.
2026-05-17 16:00:06 -06:00

27 lines
842 B
Bash
Executable File

#!/usr/bin/env bash
# This script is meant to be used by the build_all.yml workflow in a github runner
# Please only modify if you know what you are doing
set -e
# NuttX .o/.a live in the shared submodule trees, not per-board build dirs.
# Wipe them between boards so stale objects from a prior board's defconfig
# don't get linked into the next board's elf.
clean_nuttx_state() {
git -C platforms/nuttx/NuttX/nuttx clean -dXf -q
git -C platforms/nuttx/NuttX/apps clean -dXf -q
}
targets=$1
for target in ${targets//,/ }
do
echo "::group::Building: [${target}]"
start=$(date +%s)
make $target
stop=$(date +%s)
diff=$(($stop-$start))
build_time="$(($diff /60/60))h $(($diff /60))m $(($diff % 60))s elapsed"
echo -e "\033[0;32mBuild Time: [$build_time]"
echo "::endgroup::"
clean_nuttx_state
done