Difference between revisions of "Developing Cortex M3 Applications Using Visual Studio Code"
From EdWiki
m (→5. Installing Visual Studio Code Plugins) |
m (→5. Installing Visual Studio Code Plugins) |
||
Line 47: | Line 47: | ||
=== 5. Installing Visual Studio Code Plugins === | === 5. Installing Visual Studio Code Plugins === | ||
+ | The easiest way is to install them from the command prompt inside the IDE: | ||
+ | code --install-extension ms-vscode.cpptools | ||
+ | code --install-extension metalcode-eu | ||
+ | code --install-extension marus25.cortex-debug | ||
+ | code --install-extension twxs.cmake | ||
+ | code --install-extension dan-c-underwood.arm | ||
+ | code --install-extension zixuanwang.linkerscript | ||
+ | |||
+ | Or we can use in the IDE the menu <big>View > Extensions</big>. | ||
# Open VSCode | # Open VSCode | ||
− | # Select View → Extensions | + | # Select <big>View → Extensions</big> |
#: This will show the Extension sidebar | #: This will show the Extension sidebar | ||
− | # In the search box above the Extension sidebar, type the <Codename> from the below table (without the | + | # In the search box above the Extension sidebar, type the <big><Codename></big> from the below table (without the angle brackets) or another reasonable search term |
# Click on the little green '''Install''' button which appears next to the found plugin | # Click on the little green '''Install''' button which appears next to the found plugin | ||
Line 58: | Line 67: | ||
! Icon !! <center>Plugin Name</center> !! <center>Required/Optional</center> !! <center>Code Name</center> | ! Icon !! <center>Plugin Name</center> !! <center>Required/Optional</center> !! <center>Code Name</center> | ||
|- | |- | ||
− | | [[image:vscode_plugin_c_cpp.png|80px]] || | + | /Debug/ |
+ | | [[image:vscode_plugin_c_cpp.png|80px]] || C/C++ || Required || ms-vscode.cpptools | ||
|- | |- | ||
− | | [[image:vscode_plugin_linux_arm_none_eabi.png|80px]] || | + | | [[image:vscode_plugin_linux_arm_none_eabi.png|80px]] || linux-arm-none-eabi || Required || metalcode-eu |
|- | |- | ||
− | | [[image:vscode_plugin_cortex-debug.png|80px]] || | + | | [[image:vscode_plugin_cortex-debug.png|80px]] || Cortex-Debug || Required || marus25.cortex-debug |
|- | |- | ||
− | | [[image:vscode_plugin_CMake_Syntax_Highlighting.png|80px]] || | + | | [[image:vscode_plugin_CMake_Syntax_Highlighting.png|80px]] || CMake Syntax Highlighting || Optional || twxs.cmake |
|- | |- | ||
− | | [[image:vscode_plugin_ARM_Assembly_highlighting.png|80px]] || | + | | [[image:vscode_plugin_ARM_Assembly_highlighting.png|80px]] || ARM Assembly highlighting || Optional || dan-c-underwood.arm |
|- | |- | ||
− | | [[image:vscode_plugin_Linker_Script.png|80px]] || | + | | [[image:vscode_plugin_Linker_Script.png|80px]] || Language support for GNU linker script || Optional || Zixuan Wang |
|} | |} | ||
Revision as of 10:38, 19 March 2022
Developing Cortex M3/M4 Applications Using Visual Studio Code
Visual Studio Code can be used to edit the source code, build the application and finally debug it.
Required Software Components
In contrast to fully integrated IDEs, setting up Visual Studio Code (short. VSCode) requires you to setup a number of software packages, which finally work together to build the complete development environment. The software packages can be split into three groups:
- VSCode and plugins
- ARM Build Tools (compiler etc.)
- Debug tools
The packages can be installed in any order (well, almost: VSCode must be installed before VSCode plugins can be installed). Understanding the purpose of individual components helps to debug potential problems and understand the behavior of the system.
1. Visual Studio Code and Plugins
Visual Studio Code
We can look at VSCode as an intelligent text editor which provides an extensive framework to add functionality through plugins. VSCode includes a project explorer, which can show the contents of one or multiple folders as a workspace. There is more information on required plugins further down in this list.
Required Plugins
C/C++:
This plugin offers many features to simplify editing of C/C++ code, including Syntax highlighting, Intellisense (finding definitions of symbols), auto-completion of keywords and identifier names, and marking syntax errors while typing.
Cortex-Debug:
This plugin adds support for debugging ARM executable through a GDB Server.
ARM:
Syntax highlighting for ARM assembly code
Linker Script:
Syntax highlighting for linker scripts
2. ARM Build Tools
GNU ARM Embedded Toolchain:
GNU ARM Embedded Toolchain is the C/C++ compiler and linker along with additional tools. It is used to turn your source code into a binary executable.
CMake:
CMake is a tool which turns compiler-independent project definitions into compiler-specific project definitions. NXP provides such independent project definitions in CMakeLists.txt files. CMake converts these into makefiles that can be processed by the GNU ARM Embedded Toolchain.
3. Debugger Tools
OpenOCD: (for generic hardware debugger)
OpenOCD is an open-source debugger, supporting a wide variety of JTAG hardware interfaces. For customers using a JTAG adapter other than the J-Link, this probably is the matching software. The package contains a GDB server, which connects to VSCode on one side, and to the J-Link JTAG/SWD hardware on the other side.
4. Installation Steps for Linux machines
- Please follow this link to install Visual Studio Code Application.
- For more options, please refer to the Visual Studio Code setup page.
5. Installing Visual Studio Code Plugins
The easiest way is to install them from the command prompt inside the IDE:
code --install-extension ms-vscode.cpptools code --install-extension metalcode-eu code --install-extension marus25.cortex-debug code --install-extension twxs.cmake code --install-extension dan-c-underwood.arm code --install-extension zixuanwang.linkerscript
Or we can use in the IDE the menu View > Extensions.
- Open VSCode
- Select View → Extensions
- This will show the Extension sidebar
- In the search box above the Extension sidebar, type the <Codename> from the below table (without the angle brackets) or another reasonable search term
- Click on the little green Install button which appears next to the found plugin
6. Installing Build Tools
- Please follow this link to install GNU ARM Embedded Toolchain
7. Installing Debugging Tools
Installing OpenOCD
$ sudo apt-get update $ sudo apt-get install openocd
See Also
- Using Visual Studio Code for ARM Development – Include Paths
- Using Visual Studio Code for ARM Development – Defines
- Using Visual Studio Code for ARM Development – Build Tasks
- VSCode Cortex-Debug Launch Configurations