BEYOND THE DATASHEET
/ WHAT IS HW-RTOS?
By Philip Ling
Editor-in-Chief and Senior Technology Writer, Avnet
Using hardware accelerators is nothing new, but what about an accelerator for your operating system?
Most embedded systems now use some form of operating system, particularly if they are based on a modern 32-bit core like the Arm Cortex-M family. Support for embedded real-time operating systems is strong, thanks to the benefits they bring. But real-time comes in many shapes, so what can engineers do if they need to maintain hard real-time execution? One approach is to make full use of the hardware features offered by the processing platform.
A low-level operating system provides an abstraction layer between the application code and the device’s hardware features. This makes it easier for higher-level code, such as middleware, to access the available hardware features.
A real-time operating system, or RTOS, provides a way of managing these features. The real-time part provides some guarantee that things happen just when you want them to. This can create conditions where the software and hardware battle for control. The way around this is to turn off features that could disrupt the flow, but this too has problems. If certain features, like interrupts, are turned off (masked) even for very short periods, there is a chance that an event will be missed.
This basically describes the huge challenges involved and the enormous skills required when developing real-time systems. The RTOS was designed to mitigate these issues, using techniques such as ticks, semaphores and interrupt service routines (ISR). All these features are normally software based.
The concept behind the proprietary HW-RTOS, or hardware RTOS, is to implement these features in hardware and access them through APIs. What this brings is low interrupt latency with low jitter and very short interrupt disable periods.
The main features of the Renesas HW-RTOS
By taking a dedicated hardware approach, the HW-RTOS handles the tasks that could make an RTOS less responsive. Because these features are offloaded to hardware, the rest of the system becomes more responsive and less susceptible to disruption from isolated events.
The first of these is tick offloading. By handling the process of measuring elapsed time in hardware, the RTOS doesn’t have to stop executing its current task just to mark time. And because the tick is executed in hardware there is little variation in time measurement, resulting in higher precision.
The tick offloading feature of Renesas’ HW-RTOS acceleration technology delivers greater accuracy and higher processor utilization.
Interrupt servicing is a big part of real-time system design. An RTOS handles interrupts by switching to the relevant service routine when an interrupt is detected. If another interrupt is asserted during that time, potentially with a higher priority, it could be missed. The normal approach is to switch between tasks when servicing interrupts, but this can result in long periods of time when no tasks are being executed, due to the interrupt servicing process.
In the HW-RTOS, the interrupt service routine is handled in hardware. This has the effect of reducing the load on the CPU, but also shortening the time during which interrupts are disabled. A further gain is a reduction in context switching.
Task switching with HW-RTOS
The HW-RTOS works through APIs. To the host operating system, the HW-RTOS looks like a peripheral sitting on the system bus. Renesas has created a library for using the three registers that control the HW-RTOS. These registers are the API register, the argument register and the result register. If a task switch is needed, the HW-RTOS indicates this to the host operating system and puts the identification of the task to switch to into the results register.
The HW-RTOS is available in the RZ/N1D, RZ/N1S and RZ/N1L processors from Renesas. For more information about HW-RTOS, including a full list of the APIs it supports, take a look at this document on the Renesas website.