cortex-r5-debug
Skill36 starsChanged 5 months agoMITView on GitHub
Use when debugging Cortex-R5 or Cortex-R firmware — TCM, MPU, caches, DFSR/DFAR aborts, exceptions, GIC/VIC interrupts, lockstep or split mode, ECC, or JTAG bring-up
In this repository75 other files it gives its agents.
- 8051-mcu-debugSkill
- avem-integrationSkill
- battery-charger-fuel-gauge-integrationSkill
- ble-gatt-integrationSkill
- bootloader-debugSkill
- canbus-integrationSkill
- canopen-integrationSkill
- cellular-at-modem-integrationSkill
- cmbacktrace-integrationSkill
- cmsis-dsp-integrationSkill
- cortex-m-debugSkill
- crc-checksum-integrationSkill
- easylogger-integrationSkill
- embedded-app-example-libsSkill
- embedded-buffer-queue-libsSkill
- embedded-data-parsing-libsSkill
- embedded-debug-entrySkill
- embedded-fault-debugSkill
- embedded-framework-libsSkill
- embedded-input-libsSkill
- embedded-library-entrySkill
- embedded-linux-login-debugSkill
- embedded-peripheral-bringupSkill
- embedded-serial-log-debugSkill
- embedded-state-machine-libsSkill
- embedded-timing-libsSkill
- epd-integrationSkill
- esp-idf-integrationSkill
- fatfs-integrationSkill
- flashdb-integrationSkill
- freemodbus-integrationSkill
- freertos-kernel-debugSkill
- freertos-plus-tcp-integrationSkill
- gnss-gps-integrationSkill
- hardware-interface-debugSkill
- heatshrink-integrationSkill
- letter-shell-integrationSkill
- littlefs-integrationSkill
- low-power-debugSkill
- lvgl-integrationSkill
- lwip-integrationSkill
- mbedtls-integrationSkill
- mcuboot-integrationSkill
- mcu-flashing-debugSkill
- micro-ecc-integrationSkill
- miniz-integrationSkill
- mqtt-embedded-integrationSkill
- nanopb-integrationSkill
- nrf-connect-sdk-integrationSkill
- nr-micro-shell-integrationSkill
- openocd-jlink-stlink-debugSkill
- openthread-integrationSkill
- ota-update-integrationSkill
- plooc-integrationSkill
- power-management-integrationSkill
- qspi-xip-flash-debugSkill
- readme-writingSkill
- riscv-mcu-debugSkill
- rtos-debugSkill
- rt-thread-integrationSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 14
Use this skill when:
- Very specific: line 20
Do not use this skill for Cortex-M microcontrollers.
- Very specific: line 38
Check the reset vector and vector base.
- Distinctive: line 52
Add multicore/safety features last.
- Distinctive: line 68
Before claiming Cortex-R5 firmware works:
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Cortex-R5 Debug
Overview
Use this skill to debug Cortex-R5 (ARMv7-R, PMSA) systems by separating core mode, boot source, memory map, exception vectors, TCM, MPU/cache policy, interrupt controller, and safety configuration. Cortex-R5 uses an MPU (not an MMU) and CP15-based control; failures usually come from memory attributes, ECC/TCM setup, or lockstep configuration rather than C code.
When To Use
Use this skill when:
- The user is bringing up or debugging Cortex-R5/R5F, Cortex-R4, or Cortex-R7 firmware (Xilinx Zynq UltraScale+ RPU, TI Hercules/Sitara, and similar).
- The issue involves early boot, Undefined/Prefetch Abort/Data Abort exceptions, IRQ/FIQ, ATCM/BTCM, MPU regions, caches, ECC/parity, lockstep, split mode, or JTAG attach.
- The platform is an SoC with real-time cores, safety islands, motor/control firmware, storage controllers, or heterogeneous Linux + R5 systems.
Do not use this skill for Cortex-M microcontrollers. Use cortex-m-debug when the target has NVIC, VTOR, and M-profile exception behavior instead of CP15/CPSR.
First Questions
Ask for:
- SoC/board, exact core, boot owner, toolchain, debugger, and whether the R5 runs bare metal or an RTOS.
- Core mode: single core, split (performance) mode, or lock-step (
DCLS); which core the debugger is attached to. - Memory map: boot ROM, flash, DDR, OCM/SRAM,
ATCM/BTCMbase and size, stacks, heaps, and linker script. - MPU/cache policy, TCM enable state (
INITRAMA/INITRAMBreset straps), ECC init, and DMA/coherency paths. - Exception symptom plus a dump of
CPSR/SPSR,DFSR/DFAR(data abort) orIFSR/IFAR(prefetch abort),LR, and disassembly aroundPC/LR.
Debug Workflow
- Prove debugger attach and reset control.
Confirm JTAG target and core selection, reset type, and halt behavior. Read
MIDRandMPIDRto confirm you are on the expected R5 core, and check whether the sibling R5 or an A-core changes state. - Verify boot entry.
Check the reset vector and vector base. Vectors sit at
0x00000000or at0xFFFF0000whenSCTLR.V(bit 13) is set. Verify per-mode banked stacks are set forSVC,IRQ,FIQ,ABT,UND, andSYSbefore C runtime init. - Stabilize memory first.
Enable and scrub
ATCM/BTCMbefore use — set the base+enable in the ATCM/BTCM Region Registers (MRC/MCR p15, 0, Rt, c9, c1, 0for ATCM,c9, c1, 1for BTCM; bit 0 is Enable). Initialize ECC-protected RAM (write to establish valid ECC) before any read. Init BSS/data and stacks before touching DDR or cached regions. - Configure MPU/cache deliberately.
Read
MPUIR(MRC p15, 0, Rt, c0, c0, 4) for region count. Per region: select withRGNR(c6, c2, 0), setDRBAR(c6, c1, 0),DRSR(c6, c1, 2, size+enable), andDRACR(c6, c1, 4, AP/TEX/S/C/B/XN). Mark peripherals as Device/Strongly-ordered withXN, TCM/SRAM/DDR as Normal. Enable viaSCTLR.M(bit 0); enable caches withSCTLR.C(bit 2) andSCTLR.I(bit 12). UseDSB/ISBafter CP15 writes. - Decode exceptions.
Data Abort: read
DFSR(c5, c0, 0) andDFAR(c6, c0, 0). Prefetch Abort: readIFSR(c5, c0, 1) andIFAR(c6, c0, 2). ECC/parity events also surface inADFSR/AIFSR(c5, c1, 0/c5, c1, 1). Decode the DFSR status field (short-descriptorFS= bit 10 + bits [3:0]):0b00001alignment,0b00000background (no MPU region),0b01101permission,0b01000synchronous external abort,0b10110asynchronous external abort,0b11001/0b11000synchronous/asynchronous parity/ECC. CheckWnR(bit 11) for write vs read. - Bring up interrupts separately.
Validate routing before load. For a GIC:
GICD_CTLR,GICD_ISENABLERn,GICD_IPRIORITYRn,GICD_ITARGETSRn, then CPU interfaceGICC_CTLR,GICC_PMR, and theGICC_IAR/GICC_EOIRacknowledge/EOI pair. For a PL192-style VIC or TI VIM, validate the vector table and enable/priority registers. Confirm the FIQ/IRQ mode has its own stack and thatCPSR.I/CPSR.F/CPSR.Amasks are cleared as intended. - Add multicore/safety features last.
Prove single-core execution before enabling lock-step comparison, split-mode messaging, watchdogs, or safety monitors. Note lock-step vs split is a hardware/reset configuration (e.g.,
DCLS,INITRAM*straps), not a runtime software toggle.
Common Failures
- Linker script places vectors, stacks, or
.datainATCM/BTCMor DDR not yet enabled/initialized by the boot stage. ATCM/BTCMassumed enabled: the region Enable bit (c9, c1, xbit 0) is clear, orINITRAMA/INITRAMBreset base does not match the linker map.- ECC-protected RAM read before being written, producing a synchronous parity/ECC Data Abort (
DFSR=0b11001) with the address inDFAR. - Peripheral registers left in a Normal/cacheable MPU region instead of Device with
XN, causing reordering or speculative-access aborts. - DMA buffers cached without
DCCMVAC/DCIMVAC/DCCIMVACmaintenance plusDSBaround ownership handoff. - Missing banked
IRQ/FIQstack, so the first interrupt corrupts memory onceCPSR.I/CPSR.Fis cleared. - MPU enabled (
SCTLR.M) with noDRSR-enabled region and background region off (SCTLR.BR, bit 17), so every access takes a background fault (DFSR=0b00000). - Debugger attached to the wrong core, or expecting two cores while the group is in lock-step (only one core is visible).
Verification
Before claiming Cortex-R5 firmware works:
- State SoC, core, mode (single/split/lock-step), boot chain, memory map, and debugger path.
- Confirm reset-to-main with vectors (
SCTLR.V/base), per-mode stacks, TCM enabled, and C runtime initialized. - Confirm MPU regions (
DRBAR/DRSR/DRACR) and cache state (SCTLR.M/.C/.I) for code, data, Device/peripheral, DMA, and shared memory. - Confirm at least one timer/interrupt path (GIC/VIC ack + EOI) and one exception dump path (
DFSR/DFARorIFSR/IFAR). - Confirm watchdog, lock-step/split, and inter-core communication behavior if used.
Example
User:
Cortex-R5 一开 D-cache 就随机 data abort。Agent:
Reads
DFSR/DFARat the abort to classify the fault, e.g. via OpenOCD afterhalt:arm mrc 15 0 5 0 0 ;# DFSR (p15, op1=0, CRn=c5, CRm=c0, op2=0) arm mrc 15 0 6 0 0 ;# DFAR (p15, op1=0, CRn=c6, CRm=c0, op2=0)(Xilinx XSDB equivalent: select the RPU core with
targets, thenrrdforCPSR/banked regs andmrdfor the faulting address.)- Checks whether the faulting
DFARlands in a peripheral or shared buffer marked Normal/cacheable, and whether the status is permission (0b01101), external (0b01000), or parity/ECC (0b11001). - Fixes the MPU attributes (
DRACR: Device +XNfor peripherals) and addsDCCIMVAC/DSBcache maintenance around DMA/shared memory before changing application logic.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

