Installation
Software Development Kits > Platform IO
Getting started with Visual Studio Code (VS Code)
This article will assume the user’s editor of choice is Visual Studio Code (VS Code).
Install Visual Studio Code for your platform from https://code.visualstudio.com/.
VS Code offers a rich user interface, and is highly extensible. Familiarity with VS Code is recommended when using the MM IoT SDK as PlatformIO heavily leverages UI features of the editor in which it is installed.
See https://code.visualstudio.com/docs/getstarted/userinterface for a full description of the UI elements. Notable elements relevant to PlatformIO, and referenced throughout this User Guide are shown in Figure 1.
Figure 1. The VS Code UI
In addition, the Command Palette (shown in Figure 2) can be opened with CTRL+SHIFT+p. This may also be opened by PlatformIO features that require additional user input.
Figure 2. The VS Code command palette
Install PlatformIO extension for VS Code
After installing VS Code, and launching it, follow the following steps to install the PlatformIO IDE extension (see Figure 3 below)
- Open Extensions from the activity bar (on the left).
- Type platformio to the search box and the PlatformIO IDE extension will appear)
- Click install and wait for the installation to complete. You should see a notification box in the lower right corner when this occurs.
Figure 3. Installing the PlatformIO extension in VS Code
Optionally, a user may find it useful to install the following extensions for VS Code :
- Python - language support package
- hjson - syntax highlighting for the configstore file
- C/C++ - syntax highlighting for C/C++.
Install the MM IoT-SDK for PlatformIO
Figure 4. Installation of external platform - navigation
- Click the PlatformIO icon from the Visual Studio Code activity bar on the left, and wait until you can see a quick access menu (see Figure 4 above). If the installation has not yet completed you may see “Initializing PlatformIO Core…” in the section where Quick Access is seen in Figure 3.
- Under Quick Access → PIO Home, select Platforms
- In the Platforms view, click Advanced Installation
- In the Window which pops up (see Figure 5), the user will need to enter the full path to the MM-IoT-SDK.zip file, prefixed with the file:// pseudo protocol. Note, different host platforms have different formats for file paths. For example, if the mm-iot-sdk zip archive is located in the Users download folder, they could look as follows
- Windows:
file://C:/Users/MorseMicro/Downloads/mm-iot-sdk-2.0.0.zip
- macOS:
file:///Users/MorseMicro/Downloads/mm-iot-sdk-2.0.0.zip
- Ubuntu:
file:///home/MorseMicro/Downloads/mm-iot-sdk-2.0.0.zip
- Windows:
- An internet connection is required here, as the platform installation needs to download the appropriate arm toolchain. This process can take some time. Once completed, a “Platform has been successfully installed” message will appear.
Figure 5. Installation of external platform - zip selection
Unless otherwise specified, PlatformIO will use the installed MM-IoT-SDK with the highest version number. Though it is possible to maintain multiple versions of the MM IoT-SDK in PlatformIO, it can often lead to confusion regarding which version a project is configured to use. In addition, having multiple installations of the SDK can result in file names that exceed the maximum path length on Windows. As a result, it is recommended to remove previous installations. This can be done by selecting “Uninstall” on old versions in the Platforms view.
For macOS, you may need to give VS Code permission to the folder where the MM-IoT-SDK.zip package resides. This can be done by opening Settings → Privacy & Security → Files & Folders and Enable folder access to VS Code (see Figure 6):
Figure 6. Allowing Visual Studio Code access to folders