Azure Sphere hardware is available from multiple vendors, and each vendor may expose features of the underlying chip in different ways. However, through hardware abstraction, the sample applications in the Azure Sphere samples repository on GitHub are hardware independent. They will run on any Azure Sphere-compatible hardware without changes to the code.
Hardware abstraction is achieved through the use of hardware definition files. The samples are written to run on an abstract "sample appliance". For each supported board or module there is a hardware definition file called sample_appliance.json. This file maps the "peripherals" used by the sample appliance to the corresponding peripherals on the board or module. The contents of this file are used during the build procedure to update the app_manifest.json file and in compiling and packaging the sample.
To run any of the samples in the Azure Sphere samples repository on supported Azure Sphere hardware, you specify the directory that contains the sample_appliance.json file for the target hardware.
This README file describes how to set the target hardware for a sample. For additional information, see Manage hardware dependencies and Hardware abstraction files in the online documentation.
The samples support the following Azure Sphere hardware:
Development Kits
- MT3620 RDB
- Seeed MT3620 mini-dev board, which uses the AI-Link WF-M620-RSC1 module
- Avnet MT3620 SK, which uses the Avnet AES-MS-MT3620 module
- USI MT3620 BT EVB, which uses the USI USI-MT3620-BT-COMBO module
To set or change the target hardware for a sample application, use CMake function azsphere_target_hardware_definition
to specify the directory that contains the hardware definition file for your target hardware.
-
Clone the Azure Sphere samples repository on GitHub if you have not done so already.
Important: Clone the entire samples repository, instead of downloading an individual sample. The target hardware definition files for all the samples are stored in the HardwareDefinitions directory at the top level of the repository.
-
Open the CMakeLists.txt file, which is located in the sample source directory, and search for
azsphere_target_hardware_definition
. -
Change the value of the parameter
TARGET_DIRECTORY
to the target hardware definition directory. For example, to run the sample on the Avnet MT3620 Starter Kit:change
azsphere_target_hardware_definition(${PROJECT_NAME} TARGET_DIRECTORY "../../../HardwareDefinitions/mt3620_rdb" TARGET_DEFINITION "sample_appliance.json")
to
azsphere_target_hardware_definition(${PROJECT_NAME} TARGET_DIRECTORY "../../../HardwareDefinitions/avnet_mt3620_sk" TARGET_DEFINITION "sample_appliance.json")