|
|
Line 2: |
Line 2: |
| == Developing Cortex M3/M4 Applications Using Visual Studio Code == | | == Developing Cortex M3/M4 Applications Using Visual Studio Code == |
| [https://code.visualstudio.com/ Visual Studio Code] can be used to edit the source code, build the application and finally debug it. | | [https://code.visualstudio.com/ 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 [https://code.visualstudio.com/ 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
| |
− | * [https://code.visualstudio.com/ VSCode] must be installed before [https://code.visualstudio.com/ VSCode] plugins can be installed.
| |
− |
| |
− | == 1. Visual Studio Code and Plugins ==
| |
− |
| |
− | === Visual Studio Code ===
| |
− | We can look at [https://code.visualstudio.com/ VSCode] as an intelligent text editor which provides an extensive framework to add functionality through plugins. [https://code.visualstudio.com/ 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 ====
| |
− | [https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm 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 ====
| |
− | [https://cmake.org/ CMake] is a tool which turns compiler-independent project definitions into compiler-specific project definitions. [https://cmake.org/ CMake] converts these into makefiles that can be processed by the [https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm GNU ARM Embedded Toolchain].
| |
− |
| |
− | === 3. Debugger Tools ===
| |
− | ==== OpenOCD ====
| |
− |
| |
− | [http://openocd.org/ 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 [https://code.visualstudio.com/ VSCode] on one side, and to the J-Link JTAG/SWD hardware on the other side.
| |
− |
| |
− | == Chocolatey (Software Management For Windows) ==
| |
− | * <big>The Windows versions of required software will be installed using</big> [https://chocolatey.org/ Chocolately]
| |
− | * Install/Setup [https://docs.chocolatey.org/en-us/choco/setup Chocolatey] on windows 10
| |
− | * Search for available [https://community.chocolatey.org/packages packages]
| |
− | * Always run [https://chocolatey.org/ Chocolatey] (choco) under Power Shell (as an administrator)
| |
− |
| |
− | === 4. Install VSCode ===
| |
− | ==== Ubuntu ====
| |
− | * Please follow this <span style=""><font size="+0.5">[[EmSys:Setting up Embedded ARM Lab#4. Install Visual Studio Code | link]]</font></span> to install Visual Studio Code Application.
| |
− | * For more options, please refer to the [https://code.visualstudio.com/docs/setup/linux Visual Studio Code setup page].
| |
− |
| |
− | ==== Windows ====
| |
− |
| |
− | > choco install vscode
| |
− |
| |
− | === 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
| |
− | <br />
| |
− | Or we can use in the IDE the menu <big>View > Extensions</big>.
| |
− | # Open VSCode
| |
− | # Select <big>View → Extensions</big>
| |
− | #: This will show the Extension sidebar
| |
− | # In the search box above the Extension sidebar, type the '''Code name''' 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
| |
− |
| |
− |
| |
− | {| class="wikitable" style="margin: auto; border-style: solid; border-width: 4px"
| |
− | |-
| |
− | ! <center>Icon</center> !! <center>Plugin Name</center> !! <center>Required/Optional</center> !! <center>Code Name</center>
| |
− | |-
| |
− | | [[image:vscode_plugin_c_cpp.png|80px]] || C/C++ || Required || ms-vscode.cpptools
| |
− | |-
| |
− | | [[image:vscode_plugin_cortex-debug.png|80px]] || Cortex-Debug || Required || marus25.cortex-debug
| |
− | |-
| |
− | | [[image:vscode_plugin_CMake_Syntax_Highlighting.png|80px]] || CMake Syntax Highlighting || Optional || twxs.cmake
| |
− | |-
| |
− | | [[image:vscode_plugin_ARM_Assembly_highlighting.png|80px]] || ARM Assembly highlighting || Optional || dan-c-underwood.arm
| |
− | |-
| |
− | | [[image:vscode_plugin_Linker_Script.png|80px]] || Language support for GNU linker script || Optional || Zixuan Wang
| |
− | |}
| |
− |
| |
− |
| |
− | Below is our installed extensions (menu <big>File > Preferences > Extensions</big>):
| |
− |
| |
− | [[image:vscode_armdev_plugins.png|center]]
| |
− |
| |
− | == 6. Installing Build Tools ==
| |
− | === Ubuntu ===
| |
− | ==== GNU Arm Embedded Toolchain ====
| |
− | * Please follow this <span style=""><font size="+0.5">[https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads link] to install GNU ARM Embedded Toolchain
| |
− | * OR, we can install using apt
| |
− |
| |
− | $ sudo apt update
| |
− | $ sudo apt install gcc-arm-none-eabi binutils-arm-none-eabi
| |
− |
| |
− | ==== Make and CMake ====
| |
− | $ sudo apt update
| |
− | $ sudo apt install make cmake
| |
− |
| |
− | === Windows ===
| |
− | ==== GNU Arm Embedded Toolchain ====
| |
− | > choco install gcc-arm-embedded
| |
− |
| |
− | ==== Make ====
| |
− | > choco install make
| |
− |
| |
− | ==== CMake ====
| |
− | > choco install cmake
| |
− |
| |
− | == 7. Installing Debugging Tools ==
| |
− |
| |
− | === OpenOCD ===
| |
− | ==== Ubuntu ====
| |
− | $ sudo apt-get update
| |
− | $ sudo apt-get install openocd
| |
− |
| |
− | ==== Windows) ====
| |
− | > choco install openocd
| |
− |
| |
− | == See Also ==
| |
− | * [[EmSys:Using Visual Studio Code for ARM Development – Workspace and Project(s) | Using Visual Studio Code for ARM Development – Workspace and Project(s)]]
| |
− | * [[EmSys:Using Visual Studio Code for ARM Development – Include Paths | Using Visual Studio Code for ARM Development – Include Paths]]
| |
− | * [[EmSys:Using Visual Studio Code for ARM Development – Defines | Using Visual Studio Code for ARM Development – Defines]]
| |
− | * [[EmSys:Using Visual Studio Code for ARM Development – Build Tasks | Using Visual Studio Code for ARM Development – Build Tasks]]
| |
− | * [[EmSys:VSCode Cortex-Debug Launch Configurations | VSCode Cortex-Debug Launch Configurations]]
| |
− | * [[EmSys:VSCode Cortex-Debugging | VSCode Cortex-Debugging]]
| |