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.

CodeFusion Studio includes three advanced debugging tools that extend the standard VS Code debug experience with embedded-specific capabilities. The GDB Toolbox automates repetitive GDB command sequences through JSON-defined scripts, letting you capture register dumps, analyze stack usage, or decode fault registers with a single click. The Core Dump Analysis Tool provides retrospective debugging for supported Zephyr-based SoCs, reconstructing the full program state — threads, stack frames, registers, and memory — from a crash dump stored in flash or captured over UART. The CFS Memory Viewer offers a multi-core-aware hex and ASCII grid that reads device memory during live and post-mortem debug sessions and auto-refreshes each time execution halts.

GDB Toolbox

The GDB Toolbox is a scripted automation layer on top of GDB. Rather than typing the same sequence of GDB commands every debugging session, you define the sequence once in a JSON file and run it with a single click from the sidebar. Scripts can read registers, dump memory, analyze threads, walk stack frames, and save formatted reports to the workspace.

Where scripts are stored

When you create a CFS workspace, the extension creates a .cfs/gdb_toolbox/ directory with two subdirectories:
  • configs/ — JSON script definitions. Each file is one runnable script. Default scripts are pre-populated here.
  • gdb/ — Optional GDB script files (.gdb) referenced by JSON scripts. These contain raw GDB commands or Python code using the GDB Python API.
User scripts are saved to:
<userHome>/cfs/<cfs_version>/<project_name>/.cfs/gdb_toolbox/configs/
You can also drop scripts manually into this directory — they appear in the GDB Toolbox view automatically the next time a debug session starts.

Built-in scripts

The following default scripts are available in every new CFS workspace. Only scripts compatible with the active core and firmware platform are shown during a session.
ScriptDescriptionCorePlatform
Analyze CrashAnalyzes a crash and generates a JSON report of faulting threadsCore agnosticZephyr
Analyze FaultsReads and decodes fault status registers; prints an ARM fault summaryARMMSDK, Zephyr
Analyze Global HeapReports total, used, and peak heap usageCore agnosticZephyr
Analyze StackTraverses stack frames, prints locals/arguments, and reports used/remaining stack spaceCore agnosticMSDK
Analyze Stack High-water MarkReports maximum stack depth using a known fill pattern (run Paint Stack first)Core agnosticMSDK
Analyze ThreadsExtracts stack usage, register state, and call trace for all active threadsCore agnosticZephyr
Dump MemoryDumps the current memory state to a log fileCore agnosticMSDK, Zephyr, SHARC-FX
Dump RegistersDumps the current register state to a log fileCore agnosticMSDK, Zephyr, SHARC-FX
Interrupt StatusReads the NVIC state to identify enabled, active, and pending interruptsARMMSDK
Paint StackFills the stack with 0xDEADBEEF to enable high-water mark analysisCore agnosticMSDK
Analyze Threads requires an OpenOCD debug configuration (for example, CFS: Debug with GDB and OpenOCD (Arm Embedded)). J-Link GDB server configurations do not support Zephyr thread awareness, which causes this script to fail when using a J-Link debug configuration.

Accessing the GDB Toolbox

1

Start a debug session

Click the Run and Debug icon in the Activity Bar, select your configuration, and press F5 (or use the CFS: debug task). The GDB Toolbox panel appears in the sidebar once the session starts.
2

Pause execution

Set a breakpoint in your application source code and let execution reach it, or use the Pause button to halt the target manually. Scripts only run when the debug session is paused or halted.
3

Run a script

Click the script name in the GDB Toolbox panel. Output appears in the Debug Console. In multi-core projects, the Debug Console is context-aware — use the dropdown to switch between cores.

Creating and editing scripts

1

Create a new script

In the GDB Toolbox panel, click Create Script. Enter a name (for example, Dump Stack) and press Enter to generate a template JSON file.
2

Edit the JSON definition

The template opens in the editor. Define the GDB commands and post-command actions. Save with Ctrl+S / Cmd+S.
3

Edit an existing script

Hover over a script name in the GDB Toolbox and click the Edit Script pencil icon. The JSON file opens in the editor.
4

Filter scripts

Click Filter Scripts, enter a name or description, and press Enter. The panel updates to show only matching scripts. Click Clear Filter to restore the full list.

Script JSON reference

