Skip to content

Commit 2e45917

Browse files
committed
Merge branch 'main' of github.com:Open-Source-Space-Foundation/proves-core-reference into burnwire
2 parents 35ea0db + 8a8e2b3 commit 2e45917

28 files changed

+417
-140
lines changed

CMakePresets.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33
{
44
"binaryDir": "${sourceDir}/build-fprime-automatic-zephyr",
55
"cacheVariables": {
6-
"BOARD": "teensy41",
6+
"BOARD": "proves_flight_control_board_v5c/rp2350a/m33",
77
"CMAKE_BUILD_TYPE": "Release",
88
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
99
},
1010
"description": "F\u00b4 release build using local fprime-venv",
11-
"displayName": "F\u00b4 Zephyr (teensy41)",
11+
"displayName": "F\u00b4 FPrime Zephyr PROVES",
1212
"environment": {
1313
"PATH": "$env{VIRTUAL_ENV}/bin:$penv{PATH}",
1414
"VIRTUAL_ENV": "${fileDir}/fprime-venv"
1515
},
1616
"generator": "Ninja",
17-
"name": "fprime-zephyr-teensy41",
17+
"name": "fprime-zephyr-proves",
1818
"toolchainFile": "${fileDir}/lib/fprime-zephyr/cmake/toolchain/zephyr.cmake"
1919
}
2020
],

FprimeZephyrReference/ReferenceDeployment/Top/ReferenceDeploymentTopology.cpp

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,7 @@
1313

1414
#include <zephyr/drivers/gpio.h>
1515

16-
static const struct gpio_dt_spec ledGpio = GPIO_DT_SPEC_GET(DT_ALIAS(led0), gpios);
17-
// static const struct gpio_dt_spec burnwire0Gpio = GPIO_DT_SPEC_GET(DT_ALIAS(burnwire0), gpio
18-
static const struct gpio_dt_spec burnwire0Gpio = {
19-
.port = DEVICE_DT_GET(DT_NODELABEL(gpio0)),
20-
.pin = 28, // 28
21-
.dt_flags = GPIO_ACTIVE_HIGH,
22-
};
23-
static const struct gpio_dt_spec burnwire1Gpio = {
24-
.port = DEVICE_DT_GET(DT_NODELABEL(gpio0)),
25-
.pin = 29, // 29
26-
.dt_flags = GPIO_ACTIVE_HIGH,
27-
};
16+
static const struct gpio_dt_spec ledGpio = GPIO_DT_SPEC_GET(DT_NODELABEL(led0), gpios);
2817

2918
// Allows easy reference to objects in FPP/autocoder required namespaces
3019
using namespace ReferenceDeployment;

Makefile

Lines changed: 14 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ submodules: ## Initialize and update git submodules
1515

1616

1717
export VIRTUAL_ENV ?= $(shell pwd)/fprime-venv
18-
fprime-venv: uv ## Create a virtual environment
19-
echo "Creating virtual environment..."; \
20-
$(UV) venv fprime-venv; \
21-
$(UV) pip install --requirement requirements.txt;
22-
18+
fprime-venv: ## Create a virtual environment
19+
@$(MAKE) uv
20+
@echo "Creating virtual environment..."
21+
@$(UV) venv fprime-venv
22+
@$(UV) pip install --requirement requirements.txt
2323

