Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/analogdevicesinc/codefusion-studio/llms.txt

Use this file to discover all available pages before exploring further.

The AI Debug Assistant is an agentic debugging system built into CodeFusion Studio that actively participates in live debug sessions, autonomously investigating hardware faults, reading register and memory state, and coordinating across multiple cores — all in real time, using natural language.
The AI Debug Assistant is currently in preview and may change in future releases.
Rather than answering static questions about source code, the AI Debug Assistant can autonomously investigate hardware faults, read live register and memory state, coordinate across multiple cores, set hardware watchpoints, and reason about what the silicon is actually doing — all in real time, using natural language. It bridges the gap between a passive code assistant and a fully capable embedded debugging partner.

What makes it different

Traditional AI code assistants work with static source. The AI Debug Assistant connects to a live debug session through the Model Context Protocol (MCP) — an open standard created by Anthropic for connecting AI models to external tools and data sources. This means the AI has access to actual hardware state: the contents of fault registers, live memory values, the call stack at the moment of a crash, and the execution state of every core in a multi-core system. When you ask “What caused this hard fault?”, the assistant does not guess from source code. It reads the ARM Cortex-M fault status registers (CFSR, HFSR, BFAR, MMFAR), decodes the exception type, inspects the faulting address against the memory map, and walks the call stack to the offending source line — all autonomously.

Integration paths

CFS MCP Debug Server (Recommended)

An MCP-based HTTP server built into the CFS IDE extension. Works with GitHub Copilot Agent Mode, Claude Code, and any MCP-compatible AI client. Enables fully agentic, multi-step investigations.

CFS Debug Chat Participant

A VS Code GitHub Copilot Chat integration accessed via the @cfs-debug participant. Works without starting the MCP server. Best for quick, single-step interactions within VS Code.
For production workflows, use the CFS MCP debug server with any MCP-compatible AI client for maximum portability and future compatibility. Use the @cfs-debug chat participant for quick interactions without setup.

What the assistant can do

CapabilityDescription
Session controlStart, stop, restart, continue, pause, and step through debug sessions
Hardware state inspectionRead registers, memory, variables, stack traces, and thread lists directly from the target
Breakpoints and watchpointsSet, list, and remove breakpoints — including conditional breakpoints — and hardware watchpoints
GDB command executionRun GDB commands with built-in safety guards that block destructive operations
Fault decodingAutomatically parse ARM Cortex-M fault registers (CFSR, HFSR, BFAR, MMFAR) and RISC-V exception registers (mcause, mtval, mepc)
ELF binary analysisSurface symbol sizes, stack usage, section layout, and the largest consumers of flash and RAM
Structured diagnostic promptsPre-built investigation sequences for crash diagnosis, memory corruption, peripheral misconfiguration, multi-core debugging, and more

Getting started with the MCP debug server

Prerequisites

  • CodeFusion Studio installed with an active project
  • For GitHub Copilot Agent Mode: VS Code 1.96.0 or later and the GitHub Copilot extension installed and authenticated
  • For Claude Code: Claude Code CLI installed
1

Start the MCP server

Open the Command Palette (Ctrl+Shift+P / Cmd+Shift+P) and run:
(CFS) MCP: Start Debug Server
A VS Code notification appears with the URL the server is listening on, for example http://localhost:56448/mcp. Note the port number — you will need it to connect AI clients.The following commands manage the server:
CommandDescription
(CFS) MCP: Start Debug ServerStart the MCP server
(CFS) MCP: Stop Debug ServerStop the MCP server
(CFS) MCP: Server StatusCheck whether the server is running and which port it is using
2

(Optional) Set a fixed port

By default, the OS assigns an available port at startup. For a stable registration URL (recommended for Claude Code), set a fixed port:
  1. Go to Settings → Extensions → CodeFusion Studio → General, or search for cfs.mcp.port.
  2. Set Port to a specific value (for example, 3001). Set to 0 to restore OS-assigned behavior.
  3. Restart the MCP server: run Stop Debug Server then Start Debug Server.
3

Connect GitHub Copilot Agent Mode

  1. Open GitHub Copilot Chat (Ctrl+Alt+I / Cmd+Shift+I).
  2. Click the mode selector dropdown in the chat input (defaults to Ask).
  3. Select Agent.
