A method and system for organizing and managing RTOS system in Linux system

The RTOS system is bound to a process of the Linux system through process virtualization technology, and the management link list and processing link list are used to manage hardware resources, which solves the problems of low real-time performance and inflexible resource allocation in mixed deployment of Linux and RTOS on multi-core SOC, and achieves This ensures efficient operation of the RTOS system and rapid data exchange.

CN118550595BActive Publication Date: 2024-10-22KYLIN CORP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411018046.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-29
Publication Date
2024-10-22
Estimated Expiration
2044-07-29

AI Technical Summary

Technical Problem

When the existing technology mixedly deploys Linux and RTOS systems on multi-core SOC, virtualization technology reduces the real-time performance of RTOS, hardware isolation technology makes device sharing difficult, and resource allocation is inflexible, resulting in complex and error-prone system operation, and real-time performance lower than RTOS system.

Method used

The RTOS system is abstractly bound to a process in the Linux system through the process virtualization method, an RTOS virtual process is created, and the hardware environment resources are bound to the virtual process. The RTOS system is started through script or code loading, and the RTOS is used to manage the linked list and process the linked list. Manage hardware resources and threads to achieve flexible allocation and rapid exchange of hardware resources.

Benefits of technology

It simplifies the difficulty of hybrid deployment of RTOS systems, improves the real-time performance of hybrid deployment, reduces performance losses, realizes flexible allocation of hardware resources between different systems, and provides a fast data exchange method between Linux systems and RTOS systems. .

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118550595B_ABST
    Figure CN118550595B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and system for organizing and managing an RTOS system in a Linux system. The method includes the following steps: S1, obtaining the setting content of the RTOS system; S2, abstractly binding the RTOS system to the corresponding process in the Linux system through process virtualization according to the setting content of the RTOS system, thereby creating a corresponding RTOS virtual process; S3, binding the hardware environment resources required for the operation of the RTOS system to the RTOS virtual process; S4, starting the RTOS system by calling a specified script or code loading to make it run in the hardware environment corresponding to the RTOS virtual process. The present invention aims to simplify the difficulty of mixed deployment of RTOS systems, improve the real-time performance of mixed deployment RTOS systems, realize flexible allocation of hardware resources between different systems, reduce unnecessary performance loss, and provide a fast data exchange method between Linux systems and RTOS systems.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of hybrid deployment of Linux and RTOS, and in particular to a method and system for organizing and managing an RTOS system by a Linux system. Background Art

[0002] The Linux system has powerful memory management, process management, and rich components, so developers can easily develop various applications and use related functions; the real-time operating system (RTOS) has good real-time performance, such as Free-RTOS, Zephyr, VxWorks, Nuttxr, Threadx, etc., which are widely used in industrial control, aerospace, rail transportation and other fields. At the same time, multi-core SOC has greatly improved the performance of chips and has become the mainstream of chip design. The mixed deployment of multiple systems such as Linux+RTOS system on multi-core chips is already a mature solution. According to the default agreement, the mixed deployment of Linux+RTOS running on multi-core SOC is divided. Linux and RTOS are visible to all hardware resources, and Linux and RTOS use the agreed hardware resources; simulate hardware resources through virtualization technology, and then run multiple systems on multi-core SOC, such as xen, kvm and other technologies; isolate multi-core SOC resources through hardware isolation means, and run different Linux or RTOS operating systems in different isolation domains, such as jailhouse, kvisor and other technologies. Mixed deployment of multiple operating systems on a multi-core SOC, using virtualization technology greatly reduces the real-time performance of the RTOS system, requires many components, and the technology is relatively complex; using hardware isolation technology makes it difficult to share hardware devices between different systems, which has a certain loss on the real-time performance of the RTOS system; using the default resource division lacks flexibility, the system operation is prone to errors, and the management of memory, processes, etc. is not unified. At the same time, the real-time performance is increased by optimizing the Linux kernel, such as the RT-Linux system. Due to the characteristics of the Linux system, the real-time performance is lower than that of the RTOS system. Summary of the invention

[0003] Technical problem to be solved by the present invention: In view of the above-mentioned problems in the prior art, a method and system for organizing and managing RTOS systems by a Linux system are provided. The present invention aims to simplify the difficulty of hybrid deployment of RTOS systems, improve the real-time performance of hybrid deployed RTOS systems, realize flexible allocation of hardware resources between different systems, reduce unnecessary performance loss, and provide a method for fast data exchange between Linux systems and RTOS systems.

[0004] In order to solve the above technical problems, the technical solution adopted by the present invention is:

[0005] A method for organizing and managing an RTOS system in a Linux system comprises the following steps:

[0006] S1, obtain RTOS system settings;

[0007] S2, the RTOS management module running in the Linux system abstractly binds the RTOS system to the corresponding process in the Linux system through the process virtualization method according to the RTOS system setting content, thereby creating a corresponding RTOS virtual process;

