ahhh shit here we go again
This commit is contained in:
8
.gitignore
vendored
8
.gitignore
vendored
@@ -1,3 +1,9 @@
|
|||||||
build/
|
build/
|
||||||
.vscode/
|
.vscode/
|
||||||
|
tools/
|
||||||
|
.cache/
|
||||||
|
.west/
|
||||||
|
.vscode/
|
||||||
|
zephyr/
|
||||||
|
modules/
|
||||||
|
bootloader/
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
cmake_minimum_required(VERSION 3.20.0)
|
cmake_minimum_required(VERSION 3.20.0)
|
||||||
|
|
||||||
set(BOARD adafruit_feather_nrf52840)
|
set(BOARD rpi_pico)
|
||||||
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
|
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
|
||||||
|
|
||||||
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
|
||||||
project(passr)
|
project(passr)
|
||||||
|
|
||||||
target_sources(app PRIVATE src/main.c)
|
target_sources(app PRIVATE src/main.c)
|
||||||
|
|||||||
20
Makefile
Normal file
20
Makefile
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
.ONESHELL:
|
||||||
|
|
||||||
|
TARGET=rpi_pico
|
||||||
|
|
||||||
|
CMAKE_ZEPHYR_PATH=../zephyrproject/zephyr
|
||||||
|
CMAKE_ZEPHYR_COMMAND=west build
|
||||||
|
CMAKE_ZEPHYR_FLAGS=-b $(TARGET)
|
||||||
|
|
||||||
|
all: flash
|
||||||
|
|
||||||
|
compile:
|
||||||
|
$(CMAKE_ZEPHYR_COMMAND) $(CMAKE_ZEPHYR_FLAGS)
|
||||||
|
|
||||||
|
# FIXME: This is entirely board specific, for example the pi pico will vibe differently
|
||||||
|
flash:
|
||||||
|
west flash
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf build/
|
||||||
|
mkdir build
|
||||||
14
README.md
Normal file
14
README.md
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# Passr
|
||||||
|
|
||||||
|
## Building
|
||||||
|
|
||||||
|
Install Zephyr, the Zephyr SDK and West
|
||||||
|
|
||||||
|
```sh
|
||||||
|
west init
|
||||||
|
west update
|
||||||
|
make build
|
||||||
|
```
|
||||||
|
|
||||||
|
The project is currently configured to run on a Pi Pico as my nrf development board is misbehaving
|
||||||
|
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
west build -b adafruit_feather_nrf52840 .
|
west build -b adafruit_feather_nrf52840 .
|
||||||
nrfutil dfu genpkg --application build/zephyr/zephyr.hex --application-version 0xFF --dev-revision 0xFF --dev-type 0xFFFF --sd-req 0x81 feather_nrf52840_express_bootloader-0.7.0_s140_6.1.1.zip
|
# nrfutil dfu genpkg --application build/zephyr/zephyr.hex --application-version 0xFF --dev-revision 0xFF --dev-type 0xFFFF --sd-req 0x81 feather_nrf52840_express_bootloader-0.7.0_s140_6.1.1.zip
|
||||||
# nrfutil dfu usb-serial -pkg app.zip -p ttyACM0 // DO NOT FUCKING DO THIS
|
# nrfutil dfu usb-serial -pkg app.zip -p ttyACM0 // DO NOT FUCKING DO THIS
|
||||||
|
# ./uf2conv.py build/zephyr/zephyr.hex -c -f 0xADA52840
|
||||||
|
cp build/zephyr/zephyr.uf2 .
|
||||||
|
|||||||
20
feather_bootloader/manifest.json
Normal file
20
feather_bootloader/manifest.json
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"manifest": {
|
||||||
|
"dfu_version": 0.5,
|
||||||
|
"softdevice_bootloader": {
|
||||||
|
"bin_file": "sd_bl.bin",
|
||||||
|
"bl_size": 39000,
|
||||||
|
"dat_file": "sd_bl.dat",
|
||||||
|
"init_packet_data": {
|
||||||
|
"application_version": 4294967295,
|
||||||
|
"device_revision": 52840,
|
||||||
|
"device_type": 82,
|
||||||
|
"firmware_crc16": 40783,
|
||||||
|
"softdevice_req": [
|
||||||
|
65534
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"sd_size": 151016
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
feather_bootloader/sd_bl.bin
Normal file
BIN
feather_bootloader/sd_bl.bin
Normal file
Binary file not shown.
BIN
feather_bootloader/sd_bl.dat
Normal file
BIN
feather_bootloader/sd_bl.dat
Normal file
Binary file not shown.
1
prj.conf
1
prj.conf
@@ -1,3 +1,4 @@
|
|||||||
|
CONFIG_BUILD_OUTPUT_UF2=y
|
||||||
CONFIG_GPIO=y
|
CONFIG_GPIO=y
|
||||||
# CONFIG_BT=y
|
# CONFIG_BT=y
|
||||||
# CONFIG_BT_DEBUG_LOG=y
|
# CONFIG_BT_DEBUG_LOG=y
|
||||||
|
|||||||
21
src/main.c
21
src/main.c
@@ -6,7 +6,7 @@
|
|||||||
#define SLEEP_TIME_MS 1000
|
#define SLEEP_TIME_MS 1000
|
||||||
|
|
||||||
/* The devicetree node identifier for the "led0" alias. */
|
/* The devicetree node identifier for the "led0" alias. */
|
||||||
#define LED0_NODE DT_ALIAS(led1)
|
#define LED0_NODE DT_ALIAS(led0)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A build error on this line means your board is unsupported.
|
* A build error on this line means your board is unsupported.
|
||||||
@@ -18,8 +18,7 @@ void main(void)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!device_is_ready(led.port)) {
|
while (!device_is_ready(led.port)) {
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = gpio_pin_configure_dt(&led, GPIO_OUTPUT_ACTIVE);
|
ret = gpio_pin_configure_dt(&led, GPIO_OUTPUT_ACTIVE);
|
||||||
@@ -27,11 +26,13 @@ void main(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (1) {
|
gpio_pin_set_dt(&led, GPIO_OUTPUT_HIGH);
|
||||||
ret = gpio_pin_toggle_dt(&led);
|
|
||||||
if (ret < 0) {
|
while (1) {
|
||||||
return;
|
ret = gpio_pin_toggle_dt(&led);
|
||||||
}
|
if (ret < 0) {
|
||||||
k_msleep(SLEEP_TIME_MS);
|
return;
|
||||||
}
|
}
|
||||||
|
k_msleep(SLEEP_TIME_MS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user