build: replace argument dispatch and retain source-bound verification
Replace argument recovery with direct build targets. Run host, target, board, coverage, Miri and selected Kani checks while retaining source identities, logs and artifacts, including failed attempts. Keep the PID proof diagnostic exception explicit and match its exact identity alongside passing contract assertions and covers. Validation: final-source verification matrix, assembled workflow tests and documentation build.
This commit is contained in:
1 parent
4953f0a974
commit
62b18d5b2e
26 files changed
+2177
-1052
No files matched your search
+57
-41
@@ -1,65 +1,58 @@
|
||||
override SHELL := /bin/sh
|
||||
override MAKEFLAGS += --no-print-directory
|
||||
SHELL := /bin/sh
|
||||
MAKEFLAGS += --no-print-directory
|
||||
export CARGO_BUILD_JOBS ?= 2
|
||||
|
||||
.DEFAULT_GOAL := help
|
||||
.DELETE_ON_ERROR:
|
||||
|
||||
override CARGO := cargo
|
||||
override PYTHON := python3
|
||||
override CARGO_FLAGS := --locked --offline
|
||||
|
||||
override BOARDS := geprc-f722-v2 kakute-f7-mini-v3
|
||||
override BOARD_PACKAGES := $(addprefix kaptan-,$(BOARDS))
|
||||
override BOARD_PACKAGE_ARGS := $(addprefix -p ,$(BOARD_PACKAGES))
|
||||
override HOST_EXCLUDES := $(addprefix --exclude ,$(BOARD_PACKAGES))
|
||||
override HOST_FEATURES := --features kaptan-navigation/sensor-snapshots
|
||||
|
||||
override PRIMARY_GOAL := $(firstword $(MAKECMDGOALS))
|
||||
|
||||
run:
|
||||
@exec python3 ../scripts/make-argv.py exec run $(CARGO)
|
||||
|
||||
ifeq ($(PRIMARY_GOAL),run)
|
||||
|
||||
.PHONY: run
|
||||
|
||||
# Application arguments may also look like Make goals. The run recipe recovers
|
||||
# their exact boundaries from the original invocation.
|
||||
.DEFAULT:
|
||||
@:
|
||||
|
||||
else
|
||||
|
||||
.PHONY: help run fmt clippy test native-test docs pre-commit check clean
|
||||
.NOTPARALLEL:
|
||||
.PHONY: help fmt clippy test native-test docs coverage target-checks verification verification-tools miri kani verification-inventory pre-commit check clean
|
||||
|
||||
help:
|
||||
@printf '%s\n' 'Usage: make firmware -- <cargo arguments...>' '' \
|
||||
'Example: make firmware -- test --workspace --locked --offline' '' \
|
||||
@printf '%s\n' 'Usage: make -C firmware <target>' '' \
|
||||
'Workspace targets:' \
|
||||
' fmt Check Rust formatting' \
|
||||
' clippy Run host and embedded Clippy checks' \
|
||||
' test Run Rust and firmware script tests' \
|
||||
' native-test Check cross-crate error IDs at Rust/C++ release final link' \
|
||||
' docs Build Rust API documentation with warnings denied' \
|
||||
' coverage Required final strict-core line/branch coverage gate' \
|
||||
' verification Run all gates and retain source-bound evidence' \
|
||||
' verification-tools Install the pinned Miri and Kani tools' \
|
||||
' miri Run the manifest-selected Miri checks' \
|
||||
' kani Run the manifest-selected Kani proofs' \
|
||||
' verification-inventory Show verification owners, claims and gaps' \
|
||||
' target-checks Check sensor-free consumers and link cross-route fixtures' \
|
||||
' pre-commit Run fmt, clippy, test, and docs' \
|
||||
' check Alias for pre-commit' \
|
||||
' clean Remove Cargo build artifacts'
|
||||
' clean Remove Cargo build artifacts' '' \
|
||||
'For other Cargo options, run cargo directly from firmware/.' \
|
||||
'Host gates exclude bare-metal boards; navigation/sensor-snapshots is enabled.'
|
||||
|
||||
fmt:
|
||||
$(CARGO) fmt --all --check
|
||||
cargo fmt --all --check
|
||||
|
||||
clippy:
|
||||
$(CARGO) clippy --workspace --all-targets $(HOST_EXCLUDES) \
|
||||
$(CARGO_FLAGS) -- -D warnings
|
||||
$(CARGO) clippy -p platform-stm32f7 --all-targets \
|
||||
$(CARGO_FLAGS) -- -D warnings
|
||||
$(CARGO) clippy $(BOARD_PACKAGE_ARGS) --target thumbv7em-none-eabihf \
|
||||
$(CARGO_FLAGS) -- -D warnings
|
||||
cargo clippy --workspace --all-targets $(HOST_EXCLUDES) \
|
||||
$(HOST_FEATURES) --locked --offline -- -D warnings
|
||||
cargo clippy -p platform-stm32f7 --all-targets \
|
||||
--locked --offline -- -D warnings
|
||||
cargo clippy $(BOARD_PACKAGE_ARGS) $(addprefix --bin ,$(BOARD_PACKAGES)) --target thumbv7em-none-eabihf \
|
||||
--locked --offline -- -D warnings
|
||||
|
||||
test:
|
||||
$(CARGO) test --workspace $(CARGO_FLAGS)
|
||||
$(PYTHON) -m unittest \
|
||||
scripts/test-analyze-fw.py scripts/test-summarize-test-coverage.py
|
||||
cargo +1.90.0 test --workspace $(HOST_EXCLUDES) $(HOST_FEATURES) --locked --offline
|
||||
cargo +1.90.0 test -p platform-stm32f7 -p synopsys-usb-otg --lib --locked --offline
|
||||
node --test tools/configurator/web/view.test.cjs
|
||||
python3 -m unittest scripts/test-analyze-fw.py \
|
||||
scripts/test-summarize-test-coverage.py scripts/test-build-workflow.py \
|
||||
scripts/test-verify.py
|
||||
+@$(MAKE) native-test
|
||||
|
||||
native-test:
|
||||
@@ -67,14 +60,37 @@ native-test:
|
||||
--work-dir "$(or $(CARGO_TARGET_DIR),target)/native-tests/final-link"
|
||||
|
||||
docs:
|
||||
RUSTDOCFLAGS='-D warnings' $(CARGO) doc --workspace --no-deps \
|
||||
$(HOST_EXCLUDES) $(CARGO_FLAGS)
|
||||
RUSTDOCFLAGS='-D warnings' cargo doc --workspace --no-deps \
|
||||
$(HOST_EXCLUDES) $(HOST_FEATURES) --locked --offline
|
||||
|
||||
coverage:
|
||||
scripts/report-test-coverage.sh
|
||||
|
||||
verification:
|
||||
python3 scripts/verify.py all
|
||||
|
||||
verification-tools:
|
||||
python3 scripts/verify.py setup
|
||||
|
||||
miri kani:
|
||||
python3 scripts/verify.py $@
|
||||
|
||||
verification-inventory:
|
||||
python3 scripts/verify.py inventory
|
||||
|
||||
target-checks:
|
||||
cargo check -p kaptan-configurator -p kaptan-diagnostics-mavlink --locked --offline
|
||||
cargo check -p kaptan-mavlink -p kaptan-log --no-default-features --locked --offline
|
||||
cargo check -p kaptan-flight-runtime --no-default-features \
|
||||
--target thumbv7em-none-eabihf --locked --offline
|
||||
RUSTFLAGS='-C link-arg=-Tlink.x -L platforms/stm32f7/link/f722' \
|
||||
cargo build -p platform-stm32f7 --example mpu_dual_uart --example icm_dual_uart \
|
||||
--release --target thumbv7em-none-eabihf --locked --offline
|
||||
|
||||
pre-commit: fmt clippy test docs
|
||||
@printf '%s\n' 'Pre-commit passed. Coverage was not run; make coverage is a required final gate.'
|
||||
|
||||
check: pre-commit
|
||||
|
||||
clean:
|
||||
$(CARGO) clean
|
||||
|
||||
endif
|
||||
cargo clean
|
||||
Reference in new issue
Block a user