[0008] S3, bind the hardware environment resources required for the operation of the RTOS system with the RTOS virtual process;

[0009] S4, starting the RTOS system by calling a specified script or code loading to make it run in the hardware environment corresponding to the RTOS virtual process.

[0010] Optionally, the RTOS system setting content obtained in step S1 is a description file, which describes the hardware environment resources provided to the RTOS system for running so as to configure the hardware environment required for the RTOS system to run. The hardware environment resources include the SOC processor core, clock, memory, interrupt and hardware peripherals required for the RTOS system to run.

[0011] Optionally, in step S3, binding the hardware environment resources required for the operation of the RTOS system with the RTOS virtual process includes:

[0012] S3.1, allocating hardware environment resources required for the operation of the RTOS system to the RTOS system, wherein the hardware environment resources include processor cores, clocks, memory, interrupts, and hardware peripherals required for the operation of the RTOS system;

[0013] S3.2, bind the hardware environment resources required for the operation of each RTOS system to the corresponding RTOS virtual process through the RTOS management linked list.

[0014] Optionally, the RTOS management module of the Linux system and the RTOS processing module running in the RTOS system communicate through shared memory, and bind the hardware environment resources required for the operation of each RTOS system to the corresponding RTOS virtual process through the RTOS management linked list. The RTOS management module sends relevant data packets to the RTOS processing module of the RTOS system, and responds to relevant data packets sent by the RTOS processing module of the RTOS system. The RTOS management module is used to:

[0015] Create an RTOS virtual process, and when the RTOS virtual process is created, create and initialize the RTOS management linked list through the RTOS management module. At the same time, the RTOS management module sends a data packet for obtaining RTOS thread information to the RTOS processing module of the corresponding RTOS system to obtain the thread information after the RTOS system is started, and completes the thread description information corresponding to the RTOS management linked list according to the data packet received from the RTOS processing module;

[0016] When the Linux system allocates or reclaims the hardware resources corresponding to the RTOS virtual process, the RTOS management module sends a data packet for allocating or reclaiming the hardware resources corresponding to the RTOS virtual process to the RTOS processing module of the RTOS system, and adds or deletes the corresponding hardware resources in the RTOS management linked list;

[0017] When the Linux system creates, operates, or deletes a thread corresponding to the RTOS virtual process, the RTOS management module sends the corresponding thread creation, operation, or deletion data packet to the RTOS processing module of the RTOS system, and the corresponding thread description information of the RTOS management linked list changes accordingly;

[0018] When receiving the data packet of the RTOS processing module of the RTOS system to create, operate, and delete the corresponding thread, the RTOS management module operates the creation, operation, and deletion of the thread corresponding to the RTOS virtual process, and the corresponding thread description information of the RTOS management linked list is also changed accordingly;

[0019] The fields in the RTOS management linked list include a SOC processor core description structure pointer, a clock description structure pointer, a memory description structure pointer, an interrupt description structure pointer, a hardware peripheral description structure pointer, a virtual device description structure pointer, a thread description structure pointer and a pointer to the next RTOS management linked list structure.

[0020] The RTOS virtual processes created and managed by the RTOS management module correspond one to one with the RTOS system. When multiple RTOS virtual processes are created and managed, the Linux system manages multiple RTOS systems.

[0021] Optionally, in step S4, after the RTOS system is started by calling the specified script or code loading to make it run in the corresponding hardware environment, the RTOS system manages the use of threads, SOC processor cores, clocks, memory, interrupts, and hardware peripherals allocated to the RTOS system by the Linux system through the RTOS processing linked list; the RTOS processing linked list corresponds one-to-one with the RTOS management linked list, and the RTOS processing module manages the hardware environment resources and threads of the RTOS system through the RTOS processing linked list. After the RTOS system is started, the RTOS processing module collects the RTOS system thread information, the RTOS processing linked list related thread description information, and the thread information is combined into a data packet to the RTOS management module of the Linux system through shared memory. The RTOS management module parses the data packet and initializes the RTOS management linked list thread description information, and responds to the relevant data packets sent by the Linux system RTOS management module. The RTOS processing module functions to:

[0022] After the RTOS system is started, the RTOS processing module creates and initializes the RTOS processing linked list;

[0023] When receiving the RTOS thread information acquisition data packet sent by the RTOS management module, the thread information of the RTOS system is composed into a data packet and sent to the RTOS management module of the Linux system;

[0024] When receiving the allocation or recovery data packet of the corresponding RTOS virtual process hardware resource sent by the RTOS management module, the RTOS system acquires or releases the corresponding hardware resource, and the RTOS processing linked list adds or deletes the corresponding hardware resource;

[0025] When receiving the thread creation, operation, and deletion data packets sent by the RTOS management module, the RTOS processing module creates, operates, and deletes the corresponding threads, and the corresponding thread description information of the RTOS processing linked list changes accordingly;

