With the rapid development of domestic industrialization and digitization, it is increasingly obvious that embedded development plays an important role in IT industry. Meanwhile, the requirement for product's functionality, stability, real-time, etc. is becoming higher and higher in the field of embedded development.The reliability and real-time of the system as well as the flexibility of the software programming will be improved effectively by using embedded real-time operating system as developing platform and adopting high performance embedded processor as main controller in the industrial control field. Concerning embedded processor, ARM framework has already taken the lead in the embedded field for its high performance, low power consumption and low cost. In terms of embedded operating system, besides system infrastructure, solutions suitable for domestic developing trend are also not satisfactory. Firstly, mature embedded real-time operating systems abroad are mostly characteristic of high cost and complex structure, which are not fit for the application of hard real-time. Secondly, the source codes of most real-time operating systems are not accessible, which causes a safety hazard to the development products. Regardless of its characteristics of low cost, easy control, small scale and high performance, the weak foundation of small-sized hard real-time kernel in embedded system, similar toμC/OS—II, leaves a gap in product industrialization and commercialization.According to this case in combination with the theories of operating system kernel and special requirements of embedded hard real-time system, especially on the basis of analysis ofμC/OS—II, this paper designs and constructs a hard real-time application oriented kernel suitable for 32-bit ARM processor, the aim of which is to provide a reliable basic platform with a solid foundation.The research work of this paper focuses on the following aspects:To meet the demand for high efficiency, conciseness, easy extension and easy tailoring in the embedded environment, the kernel architecture is designed. Layered structure is chosen for the kernel, and relatively independent modules are used in each layer. Basic function modules are provided at the bottom layer using micro-kernel theories for reference.To fulfill the requirement for the quick and stable real-time response in the system, a unified interrupt entry is established for IRQ and a reasonable half nesting working mode is adopted. FIQ is kept unmasked and uninterrupted, to be employed in the rapid response situation. Segment handling interrupt mechanism is introduced to solve ITC and the recessive overuse of hardware protection mechanisms due to their mutual coordination.To satisfy the need for the predictability of the system behavior based on application, preemption threshold scheduling algorithm on the basis of priority bitmap is used, which has improved the utilization of the processor and the schedulability of a task set and reduced the kernel storage cost. In regard to shared resource access control, mutex event is used to solve priority inversion and deadlock in accordance with priority ceiling protocol. This paper also presents the design of clock management and memory management in the kernel to ascertain hard real-time performance of the system. At last, it has been proved by the real-time performance test that this kind of real-time kernel has an excellent hard real-time performance. |