Every GDB Toolbox script is a JSON file with the following top-level structure:
{
  "name": "Analyze Faults",
  "description": "Analyzes faults and exceptions...",
  "core": "arm",
  "firmwarePlatform": "zephyr",
  "soc": "MAX32690",
  "commands": [
    {
      "command": "source {defaultScriptsDirectory}/fault-analyzer-arm.gdb",
      "actions": [
        {
          "type": "appendFile",
          "filePath": "gdb_toolbox/reports/${input:filename}.md",
          "content": "${markdownReport}"
        }
      ]
    }
  ],
  "inputs": [
    {
      "id": "filename",
      "type": "inputBox",
      "title": "Log Filename",
      "prompt": "Enter a name for the log file"
    }
  ]
}
Top-level fields:
FieldTypeRequiredDescription
namestringDisplay name shown in the GDB Toolbox UI
descriptionstringTooltip text in the UI
corearrayFilters visibility by core type: arm, riscv
firmwarePlatformstringFilters by platform: zephyr, msdk
socstringFilters by SoC name, for example MAX32690
commandsarrayOrdered list of GDB commands and their post-run actions
inputsarrayUser input prompts referenced by ${input:<id>} in commands

Action types

Each commands entry may include an actions array that runs after the GDB command completes:
TypeFieldsDescription
logmessageWrites a message to the Debug Console
writeFilefilePath, contentWrites output to a file in the project directory
appendFilefilePath, contentAppends output to an existing file
showMessagemessage, levelDisplays a VS Code pop-up (info, warning, or error)
openFilefilePath, lineNumberOpens a file in the editor at the given line
openDisassemblyOpens the Disassembly view at the current PC
setVariablename, regexExtracts a value from GDB output using a capturing regex for reuse
conditionalcondition, then, elseRuns actions conditionally using a Jexl expression

Script variables

VariableDescriptionSupported in
${gdbOutput}Captures the raw output of the current GDB commandcontent, message
${input:<id>}Prompts the user for input, referencing an inputs[] entry by IDcommand, filePath, content
${markdownReport}Inserts a pre-formatted Markdown version of GDB outputcontent
${timestamp}Inserts the current ISO 8601 timestampfilePath, content
${<name>}Value previously captured by a setVariable actionfilePath, content, message, condition
{
  "name": "Run GDB Command and Save Output",
  "description": "Lets you choose a GDB command and saves the output to a log file.",
  "commands": [
    {
      "command": "${input:command}",
      "actions": [
        {
          "type": "writeFile",
          "filePath": "logs/output_${timestamp}.log",
          "content": "${gdbOutput}"
        }
      ]
    }
  ],
  "inputs": [
    {
      "id": "command",
      "type": "quickPick",
      "title": "Select a Command",
      "prompt": "Choose a command to run:",
      "choices": ["info registers", "info threads", "bt"]
    }
  ]
}
On macOS, the GDB binary used for GDB Toolbox is not Python-enabled by default. Install Python 3.10 and update your launch.json to point to the Python-enabled GDB binary. See the CFS release notes for details.

Core Dump Analysis

The Core Dump Analysis Tool enables post-mortem debugging of Zephyr-based firmware. When your application crashes, Zephyr writes a snapshot of program state to a reserved flash partition. CFS can retrieve that dump over JTAG (J-Link) or decode a UART log capture, then present the results in a structured view showing active threads, register state, stack usage, and memory content at the time of the fault.

Supported processors

Core dump analysis supports the following MAX32 family SoCs running Zephyr RTOS:

MAX32650

MAX32655

MAX32657

MAX32658

MAX32660

MAX32662

MAX32666

MAX32670

MAX32672

MAX32690

MAX78000

MAX78002

Support extends to all processor cores included in these SoCs.

Enabling core dump support

If you select a Zephyr-based workspace template in the Workspace Creation Wizard, core dump support is enabled by default. The template provides:
  • A reserved flash partition for storing crash data
  • Pre-configured prj.conf settings for dump generation and storage
No additional configuration is required.

Configuring core dump settings

Before running the tool, verify that the VS Code settings match your flash partition configuration. Open Settings and search for cfs.coreDump:
SettingDescriptionDefault
cfs.coreDump.addressFlash address where the core dump partition starts0x102F0000
cfs.coreDump.sizeSize of the core dump partition to retrieve0x10000
cfs.coreDump.elfFilePath to the application ELF file (required for symbol resolution)
cfs.coreDump.binFilePath where the retrieved binary dump is savedcore-dump.bin
cfs.coreDump.logFile(Optional) Path to a UART log file for UART-backend dumps
cfs.coreDump.gdbServerPortGDB server port for analysis (default: 1234 for J-Link)1234
If cfs.coreDump.address and cfs.coreDump.size do not match the flash partition defined in System Planner → Memory Allocation, the tool displays: Core dump analysis failed. Error: Neither Zephyr core dump magic header nor 'ZE' marker found in bin file.Always verify that both the System Planner partition settings and the VS Code settings use matching addresses and sizes.

Retrieving and analyzing a core dump

1

Trigger a crash

Build and flash your application. To simulate a crash for testing, add k_panic(); to main.c. After the crash, reset or power-cycle the board to ensure the dump is fully written to flash before retrieval.
2

Open the Core Dump Analysis view

