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 cfsutil tasks commands let you enumerate and execute the build, flash, clean, and debug tasks associated with a CodeFusion Studio workspace project — without opening the IDE. Task discovery combines the platform tasks generated for each project with any custom tasks defined in .vscode/cfs.tasks.json. Serial port output capture is supported for tasks that flash and run firmware, including Zephyr CTF trace collection.
Task commands operate on a generated workspace directory that contains a .cfs/ folder. Do not pass the source .cfsworkspace file to these commands — pass the workspace root directory instead.

cfsutil tasks list

cfsutil tasks list [-w <workspace-path>] [-p <project-name>] [-v]
Lists the tasks available in a generated workspace. Tasks are grouped by project and displayed in alphabetical order. The task name printed is the command-line-friendly (sanitized) form of the task label.

Flag reference

FlagShortDescription
--workspace=<path>-wWorkspace root to inspect. Defaults to the current directory. The directory must contain .cfs/, or be a project directory inside a workspace that contains .cfs/
--project=<name>-pFilter output to a specific project folder
--verbose-vAlso display the shell command associated with each task
# List all tasks in a workspace
cfsutil tasks list -w /home/<username>/analog/cfs/2.2.0/MyWorkspace

# List tasks for a specific project with commands shown
cfsutil tasks list -w /home/<username>/analog/cfs/2.2.0/MyWorkspace -p m4 -v

# Run from within a project directory
cd /home/<username>/analog/cfs/2.2.0/MyWorkspace/m4
cfsutil tasks list
Sample output:
Tasks for workspace "/home/user/analog/cfs/2.2.0/MyWorkspace":

=== Project: m4 ===
build
clean
erase_JLink
flash_JLink
flash_run_JLink

cfsutil tasks run

cfsutil tasks run <task> [-w <value>] [-p <project-name>] [-v] \
  [--capture --port <value>] [-z <value>]
Runs a task from a project inside a generated workspace. The <task> argument must match a sanitized task name exactly as printed by cfsutil tasks list.

Argument and flag reference

Argument / FlagShortDescription
<task>Required. Task name to run (as printed by tasks list)
--workspace=<value>-wWorkspace path for task discovery. Defaults to the current directory
--project=<value>-pProject folder name, relative to the workspace root
--verbose-vEnable verbose output
--capture-cCapture serial port output after task execution. Requires --port and --project. Continues until Ctrl+C
--port=<value>Serial port name (for example, COM3, /dev/ttyUSB0). Used with --capture
--zephyrTraceFile=<value>-zOutput file path for Zephyr TEF trace. The CLI collects raw CTF data and generates the TEF file when capture stops
# Build a specific project
cfsutil tasks run build -w /home/<username>/analog/cfs/2.2.0/MyWorkspace -p m4

# Flash and capture serial output
cfsutil tasks run flash_run_JLink \
  -w /home/<username>/analog/cfs/2.2.0/MyWorkspace \
  -p m4 \
  --capture --port COM4

# Run from within a project directory
cd /home/<username>/analog/cfs/2.2.0/MyWorkspace/m4
cfsutil tasks run build

# Flash with Zephyr trace capture
cfsutil tasks run flash_run_JLink \
  -w /home/<username>/analog/cfs/2.2.0/MyWorkspace \
  -p m4 \
  --capture --port /dev/ttyUSB0 \
  -z my_trace.tef

Common task names

The following tasks are generated by CFS for most projects. Use cfsutil tasks list to see the exact names available for your workspace and project.
Task nameDescription
buildCompile the project
cleanRemove build artifacts
erase_JLinkErase device flash via J-Link
flash_JLinkFlash firmware via J-Link
flash_run_JLinkFlash firmware and start execution via J-Link
cfsutil tasks run accepts only the sanitized task names printed by cfsutil tasks list. If a task label contains spaces or special characters, tasks list will show the sanitized form to use.

Defining custom tasks for CLI use

Custom tasks must be defined in .vscode/cfs.tasks.json within the project directory:
<workspace-root>/
    .cfs/
    <project-name>/
        .vscode/
            cfs.tasks.json
            settings.json
Minimal cfs.tasks.json example:
{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "build",
      "type": "shell",
      "command": "make -j8",
      "options": {
        "cwd": "${workspaceFolder}",
        "env": {
          "EXTRA_INCLUDE": "${config:cfs.sdk.path}/SDK/Libraries"
        }
      }
    }
  ]
}

Supported variable families

The CLI resolves these variable families in cfs.tasks.json:
  • ${config:<key>} — from merged CFS settings
  • ${env:<name>} — from the current shell environment
  • ${command:<name>} — supported CFS command lookups (for example, tool path resolution)
  • ${workspaceFolder} — the project directory used to run the task
  • ${workspaceFolderBasename}, ${userHome}, ${pathSeparator}, ${/}
  • ${cfs:...} — values handled by the CFS variable resolver

Configuration file

The CLI reads machine-wide settings from config.json:
PlatformDefault location
Linux / macOS~/.config/cfsutil/config.json
Windows%LOCALAPPDATA%\cfsutil\config.json
Override the location with the CFSUTIL_CONFIG_HOME environment variable. Example config.json:
{
  "cfsInstallPath": "/home/<username>/analog/cfs/2.2.0",
  "toolSearchPaths": ["/opt/toolchains/arm-gnu-toolchain/bin"],
  "env": {
    "ARM_GCC_DIR": "/opt/toolchains/arm-gnu-toolchain/bin",
    "PATH": "/opt/toolchains/arm-gnu-toolchain/bin"
  }
}
J-Link erase tasks (erase_JLink) require cfs.jlink.path to be set in config.json or the project’s .vscode/settings.json, pointing to your J-Link installation directory (for example, /opt/SEGGER/JLink_<version>).

Serial port discovery

Before using --capture, identify the correct port name with:
cfsutil port list -v

CI/CD integration

For headless CI builds, use tasks run build after creating the workspace. Avoid --capture in CI unless you have a connected target and serial adapter.
# Create workspace (or use an existing one)
cfsutil workspace create -o "$CI_WORKSPACE_DIR" --name my_fw \
  --soc MAX32690 --board AD-APARD32690-SL \
  --template-id com.analog.project.msdk.plugin

# Build the firmware
cfsutil tasks run build \
  -w "$CI_WORKSPACE_DIR/my_fw" \
  -p CM4

# Analyze the resulting ELF
cfsutil elf analyze "$CI_WORKSPACE_DIR/my_fw/CM4/build/firmware.elf" --format json

Build docs developers (and LLMs) love