Set up your Linux system for app development
The Azure Sphere SDK installation procedure installs the basic components needed to begin working with Azure Sphere on your Linux machine. To develop applications, however, you need to set up your development environment and possibly install additional tools.
- A computer running Ubuntu 18.04 LTS Edition
- Installation of the Azure Sphere SDK
Currently, a few early Seeed Azure Sphere MT3620 Development Kits require manual update. If you have such a kit that has never been used, you need to update the OS manually so that you can set up your development environment and connect your device to the internet. If you have any other type of dev kit (including the Seeed MT3620 Mini Dev Board), or if you have already used your dev kit, the OS will be updated as soon as you connect the device to the internet; manual update is not required.
You can develop Azure Sphere apps on Linux using either Visual Studio Code (VS Code) or the command-line interface (CLI). No matter which you use, you'll need to install CMake and Ninja on your development machine, if you don't already have them.
To install CMake and Ninja, use the following command:
sudo apt install cmake ninja-build
Do not install cmake or ninja using snap.
Install Visual Studio Code and the Azure Sphere extension
To develop apps with Visual Studio Code, you also need to install the Azure Sphere extension. You can find the Azure Sphere extension in the Extensions: Marketplace. Search for Azure Sphere and install the extension.
After installation, you should see these extensions in the ENABLED Extensions pane:
- Azure Sphere
- CMake Tools
When installation is complete, the Readme page for the extension opens. The Readme page provides useful information about VS Code configuration and requirements, and is updated along with the extension. You can view the Readme page any time by opening the Extensions pane and selecting Azure Sphere.
After installation, you will need to configure VS Code with the paths to the ARM Gnu Embedded Toolset and the Azure Sphere SDK installation directories:
- In the File menu select Preferences > Settings > Extensions > AzureSphere
- Under Azure Sphere: Arm Gnu Path enter the path to the ARM Gnu Embedded Toolset install directory.
- Under Azure Sphere: Sdk Path enter the path to the AzureSphere install directory.
Real-time capable application development
If you plan to develop real-time capable applications (RTApps), you need to install a GCC compiler for the real-time cores and set up hardware to display output from the app. You don't have to install this compiler or set up the hardware immediately, but you will need to do both so that you can compile applications for the real-time capable processor and view log output from those applications.
RT core toolchain
The Azure Sphere SDK for Linux does not include the GNU compiler that is required for the ARM Cortex-M4 processors on the real-time capable cores. You can find the GNU embedded toolchain for ARM that includes the compiler on the Arm developer website. Download the package appropriate for Ubuntu 18.04 LTS and consult the readme.txt for the appropriate installation instructions.
Set up hardware to display output
Currently, each real-time core supports a TX-only UART. RTApps can use this UART to send log output from the device. During application development and debugging, you typically need a way to read and display the output. The HelloWorld_RTApp_MT3620_BareMetal sample shows how an application can write to the UART.
Use a USB-to-serial adapter such as the FTDI Friend, to connect the UART on the real-time core to a USB port on your machine. You will also need a terminal emulator and a 115200-8-N-1 terminal to display the output.
To set up the hardware to display output from an RTApp, follow these steps. You'll need to refer to the documentation from your hardware manufacturer to determine the pin locations. If you're using an MT3620 RDB hardware (such as the MT3620 Dev Kit from Seeed Studios), interface headers may help you to determine the pin locations.
Connect GND on the USB-to-serial adapter to GND on your dev kit. On MT3620 RDB hardware, GND is Header 3, pin 2.
Connect RX on the USB-to-serial adapter to IOM4-0 TX on your dev kit. On MT3620 hardware, IOM4-0 TX is Header 3, pin 6.
Attach the USB-to-serial adapter to your machine.
Find out which port the serial device is connected to:
dmesg | grep ttyUSB
The port should be named ttyUSBn, where n indicates the port number.
Set up a terminal program to monitor the port. For example, the following commands set up Minicom to monitor port 5, but you can use any program you prefer:
sudo apt install minicom
sudo minicom -D /dev/ttyUSB5 -b 115200