mohitmishra786/low-level-dev-skills/interrupts-and-exceptions-baremetal
Claude Code and agent skill by mohitmishra786/low-level-dev-skills
- community
Checking that the SKILL.md file is still in the repository.
Bare-metal interrupt and exception skill for Cortex-M NVIC. Use when writing ISRs, configuring priorities, handling HardFault, or measuring interrupt latency. Activates on queries about NVIC, ISR, vector table, HardFault, tail-chaining, or interrupt priority.
Install
npx vskill@latest install mohitmishra786/low-level-dev-skills/interrupts-and-exceptions-baremetalSKILL.md
Interrupts and Exceptions (Bare-Metal)
Purpose
Guide agents through bare-metal interrupt handling on ARM Cortex-M: NVIC configuration, ISR writing rules, exception handlers (HardFault, BusFault), priority grouping, nesting, tail-chaining, and latency considerations.
When to Use
- Configuring peripheral IRQ priorities
- Writing ISRs that must not block
- Debugging HardFault after enabling interrupts
- Sharing data between ISR and main loop
- Optimizing interrupt latency
Workflow
1. NVIC overview (Cortex-M)
2. Enable and prioritize an IRQ
Priority: lower numeric value = higher urgency (on most Cortex-M implementations). Check vendor docs for grouping bits.
3. ISR template
ISR rules:
- No blocking calls (
printf,malloc, long loops) - Minimize work — defer to main via flag/ring buffer
- Clear interrupt flags per datasheet (read-to-clear vs write-1-clear)
4. Critical sections
Or raise BASEPRI to mask lower-priority IRQs only.
5. HardFault handler
Decode CFSR/HFSR registers for fault cause:
6. Latency and tail-chaining
| Factor | Impact | |
|---|---|---|
| Higher priority IRQ | Preempts lower | |
| Tail-chaining | Back-to-back IRQs skip unstack/restack | |
| FPU context | Lazy stacking adds latency on M4F/M7 | |
| Long ISRs | Starves other IRQs and main |
Measure with GPIO toggle + scope, or DWT cycle counter (DWT->CYCCNT).
7. Agent usage examples
Common Problems
| Symptom | Cause | Fix | |
|---|---|---|---|
| IRQ never fires | NVIC not enabled or IRQ masked | NVIC_EnableIRQ; check PRIMASK | |
| Spurious re-entry | Flag not cleared | Clear per RM (ORE needs DR read) | |
| HardFault in ISR | Stack overflow | Increase _estack; check ISR stack | |
| Lost bytes | ISR too slow | Ring buffer + higher IRQ priority | |
| Priority inversion | Long critical section | Shorten __disable_irq window |
Related Skills
skills/baremetal/baremetal-startup— vector table entriesskills/baremetal/uart-serial-baremetal— UART IRQ handlersskills/embedded/openocd-jtag— GDB breakpoint in ISRskills/debuggers/gdb— examine fault stack frameskills/low-level-programming/assembly-arm— fault handler asm
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/baremetal/interrupts-and-exceptions-baremetal/SKILL.md
Popularity
- Repository stars
- 237
- Repository forks
- 28
- 7-day trend score
- 27
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/mohitmishra786/low-level-dev-skills/interrupts-and-exceptions-baremetal)