embOS is a real-time operating system from SEGGER, a member of the ST Partner Program, that runs on all STM32 microcontrollers and is currently in billions of devices, all microarchitectures combined. Among other things, it is particularly efficient as its kernel ROM size is about 1,700 Bytes, and its RAM size is a mere 71 Bytes while context switching only takes 320 clock cycles on a Cortex-M4 STM32F407IG. Comparatively, a paper from scholars at the University of Suceava in Romania estimates that on the exact same MCU, alternatives can take as much as 1,340 cycles while the fastest ones in their benchmarks dropped to 462 cycles at best. embOS is also popular because it is objectively reliable as the company puts forward its IEC 61508 SIL 3 and IEC 62304 Class C certifications which enable the OS to be in medical, automotive, or avionics applications, among many others.
Unlike other competing solutions, embOS obtained these certifications after minimal rewrites, if any, because it had robustness and reliability in mind from the start thanks to its very modular approach. The kernel has two parts: a generic component and a hardware-dependent facet. The former represents about 80 % of the overall operating system and explains why embOS can run on 8-bit and 32-bit MCUs with very little memory while offering great performance. The hardware-dependent part pushes these optimizations further by taking advantage of certain aspects of a particular architecture. SEGGER also goes a step beyond its RTOS by offering add-on tools that will take advantage of certain features. For instance, its emCrypt uses STM32 Hardware Acceleration to optimize cryptographic operations. These tools work independently of embOS but also serve to attract more developers to SEGGER’s ecosystem.
embOS: More Than 50 Packages for STM32 Boards and Free Evaluation Software
The best way for users of an STM32 microcontroller to start experimenting with embOS is to head to SEGGER’s selector page where they’ll be able to download the RTOS and the tools relevant for their ST development board. One of the reasons we work closely with SEGGER is that their solutions for our components are free to use for evaluation and educational purposes without any technical limitations. Anyone can install embOS and other “em” products and use them for non-commercial purposes, making it a great platform to prototype while assessing the needs of a particular project. As SEGGER’s Dirk Akemann, Partnership Marketing Manager, and Martin Cröll, Software Developer embOS, explained:
“SEGGER has more than 50 packages for various ST boards and MCUs, which is our largest number of packages for a single vendor. Moreover, if there’s a board that we don’t currently support, customers can send us a request, and we often come up with a new package in a matter of days.”
STM32 users can count on the fact that the vast majority of testing processes within SEGGER run on STM8 and STM32 microcontrollers, making our collaboration with the company unique because its teams depend on the optimizations that differentiate them from their competitors. For years we’ve worked closely with SEGGER to ensure that they can provide the best possible solutions on our platforms. Their presence in the ST Partner Program thus shines a light on their selector page to ensure our community enjoys the fruits of our collaborations with frictionless access to reliable and powerful software.
Tickless Support: Using an STM32 Timer for Great Energy Savings
One feature that developers often miss but crucially highlights the optimizations present in embOS is its tickless support. Cortex-M architectures include a 24-bit system timer (SysTick) in the form a counter that decrements and throws an interrupt at every tick. Unfortunately, this system is far from optimal when trying to put the microcontroller in a deep sleep because of its numerous interrupts. By offering tickless support, SEGGER can altogether bypass SysTick and use the hardware timer TIM2 available on STM32 MCUs to reduce the number of interrupts significantly and, therefore, keep the component in a deep low-power mode longer, thus offering more significant energy savings.
Very simply, developers need to change the
OS_Idle() function to use tickless mode and set the maximum count time afforded by their STM32 hardware timer. The application will look at the duration of the low-power mode and only throw an interrupt when TIM2 reaches its maximum count time instead of sending one at every single tick. For instance, in SEGGER’s application note, a program sets a low-power mode for 200 idle ticks, and since the hardware timer of the STM32F103 offers a maximum count time of 58 ticks, using tickless mode means the system will only throw four interrupts (one after 58 ticks) before reaching 200. If developers use SysTick, they get 200 interrupts, which significantly limits the power savings possible during this deep sleep mode.
embOS: A More Efficient RTOS Means More Resources Available for Applications
Tickless support is an excellent example of the advantages embOS can bring to a product. It also explains why an increasing number of companies are moving away from Linux and adopting a real-time operating system for their computationally demanding application. The chart below shows the memory footprint of embOS compared to Linux and other RTOSes. When we combine these gains with optimizations such as tickless support, we see that developers are migrating to these systems because they get to enjoy additional resources that were previously unavailable while facilitating the use of advanced features thanks to the kernel’s hardware-dependent module or SEGGER’s independent tools.