Skip to content

Commit 63e5a4f

Browse files
authored
Merge pull request #4 from Open-Source-Space-Foundation/ngay-build
Remove need to manage python env
2 parents eb3a8e6 + 5e63aa1 commit 63e5a4f

File tree

5 files changed

+108
-46
lines changed

5 files changed

+108
-46
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ build
2222
**/__pycache__/
2323
**/*.egg-info/
2424

25+
bin/

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.13

Makefile

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
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

README.md

Lines changed: 12 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -8,62 +8,30 @@ This is a reference software implementation for the [Proves Kit](https://docs.pr
88

99
## Installation
1010

11-
First, clone the Proves Core Reference repository and ensure all submodules are properly checked-out.
11+
First, clone the Proves Core Reference repository.
1212

13-
```
14-
fprime-bootstrap clone https://github.com/Open-Source-Space-Foundation/proves-core-reference
15-
```
16-
17-
By using `fprime-bootstrap` the following several tasks are accomplished:
18-
19-
- The repository and submodules are cloned
20-
- A virtual environment is created and depenencies are installed
21-
22-
> [!TIP]
23-
> Always source the virtual environment when building by running `. fprime-venv/bin/activate` in the `proves-core-reference` directory,
24-
25-
Next update Zephyr modules. This will take a long time.
26-
27-
```
28-
cd proves-core-reference/lib/zephyr-workspace
29-
west update
13+
```shell
14+
git clone https://github.com/Open-Source-Space-Foundation/proves-core-reference
3015
```
3116

32-
Export a Zephyr CMake package. This allows CMake to automatically load boilerplate code required for building Zephyr applications.
17+
Next, navigate to the `proves-core-reference` directory and run `make` to set up the project.
3318

34-
```
35-
west zephyr-export
36-
```
37-
38-
The Zephyr west extension command, west packages can be used to install Python dependencies.
39-
40-
```
41-
west packages pip --install
42-
```
43-
44-
Finally, install the Zephyr SDK.
45-
46-
```
47-
west sdk install
48-
```
49-
50-
Finally, everytime you pull a new version of code, run this
51-
52-
```
53-
git submodule update --init --recursive
19+
```shell
20+
cd proves-core-reference
21+
make
5422
```
5523

5624
## Running the code
5725

58-
Run generate from the `proves-core-reference` directory. This generates the build cache for FPrime. When you regenerate, append a -f, this will purge the previous deployment. You only need to do generate if something in the core FPrime package has changed
26+
Run generate from the `proves-core-reference` directory. This generates the build cache for FPrime. You only need to do generate if something in the core FPrime package has changed
5927
```
60-
fprime-util generate
28+
make generate
6129
```
6230

6331
Then, and everytime you change code, run
6432

6533
```
66-
fprime-util build
34+
make build
6735
```
6836

6937
Next, plug in your board! You want to find the location of the board on your computer. It should be called something like RP2350 but you want to find the path to it
@@ -81,14 +49,12 @@ For Linux:
8149
findmnt
8250
```
8351

84-
8552
Now you want to copy the code from the deployment we just made. Before you run this command you have to make this board writable by pressing the two buttons in succesion
8653
```
87-
cp build-fprime-automatic-zephyr/zephyr/zephyr.uf2 [path-to-your-board]
54+
make install BOARD_DIR=[path-to-your-board]
8855
```
8956

9057
Finally, run the fprime-gds.
9158
```
92-
fprime-gds -n --dictionary ./build-artifacts/zephyr/fprime-zephyr-deployment/dict/ReferenceDeploymentTopologyDictionary.json --communication-selection uart --uart-baud 115200 --output-unframed-data
59+
make gds
9360
```
94-

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# -r https://raw.githubusercontent.com/nasa/fprime/refs/tags/v4.0.0a1/requirements.txt
33
-r lib/fprime/requirements.txt
44

5+
pip
56
west
67
# Requirements files needed for building Zephyr
78
# Zephyr workflow requirements removed due to conflicts with F Prime

0 commit comments

Comments
 (0)