Lainandlain f5f944bef0 feat(m1): local time display and three-button monitoring (#6)
## Summary

Two M1 firmware enhancements on the Waveshare ESP32-S3-RLCD-4.2:

**Local-time display (UTC+8, fixed offset — China has no DST).**
Internal time stays strictly
UTC (RTC chip, JSONL `utc`, console `--json` keep the `Z`-suffixed
machine format). Only
human-facing surfaces convert via the new
`board::kLocalUtcOffsetSeconds`:

- display RTC line renders `unix + 8*3600` labeled `UTC+8` (split after
the date: measured
montserrat16 widths 157px + 119px fit the 179px status column; the old
one-line layout was
  already 223px and overflowed)
- text `status` and `rtc status` show the labeled UTC+8 line and keep
both the raw unix and a
  UTC line
- `rtc set` now takes UTC+8 local time (validates the local calendar
round-trip, converts
  -8h before `set_rtc_time`); help/usage/README updated

**Three buttons.**

- KEY (GPIO18) unchanged (short <1s / long 1-3s / >=3s portal).
- BOOT (GPIO0, strapping pin — input + pull-up, runtime read only):
mirrors the KEY 30ms
debounce and release bands (short <1s, long >=1s), new
`boot_short_presses` /
  `boot_long_presses`, no portal binding.
- RST is hardwired to chip reset, so it is tracked as a persistent boot
counter: NVS
namespace `frame`, key `rst_cnt`, incremented once per boot after
`nvs_flash_init`, exposed
  as `reset_count`.
- Surfaces: display `KEY:a/b BOOT:c/d` + `RST:e` lines, console text +
`--json`
(`boot_short`, `boot_long`, `reset_count`), JSONL
`boot_short`/`boot_long` only — measured
594B worst observed line vs the 640B buffer (46B headroom, gate was
>=40B); `reset_count`
  is static per boot so it is `--json`-only.

## On-device verification (34/34 deterministic asserts PASS + user
assist)

Evidence:
`.omo/evidence/m1wp/tz-buttons-finish-m1-wifi-provisioning.log`

- Build 0 warnings; clang-format 18.1.8 clean on whole `main/`.
- `rtc status`/text status UTC+8 lines match host `date` +8h (<=3s
skew); `rtc set` with a
  UTC+8 local time round-trips (`1788157541 = 14:25:41 local - 8h`).
- JSONL `utc` unchanged UTC-with-Z, crc32c intact, max line 594B < 640.
- KEY short press: +1 with BOOT unchanged (user-assisted). BOOT short:
+2 (user-assisted).
BOOT long: not physically exercised this session — code path is the
device-proven KEY band
logic (same constants); noted in `.omo/notepads` for the next bench
session.
- RST/reset_count: host RTS-pulse reboot 3->4 with boot banner; `--json`
agrees.
- Regressions: wifi auto-connect CONNECTED, tf_logging true, selftest
`wifi_config: ok` +
  `bad ignored`, `prov status` three-state.

Co-authored-by: ania-lain <[email protected]>
2026-08-31 14:39:04 +08:00

Frame

CI Nightly CodeQL

Draft / PoC: the v4.2 architecture and hardware gates are not signed off. Green cloud CI does not mean M1, PoC-A through PoC-E, power-cut durability, or production security has passed.

Frame is an ESP32-S3 firmware project exploring an embedded plugin architecture. The repository contains the product firmware skeleton, isolated architecture proofs of concept, host-side contract tests, and repository validation tools.

The firmware currently targets the Waveshare ESP32-S3-RLCD-4.2 (N16R8) with ESP-IDF v6.0.2 and requires a toolchain that provides C++26 mode. The custom 16 MiB flash layout contains two OTA slots, core-dump storage, encrypted NVS, internal plugin storage, and system storage. Signed plugin resources live on a dedicated FAT32 TF card; dynamic plugins do not start without it.

Repository Layout

  • main/ contains the firmware entry point.
  • components/ contains product firmware components.
  • poc/ contains isolated architecture proofs of concept and host contract tests.
  • plugins/ is reserved for plugin build inputs; installed code is content-addressed at runtime.
  • tools/frame_tools/ contains local repository gate commands.

Firmware Build

Install CMake 3.25 or newer and Ninja, then export an ESP-IDF checkout at the exact v6.0.2 tag. The checked-in presets target esp32s3 and keep generated configuration under .build/.

. "$IDF_PATH/export.sh"
cmake --preset dev
cmake --build --preset dev

Use the production defaults with:

. "$IDF_PATH/export.sh"
cmake --preset prod
cmake --build --preset prod

Production builds are build artifacts, not release attestations. Hardware validation and signing remain separate release concerns.

Host Tests

The host project is a plain CMake/CTest suite. It does not build ESP32 firmware.

cmake -S poc/host -B .build/poc-host -DENABLE_SANITIZERS=ON
cmake --build .build/poc-host
ctest --test-dir .build/poc-host --output-on-failure

Repository Gates

Python 3.11 or newer and uv are required.

uv sync --frozen
uv run ruff format --check tools tests
uv run ruff check tools tests
uv run pyright
uv run pytest
uv run frame-partitions
uv run frame-evidence
uv run frame-doc-links
uv run frame-sbom --output .build/reports/sbom.cdx.json

CI also runs an independent ThreadSanitizer build and enforces at least 90% LLVM branch coverage for the shared ABI, handle, and lifecycle contract headers.

Evidence manifests placed in poc/evidence/ are validated against the existing poc/evidence/schema.json. The schema itself is always checked, including when no manifests have been collected yet.

Contributing And Security

Read CONTRIBUTING.md before submitting a change. Report security issues through GitHub private vulnerability reporting as described in SECURITY.md. Community participation is governed by CODE_OF_CONDUCT.md.

License

Except where a file or third-party component states otherwise, this project is licensed under the GNU General Public License, version 3 or later. See LICENSE and NOTICE.

S
Description
ESP32-S3 plugin-architecture firmware research: M1 hardware-status slice, host contract tests, and gated PoCs (Waveshare ESP32-S3-RLCD-4.2)
Readme GPL-3.0
7.4 MiB
Languages
C++ 46.1%
Python 26.3%
C 18.6%
CMake 8%
Pawn 1%