Search by Tags

Developing M4 Applications Using Visual Studio Code

 
Article updated at 23 Aug 2019
Subscribe for this article updates

Visual Studio Code can be used to edit the source code, build the application and finally debug it. Toradex provides the necessary configuration files and instructions to setup your system.

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.

Understanding the purpose of individual components helps to debug potential problems and understand the behavior of the system. Therefore I want to first give an overview over these parts.

Even though there are 10 individual packages to install, installation is a simple process. The packages can be installed in any order (well, almost: VSCode must be installed before VSCode plugins can be installed).

# logo Description
1 Visual Studio Code
You can look at VSCode as an intelligent text editor which provides an extensive framework to add functionality through plugins. There is more information on required plugins further down in this list.VSCode includes a project explorer, which can show the contents of one or multiple folders as a workspace.
2 GNU Arm Embedded Toolchain
This is the C/C++ compiler und linker along with additional tools. It is used to turn your source code into a binary executable.
3 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.
4 Segger J-Link (for J-Link hardware debugger only)
This software package contains the J-Link GDB server, which connects to VSCode on one side, and to the J-Link JTAG hardware on the other side.
5 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 hardware on the other side.
6 VSCode Plugin: 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.
7 VSCode Plugin: Cortex-Debug
This plugin adds support for debugging ARM executables through a GDB Server.
8 VSCode Plugins: CMake
Syntax highlighting for CMakeLists.txt
9 VSCode Plugin: ARM
Syntax highlighting for ARM assembly code
10 VSCode Plugin: Linker Script
Syntax highlighting for linker scripts

Installation Steps

Click the tab below to select whether you develop on a Windows or Linux host machine.

Installation Steps for Windows 10 machines

Visual Studio Code is still undergoing significant development. Therefore I will point out the version used at the time when these instructions were written.

  • Instructions were written in August 2019
  • Tested on a Windows 10 Build 1903

1. Installing Visual Studio Code

Details

2. Installing GNU Arm Embedded Toolchain

Details

3. Installing CMake

Details

4. Installing Segger J-Link

Details

5. Installing OpenOCD

Details

6. Installing C/C++ for Visual Studio Code

Details

7. Installing Cortex-Debug for Visual Studio Code

Details

8. Installing CMake for Visual Studio Code

Details

9. Installing ARM assembly highlighting for Visual Studio Code

Details

10. Installing Linker Script for Visual Studio Code

Details

Installation Steps for Linux machines

Note: Sorry, this documentation is not yet ready. Installation instructions for Linux are coming soon...

Visual Studio Code is still undergoing significant development. Therefore I will point out the version used at the time when these instructions were written.

  • Instructions were written in August 2019
  • Tested on Ubuntu 18.04.3 (running in a VirtualBox VM on a Windows 10 host)

1. Installing Visual Studio Code

Details

2. Installing GNU Arm Embedded Toolchain

Details

3. Installing CMake

Details

4. Installing Segger J-Link

Details

5. Installing OpenOCD

Details

6. Installing C/C++ for Visual Studio Code

Details

7. Installing Cortex-Debug for Visual Studio Code

Details

8. Installing CMake for Visual Studio Code

Details

9. Installing Cortex-Debug for Visual Studio Code

Details

10. Installing Linker Script for Visual Studio Code

Details