Riscv Mcu Debug logo

Riscv Mcu Debug

Community
easyzoom
riscv-mcu-debug

Use when debugging RISC-V microcontrollers, bare-metal firmware, RTOS bring-up, OpenOCD or GDB sessions, traps, CSRs, startup code, or flashing failures

Overview

Publishereasyzoom
Repositoryaix-skills
Skill nameriscv-mcu-debug
Stars
39
Forks
5
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by easyzoom on GitHub. Read the source before you install it.

Installation

Install the Riscv Mcu Debug AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/easyzoom/aix-skills/tree/main/skills/riscv-mcu-debug
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/easyzoom/aix-skills.git /tmp/aix-skills
mkdir -p .claude/skills
cp -r /tmp/aix-skills/skills/riscv-mcu-debug .claude/skills/riscv-mcu-debug
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Riscv Mcu Debug in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Riscv Mcu Debug on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Riscv Mcu Debug is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

RISC-V MCU Debug

Overview

Use this skill to debug RISC-V MCU firmware systematically. Identify the exact core, SoC, debug module, toolchain, memory map, and trap state before changing startup code, linker scripts, flash settings, or machine-mode configuration.

When To Use

Use this skill when:

  • The target is a RISC-V MCU or bare-metal RISC-V SoC.
  • The user mentions OpenOCD, GDB, JTAG, RISC-V debug module, mstatus, mcause, mepc, mtvec, trap handlers, startup code, or linker scripts.
  • Firmware cannot flash, stops before main, traps, hangs, or has no UART/log output.

Do not use this skill for Cortex-M, 8051, embedded Linux application debugging, or general C code review without target evidence.

First Questions

Ask for:

  • Exact chip, board, and core if known, such as RV32IMAC, RV32E, RV64, F/D extension, or vendor core name.
  • Toolchain: GCC, LLVM, vendor IDE, Zephyr, RT-Thread, or bare metal.
  • Debug path: OpenOCD, vendor GDB server, J-Link, WCH-Link, onboard probe, or UART bootloader.
  • Current symptom: cannot connect, cannot flash, no boot, trap, hang, no log, or peripheral failure.
  • Available artifacts: ELF, MAP, linker script, startup file, OpenOCD config, UART log, trap dump, or GDB transcript.

Workflow

  1. Confirm the target profile. RISC-V MCU behavior depends on XLEN, extensions, privilege mode, vendor CSRs, debug module, and memory map.

  2. Classify the failure phase. Use connect, flash, reset/startup, trap, runtime hang, peripheral bring-up, or RTOS scheduling.

  3. Establish a non-destructive debug session. Prefer halt/reset-halt and symbol loading before flash erase or startup rewrites.

  4. Collect trap and reset evidence. Record pc, sp, mstatus, mcause, mepc, mtval, mtvec, and key memory addresses.

  5. Check linker and startup alignment. Confirm reset address, vector/trap base, RAM origin, stack top, .data copy, .bss zeroing, and main call path.

  6. Ask before risky operations. Mass erase, option bytes, boot mode, security locks, and vendor flash config changes require explicit approval.

OpenOCD And GDB Checks

Useful patterns:

bash
openocd -f interface/<probe>.cfg -f target/<target>.cfg
riscv64-unknown-elf-gdb build/firmware.elf
riscv-none-elf-gdb build/firmware.elf

GDB baseline:

gdb
target extended-remote :3333
monitor reset halt
info registers
p/x $pc
p/x $sp
p/x $mcause
p/x $mepc
p/x $mtval
p/x $mtvec
bt

Check:

  • pc points to a valid executable region.
  • sp points inside RAM and is aligned.
  • mtvec points to the intended trap handler.
  • mepc maps to source or disassembly.
  • OpenOCD target config matches the exact chip or debug module.

Trap Debugging

When a trap occurs:

  1. Preserve state before reset.
  2. Read mcause, mepc, mtval, mstatus, and mtvec.
  3. Decode whether the cause is interrupt or exception.
  4. Map mepc to a symbol and instruction.
  5. Check whether mtval contains a bad address or instruction.

Common causes:

  • Illegal instruction due to wrong ISA flags, such as compiling for rv32imac but running on a core without compressed instructions.
  • Misaligned access or unsupported unaligned loads/stores.
  • Executing from erased flash or wrong boot address.
  • Stack pointer outside RAM.
  • Trap vector not initialized or not aligned as required.
  • Accessing peripheral addresses before clocks or bus bridges are ready.
  • M-mode interrupt enable or PLIC/CLIC setup mismatch.

Startup And Linker Checks

If firmware fails before main():

  • Confirm linker script flash/RAM origins match the exact SoC.
  • Confirm reset entry address agrees with boot ROM or flash mapping.
  • Confirm stack top is valid and aligned.
  • Confirm global pointer gp and small data sections are initialized if used.
  • Confirm .data and .bss initialization.
  • Confirm trap handler is installed before enabling interrupts.
  • Confirm compiler ABI, ISA string, and startup assembly agree.

Flashing Checks

If flashing fails:

  • Separate connect, erase, program, and verify failures.
  • Check probe wiring, target voltage, reset, and JTAG/SWD-equivalent pin mux.
  • Lower adapter speed.
  • Confirm flash algorithm and target config match the chip.
  • Ask before mass erase or security unlock.

Verification

Before claiming progress:

  • State chip/core, XLEN, ISA string if known, probe, debug server, and toolchain.
  • Confirm whether GDB can halt and read registers.
  • Report pc, sp, mcause, mepc, mtval, and mtvec when trap-related.
  • Confirm flash erase/program/verify status separately if flashing was attempted.
  • List destructive actions skipped or awaiting approval.

Common Failures

  • Using the wrong -march or -mabi for the actual core.
  • Assuming all RISC-V MCUs have the same interrupt controller.
  • Resetting before reading trap CSRs.
  • Debugging C code before confirming startup assembly and linker origins.
  • Using a near-match OpenOCD target config without checking memory map and flash algorithm.

Example

User:

text
RISC-V 小板下载后进 trap,串口没有日志。

Agent:

  1. Asks for chip, core/ISA, probe, OpenOCD config, ELF, and trap register dump.
  2. Connects halt-first and reads pc, sp, mcause, mepc, mtval, and mtvec.
  3. Maps mepc to source or disassembly.
  4. Checks ISA flags, stack range, trap vector, and linker origins before editing code.

Frequently asked questions

What does the Riscv Mcu Debug AI skill do?

Use when debugging RISC-V microcontrollers, bare-metal firmware, RTOS bring-up, OpenOCD or GDB sessions, traps, CSRs, startup code, or flashing failures

Why use Riscv Mcu Debug on TypingMind?

Because you install it once and use it with any model. Riscv Mcu Debug is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Riscv Mcu Debug in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/easyzoom/aix-skills/tree/main/skills/riscv-mcu-debug. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Riscv Mcu Debug?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Riscv Mcu Debug?

As many as you like. As long as a model supports skills, you can use Riscv Mcu Debug with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Riscv Mcu Debug AI skill free?

Yes. It is published on GitHub by easyzoom under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