1
0
Fork 0
mirror of https://github.com/imjasonh/esp32 synced 2026-07-06 23:52:24 +00:00
No description
Find a file
Jason Hall f94f0f9f8a Add Dependabot config: weekly grouped updates for GHA + Cargo deps
Three ecosystems: GitHub Actions (workflow files), firmware Cargo
deps (root), publisher Cargo deps (tools/publisher). Each ecosystem
groups all updates into a single weekly PR.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 14:41:15 -04:00
.cargo initial commit 2026-05-02 11:43:41 -04:00
.github Add Dependabot config: weekly grouped updates for GHA + Cargo deps 2026-05-02 14:41:15 -04:00
src Auto-publish from GHA on push to main; sign by immutable digest 2026-05-02 13:58:44 -04:00
tools/publisher CI: pin setup-uv to v7 (no v8 moving tag), add publisher rust-toolchain 2026-05-02 14:22:34 -04:00
trust Add cosign signature verification (OTA phase 4a) 2026-05-02 13:50:03 -04:00
.gitignore Add CI workflow, bump GHA actions, refresh + commit Cargo.lock 2026-05-02 14:16:55 -04:00
build.rs Add device-side OTA loop (OTA phase 2) 2026-05-02 12:53:19 -04:00
Cargo.lock Add CI workflow, bump GHA actions, refresh + commit Cargo.lock 2026-05-02 14:16:55 -04:00
Cargo.toml Add cosign signature verification (OTA phase 4a) 2026-05-02 13:50:03 -04:00
eink-plan.md initial commit 2026-05-02 11:43:41 -04:00
LICENSE Initial commit 2026-05-02 11:43:06 -04:00
Makefile Auto-publish from GHA on push to main; sign by immutable digest 2026-05-02 13:58:44 -04:00
notes.txt Switch to OTA partition layout and document Wi-Fi + HTTPS demo 2026-05-02 12:14:21 -04:00
ota-plan.md Mark phase 4a done in ota-plan.md 2026-05-02 13:50:49 -04:00
partitions.csv Add cosign signature verification (OTA phase 4a) 2026-05-02 13:50:03 -04:00
README.md Add OCI artifact publisher (OTA phase 1) 2026-05-02 12:29:51 -04:00
rust-toolchain.toml initial commit 2026-05-02 11:43:41 -04:00
sdkconfig.defaults.in Add device-side OTA loop (OTA phase 2) 2026-05-02 12:53:19 -04:00

ESP32 Rust

Std Rust on an Inland ESP-WROOM-32 dev board. Currently a Wi-Fi + HTTPS demo; e-ink display work coming next (see eink-plan.md).

Hardware

  • Board: Inland ESP-WROOM-32 (Micro Center SKU 027466). Connects as /dev/cu.usbserial-0001 on macOS via the onboard CP210x USB-UART.
  • No user LED: this specific board variant only has a power LED ("D1", always on). There is no software-controllable LED. For visible output, attach an external LED + ~330Ω resistor to a GPIO, or watch logs via make monitor.

Prerequisites (one-time, macOS)

# Cargo tools:
#   espup     installs the Xtensa Rust toolchain (rustc fork + LLVM + GCC)
#   espflash  flashes firmware over USB serial
#   ldproxy   linker shim used by esp-idf-sys
cargo install espup espflash ldproxy

# C build deps for the ESP-IDF SDK
brew install cmake ninja dfu-util

# Xtensa Rust toolchain + GCC + esp-clang, installed under
# ~/.rustup/toolchains/esp/. The Makefile finds them via wildcards
# so future espup updates don't require any path edits.
espup install --targets esp32

# uv (the Makefile uses it to install Python 3.12 and shim it into PATH
# so the ESP-IDF Python venv is bootstrapped against 3.12 instead of
# Apple's 3.9). Skip if you already have uv.
curl -LsSf https://astral.sh/uv/install.sh | sh

First build

make wifi.env             # creates wifi.env from template
$EDITOR wifi.env          # fill in WIFI_SSID and WIFI_PASS
make run                  # build, flash, open serial monitor

The first build clones ESP-IDF v5.2.2 into .embuild/ and bootstraps a Python venv inside it. Plan on 510 minutes. Subsequent builds are fast.

Day-to-day

make build      Compile (requires wifi.env)
make flash      Build (if needed) and flash app to PORT
make flash-all  Erase + write bootloader, partition table, and app
make monitor    Open serial monitor; Ctrl+C to exit
make run        Build + flash + monitor
make clean      cargo clean

make flash PORT=/dev/cu.usbserial-XXXX   # override the port

Use make flash-all after partition-table changes, or as the recovery path if both OTA slots end up bad and the bootloader can't auto-revert (see "USB recovery" in ota-plan.md). Day-to-day use is just make flash or make run.

Publishing firmware to GHCR (OTA, phase 1)

The firmware is packaged as an OCI artifact and pushed to ghcr.io/imjasonh/esp32. The device will pull it back down (phase 2, not yet implemented).

One-time setup:

  1. Mint a classic PAT at https://github.com/settings/tokens/new with the write:packages scope. (Fine-grained PATs don't currently expose a Packages permission for user-owned packages.)
  2. echo 'export GH_TOKEN=ghp_...' > gh.env (gitignored)
  3. After the first push, set the package's visibility to public at https://github.com/users/imjasonh/packages/container/esp32/settings — the device will pull anonymously, no token on the ESP32.

Then:

make publish      # build firmware, save .bin, push :latest and :sha-<short>

The publisher tool lives at tools/publisher/ — Rust, uses oci-distribution. It's a separate cargo project so it builds for the host, not for the ESP32.

What the firmware does

src/main.rs connects to Wi-Fi using the credentials baked in at compile time from wifi.env, then issues two HTTPS GETs and logs the responses over serial:

  • https://api.ipify.org?format=json — public IP, JSON
  • https://wttr.in/?format=3 — one-line weather for your location

Project layout

src/main.rs            firmware
Cargo.toml             deps: esp-idf-svc, embedded-svc, log, anyhow
build.rs               embuild + cargo:rerun-if-env-changed for WIFI_*
.cargo/config.toml     target, linker, runner, build-std
rust-toolchain.toml    pins the `esp` rustc toolchain
sdkconfig.defaults     ESP-IDF kconfig overrides (stack, mbedtls bundle)
Makefile               canonical build / flash / monitor entrypoint
wifi.env.example       template for compile-time Wi-Fi creds
eink-plan.md           plan for the upcoming e-ink display work
ota-plan.md            plan for OCI-artifact-based OTA updates
tools/publisher/       Rust tool that pushes firmware as an OCI artifact
notes.txt              internal design notes and issues hit during setup