Skip to content

Commit

Permalink
use strings / path / names sdk_3.x and sdk_2.x instead of names o…
Browse files Browse the repository at this point in the history
…f underlying kernels of Talaria TWO SDKs

- BUILD_TYPE_FLAG changed from `-DINP_FREERTOS_SDK` to `-DSDK_THREE_DOT_X` as needed for SDK_3.2.1
- removed references of `freertos` and `inno_os` in favor of  `sdk_3.x` and `sdk_2.x`
  • Loading branch information
vivek tiwari authored and tiwarivivek committed Dec 20, 2024
1 parent f21b791 commit ab1d82b
Show file tree
Hide file tree
Showing 86 changed files with 68 additions and 68 deletions.
10 changes: 5 additions & 5 deletions apply_t2_libc_compatibility_patches.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/bin/bash
PLATFORM_TYPE=$(cat ../../build.mak | grep "INP_FREERTOS_SDK")
if [ "$PLATFORM_TYPE" = "BUILD_TYPE_FLAG = -DINP_FREERTOS_SDK" ]
PLATFORM_TYPE=$(cat ../../build.mak | grep "SDK_THREE_DOT_X")
if [ "$PLATFORM_TYPE" = "BUILD_TYPE_FLAG = -DSDK_THREE_DOT_X" ]
then
OS_TYPE=freertos
OS_TYPE=sdk_3.x
else
OS_TYPE=inno_os
OS_TYPE=sdk_2.x
fi


Expand Down Expand Up @@ -48,7 +48,7 @@ echo "...patching $ROOT_PATH/$PATCH_TARGET_4_PATH"
cd $ROOT_PATH/$PATCH_TARGET_4_PATH
git apply --whitespace=nowarn $ROOT_PATH/$PATCH_FILE_4_PATH

if [ "$PLATFORM_TYPE" != "BUILD_TYPE_FLAG = -DINP_FREERTOS_SDK" ]
if [ "$PLATFORM_TYPE" != "BUILD_TYPE_FLAG = -DSDK_THREE_DOT_X" ]
then
echo "...patching $ROOT_PATH/$PATCH_TARGET_5_PATH"
cd $ROOT_PATH/$PATCH_TARGET_5_PATH
Expand Down
Binary file not shown.
Binary file not shown.
22 changes: 11 additions & 11 deletions examples/Makefile
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@

PLATFORM_TYPE := $(shell cat ../../../build.mak | grep "INP_FREERTOS_SDK")
PLATFORM_TYPE := $(shell cat ../../../build.mak | grep "SDK_THREE_DOT_X")
#$(info PLATFORM_TYPE=$(PLATFORM_TYPE))

all:
ifeq ($(PLATFORM_TYPE),BUILD_TYPE_FLAG = -DINP_FREERTOS_SDK)
echo "$(PLATFORM_TYPE) building freertos sample apps..."
cd freertos/ && $(MAKE) all
ifeq ($(PLATFORM_TYPE),BUILD_TYPE_FLAG = -DSDK_THREE_DOT_X)
echo "$(PLATFORM_TYPE) building sample apps for sdk_3.x..."
cd sdk_3.x/ && $(MAKE) all
else
echo "$(PLATFORM_TYPE) building inno_os sample apps..."
cd inno_os/ && $(MAKE) all
echo "$(PLATFORM_TYPE) building sample apps for sdk_2.x..."
cd sdk_2.x/ && $(MAKE) all
endif

clean:
ifeq ($(PLATFORM_TYPE),BUILD_TYPE_FLAG = -DINP_FREERTOS_SDK)
echo "$(PLATFORM_TYPE) cleaning freertos sample apps..."
cd freertos/ && $(MAKE) clean
ifeq ($(PLATFORM_TYPE),BUILD_TYPE_FLAG = -DSDK_THREE_DOT_X)
echo "$(PLATFORM_TYPE) cleaning sample apps for sdk_3.x..."
cd sdk_3.x/ && $(MAKE) clean
else
echo "$(PLATFORM_TYPE) cleaning inno_os sample apps..."
cd inno_os/ && $(MAKE) clean
echo "$(PLATFORM_TYPE) cleaning sample apps for sdk_2.x..."
cd sdk_2.x/ && $(MAKE) clean
endif

