AWS IoT Device SDK C:
Main
|
Return to main page ↑ |
Guide for porting this SDK to a new platform.
This SDK has three components that must be ported to a new system:
Guide for porting the SDK's build system.
The CMake-based build system present in the SDK's GitHub repo targets desktop systems and builds libraries into shared or static libraries. The build selects the types of the platform layer based on the detected host OS and automatically configures the platform layer. See Building the SDK for more information on the build system.
In general, this SDK should build with C compilers in C99 mode. Currently, we do not guarantee builds with a C++ compiler. Compilers that provide intrinsics for atomic operations are recommended; see Atomics for more information.
The following directories contain the SDK's source code and are relevant for porting.
Of the directories listed below, only ports/
should be modified during porting. Empty templates of a new port are placed in ports/template
. Some directories present in the GitHub repo (such as cbmc
, doc
, and scripts
) are not relevant for porting and therefore not listed.
As relative paths from the SDK's root directory:
demos/
app/
main()
functions.include/
src/
iot_config.h
libraries/
aws/
defender/
include
src
test
common, jobs, shadow, ...
platform/
ports/
directory. types/
standard
common, mqtt, serializer, ...
ports/
common
include/
atomic/
src/
template
posix, ...
tests/
1
globally.third_party/
mbedtls/
tinycbor/
unity/
malloc
overrides thread-safe.The following paths should be passed as include paths to the compiler when building this SDK.
SDK include paths that are always required:
iot_config.h
. For example:iot_config.h
is in demos/
.iot_config.h
is in tests/
.ports/posix/include
when using the POSIX port.libraries/platform/
Each library has its headers in a different include
directory. Library include directories are in libraries/aws
for AWS IoT client libraries, and libraries/standard
for other libraries. For example, the MQTT library's include directory is libraries/standard/mqtt/include/
and the AWS IoT Shadow library's include directory is libraries/aws/shadow/include/
. Each library's include directory must be added to the include path if that library is being used.
Third-party submodule include paths:
third_party/tinycbor/tinycbor/src
third_party/mbedtls
and third_party/mbedtls/mbedtls/include
Additional include paths required to build the demos:
demos/include
Additional include paths required to build the tests:
third_party/unity/unity
third_party/unity/unity/fixture
libraries/standard/mqtt/test/access
(when building the MQTT or Shadow tests)libraries/standard/mqtt/test/mock
(when building tests that use the MQTT mocks, such as Shadow or Jobs)In addition to the tests include paths, IOT_BUILD_TESTS should be set to 1
globally when building tests.
Settings that must be set in the config header, iot_config.h
At the very least, the config header must contain the following defines:
The platform types must also be set. See Porting the platform layer for more details.
Guide for porting the SDK's platform layer.
Types that must be set in the platform layer.
ports/posix/include/iot_platform_types_posix.h
for an example of setting the types on POSIX systems.The platform types should be set in the config file, iot_config.h
, or in another header included by the config file. As an example, the header iot_platform_types_posix.h
sets the platform types to the matching POSIX system types. This header is then included in iot_config.h
by the provided CMake build system.
Functions that must be implemented for the platform layer.
libraries/platform
for the interfaces of the platform functions. ports/posix/src
for examples of functions implemented for POSIX systems.