November 9th, 2017 by
Real-time operating systems(RTOS) are becoming a major necessity that embedded software developers must incorporate in their applications. As their devices start to rely on the internet and their micro controllers move to 32-bit architectures, even traditional bare-metal developers are transitioning to using real-time operating systems. But developers must face certain challenges when using an RTOS, no matter their level of experience. These challenges include:
Deciding when to use an RTOS
Most bare-metal developers have a hard time deciding when to use an RTOS. This is because there is a lot that developers can do to utilize preemptive scheduling without having to switch to RTOS. Here are some questions to ask when considering a switch:
- Does the application in use have a connectivity stack like WiFi, USB, or TCP/IP?
- Will time management get simplified if an RTOS is used?
- Will using an RTOS improve application maintenance and management?
- Do you need deterministic behavior?
- Do your program tasks require the ability to preempt each other?
- Does your MCU contain 32 KB code space and at least 4 KB RAM?
If the answer to most of these questions is yes, using an RTOS will simplify your applications’ use and development.
Setting task priorities
Developers must select top tasks and arrange them in order of priority. Most developers determine order priorities based on how important they deem a task to be. However, determining task priorities in such a manner is often disastrous. As a developer, you should rely on monotonic rate scheduling to determine whether your periodic tasks are scheduled successfully. RMS treats all tasks as periodic and fails to interact appropriately; it acts as a starting point but it can sort the priority tasking issue up to 80 percent. Developers can utilize trace tools to observe their system behavior and make the right adjustments.
It is common for developers to spend 20 to 80 percent of a development cycle debugging application codes. This means that developers spend a lot of time debugging. Using a real-time operating system complicates debugging by introducing problems like priority inversion, task jitter, and deadlock. Developers new to RTOS do not know about new and effective debugging techniques, like tracing, that can be used to debug systems. These tools record when tasks begin and conclude their execution.
There are some memory management layers offered by real-time operating systems. Developers may have to configure the RTOS to minimize their code size when using resource-constrained devices. Real-time operating systems require configuration adjustments to disable features that utilize too much RAM and code space. Developers must manage memory allocation and their RTOS objects properly.
Whether you are a real-time operating system novice or an experienced user, developers must face the above challenges during the design and implementation of an RTOS-based application. However, the need to understand real-time operating systems increase as system complexity increases, so it is worthwhile to work through these challenges and become familiar with RTOS technology.