|
| 1 | +export VIRTUAL_ENV ?= $(shell pwd)/fprime-venv |
| 2 | + |
| 3 | +.PHONY: all |
| 4 | +all: submodules fprime-venv zephyr-setup generate-skip-if-exists build |
| 5 | + |
| 6 | +.PHONY: help |
| 7 | +help: ## Display this help. |
| 8 | + @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) |
| 9 | + |
| 10 | +##@ Dependencies |
| 11 | + |
| 12 | +.PHONY: submodules |
| 13 | +submodules: ## Initialize and update git submodules |
| 14 | + @echo "Initializing and updating git submodules..." |
| 15 | + git submodule update --init --recursive |
| 16 | + |
| 17 | +fprime-venv: ## Create a virtual environment |
| 18 | + @echo "Creating virtual environment..." |
| 19 | + @$(MAKE) uv |
| 20 | + @$(UV) venv fprime-venv |
| 21 | + @$(UV) pip install --requirement requirements.txt |
| 22 | + |
| 23 | +.PHONY: zephyr-setup |
| 24 | +zephyr-setup: ## Set up Zephyr environment |
| 25 | + @test -s $(lib/zephyr-workspace/tools/edtt/.gitignore) || (echo "Setting up Zephyr environment..." && \ |
| 26 | + cd lib/zephyr-workspace && \ |
| 27 | + $(UVX) west update && \ |
| 28 | + $(UVX) west zephyr-export && \ |
| 29 | + $(UV) run west packages pip --install && \ |
| 30 | + $(UV) run west sdk install) |
| 31 | + |
| 32 | +##@ Development |
| 33 | + |
| 34 | +.PHONY: generate |
| 35 | +generate: fprime-venv zephyr-setup ## Generate FPrime-Zephyr Proves Core Reference |
| 36 | + @echo "Generating FPrime-Zephyr Proves Core Reference..." |
| 37 | + $(UV) run fprime-util generate --force |
| 38 | + |
| 39 | +.PHONY: generate-if-needed |
| 40 | +generate-if-needed: |
| 41 | + @test -s $(build-fprime-automatic-zephyr) || $(MAKE) generate |
| 42 | + |
| 43 | +.PHONY: build |
| 44 | +build: fprime-venv zephyr-setup $(UF2) ## Build FPrime-Zephyr Proves Core Reference |
| 45 | + @echo "Building FPrime code..." |
| 46 | + @$(UV) run fprime-util build |
| 47 | + |
| 48 | +.PHONY: list-tty |
| 49 | +list-tty: arduino-cli ## List available TTY ports |
| 50 | + @echo "TTY ports:" |
| 51 | + @$(ARDUINO_CLI) board list | grep "USB" | awk '{print $$1}' |
| 52 | + |
| 53 | +.PHONY: install |
| 54 | +UF2 ?= build-fprime-automatic-zephyr/zephyr/zephyr.uf2 |
| 55 | +install: arduino-cli build ## Install the zephyr firmware onto a connected PROVES Kit, requires BOARD_DIR=[path-to-your-board] |
| 56 | + @$(ARDUINO_CLI) config init || true |
| 57 | + @$(ARDUINO_CLI) config add board_manager.additional_urls https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json |
| 58 | + @ $(ARDUINO_CLI) core install rp2040: [email protected] |
| 59 | + @$(ARDUINO_CLI) upload -v -b 115200 --fqbn rp2040:rp2040:rpipico -p $(BOARD_DIR) -i $(UF2) |
| 60 | + |
| 61 | +.PHONY: clean |
| 62 | +clean: ## Remove all gitignored files |
| 63 | + git clean -dfX |
| 64 | + rm -rf lib/zephyr-workspace/bootloader lib/zephyr-workspace/modules lib/zephyr-workspace/tools |
| 65 | + |
| 66 | +##@ Operations |
| 67 | + |
| 68 | +.PHONY: gds |
| 69 | +gds: ## Run FPrime GDS |
| 70 | + @echo "Running FPrime GDS..." |
| 71 | + @$(UV) run fprime-gds -n --dictionary ./build-artifacts/zephyr/fprime-zephyr-deployment/dict/ReferenceDeploymentTopologyDictionary.json --communication-selection uart --uart-baud 115200 --output-unframed-data |
| 72 | + |
| 73 | +##@ Build Tools |
| 74 | +BIN_DIR ?= $(shell pwd)/bin |
| 75 | +$(BIN_DIR): |
| 76 | + mkdir -p $(BIN_DIR) |
| 77 | + |
| 78 | +### Tool Versions |
| 79 | +UV_VERSION ?= 0.8.13 |
| 80 | + |
| 81 | +UV_DIR ?= $(BIN_DIR)/uv-$(UV_VERSION) |
| 82 | +UV ?= $(UV_DIR)/uv |
| 83 | +UVX ?= $(UV_DIR)/uvx |
| 84 | +.PHONY: uv |
| 85 | +uv: $(UV) ## Download uv |
| 86 | +$(UV): $(BIN_DIR) |
| 87 | + @test -s $(UV) || { mkdir -p $(UV_DIR); curl -LsSf https://astral.sh/uv/$(UV_VERSION)/install.sh | UV_INSTALL_DIR=$(UV_DIR) sh > /dev/null; } |
| 88 | + |
| 89 | +ARDUINO_CLI ?= $(BIN_DIR)/arduino-cli |
| 90 | +.PHONY: arduino-cli |
| 91 | +arduino-cli: $(ARDUINO_CLI) ## Download arduino-cli |
| 92 | +$(ARDUINO_CLI): $(BIN_DIR) |
| 93 | + @test -s $(ARDUINO_CLI) || curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | BINDIR=$(BIN_DIR) sh > /dev/null |
0 commit comments