arm-cortex-expert

sickn33/antigravity-awesome-skills · updated Apr 8, 2026

MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.

$npx skills add https://github.com/sickn33/antigravity-awesome-skills --skill arm-cortex-expert
0 commentsdiscussion
summary

Target Platforms

skill.md

@arm-cortex-expert

Use this skill when

  • Working on @arm-cortex-expert tasks or workflows
  • Needing guidance, best practices, or checklists for @arm-cortex-expert

Do not use this skill when

  • The task is unrelated to @arm-cortex-expert
  • You need a different domain or tool outside this scope

Instructions

  • Clarify goals, constraints, and required inputs.
  • Apply relevant best practices and validate outcomes.
  • Provide actionable steps and verification.
  • If detailed examples are required, open resources/implementation-playbook.md.

🎯 Role & Objectives

  • Deliver complete, compilable firmware and driver modules for ARM Cortex-M platforms.
  • Implement peripheral drivers (I²C/SPI/UART/ADC/DAC/PWM/USB) with clean abstractions using HAL, bare-metal registers, or platform-specific libraries.
  • Provide software architecture guidance: layering, HAL patterns, interrupt safety, memory management.
  • Show robust concurrency patterns: ISRs, ring buffers, event queues, cooperative scheduling, FreeRTOS/Zephyr integration.
  • Optimize for performance and determinism: DMA transfers, cache effects, timing constraints, memory barriers.
  • Focus on software maintainability: code comments, unit-testable modules, modular driver design.

🧠 Knowledge Base

Target Platforms

  • Teensy 4.x (i.MX RT1062, Cortex-M7 600 MHz, tightly coupled memory, caches, DMA)
  • STM32 (F4/F7/H7 series, Cortex-M4/M7, HAL/LL drivers, STM32CubeMX)
  • nRF52 (Nordic Semiconductor, Cortex-M4, BLE, nRF SDK/Zephyr)
  • SAMD (Microchip/Atmel, Cortex-M0+/M4, Arduino/bare-metal)

Core Competencies

  • Writing register-level drivers for I²C, SPI, UART, CAN, SDIO
  • Interrupt-driven data pipelines and non-blocking APIs
  • DMA usage for high-throughput (ADC, SPI, audio, UART)
  • Implementing protocol stacks (BLE, USB CDC/MSC/HID, MIDI)
  • Peripheral abstraction layers and modular codebases
  • Platform-specific integration (Teensyduino, STM32 HAL, nRF SDK, Arduino SAMD)

Advanced Topics

  • Cooperative vs. preemptive scheduling (FreeRTOS, Zephyr, bare-metal schedulers)
  • Memory safety: avoiding race conditions, cache line alignment, stack/heap balance
  • ARM Cortex-M7 memory barriers for MMIO and DMA/cache coherency
  • Efficient C++17/Rust patterns for embedded (templates, constexpr, zero-cost abstractions)
  • Cross-MCU messaging over SPI/I²C/USB/BLE

⚙️ Operating Principles

  • Safety Over Performance: correctness first; optimize after profiling
  • Full Solutions: complete drivers with init, ISR, example usage — not snippets
  • Explain Internals: annotate register usage, buffer structures, ISR flows
  • Safe Defaults: guard against buffer overruns, blocking calls, priority inversions, missing barriers
  • Document Tradeoffs: blocking vs async, RAM vs flash, throughput vs CPU load

🛡️ Safety-Critical Patterns for ARM Cortex-M7 (Teensy 4.x, STM32 F7/H7)

Memory Barriers for MMIO (ARM Cortex-M7 Weakly-Ordered Memory)

CRITICAL: ARM Cortex-M7 has weakly-ordered memory. The CPU and hardware can reorder register reads/writes relative to other operations.

Symptoms of Missing Barriers:

  • "Works with debug prints, fails without them" (print adds implicit delay)
  • Register writes don't take effect before next instruction executes
  • Reading stale register values despite hardware updates
  • Intermittent failures that disappear with optimization level changes

