The Design and Implementation of the RT-Thread Operating System
eBook - ePub

The Design and Implementation of the RT-Thread Operating System

  1. 390 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

The Design and Implementation of the RT-Thread Operating System

Book details
Book preview
Table of contents
Citations

About This Book

Since the release of V0.01 in 2006, to the present V4.0 version, RT-Thread has developed a reputation among developers for its open source strategy. RT-Thread has gained a large following among members of the embedded open source community in China with hundreds of thousands of enthusiasts. RT-Thread is widely used in energy, automotive, medical, consumer electronics, among other applications, making it a mature and stable open source embedded operating system.

The purpose of RT-Thread RTOS Design and Implementation is to create an easy learning curve for mastering RT-Thread, so that more developers can participate in the development of RT-Thread and work together to create an open source, tiny, and beautiful Internet of Things operating system. The book's first part introduces the RT-Thread kernel and starts with an overview of RT-Thread before covering thread management, clock management, inter-thread synchronization, inter-thread communication, memory management, and interrupt management. The second part begins with RT-Thread kernel porting and explains how to port RT-Thread to a hardware board to run it. The second part also introduces RT-Thread components and discusses the Env development environment, FinSH console, device management, and network framework. Additional topics covered include:

  • The I/O device framework
  • Virtual file systems
  • Peripheral interfaces
  • Devices including the PIN device, UART device, and ADC device, among others.

Each chapter features code samples, as well as helpful tables and graphs, so you can practice as you learn as well as perform your own experiments.

Frequently asked questions

Simply head over to the account section in settings and click on ā€œCancel Subscriptionā€ - itā€™s as simple as that. After you cancel, your membership will stay active for the remainder of the time youā€™ve paid for. Learn more here.
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
Both plans give you full access to the library and all of Perlegoā€™s features. The only differences are the price and subscription period: With the annual plan youā€™ll save around 30% compared to 12 months on the monthly plan.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, weā€™ve got you covered! Learn more here.
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Yes, you can access The Design and Implementation of the RT-Thread Operating System by Qiu Yi, Xiong Puxiang, Tianlong Zhu in PDF and/or ePUB format, as well as other popular books in Computer Science & Operating Systems. We have over one million books available in our catalogue for you to explore.

Information

Year
2020
ISBN
9781000205268
Edition
1

1Embedded Real-Time Operating System

The operating system refers to the computer programs used to manage and control the computer hardware and software resources, which are directly run on the computer as the most basic system softwareā€”all the other software runs on top of the operating system. According to the application field, the operating system can be divided into several categories, such as desktop operating system, server operating system, mobile operating system, and embedded operating systems.
Desktop operating system refers to the operating system running on the personal computer; the current mainstream desktop operating system is Microsoft's Windows operating system; in addition, Linux and macOS are desktop operating systems.
Server operating system refers to the operating system running on large servers, such as cloud servers, database servers, network servers, etc. The current mainstream server operating system is Linux, but Microsoft's Windows server operating system also occupies a part of the market.
Mobile operating system refers to the operating system running on mobile phones, PADs, and smart TVs. Google's Android and Apple's iOS both belong to the mobile operating system. Traditionally, mobile devices like mobile phones and PADs are also embedded devices, but as the chips used by mobile devices become more powerful, the difference is obviously larger between the mobile operating system and the traditional embedded device, so that the mobile operating system is classified separately.
An embedded operating system is an operating system that is used in an embedded system. Embedded systems are widely used and easier to understand. All computers are embedded devices except servers, personal computers, and mobile devices. Embedded systems are everywhere in our lives, from military equipment to civilian affairs, from industrial control to network applications. The following are some typical embedded device examples; Figure 1.1 also lists some embedded operating system applications.
Figure 1.1
FIGURE 1.1Applications for common embedded operating systems.
Consumer electronics: a variety of information appliances, such as digital televisions, set-top boxes, digital cameras, audio equipment, videophones, home network equipment, washing machines, refrigerators, smart toys, etc.
Industrial control: a variety of intelligent measuring instruments, digital control devices, programmable controllers, controlling machines, distributed control systems, field bus instruments and control systems, industrial robots, mechatronic machinery, automotive electronics, etc.
Network applications: including network infrastructure, access equipment, mobile terminal equipment, shared bicycles, water and electrical meters, Internet of Things (IoT) terminal equipment, etc.
Military equipment: for all kinds of weapons control (such as artillery control, missile control, intelligent bomb guidance, and detonating devices); tanks; warships; bombers; and land, sea, and air military electronic equipment; radar; electronic counter-military communications equipment; and a variety of special equipment for field operation command.
Others: all kinds of cash registers, POS systems, electronic scales, bar code readers, commercial terminals, bank money counting machines, IC card input equipment, cash machines, ATMs, automatic service terminals, anti-theft systems, and a variety of professional banking peripherals and medical electronic equipment.

