# Construct ESP32 firmware — JSON-over-serial peripheral for host-mediated control.
#
# Flash to ESP32 and connect via serial. The host Construct sends gpio_read/gpio_write
# commands; this firmware executes them and responds.
#
# Prerequisites: espup (cargo install espup; espup install; source ~/export-esp.sh)
# Build: cargo build --release
# Flash: cargo espflash flash --monitor

[package]
name = "esp32"
version = "0.1.0"
edition = "2024"
license = "MIT OR Apache-2.0"
description = "Construct ESP32 peripheral firmware — GPIO over JSON serial"

[patch.crates-io]
# Use latest esp-rs crates to fix u8/i8 char pointer compatibility with ESP-IDF 5.x
esp-idf-sys = { git = "https://github.com/esp-rs/esp-idf-sys" }
esp-idf-hal = { git = "https://github.com/esp-rs/esp-idf-hal" }
esp-idf-svc = { git = "https://github.com/esp-rs/esp-idf-svc" }

[dependencies]
esp-idf-svc = { git = "https://github.com/esp-rs/esp-idf-svc" }
log = "0.4"
anyhow = "1.0"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"

[build-dependencies]
embuild = { version = "0.33", features = ["espidf"] }

[profile.release]
opt-level = "s"
lto = true
codegen-units = 1
strip = true
panic = "abort"

[profile.dev]
opt-level = "s"