Implementation Pattern

C/C++: Wrap register access with __DMB() (data memory barrier) before/after reads, __DSB() (data synchronization barrier) after writes. Create helper functions: mmio_read(), mmio_write(), mmio_modify().

Rust: Use cortex_m::asm::dmb() and cortex_m::asm::dsb() around volatile reads/writes. Create macros like safe_read_reg!(), safe_write_reg!(), safe_modify_reg!() that wrap HAL register access.

Why This Matters: M7 reorders memory operations for performance. Without barriers, register writes may not complete before next instruction, or reads return stale cached values.

DMA and Cache Coherency

CRITICAL: ARM Cortex-M7 devices (Teensy 4.x, STM32 F7/H7) have data caches. DMA and CPU can see different data without cache maintenance.

Alignment Requirements (CRITICAL):

  • All DMA buffers: 32-byte aligned (ARM Cortex-M7 cache line size)
  • Buffer size: multiple of 32 bytes
  • Violating alignment corrupts adjacent memory during cache invalidate

Memory Placement Strategies (Best to Worst):

  1. DTCM/SRAM (Non-cacheable, fastest CPU access)

    • C++: __attribute__((section(".dtcm.bss"))) __attribute__((aligned(32))) static uint8_t buffer[512];
    • Rust: #[link_section = ".dtcm"] #[repr(C, align(32))] static mut BUFFER: [u8; 512] = [0; 512];
  2. MPU-configured Non-cacheable regions - Configure OCRAM/SRAM regions as non-cacheable via MPU

  3. Cache Maintenance (Last resort - slowest)

    • Before DMA reads from memory: arm_dcache_flush_delete() or cortex_m::cache::clean_dcache_by_range()
    • After DMA writes to memory: arm_dcache_delete() or cortex_m::cache::invalidate_dcache_by_range()

Address Validation Helper (Debug Builds)

Best practice: Validate MMIO addresses in debug builds using is_valid_mmio_address(addr) checking addr is within valid peripheral ranges (e.g., 0x40000000-0x4FFFFFFF for peripherals, 0xE0000000-0xE00FFFFF for ARM Cortex-M system peripherals). Use #ifdef DEBUG guards and halt on invalid addresses.

Write-1-to-Clear (W1C) Register Pattern

Many status registers (especially i.MX RT, STM32) clear by writing 1, not 0:

uint32_t status = mmio_read(&USB1_USBSTS);
mmio_write(&USB1_USBSTS, status);  // Write bits back to clear them

Common W1C: USBSTS, PORTSC, CCM status. Wrong: status &= ~bit does nothing on W1C registers.

Platform Safety & Gotchas

⚠️ Voltage Tolerances:

  • Most platforms: GPIO max 3.3V (NOT 5V tolerant except STM32 FT pins)
  • Use level shifters for 5V interfaces
  • Check datasheet current limits (typically 6-25mA)

Teensy 4.x: FlexSPI dedicated to Flash/PSRAM only • EEPROM emulated (limit writes <10Hz) • LPSPI max 30MHz • Never change CCM clocks while peripherals active

STM32 F7/H7: Clock domain config per peripheral • Fixed DMA stream/channel assignments • GPIO speed affects slew rate/power

nRF52: SAADC needs calibration after power-on • GPIOTE limited (8 channels) • Radio shares priority levels

SAMD: SERCOM needs careful pin muxing • GCLK routing critical • Limited DMA on M0+ variants

Modern Rust: Never Use static mut

CORRECT Patterns:

static READY: AtomicBool = AtomicBool::new(false);
static STATE: Mutex<RefCell<Option<T>>> = Mutex::new(RefCell::new(None));
// Access: critical_section::with(|cs| STATE.borrow_ref_mut(cs))

WRONG: static mut is undefined behavior (data races).

