A new open source operating system for embedded systems | Opensource.com

A new open source operating system for embedded systems

RT-Thread Smart is working to open source the world of IoT and edge computing.

An intersection of pipes.
Image by : 
Opensource.com
x

Subscribe now

Get the highlights in your inbox every week.

There's a growing demand for embedded operating systems, and it's best when the one you build upon is open source. The RT-Thread project's R&D team has spent two years of research and intensive development to arrive at the project's latest offering: RT-Thread Smart. It is a microkernel operating system aimed primarily at midrange to high-end processors such as RISC-V or Arm Cortex-A that with a memory management unit (MMU) and provides a competitive and POSIX-based software platform for all industries in the embedded space.

Who needs RT-Thread Smart?

RT-Thread Smart is a professional, high-performance, microkernel operating system for real-time applications. It offers an open source foundation for embedded devices in any market, including security (e.g., internet protocol cameras), industrial control, onboard devices, consumer electronics, and anything else using embedded technology (which is increasingly coming to mean "everything"). It's significant because, unlike traditional IoT operating systems, a microkernel operating system can fill the gap between a traditional real-time operating system (RTOS) and a comparatively large operating system like Linux to achieve the best balance between real-time performance, cost, security, startup speed, and more.

RT-Thread Smart's architecture

RT-Thread Smart splits a system into kernel space and user space by taking advantage of the MMU and system call methods. It then divides the address space for each mode (a 32-bit system provides 4G address space).

The RT-Thread Smart kernel includes the platform's basic functionality and supports customizations. RT-Thread Smart's userspace application environment uses musl libc to provide POSIX interface calls and C runtime supports. It also inherits the original RT-Thread ecosystem, using SCons or other build tools such as Autotools, Makefiles, CMake, and so on to support development, as well as RT-Thread's out-of-the-box online software packages (over 342 at the time of this writing). You can even port Linux applications, such as wget/cURL, BusyBox, OpenSSL, and Simple DirectMedia Layer, to your platform.

The compressed RT-Thread Smart kernel is just 217KB, with a root filesystem of 127KB. Typical memory usage is about 2MB.

Including full support for filesystems, network protocol stacks, and multimedia, it takes only three to five seconds for RT-Thread to finish its startup process. Without running or loading complex user applications, RT-Thread Smart requires less than 500ms to start and be ready.

With its integrated Persimmon user interface (UI) component, the time it takes from power-on to a running UI is about one second. In other words, this is a seriously tiny and fast system. Of course, "real time" isn't about startup but how the system performs consistently over time. For RT-Thread, real-time performance is a priority, and the interrupt latency is less than 1 μs, which meets most application cases with the strictest real-time requirements.

RT-Thread Smart vs. RT-Thread

You might be wondering about the differences between RT-Thread Smart and RT-Thread. Simply put, RT-Thread Smart is an RT-Thread RTOS-based operating system, but it integrates the user-space process. The kernel part of RT-Smart is essentially RT-Thread RTOS; it runs on virtual addresses, adds process management, and uses interprocess communication mechanisms, virtual memory/address space management, ELF loaders, and so on, and it makes all of these features components within RT-Thread RTOS. When the components are disabled, RT-Smart falls back onto RT-Thread RTOS.

Here's a comparison:

  RT-Thread RT-Thread Smart
Supported chips Cortex-M/R, RISC-V RV32IMAC (and similar), Cortex-A MPU MPU with MMU, such as ARM Cortex-A and RISC-V
Compiling The kernel and application are compiled into an image program. The kernel and application can be separately compiled and executed.
Memory Runs on a linear address space (even with MMU) and uses virtual addressing with the physical address Runs on a 32-bit system with the kernel running on more than 1GB, the user-space
process that has full 4G address spaces are isolated from each other. Peripheral drivers must access peripherals with virtual addresses.
Running errors When an application fails, the overall system collapses. When an application fails, it does not affect kernel and other process execution.
Running model Multi-thread model Multiprocess model (multithread is supported within the process, and kernel threads are supported by the kernel)
User model Single-user model Single-user model
API RT-Thread API, POSIX PSE52 RT-Thread API (on kernel and userspace), plus a full POSIX API
Real time Preemptive hard real-time system Preemptive hard real-time system
Resource utilization Very small Relatively small
Debugging Generally debugged through the emulator Supports GDB debugging and no emulator
required

RT-Thread RTOS is very compact. All applications and subsystems are compiled into the image, and multi-thread applications run and share the same address space.

RT-Thread Smart is independent. Systems and applications are separately compiled and executed. Applications have a full address space and are kept isolated from each other. It also inherits all the great real-time features of RT-Thread and features a POSIX environment.

Similarly, they're both compatible with the RT-Thread API, so applications on RT-Thread RTOS can be smoothly ported to RT-Thread Smart.

Embed open source

RT-Thread Smart is an open source project, with its code available on GitHub. You can download the code and its documentation, give it a try, submit comments and feedback, and help spread it to more open source advocates. Embedded systems should belong to their users, and there are too many embedded developers out there who don't realize what's available.

If you're a developer, help hack on RT-Thread Smart! As the RT-Thread project continues to advance, we aim to make the exciting worlds of IoT and edge computing open source.

Looking at a map

The AT device package for controlling wireless modems is one of RTOS's most popular extensions.
Working from home at a laptop

Home automation is an exciting and fun branch of tech. Start designing your home automation solutions today with open source tools.

About the author

Zhu Tianlong - Has more than 10 years of RTOS programming experience and is committed to researching and developing cutting-edge technology.