# Build the TerraHawk charge node firmware in ArduPilot's Docker image. # ARDUPILOT must be a checkout with submodules that nothing else is using. ARDUPILOT ?= $(abspath ../../../ardupilot-chargenode) # Pinned by digest (Ryan, 2026-10-03: tracked builds). This is the image :latest named on 2026-06-25; a tag # can move to a new compiler without notice. SITL uses the same digest through mcardupilot. IMAGE ?= ardupilot/ardupilot-dev-chibios@sha256:8bb0f850fb3fe1c170cb12dd577ab64f3708be8a828f9eafd28d73559766e81f BOARD := TerraHawkChargeNode HERE := $(abspath .) .PHONY: firmware clean firmware: ## Build bootloader and AP_Periph firmware, outputs in build/ @test -d "$(ARDUPILOT)/libraries/AP_HAL_ChibiOS/hwdef" || { echo "no ArduPilot tree at $(ARDUPILOT); set ARDUPILOT="; exit 1; } rm -rf "$(ARDUPILOT)/libraries/AP_HAL_ChibiOS/hwdef/$(BOARD)" cp -r hwdef/$(BOARD) "$(ARDUPILOT)/libraries/AP_HAL_ChibiOS/hwdef/" docker run --rm -v "$(ARDUPILOT)":"$(ARDUPILOT)" -w "$(ARDUPILOT)" -u "$$(id -u):$$(id -g)" -e HOME=/tmp $(IMAGE) \ bash -c 'git config --global --add safe.directory "*" && Tools/scripts/build_bootloaders.py $(BOARD) && ./waf configure --board $(BOARD) && ./waf AP_Periph' mkdir -p build cp "$(ARDUPILOT)/build/$(BOARD)/bin/AP_Periph.bin" "$(ARDUPILOT)/build/$(BOARD)/bin/AP_Periph_with_bl.hex" build/ cp "$(ARDUPILOT)/Tools/bootloaders/$(BOARD)_bl.bin" build/ @ls -la build/ clean: rm -rf build