2424
.PHONY: zephyr-setup
25-
zephyr-setup: uv ## Set up Zephyr environment
25+
zephyr-setup: fprime-venv ## Set up Zephyr environment
2626
@test -s lib/zephyr-workspace/tools/edtt/.gitignore || { \
2727
echo "Setting up Zephyr environment..."; \
2828
cd lib/zephyr-workspace && \
@@ -35,45 +35,34 @@ zephyr-setup: uv ## Set up Zephyr environment
3535
##@ Development
3636

3737
.PHONY: pre-commit-install
38-
pre-commit-install: uv
39-
@echo "Installing pre-commit hooks..."
38+
pre-commit-install: uv ## Install pre-commit hooks
4039
@$(UVX) pre-commit install > /dev/null
4140

4241
.PHONY: fmt
4342
fmt: pre-commit-install ## Lint and format files
44-
$(UVX) pre-commit run --all-files
43+
@$(UVX) pre-commit run --all-files
4544

4645
.PHONY: generate
4746
generate: submodules fprime-venv zephyr-setup ## Generate FPrime-Zephyr Proves Core Reference
4847
@echo "Generating FPrime-Zephyr Proves Core Reference..."
49-
$(UV) run fprime-util generate --force
48+
@$(UV) run fprime-util generate --force
5049

5150
.PHONY: generate-if-needed
5251
BUILD_DIR ?= $(shell pwd)/build-fprime-automatic-zephyr
5352
generate-if-needed:
5453
@test -s $(BUILD_DIR) || $(MAKE) generate
5554

5655
.PHONY: build
57-
build: generate-if-needed ## Build FPrime-Zephyr Proves Core Reference
58-
@echo "Building FPrime code..."
56+
build: submodules zephyr-setup fprime-venv generate-if-needed ## Build FPrime-Zephyr Proves Core Reference
57+
@echo "Building..."
5958
@$(UV) run fprime-util build
6059

61-
.PHONY: list-tty
62-
list-tty: arduino-cli ## List available TTY ports
63-
@echo "TTY ports:"
64-
@$(ARDUINO_CLI) board list | grep "USB" | awk '{print $$1}'
65-
66-
.PHONY: install
67-
UF2 ?= $(BUILD_DIR)/zephyr/zephyr.uf2
68-
install: arduino-cli build ## Install the zephyr firmware onto a connected PROVES Kit, requires BOARD_DIR=[path-to-your-board]
69-
@$(ARDUINO_CLI) config init || true
70-
@$(ARDUINO_CLI) config add board_manager.additional_urls https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
71-
@$(ARDUINO_CLI) core install rp2040:[email protected]
72-
@$(ARDUINO_CLI) upload -v -b 115200 --fqbn rp2040:rp2040:rpipico -p $(BOARD_DIR) -i $(UF2)
73-
7460
.PHONY: clean
7561
clean: ## Remove all gitignored files
7662
git clean -dfX
63+
64+
.PHONY: clean-zephyr
65+
clean-zephyr: ## Remove all Zephyr build files
7766
rm -rf lib/zephyr-workspace/bootloader lib/zephyr-workspace/modules lib/zephyr-workspace/tools
7867

7968
##@ Operations
@@ -99,9 +88,3 @@ UVX ?= $(UV_DIR)/uvx
9988
uv: $(UV) ## Download uv
10089
$(UV): $(BIN_DIR)
10190
@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; }
102-
103-
ARDUINO_CLI ?= $(BIN_DIR)/arduino-cli
104-
.PHONY: arduino-cli
105-
arduino-cli: $(ARDUINO_CLI) ## Download arduino-cli
106-
$(ARDUINO_CLI): $(BIN_DIR)
107-
@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: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,7 @@ make build
3636

3737
### Find the path to your board
3838

39-
Next, plug in your board! If you have previously installed a firmware on your board you may not see it show up as a drive. In that case you'll want to find it's `tty` port.
40-
41-
To do this, run the following command
42-
```shell
43-
make list-tty
44-
```
45-
46-
Otherwise, 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
39+
Next, plug in your board! If you have previously installed a firmware on your board you may not see it show up as a drive. In that case you'll want to put the board into boot loader mode. Then you'll be able 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
4740

