1-1. Embedded systems and Real-time OS
Embedded systems
Embedded systems are computer systems embedded in devices for controlling them. While PCs, servers, and large computers are devices designed as computers that process information, embedded systems are not perceived by users as computers. For example, many of today's home electronic appliances are embedded systems equipped with microprocessors, but most people who use home electronic appliances are unaware that they are computers.
The main purpose of a typical computer, such as a personal computer (PC), is to provide services through information processing to human users. Specific purposes vary from user to user, and a single user may use a computer for many different purposes. Thus, a typical computer is a general-purpose system. Hereafter, this type of computer will be referred to as a general-purpose computer.
Table 1 summarizes the differences between embedded systems and general-purpose computers. An example of a general-purpose computer is a typical PC. Although there are many variations of embedded systems, depending on application and scale, we use typical IoT edge nodes for comparison purposes.
Personal computer | Embedded systems | |
---|---|---|
CPU | 2-64 bit high-performance processors (Currently 64-bit is the mainstream) Multi-core processors with multiple CPU cores are the mainstream |
Mainly 8-bit to 32-bit microprocessors (64-bit microprocessors are starting to be used) Single-core microprocessors with a single CPU core are the mainstream |
Memory | Several giga bytes of off-chip memory (Normally, RAM) Multi-level cache and virtual memory are used. |
On-chip memory in microprocessors from tens of K bytes to hundreds of K bytes Program code is often recorded in ROM. |
Secondary storage | External storage device such as a large-capacity hard disk Supports external storage devices such as CD-ROM, SD card, and USB memory |
Not mandatory |
OS | General-purpose OS such as Windows and Linux | Mainly real-time OSs are used. Some systems do not use an OS at all. |
Network communication | Supports various network communications such as Ethernet, Wi-Fi, and Bluetooth. | Not required for embedded systems, but required for IoT edge nodes. Near field communication is often used. |
Real-time operating systems
OSs used in embedded systems tend to differ between so-called microcontrollers and microprocessors.
The OSs used for microcontrollers are often OS designed for embedded systems called real-time OSs. In addition, relatively simple systems that use microcontrollers may not use an OS.
On the other hand, so-called microprocessors often use Linux or similar high-performance OSs. However, even for such microprocessor-based systems, a real-time OS is used in many cases, depending on the application needs, and Linux is not always used for microprocessor-based systems.
Although it is difficult to clearly define a real-time OS, it can be said that a real-time OS is an OS that has the following main characteristics.
- Lightweight OS running on resource-tight microprocessors
- Multitasking to execute multiple processing in parallel
- OS with high real-time response
Multitask
Multitasking is the parallel execution of multiple programs (or so-called tasks). In practice, however, a microprocessor can execute only one program at a time. In other words, multitasking is not possible with microprocessor function alone.
Therefore, OS realizes multitasking by switching between execution of multiple tasks.
In multitask processing, determining the order in which tasks are executed by the OS is called scheduling. The processing of actually switching the execution of tasks according to the determined scheduling is called dispatching.
Scheduling can be done in a variety of ways. A common one is time-division scheduling, in which the execution time of the microprocessor is shared, i.e. divided for different tasks, and the execution of each task is allocated to a time slot. The simplest time-share scheduling is round robin scheduling, in which tasks are executed sequentially during each allocated execution time (Figure 1-1-1).
This type of time-share scheduling is the basic scheduling framework for general-purpose computers such as PCs. However, in a real-time OS, time-share scheduling is usually not used because it is not suitable for achieving good real-time response.
Achieving real-time response
To achieve real-time response, a real-time OS employs a priority scheduling scheme based on priorities given to tasks, which is different from a time-share schedule.
As an actual example, the scheduling rules for tasks in μT-Kernel are shown below.
- All tasks are given a priority.
- The OS executes the task with highest precedence among the tasks in READY state.
- When there are multiple tasks of the same priority in ②, priority is given to the task that has become executable first.
In priority scheduling, the execution time given to each task is not fixed. Also, the order in which tasks are executed follows priority, so they are not executed in the order in which they become executable first (Figure 1-1-2).
1-2. TRON Project and μT-Kernel
About TRON Project
TRON Project is a computer architecture development project by collaboration of industry and academia. It started in 1984, and has continued to proceed with computer-related developments such as RTOSs.
Its goal is to realize the Highly Functionally Distributed System (HFDS) or "Computers Everywhere" concept proposed by the project leader, Ken Sakamura. The concept is that computers are embedded in every part of our daily living, and that they are connected to a network and work together to create a comfortable environment (Figure 1-2-1).
This HFDS concept later was called ubiquitous computing, which is now being realized as the IoT.
ITRON specification OS for embedded systems
One of the early TRON Project developments was Industrial TRON (ITRON), a real-time OS specification for embedded systems. It can be said that this ITRON specification OS is the root of μT-Kernel.
The first ITRON specification OS was compiled in 1984, and ITRON became popular in various fields as embedded systems were used throughout the world in the 1990s.
At that time, the mainstream CPU of embedded systems was 8- to 16-bit microprocessors, and µITRON was developed to adapt to these microprocessors and narrow down their functions. Later, ITRON specification and µITRON specification will be integrated into µITRON 3.0 specification.
The last major version of µITRON specification was µITRON 4.0, which was released in 1999. More than 20 years have already passed since then, and µITRON specification OSs continue to be used in many embedded systems today.
T-Engine Project and T-Kernel
After the year 2000, a new project, T-Engine project, was started to develop a standard development platform for embedded systems.
At that time, the performance of embedded system microprocessors had increased very much, and high-end ones were beginning to use 32-bit CPUs with MMUs. Embedded system software itself had become large and complex, and improvement of development efficiency had become more important.
On the other hand, many microprocessor manufacturers were developing microprocessors with their own specifications, and there was no development environment that could be called a standard.
In the T-Engine project, various aspects of the development process such as microprocessor boards for development, real-time OSs and software development environments, in order to create a standard development platform that overcome the barriers between manufacturers. The real-time OS developed in this context was T-Kernel.
T-Kernel Deployment and μT-Kernel
The real-time OS T-Kernel, which originated from the T-Engine project, spawned several derivative versions as it became popular. One of them is μT-Kernel (Figure 1-2-2).
T-Kernel targets high-end microprocessors with 32-bit CPUs equipped with MMUs, and does not target the 8- to 16-bit microprocessors that μITRON has conventionally supported. However, as T-Kernel was used widely, there was a growing demand to use T-Kernel in these lesser microprocessors, leading to the development of μT-Kernel for small-scale embedded systems.
The first version of μT-Kernel released in 2007 was a subset that supported only the basic features of T-Kernel so that it could be used on 8- to 16-bit microprocessors. Subsequently, in the next version of μT-Kernel 2.0 released in 2013, many features of T-Kernel were incorporated by allowing only necessary features to be implemented through profiles.
There are fewer functional differences between the current T-Kernel and μT-Kernel. However, while T-Kernel assumes memory management by MMU, μT-Kernel is targeted at microprocessors that do not have MMU, or systems that have MMU but do not use it. This remains a major feature of μT-Kernel.
In recent years, 32-bit CPUs have become the mainstream for so-called microcontrollers, so μT-Kernel can be called a real-time OS for microcontrollers without MMUs.
The current version of μT-Kernel is now μT-Kernel 3.0, its third generation.
1-3. International Standard OS for IoT Edge Nodes and μT-Kernel 3.0
Standardization of IoT Edge Node OS by IEEE
As the IoT became increasingly popular, the Institute of Electrical and Electronics Engineers (IEEE), a U.S. standards organization, standardized a real-time OS for it.
In standardizing the OS for IoT edge nodes, the IEEE focused on the TRON OS family, which is widely used in embedded systems, and standardization was promoted based on the μT-Kernel 2.0 specification. Copyright of μT-Kernel 2.0 specification was transferred to IEEE (shared by TRON Forum and IEEE) through discussions between IEEE and TRON Forum, and the specification was officially published in 2018 as IEEE 2050-2018 standard.
IEEE 2050-2018 is an international standard for real-time OSs, positioned as the "IEEE Standard for a Real-Time Operating System (RTOS) for Small-Scale Embedded Systems."
μT-Kernel 3.0
μT-Kernel 3.0 is the latest version of μT-Kernel released by TRON Forum in 2019, and the newest member of TRON real-time OS family at this time.
Since μT-Kernel 3.0 is the first major version upgrade in six years since μT-Kernel 2.0, the specifications were completely re-examined, and the reference source code was re-implemented. The main changes from μT-Kernel 2.0 to 3.0 are listed below.
Compliant with IEEE 2050-2018
In terms of specifications, it fully complies with the IEEE 2050-2018 standard.
Support for new microprocessors and improved portability
Recent microprocessors have various built-in I/O devices. Features that were once realized by multiple chips on a microprocessor board can now be supported by a single-chip microprocessor. On the other hand, as typified by ARM microprocessors, CPU cores tend to be commonized across manufacturers.
The source code of T-Kernel and μT-Kernel have conventionally been structured so that the hardware-dependent part is separated from the common part of the OS to avoid dependence on a specific microprocessor or hardware. In μT-Kernel 3.0, this has been reorganized to match the recent microprocessor scene.
In addition, the reference source code now, supports major popular CPU cores better. Table 1-3-2 shows the microprocessors supported by the reference source code. This information is for version 3.00.05 at the time of writing and more microprocessors will be supported in the future.
Supports the latest development environment.
The standard development environment of TRON Forum up to μT-Kernel 2.0 assumed the use of the automatic program build tool "make" and the scripting language Perl, and the reference source code was structured accordingly.
In T-Kernel 3.0, the development environment has been changed from one that assumes tools such as "make" and Perl to one that does not depend on a specific development environment as much as possible.
μT-Kernel 3.0 can be built in a C programming environment without changing the source code structure, etc. At the time of writing, build succeeds with various integrated development environments, such as Eclipse, STM32CubeIDE, E2 Studio, and SEGGER Embedded Studio.
Git-based development and release from GitHub
μT-Kernel 3.0 development has started to use the version control system Git. Reference source code for μT-Kernel 3.0 is available from GitHub instead of conventional downloading from the legacy website.
In the past, embedded systems tended to avoid frequent OS version upgrades from the standpoint of product software maintenance. However, the use of GitHub has made it easier to identify differences between versions and to retrieve specific versions from the past, which allows more frequent and smaller version upgrades.
In addition, pre-release versions for evaluation purposes now have been released quickly prior to the regular version upgrades.
Currently, TRON Forum has released the following repositories on GitHub related to μT-Kernel 3.0.
μT-Kernel 3.0 (mtkernel_3)
https://github.com/tron-forum/mtkernel_3
The source code of μT-Kernel 3.0 is available.
You can obtain the source code of the official and pre-release versions of μT-Kernel 3.0 from "Release" in this repository.
μT-Kernel 3.0 development environment collection (mtk3_devenv)
https://github.com/tron-forum/mtk3_devenv
A set of μT-Kernel 3.0 and project files, etc. are available for various development environments.
Various development environments can be used with μT-Kernel 3.0, but setting up your own development environment requires some knowledge and work, such as creating a project file. Therefore, we provide pre-created project files to make it easier for developers to set up a development environment.
μT-Kernel 3.0 BSP collection (mtk3_bsp)
https://github.com/tron-forum/mtk3_bsp
The Board Support Package (BSP) is released as a package that provides basic device drivers, etc., after porting μT-Kernel 3.0 to commercial off-the-shelf CPU boards.
It is intended to facilitate learning and evaluation of μT-Kernel 3.0 and software development using commercial off-the-shelf CPU boards.