[0026] When the RTOS system creates, operates, or deletes a corresponding thread, the RTOS management module sends the corresponding creation, operation, or deletion data packet to the RTOS management module of the Linux system, and the thread description information corresponding to the RTOS processing linked list is also changed accordingly;

[0027] The fields in the RTOS processing linked list include a SOC processor core description structure pointer, a clock description structure pointer, a memory description structure pointer, an interrupt description structure pointer, a hardware peripheral description structure pointer, a virtual device description structure pointer, a thread description structure pointer and a pointer to the next RTOS processing linked list structure.

[0028] Optionally, the hardware resources used by the RTOS system are physical hardware resources or virtual hardware resources of the Linux system. When there are corresponding hardware resources in the Linux system, the RTOS system directly uses the hardware resources. When there are no hardware resources, the Linux system blocks related operations or provides virtual hardware resources.

[0029] Optionally, the RTOS system applies for hardware resources from the Linux system through the RTOS processing module, and when hardware resources need to be shared, the RTOS system transmits data required for the hardware resources to the Linux system through hardware sharing.

[0030] In addition, the present invention also provides a system for organizing and managing an RTOS system using a Linux system, comprising a microprocessor and a memory connected to each other, wherein the microprocessor is programmed or configured to execute the method for organizing and managing an RTOS system using a Linux system.

[0031] In addition, the present invention also provides a computer-readable storage medium, in which a computer program or instruction is stored. The computer program or instruction is programmed or configured to execute the method of organizing and managing the RTOS system by the Linux system through a processor.

[0032] In addition, the present invention also provides a computer program product, including a computer program or an instruction, wherein the computer program or the instruction is programmed or configured to execute the method for organizing and managing an RTOS system by a processor.

[0033] Compared with the prior art, the present invention mainly has the following advantages: the method for organizing and managing RTOS system by Linux system of the present invention comprises obtaining setting content of RTOS system, abstractly binding RTOS system as a process in Linux system through process virtualization method according to setting content of RTOS system, thereby creating corresponding RTOS virtual process, binding hardware environment resources required for running of RTOS system with RTOS virtual process, starting RTOS system by calling specified script or code loading to make it run in corresponding hardware environment, the present invention can simplify the difficulty of mixed deployment of RTOS system, improve the real-time performance of mixed deployment RTOS system, realize flexible allocation of hardware resources between different systems, reduce unnecessary performance loss, and provide a method for fast data exchange between Linux system and RTOS system. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] Figure 1 Schematic diagram of the basic flow of the method of the embodiment of the present invention.

[0035] Figure 2 Schematic diagram of the system structure in an embodiment of the present invention. DETAILED DESCRIPTION

[0036] like Figure 1 As shown, the method for organizing and managing the RTOS system by the Linux system in this embodiment includes the following steps:

[0037] S1, obtain RTOS system settings;

[0038] S2, the RTOS management module running in the Linux system abstractly binds the RTOS system to the corresponding process in the Linux system through the process virtualization method according to the RTOS system setting content, thereby creating a corresponding RTOS virtual process;

[0039] S3, bind the hardware environment resources required for the operation of the RTOS system with the RTOS virtual process;

[0040] S4, starting the RTOS system by calling a specified script or code loading to make it run in the hardware environment corresponding to the RTOS virtual process.

[0041] like Figure 2 As shown, steps S1 to S4 of this embodiment are executed by the RTOS management module in the Linux system. The method for organizing and managing the RTOS system in the Linux system of this embodiment involves a method for mixed deployment of multiple operating systems on a multi-core SOC. The RTOS management module runs on the Linux system. The RTOS management module is responsible for the creation and abstract binding of the RTOS virtual process, and is also responsible for the environment creation, system startup, thread management, hardware resource management, and system deletion of the RTOS system. The RTOS management module creates the corresponding RTOS virtual process according to the RTOS system setting content, and binds the SOC core, clock, memory, interrupt, and hardware peripherals that the RTOS system needs to run to the RTOS virtual process and sets the RTOS management linked list; the corresponding RTOS system is started by calling the relevant script or code loading. The corresponding RTOS virtual process is fixed on the corresponding SOC core processor. The corresponding clock is assigned to the RTOS virtual process, which is managed by the RTOS virtual process or managed by the RTOS. The corresponding memory is assigned to the RTOS virtual process. The corresponding interrupt uses the interrupt isolation method to bind the corresponding interrupt to the SOC core running the RTOS system. The corresponding hardware peripherals are bound to the RTOS virtual process. Hardware resources and software resources are isolated through cgroup, namespace, etc. The corresponding RTOS virtual process occupies the corresponding hardware and software resources, and the corresponding hardware and software resources are protected from being used by other processes of the Linux system. The RTOS system runs on the hardware resources corresponding to the RTOS virtual process, and manages the normal operation of the RTOS virtual process and the RTOS system without interfering with each other. At the same time, the RTOS virtual process is invisible and inaccessible to the unallocated hardware resources, that is, the RTOS system cannot access the unallocated hardware resources.