When VS Code MCP support is enabled, Agent Mode automatically discovers and uses the running MCP server. No manual registration is needed — GitHub Copilot reads the port directly from the cfs.mcp.port setting.
4

Connect Claude Code

Check the server URL via (CFS) MCP: Server Status, then register the server:
claude mcp add --transport http cfs-debug http://localhost:<port>/mcp
Exit and restart Claude Code for the registration to take effect. Verify with:
claude mcp list
5

Start a debug session

Press F5 or click the Run and Debug icon to start a CFS debug session. The AI assistant needs an active session to inspect hardware state. Alternatively, ask the assistant: “Start debugging CFS: Debug with GDB and OpenOCD (ARM Embedded)”.
6

Ask your first question

In Agent Mode or Claude Code, describe what you want investigated in natural language:
What is the current execution state of the target?
What caused this hard fault?
The assistant plans and executes a sequence of debug operations autonomously and reports its findings.
To start the MCP server automatically whenever the CFS extension activates, enable Settings → Extensions → CodeFusion Studio → General → MCP Server → Run on Activation (cfs.mcp.runOnActivation).

Getting started with the chat participant

For quick interactions within VS Code without setting up the MCP server:
1

Ensure prerequisites

Install VS Code 1.96.0 or later and the GitHub Copilot extension. Sign in to GitHub Copilot.
2

Open GitHub Copilot Chat

Press Ctrl+Alt+I / Cmd+Shift+I to open the Copilot Chat panel.
3

Type @cfs-debug

Prefix your message with @cfs-debug. The assistant routes your input to the appropriate debug operation:
@cfs-debug show registers
@cfs-debug what caused this hard fault?
@cfs-debug set breakpoint at main.c:42
For AI analysis features, use a Claude model (such as Claude Sonnet 4.5 or Claude Opus 4.6) with the @cfs-debug chat participant. Other models may work for basic commands but can produce inconsistent results for analysis tasks.

Using the assistant during a live debug session

Natural language investigations (MCP server)

With the MCP server running and a debug session active, describe the problem in plain language. The assistant determines the investigation sequence autonomously:
Investigate the shared memory issue between both cores.
Diagnose why the application hard-faulted after 30 seconds of runtime.
Find what's writing to the shared buffer and causing data corruption.
The assistant plans and executes the sequence — reading registers, inspecting memory, setting watchpoints, walking call stacks — and reports its findings when complete.

Chat participant commands (@cfs-debug)

@cfs-debug start debugging with CFS: Debug with GDB and OpenOCD (Arm Embedded)
@cfs-debug stop debugging
@cfs-debug restart
@cfs-debug continue
@cfs-debug step over
@cfs-debug step into
@cfs-debug step out
@cfs-debug pause

Real-world examples

Your firmware hits a hard fault. In Agent Mode or Claude Code:
“What caused this hard fault?”
The AI Debug Assistant:
  1. Reads the ARM Cortex-M fault status registers (CFSR, HFSR, BFAR, MMFAR)
  2. Decodes the exception type: bus fault, memory management fault, usage fault, or hard fault
  3. Inspects the faulting address against the memory map
  4. Walks the call stack to identify the offending function and source line
  5. Reports the root cause in plain language with the relevant file and line number
A dual-core SoC (Cortex-M33 + Cortex-M4) shares a region of SRAM. Under load, the application core intermittently reads stale values — no crash, no fault, just wrong data.
“Investigate the shared memory issue between both cores.”
The AI Debug Assistant:
  1. Connects to debug sessions on both cores
  2. Reads the shared memory region and inspects ELF-mapped variables
  3. Examines the execution state of each core — what each was running, what addresses each was accessing
  4. Identifies that the DMA transfer on Core 1 overlaps with Core 0’s buffer read with no synchronization primitive
  5. Reports the conflicting memory region, the source lines involved, and a suggested fix
A variable is being corrupted and you don’t know where.
“Watch shared_buffer for writes and tell me what’s writing to it.”
The AI Debug Assistant:
  1. Locates the variable in the ELF symbol table to get its address
  2. Sets a hardware watchpoint on that address
  3. Continues execution and waits for the watchpoint to fire
  4. Reads the call stack at the point of the write
  5. Disassembles the surrounding code to identify the root cause
  6. Reports the offending function, source line, and the value written