10 changes: 5 additions & 5 deletions examples/inno_os/Makefile → examples/sdk_2.x/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ azure_sdk_provisioning_client_src=$(T2AZURE_LOC)/azure-iot-sdk-c/provisioning_cl
azure_sdk_provisioning_client_adapters=$(T2AZURE_LOC)/azure-iot-sdk-c/provisioning_client/adapters/
azure_sdk_provisioning_client_deps=$(T2AZURE_LOC)/azure-iot-sdk-c/provisioning_client/deps/utpm/deps/c-utility/src/

azure_sdk_pal=$(T2AZURE_LOC)/pal/inno_os/src/
azure_sdk_pal=$(T2AZURE_LOC)/pal/sdk_2.x/src/

commonIncs = \
-I$(T2AZURE_LOC)/pal/inno_os/inc \
-I$(T2AZURE_LOC)/pal/sdk_2.x/inc \
-I$(T2AZURE_LOC)/azure-iot-sdk-c/c-utility/pal/generic \
-I$(T2AZURE_LOC)/azure-iot-sdk-c/c-utility/inc \
-I$(T2AZURE_LOC)/azure-iot-sdk-c/c-utility/deps/azure-macro-utils-c/inc \
Expand Down Expand Up @@ -258,9 +258,9 @@ else
endif

# Reference -- add the application's code paths here
azure_iothub_client_sample_mqtt=$(T2AZURE_LOC)/examples/inno_os/iothub_client_sample_mqtt/main/
azure_iothub_devicetwin_and_methods_sample=$(T2AZURE_LOC)/examples/inno_os/iothub_devicetwin_and_methods_sample/main/
azure_iothub_prov_dev_client_ll_sample=$(T2AZURE_LOC)/examples/inno_os/prov_dev_client_ll_sample/main/
azure_iothub_client_sample_mqtt=$(T2AZURE_LOC)/examples/sdk_2.x/iothub_client_sample_mqtt/main/
azure_iothub_devicetwin_and_methods_sample=$(T2AZURE_LOC)/examples/sdk_2.x/iothub_devicetwin_and_methods_sample/main/
azure_iothub_prov_dev_client_ll_sample=$(T2AZURE_LOC)/examples/sdk_2.x/prov_dev_client_ll_sample/main/

# Reference -- add the application's include paths here

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Output will be similar to:
}
```

- open the file `<sdk_path>/apps/talaria_two_azure/examples/inno_os/iothub_client_sample_mqtt/main/iothub_client_sample_mqtt.c`
- open the file `<sdk_path>/apps/talaria_two_azure/examples/sdk_2.x/iothub_client_sample_mqtt/main/iothub_client_sample_mqtt.c`

- In this file, populate the macro 'EXAMPLE_IOTHUB_CONNECTION_STRING' (shown below) with the connection string of your device copied in previous steps.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Output will be similar to:
}
```

- open the file `<sdk_path>/apps/talaria_two_azure/examples/inno_os/iothub_devicetwin_and_methods_sample/main/iothub_client_device_twin_and_methods_sample.c`
- open the file `<sdk_path>/apps/talaria_two_azure/examples/sdk_2.x/iothub_devicetwin_and_methods_sample/main/iothub_client_device_twin_and_methods_sample.c`