[0042] The RTOS system setting content obtained in step S1 of this embodiment is a description file, which describes the hardware environment resources provided to the RTOS system for running and is used to configure the hardware environment required for the RTOS system to run. The hardware environment resources include the SOC processor core, clock, memory, interrupt and hardware peripherals required for the RTOS system to run, and are read by the RTOS management module to configure the RTOS system running environment.

[0043] In step S3 of this embodiment, binding the hardware environment resources required for the operation of the RTOS system with the RTOS virtual process includes:

[0044] S3.1, allocating hardware environment resources required for the operation of the RTOS system to the RTOS system, wherein the hardware environment resources include processor cores, clocks, memory, interrupts, and hardware peripherals required for the operation of the RTOS system;

[0045] S3.2, bind the hardware environment resources required for the operation of each RTOS system to the corresponding RTOS virtual process through the RTOS management linked list.

[0046] In this embodiment, the RTOS management module of the Linux system and the RTOS processing module of the RTOS system communicate through shared memory. The RTOS management module runs in the Linux system. The hardware environment resources required for the operation of each RTOS system are bound to the corresponding RTOS virtual process through the RTOS management linked list. The RTOS management module sends relevant data packets to the RTOS processing module of the RTOS system and responds to the relevant data packets sent by the RTOS processing module of the RTOS system. The functions of the RTOS management module include:

[0047] 1. Create an RTOS virtual process, and when the RTOS virtual process is created, create and initialize the RTOS management linked list through the RTOS management module. At the same time, the RTOS management module sends the RTOS thread information data packet to the RTOS processing module of the corresponding RTOS system and obtains the running thread information of the RTOS system and initializes the thread description information corresponding to the RTOS management linked list;

[0048] 2. When the Linux system allocates or reclaims the hardware resources of the corresponding RTOS virtual process, the RTOS management module sends the data packet of the allocation or reclaiming of the hardware resources of the corresponding RTOS virtual process to the RTOS processing module of the RTOS system, and adds or deletes the corresponding hardware resources in the RTOS management linked list;

[0049] 3. When the Linux system creates, operates, or deletes threads corresponding to the RTOS virtual process, the RTOS management module sends the corresponding thread creation, operation, or deletion data packets to the RTOS processing module of the RTOS system, and the thread description information corresponding to the RTOS management linked list changes accordingly;

[0050] 4. When receiving the data packet of the RTOS processing module of the RTOS system to create, operate, and delete the corresponding thread, the RTOS management module operates the creation, operation, and deletion of the thread corresponding to the RTOS virtual process, and the thread description information corresponding to the RTOS management linked list is also changed accordingly;

[0051] The fields in the RTOS management linked list include a SOC processor core description structure pointer, a clock description structure pointer, a memory description structure pointer, an interrupt description structure pointer, a hardware peripheral description structure pointer, a virtual device description structure pointer, a thread description structure pointer and a pointer to the next RTOS management linked list structure.

[0052] The RTOS management linked list is a real-time description of the hardware resources (such as SOC processor cores, clocks, memory, interrupts, hardware peripherals) and related RTOS running threads allocated by the Linux system to the RTOS virtual process. When the RTOS virtual process is created, the RTOS management module creates and initializes the RTOS management linked list. The RTOS management module obtains the running thread information of the RTOS system through shared memory and initializes the thread description information corresponding to the RTOS management linked list; when the Linux system allocates or reclaims the corresponding RTOS virtual process hardware resources, the corresponding hardware resources of the RTOS management linked list are added or deleted; when the Linux system creates, operates, or deletes the thread corresponding to the RTOS virtual process, the corresponding thread description information of the RTOS management linked list changes accordingly; when the RTOS system creates, operates, or deletes the corresponding thread, the corresponding thread description information of the RTOS management linked list also changes accordingly. The corresponding RTOS management linked list can be flexibly modified according to needs. An example of the RTOS management linked list in this embodiment is as follows:

[0053] typedef struct linux_manage_g{

[0054] struct linux_cpu *cpu; / / soc processor core description structure pointer

[0055] struct linux_time *time; / / clock description structure pointer

[0056] struct linux_mem *mem; / / memory description structure pointer

[0057] struct linux_inter *inter; / / interrupt description structure pointer

[0058] struct linux_dev *dev; / / Peripheral description structure pointer

[0059] struct linux_virt_dev *virt_dev; / / Virtual device description structure pointer

[0060] struct linux_task *task; / / thread description structure pointer

[0061] structlinux_manage_g *next; / / Pointer to the next RTOS management list structure

[0062] }linux_manage_t;

[0063] The RTOS management module of the Linux system can create and manage multiple RTOS virtual processes, that is, the Linux system manages multiple RTOS systems. The RTOS management linked list can describe multiple RTOS virtual processes, that is, describe multiple RTOS systems.