In VS Code, go to the Run and Debug view. The Core Dump Analysis section appears below your debug configurations with four action buttons.
3

Choose a retrieval method

  • Retrieve Core Dump (JLink) — Downloads the .bin from the device without opening the analysis view. Connect via J-Link first.
  • Analyze Existing Core Dump — Opens a previously saved .bin or UART .log file for analysis without connecting to the device.
  • Retrieve and Analyze Core Dump — Retrieves the dump from flash and immediately opens it in the analysis view. The typical full workflow.
  • Export Core Dump Report — Packages the current analysis, ELF file, and core dump binary into a ZIP archive for sharing.
4

Inspect the results

The analysis view shows the program state at crash time: active threads and their stack usage, register values including fault status registers, the faulting address, and a call stack trace to the offending function.
You can also run core dump actions from the Command Palette:
CommandCommand Palette Entry
Retrieve Core Dumpcfs.retrieveCoreDump
Analyze Existing Core Dumpcfs.analyzeExistingCoreDump
Retrieve and Analyze Core Dumpcfs.retrieveAndAnalyzeCoreDump
Export Core Dump Reportcfs.downloadCoreDumpReport

Memory Viewer

The CFS Memory Viewer is a multi-core-aware alternative to the Memory tab provided by the Cortex-Debug extension. It integrates directly with the CFS debug infrastructure, supports both live and post-mortem (core dump) sessions, and auto-refreshes memory contents each time the debugger halts — without requiring a manual refresh between steps.

Opening the Memory Viewer

The CFS Memory tab appears automatically in the bottom panel when you start a debug session. You can also open it any time via the Command Palette:
Ctrl+Shift+P → CFS Memory: Focus on CFS Memory Viewer View
  1. In the Go to field in the toolbar, enter an address in hexadecimal (for example, 0x20000000) or decimal format.
  2. Press Enter. The memory grid loads data starting from that address.
If the address is already within the loaded region, the grid scrolls to it without a new fetch. The Go to field displays an inline error if the address is invalid, the session is not active, or the target is currently running.

Memory grid display

The scrollable grid shows three columns:
  • Address — the hex address of the first byte in each row
  • Hex values — bytes in the selected format, grouped by the byte grouping setting
  • ASCII — printable ASCII representation of the same bytes; non-printable characters render as .
The grid uses infinite scroll — as you approach the end of the loaded region, the viewer fetches the next chunk automatically.

Display settings

Configure the grid layout using the footer controls:
ControlOptionsEffect
Byte grouping1 Byte, 2 Bytes, 4 BytesGroups bytes into hex cells; cycle by clicking the label
EndiannessBig Endian, Little EndianShown when grouping is 2 or 4 bytes
Columns4, 8, 16, 32, 64Number of hex cells per row (default: 16)
Display formatHexadecimal, DecimalToggle by clicking the format label

Auto-refresh

Once you navigate to an address, the viewer automatically re-reads memory each time the debugger halts — on every step or breakpoint. When execution resumes (Continue), the viewer marks current data as Stale to indicate the values may no longer reflect the target state. To manually refresh while already halted (for example, after writing a value from the Debug Console), click the Refresh button in the toolbar.
Declare a static variable in your source so the compiler assigns it a fixed address in SRAM:
static int count = 0;
With the debugger halted at a breakpoint:
  1. Add &count as a Watch expression, or run print &count in the Debug Console to get the address.
  2. Enter that address in the Go to field.
  3. Set footer to 1 Byte grouping and Decimal display.
  4. Press F10 (Step Over) repeatedly.
The Memory Viewer re-reads the address on each halt. Watch the bytes at count’s address update as the value increments — no manual refresh needed.

Session status indicators

The toolbar shows the following status badges for the active session:
  • LIVE — connected to a running target
  • POST-MORTEM — reading from a core dump (read-only mode)
  • Halted — target is stopped; data is current
  • Stale — target resumed since last read; data may be out of date

Multi-core support

In multi-core environments, the Memory Viewer tracks all active debug sessions simultaneously. It displays memory for whichever core’s session you select in the Call Stack view, and updates automatically when you switch cores. Each session’s lifecycle (start, halt, continue, stop) is tracked independently.

Error states

StateViewer message
No debug sessionStart a debug session to view memory.
Target runningHalt execution to read memory.
No address enteredEnter an address in ‘Go to’ to inspect target memory.
Invalid addressInline error in the Go to field
Unmapped addressRead memory error: Unable to read memory
Read timeout (>5 s)Request is cancelled and an error is displayed

Retrospective debugging

The Memory Viewer works with Core Dump Analysis sessions. When a post-mortem session is open, the POST-MORTEM badge appears and the viewer operates in read-only mode. Enter any valid address in the Go to field to inspect the memory state captured at crash time.

Build docs developers (and LLMs) love