- In this file, populate the macro 'CONFIG_IOTHUB_CONNECTION_STRING' (shown below) with the connection string of your device copied in previous steps.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ More details with the screenshots about these steps can be found [here](https://

### Device Configuration

For this method, we will need to populate `ID Scope`, `Registration ID` and `Symmetric Key` in the file `<sdk_path>/apps/talaria_two_azure/examples/inno_os/prov_dev_client_ll_sample/main/prov_dev_client_ll_sample.c`.
For this method, we will need to populate `ID Scope`, `Registration ID` and `Symmetric Key` in the file `<sdk_path>/apps/talaria_two_azure/examples/sdk_2.x/prov_dev_client_ll_sample/main/prov_dev_client_ll_sample.c`.

In this file search for the function `prov_dev_client_ll_sample_run()`. Here you will find the code :

Expand All @@ -65,7 +65,7 @@ to populate this, as shown below for example -

Now, copy the ID Scope of the Device Provisioning Service we created. This can be found on the Azure portal under the "Overview" section of DPS.

Then in the same file `<sdk_path>/apps/talaria_two_azure/examples/inno_os/prov_dev_client_ll_sample/main/prov_dev_client_ll_sample.c`, searching for `id_scope` you will find the code :
Then in the same file `<sdk_path>/apps/talaria_two_azure/examples/sdk_2.x/prov_dev_client_ll_sample/main/prov_dev_client_ll_sample.c`, searching for `id_scope` you will find the code :

```
static const char* id_scope = "XXXXXXXXXXX";
Expand Down Expand Up @@ -250,13 +250,13 @@ You will notice that an enrollment entity has been created with the same name we
### Device Configuration

For this method, we will need to populate
- `ID Scope` in the file `<sdk_path>/apps/talaria_two_azure/examples/inno_os/prov_dev_client_ll_sample/main/prov_dev_client_ll_sample.c`
- `COMMON_NAME` in the file `<sdk_path>/apps/talaria_two_azure/examples/inno_os/prov_dev_client_ll_sample/main/custom_hsm.c`
- `leaf_cert_pem_start[]` and `leaf_pv_key_pem_start[]` in file `<sdk_path>/apps/talaria_two_azure/examples/inno_os/prov_dev_client_ll_sample/main/certs/certs.c`
- `ID Scope` in the file `<sdk_path>/apps/talaria_two_azure/examples/sdk_2.x/prov_dev_client_ll_sample/main/prov_dev_client_ll_sample.c`
- `COMMON_NAME` in the file `<sdk_path>/apps/talaria_two_azure/examples/sdk_2.x/prov_dev_client_ll_sample/main/custom_hsm.c`
- `leaf_cert_pem_start[]` and `leaf_pv_key_pem_start[]` in file `<sdk_path>/apps/talaria_two_azure/examples/sdk_2.x/prov_dev_client_ll_sample/main/certs/certs.c`

Copy the ID Scope of the Device Provisioning Service we created. This can be found on the Azure portal under the "Overview" section of DPS.

Then in the file `<sdk_path>/apps/talaria_two_azure/examples/inno_os/prov_dev_client_ll_sample/main/prov_dev_client_ll_sample.c`, searching for `id_scope` you will find the code :
Then in the file `<sdk_path>/apps/talaria_two_azure/examples/sdk_2.x/prov_dev_client_ll_sample/main/prov_dev_client_ll_sample.c`, searching for `id_scope` you will find the code :

```
static const char* id_scope = "XXXXXXXXXXX";
Expand All @@ -268,7 +268,7 @@ For example
static const char* id_scope = "0ne001E4235";
```

The name of the Enrollment Entity we created in previous step is to be populated in below portion of file `<sdk_path>/apps/talaria_two_azure/examples/inno_os/prov_dev_client_ll_sample/main/custom_hsm.c`.
The name of the Enrollment Entity we created in previous step is to be populated in below portion of file `<sdk_path>/apps/talaria_two_azure/examples/sdk_2.x/prov_dev_client_ll_sample/main/custom_hsm.c`.
```
static const char* const COMMON_NAME = "XXYYZZ";
```
Expand All @@ -279,10 +279,10 @@ For Example --
static const char* const COMMON_NAME = "InnoProvServiceECC";
```

In the file `<sdk_path>/apps/talaria_two_azure/examples/inno_os/prov_dev_client_ll_sample/main/certs/certs.c`, content of `leaf_cert_pem_start[]` and `leaf_pv_key_pem_start[]` are to be populated with the contents from
In the file `<sdk_path>/apps/talaria_two_azure/examples/sdk_2.x/prov_dev_client_ll_sample/main/certs/certs.c`, content of `leaf_cert_pem_start[]` and `leaf_pv_key_pem_start[]` are to be populated with the contents from
`leaf_private_key.pem` and `leaf_certificate.pem` we created earlier.

The way to populate this is shown in the example file `<sdk_path>/apps/talaria_two_azure/examples/inno_os/prov_dev_client_ll_sample/main/certs/ecc_example_certs.c`
The way to populate this is shown in the example file `<sdk_path>/apps/talaria_two_azure/examples/sdk_2.x/prov_dev_client_ll_sample/main/certs/ecc_example_certs.c`

Confirm that these needed changes are in place and files saved
Now, do a `make clean` and then run `make build_type=prov_build_with_x509` for generating `Azure IoT Hub Device Provisioning Service Sample` provisioning build with HSM_TYPE_X509.
Expand Down Expand Up @@ -421,8 +421,8 @@ All this, means the provisioning using X.509 CA Certificate based device enrollm
static const char* const COMMON_NAME = "InnoProvServiceRSA";
```
We will have to use the content from `leaf_private_key.pem` and `leaf_certificate.pem` generated from RSA specific steps to populate the file--
`<sdk_path>/apps/talaria_two_azure/examples/inno_os/prov_dev_client_ll_sample/main/certs/certs.c`.
(Similar to the way shown in the example file `<sdk_path>/apps/talaria_two_azure/examples/inno_os/prov_dev_client_ll_sample/main/certs/rsa_example_certs.c`.)
`<sdk_path>/apps/talaria_two_azure/examples/sdk_2.x/prov_dev_client_ll_sample/main/certs/certs.c`.
(Similar to the way shown in the example file `<sdk_path>/apps/talaria_two_azure/examples/sdk_2.x/prov_dev_client_ll_sample/main/certs/rsa_example_certs.c`.)

Please Note : All other steps not specifically detailed in this RSA specific section are exactly the same as already covered in the ECC example in great details.
(for example populating `id_scope` in device config section, etc). Only the key and certificate generation and the names we use for examples are changed here.
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ azure_sdk_provisioning_client_src=$(T2AZURE_LOC)/azure-iot-sdk-c/provisioning_cl
azure_sdk_provisioning_client_adapters=$(T2AZURE_LOC)/azure-iot-sdk-c/provisioning_client/adapters/
azure_sdk_provisioning_client_deps=$(T2AZURE_LOC)/azure-iot-sdk-c/provisioning_client/deps/utpm/deps/c-utility/src/

azure_sdk_pal=$(T2AZURE_LOC)/pal/freertos/src/
azure_sdk_pal=$(T2AZURE_LOC)/pal/sdk_3.x/src/

commonIncs = \
-I$(T2AZURE_LOC)/azure-iot-sdk-c/c-utility/inc \
-I$(T2AZURE_LOC)/azure-iot-sdk-c/c-utility/pal/generic \
-I$(T2AZURE_LOC)/azure-iot-sdk-c/c-utility/deps/azure-macro-utils-c/inc \
-I$(T2AZURE_LOC)/azure-iot-sdk-c/c-utility/deps/umock-c/inc\
-I$(T2AZURE_LOC)/pal/freertos/inc
-I$(T2AZURE_LOC)/pal/sdk_3.x/inc

iotclientIncs = \
-I$(T2AZURE_LOC)/azure-iot-sdk-c/iothub_client/inc \
Expand Down Expand Up @@ -239,7 +239,7 @@ $(OUTDIR)/${lib_azure_iot_sdk_t2_pal_path}/libazure_iot_sdk_t2_pal.a: lib_objs =

APP := iothub_client_mqtt_sample.elf

app_src=$(T2AZURE_LOC)/examples/freertos/iothub_client_sample_mqtt/main
app_src=$(T2AZURE_LOC)/examples/sdk_3.x/iothub_client_sample_mqtt/main

CFLAGS += -I${app_src}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Output will be similar to:
}
```

- open the file `<sdk_path>/apps/talaria_two_azure/examples/freertos/iothub_client_sample_mqtt/main/iothub_client_sample_mqtt.c`
- open the file `<sdk_path>/apps/talaria_two_azure/examples/sdk_3.x/iothub_client_sample_mqtt/main/iothub_client_sample_mqtt.c`

- In this file, populate the macro 'EXAMPLE_IOTHUB_CONNECTION_STRING' (shown below) with the connection string of your device copied in previous steps.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ azure_sdk_provisioning_client_src=$(T2AZURE_LOC)/azure-iot-sdk-c/provisioning_cl
azure_sdk_provisioning_client_adapters=$(T2AZURE_LOC)/azure-iot-sdk-c/provisioning_client/adapters/
azure_sdk_provisioning_client_deps=$(T2AZURE_LOC)/azure-iot-sdk-c/provisioning_client/deps/utpm/deps/c-utility/src/

azure_sdk_pal=$(T2AZURE_LOC)/pal/freertos/src/
azure_sdk_pal=$(T2AZURE_LOC)/pal/sdk_3.x/src/

commonIncs = \
-I$(T2AZURE_LOC)/azure-iot-sdk-c/c-utility/inc \
-I$(T2AZURE_LOC)/azure-iot-sdk-c/c-utility/pal/generic \
-I$(T2AZURE_LOC)/azure-iot-sdk-c/c-utility/deps/azure-macro-utils-c/inc \
-I$(T2AZURE_LOC)/azure-iot-sdk-c/c-utility/deps/umock-c/inc\
-I$(T2AZURE_LOC)/pal/freertos/inc
-I$(T2AZURE_LOC)/pal/sdk_3.x/inc

iotclientIncs = \
-I$(T2AZURE_LOC)/azure-iot-sdk-c/iothub_client/inc \
Expand Down Expand Up @@ -239,7 +239,7 @@ $(OUTDIR)/${lib_azure_iot_sdk_t2_pal_path}/libazure_iot_sdk_t2_pal.a: lib_objs =

APP := iothub_devicetwin_and_methods_sample.elf

app_src=$(T2AZURE_LOC)/examples/freertos/iothub_devicetwin_and_methods_sample/main
app_src=$(T2AZURE_LOC)/examples/sdk_3.x/iothub_devicetwin_and_methods_sample/main

CFLAGS += -I${app_src}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Output will be similar to:
}
```

- open the file `<sdk_path>/apps/talaria_two_azure/examples/freertos/iothub_devicetwin_and_methods_sample/main/iothub_client_device_twin_and_methods_sample.c`
- open the file `<sdk_path>/apps/talaria_two_azure/examples/sdk_3.x/iothub_devicetwin_and_methods_sample/main/iothub_client_device_twin_and_methods_sample.c`

- In this file, populate the macro 'CONFIG_IOTHUB_CONNECTION_STRING' (shown below) with the connection string of your device copied in previous steps.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ azure_sdk_provisioning_client_src=$(T2AZURE_LOC)/azure-iot-sdk-c/provisioning_cl
azure_sdk_provisioning_client_adapters=$(T2AZURE_LOC)/azure-iot-sdk-c/provisioning_client/adapters/
azure_sdk_provisioning_client_deps=$(T2AZURE_LOC)/azure-iot-sdk-c/provisioning_client/deps/utpm/deps/c-utility/src/

azure_sdk_pal=$(T2AZURE_LOC)/pal/freertos/src/
azure_sdk_pal=$(T2AZURE_LOC)/pal/sdk_3.x/src/

commonIncs = \
-I$(T2AZURE_LOC)/azure-iot-sdk-c/c-utility/inc \
-I$(T2AZURE_LOC)/azure-iot-sdk-c/c-utility/pal/generic \
-I$(T2AZURE_LOC)/azure-iot-sdk-c/c-utility/deps/azure-macro-utils-c/inc \
-I$(T2AZURE_LOC)/azure-iot-sdk-c/c-utility/deps/umock-c/inc\
-I$(T2AZURE_LOC)/pal/freertos/inc
-I$(T2AZURE_LOC)/pal/sdk_3.x/inc

iotclientIncs = \
-I$(T2AZURE_LOC)/azure-iot-sdk-c/iothub_client/inc \
Expand Down Expand Up @@ -263,7 +263,7 @@ $(OUTDIR)/${lib_azure_iot_sdk_t2_pal_path}/libazure_iot_sdk_t2_pal.a: lib_objs =

APP := prov_dev_client_ll_sample.elf

app_src=$(T2AZURE_LOC)/examples/freertos/prov_dev_client_ll_sample/main
app_src=$(T2AZURE_LOC)/examples/sdk_3.x/prov_dev_client_ll_sample/main

CFLAGS += -I${app_src}

Expand Down
Loading

0 comments on commit ab1d82b

Please sign in to comment.