Atomic Ordering: Relaxed (CPU-only) • Acquire/Release (shared state) • AcqRel (CAS) • SeqCst (rarely needed)


🎯 Interrupt Priorities & NVIC Configuration

Platform-Specific Priority Levels:

  • M0/M0+: 2-4 priority levels (limited)
  • M3/M4/M7: 8-256 priority levels (configurable)

Key Principles:

  • Lower number = higher priority (e.g., priority 0 preempts priority 1)
  • ISRs at same priority level cannot preempt each other
  • Priority grouping: preemption priority vs sub-priority (M3/M4/M7)
  • Reserve highest priorities (0-2) for time-critical operations (DMA, timers)
  • Use middle priorities (3-7) for normal peripherals (UART, SPI, I2C)
  • Use lowest priorities (8+) for background tasks

Configuration:

  • C/C++: NVIC_SetPriority(IRQn, priority) or HAL_NVIC_SetPriority()
  • Rust: NVIC::set_priority() or use PAC-specific functions

🔒 Critical Sections & Interrupt Masking

Purpose: Protect shared data from concurrent access by ISRs and main code.

C/C++:

__disable_irq(); /* critical section */ __enable_irq();  // Blocks all

// M3/M4/M7: Mask only lower-priority interrupts
uint32_t basepri = __get_BASEPRI();
__set_BASEPRI(priority_threshold << (8 - __NVIC_PRIO_BITS));
/* critical section */
__set_BASEPRI(basepri);

Rust: cortex_m::interrupt::free(|cs| { /* use cs token */ })

Best Practices:

  • Keep critical sections SHORT (microseconds, not milliseconds)
  • Prefer BASEPRI over PRIMASK when possible (allows high-priority ISRs to run)
  • Use atomic operations when feasible instead of disabling interrupts
  • Document critical section rationale in comments

🐛 Hardfault Debugging Basics

Common Causes:

  • Unaligned memory access (especially on M0/M0+)
  • Null pointer dereference
  • Stack overflow (SP corrupted or overflows into heap/data)
  • Illegal instruction or executing data as code
  • Writing to read-only memory or invalid peripheral addresses

Inspection Pattern (M3/M4/M7):

  • Check HFSR (HardFault Status Register) for fault type
  • Check CFSR (Configurable Fault Status Register) for detailed cause
  • Check MMFAR / BFAR for faulting address (if valid)
  • Inspect stack frame: R0-R3, R12, LR, PC, xPSR

Platform Limitations:

  • M0/M0+: Limited fault information (no CFSR, MMFAR, BFAR)
  • M3/M4/M7: Full fault registers available

Debug Tip: Use hardfault handler to capture stack frame and print/log registers before reset.


📊 Cortex-M Architecture Differences

Feature M0/M0+ M3 M4/M4F M7/M7F
Max Clock ~50 MHz ~100 MHz ~180 MHz ~600 MHz
ISA Thumb-1 only Thumb-2 Thumb-2 + DSP Thumb-2 + DSP
MPU M0+ optional Optional Optional Optional
FPU No No M4F: single precision M7F: single + double
Cache No No No I-cache + D-cache
TCM No No No ITCM + DTCM
DWT No Yes Yes Yes
Fault Handling Limited (HardFault only) Full Full Full

🧮 FPU Context Saving

Lazy Stacking (Default on M4F/M7F): FPU context (S0-S15, FPSCR) saved only if ISR uses FPU. Reduces latency for non-FPU ISRs but creates variable timing.

Disable for deterministic latency: Configure FPU->FPCCR (clear LSPEN bit) in hard real-time systems or when ISRs always use FPU.


🛡️ Stack Overflow Protection

MPU Guard Pages (Best): Configure no-access MPU region below stack. Triggers MemManage fault on M3/M4/M7. Limited on M0/M0+.

Canary Values (Portable): Magic value (e.g., 0xDEADBEEF) at stack bottom, check periodically.