[0064] In step S4 of this embodiment, the RTOS system is started by calling the specified script or code loading to make it run in the corresponding hardware environment. The RTOS system is started by the RTOS management module of the Linux system, the RTOS processing module runs in the RTOS system, and the RTOS processing module creates and maintains the RTOS processing linked list. The RTOS system manages the use of threads, SOC processor cores, clocks, memory, interrupts, and hardware peripherals allocated to the RTOS system by the Linux system through the RTOS processing linked list. When there are corresponding hardware resources, the RTOS system directly uses the hardware resources, and when there are no hardware resources, it blocks related operations or provides virtual hardware resources.

[0065] The RTOS processing list corresponds to the RTOS management list one by one. The RTOS processing module manages the hardware environment resources and threads of the RTOS system through the RTOS processing list. After the RTOS system is started, the RTOS processing module collects the RTOS system thread information, the RTOS processing list related thread description information, and forms a data packet with the thread information to the RTOS management module of the Linux system through shared memory. The RTOS management module parses the data packet and initializes the RTOS management list thread description information, and responds to the relevant data packets sent by the Linux system RTOS management module. The functions of the RTOS processing module include:

[0066] 1. After the RTOS system is started, the RTOS processing module creates and initializes the RTOS processing linked list;

[0067] 2. When receiving the RTOS thread information acquisition data packet sent by the RTOS management module, the thread information packet of the RTOS system is sent to the RTOS management module of the Linux system;

[0068] 3. When receiving the allocation or recovery data packet of the corresponding RTOS virtual process hardware resources sent by the RTOS management module, the RTOS system acquires or releases the corresponding hardware resources, and the RTOS processing linked list adds or deletes the corresponding hardware resources;

[0069] 4. When receiving the thread creation, operation, and deletion data packets sent by the RTOS management module, the RTOS processing module creates, operates, and deletes the corresponding threads, and the corresponding thread description information of the RTOS processing linked list changes accordingly;

[0070] 5. When the RTOS system creates, operates, or deletes the corresponding thread, the RTOS management module sends the corresponding creation, operation, or deletion data packet to the RTOS management module of the Linux system, and the corresponding thread description information of the RTOS processing linked list also changes accordingly.

[0071] The fields in the RTOS processing linked list include a SOC processor core description structure pointer, a clock description structure pointer, a memory description structure pointer, an interrupt description structure pointer, a hardware peripheral description structure pointer, a virtual device description structure pointer, a thread description structure pointer and a pointer to the next RTOS processing linked list structure.

[0072] The RTOS processing linked list is a real-time description of the hardware resources (such as SOC processor core, clock, memory, interrupt, hardware peripherals) and related RTOS running threads allocated by the Linux system to the RTOS system. The RTOS processing linked list corresponds to the RTOS management linked list one by one. The RTOS processing linked list is maintained by the RTOS processing module of the RTOS system, and the corresponding RTOS processing linked list can be flexibly modified according to needs. The sample RTOS management linked list in this embodiment is as follows:

[0073] typedef struct rtos_manage_g{

[0074] struct rtos_cpu *cpu; / / soc processor core description structure pointer

[0075] struct rtos_time *time; / / clock description structure pointer

[0076] struct rtos_mem *mem; / / memory description structure pointer

[0077] struct rtos_inter *inter; / / interrupt description structure pointer

[0078] struct rtos_dev *dev; / / Peripheral description structure pointer

[0079] struct rtos_virt_dev *virt_dev; / / Virtual device description structure pointer

[0080] struct rtos_task *task; / / thread description structure pointer

[0081] struct rtos_manage_g *next; / / Pointer to the next RTOS processing list structure

[0082] }rtos_manage_t;

[0083] The RTOS processing module prevents the RTOS system from accessing the RTOS processing linked list without corresponding hardware resources. The method includes judging whether the RTOS processing linked list has corresponding hardware resources or illegal access interrupt judgment when calling related hardware resources.

[0084] The Linux system in this embodiment creates threads, manages threads, and deletes threads for RTOS virtual processes. The RTOS management module operates and sends data packets and command packets to the RTOS processing module of the RTOS system through shared memory. The RTOS processing module parses the data packets and commands and implements specific thread operations, and feeds back relevant information to the RTOS management module. The specific RTOS thread creation steps are as follows:

[0085] 1. The RTOS management module of the Linux system creates the corresponding thread of the RTOS virtual process.

[0086] 2. The RTOS management module calls the relevant library to convert the relevant code into the corresponding RTOS system code, and compiles it into the elf dynamic loading module through the corresponding RTOS system compilation environment.

[0087] 3. The RTOS management module sends the corresponding elf dynamic loading module to the RTOS processing module of the RTOS system through shared memory.

[0088] 4. After receiving the data packet, the RTOS processing module parses it, loads the elf dynamic loading module corresponding to the created thread, and returns the relevant information to the RTOS management module of the Linux system.

