Method for realizing residence of real-time operating system under embedded architecture
A real-time operating system is implemented in embedded systems by optimizing architecture, task scheduling, and energy management, addressing resource limitations and communication issues to enhance performance and scalability.
Patent Information
- Application Number
- CN202411299743.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-18
- Publication Date
- 2025-01-03
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing embedded systems face challenges with limited resources, unstable connections, slow communication speeds, and insufficient real-time performance due to hardware limitations and non-unified standards, leading to development inconveniences and inefficiencies.
Implement a real-time operating system in embedded architecture by determining a general computer architecture, optimizing task scheduling, segmenting storage areas, sharing interrupt service routines, separating BIOS from user programs, and enhancing energy management and communication protocols.
Improves usability, reduces development costs and complexity, and enhances scalability and adaptability by providing standardized components and modular design, thus improving system performance and efficiency.
Smart Images

Figure CN119248228A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method for implementing a resident real-time operating system in an embedded architecture. Background Art
[0002] The main function of the resident method under the embedded architecture is to improve programming granularity, improve portability, reduce the user's programming difficulty, simplify the serial port writing of the program, facilitate user calls, and solve the troubles caused by the difficulty of compiling RTOS in different development environments. The resident method under the embedded architecture separates the basic input and output system from the user program to achieve a thorough division of labor, thereby improving programming granularity and portability.
[0003] However, due to the limited resources of embedded systems, the hardware capabilities and processing speed of general resident methods may not be able to meet the current complex application requirements. Embedded systems usually need to run for a long time, and unreasonable energy management will lead to a shortened system running time. When embedded systems communicate with other devices, there may be unstable connections or slow communication speeds. For some embedded systems, real-time performance is crucial, but it may be insufficient due to system resource limitations or improper design. The implementation technologies of embedded systems are diverse and the standards are not completely unified, which may lead to inconvenience in the development and use of tool software. Summary of the invention The purpose of the present invention is to provide a method for implementing a real-time operating system in an embedded architecture in order to solve the above problems, thereby solving the problems mentioned in the background technology.
[0005] In order to solve the above problems, the present invention provides a technical solution: A method for implementing a real-time operating system in an embedded architecture comprises the following steps: S1: Determination of general embedded computer architecture: A general embedded computer architecture needs to be determined, which is the basis for implementing the resident method. This architecture should be able to support the operation of the real-time operating system and provide necessary interfaces and services; S2: Real-time operating system optimization strategy: adopt more advanced integrated chips, RF modules and embedded processors, and combine new process flows; S3: Segmentation of storage area: Under the general embedded computer architecture, the storage area is reasonably segmented to achieve the connection between the basic input and output system and the user program, as well as the mapping mechanism of the operating system service interface; S4: Measures to solve the deficiencies: Select and adjust according to the specific embedded system application scenarios and requirements. At the same time, since the technical fields involved in embedded systems are extensive and complex; S5: Sharing of interrupt service routines: Through the sharing of interrupt service routines, the function call service of the underlying driver and the software application layer is provided to users; S6: Separation of BIOS and user programs: Borrowing the concepts and practices of general-purpose computers, the basic input and output system is separated from user programs.
[0006] As a preferred solution of the present invention, the optimization strategy of the real-time operating system in S2 mainly includes the following steps: S21: Optimize task scheduling algorithm: The task scheduling algorithm is the core part of the real-time operating system, which directly determines the execution order and scheduling strategy of tasks; S22: Reduce task switching overhead: Real-time operating systems will generate certain overhead when switching between multiple tasks, such as context switching overhead; S23: Performance monitoring and tuning: In real-time operating systems, performance monitoring tools can be used to collect and analyze performance data during system operation to understand system bottlenecks and performance issues, and then take appropriate measures for tuning; S24: Memory management optimization: Real-time operating systems need to manage and allocate memory resources during operation, and memory management algorithms can be optimized; S25: Hardware optimization: The performance of a real-time system is not only related to the software, but also to the performance of the hardware devices. The overall performance of the real-time system can be improved by selecting higher-performance hardware devices, such as processors and memory.
[0007] As a preferred solution of the present invention, the segmentation of the storage area in S3 mainly includes the following steps: S31: Determine the segmentation requirement: It is necessary to clarify why the storage area needs to be segmented; S32: Select partition method: Select the appropriate partition method based on your needs, which may include using Windows Disk Management tools for basic partition operations, or using professional partition management tools such as DiskGenius for more complex operations; S33: performing a split operation: obtaining free space by shrinking an existing partition, and then creating a new partition on the unallocated area, which involves compressing a volume to free up space, and then creating a new simple volume on the newly freed space to create a new partition; S34: Format new partition: After creating a new partition, it is usually necessary to format the new partition in order to store data, which involves selecting a file system and performing a formatting operation; S35: Test and Verify: After the split operation is completed, test and verify should be performed to ensure that the new storage area can work properly and data can be read and written correctly.
[0008] As a preferred solution of the present invention, the measures to solve the problem in S4 mainly include the following steps: S41: Improved energy management: Adopt power management technologies such as dynamic frequency adjustment and sleep mode to reduce system energy consumption, optimize system working mode, and reduce unnecessary energy waste; S42: Optimize communication: adopt more stable and efficient communication protocols and optimize the system's communication processing logic; S43: Enhance scalability and upgradeability: Consider the scalability and upgradeability of the system at the initial design stage, adopt modular design, and reserve sufficient hardware and software interfaces; S44: Promote standardized design: Encourage the standardization of embedded system design and actively participate in the formulation and promotion of industry standards.
[0009] As a preferred solution of the present invention, the sharing of the interrupt service routine in S5 mainly includes the following steps: S51: Preparation part: The system needs to protect the scene of the interrupted process, which includes saving the current processor program state value and program counter value; S52: Processing part: The system analyzes the interruption cause and executes the corresponding interruption processing program. When multiple interruption requests occur at the same time, the system will process the interruption request from the interruption source with the highest priority; S53: Ending part: After processing the interrupt, the system needs to restore the scene of the interrupted process, including restoring the register status and enabling interrupts, so that it can respond to other interrupt requests after returning to the original program.
[0010] As a preferred solution of the present invention, the separation of BIOS and user program in S6 mainly includes the following steps: S61: Definition and functions of BIOS: BIOS is a set of programs fixed on a ROM chip on the motherboard of a computer, which stores the most important basic input and output programs of the computer, the self-test program after power-on, and the system self-starting program; S62: Boot loader: When the boot loader installed in the MBR can recognize both Windows and Linux operating systems, there will be two menu options during the boot process; S63: Partitions and boot sectors: Each partition has its own boot sector, and the actual bootable kernel files are placed in each partition.
[0011] The beneficial effects of the present invention are: by setting up measures to solve deficiencies, the usability and automation of development tools are improved to reduce the difficulty and cost of development; more abundant documentation and training resources are provided to help developers master new technologies more quickly; standardized hardware and software components are adopted to reduce the necessity of customized development, thereby reducing costs and improving efficiency; and modular and scalable design methods are encouraged to make the system more adaptable to different hardware platforms and changes in requirements. The role of these measures is to improve development efficiency, reduce costs, simplify the learning process and enhance the scalability of the system. BRIEF DESCRIPTION OF THE DRAWINGS For ease of explanation, the present invention is described in detail with reference to the following specific implementations and the accompanying drawings.
[0013] Figure 1 It is a flow chart of the resident method of the present invention. DETAILED DESCRIPTION The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention.
[0015] Embodiment 1: The present invention provides a technical solution: a method for implementing a real-time operating system in an embedded architecture, comprising the following steps: S1: Determination of general embedded computer architecture: A general embedded computer architecture needs to be determined, which is the basis for implementing the resident method. This architecture should be able to support the operation of the real-time operating system and provide necessary interfaces and services; S2: Real-time operating system optimization strategy: adopt more advanced integrated chips, RF modules and embedded processors, and combine new process flows; S3: Segmentation of storage area: Under the general embedded computer architecture, the storage area is reasonably segmented to achieve the connection between the basic input and output system and the user program, as well as the mapping mechanism of the operating system service interface; S4: Measures to solve the deficiencies: Select and adjust according to the specific embedded system application scenarios and requirements. At the same time, since the technical fields involved in embedded systems are extensive and complex; S5: Sharing of interrupt service routines: Through the sharing of interrupt service routines, the function call service of the underlying driver and the software application layer is provided to users; S6: Separation of BIOS and user programs: Borrowing the concepts and practices of general-purpose computers, the basic input and output system is separated from user programs.
[0016] Embodiment 2: The optimization strategy of the real-time operating system in S2 mainly includes the following steps: S21: Optimize task scheduling algorithm: The task scheduling algorithm is the core part of the real-time operating system, which directly determines the execution order and scheduling strategy of the tasks; S22: Reduce task switching overhead: The real-time operating system will generate certain overhead when switching multiple tasks, such as context switching overhead; S23: Performance monitoring and tuning: In the real-time operating system, the performance data of the system during operation can be collected and analyzed through performance monitoring tools to understand the bottlenecks and performance problems of the system, and then take corresponding measures for tuning; S24: Memory management optimization: The real-time operating system needs to manage and allocate memory resources during operation, and the memory management algorithm can be optimized; S25: Hardware optimization: In addition to being related to software, the performance of the real-time system is also related to the performance of the hardware devices. The overall performance of the real-time system can be improved by selecting higher-performance hardware devices, such as processors, memories, etc.
[0017] In real-time systems, task optimization plays a decisive role in the performance of the entire system. The system performance can be improved by optimizing the execution order of tasks, reducing the scheduling overhead of tasks, and reducing the execution time of tasks. Memory management is an important aspect of real-time operating systems. Excessive dynamic memory allocation and release operations will increase the system overhead and affect real-time performance. Therefore, in the development of real-time operating systems, methods such as static memory allocation and object pool technology can be used to reduce memory fragmentation and frequent memory operations and improve system performance. Interrupts are a commonly used mechanism in real-time operating systems that can respond to hardware events in a timely manner. The optimization of interrupt processing functions plays an important role in the stability and performance of real-time systems. Interrupt processing can be optimized by reasonably setting interrupt priorities and reducing time-consuming operations in interrupt processing to improve the response speed of the system. Real-time systems usually have to deal with the competition between multiple tasks and resources. Reasonable resource management is the key to improving system performance. Access to shared resources can be protected by introducing mechanisms such as mutexes and semaphores to avoid resource contention and deadlocks, thereby improving the concurrency and stability of the system.
[0018] Embodiment 3: The partitioning of the storage area in S3 mainly includes the following steps: S31: Determine the partitioning requirement: It is necessary to clarify why the storage area needs to be partitioned; S32: Select the partitioning method: According to the requirements, select the appropriate partitioning method, which may include using the Windows Disk Management tool for basic partitioning operations, or using professional partition management tools such as DiskGenius for more complex operations; S33: Perform the partitioning operation: Get free space by shrinking the existing partition, and then create a new partition on the unallocated area, which involves compressing the volume to free up space, and then creating a new simple volume on the newly freed space to create a new partition; S34: Format the new partition: After creating a new partition, it is usually necessary to format the new partition in order to store data, which involves selecting a file system and performing a formatting operation; S35: Test and verify: After completing the partitioning operation, testing and verification should be performed to ensure that the new storage area can work properly and data can be read and written correctly.
[0019] When the system allocates main memory space to a job, it finds a large enough free partition in the partition table to allocate to it according to the memory capacity required by the job. If a large enough free partition cannot be found, the job cannot allocate memory space temporarily. When a job ends, the system reclaims the partition it occupies and changes it to an idle state. Although this allocation method can enable multiple jobs to share main memory space, there is always a part of the space in each allocated partition that is wasted. This wasted storage area is called the intra-area head. Disk partitioning is a storage method that stores a single digital file in multiple non-adjacent clusters on a hard disk. This partitioning is to meet the demand for optimal performance in computer use, but it also brings about the problem of increasingly dispersed file data over time, making it more difficult and time-consuming to reorganize files. The introduction of segmented storage management is mainly to meet the specific needs of users and programmers, such as convenient programming, information sharing, information protection, dynamic growth and dynamic linking. Users divide their jobs into several segments according to logical relationships. Each segment is addressed from 0 and has its own name and length.
[0020] Embodiment 4: The measures to address the deficiencies in S4 mainly include the following steps: S41: Improve energy management: Adopt power management technologies, such as dynamic frequency adjustment and sleep mode, to reduce the energy consumption of the system, optimize the system's working mode, and reduce unnecessary energy waste; S42: Optimize communication: Adopt a more stable and efficient communication protocol, and optimize the system's communication processing logic; S43: Enhance scalability and upgradeability: Consider the scalability and upgradeability of the system in the early stage of design, adopt modular design, and reserve sufficient hardware and software interfaces; S44: Promote standardized design: Encourage the standardization of embedded system design, and actively participate in the formulation and promotion of industry standards.
[0021] For memory management, static memory allocation can be adopted, and memory pool technology can be used to pre-allocate and release memory to reduce memory fragmentation and improve memory allocation efficiency. At the same time, memory protection mechanism can be used to detect and prevent access to invalid memory addresses to improve system stability and security. By optimizing algorithms and data structures, task scheduling and priority management mechanisms, high-priority tasks can be ensured to be executed within the specified time. Interrupts can be used reasonably, and time-sensitive tasks can be processed in interrupt service routines to improve system real-time performance. When selecting a processor, factors such as power consumption, performance, and cost should be considered. The concurrent performance of the processor should be reasonably utilized. A suitable multi-core processor should be selected according to system requirements. A triggered memory management strategy should be adopted to promptly release memory resources that are no longer in use. Key data and code should be optimized to reduce memory usage. Compression algorithms should be used to compress data to reduce storage space usage.
[0022] Embodiment 5: The sharing of the interrupt service routine in S5 mainly includes the following steps: S51: Preparation part: The system needs to protect the scene of the interrupted process, which includes saving the current processor program status value and the value of the program counter, etc.; S52: Processing part: The system analyzes the cause of the interrupt and switches to execute the corresponding interrupt handler. When multiple interrupt requests occur at the same time, the system will process the interrupt request issued by the interrupt source with the highest priority; S53: Ending part: After processing the interrupt, the system needs to restore the scene of the interrupted process, including restoring the register status and opening the interrupt, so that it can respond to other interrupt requests after returning to the original program.
[0023] Interrupt handler and interrupt service routine are two different concepts. One interrupt line corresponds to one interrupt handler, and one interrupt handler can correspond to multiple interrupt service routines. When multiple devices need to share an interrupt line, the interrupt handler must call the ISR, which involves registering and calling the interrupt service routine.
[0024] Embodiment 6: The separation of BIOS and user programs in S6 mainly includes the following steps: S61: Definition and function of BIOS: BIOS is a set of programs solidified on a ROM chip on the motherboard of the computer, which stores the most important basic input and output programs of the computer, the self-test program after power-on, and the system self-starting program; S62: Boot loader: When the boot loader that can simultaneously recognize Windows / Linux operating systems is installed in the MBR, the entire boot process will have two menu options; S63: Partition and boot sector: Each partition has its own boot sector, and the actual bootable kernel file is placed in each partition.
[0025] BIOS is a set of programs fixed to the computer motherboard, which is responsible for storing the most important basic input and output programs of the computer, the self-test program after power-on, and the system self-starting program. Since the Pentium era, modern computer motherboards have used NORFlash as the storage chip of BIOS. The working principle of BIOS is to execute the instructions stored in its memory when the system starts, and allocate specific resources such as interrupts or memory addresses to all devices connected to the computer so that they can operate normally. Without BIOS, the computer will not be able to start and many functions will not be available.
[0026] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A method for implementing a real-time operating system in an embedded architecture, characterized in that: The following steps are involved: S1: Determination of general embedded computer architecture: A general embedded computer architecture needs to be determined, which is the basis for implementing the resident method. This architecture should be able to support the operation of the real-time operating system and provide necessary interfaces and services; S2: Real-time operating system optimization strategy: adopt more advanced integrated chips, RF modules and embedded processors, and combine new process flows; S3: Segmentation of storage area: Under the general embedded computer architecture, the storage area is reasonably segmented to achieve the connection between the basic input and output system and the user program, as well as the mapping mechanism of the operating system service interface; S4: Measures to solve the deficiencies: Select and adjust according to the specific embedded system application scenarios and requirements. At the same time, since the technical fields involved in embedded systems are extensive and complex; S5: Sharing of interrupt service routines: Through the sharing of interrupt service routines, the function call service of the underlying driver and the software application layer is provided to users; S6: Separation of BIOS and user programs: Borrowing the concepts and practices of general-purpose computers, the basic input and output system is separated from user programs.
2. A method for implementing a real-time operating system in an embedded architecture according to claim 1, characterized in that: The optimization strategy of the real-time operating system in S2 mainly includes the following steps: S21: Optimize task scheduling algorithm: The task scheduling algorithm is the core part of the real-time operating system, which directly determines the execution order and scheduling strategy of tasks; S22: Reduce task switching overhead: Real-time operating systems will generate certain overhead when switching multiple tasks, such as context switching overhead; S23: Performance monitoring and tuning: In real-time operating systems, performance monitoring tools can be used to collect and analyze performance data during system operation to understand system bottlenecks and performance issues, and then take appropriate measures for tuning; S24: Memory management optimization: Real-time operating systems need to manage and allocate memory resources during operation, and memory management algorithms can be optimized; S25: Hardware optimization: The performance of a real-time system is not only related to the software, but also to the performance of the hardware devices. The overall performance of the real-time system can be improved by selecting higher-performance hardware devices, such as processors and memory.
3. The method for implementing a real-time operating system residency in an embedded architecture according to claim 1, characterized in that: The segmentation of the storage area in S3 mainly includes the following steps: S31: Determine the segmentation requirement: It is necessary to clarify why the storage area needs to be segmented; S32: Select partition method: Select the appropriate partition method based on your needs, which may include using Windows Disk Management tools for basic partition operations, or using professional partition management tools such as DiskGenius for more complex operations; S33: performing a split operation: obtaining free space by shrinking an existing partition, and then creating a new partition on the unallocated area, which involves compressing a volume to free up space, and then creating a new simple volume on the newly freed space to create a new partition; S34: Format new partition: After creating a new partition, it is usually necessary to format the new partition in order to store data, which involves selecting a file system and performing a formatting operation; S35: Test and Verify: After the split operation is completed, test and verify should be performed to ensure that the new storage area can work properly and data can be read and written correctly.
4. The method for implementing a real-time operating system residency in an embedded architecture according to claim 1, characterized in that: The measures to solve the problem in S4 mainly include the following steps: S41: Improved energy management: Adopt power management technologies such as dynamic frequency adjustment and sleep mode to reduce system energy consumption, optimize the system's working mode, and reduce unnecessary energy waste; S42: Optimize communication: adopt more stable and efficient communication protocols and optimize the system's communication processing logic; S43: Enhance scalability and upgradeability: Consider the scalability and upgradeability of the system at the initial design stage, adopt modular design, and reserve sufficient hardware and software interfaces; S44: Promote standardized design: Encourage the standardization of embedded system design and actively participate in the formulation and promotion of industry standards.
5. The method for implementing a real-time operating system residency in an embedded architecture according to claim 1, characterized in that: The sharing of the interrupt service routine in S5 mainly includes the following steps: S51: Preparation part: The system needs to protect the scene of the interrupted process, which includes saving the current processor program state value and program counter value; S52: Processing part: The system analyzes the interruption cause and executes the corresponding interruption processing program. When multiple interruption requests occur at the same time, the system will process the interruption request from the interruption source with the highest priority; S53: Ending part: After processing the interrupt, the system needs to restore the scene of the interrupted process, including restoring the register status and enabling interrupts, so that it can respond to other interrupt requests after returning to the original program.
6. The method for implementing a real-time operating system residency in an embedded architecture according to claim 1, characterized in that: The separation of BIOS and user program in S6 mainly includes the following steps: S61: Definition and functions of BIOS: BIOS is a set of programs fixed on a ROM chip on the motherboard of a computer, which stores the most important basic input and output programs of the computer, the self-test program after power-on, and the system self-starting program; S62: Boot loader: When the boot loader installed in the MBR can recognize both Windows and Linux operating systems, there will be two menu options during the boot process; S63: Partitions and boot sectors: Each partition has its own boot sector, and the actual bootable kernel files are placed in each partition.