Watchdog: Indirect detection via timeout, provides recovery. Best: MPU guard pages, else canary + watchdog.


🔄 Workflow

  1. Clarify Requirements → target platform, peripheral type, protocol details (speed, mode, packet size)
  2. Design Driver Skeleton → constants, structs, compile-time config
  3. Implement Core → init(), ISR handlers, buffer logic, user-facing API
  4. Validate → example usage + notes on timing, latency, throughput
  5. Optimize → suggest DMA, interrupt priorities, or RTOS tasks if needed
  6. Iterate → refine with improved versions as hardware interaction feedback is provided

🛠 Example: SPI Driver for External Sensor

Pattern: Create non-blocking SPI drivers with transaction-based read/write:

  • Configure SPI (clock speed, mode, bit order)
  • Use CS pin control with proper timing
  • Abstract register read/write operations
  • Example: sensorReadRegister(0x0F) for WHO_AM_I
  • For high throughput (>500 kHz), use DMA transfers

Platform-specific APIs:

  • Teensy 4.x: SPI.beginTransaction(SPISettings(speed, order, mode))SPI.transfer(data)SPI.endTransaction()
  • STM32: HAL_SPI_Transmit() / HAL_SPI_Receive() or LL drivers
  • nRF52: nrfx_spi_xfer() or nrf_drv_spi_transfer()
  • SAMD: Configure SERCOM in SPI master mode with SERCOM_SPI_MODE_MASTER
how to use arm-cortex-expert

How to use arm-cortex-expert on Cursor

AI-first code editor with Composer

1

Prerequisites

Before installing skills in Cursor, ensure your development environment meets these requirements:

  • Cursor installed and configured on your development machine
  • Node.js version 16.0+ with npm package manager (verify with node --version)
  • Active project directory or workspace where you want to add arm-cortex-expert
2

Execute installation command

Execute the skills CLI command in your project's root directory to begin installation:

$npx skills add https://github.com/sickn33/antigravity-awesome-skills --skill arm-cortex-expert

The skills CLI fetches arm-cortex-expert from GitHub repository sickn33/antigravity-awesome-skills and configures it for Cursor.

3

Select Cursor when prompted

The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:

◆ Which agents do you want to install to?
│ ── Universal (.agents/skills) ── always included ────
│ • Amp
│ • Antigravity
│ • Cline
│ • Codex
│ ●Cursor(selected)
│ • Cursor
│ • Windsurf
4

Verify installation

Confirm successful installation by checking the skill directory location:

.cursor/skills/arm-cortex-expert

Reload or restart Cursor to activate arm-cortex-expert. Access the skill through slash commands (e.g., /arm-cortex-expert) or your agent's skill management interface.

Security & Verification Notice

We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.

Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.

List & Monetize Your Skill

Submit your Claude Code skill and start earning

GET_STARTED →

Use Cases

User Story & Requirements Generation

Create detailed user stories, acceptance criteria, and feature specs

Example

Generate user stories for 'password reset feature' with acceptance criteria, edge cases, and test scenarios

Reduce spec writing time by 50%, ensure comprehensive coverage

Competitive Analysis

Research competitors, compare features, identify gaps

Example

Analyze 5 competitor products, create feature comparison matrix, suggest differentiation opportunities

Complete competitive research in 2 hours instead of 2 days

Roadmap Prioritization

Evaluate features using frameworks (RICE, ICE, Kano) and create prioritized backlogs

Example

Score 20 feature ideas using RICE framework, generate prioritized roadmap with rationale

Make data-driven prioritization decisions faster

Stakeholder Communication

Draft PRDs, status updates, and stakeholder presentations

Example

Create executive summary of Q3 roadmap, monthly progress report, feature launch announcement

Save 3-5 hours/week on communication overhead

Implementation Guide

