Software development with Mbed OS
We provide software to build and deploy the firmware for IoT devices: the real-time operating system Mbed OS and compatible libraries to connect to Pelion Device Management.
Arm has created a real-time operating system called Mbed OS. It's an Apache 2.0 licensed open-source operating system for Cortex M-based devices. It is based on the Keil RTX5 RTOS kernel, and is CMSIS compliant, which allows for easy flashing and communication with the device.
Since you have already gone through the evaluation stage, you should be familiar with Mbed OS. Although Pelion Device Management supports other device operating systems, this guide assumes that you are creating a product with Mbed OS.
We have several libraries to connect to Pelion Device Management, supported by different hardware classes and with different security requirements, to match your solution's hardware and connectivity needs.
|Library||Device class||Operating system||Connectivity type|
|Device Management Client||Mainstream IoT||Mbed OS, Linux||Direct to the cloud|
|Device Management Client Lite||Constrained||Mbed OS||Direct to the cloud|
|Device Management Edge Core||Edge gateway, used to connect ultra-constrained devices||Linux||Gateway|
Device Management Client
The Device Management Client library is a C++ library that runs on top of Mbed OS. It uses Mbed OS's CoAP library, storage, and connectivity options along with Mbed TLS to securely connect the device to Pelion Device Management. Device Management Client provides the following functionality:
- Implements the device management functionality, such as LwM2M resource definitions and firmware update.
- Exposes an API that you can use to implement device logic, such as:
- Defining custom LwM2M resources based on data from the device.
- Authorizing firmware updates based on critical system functions.
- Implementing callback actions triggered from LwM2M resource updates.
- Implements a secure storage solution, called the Enhanced Secure File System, that contains the credentials to connect to Device Management. The private keys to these credentials are encrypted on the device.
Device Management Client's connection to Device Management is secured through the use of X.509 certificates.
The rest of this guide will assume that you are using the Device Management Client.
Device Management Client Lite
Device Management Client Lite is a C++ library that provides almost the same functionality as Device Management Client, but adjusted for constrained devices with limited RAM and Flash:
- It uses pre-shared keys (PSK) rather than X.509 certificates.
- PSK is stored on the device's flash, eliminating the need for external memory.
For a full list of differences between the two client libraries, please see the documentation.
Device Management Edge Core
Device Management Edge Core is a C++ library that extends Device Management Client so that you can manage the gateway as well as the devices connected to it. Edge devices, normally legacy or ultra-constrained devices, must implement the Protocol Translator. The translator translates the device's non-IP communication layer to LwM2M and sends this data back to Device Management Edge Core through JSON RPC2.0.
The translation allows Device Management Edge Core to manage these devices like any other connected endpoint; they appear in Pelion Device Management as additional devices, with their own unique endpoint name and LwM2M resources.
For more information on Device Management Edge Core, the Protocol Translator and how these two elements communicate with each other, please see the documentation for Device Management Edge.
Software development for a proof of concept
To create an IoT solution, you need to develop four applications:
A provisioning application, which we will explore in more detail in the prototype stage.
For this stage, use the developer workflow: it relies on the Device Management's developer certificate, so test devices can connect to a Device Management account without going through the normal provisioning process.
A device application, using Mbed OS (or another operating system) and Device Management Client, as reviewed below.
A bootloader, as reviewed below.
A web application of your own design, which includes a connection to Device Management.
The device application
The device application is where the main logic of your embedded software is implemented. It includes your connectivity drivers, Device Management Client and local control.
To develop your device application, refer often to the Mbed OS documentation.
Mbed OS examples: There are several example applications built for Mbed OS devices that showcase the various APIs and connectivity. For a full list of officially supported examples, please see the Mbed OS team examples repository and the Mbed OS API references.
Pelion-ready examples: We also provide Device Management Client examples that are ready to use and can serve as a baseline for production-ready applications. We recommended that you modify these examples for your own custom purpose:
Device Management Edge: If you are creating products based on Device Management Edge, you need to develop a protocol translator and port Device Management Edge to your hardware. Please see the full Device Management Edge documentation for more information.
A device must have a bootloader to be able to update firmware using the Device Management Update service. You need to combine the bootloader with the main device application before you flash the application to the device for the first time. The bootloader then remains on the device for the device's entire life cycle, so you do not need to flash it again or include it in your application updates.
Our reference bootloader works on several platforms, so you can quickly evaluate the update feature on your device. We recommend you use the reference bootloader at this stage in development, as it works out of the box or with minor modifications for custom platforms.
If you use our bootloader, or any other managed bootloader, our development tools can combine it with the application. If you use your own bootloader and it is unmanaged, you will need to write a script to combine it for you.
- The Pelion documentation offers an overview of the reference bootloader.
- A detailed explanation of the bootloader and how it interacts with the Update client and the rest of your device application is part of the Update Client documentation..
- For more information about managed and unmanaged bootloaders, see the bootloader documentation.