4841
For Mac:
4942
```shell
@@ -60,7 +53,7 @@ findmnt
6053

6154
Now you want to install the firmware to the board.
6255
```shell
63-
make install BOARD_DIR=[path-to-your-board]
56+
cp build-artifacts/zephyr.uf2 [path-to-your-board]
6457
```
6558

6659
Finally, run the fprime-gds.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
config SOC_RP2350A_M33
2+
bool "Enable Arm cores"
3+
default y
4+
5+
config USB_SELF_POWERED
6+
default n
7+
8+
config USB_CDC_ACM_LOG_LEVEL
9+
default 0
10+
11+
config USB_DEVICE_LOG_LEVEL
12+
default 1
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#include <zephyr/dt-bindings/pinctrl/rpi-pico-rp2350a-pinctrl.h>
2+
3+
&pinctrl {
4+
spi1_default: spi1_default {
5+
group1 {
6+
pinmux = <SPI1_SCK_P10>, <SPI1_TX_P11>;
7+
};
8+
9+
group2 {
10+
pinmux = <SPI1_RX_P8>;
11+
input-enable;
12+
};
13+
};
14+
i2c1_default: i2c1_default {
15+
group1 {
16+
pinmux = <I2C1_SCL_P3>, <I2C1_SDA_P2>;
17+
input-enable;
18+
};
19+
};
20+
};
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
#include <freq.h>
2+
3+
#include <zephyr/dt-bindings/i2c/i2c.h>
4+
#include <zephyr/dt-bindings/pwm/pwm.h>
5+
6+
#include "proves_flight_control_board_v5-pinctrl.dtsi"
7+
8+
/ {
9+
chosen {
10+
zephyr,sram = &sram0;
11+
zephyr,flash = &flash0;
12+
zephyr,console = &cdc_acm_uart0;
13+
zephyr,shell-uart = &cdc_acm_uart0;
14+
zephyr,code-partition = &code_partition;
15+
};
16+
17+
aliases {
18+
watchdog0 = &wdt0;
19+
};
20+
21+
leds {
22+
compatible = "gpio-leds";
23+
led0: led0 {
24+
gpios = <&gpio0 24 GPIO_ACTIVE_HIGH>;
25+
label = "User LED GPIO24";
26+
};
27+
};
28+
};
29+
30+
zephyr_udc0: &usbd {
31+
status = "okay";
32+
};
33+
34+
&zephyr_udc0 {
35+
cdc_acm_uart0: cdc_acm_uart0 {
36+
compatible = "zephyr,cdc-acm-uart";
37+
label = "CDC_ACM_0";
38+
};
39+
};
40+
41+
&flash0 {
42+
reg = <0x10000000 DT_SIZE_M(4)>;
43+
44+
partitions {
45+
compatible = "fixed-partitions";
46+
#address-cells = <1>;
47+
#size-cells = <1>;
48+
49+
/* Reserved memory for an image definition block. The block is much
50+
* smaller than 256 bytes, but in practice the linker places the vector
51+
* table at a much larger alignment offset.
52+
*/
53+
image_def: partition@0 {
54+
label = "image_def";
55+
reg = <0x00000000 0x100>;
56+
read-only;
57+
};
58+
59+
/*
60+
* Usable flash. Starts at 0x100, after the image definition block.
61+
* The partition size is 4MB minus the 0x100 bytes taken by the
62+
* image definition.
63+
*/
64+
code_partition: partition@100 {
65+
label = "code-partition";
66+
reg = <0x100 (DT_SIZE_M(4) - 0x100)>;
67+
read-only;
68+
};
69+
};
70+
};
71+
72+
&timer0 {
73+
status = "okay";
74+
};
75+
76+
&wdt0 {
77+
status = "okay";
78+
};
79+
80+
&gpio0 {
81+
status = "okay";
82+
};
83+
84+
&spi1 {
85+
status = "okay";
86+
cs-gpios = <&gpio0 9 GPIO_ACTIVE_LOW>;
87+
pinctrl-0 = <&spi1_default>;
88+
pinctrl-names = "default";
89+
90+
lora0: sx1276@0 {
91+
compatible = "semtech,sx1276";
92+
reg = <0>;
93+
spi-max-frequency = <125000>;
94+
dio-gpios = <&gpio0 13 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>,<&gpio0 12 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>;
95+
reset-gpios = <&gpio0 6 GPIO_ACTIVE_LOW>;
96+
power-amplifier-output = "pa-boost";
97+
label = "HOPE_RF";
98+
};
99+
};
100+
101+
&i2c1 {
102+
status = "okay";
103+
pinctrl-0 = <&i2c1_default>;
104+
pinctrl-names = "default";
105+
clock-frequency = <100000>;
106+
107+
lsm6dso0: lsm6dso0@6b {
108+
compatible = "st,lsm6dso";
109+
reg = <0x6b>;
110+
label = "LSM6DSO";
111+
};
112+
113+
lis2mdl: lis2mdl@1e {
114+
compatible = "st,lis2mdl";
115+
reg = <0x1e>;
116+
label = "LIS2MDL";
117+
};
118+
rv3028: rv3028@52 {
119+
compatible = "microcrystal,rv3028";
120+
reg = <0x52>;
121+
int-gpios = <&gpio0 27 GPIO_ACTIVE_HIGH>;
122+
backup-switch-mode = "level";
123+
label = "RV3028";
124+
};
125+
ina219: ina219@40 {
126+
compatible = "ti,ina219";
127+
reg = <0x40>;
128+
shunt-milliohm = <2>;
129+
lsb-microamp = <100>;
130+
label = "INA219";
131+
};
132+
};
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
source "../../../boards/bronco_space/proves_flight_control_board_v5/Kconfig.defconfig"
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
if("${RPI_PICO_DEBUG_ADAPTER}" STREQUAL "")
4+
set(RPI_PICO_DEBUG_ADAPTER "cmsis-dap")
5+
endif()
6+
7+
board_runner_args(openocd --cmd-pre-init "source [find interface/${RPI_PICO_DEBUG_ADAPTER}.cfg]")
8+
board_runner_args(openocd --cmd-pre-init "source [find target/rp2350.cfg]")
9+
10+
# The adapter speed is expected to be set by interface configuration.
11+
# The Raspberry Pi's OpenOCD fork doesn't, so match their documentation at
12+
# https://www.raspberrypi.com/documentation/microcontrollers/debug-probe.html#debugging-with-swd
13+
board_runner_args(openocd --cmd-pre-init "set_adapter_speed_if_not_set 5000")
14+
15+
board_runner_args(jlink "--device=RP2350_M33_0")
16+
board_runner_args(uf2 "--board-id=RP2350")
17+
18+
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)
19+
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
20+
include(${ZEPHYR_BASE}/boards/common/uf2.board.cmake)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
board:
2+
name: proves_flight_control_board_v5c
3+
full_name: PROVES Flight Control Board v5c
4+
vendor: Bronco Space
5+
socs:
6+
- name: rp2350a

0 commit comments

Comments
 (0)