Building Device Management Client for non-Mbed OS operating systems
Tip: If you cannot access some of the repos referenced in this section, please contact us to request access.
Requirements
For all requirements, see the tools and account section.
Including Device Management Client in your application
Here are the typical steps when using Device Management Client with an application:
-
Add the following files and folders to your application:
File Purpose mbed-cloud-client.lib
The .lib
file for importing a specific version of Device Management Client.CMakeLists.txt
CMakeLists specific to the application. It contains all the necessary include and source paths to build Device Management Client for a given platform. pal-platform/
Contains the platform-specific components and deployment scripts.
Only needed for non-Mbed OS builds. -
Fetch Device Management Client and the needed platform source-files by running
mbed deploy
(for those using Mbed CLI). This deploys all the.lib
files.
Additional steps for non-Mbed OS builds
If you are building for a system other than Mbed OS, please set up the sources, and configure the build for your target.
Defining a target and toolchain
Configuring a build requires selecting:
-
Toolchain - The name of the toolchain used for compilation.
Variable Purpose TOOLCHAIN
Specify your platform. We support ARMCC, ARMGCC, GCC(x86). -
Target - The build target is a variable composed of three parts:
Variable Purpose PLATFORM
Specify your platform. We support x86_x64
andK64F
.OS
Specify your OS. We support NativeLinux
.SSL_LIBRARY
Define your SSL library. We support Mbed TLS.
The currently supported reference implementation is x86_x64_NativeLinux_mbedtls
.
Configuring the build
-
For a simple build (this will also compile):
python pal-platform/pal-platform.py fullbuild --target <PLATFORM_OS_SSL> --toolchain <TOOLCHAIN> --external ./../define.txt --name mbedCloudClientExample.elf
-
For a manually configured build:
-
Deploy, and generate the Make directory.
python pal-platform/pal-platform.py deploy --target=<PLATFORM_OS_SSL> generate
For example, this configuration is for native Linux OS running on an
x86_64
platform with Mbed TLS as the SSL library:python pal-platform/pal-platform.py deploy --target=x86_x64_NativeLinux_mbedtls generate
The script generates a build directory in the form of
__<PLATFORM_OS_SSL>
. In our example, the generated build directory is__x86_x64_NativeLinux_mbedtls
. -
Configure the application for your selected target from the generated build directory:
cmake -G "<SYSTEM_GENERATOR>" -DCMAKE_BUILD_TYPE=<BUILD_TYPE> -DCMAKE_TOOLCHAIN_FILE=<TOOLCHAIN_RULES_FILE>
You can, and probably need to, give the following variables to generate Makefiles for the correct target:
Variable Purpose SYSTEM_GENERATOR
Specify a build system generator. For Unix makefiles, use Unix Makefiles
.BUILD_TYPE
Select either a release
ordebug
build.TOOLCHAIN_RULES_FILE
Define the location of the toolchain rules that CMake should use to generate Makefiles. For example, for the above configuration, you need the following commands for CMake to set up the right Makefiles:
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=./../pal-platform/Toolchain/GCC/GCC.cmake
-
For more details on the manual build procedure, see the PAL platform utility documentation.
Building the application
make <your application>.elf
This builds only your main application executable, based on the name that you gave in your application's CMakeLists.txt
.