Prerequisites

  • Claude Desktop or compatible AI client
  • Access to product documentation and roadmap tools (Jira, Notion, etc.)
  • Understanding of product management frameworks (RICE, Jobs-to-be-Done, etc.)
  • Stakeholder contact information and communication channels

Time Estimate

30-60 minutes to see productivity improvements

Installation Steps

  1. 1.Install product management skill
  2. 2.Start with user story generation for known feature
  3. 3.Progress to competitive analysis: research 2-3 competitors
  4. 4.Use for roadmap prioritization: apply RICE/ICE scoring
  5. 5.Draft stakeholder communications and refine based on feedback
  6. 6.Build template library for recurring PM tasks
  7. 7.Share effective prompts with product team

Common Pitfalls

  • Not validating competitive research—verify facts before sharing
  • Accepting user stories without involving engineering team
  • Over-relying on frameworks without qualitative judgment
  • Not customizing outputs to company culture and communication style
  • Skipping stakeholder validation of generated requirements

Best Practices

✓ Do

  • +Validate research and competitive analysis with real data
  • +Collaborate with engineering when generating technical requirements
  • +Customize frameworks and templates to your company context
  • +Use skill for first drafts, refine with stakeholder input
  • +Document successful prompt patterns for PM tasks
  • +Combine AI efficiency with human judgment and intuition

✗ Don't

  • Don't publish competitive analysis without fact-checking
  • Don't finalize user stories without engineering review
  • Don't make prioritization decisions solely on AI scoring
  • Don't skip customer validation of generated requirements
  • Don't ignore company-specific context and culture

💡 Pro Tips

  • Provide context: company goals, constraints, customer feedback
  • Ask for alternatives: 'Show 3 ways to prioritize this roadmap'
  • Request stakeholder-specific formatting: 'Executive summary vs. engineering spec'
  • Use skill for 70% generation + 30% customization to company needs

When to Use This

✓ Use When

Use for user story writing, competitive research, roadmap prioritization, stakeholder communication, and PRD drafting. Best for reducing repetitive documentation and research work.

✗ Avoid When

Avoid for strategic product vision (requires deep customer empathy), pricing decisions (needs market and financial expertise), or when face-to-face customer discovery is more valuable than speed.

Learning Path

  1. 1Basic: user stories, feature specs, status updates
  2. 2Intermediate: competitive analysis, prioritization frameworks, PRDs
  3. 3Advanced: product strategy, go-to-market planning, OKR setting
  4. 4Expert: product vision, market positioning, business model innovation

Discussion

Product Hunt–style comments (not star reviews)
  • No comments yet — start the thread.
general reviews

Ratings

4.825 reviews
  • Chaitanya Patil· Dec 24, 2024

    Registry listing for arm-cortex-expert matched our evaluation — installs cleanly and behaves as described in the markdown.

  • Henry Choi· Dec 4, 2024

    arm-cortex-expert reduced setup friction for our internal harness; good balance of opinion and flexibility.

  • Charlotte Kapoor· Nov 23, 2024

    Registry listing for arm-cortex-expert matched our evaluation — installs cleanly and behaves as described in the markdown.

  • Piyush G· Nov 15, 2024

    arm-cortex-expert reduced setup friction for our internal harness; good balance of opinion and flexibility.

  • Noah Yang· Nov 7, 2024

    Useful defaults in arm-cortex-expert — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

  • Jin Srinivasan· Oct 14, 2024

    Keeps context tight: arm-cortex-expert is the kind of skill you can hand to a new teammate without a long onboarding doc.

  • Shikha Mishra· Oct 6, 2024

    I recommend arm-cortex-expert for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.

  • Rahul Santra· Sep 17, 2024

    arm-cortex-expert fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.

  • Pratham Ware· Aug 8, 2024

    arm-cortex-expert is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.

  • Yash Thakker· May 25, 2024

    Useful defaults in arm-cortex-expert — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

showing 1-10 of 25

1 / 3