Skip to main content

Crate m5stack_core

Crate m5stack_core 

Source
Expand description

Board support crate for the M5Stack Fire27 (ESP32) and CoreS3 (ESP32-S3).

Provides chip-agnostic peripheral drivers (driver), a shared async I2C bus and reusable embassy-based IO task loops (io), and board bring-up helpers (board).

The crate also owns the board/chip boilerplate a binary would otherwise hand-roll, so a consumer’s main collapses to a thin entry shell:

  • mem::init_heap — the global heap (esp-alloc DRAM regions + HIL-proven per-board sizes; heap feature, implied by psram).
  • io::console::install — one-call logging over the chip’s native transport (UART0 / USB-Serial-JTAG CDC) + an RTC panic breadcrumb (io::console::take_panic_breadcrumb) + (app-desc feature) the firmware identity, logged once as the very first BSP-emitted line.
  • the panic-handler feature exports the #[panic_handler], and app_desc! the esp-idf app descriptor (app-desc feature, implied by heap) — plus app_elf_sha256, and, under identity, an enforced build-time git identity in app_desc!()’s version field (see the README’s “Firmware identity” section).
  • board::run_app_core — the second-core harness (multicore feature).
  • io::input_caps — the board’s input model (keypad vs pointer), so a UI installs the matching indev without hardcoding the board.

Exactly one board feature must be enabled: fire27 (xtensa-esp32) or cores3 (xtensa-esp32s3). Radio (ble/wifi/wifi-sta/coex), heap/ psram/app-desc/identity, console-serial, panic-handler, and multicore are orthogonal opt-ins. See the README for the full feature matrix and usage examples.

Modules§

board
Board-level bring-up: pin wiring ([cores3::Board]/fire27::Board), display + SD shared-bus sequences (spi2, display), and bring-up orchestration across drivers.
driver
io
mem
Global heap ownership + external PSRAM integration.

Macros§

app_desc
Emit the esp-idf application descriptor. Invoke once in the binary (not the BSP) so it captures the application’s CARGO_PKG_VERSION. Thin wrapper over esp_bootloader_esp_idf::esp_app_desc! so the binary keeps a single m5stack_core::app_desc!(); line instead of naming the bootloader crate.
must_spawn
Replaces embassy-executor’s Spawner::must_spawn, dropped in 0.10: panics on pool exhaustion with call-site context. Works for Spawner and SendSpawner.

Functions§

app_desc
Reads back the descriptor app_desc! emits.
app_elf_sha256
The ELF’s content hash, straight from the esp-idf application descriptor — the first bytes distinguish two images built from the same commit with different uncommitted edits. Unambiguous with no consumer input needed: it is a function of the linked image, computed and patched in by espflash. Requires app_desc! to have been invoked (see app_desc()).