MATLAB Coder Interface for Visual Studio Code Debugging
Use Visual Studio Code to view and debug C and C++ code, in combination with supported MATLAB and Simulink workflows.
1.3K 次下载
更新时间
2024/9/11
MATLAB Coder Interface for Visual Studio Code Debugging
The MATLAB® Coder™ Interface for Visual Studio® Code™ Debugging support package allows you to use Visual Studio Code to view and debug C and C++ code. For example, code that you generate from MATLAB code and Simulink® models or code that you import from external libraries.
How to Install
You will need to install an extension in Visual Studio Code, by following the steps below:
- Download and install support package
- Open Visual Studio Code and navigate to the Extensions pane
- In the top right corner of the pane select "..." and "Install from VSIX..."
- Retrieve path of support package installation: matlabshared.supportpkg.getSupportPackageRoot()
- Navigate to the support package installation folder (from step 4) and select the VSIX file in "toolbox > targetframework > supportpackage > vscodedebug > extension > matlab-coder-interface-vscode-debugging.vsix"
Alternatively, if the code command is on your system path, you can install the extension by running this command in the MATLAB Command Window:
system("code --install-extension " + fullfile(matlabshared.supportpkg.getSupportPackageRoot(), "toolbox", "targetframework", "supportpackage", "vscodedebug", "extension", "matlab-coder-interface-vscode-debugging.vsix"))
Supported Workflows
The following workflows are supported with Visual Studio Code:
- Debug Generated Code During SIL Simulation (Simulink Coder™ and Embedded Coder®)
- Debug Generated Code During SIL Execution (MATLAB Coder)
- From R2022b, Debug Custom C/C++ Code (Simulink) using Simulate custom code in a separate process
How to Uninstall
To disable Visual Studio Code as debugger for the workflows listed above, uninstall this support package.
Requirements
General
- Visual Studio Code version 1.59.0 or above
- Visual Studio Code command line (see documentation)
- C/C++ extension by Microsoft®
Linux®
- For SIL debugging, MATLAB must be started from a terminal running a bash shell.
Mac®
- Xcode® or Command Line Tools are in default locations (/Applications/Xcode.app or /Library/Developer/CommandLineTools).
Windows®
- For SIL debugging, a version of MinGW® newer than 8.0 must also be installed. To configure the path to the newer GDB version, run the command: target.mingw.OverrideDebuggerPathForMinGWGDB.set(pathToGDB)
Compilers and Debuggers
- macOS®: Xcode & LLDB
- Linux: GCC & GDB
- Windows: MinGW GCC & MinGW GDB *
* MinGW needs to be installed separately. See MATLAB Support for MinGW-w64 C/C++ Compiler support package.
Support
If you have download or installation problems, please contact Technical Support - www.mathworks.com/contact_ts
MATLAB 版本兼容性
创建方式
R2022a
兼容 R2022a 到 R2024b 的版本
平台兼容性
Windows macOS (Apple 芯片) macOS (Intel) Linux标签
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!