[0089] The Linux system manages (including starting, suspending, and adjusting priority operations) the corresponding threads of the RTOS virtual process. The RTOS management module sends the command packets of the relevant management operations to the RTOS processing module of the RTOS system through shared memory. The RTOS processing module parses the command packets and operates the corresponding RTOS threads, and returns the relevant information to the RTOS management module of the Linux system. The Linux system deletes the corresponding threads of the RTOS virtual process. The RTOS management module sends the command packets of the deletion operations to the RTOS processing module of the RTOS system through shared memory. The RTOS processing module parses the command packets and deletes the corresponding RTOS threads and recycles the relevant resources. At the same time, it returns the relevant information to the RTOS management module of the Linux system and recycles the relevant resources.

[0090] The Linux system in this embodiment corresponds to the RTOS virtual process hardware resource management, including hardware resource allocation and hardware resource recovery. When the RTOS virtual process is created, the Linux system allocates the SOC processor core, clock, memory, interrupt, and hardware peripherals to the RTOS virtual process, and the RTOS virtual process management corresponds to the RTOS system using the corresponding SOC core, clock, memory, interrupt, and hardware peripheral resources. When the RTOS system is running, the Linux system dynamically allocates relevant hardware peripherals to the RTOS virtual process, and the RTOS management module sends the hardware dynamic allocation behavior packet to the RTOS processing module of the RTOS system through a shared memory method. The RTOS processing module parses the packet, and the RTOS system obtains the right to use the relevant hardware peripherals. When the RTOS system is running, the Linux system dynamically reclaims the hardware peripherals corresponding to the RTOS virtual process, and the RTOS management module sends the hardware dynamic recovery behavior packet to the RTOS processing module of the RTOS system through a shared memory method. The RTOS processing module parses the packet, and releases the use rights of the relevant hardware peripherals for the hardware that is not used and forms a peripheral release packet to the RTOS management module; for the use of peripherals, the packet that cannot release hardware resources is returned to the RTOS management module. Similarly, SOC processor cores, clocks, memory, interrupts, etc. can also be flexibly and dynamically allocated between Linux systems and RTOS systems. A hardware resource can only be allocated to one operating system at a time, and virtual devices are used for hardware sharing.

[0091] At the same time, Linux virtual devices can be shared with the RTOS system for use by the RTOS system, including the RTOS virtual thread of the Linux system obtaining the Linux virtual device, the RTOS management module sending the virtual device allocation data packet to the RTOS processing module of the RTOS system, the RTOS processing module adding the relevant virtual device information to the RTOS processing linked list of the RTOS system, and the RTOS system using the virtual device according to the content of the RTOS processing linked list, such as operating or reading the register of the virtual device corresponding to the pointer of the virtual device description structure of the RTOS processing linked list. The Linux system reclaims the corresponding virtual device in the same way as the physical peripheral, which will not be repeated here.

[0092] Through hardware sharing, the relevant data of the RTOS system and the Linux system can be quickly transmitted, including: the Linux system dynamically allocates the relevant data hardware resources (such as hard disk, TF card, U disk, etc.) to the RTOS virtual process, the RTOS management module composes the relevant data hardware resource content into a data packet and sends it to the RTOS processing module of the RTOS system, the RTOS processing module parses the data packet and adds the relevant data hardware resources to the peripheral description structure pointer of the RTOS processing linked list, the RTOS system loads the corresponding relevant data hardware resources, and reads and writes the hardware resource content according to the permissions. Take PCIE hard disk data transmission as an example:

[0093] 1. The Linux system allocates the corresponding partition of the PCIE hard disk to the RTOS virtual process.

[0094] 2. The RTOS management module assembles the partition information corresponding to the PCIE hard disk into a data packet and sends it to the RTOS processing module of the RTOS system.

[0095] 3. The RTOS processing module receives the partition information corresponding to the PCIE hard disk to form a data packet and adds the relevant PCIE hard disk corresponding partition information to the RTOS processing linked list after parsing. The RTOS processing module triggers the RTOS system to load the partition corresponding to the PCIE hard disk.

[0096] 4. The RTOS system reads or writes the corresponding files on the corresponding partition of the PCIE hard disk.

[0097] The way the Linux system reclaims corresponding data hardware resources is the same as the way it reclaims physical peripherals, so it will not be described here.

[0098] In this embodiment, when the RTOS system is running, the Linux system can allocate memory to the RTOS virtual process to dynamically allocate memory to the RTOS system; similarly, by recycling the memory of the RTOS virtual process, the memory resources of the RTOS system can be recycled. In this embodiment, after the RTOS management module of the Linux system writes data packets and command packets to the shared memory, it will trigger the corresponding interrupt of the RTOS system to ensure that the RTOS processing module reads the information in time; after the RTOS processing module of the RTOS system writes data packets and command packets to the shared memory, it will trigger the corresponding interrupt of the Linux system to ensure that the RTOS management module reads the information in time. Figure 2 As shown, the RTOS management module in this embodiment runs on the Linux system. The RTOS management module is responsible for RTOS virtual process creation and abstract binding, as well as RTOS system environment creation, system startup, thread management, hardware resource management, and system deletion.

