Build, clean, flash, and debug tasks
After creating a workspace and configuring it in System Planner, you can run various tasks to create, flash, clean, and run applications.
Access the tasks
Tasks can be accessed in the following ways:
- Command Palette: Open the Command Palette (
Ctrl+Shift+PorCmd+Shift+Pon macOS), search for Tasks: Run Build Task or Tasks: Run Task, then select the desired task from the list. - Actions view: Click the CFS icon
in the Activity Bar, then choose a task from the Actions view. You can also create new custom tasks by clicking Copy and Edit 
next to each task. - Status Bar: Click a relevant icon (build, clean, flash, debug) on the left side of the Status Bar.
- From the menu: Go to Terminal > Run Build Task, then select the desired task.
Note
All tasks operate in the same way independent of the mechanism used to invoke them.
Tasks
CFS: build
The CFS: build task compiles the code for your project. For MSDK projects, this uses make. For Zephyr projects, this uses west build. Build configuration variables (such as target, board, and toolchain) are read from the workspace .vscode/settings.json file (VS Code settings) and are set during workspace creation, or in the workspace, user, or system settings. The task creates the ./build directory, which contains the output binary and all intermediary object files.
Note
Shortcut: Ctrl + Shift + B (Windows/Linux) or Command + Shift + B (Mac).
The build task is also available with shortcuts on the left-hand side of the status bar.

CFS: pristine build
The CFS: pristine build task is available for Zephyr projects and performs a clean build from scratch, removing all previous build artifacts before compiling. This runs west build -b <board> --pristine=always, which ensures a completely fresh build without relying on cached build outputs. Use this task to guarantee a clean slate or troubleshoot build issues that may be caused by stale artifacts.
CFS: clean
The CFS: clean task cleans the build output, removing the ./build directory and all of its contents.
CFS: clean-periph
The CFS: clean-periph task runs CFS: clean and removes the build output for the MSDK peripheral drivers. Use CFS: clean-periph to recompile the peripheral drivers from source on the next build.
CFS: flash
The flash task runs CFS: build first, then flashes the output binary to the microcontroller using your configured debugger. The task name in the task picker will include the debugger type (for example, CFS: flash (OpenOCD) or CFS: flash (JLink)). After flashing completes, the target state (halted or running) depends on the debugger/runner; reset or power cycle the microcontroller, or use your debugger to resume execution as needed. A debugger must be connected correctly to use this task. See Connect hardware and Troubleshooting.
CFS: flash & run
The flash & run task runs CFS: build first, then flashes the output binary to the microcontroller and resumes execution of the program after flashing is complete. The task name in the task picker will include the debugger type (for example, CFS: flash & run (OpenOCD) or CFS: flash & run (JLink)).
CFS: erase
The erase task erases all of the application code in the flash memory bank using your configured debugger. The task name in the task picker will include the debugger type (for example, CFS: erase (OpenOCD) or CFS: erase (JLink)). After running this task, the target microcontroller is effectively blank. Use to recover from low power (LP) lockouts, bad firmware, or other issues.
CFS: debug
The CFS: debug task will launch the previous debug session. This may run the CFS: flash command before running the application and halting at the breakpoint at main(). The executable file will need to be built using the CFS: build command before debugging. Care should be made to ensure the executable is up to date before debugging.
Using the activity view you can select a debug session to launch. See Debugging an application for more information.
Create custom tasks
To create a custom build or flash task, do one of the following:
- Click the dropdown arrow in the Terminal panel and select Configure Tasks. Then choose a task from the list to copy.
- In the Actions view, click Copy and Edit

next to the task you want to duplicate.
This opens your project's .vscode/tasks.json file and adds a copy of the selected task. You can now edit the copy without affecting the original.
The new task also appears as a separate entry in the Actions view, with a label that starts with CFS: (for example, CFS: build).
Tip
To personalize your task, append a description to the label in tasks.json. For example: "label": "CFS: build MAX32690-debug"
Modify build tasks
To modify a custom build or flash task, do one of the following:
- Click the dropdown arrow in the Terminal panel and select Configure Tasks. Then choose the task your previously created from the list.
- In the Actions view, click Edit

next to your custom task.
The .vscode/tasks.json file opens in your editor. You can update the task directly in the file.
For more information on modifying build tasks, see Custom tasks
Custom tasks with dependencies
Tasks defined in .vscode/tasks.json support the built-in dependsOn and dependsOrder properties in VS Code. See Compound tasks for the syntax.
CodeFusion Studio also discovers custom tasks defined in a separate .vscode/cfs.tasks.json file in the project directory. These tasks appear in the Actions view alongside tasks from tasks.json, and support their own dependsOn property, which runs the dependency task first when the task is started from the Actions view. See Run a task before another task with dependsOn for the file format and examples.
In the Actions view:
- CodeFusion Studio resolves a dependency label only to a CFS task in the same project; it doesn't resolve tasks from
.vscode/tasks.json. - The Actions view only lists tasks whose label contains a recognized keyword, such as
build,clean,erase,flash, ordocumentation. A dependency task with an unrelated label still runs correctly but won't appear in the Actions view itself. - If a dependency task fails, CodeFusion Studio stops and doesn't run the dependent task. A notification names the failed task, its exit code, and the dependent task that was skipped.









