Porting Pelion Device Management Client to devices
The Platform Abstraction Layer (PAL) connects Device Management Client to the underlying platform. PAL sits between the device or operating system and the Device Management Client library, providing a single API that services can use across all devices and operating systems. PAL enables easy and fast portability of Device Management Client, and allows it to operate over a wide range of Arm cortex-based platforms running different operating systems with various libraries. The Device Management Client Porting layer for Mbed OS and Linux is available from Arm. If you want to run Device Management Client on your own custom platform, then you need to port all the PAL platform modules, as the headers of the PAL platform API describe. You may also need to change some of the configuration files.
This chapter covers:
This section begins by giving an overview of the tasks needed to port the PAL platform APIs to a new target platform. It explains the PAL modules and layers, as well as their porting order. It then discusses the basic configurations for PAL porting and gives instructions for porting the following PAL modules: the RTOS, networking, Crypto, FileSystem and TLS/DTLS modules. Each instruction set explains the module scope, prerequisites for the porting stage, and the porting result, while providing porting notes and reference implementations.
This section explains how to plan an update port and gives an example of this with an FRDM-K64F port running Mbed OS. To add firmware update capability onto a new device, you should consider the memory layout and the bootloader. When designing the memory layout, three components must be in place and work together: the bootloader, an active user application and a storage area for the new firmware. The example port for the target FRDM-K64F and Mbed OS 5 shows you how to choose the location of the active header and firmware, choose the firmware candidate storage area location and format, and if your target is not supported by Mbed OS, how to implement the Mbed HAL API for your target.
PAL provides a test suite to test the service API, which is used by the services running on top of PAL. This section guides you through compiling and running the tests, understanding the tested modules, the PAL test structure, the PAL test requirements, how to customize PAL tests and the results that you should expect to see if a PAL port is working correctly.
The pal-platform utility script deploys and generates platform-dependent files needed to build and run non-Mbed OS applications. This section describes the pal-platform utility, its requirements and usage. It also provides examples of the
fullbuild subcommands. If you use a manual approach, rather than the
fullbuild command, then the
generate step will result in a
build directory, which contains CMake files. You can use the
cmake tool to generate Makefiles for debug binaries for the target toolchain from this
build directory. The section concludes by explaining how to add a new port to the pal-platform.
This section explains how to build an application that uses Device Management Client for different platforms. We recommend using Mbed CLI for Mbed OS, which allows you to build directly from the command-line and generate Makefiles and project files for various IDEs. For Linux, you can build Device Management Client by using Makefiles that the CMake build system autogenerates. The section then discusses how to build the R1.3 or higher versions of Cloud Client for different operating systems, explaining how to include Device Management Client in your application, additional steps for non-Mbed OS builds and how to build the application itself. The section concludes by discussing the Device Management Client error recovery mechanism for connectivity and firmware update error handling, as well as debugging devices running Device Management Client.
This section is for those using a customized or propriety porting layer based on Device Management Client 1.2. We’ve added a number of features and security enhancements since Device Management Client 1.2, which have implications for the PAL porting layer. This guide discusses the main changes and helps you make the adjustments required to upgrade to the current version. It also explains how to change a customized porting layer and the changes that you need to make in each module – the RTOS module, Crypto module, TLS module and PAL executables – to migrate it from Device Management Client 1.2 to the current release.