[0099] In summary, the method for organizing and managing the RTOS system in the Linux system of this embodiment uses a process virtualization method to abstractly bind the RTOS system to a Linux system process, so that the Linux system can manage and use the RTOS system. After creating the relevant RTOS virtual process according to the RTOS management module set in the Linux system, the RTOS system operating environment is set and hardware resources are allocated through relevant parameters, and then the RTOS system is started; when the Linux system operates the RTOS virtual process, the RTOS management module responds to the relevant RTOS virtual process operation to manage the corresponding RTOS system and return relevant information; when the RTOS system needs relevant resources, it applies to the RTOS management module of the Linux system through shared memory; when the Linux system needs to reclaim relevant RTOS hardware resources, the RTOS system is reclaimed through the RTOS management module; when the Linux system deletes the corresponding RTOS virtual process, the RTOS management module shuts down the corresponding RTOS system and reclaims the relevant resources of the RTOS system and returns relevant information. The RTOS processing module runs in the RTOS system to respond to the relevant operations of the RTOS management module running in the Linux system. By abstracting and binding the RTOS system to the process method of the Linux system, the difficulty of mixed deployment of RTOS systems is simplified, and the real-time performance of mixed deployment RTOS systems is greatly improved. Hardware resources are flexibly allocated between different systems, reducing unnecessary performance loss, and providing a fast data exchange method between Linux systems and RTOS systems.

[0100] In addition, this embodiment also provides a system for organizing and managing an RTOS system using a Linux system, comprising a microprocessor and a memory connected to each other, wherein the microprocessor is programmed or configured to execute the method for organizing and managing an RTOS system using a Linux system.

[0101] In addition, this embodiment also provides a computer-readable storage medium, in which a computer program or instruction is stored. The computer program or instruction is programmed or configured to execute the method of organizing and managing the RTOS system by the Linux system through a processor.

[0102] In addition, this embodiment also provides a computer program product, including a computer program or instructions, which are programmed or configured to execute the method of organizing and managing the RTOS system by a processor.

[0103] Those skilled in the art should understand that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application can take the form of a computer program product implemented on one or more computer-readable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code. The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the process Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing device to work in a specific way, so that the instructions stored in the computer-readable memory produce a product including an instruction device, which implements the functions specified in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide for implementing the process in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0104] The above is only a preferred embodiment of the present invention, and the protection scope of the present invention is not limited to the above embodiments. All technical solutions under the concept of the present invention belong to the protection scope of the present invention. It should be pointed out that for ordinary technicians in this technical field, some improvements and modifications without departing from the principle of the present invention should also be regarded as the protection scope of the present invention.

Claims

1. A method for organizing and managing an RTOS system in a Linux system, characterized in that: The steps include: S1, obtain RTOS system settings; S2, the RTOS management module running in the Linux system abstractly binds the RTOS system to the corresponding process in the Linux system through the process virtualization method according to the RTOS system setting content, thereby creating a corresponding RTOS virtual process; S3, bind the hardware environment resources required for the operation of the RTOS system with the RTOS virtual process; S4, starting the RTOS system by calling a specified script or code loading to make it run in the hardware environment corresponding to the RTOS virtual process; The RTOS management module of the Linux system and the RTOS processing module running in the RTOS system communicate through shared memory, and bind the hardware environment resources required for the operation of each RTOS system with the corresponding RTOS virtual process through the RTOS management linked list. The RTOS management module sends relevant data packets to the RTOS processing module of the RTOS system, and responds to the relevant data packets sent by the RTOS processing module of the RTOS system. The RTOS management module is used to: Create an RTOS virtual process, and when the RTOS virtual process is created, create and initialize the RTOS management linked list through the RTOS management module. At the same time, the RTOS management module sends a data packet for obtaining RTOS thread information to the RTOS processing module of the corresponding RTOS system to obtain the thread information after the RTOS system is started, and completes the thread description information corresponding to the RTOS management linked list according to the data packet received from the RTOS processing module; When the Linux system allocates or reclaims the hardware resources corresponding to the RTOS virtual process, the RTOS management module sends a data packet for allocating or reclaiming the hardware resources corresponding to the RTOS virtual process to the RTOS processing module of the RTOS system, and adds or deletes the corresponding hardware resources in the RTOS management linked list; When the Linux system creates, operates, or deletes a thread corresponding to the RTOS virtual process, the RTOS management module sends the corresponding thread creation, operation, or deletion data packet to the RTOS processing module of the RTOS system, and the corresponding thread description information of the RTOS management linked list changes accordingly; When receiving the data packet of the RTOS processing module of the RTOS system to create, operate, and delete the corresponding thread, the RTOS management module operates the creation, operation, and deletion of the thread corresponding to the RTOS virtual process, and the corresponding thread description information of the RTOS management linked list is also changed accordingly; The fields in the RTOS management linked list include a SOC processor core description structure pointer, a clock description structure pointer, a memory description structure pointer, an interrupt description structure pointer, a hardware peripheral description structure pointer, a virtual device description structure pointer, a thread description structure pointer and a pointer to the next RTOS management linked list structure; The RTOS virtual processes created and managed by the RTOS management module correspond one to one with the RTOS system. When multiple RTOS virtual processes are created and managed, the Linux system manages multiple RTOS systems.

