Skip to content

Latest commit

 

History

History
171 lines (102 loc) · 7.37 KB

vscode.md

File metadata and controls

171 lines (102 loc) · 7.37 KB

Using Visual Studio Code with the NXP MIMXRT1060-EVK Evaluation Kit

This guide describes how to use Visual Studio Code to build, flash, and debug with the NXP MIMXRT1060-EVK Evaluation Kit.

This is a companion to the Quickstart Guide. Please ensure you have completed the following steps of the Quickstart Guide before continuing.

  1. Clone the repo for the quickstart.

  2. Create the cloud components.

  3. Configure Azure IoT connection settings.

Note: It is not necessary to install the tools described in the quickstart guide. Tool installation will be covered in the next section below.

Configure Your Development Environment with vcpkg-ce

This section shows how to configure your development environment with the new vcpkg-ce, short for "configure environment", bootstraps project dependencies from a manifest file, vcpkg-configuration.json. This makes it easy to express which compilers and build tools are required by a project. Upon activation, the tools specified by the manifest are added to the path of the current shell. If the tools are not present, vcpkg-ce acquires them and installs them to a common location. The vcpkg-ce tool runs in user mode without elevation.

vcpkg-ce is in early preview. To report problems or provide feedback, please open issues at https://github.com/microsoft/vcpkg-ce.

Windows 10

  1. Download and install Visual Studio Code.

  2. Download and install the SEGGER J-Link Software and Documentation Pack V7.00 or greater. Note: Version V7.00 or greater is required to support the on-board DAPLink probe.

  3. Open an Administrator PowerShell terminal and enable execution of PowerShell scripts.

    Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine
  4. Add the J-Link installation directory to the Path environment variable. Assuming you have chosen the default installation directory, you can do so by running the following command:

    [Environment]::SetEnvironmentVariable("Path", $env:Path + ";C:\Program Files (x86)\SEGGER\JLink", "Machine")
  5. Open a new PowerShell terminal and navigate to the following path in the repo.

    getting-started\NXP\MIMXRT1060-EVK

  6. Install vcpkg-ce.

    iex (iwr -useb aka.ms/vcpkg-init.ps1)
  7. Download, install, and activate developer tools.

    vcpkg activate
  8. Run the following code to confirm that CMake version 3.20 or later is installed.

    cmake --version
  9. Use this terminal to complete the remaining tasks in this guide.

Ubuntu 20.04

  1. Download and install Visual Studio Code.

  2. Download and install the SEGGER J-Link Software and Documentation Pack V7.00 or greater. Choose the installer as appropriate for your Linux distribution. Note: Version V7.00 or greater is required to support the on-board DAPLink probe.

  3. Open a new bash terminal and navigate to the following path in the repo.

    getting-started\NXP\MIMXRT1060-EVK

  4. Install curl and libncurses5 using your package manager.

    sudo apt install curl libncurses5
  5. Install vcpkg-ce.

    . <(curl aka.ms/vcpkg-init.sh -L)
  6. Download, install, and activate developer tools.

    vcpkg activate
  7. Ensure the following lines in getting-started\NXP\MIMXRT1060-EVK.vscode\tasks.json have been commented out.

    // This must be commented out to run on Linux.
    // "options": {
    //     "shell": {
    //         "executable": "cmd.exe",
    //         "args": [ "/c" ]
    //     }
    // }
  8. Run the following code to confirm that CMake version 3.20 or later is installed.

    cmake --version
  9. Use this terminal to complete the remaining tasks in this guide.

Using Visual Studio Code

  1. Connect the Micro USB cable from the DevKit to your computer. If it is already connected, disconnect and reconnect it.

  2. Launch Visual Studio Code from a PowerShell terminal.

    code .
  3. Accept the popup that appears in the lower right corner prompting you to install recommended extensions.

    recommended-extensions

    If it does not appear, you can also invoke the “Extensions: Show Recommended Extensions” command from the Command Palette (Ctrl-Shift-P).

    Completing this step will install the following extensions: C/C++ and CMake Tools.

  4. If prompted for a Configure Preset, select "arm-gcc-cortex-m7".

    configure-preset

  5. If on the right side of the Status Bar, No Build Preset is selected:

    build-preset

    Click it and choose the "arm-gcc-cortex-m7" Build Preset.

  6. Navigate to the Run and Debug view (Ctrl-Shift-D) and select the Launch configuration.

    launch-configuration

  7. Press F5 to start debugging the application. A dialog for the J-Link Terms of use may appear. Click the check box “Do not show this message again for today” and accept the terms of use if you agree.

    Visual Studio Code will build and flash the application to the device, then pause the debugger at the application entry point.

  8. Press F5 to resume execution. The debugger is now running and connected the device.

Using Visual Studio Code's Embedded Tooling

Visual Studio Code now supports additional tooling to help embedded programmers debug their applications: a Peripheral Viewer, a RTOS Viewer, and a Serial Monitor.

Note that if you don't see the aforementioned tooling, ensure that you have the extensions installed, Embedded Tools and Serial Monitor

Restoring Your Development Environment

vcpkg-ce only modifies the path in the shell in which it is activated. If you close your shell and wish to restore the development environment in a future session:

  1. Open a new PowerShell terminal.

  2. Re-activate vcpkg-ce.

    . ~/.vcpkg/vcpkg activate
  3. Launch Visual Studio Code.

    code .