Mbed OS bare metal profile
Bare metal is a profile of Mbed OS for ultraconstrained hardware: compact and without an RTOS. It represents a different way of working with Mbed OS: the bare metal profile builds only the smallest set of APIs that applications require - driver APIs, platform APIs and a subset of the RTOS APIs. This gives you better control of the application's final size than the full profile, which relies on the build time linker to remove classes that are not used and are not a dependency.
The bare metal profile implements a subset of Mbed OS's RTOS APIs that are useful in non-threaded applications, such as semaphores (calling the release API from interrupts) and tickers (to set up a recurring interrupt). It does not include an RTX, and is therefore suitable for applications that do not require complex thread management. Instead of the RTOS's scheduler, all activities are polled or interrupt-driven. This simplifies application code and allows using APIs that are not thread safe. Just as important, you can use the code-optimized versions of the C standard libraries,
newlib-nano, which are much smaller than the thread safe equivalents the full profile requires.
The Mbed OS build tools - Mbed CLI, Mbed Online Compiler and Mbed Studio - all support working with the bare metal profile.
Note: Because bare metal uses some APIs that Mbed OS classifies as RTOS APIs, some class names that traditionally belong in RTOS programming are used in bare metal. For example, bare metal uses the class
ThisThread despite not using threads.
✔ : Supported - by default or manually | ✗ : Not supported
|Events||✔ (can be manually enabled)|
|HAL||✔ (can be manually enabled)|
|RTOS APIs||Enabled by default: Semaphore, Mutex, EventFlags, ThisThread.
All other APIs not supported.
|Storage||✔ (can be manually enabled)|
|BLE||✔ (can be manually enabled)
Except the BlueNRG-MS component
|NFC||✔ (can be manually enabled)|
|Mbed Crypto||✔ (can be manually enabled)|
|Devicekey||✔ (can be manually enabled)|
|Mbed TLS||✔ (can be manually enabled)|
The bare metal documentation covers:
- A bare metal usage guide that shows how to set up a bare metal application, or migrate an Mbed 2 application, and enable non-defult APIs.
- A short review of small C libraries.
- A porting guide for Mbed OS 2 targets.
Additionally, our quick starts include a bare metal version of the Blinky example application.