Telink VS Code Extension User Guide
Brief Introduction
Telink VS Code Extension can convert Telink IoT Studio projects to CMake projects usable in VS Code, and supports developing SDKs for Telink TL32 and TC32 series chips within VS Code.
Convert Telink IoT Studio Project to CMake Project
Run the conversion function if the repository is being used the first time.
Open an SDK directory in VS Code workspace, convert the Telink IoT Studio project to CMake project, and select the project to convert.
After conversion, it can be viewed through project - target - source in PROJECT OUTLINE.
To convert multiple projects, repeat the above steps and select other projects.
CMake Configuration and Building
When running build commands, the extension automatically executes the configuration by default.
Build
The development environment of the computer must have CMake and Toolchain installed. Refer to the next subsection for the required software installation.
Click the rocket icon 🚀 next to the target to start building.
After building, built artifacts and logs can be viewed.
Clean
Right-click the target, select Clean Target, or the clean button below.
Required Software Installation
Since the Toolchain file is relatively large, there are multiple approaches to applying it.
(1) Telink Tools Installer (Recommended without Telink IoT Studio, around 2GB, includes commonly used Toolchain/BDT/CMake)
Extension auto-detects Tools paths after installation.
(2) Local Configuration
Reuse existing Toolchain if Telink IoT Studio is installed.
(3) Online Installation
Files are large, network speed may impact installation time.
Local Toolchain Configuration
If a corresponding Toolchain is missing during building, a selection box pops up on the bottom right side.
Click Configure
, select gcc
file (riscv32-elf-gcc
or tc32-elf-gcc
) from the corresponding Toolchain
path.
CMake Installation and Configuration
If CMake is not installed:
(1) Download installer from CMake website (2) Manually add CMake's installation path to the system environment variables.
CMake Project Structure
(1) CMakeLists.txt
: CMake project function, differs for TL/TC series.
(2) cmake_configs
: SDK config file (*_cmake.json
). Do not manually modify this file, it may cause failures since the CMakeLists.txt will read the configuration to generate projects.
(3) cmake_builds
: Intermediate project compile file.
If CMake is not installed, install it manually.
Project Management
Add/Delete Project and Target
The + signs next to the PROJECT OUTLINE and project name nodes correspond to "Add Project", "Add target".
Enter new names in the input box and choose:
- Create blank project/target
- Clone existing project/target
The advantage of cloning an existing project over creating a blank one is that similar project can be added with simple modifications.
File Operations
Add/Delete Files
Right-click the folder, enter new name in the input box.
Import/Remove References
Import Reference: Import existing file to target source (no file creation).
Remove Reference: Remove reference from target source (no file deletion).
Toolchain Parameter Configuration
Right-click target to enter the Toolchain Configuration interface, which is the same as Telink IoT Studio.
Notes on Telink IoT Studio Parameters
${ConfigName} ${ProjName}
are expanded to actual values during project conversion.
${workspace_loc:/${ProjName}}
paths are converted to ${CMAKE_CURRENT_SOURCE_DIR}
.
Below is an example of a shell sentence
${workspace_loc:/${ProjName}}/../../../tools/tl_check_fw_tool/tl_check_fw.sh ${ConfigName} ${ProjName}
>>> after converted >>>
${CMAKE_CURRENT_SOURCE_DIR}/project/tlsr_riscv/B92/../../../tools/tl_check_fw_tool/tl_check_fw.sh UART_Demo TL_PLATFORM_SDK_B92
Similar to the -I -L path parameter, the recommended format in Telink IoT Studio is${workspace_loc:/${ProjName}}
.
Custom Script (Pre/Post Build)
The Telink extension supports executing custom scripts during the pre/post-build phase.
However, it should be noted that there are differences in the project structure between Telink IoT Studio and VS Code, and relative paths cannot be directly used in commands.
If the current project is a Telink IoT Studio project and users want to execute pre/post-build normally after conversion, then do not directly write like ../../
, use ${workspace_loc:/${ProjName}}
to refer to the project's root directory instead.
For example, a script is written as below
"../../../tools/tl_link_load.sh" "../../../platform/boot/tl321x/boot_tl321x.link" "${workspace_loc:/${ProjName}}/boot.link"
"${workspace_loc:/${ProjName}}/../../tools/tl_link_load.sh" "${workspace_loc:/${ProjName}}/../../platform/boot/tl321x/boot_tl321x.link" "${workspace_loc:/${ProjName}}/boot.link"
Known bug
- Configuration options may not be fully converted, because some settings are not explicitly defined in the .cproject file, and they are controlled by IDE by default.