embedded-firmware
Use when an org role acts as embedded firmware engineer and must ship reliable ESP32, STM32, nRF or Zephyr firmware under FreeRTOS memory and ISR constraints. For hands-on drivers, RTOS and power work with reference files use embedded-systems.
- License 许可
- Apache-2.0
- 所属仓库
- monoes/monomind
- 最近更新
- 2026-11-10
- Stars
- ★ 23
- Forks
- 2
01 前言 Front Matter
- name
- embedded-firmware
- tags
- [ "devops", "embedded", "reliability" ]
- tools
- []
- source
- https://github.com/monoes/monomind
- license
- Apache-2.0
- description
- Use when an org role acts as embedded firmware engineer and must ship reliable ESP32, STM32, nRF or Zephyr firmware under FreeRTOS memory and ISR constraints. For hands-on drivers, RTOS and power work with reference files use embedded-systems.
03 SKILL.md 正文
Embedded Firmware — Best Practices
Focus
Writes production-grade firmware for resource-constrained embedded systems (ESP32/ESP-IDF, STM32 HAL/LL, Nordic nRF/Zephyr, FreeRTOS) where hardware constraints and undefined behavior carry real consequences.
Best practices
- Avoid dynamic allocation in RTOS tasks after init — use static allocation or memory pools; heap fragmentation on constrained devices causes unpredictable failures.
- Always check return values from HAL/SDK calls (
esp_err_t, HAL status codes) — a silently ignored error is a silent field failure. - Calculate stack sizes, don't guess — verify with
uxTaskGetStackHighWaterMark()or equivalent under real load, not just at boot. - Keep ISRs minimal — defer work to tasks via queues/semaphores; never call blocking APIs from interrupt context.
- Use
FromISRAPI variants inside interrupt handlers, and never poll from an ISR on timing-critical platforms. - Pin toolchain and library versions in build config (
platformio.ini,west.yml) — never track@latestin anything shipping to production. - Test every error path with fault injection, not just the happy path — the failures that matter are the ones nobody exercises in normal testing.
Common pitfalls
- Using
malloc/newfreely in long-running tasks, causing heap fragmentation that only manifests after hours or days of uptime. - Guessing stack sizes instead of measuring high-water marks, leading to intermittent stack overflow crashes.
- Doing real work inside an ISR (I2C/SPI transactions, logging, heavy computation) instead of deferring to a task.
- Hardcoding peripheral addresses or pin assignments instead of using devicetree/Kconfig or board-specific config layers.
Tools & techniques
- JTAG/SWD debugging and crash-dump analysis (
idf.py coredump-info, STM32 SWV/ITM trace) for post-mortem root cause. - FreeRTOS runtime stats / task trace (SystemView) to catch priority inversion and starvation before they hit production.
- Logic analyzer / oscilloscope captures to verify timing-critical peripheral transactions against datasheet specs.
- OTA update paths with rollback (
esp_ota_ops.h, MCUboot) designed and tested before first field deployment, not after.
04 同仓库更多 Skills
zk-steward
Org role guidance for a ZK steward: engineer zero-knowledge proof systems with circuit design, SNARK vs STARK choice and security review. This is zero-knowledge cryptography, not Zettelkasten note-taking.
writing-plans
Use when you have a spec or requirements for a multi-step coding task and must write an implementation plan before touching code. Produces bite-sized TDD tasks with exact file paths, code and commands for an engineer with zero context.
write-spec
Write a feature spec or PRD from a problem statement or feature idea. Use when turning a vague idea or user request into a structured document, scoping a feature with goals and non-goals, defining success metrics and acceptance criteria, or breaking a big ask into a phased spec.
write-query
Write optimized SQL for your dialect with best practices. Use when translating a natural-language data need into SQL, building a multi-CTE query with joins and aggregations, optimizing a query against a large partitioned table, or getting dialect-specific syntax for Snowflake, BigQuery, Postgres, etc.
workflow-automation
Org role guidance for workflow automation: build and maintain CI/CD definitions in GitHub Actions or equivalent: triggers, jobs, matrices, caching. Covers path filters, dependency caching, parallel jobs, timeouts and fail-fast ordering.
workflow-architect
Org role guidance for a workflow architect: map full workflow trees for systems, user journeys and agents, covering every branch and failure. Covers discovering workflows from code, handoff contracts, timeouts, recovery paths and observable state.