build: add directory-oriented make workflows
Host SITL smoke / Deterministic Gazebo command path (push) Has been cancelled
Host SITL smoke / Deterministic Gazebo command path (push) Has been cancelled
This commit is contained in:
1 parent
4bc98adbc6
commit
7dc3ccb619
40 files changed
+1367
-278
No files matched your search
@@ -0,0 +1,69 @@
|
||||
override SHELL := /bin/sh
|
||||
override MAKEFLAGS += --no-print-directory
|
||||
|
||||
.DEFAULT_GOAL := help
|
||||
.DELETE_ON_ERROR:
|
||||
|
||||
override CARGO := cargo
|
||||
override CARGO_FLAGS := --locked --offline
|
||||
override DFU_UTIL := dfu-util
|
||||
|
||||
override EMBEDDED_TARGET := thumbv7em-none-eabihf
|
||||
override PACKAGE := kaptan-$(BOARD)
|
||||
override TARGET_DIR := ../../target/$(EMBEDDED_TARGET)/release
|
||||
override CREATE_IMAGE := ../../scripts/create-dfu-image.sh
|
||||
|
||||
override DFU_DEVICE := 0483:df11
|
||||
override DFU_ALT := 0
|
||||
override DFU_ADDRESS := 0x08000000:leave
|
||||
|
||||
override PRIMARY_GOAL := $(firstword $(MAKECMDGOALS))
|
||||
|
||||
run:
|
||||
@exec python3 ../../../scripts/make-argv.py exec run $(CARGO) build --release \
|
||||
$(CARGO_FLAGS) -p $(PACKAGE) --target $(EMBEDDED_TARGET)
|
||||
$(CREATE_IMAGE) $(TARGET_DIR)/$(PACKAGE)
|
||||
|
||||
_build:
|
||||
$(CARGO) build --release $(CARGO_FLAGS) -p $(PACKAGE) \
|
||||
--target $(EMBEDDED_TARGET)
|
||||
$(CREATE_IMAGE) $(TARGET_DIR)/$(PACKAGE)
|
||||
|
||||
flash: _build
|
||||
@printf '%s\n' 'Flashing $(TARGET_DIR)/$(PACKAGE).bin to $(DFU_DEVICE)'
|
||||
@exec python3 ../../../scripts/make-argv.py exec flash \
|
||||
$(DFU_UTIL) --device $(DFU_DEVICE) --alt $(DFU_ALT) \
|
||||
--dfuse-address $(DFU_ADDRESS) \
|
||||
--download $(TARGET_DIR)/$(PACKAGE).bin
|
||||
|
||||
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
|
||||
|
||||
ifeq ($(PRIMARY_GOAL),flash)
|
||||
|
||||
.PHONY: flash _build
|
||||
|
||||
.DEFAULT:
|
||||
@:
|
||||
|
||||
else
|
||||
|
||||
.PHONY: help run flash _build
|
||||
|
||||
help:
|
||||
@printf '%s\n' 'Usage: make firmware/boards/$(BOARD) -- <cargo build arguments...>' '' \
|
||||
' make firmware/boards/$(BOARD) flash -- <dfu-util arguments...>' '' \
|
||||
'With no arguments, this board is built and packaged.' \
|
||||
'The flash target builds, packages, and writes this board over DFU.'
|
||||
|
||||
endif
|
||||
|
||||
endif
|
||||
Reference in new issue
Block a user