Embedded System

An embedded system is a computer system that is fully embedded on a device or inside a device and is designed to meet specific needs, such as the common embedded system in daily life, including TV set-top boxes, routers, refrigerators, microwave ovens, mobile phones, etc. They all have certain functions: the TV set-top box used to play TV shows on the network, and similarly, the router is used to select the optimal path and forward the network message correctly. Such systems are highly specialized and relatively single in functionality, usually only for specific external input processing, and then give the corresponding results, so that the embedded system only needs to have just enough but a small number of hardware resources to complete the required specific functions, and thus the cost can be effectively controlled.
General computer systems, on the other hand, do not have specific needs, but do everything possible to meet requirements. Even when constructing hardware systems, consider the changes in requirements over the next few years. For example, when people buy computers, they want to get as much high-end performance as possible for multimedia, games, work, etc.
As shown in Figure 1.2, the hardware equipment of the embedded system consists of a number of chips and circuits, including the main control chip, power management, and JTAG interface used in the debugging of the development phase, and may also contain some data acquisition modules, communication modules, audio/video modules, and so on.
Figure 1.2
FIGURE 1.2Hardware block diagram of embedded system.

Real-Time System

The real-time performance of the system refers to the correct response to external events in a fixed amount of time. During this ā€œtime,ā€ the system will do some processing, such as input data analysis, calculation, processing, and so on. And outside of this time, the system may be idle and do some spare work. Take a mobile terminal as an example: when a phone dials in, the system should be ringing in a timely manner to inform the host of a call and ask whether to answer, and when the telephone is not dialing in, people can use it to do some other work, such as listening to music, playing games, and so on.
From the earlier example, we can see that the real-time system is a demand-oriented system, for real-time tasks need to respond the first time, and non-real-time tasks can make way for real-time events when they arriveā€”it is called preempted. So a real-time system can also be thought of as a hierarchical system, and tasks of different importance have different priority levels: important tasks can be prioritized for response, and non-essential tasks can be postponed appropriately.
Real-time calculations can be defined as a type of calculation in which the correctness of the system depends not only on the logical result of the calculation but also on the time at which the result is produced. There are two key points, that is, done correctly and within a given time, and the importance of these two points is equivalent. If the calculation results go wrong, this will not be considered a correct system, and if the calculation results are correct but the calculation has taken time away from the required time, this will also not be considered a correct system. A real-time system is shown in Figure 1.3.
Figure 1.3
FIGURE 1.3Real-time system.
For input signals and events, the real-time system must be able to respond correctly within the specified time, regardless of whether these events are single events or multiple events, synchronous signals, or asynchronous signals.
Example: Suppose a bullet is fired from 20 meters away into a glass, the speed of the bullet is v m/s, then after t1 = 20/v seconds, the bullet will break the glass. And if a protection system takes the glass away after detecting a bullet, assuming the whole process lasts t2 seconds, and if t2 < t1, the glass won't be broken; this is the real-time system.
Similar to embedded systems, there are also certain computing units in real-time systems that can anticipate the environment of the system and its internal applications, which is the determinism that many of the real-time system books have mentioned; that is, the system can respond to a given event within a given time (t seconds). The determinism of multiple events and multiple input system responses constitute determinism for the entire real-time system (the real-time system does not mean that it has a real-time response to all input events, but rather completes the response to the event within a specified time). Embedded systems are widely used in applications. We do not require all dedicated functions to have real-time characteristics, only when the system has strict time limits on tasks would we pay attention to its real-time problems. Specific examples include experimental control, process control equipment, robots, air traffic control, telecommunications, military command and control systems, etc. But embedded applications like printers don't have strict time limits; it only has ā€œas fast as possibleā€ requirement, so it's not a real-time system.

