Skip to content

Commit

Permalink
Update to Azure RTOS 6.1 (#151)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanwinter authored Oct 14, 2020
1 parent 869fff8 commit 05a9f68
Show file tree
Hide file tree
Showing 523 changed files with 1,532 additions and 142,504 deletions.
7 changes: 2 additions & 5 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
[submodule "core/lib/threadx"]
path = core/lib/threadx
url = http://github.com/azure-rtos/threadx.git
url = https://github.com/azure-rtos/threadx.git
[submodule "core/lib/netxduo"]
path = core/lib/netxduo
url = http://github.com/azure-rtos/netxduo.git
[submodule "core/lib/azure-iot-preview"]
path = core/lib/azure-iot-preview
url = https://github.com/azure-rtos/azure-iot-preview
url = https://github.com/azure-rtos/netxduo.git
[submodule "core/lib/jsmn/src"]
path = core/lib/jsmn/src
url = https://github.com/zserge/jsmn
2 changes: 0 additions & 2 deletions MXChip/AZ3166/app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ add_executable(${PROJECT_NAME} ${SOURCES})
target_link_libraries(${PROJECT_NAME}
azrtos::threadx
azrtos::netxduo
azrtos::nx_cloud
azrtos::azure_iot

stm32cubef4
wiced_sdk
Expand Down
19 changes: 12 additions & 7 deletions MXChip/AZ3166/app/nx_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "nx_api.h"
#include "nx_azure_iot_hub_client.h"
#include "nx_azure_iot_provisioning_client.h"
#include "nx_azure_iot_json_reader.h"

// These are sample files, user can build their own certificate and ciphersuites
#include "azure_iot_cert.h"
Expand Down Expand Up @@ -46,7 +47,7 @@ static void set_led_state(bool level)
}

static void direct_method_cb(AZURE_IOT_NX_CONTEXT* nx_context,
UCHAR* method,
const UCHAR* method,
USHORT method_length,
UCHAR* payload,
USHORT payload_length,
Expand Down Expand Up @@ -84,15 +85,17 @@ static void device_twin_desired_property_cb(UCHAR* component_name,
UINT component_name_len,
UCHAR* property_name,
UINT property_name_len,
az_json_reader property_value_reader,
NX_AZURE_IOT_JSON_READER property_value_reader,
UINT version,
VOID* userContextCallback)
{
UINT status;
AZURE_IOT_NX_CONTEXT* nx_context = (AZURE_IOT_NX_CONTEXT*)userContextCallback;

if (strncmp((CHAR*)property_name, TELEMETRY_INTERVAL_PROPERTY, property_name_len) == 0)
{
if (az_succeeded(az_json_token_get_int32(&property_value_reader.token, &telemetry_interval)))
status = nx_azure_iot_json_reader_token_int32_get(&property_value_reader, &telemetry_interval);
if (status == NX_AZURE_IOT_SUCCESS)
{
// Set a telemetry event so we pick up the change immediately
tx_event_flags_set(&azure_iot_flags, TELEMETRY_INTERVAL_EVENT, TX_OR);
Expand All @@ -108,15 +111,17 @@ static void device_twin_property_cb(UCHAR* component_name,
UINT component_name_len,
UCHAR* property_name,
UINT property_name_len,
az_json_reader property_value_reader,
NX_AZURE_IOT_JSON_READER property_value_reader,
UINT version,
VOID* userContextCallback)
{
UINT status;
AZURE_IOT_NX_CONTEXT* nx_context = (AZURE_IOT_NX_CONTEXT*)userContextCallback;

if (strncmp((CHAR*)property_name, TELEMETRY_INTERVAL_PROPERTY, property_name_len) == 0)
{
if (az_succeeded(az_json_token_get_int32(&property_value_reader.token, &telemetry_interval)))
status = nx_azure_iot_json_reader_token_int32_get(&property_value_reader, &telemetry_interval);
if (status == NX_AZURE_IOT_SUCCESS)
{
// Set a telemetry event so we pick up the change immediately
tx_event_flags_set(&azure_iot_flags, TELEMETRY_INTERVAL_EVENT, TX_OR);
Expand All @@ -132,7 +137,7 @@ UINT azure_iot_nx_client_entry(
NX_IP* ip_ptr, NX_PACKET_POOL* pool_ptr, NX_DNS* dns_ptr, UINT (*unix_time_callback)(ULONG* unix_time))
{
UINT status;
ULONG events = 0;
ULONG events = 0;
int telemetry_state = 0;
lps22hb_t lps22hb_data;
hts221_data_t hts221_data;
Expand Down Expand Up @@ -222,7 +227,7 @@ UINT azure_iot_nx_client_entry(
// Send the compensated humidity
hts221_data = hts221_data_read();
azure_iot_nx_client_publish_float_telemetry(
&azure_iot_nx_client, "humidityPercentage", hts221_data.humidity_perc);
&azure_iot_nx_client, "humidity", hts221_data.humidity_perc);
break;

case 3:
Expand Down
9 changes: 1 addition & 8 deletions MXChip/AZ3166/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ set(TX_USER_FILE "${CMAKE_CURRENT_LIST_DIR}/threadx/tx_user.h" CACHE STRING "Ena

# Define NetXDuo user configuration
set(NX_USER_FILE "${CMAKE_CURRENT_LIST_DIR}/netxduo/nx_user.h" CACHE STRING "Enable NX user configuration")
set(NXD_ENABLE_AZURE_IOT ON CACHE BOOL "Enable Azure IoT")
set(NXD_ENABLE_FILE_SERVERS OFF CACHE BOOL "Disable fileX dependency by netxduo")

# Disable ASC
Expand All @@ -18,15 +19,7 @@ set(NX_AZURE_DISABLE_IOT_SECURITY_MODULE ON CACHE BOOL "Disable ASC")
# Core libraries
add_subdirectory(${CORE_LIB_DIR}/threadx threadx)
add_subdirectory(${CORE_LIB_DIR}/netxduo netxduo)
add_subdirectory(${CORE_LIB_DIR}/azure-iot-preview/nx_cloud nx_cloud)
add_subdirectory(${CORE_LIB_DIR}/azure-iot-preview/azure_iot azure_iot)
add_subdirectory(${CORE_LIB_DIR}/jsmn jsmn)

# Bind the nx_cloud preview include into the existing netxduo
target_include_directories(netxduo
PUBLIC
${CORE_LIB_DIR}/azure-iot-preview/nx_cloud
)

add_subdirectory(stm32cubef4)
add_subdirectory(wiced_sdk)
19 changes: 16 additions & 3 deletions MXChip/AZ3166/lib/netxduo/nx_user.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
/**************************************************************************/
/* */
/* Copyright (c) Microsoft Corporation. All rights reserved. */
/* */
/* This software is licensed under the Microsoft Software License */
/* Terms for Microsoft Azure RTOS. Full text of the license can be */
/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
/* and in the root directory of this software. */
/* */
/**************************************************************************/

#ifndef NX_USER_H
#define NX_USER_H

#define NX_SECURE_ENABLE
#define NX_ENABLE_EXTENDED_NOTIFY_SUPPORT
#define NX_ENABLE_IP_PACKET_FILTER
#define NX_DISABLE_IPV6
#define NX_DISABLE_INCLUDE_SOURCE_CODE
#define NX_DNS_CLIENT_USER_CREATE_PACKET_POOL

#define NX_SECURE_ENABLE
#define NX_ENABLE_EXTENDED_NOTIFY_SUPPORT
#define NXD_MQTT_CLOUD_ENABLE

#define NX_SNTP_CLIENT_MIN_SERVER_STRATUM 3

extern UINT nx_rand16( void );
#define NX_RAND nx_rand16

Expand Down
4 changes: 1 addition & 3 deletions Microchip/ATSAME54-XPRO/app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ target_link_libraries(${PROJECT_NAME}
PUBLIC
azrtos::threadx
azrtos::netxduo
azrtos::nx_cloud
azrtos::azure_iot


atmel_start
app_common
jsmn
Expand Down
18 changes: 11 additions & 7 deletions Microchip/ATSAME54-XPRO/app/nx_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#include "nx_api.h"
#include "nx_azure_iot_hub_client.h"
#include "nx_azure_iot_json_reader.h"
#include "nx_azure_iot_provisioning_client.h"

#include "jsmn.h"
Expand All @@ -22,7 +23,7 @@

#include "azure_config.h"

#define IOT_MODEL_ID "dtmi:com:example:azurertos:gsg;1"
#define IOT_MODEL_ID "dtmi:com:example:azurertos:gsg;1"
#define TELEMETRY_INTERVAL_PROPERTY "telemetryInterval"
#define LED_STATE_PROPERTY "ledState"
#define SET_LED_STATE_COMMAND "setLedState"
Expand Down Expand Up @@ -51,7 +52,7 @@ static void set_led_state(bool level)
}

static void direct_method_cb(AZURE_IOT_NX_CONTEXT* nx_context,
UCHAR* method,
const UCHAR* method,
USHORT method_length,
UCHAR* payload,
USHORT payload_length,
Expand Down Expand Up @@ -89,15 +90,17 @@ static void device_twin_desired_property_cb(UCHAR* component_name,
UINT component_name_len,
UCHAR* property_name,
UINT property_name_len,
az_json_reader property_value_reader,
NX_AZURE_IOT_JSON_READER property_value_reader,
UINT version,
VOID* userContextCallback)
{
UINT status;
AZURE_IOT_NX_CONTEXT* nx_context = (AZURE_IOT_NX_CONTEXT*)userContextCallback;

if (strncmp((CHAR*)property_name, TELEMETRY_INTERVAL_PROPERTY, property_name_len) == 0)
{
if (az_succeeded(az_json_token_get_int32(&property_value_reader.token, &telemetry_interval)))
status = nx_azure_iot_json_reader_token_int32_get(&property_value_reader, &telemetry_interval);
if (status == NX_AZURE_IOT_SUCCESS)
{
// Set a telemetry event so we pick up the change immediately
tx_event_flags_set(&azure_iot_flags, TELEMETRY_INTERVAL_EVENT, TX_OR);
Expand All @@ -113,15 +116,17 @@ static void device_twin_property_cb(UCHAR* component_name,
UINT component_name_len,
UCHAR* property_name,
UINT property_name_len,
az_json_reader property_value_reader,
NX_AZURE_IOT_JSON_READER property_value_reader,
UINT version,
VOID* userContextCallback)
{
UINT status;
AZURE_IOT_NX_CONTEXT* nx_context = (AZURE_IOT_NX_CONTEXT*)userContextCallback;

if (strncmp((CHAR*)property_name, TELEMETRY_INTERVAL_PROPERTY, property_name_len) == 0)
{
if (az_succeeded(az_json_token_get_int32(&property_value_reader.token, &telemetry_interval)))
status = nx_azure_iot_json_reader_token_int32_get(&property_value_reader, &telemetry_interval);
if (status == NX_AZURE_IOT_SUCCESS)
{
// Set a telemetry event so we pick up the change immediately
tx_event_flags_set(&azure_iot_flags, TELEMETRY_INTERVAL_EVENT, TX_OR);
Expand Down Expand Up @@ -215,4 +220,3 @@ UINT azure_iot_nx_client_entry(

return NX_SUCCESS;
}

9 changes: 1 addition & 8 deletions Microchip/ATSAME54-XPRO/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ set(TX_USER_FILE "${CMAKE_CURRENT_LIST_DIR}/threadx/tx_user.h" CACHE STRING "Ena

# Define NetXDuo user configuration
set(NX_USER_FILE "${CMAKE_CURRENT_LIST_DIR}/netxduo/nx_user.h" CACHE STRING "Enable NX user configuration")
set(NXD_ENABLE_AZURE_IOT ON CACHE BOOL "Enable Azure IoT")
set(NXD_ENABLE_FILE_SERVERS OFF CACHE BOOL "Disable fileX dependency by netxduo")

# Disable ASC
Expand All @@ -18,15 +19,7 @@ set(NX_AZURE_DISABLE_IOT_SECURITY_MODULE ON CACHE BOOL "Disable ASC")
# Core libraries
add_subdirectory(${CORE_LIB_DIR}/threadx threadx)
add_subdirectory(${CORE_LIB_DIR}/netxduo netxduo)
add_subdirectory(${CORE_LIB_DIR}/azure-iot-preview/nx_cloud nx_cloud)
add_subdirectory(${CORE_LIB_DIR}/azure-iot-preview/azure_iot azure_iot)
add_subdirectory(${CORE_LIB_DIR}/jsmn jsmn)

# Bind the nx_cloud preview include into the existing netxduo
target_include_directories(netxduo
PUBLIC
${CORE_LIB_DIR}/azure-iot-preview/nx_cloud
)

add_subdirectory(netx_driver)
add_subdirectory(atmel_start)
45 changes: 4 additions & 41 deletions Microchip/ATSAME54-XPRO/lib/netxduo/nx_user.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,54 +9,17 @@
/* */
/**************************************************************************/


/**************************************************************************/
/**************************************************************************/
/** */
/** NetX Component */
/** */
/** User Specific */
/** */
/**************************************************************************/
/**************************************************************************/


/**************************************************************************/
/* */
/* PORT SPECIFIC C INFORMATION RELEASE */
/* */
/* nx_user.h PORTABLE C */
/* 6.0 */
/* */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file contains user defines for configuring NetX in specific */
/* ways. This file will have an effect only if the application and */
/* NetX library are built with NX_INCLUDE_USER_DEFINE_FILE defined. */
/* Note that all the defines in this file may also be made on the */
/* command line when building NetX library and application objects. */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* */
/**************************************************************************/

#ifndef NX_USER_H
#define NX_USER_H

#define NX_DISABLE_INCLUDE_SOURCE_CODE

#define NX_SECURE_ENABLE
#define NX_ENABLE_EXTENDED_NOTIFY_SUPPORT
#define NX_ENABLE_IP_PACKET_FILTER

#define NXD_MQTT_CLOUD_ENABLE

#define NX_SNTP_CLIENT_MIN_SERVER_STRATUM 3

/* Define various build options for the NetX Duo port. The application should either make changes
here by commenting or un-commenting the conditional compilation defined OR supply the defines
though the compiler's equivalent of the -D option. */
Expand Down
5 changes: 4 additions & 1 deletion Microchip/ATSAME54-XPRO/tools/flash.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
:: Copyright (c) Microsoft Corporation.
:: Licensed under the MIT License.

atprogram.exe --tool edbg --interface SWD --device ATSAME54P20A program --chiperase --file atsame54_azure_iot.bin --verify
setlocal
cd /d %~dp0\..

openocd -f board/microchip_same54_xplained_pro.cfg -c "program build/app/atsame54_azure_iot.elf verify reset exit"
2 changes: 0 additions & 2 deletions NXP/MIMXRT1060-EVK/app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ target_link_libraries(${PROJECT_NAME}
PUBLIC
azrtos::threadx
azrtos::netxduo
azrtos::nx_cloud
azrtos::azure_iot

app_common
jsmn
Expand Down
16 changes: 10 additions & 6 deletions NXP/MIMXRT1060-EVK/app/nx_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ static void set_led_state(bool level)
}

static void direct_method_cb(AZURE_IOT_NX_CONTEXT* nx_context,
UCHAR* method,
const UCHAR* method,
USHORT method_length,
UCHAR* payload,
USHORT payload_length,
Expand Down Expand Up @@ -83,15 +83,17 @@ static void device_twin_desired_property_cb(UCHAR* component_name,
UINT component_name_len,
UCHAR* property_name,
UINT property_name_len,
az_json_reader property_value_reader,
NX_AZURE_IOT_JSON_READER property_value_reader,
UINT version,
VOID* userContextCallback)
{
UINT status;
AZURE_IOT_NX_CONTEXT* nx_context = (AZURE_IOT_NX_CONTEXT*)userContextCallback;

if (strncmp((CHAR*)property_name, TELEMETRY_INTERVAL_PROPERTY, property_name_len) == 0)
{
if (az_succeeded(az_json_token_get_int32(&property_value_reader.token, &telemetry_interval)))
status = nx_azure_iot_json_reader_token_int32_get(&property_value_reader, &telemetry_interval);
if (status == NX_AZURE_IOT_SUCCESS)
{
// Set a telemetry event so we pick up the change immediately
tx_event_flags_set(&azure_iot_flags, TELEMETRY_INTERVAL_EVENT, TX_OR);
Expand All @@ -107,15 +109,17 @@ static void device_twin_property_cb(UCHAR* component_name,
UINT component_name_len,
UCHAR* property_name,
UINT property_name_len,
az_json_reader property_value_reader,
NX_AZURE_IOT_JSON_READER property_value_reader,
UINT version,
VOID* userContextCallback)
{
UINT status;
AZURE_IOT_NX_CONTEXT* nx_context = (AZURE_IOT_NX_CONTEXT*)userContextCallback;

if (strncmp((CHAR*)property_name, TELEMETRY_INTERVAL_PROPERTY, property_name_len) == 0)
{
if (az_succeeded(az_json_token_get_int32(&property_value_reader.token, &telemetry_interval)))
status = nx_azure_iot_json_reader_token_int32_get(&property_value_reader, &telemetry_interval);
if (status == NX_AZURE_IOT_SUCCESS)
{
// Set a telemetry event so we pick up the change immediately
tx_event_flags_set(&azure_iot_flags, TELEMETRY_INTERVAL_EVENT, TX_OR);
Expand Down Expand Up @@ -188,7 +192,7 @@ UINT azure_iot_nx_client_entry(
// Send reported properties
azure_iot_nx_client_publish_bool_property(&azure_iot_nx_client, LED_STATE_PROPERTY, false);

ULONG events;
ULONG events = 0;
float temperature = 28.5;

printf("\r\nStarting Main loop\r\n");
Expand Down
Loading

0 comments on commit 05a9f68

Please sign in to comment.