|
| 1 | +# Using Visual Studio with the MXChip AZ3166 IoT DevKit |
| 2 | + |
| 3 | +This guide describes how to use Visual Studio to build, flash, and debug with the **MXChip AZ3166 IoT DevKit**. |
| 4 | + |
| 5 | +This is a companion to the [Quickstart Guide](https://docs.microsoft.com/en-us/azure/iot-develop/quickstart-devkit-mxchip-az3166). Please ensure you have completed the following steps of the Quickstart Guide before continuing. |
| 6 | + |
| 7 | +1. [Clone the repo for the quickstart](https://docs.microsoft.com/en-us/azure/iot-develop/quickstart-devkit-mxchip-az3166#clone-the-repo-for-the-quickstart). |
| 8 | + |
| 9 | +1. [Create the cloud components](https://docs.microsoft.com/en-us/azure/iot-develop/quickstart-devkit-mxchip-az3166#create-the-cloud-components). |
| 10 | + |
| 11 | +1. [Configure Wi-Fi and Azure IoT connection settings](https://docs.microsoft.com/en-us/azure/iot-develop/quickstart-devkit-mxchip-az3166#add-configuration). |
| 12 | + |
| 13 | + _*Note: It is not necessary to install the tools described in the quickstart guide. Tool installation will be covered in the next section below.*_ |
| 14 | + |
| 15 | +## Configure Your Development Environment with vcpkg `ce` |
| 16 | + |
| 17 | +This section shows how to configure your development environment with the new vcpkg `ce` tool: `ce`, short for "configure environment", bootstraps project dependencies from a manifest file, `environment.yaml`. 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, `ce` acquires them and installs them to a common location. The `ce` tool runs in user mode without elevation. |
| 18 | + |
| 19 | +> `ce` is in early preview prior to being integrated as a part of `vcpkg`. To report problems or provide feedback, please open issues at https://github.com/microsoft/vcpkg-ce. |
| 20 | +
|
| 21 | +### Windows 10 |
| 22 | + |
| 23 | +1. Download and install [Visual Studio](https://visualstudio.microsoft.com/downloads/). |
| 24 | + |
| 25 | +1. Download and install the [ST-LINK Drivers](https://www.st.com/en/development-tools/stsw-link009.html). Restart your computer after installation is complete. |
| 26 | + |
| 27 | +1. Open an Administrator PowerShell terminal and enable execution of PowerShell scripts. |
| 28 | + |
| 29 | + ```PowerShell |
| 30 | + Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine |
| 31 | + ``` |
| 32 | +
|
| 33 | +1. Open a new PowerShell terminal and navigate to the following path in the repo: |
| 34 | +
|
| 35 | + > *getting-started\MXChip\AZ3166* |
| 36 | +
|
| 37 | +1. Install `ce`. |
| 38 | +
|
| 39 | + ```PowerShell |
| 40 | + iex (iwr -useb aka.ms/install-ce.ps1) |
| 41 | + ``` |
| 42 | +
|
| 43 | +1. Review the end-user license agreement at https://aka.ms/vcpkg-ce-eula.txt. Run the following command to accept. |
| 44 | +
|
| 45 | + ```PowerShell |
| 46 | + ce --accept-eula |
| 47 | + ``` |
| 48 | +
|
| 49 | +1. Download, install, and activate developer tools. |
| 50 | +
|
| 51 | + ```PowerShell |
| 52 | + ce activate |
| 53 | + ``` |
| 54 | +
|
| 55 | +1. Run the following code to confirm that CMake version 3.20 or later is installed. |
| 56 | +
|
| 57 | + ```PowerShell |
| 58 | + cmake --version |
| 59 | + ``` |
| 60 | +
|
| 61 | +1. Use this terminal to complete the remaining tasks in this guide. |
| 62 | +
|
| 63 | +## Using Visual Studio |
| 64 | +
|
| 65 | +1. Connect the Micro USB cable from the DevKit to your computer. If it is already connected, disconnect and reconnect it. |
| 66 | +
|
| 67 | +1. Launch Visual Studio. |
| 68 | +
|
| 69 | + ```Shell |
| 70 | + start devenv . |
| 71 | + ``` |
| 72 | +
|
| 73 | +1. Ensure that both the Configure Preset and the Build Preset are set to "arm-gcc-cortex-m4" |
| 74 | + |
| 75 | +  |
| 76 | +
|
| 77 | +1. Ensure that the "Launch" target is selected as the Debug Target. |
| 78 | + |
| 79 | +  |
| 80 | +
|
| 81 | +1. Press `F5` to start debugging the application. |
| 82 | +
|
| 83 | + > Visual Studio will build and flash the application to the device, then pause the debugger at the application entry point. |
| 84 | +
|
| 85 | +1. Press `F5` to resume execution. The debugger is now running and connected the device. |
| 86 | +
|
| 87 | +## Restoring Your Development Environment |
| 88 | +
|
| 89 | +`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: |
| 90 | +
|
| 91 | +1. Open a new terminal. |
| 92 | +
|
| 93 | +1. Re-activate `ce`. |
| 94 | +
|
| 95 | + ```Shell |
| 96 | + . ~/.ce/ce activate |
| 97 | + ``` |
| 98 | +
|
| 99 | +1. Launch Visual Studio. |
| 100 | +
|
| 101 | + ```Shell |
| 102 | + start devenv . |
| 103 | + ``` |
0 commit comments