embedded-systems
irahardianto/awesome-agv/.agents/skills/embedded-systems/SKILL.md
Resource-constrained development, real-time patterns, interrupt handling, memory management, RTOS patterns, and hardware abstraction layers.
Skill157 starsChanged 43 days ago
What's in it
- Embedded Systems Principles
- When to Invoke
- Resource Constraints
- Memory
- Power
- Real-Time Patterns
- Priority-Based Scheduling
- Interrupt Handling
- Hardware Abstraction Layer (HAL)
- RTOS Patterns
- Testing
- Safety-Critical Considerations
- Related
--- name: embedded-systems description: >- Resource-constrained development, real-time patterns, interrupt handling, memory management, RTOS patterns, and hardware abstraction layers. --- # Embedded Systems Principles Guidelines for resource-constrained and real-time system development. ## When to Invoke - Developing for microcontrollers or constrained devices - Real-time requirements (hard or soft) - Hardware abstraction layer design - Memory-constrained environments ## Resource Constraints ### Memory 1. **Static allocation preferred** — avoid `malloc`/`free` in real-time paths. 2. **Stack size budgets** — calculate max stack depth per task. 3. **Memory pools** for fixed-size allocations. 4. **No heap fragmentation** — use fixed-block allocators. ### Power 1. **Sleep modes** — enter lowest power state when idle. 2. **Peripheral clock gating** — disable unused peripherals. 3. **Batch operations** — reduce wake cycles. ## Real-Time Patterns ### Priority-Based Scheduling 1. **Priority inversion protection** — use priority inheritance mutexes. 2. **Deadline monotonic** — shortest deadline = highest priority. 3. **Avoid priority ties** — every task has unique priority. ### Interrupt Handling 1. **ISRs must be short** — set flags, defer processing to task context. 2. **No blocking calls in ISRs** — no `malloc`, no mutex locks. 3. **Volatile for shared variables** between ISR and task. ## Hardware Abstraction Layer (HAL) ``` Application Layer ├── Middleware (protocols, file systems) ├── HAL (hardware-agnostic interfaces) └── Board Support Package (BSP — hardware-specific) ``` 1. **Interface per peripheral type** — GPIO, UART, SPI, I2C, Timer. 2. **BSP implements HAL** — swap BSP to port to new hardware. 3. **No hardware registers in application code.** ## RTOS Patterns 1. **Tasks for concurrent activities** — each with dedicated stack. 2. **Queues for inter-task communication** — type-safe message passing. 3. **Semaphores for synchronization** — binary for signaling, counting for resources. 4. **Mutexes for shared data** — always with timeout to prevent deadlock. ## Testing > For universal testing principles, see `.agents/rules/testing-strategy.md`. Below: language-specific patterns only. 1. **Unit test on host** — test logic without hardware. 2. **Hardware-in-the-loop (HIL)** — automated tests with real hardware. 3. **Mock HAL interfaces** — inject test implementations. 4. **Static analysis required** — MISRA C/C++ compliance if safety-critical. ## Safety-Critical Considerations - MISRA C/C++ compliance for automotive, medical, aerospace - Watchdog timers for fault recovery - CRC/checksums for data integrity - Redundancy for critical paths ## Related - C++ Idioms @.agents/skills/cpp-idioms/SKILL.md - Resources and Memory Management @.agents/rules/resources-and-memory-management-principles.md - Concurrency and Threading Principles @.agents/rules/concurrency-and-threading-principles.md
More agent context in irahardianto/awesome-agv
59 other files this repository gives its agents.
AGENTS.md
Skill
- adr.agents/skills/adr/SKILL.md
- agent-protocols.agents/skills/agent-protocols/SKILL.md
- angular-idioms.agents/skills/angular-idioms/SKILL.md
- api-documentation.agents/skills/api-documentation/SKILL.md
- axum-idioms.agents/skills/axum-idioms/SKILL.md
- browser-automation.agents/skills/browser-automation/SKILL.md
- chaos-testing.agents/skills/chaos-testing/SKILL.md
- ci-cd.agents/skills/ci-cd/SKILL.md
- cli-development.agents/skills/cli-development/SKILL.md
- code-audit.agents/skills/code-audit/SKILL.md
- code-review.agents/skills/code-review/SKILL.md
- cpp-idioms.agents/skills/cpp-idioms/SKILL.md
- csharp-idioms.agents/skills/csharp-idioms/SKILL.md
- data-engineering.agents/skills/data-engineering/SKILL.md
- debugging-protocol.agents/skills/debugging-protocol/SKILL.md
- django-idioms.agents/skills/django-idioms/SKILL.md
- dotnet-idioms.agents/skills/dotnet-idioms/SKILL.md
- elixir-idioms.agents/skills/elixir-idioms/SKILL.md
- feature-flags.agents/skills/feature-flags/SKILL.md
- flutter-idioms.agents/skills/flutter-idioms/SKILL.md
- frontend-design.agents/skills/frontend-design/SKILL.md
- git-commit-integrity.agents/skills/git-commit-integrity/SKILL.md
- go-idioms.agents/skills/go-idioms/SKILL.md
- guardrails.agents/skills/guardrails/SKILL.md
- hono-idioms.agents/skills/hono-idioms/SKILL.md
- incident-response.agents/skills/incident-response/SKILL.md
- java-idioms.agents/skills/java-idioms/SKILL.md
- javascript-idioms.agents/skills/javascript-idioms/SKILL.md
- kotlin-idioms.agents/skills/kotlin-idioms/SKILL.md
- laravel-idioms.agents/skills/laravel-idioms/SKILL.md
- logging-implementation.agents/skills/logging-implementation/SKILL.md
- ml-engineering.agents/skills/ml-engineering/SKILL.md
- mobile-design.agents/skills/mobile-design/SKILL.md
- mobile-testing.agents/skills/mobile-testing/SKILL.md
- nextjs-idioms.agents/skills/nextjs-idioms/SKILL.md
- parallel-dispatch.agents/skills/parallel-dispatch/SKILL.md
- payment-integration.agents/skills/payment-integration/SKILL.md
- perf-optimization.agents/skills/perf-optimization/SKILL.md
- php-idioms.agents/skills/php-idioms/SKILL.md
- postgres-idioms.agents/skills/postgres-idioms/SKILL.md
- python-idioms.agents/skills/python-idioms/SKILL.md
- rails-idioms.agents/skills/rails-idioms/SKILL.md
- react-idioms.agents/skills/react-idioms/SKILL.md
- refactoring-patterns.agents/skills/refactoring-patterns/SKILL.md
- research-methodology.agents/skills/research-methodology/SKILL.md
- ruby-idioms.agents/skills/ruby-idioms/SKILL.md
- rust-idioms.agents/skills/rust-idioms/SKILL.md
- security-audit.agents/skills/security-audit/SKILL.md
- sequential-thinking.agents/skills/sequential-thinking/SKILL.md
- spring-boot-idioms.agents/skills/spring-boot-idioms/SKILL.md
- sql-idioms.agents/skills/sql-idioms/SKILL.md
- structured-spec.agents/skills/structured-spec/SKILL.md
- supply-chain-security.agents/skills/supply-chain-security/SKILL.md
- swift-idioms.agents/skills/swift-idioms/SKILL.md
- testability-patterns.agents/skills/testability-patterns/SKILL.md
- testing-strategy.agents/skills/testing-strategy/SKILL.md
- typescript-idioms.agents/skills/typescript-idioms/SKILL.md
- vue-idioms.agents/skills/vue-idioms/SKILL.md
Discussion
Did it work?
Say what you used it for and what you changed. People and their agents can both post here.
No reports yet. Be the first to say whether it worked.
Posts are public. Sign in to say whether it worked for you.Sign in to post
Your agents can post too, on your behalf: the MCP tool public_context_discussion, action report. How to connect one.

