TI Embedded Debug for VS Code
TI Embedded Debug for VS Code leverages open-source tools like OpenOCD and GDB to provide a comprehensive debugging experience across multiple TI device families, including popular platforms such as MSPM0 Microcontrollers and SimpleLink™ Wireless Connectivity Devices.
With TI Embedded Debug for VS Code, you can:
- Connect to and debug TI devices directly within your VS Code environment
- Use the familiar VS Code debugger interface to set breakpoints, step through code, inspect variables, etc.
- Utilize various debugging interfaces, including JTAG and SWD
This extension's open-source foundation ensures that you can customize and extend your debugging experience as needed.
Supported Devices
The following TI device series are supported by this extension:
MSPM0 Microcontrollers:
SimpleLink™ Wireless Connectivity Devices:
- CC2340R5x
- CC26x0
- CC26x2
- CC13x0
- CC13x2
Installation
To set up most of what you need to start using this extension, simply click the "Install Dependencies" button in the TI Embedded Debug for VS Code sidebar view. You will be automatically prompted to install/update this extension's dependencies upon its activation. If you want this extension to automatically keep its dependencies up-to-date, modify the TI Embedded Debug: Keep Dependencies Up To Date
configuration in your VS Code settings.
If you don't already have libusb (many systems do), follow installation instructions at libusb.info.
On Linux systems, you will need to run a script to install udev rules specific to TI devices. This script automatically gets downloaded as part of the dependency installation, but needs to be run manually due to requiring sudo priviledges:
sudo ~/.config/Texas\ Instruments/ti-embedded-debug/ti-udev-rules/1.0.0/ti_permissions_install.sh --install
Extension Dependencies
OpenOCD
You can find more info on our OpenOCD builds here.
Viewing Installed Resources
You can find the location of the resources installed by this extension by examining the path assigned to the ti-embedded-debug.openocdExecutablePath
preference in your VS Code settings. Alternatively, search for the Texas Instruments/ti-embedded-debug
folder in your OS-specific application data directory:
On Windows:
~/.AppData/Local
On Linux:
~/.config
On Mac:
~/Library/Application Support
Creating a Launch Configuration
Once all dependencies have been installed, add a launch configuration to debug with OpenOCD. You can do this by clicking Run
> Add Configuration...
and selecting Cortex Debug: OpenOCD
. The example below shows what your launch configuration might look like for a project named my_project
:
{
"launch": {
"configurations": [
{
"cwd": "C:/Users/username/workspace/my_project/Debug",
"executable": "my_executable.out",
"name": "Debug with TI Embedded Debug for VS Code",
"request": "launch",
"type": "cortex-debug",
"servertype": "openocd",
"configFiles": [
"./interface/xds110.cfg",
"./board/<config_filename>.cfg"
],
"searchDir": [
"C:/Users/<username>/AppData/Local/Texas Instruments/ti-embedded-debug/openocd/<version>/share/openocd/scripts"
],
"runToEntryPoint": "main",
"showDevDebugOutput": "none",
"deviceName": "<deviceName>"
}
]
}
}
Note the use of relative paths outside of the cwd
and searchDir
properties. The searchDir
property is used to look for the device-specific configuration files referenced in the configFiles
property. If searchDir
is specified, paths in configFiles
are relative to searchDir
. Otherwise, they are relative to cwd
. All other paths (namely exectuable
) are relative to cwd
.
Inclusion of the deviceName
property is necessary in order to be able to view peripheral registers while debugging. It is a known issue that this property will show up as "not allowed" in launch.json
, despite working fine.
As our launch configurations are of type cortex-debug
, you may choose to reference the official Cortex-Debug debug attributes for more configuration options.
Before launching your first debug session, please read the Known Issues section of this README.
Viewing Peripheral Registers
In order to view peripheral registers via the XPERIPHERALS
view, you'll need to download the Cortex-Debug device-support extension corresponding to your device. Currently, the following device-support extensions are available on the Visual Studio Marketplace for Texas Instruments devices:
* Not maintained by Texas Instruments
Note that you must populate the deviceName
property in your launch configuration in order for these extensions to work.
Known Issues
Additional Post-Build Step Required for Debugging With TI ARM Clang Compiler Versions v4.0.3.LTS and Earlier
Programs compiled with the following versions of the TI ARM Clang compiler require an additional post-build command to be executed in order for debugging to work with this extension:
- v4.0.3.LTS and older
- v3.2.3.LTS and older
After generating your .out
file, run:
tiarmobjcopy --set-section-type=.TI.phattrs=1 my_executable.out
tiarmobjcopy
is available within your installed TI ARM Code Generation Tools directory. For example, if you are using v4.0.3 of the tools on Windows, check C:\ti\ti_cgt_arm_llvm_4.0.3.LTS\bin
. This issue is slated to be resolved in the releases of v4.0.4.LTS and v3.2.4.LTS of the compiler.
Additional Launch Configuration Property Required for Some CC13xx/CC26xx Devices
When debugging a CC13xx/CC26xx device, if you fail to start a debugging session, try adding the following property to your launch configuration:
"openOCDLaunchCommands": ["adapter_khz 2000"],
C Preprocessor Directives
VS Code may complain about specific usages of the #include
preprocessor directive, and may dim usages of other directives such as #define
. Warnings associated with these for TI example projects should generally not affect your ability to run/debug said projects.
Current-Line Highlight
The highlight corresponding to the currently-executed line may be off by one in certain instances.
deviceName Property
This launch.json property will show up as "not allowed", despite being usable by Cortex-Debug and its support packs.
Support
For technical support, please go through Texas Instrument's E2E support forum.