-
Notifications
You must be signed in to change notification settings - Fork 7
Build Tools
The purpose of the update and build tools is to ensure the examples in this repo are updated to match the Azure Sphere SDK installed on your computer.
The PowerShell build tools are supported on Linux and Windows.
- Build All: Run the build_all tool after the Update Config tool. The build_all tool will build of all the projects in AzureSphereDevX.Examples folder. On completion, check the output of the build_all script to confirm success or failure of the build process.
For information on installing the following software on your computer, refer to the appendix.
- Install the Azure Sphere SDK
- Install PowerShell
- Install CMake and Ninja
- Install GNU Arm Embedded Toolchain. The build_all PowerShell script expects to find the toolchain at /opt/gcc-arm-none<version>
Each examples automatically updates the CMake Azure Sphere configuration to match the Azure Sphere SDK you've installed on your computer. This is fine for examples, but for production applications, setting the Azure Sphere configuration in CMake should be intentional and tested.
In the CMakeLists.txt file, the auto_generate_azsphere_config CMake function is called to generate the azsphere_configure_tools and azsphere_configure_api settings.
if (EXISTS "${CMAKE_SOURCE_DIR}/Tools/cmake/azsphere_config.cmake")
include(Tools/cmake/azsphere_config.cmake)
auto_generate_azsphere_config()
else()
# For information on setting tools revision and target api set see
# https://docs.microsoft.com/en-us/azure-sphere/app-development/using-cmake-functions
azsphere_configure_tools(TOOLS_REVISION "21.07")
azsphere_configure_api(TARGET_API_SET "10")
endif()
For production applications, remove this block and replace it with the following CMake commands.
azsphere_configure_tools(TOOLS_REVISION "<YOUR_TOOLS_VERSION>")
azsphere_configure_api(TARGET_API_SET "<THE_TARGET_API_SET_YOU_ARE_TESTING_AGAINST")
The Build All tool:
- builds all the examples in the \AzureSphereDevX.Examples folder.
- assumes the Azure Sphere toolchains are installed in their default locations.
Follow these steps to run the Build All tool:
- Open command prompt
- Navigate to the AzureSphereDevX.Examples folder
- Run the tool.
pwsh .\tools\build-tools\build_all.ps1
Note the completion status message to ensure all examples built correctly. The Build All tool will halt on the first error encountered.
These tools and the examples in the AzureSphereDevX.Examples folder assume the latest Azure Sphere SDK is installed on your computer and the new CLI V2 is enabled.
Install latest version of PowerShell on your computer.
The tools require CMake and Ninja to be installed on your computer.
From the CMake website, download and install CMake .MSI file. Install for the current user, and add to the path.
Download Ninja zip file for Windows. To install Ninja, open the zip file, select Extract All, and note the file location of the extracted file ninja.exe.
Add the directory containing ninja.exe to your PATH environment variable. To find information about setting this environment variable in Windows, type "path" in the Search box.
On Linux, install the CMake and Ninja applications using the following command.
sudo apt install cmake ninja-build
There are real-time applications examples in the AzureSphereDevX.Examples folder.
Install the GNU Arm Embedded Toolchain for Windows.
- Download the GNU Arm Embedded Toolchain for Windows.
- Install the GNU Arm Embedded Toolchain
On Linux, you need to manually install the GNU Arm Embedded Toolchain. The Build All tool assumes the installation location is in the opt folder.
To install the GCC ARM compiler, follow these steps:
- Download the GNU Arm Embedded Toolchain. At the time of writing this is Version gcc-arm-none-eabi-10.3-2021.07-x86_64-linux.tar.bz2.
- Install the downloaded package. The following installs the toolchain in the /opt directory.
sudo tar -xjvf gcc-arm-none-eabi-10.3-2021.07-x86_64-linux.tar.bz2 -C /opt
- Update your path. Open ~/.bashrc and add to the end.
export PATH=$PATH:/opt/gcc-arm-none-eabi-10.3-2021.07/bin
- Optional: The real-time core debugger relies on the libncurses.so.5 library. Depending on your system setup, this library may already be install, if not, then run the following commands.
sudo add-apt-repository universe
sudo apt-get install libncurses5
Tip: This assumes your default WSL distro is Ubuntu 20.04. Download required software from Windows. Navigate to Downloads folder, open a Windows command prompt in the Downloads folder, run
wsl
, this will open Ubuntu in the Windows downloads folder. From Ubuntu, install the required software.
-
Follow the guide to installing Azure Sphere for Linux tools.
-
Update the PATH statement in ~/.bashrc
export PATH=/opt/azurespheresdk/Tools_v2:$PATH export PATH=/opt/gcc-arm-none-eabi-10.3-2021.07/bin:$PATH
-
Update the PATH for current session.
source ~/.bashrc
AzureSphereDevX Examples Wiki
- Home
- Build Tools
- Adding the DevX library
- Azure IoT Hub Messaging
- Azure IoT Hub Device Twins
- Azure IoT Hub Direct Methods
- Avnet IoT Connect messaging
- Handling multithreaded async events
- Working with GPIO
- Working with UARTS
- Working with PWM
- Working with Event Timers
- Intercore Messaging
- Application termination
- Deferring updates
- Utility functions
- Tools and scripts
- Hardware Definitions