Soft Real Time and Hard Real Time

As we described earlier, the real-time system is concerned with two points, namely the correctness of time and the correctness of function. In fact, measuring the correctness of a real-time system is to require the system to perform the corresponding tasks correctly in a given time. But in reality there is also a system that, in most cases, this kind of system is able to perform tasks strictly within a specified time, but occasionally it will complete the task a little beyond the given time, which we often refer to as a soft real-time system. From the system's different requirements for the sensitivity of the specified time, the real-time system can be divided into the hard real-time system and the soft real-time system.
Hard real-time systems are strictly limited to the specified time to complete the task; otherwise, it may lead to disaster. For example, missile intercept systems, automotive engine systems, etc., when these systems cannot meet the required response time, even occasionally, it will lead to car crash or other major disaster.
Soft real-time systems can allow occasional time deviation, but over time, the accuracy of the entire system will decline, for example, a DVD playback system can be seen as a soft real-time system; it is allowed occasional screen or sound delay.
Figure 1.4 describes the time-effect relationship of these three systems (non-real-time system, soft real-time system, and hard real-time system).
Figure 1.4
FIGURE 1.4The relationship between time and utility.
As we can see from the figure, when the event is triggered and completed within time t, the effect of the three systems is the same. But when the completion time exceeds time t, the effect changes:
  • Non-real-time system: the effect slowly declines after the completion time exceeds time t.
  • Soft real-time system: the effect rapidly declines after the completion time exceeds time t.
  • Hard real-time system: the effect becomes zero after the completion time exceeds time t.

Embedded Real-Time Operating System

In embedded devices, in addition to the embedded operating system, there are bare metal programs. We write a large loop in the main function, the loop is the functional implementation of each task, and all the tasks are performed in a flat orderā€”the next task must wait for the previous task to run completely before starting to run; this running large loop we can call the background program. An interruption can disturb the system's current background task to perform its tasks first; after the interrupted task is complete, the task goes back to the original background where was interrupted to continue to implement the backg...

Table of contents

  1. Cover
  2. Half Title
  3. Title
  4. Copyright
  5. Contents
  6. Preface
  7. Acknowledgments
  8. Authors
  9. Chapter 1 Embedded Real-Time Operating System
  10. Chapter 2 RT-Thread Introduction
  11. Chapter 3 Kernel Basics
  12. Chapter 4 Thread Management
  13. Chapter 5 Clock Management
  14. Chapter 6 Inter-Thread Synchronization
  15. Chapter 7 Inter-Thread Communication
  16. Chapter 8 Memory Management
  17. Chapter 9 Interrupt Management
  18. Chapter 10 Kernel Porting
  19. Chapter 11 Env-Assisted Development Environment
  20. Chapter 12 FinSH Console
  21. Chapter 13 I/O Device Framework
  22. Chapter 14 General Peripheral Interface
  23. Chapter 15 Virtual File System
  24. Chapter 16 Network Framework
  25. Appendix A: ā€œMenuconfigā€ Options
  26. Appendix B: SCons
  27. Appendix C: Getting Started with QEMU (Ubuntu)
  28. Appendix D: Getting Started with RT-Thread Studio (Windows)
  29. Index