|
1 | | -# STM32 selftest — cloud HIL via GitHub Actions |
| 1 | +# STM32 selftest: a minimal hardware-in-the-loop test |
2 | 2 |
|
3 | 3 | `selftest.c` is a tiny STM32F446 firmware that boots, prints a UART banner ending in |
4 | 4 | `APP_OK`, and exposes a `ping`/`status` console. It's the "hello world" of an EmbeddedCI |
5 | 5 | hardware-in-the-loop test driven entirely from CI. |
6 | 6 |
|
7 | | -## What the workflow does |
| 7 | +## Run it over the cloud |
8 | 8 |
|
9 | | -[`.github/workflows/selftest-cloud.yml`](../.github/workflows/selftest-cloud.yml) runs on every |
10 | | -change to `selftest.c` (or the workflow itself): |
| 9 | +The pod does not have to be on your network: the SDK reaches it **through embeddedci.com**, |
| 10 | +flashes the firmware over the cloud, power-cycles the target and asserts the `APP_OK` UART |
| 11 | +marker. Use the device name from the **BenchPod** page in the EmbeddedCI web app and an API key |
| 12 | +(or a `benchpod login` session): |
11 | 13 |
|
12 | | -1. builds `selftest.c` → `build/selftest.elf` (arm-none-eabi + STM32CubeF4), |
13 | | -2. installs the `embeddedci` SDK and runs `pytest selftest-stm32/tests`, |
14 | | -3. the test connects to the device **through embeddedci.com** with the connection |
15 | | - `embeddedci:benchpod-v1.0.0`, flashes the firmware over the cloud, power-cycles the |
16 | | - target, and asserts the `APP_OK` UART marker. |
17 | | - |
18 | | -There is **no BenchPod on the GitHub runner** — the physical pod lives wherever it's plugged in |
19 | | -and connects out to embeddedci.com. Auth is the job's **GitHub OIDC token** (`permissions: |
20 | | -id-token: write`); no API key or secret is stored. |
21 | | - |
22 | | -## One-time setup |
| 14 | +```bash |
| 15 | +pip install "embeddedci[pytest]>=2.0,<3" |
| 16 | +make CUBE_F4=/path/to/STM32CubeF4 |
| 17 | +BENCHPOD_API_KEY=eci_... pytest selftest-stm32/tests -v \ |
| 18 | + --benchpod-connection=embeddedci:<device-name> \ |
| 19 | + --benchpod-firmware=selftest-stm32/build/selftest.elf |
| 20 | +``` |
23 | 21 |
|
24 | | -1. **Register the device** from the machine wired to the pod: |
25 | | - ```bash |
26 | | - benchpod register --connection <pod-ip> |
27 | | - ``` |
28 | | - then rename it to `benchpod-v1.0.0` on the **BenchPod** page in the EmbeddedCI web app |
29 | | - (names are URL-safe and unique per org). |
30 | | -2. **Trust this repo**: BenchPod → **GitHub Actions** → add `OWNER/REPO` (click *Look up* to fill |
31 | | - the numeric ids) and allow it to drive **benchpod-v1.0.0** (Any device, or this specific one). |
| 22 | +To run this from GitHub Actions instead, see [`scenario-sensors-stm32`](../scenario-sensors-stm32) |
| 23 | +and its workflow: it authenticates with the job's GitHub OIDC token, so no secret is stored. |
32 | 24 |
|
33 | 25 | ## Run it locally (against a pod on your LAN) |
34 | 26 |
|
|
0 commit comments