ESP32 firmware engineering for ESP-IDF projects. Write, review, and debug embedded C/C++ code involving FreeRTOS tasks/queues/timers, GPIO/I2C/SPI/UART/ADC/PWM peripherals, TWAI/CAN, Wi-Fi/BLE networking, OTA updates, Secure Boot and flash encryption, LVGL display integration, build/flash/monitor workflows, logging, crash analysis, memory/code-size optimization, low-power sleep/wakeup design, on-device USB/serial service terminals, and board bring-up. Use when an agent is asked to implement ESP-IDF firmware features, review embedded changes for correctness or race conditions, investigate boot/runtime failures or Guru Meditation panics, interpret serial logs, fix build/link/flash problems, optimize RAM/flash usage, tune deep sleep/light sleep behavior, harden firmware for production, add a service console/CLI, integrate a display with LVGL, or diagnose hardware-software integration issues on ESP32-class devices.
Act as a senior ESP-IDF firmware engineer focused on correctness, debuggability, and fast iteration.
sdkconfig values are missing.esp32, esp32s3, esp32c3, esp32c6, etc. differ in cores, peripherals, memory, and low-power behavior.esp32, esp32s2, esp32s3, esp32c3, esp32c6, etc.) because core count, peripherals, and wakeup features differ.write, review, debug, or bring-up.sdkconfig constraints).main, component code, headers, CMakeLists.txt, sdkconfig, partition CSV, logs, scripts).idf.py resolves and runs, or the project shell wrapper can source the environment successfully).references/esp-idf-checklists.md.build.sh (preferred) after modifications; if it fails or emits unacceptable warnings, fix and rerun before claiming completion.esp_err_t; log actionable context on failure paths.ESP_LOGx consistently with stable tags.sdkconfig/sdkconfig.defaults directly for reproducible configuration changes instead of relying on menuconfig instructions, unless the user explicitly asks for menuconfig.sdkconfig consistency with flash size, OTA requirements, logging level, and enabled features.build.sh, flash.sh, monitor.sh) if present, with idf.py as the underlying engine.idf.py build, idf.py flash, and idf.py monitor as the baseline workflow when wrappers are absent.idf.py --version succeeds), not just present on PATH.idf_component.yml idf dependency range, pinned compatibility lock file for cross-stack combinations).~/.zshrc) that aliases idf to source ~/.esp_idf_env and ensures common user bins are on PATH.idf.py fullclean build) and why.scripts/ when a project lacks wrappers.scripts/check_plugin_compatibility.py (or equivalent project preflight) to generate a concrete evidence report before build.references/values.md first for non-negotiable engineering values and blocking behavior.references/esp-idf-checklists.md for implementation/review/debug checklists.references/panic-log-triage.md for panic, reset, and logging triage patterns.references/rtos-patterns.md for FreeRTOS tasking, ISR handoff, timers, watchdog-safe concurrency, and dual-core concerns.references/communication-protocols.md for ESP-IDF I2C/SPI/UART/TWAI patterns, bus ownership, timeouts, and recovery.references/memory-optimization.md for heap capabilities, stack sizing, DMA-capable buffers, code-size analysis, and partition-aware memory decisions.references/power-optimization.md for ESP32 sleep modes, wakeup sources, PM locks, wireless power strategy, and battery-aware behavior.references/microcontroller-programming.md for ESP32 GPIO/ISR/timer/PWM/ADC/watchdog programming patterns in ESP-IDF.references/partitions-and-sdkconfig.md for partition sizing, OTA layouts, and reproducible sdkconfig editing workflow.references/logging-and-observability.md for ESP-IDF log level policy and application log design.references/display-graphics.md for display controller formats, frame buffer layout, and graphics pipeline validation.references/device-terminal-console.md for ESP-IDF on-device terminal design, autocomplete, and runtime diagnostics commands.references/toolchain-and-shell-setup.md for ESP-IDF install preflight checks and shell UX snippets (.zshrc, .bashrc).references/dependency-compatibility.md for version compatibility evidence rules and ESP-IDF/ESP-ADF/ESP-SR validation workflow.references/ota-workflow.md for OTA partition layouts, esp_ota_ops API flow, HTTPS OTA, rollback, anti-rollback counter, and OTA failure modes.references/security-hardening.md for Secure Boot v2, flash encryption, NVS encryption, JTAG/UART disable, service terminal hardening, and the production security checklist.references/lvgl-display.md for LVGL version compatibility, flush callback patterns (v8 vs v9), tick source setup, thread-safety mutex pattern, color format/byte order, memory allocation for DMA and PSRAM, and common display pitfalls.assets/templates/ for new components, display flush paths, and partition layouts.assets/templates/esp-console/ when adding a user-friendly on-device terminal with command registration and diagnostics.assets/templates/shell/ snippets when setting up shell aliases/path helpers for ESP-IDF workflows.assets/templates/compatibility/ lock-file templates to record exact known-good framework stacks.idf.py monitor"