2. The method for organizing and managing RTOS system by Linux system according to claim 1, characterized in that: The RTOS system setting content obtained in step S1 is a description file, which describes the hardware environment resources provided to the RTOS system for running and is used to configure the hardware environment required for the RTOS system to run. The hardware environment resources include the SOC processor core, clock, memory, interrupt and hardware peripherals required for the RTOS system to run.

3. The method for organizing and managing RTOS system by Linux system according to claim 2, characterized in that: Binding the hardware environment resources required for the operation of the RTOS system with the RTOS virtual process in step S3 includes: S3.1, allocating hardware environment resources required for the operation of the RTOS system to the RTOS system, wherein the hardware environment resources include processor cores, clocks, memory, interrupts and hardware peripherals required for the operation of the RTOS system; S3.2, bind the hardware environment resources required for the operation of each RTOS system to the corresponding RTOS virtual process through the RTOS management linked list.

4. The method for organizing and managing RTOS system by Linux system according to claim 3, characterized in that: In step S4, after the RTOS system is started by calling the specified script or code loading to make it run in the corresponding hardware environment, the RTOS system manages the use of the threads, SOC processor cores, clocks, memories, interrupts, and hardware peripherals allocated to the RTOS system by the Linux system through the RTOS processing linked list; the RTOS processing linked list corresponds to the RTOS management linked list one by one, and the RTOS processing module manages the hardware environment resources and threads of the RTOS system through the RTOS processing linked list; after the RTOS system is started, the RTOS processing module collects the RTOS system thread information and the related thread description information of the RTOS processing linked list, and forms a data packet with the thread information to the RTOS management module of the Linux system through the shared memory mode, the RTOS management module parses the data packet and initializes the thread description information of the RTOS management linked list, and responds to the related data packets sent by the RTOS management module of the Linux system, and the RTOS processing module functions to: After the RTOS system is started, the RTOS processing module creates and initializes the RTOS processing linked list; When receiving the RTOS thread information acquisition data packet sent by the RTOS management module, the thread information of the RTOS system is composed into a data packet and sent to the RTOS management module of the Linux system; When receiving the allocation or recovery data packet of the corresponding RTOS virtual process hardware resource sent by the RTOS management module, the RTOS system acquires or releases the corresponding hardware resource, and the RTOS processing linked list adds or deletes the corresponding hardware resource; When receiving the thread creation, operation, and deletion data packets sent by the RTOS management module, the RTOS processing module creates, operates, and deletes the corresponding threads, and the corresponding thread description information of the RTOS processing linked list changes accordingly; When the RTOS system creates, operates, or deletes a corresponding thread, the RTOS management module sends the corresponding creation, operation, or deletion data packet to the RTOS management module of the Linux system, and the thread description information corresponding to the RTOS processing linked list is also changed accordingly; The fields in the RTOS processing linked list include a SOC processor core description structure pointer, a clock description structure pointer, a memory description structure pointer, an interrupt description structure pointer, a hardware peripheral description structure pointer, a virtual device description structure pointer, a thread description structure pointer and a pointer to the next RTOS processing linked list structure.

5. The method for organizing and managing RTOS system by Linux system according to claim 4, characterized in that: The hardware resources used by the RTOS system are physical hardware resources or virtual hardware resources of the Linux system. When there are corresponding hardware resources in the Linux system, the RTOS system directly uses the hardware resources. When there are no hardware resources, the Linux system blocks related operations or provides virtual hardware resources.

6. The method for organizing and managing RTOS system by Linux system according to claim 5, characterized in that: The RTOS system applies for hardware resources from the Linux system through the RTOS processing module, and when it is necessary to share hardware resources, the RTOS system transmits the data required for the hardware resources to the Linux system through hardware sharing.

7. A system for organizing and managing RTOS systems using a Linux system, comprising a microprocessor and a memory connected to each other, characterized in that: The microprocessor is programmed or configured to execute the method for organizing and managing an RTOS system by a Linux system as described in any one of claims 1 to 6.

8. A computer-readable storage medium having a computer program or instruction stored therein, characterized in that: The computer program or instruction is programmed or configured to execute the method for organizing and managing an RTOS system by a Linux system as claimed in any one of claims 1 to 6 through a processor.

9. A computer program product comprising a computer program or instructions, characterized in that The computer program or instruction is programmed or configured to execute the method for organizing and managing an RTOS system by a Linux system as claimed in any one of claims 1 to 6 through a processor.