Skip to content

Commit 6ffd9f7

Browse files
committed
Merge branch 'main' of github.com:CivicTechTO/tRacket-sensor into 21-access-point-dropdown
2 parents 7c633f7 + 0307c10 commit 6ffd9f7

File tree

7 files changed

+65
-65
lines changed

7 files changed

+65
-65
lines changed

.github/workflows/dummy_priv_key.pem

Lines changed: 0 additions & 52 deletions
This file was deleted.

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ jobs:
2424
2525
- name: Create header files
2626
run: |
27-
cp "${GITHUB_WORKSPACE}/.github/workflows/dummy_priv_key.pem" "${GITHUB_WORKSPACE}/priv_key.pem"
2827
cp "${GITHUB_WORKSPACE}/noisemeter-device/config.h.example" "${GITHUB_WORKSPACE}/noisemeter-device/config.h"
2928
python "${GITHUB_WORKSPACE}/noisemeter-device/certs.py" -s api.tracket.info > "${GITHUB_WORKSPACE}/noisemeter-device/certs.h"
3029
@@ -33,3 +32,4 @@ jobs:
3332

3433
- name: Build PlatformIO Project (esp32-breadboard)
3534
run: pio run -e esp32-breadboard
35+

.github/workflows/ota-release.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: OTA Release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
generate:
9+
name: Create release-artifacts
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/[email protected]
13+
- uses: actions/[email protected]
14+
with:
15+
path: |
16+
~/.cache/pip
17+
~/.platformio/.cache
18+
key: ${{ runner.os }}-pio
19+
- uses: actions/[email protected]
20+
with:
21+
python-version: '3.9'
22+
- name: Install Python packages
23+
run: |
24+
pip install --upgrade platformio
25+
pip install --upgrade cryptography
26+
27+
- name: Create files
28+
env:
29+
OTA_KEY: ${{ secrets.OTA_SIGNING_KEY }}
30+
run: |
31+
echo "$OTA_KEY" > "${GITHUB_WORKSPACE}/priv_key.pem"
32+
cp "${GITHUB_WORKSPACE}/noisemeter-device/config.h.example" "${GITHUB_WORKSPACE}/noisemeter-device/config.h"
33+
python "${GITHUB_WORKSPACE}/noisemeter-device/certs.py" -s api.tracket.info > "${GITHUB_WORKSPACE}/noisemeter-device/certs.h"
34+
35+
- name: Build signed firmware
36+
run: pio run -t ota -e esp32-pcb
37+
38+
- name: Upload signed firmware
39+
uses: djn24/add-asset-to-release@v1
40+
with:
41+
token: ${{ secrets.GITHUB_TOKEN }}
42+
path: 'firmware_signed.bin'

bringup.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
#
3+
# Run this script with a newly manufactured tRacket board connected to give it
4+
# a unique storage encryption key and flash the latest firmware.
5+
# The "tail" command will show the board's UUID; this needs to be added to the
6+
# server for device registration.
7+
8+
dd if=/dev/urandom of=hmac_key bs=1 count=32
9+
echo "BURN" | pio pkg exec -- espefuse.py --port /dev/ttyACM0 burn_key BLOCK4 hmac_key HMAC_UP
10+
rm hmac_key
11+
pio run -t upload
12+
tail -F /dev/ttyACM0
13+

build_hooks.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
Import("env")
22

3-
env.AddPostAction(
4-
"$BUILD_DIR/${PROGNAME}.bin",
5-
env.VerboseAction(
3+
env.AddCustomTarget(
4+
name="ota",
5+
dependencies="$BUILD_DIR/${PROGNAME}.bin",
6+
actions=[
67
"openssl dgst -sha256 -sign priv_key.pem -keyform PEM -out $BUILD_DIR/${PROGNAME}.sig -binary $BUILD_DIR/${PROGNAME}.bin",
7-
"Creating OTA signature...")
8-
)
9-
10-
env.AddPostAction(
11-
"$BUILD_DIR/${PROGNAME}.bin",
12-
env.VerboseAction(
13-
"cat $BUILD_DIR/${PROGNAME}.sig $BUILD_DIR/${PROGNAME}.bin > ${PROGNAME}_signed.bin",
14-
"Creating ${PROGNAME}_signed.bin")
8+
"cat $BUILD_DIR/${PROGNAME}.sig $BUILD_DIR/${PROGNAME}.bin > ${PROGNAME}_signed.bin"
9+
],
10+
title="OTA Signing",
11+
description="Create a signed OTA update"
1512
)
1613

hardware/pcb-rev3/tracket.FCStd

1.1 MB
Binary file not shown.

platformio.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ include_dir = noisemeter-device
1414
default_envs = esp32-pcb
1515

1616
[env]
17-
extra_scripts = post:build_hooks.py
17+
extra_scripts = build_hooks.py
1818
framework = arduino
1919
2020
board_build.partitions = nmpartitions.csv

0 commit comments

Comments
 (0)