Before a release, you need to reduce flash usage.
“Analyze the firmware binary and show me the largest consumers of flash and RAM.”
The assistant reads the ELF binary, surfaces symbol sizes and section layout, ranks the largest contributors, and suggests optimization candidates — without requiring you to manually run arm-none-eabi-nm and sort the output.

MCP tools reference

The CFS MCP debug server exposes tools organized into six categories. All tools are available to any connected MCP-compatible client.
ToolDescriptionParameters
debug_execute_gdb_commandExecute a single GDB command. Destructive commands are blocked.command
debug_execute_gdb_sequenceExecute a sequence of GDB commands in order. Session must be halted.commands (array, 1–20), stopOnError (optional)

Diagnostic prompts reference

Pre-built diagnostic prompts encode systematic debugging methodologies. Invoke them by describing the task in natural language, or by name in any MCP-compatible client. In Claude Code, run /mcp to browse all available prompts.
PromptWhat it doesParameters
basic-state-awarenessReports execution state, program counter, and stack pointer
crash-diagnosisWaits for a crash, decodes fault registers, walks call stack, identifies offending function
breakpoint-and-inspectSets a breakpoint, continues, reports local variables when hitfile, line
source-search-and-debugFinds code matching a description, sets a breakpoint, inspects registersdescription
conditional-breakpointSets a conditional breakpoint, catches it twice, reads a variable each timecondition, variable (optional)
step-and-disassembleSteps N instructions, showing disassembly and a register value at each stepsteps (optional), register (optional)
watchpoint-triggerWatches a variable for writes, reports what wrote to it with the full call stackvariable
memory-inspectionReads a memory region; identifies ASCII strings, structured data, or byte patternsaddress, length (optional)
autonomous-investigationEnd-to-end memory corruption investigation: locates struct in ELF, sets watchpoint, traces root causevariable
timeout-handlingSets a breakpoint on a function and reports what happens; useful for testing error pathsfunctionName

Settings reference

SettingDescriptionDefault
cfs.mcp.runOnActivationAutomatically start the MCP server when the CFS extension activatesfalse
cfs.mcp.portPort for the MCP server. Set to 0 for OS-assigned port.0

Troubleshooting

If the OS cannot assign a port, or you need a specific port:
  1. Open Settings and search for cfs.mcp.port.
  2. Set Port to a specific free port (for example, 3001). Use 0 for OS-assigned.
  3. Run Stop Debug Server then Start Debug Server.
  4. Update your AI client registration to use the new port.
Most tools require an active debug session. Start debugging with F5 or the Run menu before asking the assistant to inspect hardware state. Alternatively, ask the assistant directly: “Start debugging CFS: Debug with GDB and OpenOCD (ARM Embedded)”.
If you see No Copilot model available. Please ensure GitHub Copilot is installed and authenticated:
  1. Verify GitHub Copilot is installed and you are signed in.
  2. Confirm your GitHub Copilot plan includes access to Claude models (Claude Sonnet 4.5 or Claude Opus 4.6).
  1. Check that VS Code is version 1.96.0 or later (Help → About).
  2. Ensure GitHub Copilot is installed and authenticated.
  3. Confirm the CodeFusion Studio extension is installed and active.
  4. If MCP support is unavailable in your VS Code environment, use the @cfs-debug chat participant or Claude Code instead.
  1. Run (CFS) MCP: Server Status to confirm the server is running.
  2. Run claude mcp list to verify cfs-debug is registered with the correct URL and port.
  3. If the port has changed since registration, re-register:
    claude mcp remove cfs-debug
    claude mcp add --transport http cfs-debug http://localhost:<port>/mcp
    claude mcp list
    
To test the server independently, use the open-source MCP Inspector:
npx @modelcontextprotocol/inspector
Select Streamable HTTP transport and Via Proxy connection type, then enter http://localhost:<port>/mcp. Browse all available tools and prompts to verify the server is working before involving an AI client.
If Agent Mode does not discover the CFS MCP server, verify that MCP support is enabled in your VS Code installation. If MCP support is unavailable, use the @cfs-debug chat participant or connect with Claude Code instead.

Build docs developers (and LLMs) love