Task Integration

The extension provides custom task providers for both Zephyr and CMake projects.

Zephyr Task Provider

Type: onsemi.zephyr

Available Commands:

  • build: Build the project

  • flash: Flash firmware to device

  • clean: Clean build artifacts

  • menuconfig: Open Kconfig menuconfig

  • guiconfig: Open Kconfig GUI

  • ram-report: Generate RAM usage report

  • rom-report: Generate ROM usage report

Task Definition Example (tasks.json):

{
  "version": "2.0.0",
  "tasks": [
    {
      "type": "onsemi.zephyr",
      "label": "Build Zephyr Project",
      "projectPath": "${workspaceFolder}",
      "command": "build",
      "configName": "debug",
      "args": ["--pristine"],
      "options": {
        "cwd": "${workspaceFolder}",
        "env": [
          {
            "name": "CONF_FILE",
            "value": "prj_debug.conf"
          }
        ]
      },
      "problemMatcher": ["$gcc"],
      "group": {
        "kind": "build",
        "isDefault": true
      }
    },
    {
      "type": "onsemi.zephyr",
      "label": "Flash to Device",
      "projectPath": "${workspaceFolder}",
      "command": "flash",
      "configName": "debug",
      "problemMatcher": []
    }
  ]
}

Task Properties:

  • projectPath (required): Path to the project folder

  • command (required): Command to execute (build, flash, clean, etc.)

  • args: Additional command-line arguments

  • configName: Build configuration name to use

  • options.cwd: Working directory for the task

  • options.env: Additional environment variables

CMake Task Provider

Type: onsemi.cmake

Available Commands:

  • configure: Configure CMake project

  • build: Build the project

  • clean: Clean build artifacts

  • cleanRebuild: Clean and rebuild

Task Definition Example (tasks.json):

{
  "version": "2.0.0",
  "tasks": [
    {
      "type": "onsemi.cmake",
      "label": "Configure CMake",
      "projectPath": "${workspaceFolder}",
      "command": "configure",
      "configName": "Debug-CM33",
      "buildType": "",
      "generator": "Ninja",
      "toolchainFile": "cmake/arm-toolchain.cmake",
      "cacheVars": [
        {
          "name": "CMAKE_EXPORT_COMPILE_COMMANDS",
          "value": "ON"
        }
      ],
      "problemMatcher": ["$gcc"]
    },
    {
      "type": "onsemi.cmake",
      "label": "Build CMake Project",
      "projectPath": "${workspaceFolder}",
      "command": "build",
      "configName": "Debug-CM33",
      "buildType": "",
      "targets": ["blinky"],
      "problemMatcher": ["$gcc"],
      "group": {
        "kind": "build",
        "isDefault": true
      }
    }
  ]
}

Task Properties:

  • projectPath (required): Absolute path to the project folder

  • command (required): Command to execute

  • args: Additional arguments

  • configName: Build configuration name

  • buildType: CMake build type (Debug, Release, etc.)

  • generator: CMake generator (Ninja, Unix Makefiles, etc.)

  • toolchainFile: Absolute path to CMake toolchain file

  • cacheVars: CMake cache variables

  • configurationPreset: CMake configuration preset name

  • buildPreset: CMake build preset name

  • targets: Build targets to compile

  • options.cwd: Working directory

  • options.env: Environment variables