Azure RTOS NetX Duo
Azure RTOS NetX Duo is a real time implementation of the TCP/IP standards that works exclusively with Azure RTOS ThreadX as its Real-Time Operating System.
Additionally, Azure IoT Middleware for Azure RTOS is available as an addon to provide platform specific binding code between the Azure RTOS and the Azure SDK for Embedded C which is made available through NetX Duo. This addon enables applications to connect to and use services of Azure IoT Hub.
In its default configuration, Azure RTOS NetX Duo comes with Azure RTOS FileX enabled to support server protocol handlers. However, this has been turned off as Azure RTOS FileX is not provided by the Open IoT SDK.
Fetching
In your application's CMakeLists.txt
, include netxduo
and its dependency, threadx
, in the IOTSDK_FETCH_LIST
variable, alongside any other components you need to fetch:
This must be done before your application's
CMakeLists.txt
adds the Open IoT SDK.
Configuration
Available configuration macros are documented in nx_user_sample.h
from the Azure RTOS NetX Duo
repository. This nx_user_sample.h
is also used as the default configuration file, unless you override any macros.
If you would like to override any default configuration macros:
- In your application's directory, create a
netxduo-config/nx_user.h
file. - In the
nx_user.h
file you have just created, define any macros to override. -
In you application's
CMakeLists.txt
, setNX_USER_FILE
to the full path to yournx_user.h
file:CMAKE_CURRENT_LIST_DIR
is a CMake built-in variable containing the full path to the directory containing the currentCMakeLists.txt
.This must be done before your application's
CMakeLists.txt
adds the Open IoT SDK.
The default configuration only enables the TCP/IP stack. If you would also like to enable Azure IoT Middleware for Azure RTOS, in addition to the steps above, you also need to do the following:
-
In you application's
CMakeLists.txt
, setNXD_ENABLE_AZURE_IOT
toON
:Notice that the way we set
NXD_ENABLE_AZURE_IOT
is different fromNX_USER_FILE
earlier. This is because Azure RTOS NetX Duo's CMake support internally declaresNXD_ENABLE_AZURE_IOT
as aCACHE
variable, and it also specifies a very old version of CMake which requires this way of overridingCACHE
variables.This must be done before your application's
CMakeLists.txt
adds the Open IoT SDK. -
Add the following definitions to the
nx_user.h
file you have created earlier:
Linking
In your application's CMakeLists.txt
, link the application executable against the library named netxduo
alongside
any other libraries you need:
Replace
my_application
with the actual name of your application.
This not only enables the linking of the netxduo
static library, but also makes its API headers' include paths
available to your application.
Examples
To see the full context of the information in the sections above, you are advised to take a look at
- the Open IoT SDK example for NetX Duo showing the use of TCP/IP features
- the Open IoT SDK example for Azure IoT Middleware showing the connection to Azure IoT Hub
Documentation
For more details of how to use the APIs in your application code, see the official documentations for