Early thought on MBED-OS

Behnam Shakibafar
Nov 1 · 4 min read

Mbed-OS’s first release was about in 2009 with very elementary features. I got to know about it some years after started working with ARM Microcontrollers. I used to deploy STM32 and NXP ARM Cortex-M microcontrollers in my embedded projects and as they were going to be more and more complex I was feeling that something is missing in our programming.

in one of my long-time projects with CC2538, I found TI’s ZStack a very good sample of what always liked to have! ZStack is a semi RTOS (named OSAL by TI) that works many same on both CC2538 (an ARM Cortex-M3 based ZigBee microcontroller) and CC2530 (an 8051 based ZigBee microcontroller)! It was very pleasurable that I can learn things one time and use them with every microcontroller that TI built for ZigBee.

So I started searching if there is any more global RTOS that works on all microcontrollers and found mbed by ARM. The idea was just as my ideal were but it was not as prefect as needed to be that days. The only compatible IDE was online, supported evaluation boards were very limited and most important, the codes were at alpha level.

I tracked mbed for many years since my first contact, till some months ago that new version 5 released. This was a very major update and took me to try it again. Now, after some weeks of working and building few projects, I am totally engaged with it and I think I’m ready to start a real project based on Mbed-OS. I think it will be useful to share my thoughts on this way and document steps, so for now, let’s talk about the basics of Mbed-OS.

Introduction to the Idea

just like any other OS, the Mbed-OS is here to make programming easier and standardize, this time for Microcontrollers. We all know Linux as opensource OS made for PCs (X86, ARM Cortex-A, etc. processors) that many programmers use to compile and run their applications over it. The OS gives programmer the ability to develop, run and test its application independent from the hardware they use.

the basic idea for Mbed-OS is the same. for example assume that in a simple project you need to receive data from some sensors over I2C, process them and send it to a Client such as PC.

In the traditional way after choosing your microcontroller, opening new project in Keil or IAR, loading needed HAL, libraries and etc. based on resources you need on a microcontroller and then configure them. to prevent the same routine for each project the shortcut is to use sample codes that match your needs. but still, you have to know much about your selected microcontroller spec, resources, HAL and libraries! This makes us use the same chips for our projects and not to upgrade ourselves due to difficulties.

The idea of OS is usable here. Just as programmers that launch their apps on PC regardless of its hardware, and RTOS could help us to write our codes interdependent of microcontroller selected. In an ideal world you only don’t need much about the hardware of your chip, just check that it has needed peripherals and resources then configure them using high-level APIs and write your application on top of the OS drivers and libraries.

the bad news is the real world is not such ideal, and the good news is it’s not that bad, but there are very differences between the real OS (such as Linux) and Real-Time OS (such as mbed).

MBED Benefits

As an OS, it has all the components it should. take a look at the image to get the whole idea. you can read more and dive into details on the main page:
https://os.mbed.com/docs/mbed-os/v5.14/reference/index.html

Ok, I’m not going to explain due to the mbed site said all things needed and also you can see updates and news. Here I want to talk about how I’m going to use it in my projects.

For me the best part of using this RTOS is its support for complex operations. For example, I want to use BLE and TensorFlow Lite on the same microcontrollers. The main codes that provided by companies are for different chips.

The power of using Mbed-OS is that I can port a tested library from a chip (made by ST for example) to my main code on nRF52. That’s what I’m going through next weeks.

I will publish my codes on my GitHub, you can follow to get updates.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade