You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Removing the Executable bit from all the files in the repository. Fixing [this](https://github.com/aws/aws-iot-device-sdk-embedded-C/issues/14) issue
6
+
- Refactoring MQTT client to remove declaration after statement warnings
The scope of this document is to provide instructions to modify the provided source files and functions in of this SDK to run in a variety of embedded C–based environments (e.g. real-time OS, embedded Linux) and to be adjusted to use a specific TLS implementation as available with specific hardware platforms.
4
+
The scope of this document is to provide instructions to modify the provided source files and functions in this SDK to run in a variety of embedded C–based environments (e.g. real-time OS, embedded Linux) and to be adjusted to use a specific TLS implementation as available with specific hardware platforms.
5
5
6
6
##Contents of the SDK
7
7
8
8
The SDK ported for linux can be downloaded from the below links.
*[mbedTLS from ARM](https://s3.amazonaws.com/aws-iot-device-sdk-embedded-c/linux_mqtt_mbedtls-1.1.1.tar)
11
11
12
12
The C-code files of this SDK are delivered via the following directory structure (see comment behind folder name for an explanation of its content).
13
13
@@ -31,7 +31,7 @@ Current SDK Directory Layout (mbedTLS)
31
31
All makefiles in this SDK were configured using the documented folder structure above, so moving or renaming folders will require modifications to makefiles.
32
32
33
33
##Explanation of folders and their content
34
-
`iot_src` : This directory contains the SDK source code including wrappers around the MQTT library, device shadow code and utilities.
34
+
`aws_iot_src` : This directory contains the SDK source code including wrappers around the MQTT library, device shadow code and utilities.
35
35
36
36
`aws_mqtt_embedded_client_lib` : The source code for the Embedded C MQTT client. This client is a modified version of the [Eclipse Paho](http://www.eclipse.org/paho/clients/c/embedded/) Embedded C client. The modifications include improved keep alive handling (callback on disconnect), a fix for unsubscribe functionality, buffer protection against too large MQTT messages and additional callback context to allow for a better layered architecture of the AWS IoT SDK.
37
37
@@ -96,24 +96,47 @@ Clean up the connection
96
96
97
97
The TLS library generally provides the API for the underlying TCP socket.
98
98
99
+
###Sample Porting:
100
+
Marvell has ported the SDK to its IoT Starter kit. [These](https://github.com/marvell-iot/aws_starter_sdk/tree/master/wmsdk/external/aws_iot/aws_iot_src/protocol/mqtt/aws_iot_embedded_client_wrapper/platform_wmsdk) files are example implementations of the above mentioned functions.
101
+
99
102
##Time source for certificate validation
100
103
As part of the TLS handshake the device (client) needs to validate the server certificate which includes validation of the certificate lifetime requiring that the device is aware of the actual time. Devices should be equipped with a real time clock or should be able to obtain the current time via NTP. Bypassing validation of the lifetime of a certificate is not recommended as it exposes the device to a security vulnerability, as it will still accept server certificates even when they have already expired.
101
104
102
105
##Integration into operating system
103
106
###Single-Threaded implementation
104
-
The single threaded implementation implies that the sample application code (SDK + MQTT client) is called periodically by the firmware application running on the main thread. This is done by calling the function `iot_mqtt_yield` (in the simple pub-sub example) and by calling `iot_shadow_yield()` (in the device shadow example). In both cases the keep-alive time is set to 10 seconds. This means that the yield functions need to be called at a minimum frequency of once every 10 seconds. Note however that the `iot_mqtt_yield()` function takes care of reading incoming MQTT messages from the IoT service as well and hence should be called more frequently depending on the timing requirements of an application. All incoming messages can only be processed at the frequency at which `yield` is called.
107
+
The single threaded implementation implies that the sample application code (SDK + MQTT client) is called periodically by the firmware application running on the main thread. This is done by calling the function `aws_iot_mqtt_yield` (in the simple pub-sub example) and by calling `aws_iot_shadow_yield()` (in the device shadow example). In both cases the keep-alive time is set to 10 seconds. This means that the yield functions need to be called at a minimum frequency of once every 10 seconds. Note however that the `iot_mqtt_yield()` function takes care of reading incoming MQTT messages from the IoT service as well and hence should be called more frequently depending on the timing requirements of an application. All incoming messages can only be processed at the frequency at which `yield` is called.
105
108
106
109
###Multi-Threaded implementation
107
-
In the simple multithreaded case the yield() function can be moved to a background thread. Ensure this task runs at the frequency described above. In this case, depending on the OS mechanism, a message queue or mailbox could be used to proxy incoming MQTT messages from the callback to the worker task responsible for responding to or dispatching messages. A similar mechanism could be employed to queue publish messages from threads into a publish queue that are processed by a publishing task.
110
+
In the simple multithreaded case the `yield` function can be moved to a background thread. Ensure this task runs at the frequency described above. In this case, depending on the OS mechanism, a message queue or mailbox could be used to proxy incoming MQTT messages from the callback to the worker task responsible for responding to or dispatching messages. A similar mechanism could be employed to queue publish messages from threads into a publish queue that are processed by a publishing task. Ensure a synchronization primitive like mutex is used, as the library is not thread safe.
108
111
109
112
##Sample applications
110
113
111
-
The sample apps in this SDK provide a working implementation for either openSSL or mbedTLS, meaning that the function calls explained above are already implemented for these environments.
114
+
The sample apps in this SDK provide a working implementation for either openSSL or mbedTLS, meaning that the function calls explained above are already implemented for these TLS libraries for linux.
112
115
113
116
###Memory Requirements
114
-
Building the SDK shadow example using the Keil ARM toolchain on a Windows box.<br>
115
-
Target is an ARM Cortex M4.<br>
116
-
Code: ~8kb code+const<br>
117
-
RAM: ~12kb<br>
118
-
These numbers are with TLS and TCP/IP code stubbed out. This is just the SDK.
119
117
118
+
These numbers do not include TLS and TCP/IP code. This is just the AWS IoT SDK.
119
+
120
+
####Marvell Example
121
+
The following sizes are of AWS IoT sample compiled for [Marvell AWS IoT](https://github.com/marvell-iot/aws_starter_sdk) platform.
122
+
#####Size of Certificates
123
+
124
+
- Private key - 1733 bytes
125
+
- Signed Certificate from AWS IoT - 1225 bytes
126
+
- Root CA - 1680 bytes
127
+
128
+
#####Size of SDK with MQTT subscribe publish sample
129
+
All sizes are in bytes
130
+
131
+
| Name | Text | RO Data | Data | BSS | Common | Total|
@@ -27,8 +27,8 @@ Ensure you understand the AWS IoT platform and create the necessary certificates
27
27
28
28
In order to quickly get started with the AWS IoT platform, we have ported the SDK for POSIX type Operating Systems like Ubuntu, OS X and RHEL. The porting of the SDK happens at the TLS layer, and for the MQTT protocol. The SDK is configured for two TLS libraries and can be built out of the box with *GCC* using *make utility*. The tarballs can be downloaded from the below links.
*[mbedTLS from ARM](https://s3.amazonaws.com/aws-iot-device-sdk-embedded-c/linux_mqtt_mbedtls-1.1.1.tar)
32
32
33
33
##Installation
34
34
This section explains the individual steps to retrieve the necessary files and be able to build your first application using the AWS IoT device SDK for embedded C.
0 commit comments