Trident IoT SDK
 
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Loading...
Searching...
No Matches
VS Code Integration

Back to Trident IoT SDK

VSCode Build Tasks

Note
In the future, we will have better VSCode integration with a custom extension which is currently in development.

In the Z-Wave and Zigbee starting point example projects, we include a default .vsocde folder populated with a default tasks.json to make building your project in VSCode simpler.

To open a project in VSCode, open the root directory if your project in VSCode. You can do that by either opening VSCode and use "Open Folder" to the root of your project, or (if you've added the VSCode to your User Path) then you can simply type "code ." in your project directory on the command line after creating the project.

If you open tasks.json, you can see that these tasks merely invoke Trident-IoT's elcap binary, so you can add more tasks if there is something you need which is not added by default.

Default Tasks

The default tasks included in the project are:

  1. [Trident-IoT] Build (Debug) - Build for debug. This is the default build task which you can invoke with the keyboard shortcut (crtl-shift-b).
  2. [Trident-IoT] Build (Release) - Build for release. This will build the release version without debug information and optimization turned on.
  3. [Trident-IoT] Clean Build - Cleans your build. This is useful if you change your CMakeLists.txt or want to make sure your changes were brought over by cmake.
  4. [Trident-IoT] Check Build System - This runs elcap doctor which among other things makes sure everything you need is installed.
  5. [Trident-IoT] Discover Attached Devboards - You can use this to find the serial number of your development board(s).
  6. [Trident-IoT] Flash Hexfile - This will flash the default combined hex file including the bootloader. See your project's .toml file to change the defult hex file to a different board if building for multiple boards at the same time.
Note
For Flash Hexfile and Get Tokens tasks, you will need to edit the .vscode/tasks.json file directly to put the J-Link Serial Number (Not the board serial number or Unique ID). Use the Discover Attached Devboards to see them.

Z-Wave Specific Tasks:

- [Trident-IoT] Get Tokens (Z-Wave QR-Code/ DSK) - The tokens is a section of flash where the Z-Wave QR-Code / DSK is stored, so you can use this to read it out, so you can learn in your device to the PC-Controller.

Zigbee Specific Tasks:

- [Trident-IoT] ZAP - This task starts the ZAP (ZCL Advanced Platform) for configuring Zigbee clusters etc.

Adding J-Link Serial Number:

Some of the tasks need to know your development board's "Serial number" which is the J-Link Serial number. Check the label on your development board or run the Discover Attached Devboards task to see all attached J-Links. If can also use a normal J-Link debugger here for developing on more than just the development boards.

{
"label": "[Trident-IoT] Flash Hexfile",
"type": "shell",
"command": "elcap",
"args": [
"flash",
"--usb",
"EditVsCodeTasksJsonToAddDevboardSerialNumber"// Run [Trident-IoT] Discover Attached Devboards task, or manually with "elcap device discover" in the terminal, or check devboard label for serial number
],
"options": {
"cwd": "${workspaceFolder}"
},
"group": {
"kind": "build",
"isDefault": false
}
},

VSCode Intellisense

The c_cpp_properties.json helps VSCode's Intellisense work properly to find your source and header files, and highlight syntax errors etc.

Your intellisense may be highlighting GCC specific macros and unable to find standard library files because of the way we are containerizing the build system. This will be fixed in the future, but for right now, you can download an ARM GCC compiler, and put it in your c_cpp_properties.json like this:

{//Zigbee specific example but Z-Wave is similar
"configurations": [
{
"name": "T32CM11C",
"includePath": [
"${workspaceFolder}/**",
"${workspaceFolder}/bootloader/**",
"${workspaceFolder}/generated/**",
"${workspaceFolder}/hal_config_*/**",
"${workspaceFolder}/src/**",
"${workspaceFolder}/tridentiot-sdk/**"
],
"browse": {
"path": [
"${workspaceFolder}/**",
"${workspaceFolder}/bootloader/**",
"${workspaceFolder}/generated/**",
"${workspaceFolder}/hal_config_*/**",
"${workspaceFolder}/src/**",
"${workspaceFolder}/tridentiot-sdk/**"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
},
"defines": [
"TR_PLATFORM_T32CM11C"
],
"intelliSenseMode": "${default}",
"cStandard": "c17",
"cppStandard": "gnu++17"
"compilerPath": "ABSOLUTE_OR_RELATIVE_PATH_TO_GCC_HERE/arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi/bin/arm-none-eabi-gcc",//<--- Path to ARM GCC installation.
}
],
"version": 4
}

You should not have to do this in the future.

Notice the "defines" section. If you notice intellisense is not recognizing that a define or macro is defined, then you can add it there to force intellisense to recognize it.

VSCode Task Extensions

You can optionally install a VSCode extension like Task Runner to make the tasks show up on the left hand side column to be clickable button.

Note
If you have a CMake extension (which you likely do), you may need to clean your build first before building initially because the CMake extension may try to helpfully run CMake for you from your system's installation instead of the one inside of our container.

VSCode Project Settings

VSCode settings.json - You probably don't need to edit this file directly. The only thing we've added to this is { "files.eol": "\n" }, for Windows users to specify Unix line endings.