CodeFusion Studio integrates the full build-and-flash workflow into Visual Studio Code through a set of pre-configured tasks. Whether you are targeting an Arm Cortex-M device with the MSDK toolchain or a Zephyr RTOS project withDocumentation 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.
west, CFS automatically generates the correct task configuration when you create a workspace. From there, a single keystroke compiles your firmware, links the output binary, and programs it to your connected hardware through the configured debug adapter.
Build tasks overview
CFS adds dedicated entries to the VS Code Tasks system for every workspace. These tasks are backed by the workspace.vscode/tasks.json file and read their configuration — target device, board, toolchain, and debugger type — directly from .vscode/settings.json. All tasks are equivalent regardless of which mechanism you use to invoke them.
CFS: build
Compiles project sources. Uses
make for MSDK projects and west build for Zephyr. Outputs the binary and all object files to the ./build directory.CFS: pristine build
Zephyr only. Runs
west build --pristine=always to delete cached artifacts before recompiling from scratch.CFS: clean
Removes the
./build directory and all of its contents without recompiling.CFS: clean-periph
Runs CFS: clean and also removes MSDK peripheral driver build output, forcing a full peripheral recompilation on the next build.
CFS: flash
Builds the project, then flashes the output binary via the configured debugger. The task name includes the adapter type, for example CFS: flash (OpenOCD) or CFS: flash (JLink).
CFS: flash & run
Builds, flashes, and immediately resumes execution on the target after programming completes.
CFS: erase
Erases all application flash without reflashing. Useful for recovering from LP lockouts or bad firmware.
CFS: debug
Launches the most recently used debug session, optionally reflashing first, then halts at
main().Running build and flash tasks
Open your CFS workspace
Open the workspace folder in VS Code. The CFS extension detects the workspace configuration and populates the task list automatically.
Choose a task access method
You can invoke any task through four entry points:
- Command Palette — press
Ctrl+Shift+P(orCmd+Shift+Pon macOS), search for Tasks: Run Build Task or Tasks: Run Task, and select from the list. - Actions view — click the CFS icon in the Activity Bar, then choose a task from the Actions panel.
- Status Bar — click the build, clean, flash, or debug shortcut icons on the left side of the status bar.
- Terminal menu — select Terminal → Run Build Task from the menu bar.
Build the firmware
Run CFS: build (or press
Ctrl+Shift+B / Cmd+Shift+B). The integrated terminal shows compiler output. A successful build produces the ELF binary in ./build.Connect your hardware
Attach your evaluation board’s debug probe to your computer via USB. Ensure the board is powered on. Refer to your board’s data sheet for the correct SWD/JTAG header and cable.
Flash the firmware
Run CFS: flash (or CFS: flash & run if you want execution to resume automatically). The task first rebuilds if necessary, then programs the binary. The task name in the picker reflects the active debugger, for example CFS: flash (OpenOCD).
CFS settings
CodeFusion Studio adds its own settings namespace inside VS Code to configure toolchain paths, debugger selection, and build options. These settings determine how CFS locates SDKs, compilers, and debug adapters at build and flash time. Settings are applied in a hierarchy: Folder overrides Workspace, which overrides User. When you create a new workspace, CFS automatically writes workspace-scoped settings to.vscode/settings.json.
Accessing settings
- VS Code Settings UI — go to File → Preferences → Settings (macOS: Code → Settings → Settings), or press
Ctrl+,/Cmd+,. - Command Palette — search for Preferences: Open Settings (UI).
- Directly edit
.vscode/settings.jsonin your workspace folder for workspace or folder-level overrides.
Viewing all CFS settings
Select the CodeFusion Studio extension
Find and click CodeFusion Studio in your installed extensions list.
cfs.sdk.path— override the path to the MSDK or Zephyr SDK root.cfs.openocd.interface— select the OpenOCD interface config file, for exampleinterface/ice1000.cfgfor ICE-1000 emulators.cfs.coreDump.address/cfs.coreDump.size— configure the flash partition used for Zephyr core dumps.
The CFS Terminal
CFS ships a custom terminal profile called the CFS Terminal. When you open it, CFS automatically prepends the SDK’s tools directory to yourPATH so that utilities like cfsutil and Zephyr’s west are available immediately — no manual environment setup required.
The underlying shell is cmd on Windows, zsh on macOS, and bash on Linux.
Open a new terminal
Press
Ctrl+Shift+` (all platforms) or go to Terminal → New Terminal (macOS/Linux) or View → Terminal (Windows).Select CFS Terminal
In the terminal panel, click the dropdown arrow next to the + icon (top-right corner) and choose CFS Terminal.
Most IDE tasks (build, flash, workspace management) have equivalent
cfsutil commands you can run from the CFS Terminal. See the CFS Command Line Utility documentation for the full command reference.Zephyr-specific build notes
For Zephyr RTOS projects, CFS generates a defaultwest build command based on the board and target selected during workspace creation. Many scenarios require passing additional arguments to west or CMake.
- One-off KConfig override
- Overlay config file
- Shield selection
- Compiler flags via CMakeLists.txt
Pass KConfig flags directly on the command line for a single build without modifying The double dash
prj.conf. Use the CFS Terminal:-- passes everything that follows directly to CMake.Custom and modified tasks
CFS tasks can be customized to extend or replace the default behavior. Custom tasks appear alongside built-in tasks in the Actions view with aCFS: prefix.
Create a custom task
- Click the dropdown arrow in the Terminal panel and select Configure Tasks, then choose a task to copy, or
- In the Actions view, click Copy and Edit next to the task you want to duplicate.
.vscode/tasks.json. Edit the copy freely — the original task is unaffected.
Modify an existing custom task
- Click the dropdown in the Terminal panel, choose Configure Tasks, and select your previously created task, or
- Click Edit next to your custom task in the Actions view.
.vscode/tasks.json file opens in the editor for direct modification.
Troubleshooting
Build flags from environment variables override project settings
Build flags from environment variables override project settings
Environment variables such as
CC, CFLAGS, CXXFLAGS, LDFLAGS, LD, and others can silently override the flags CFS sets for your project, causing unpredictable build behavior.To list all active environment variables, run set in a Windows terminal or env on Linux/macOS. Unset any conflicting variables before building.Toolchain not found or SDK path incorrect
Toolchain not found or SDK path incorrect
If the build task fails with a toolchain-not-found error, open VS Code Settings and verify that
cfs.sdk.path points to the correct MSDK or Zephyr SDK installation directory. For workspace-specific overrides, edit .vscode/settings.json directly.Flash task fails: debugger not connected
Flash task fails: debugger not connected
The flash task requires an active debug probe connection. Verify that:
- The debug probe is physically connected to the correct header on your evaluation board.
- The USB cable is connected to your computer and the board is powered on.
- The correct driver is installed (Segger J-Link, OpenOCD, or ICE as required by your board).
- No other application (such as a GDB server or JLink utility) is holding the probe open.
Stale artifacts causing unexpected behavior (Zephyr)
Stale artifacts causing unexpected behavior (Zephyr)
If a Zephyr build produces unexpected results after changing configuration, run CFS: pristine build to remove all cached CMake and Ninja artifacts and force a clean compilation. This is also useful when switching between boards or overlay files.