Build and Deploy Applications
You can deploy Xrt applications to Azure Sphere from the following host development systems:
Note
Before deploying Xrt to Azure Sphere hardware, you must have set up the Azure Cloud as described in Set Up Azure Cloud.
Windows
You can use Visual Studio Code to configure, build and debug AzureSphere Xrt applications on Windows. To see how you can build on vscode see Building on Visual Studio Code.
Linux
You can use Visual Studio Code to configure, build and debug AzureSphere Xrt applications on Linux. To see how you can build on vscode see Building on Visual Studio Code.
You can also use the Linux command line to configure, build and debug Xrt Azure Sphere applications.
To build Xrt applications using the command line, enter the following commands:
mkdir build
cd build
cmake -G "Ninja" \
-DCMAKE_TOOLCHAIN_FILE="/opt/azurespheresdk/CMakeFiles/AzureSphereToolchain.cmake" \
-DAZURE_SPHERE_TARGET_TOOLS_REVISION="<azsphere-sdk-version>" \
-DAZURE_SPHERE_TARGET_API_SET="15" \
-DDEVICE="<device-service>" \
-DBOARD="<azure-board>" \
-DCMAKE_BUILD_TYPE="Debug" ..
ninja
cd ..
<azsphere-sdk-version>
can be found using:
azsphere --version
<device-service>
can be set to one of the following:
* virtual
* bacnet
* modbus
* ethernet-ip
azure-board
can be set to one of the following:
* mt3620-dk
* mt3620-g100
* mt3620-sk
* mt3620-sr620
To deploy and debug the built application using the command line, complete the following steps:
-
Deploy the application and initiate a Telnet session, using the following commands:
azsphere device sideload delete azsphere device sideload deploy --image-package build/xrt-app.imagepackage
-
Start the application in debug mode, using the following commands, where CID is the unique identifier for the application:
To monitor the application output, complete the following steps:azsphere device app stop --component-id ${CID} azsphere device app start --debug --component-id ${CID}
-
Connect using Telnet, as follows:
telnet 192.168.35.2 2342
-
Open another command shell and enter the following command:
/opt/azurespheresdk/Sysroots/15/tools/sysroots/x86_64-pokysdklinux/usr/bin/arm-poky-linux-musleabi/arm-poky-linux-musleabi-gdb xrt-app.out
-
In gdb, enter the following commands:
set sysroot /opt/azurespheresdk/Sysroots/15 target remote 192.168.35.2:2345 continue
-
View the debug output in the command shell.