Method for simultaneous running of multiple cores of embedded device with multiple operating systems
By adopting a multi-core and multi-operating system approach in embedded devices, allocating DDR storage units and interrupt management, and loading and booting the Linux and VxWorks operating systems, the problem of single-core devices being unable to run real-time and non-real-time systems at the same time is solved, thereby improving processing speed and resource utilization.
Patent Information
- Application Number
- CN202111647047.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-30
- Publication Date
- 2025-10-21
- Estimated Expiration
- 2041-12-30
AI Technical Summary
In the prior art, when embedded devices need to run both real-time and non-real-time systems, a single core or single operating system cannot adapt to diverse operating environments, resulting in low processing speed and code execution efficiency.
Adopting the multi-core and multi-operating system method of embedded devices, the DDR memory unit address space is allocated to the Linux and VxWorks operating systems. Interrupt management is handled by the Linux operating system. The two operating systems are loaded and booted through the WMF jump instruction, and the address configuration and compilation process of the operating system are optimized.
It realizes the simultaneous operation of real-time and non-real-time systems, improves the resource utilization of the equipment and the chip processing speed, and enhances the code execution efficiency.
Smart Images

Figure CN114281344B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of software and hardware design of FPGA / ARM embedded devices, and in particular to a method for simultaneously running multiple cores and multiple operating systems of an embedded device. Background Art
[0002] Currently, traditional embedded devices run operating systems on either a single-core, single-system or multi-core, single-system basis. These include Windows, Linux, and VxWorks. Regardless of whether a single processor or multiple processors are used, these devices typically rely on a single operating system. A method for running multiple operating systems on a multi-core chip could fill this gap. Existing technologies typically rely on a single processor running a single operating system. However, in scenarios requiring simultaneous execution of both real-time and non-real-time systems, a single core or single operating system is not suitable for most operating environments.
[0003] Therefore, there is an urgent need for a method for running multiple cores and multiple operating systems simultaneously on embedded devices, which supports both real-time and non-real-time systems to meet most adaptation environments and improve the processing speed of the chip and the execution efficiency of the code. Summary of the Invention
[0004] In response to the problem in the existing technology that a single core or a single operating system cannot adapt to most operating environments in some scenarios requiring real-time systems and non-real-time systems, the present invention proposes a method for simultaneously running multiple cores and multiple operating systems on an embedded device, which supports the operation of both real-time systems and non-real-time systems. By running some real-time programs in the real-time system and some non-real-time low-priority tasks in the non-real-time system, the real-time requirements are guaranteed.
[0005] To achieve the above object, the specific contents of the present invention are as follows:
[0006] The present invention proposes a method for simultaneously running multiple cores and multiple operating systems on an embedded device, comprising the following steps:
[0007] Step 1: Allocate the DDR memory unit of the embedded device, allocate half of the DDR memory unit address space to the Linux operating system, and the other half to the VxWorks operating system;
[0008] Step 2: Configure and process the interrupts of the embedded device. All interrupts are configured and managed in the Linux operating system. The VxWorks operating system does not configure peripheral interrupts and only processes tasks.
[0009] Step 3: Modify the Linux operating system kernel source code so that when executing the WMF jump instruction, it will jump to the address passed in the boot_secondary file of the embedded device for execution;
[0010] Step 4: Set the loading address of the VxWorks operating system;
[0011] Step 5: After setting the loading address of the VxWorks operating system, execute the loading instruction to load the Linux operating system and the VxWorks operating system. After the loading is successful, use the boot instruction to boot the Linux operating system to run;
[0012] Step 6: Wait for the Linux operating system to complete running in core 1. After the Linux operating system completes running in core 1, the Linux operating system executes the boot instruction to boot the VxWorks operating system to run.
[0013] In order to better implement the present invention, further, before allocating the DDR storage unit of the embedded device, it is necessary to boot the operating system. The u-boot file is needed in the boot stage of the operating system. First, the u-boot source code of the u-boot file is opened, and then the address space of the DDR storage unit in the u-boot source code that needs to be configured in the u-boot file is divided. The address division interval of the u-boot file is the same as the interval of the Linux operating system. Other peripheral configurations are default. The u-boot project is configured and compiled, the environment variables are set, the path of the cross compiler is configured by export PATH, and finally the compiled file is downloaded to the QSPIFlash storage unit of the embedded device.
[0014] The storage space of the QSPIFlash storage unit of the embedded device is divided. In this embodiment, the storage space size of the QSPIFlash storage unit device we use is 64MB. The specific storage space is divided as follows: the storage space address of the u-boot file is: 0-0x100000, the storage space address of the uImgage file is: 0x100000-0x600000, the storage space address of the devicetree file is: 0x600000-0x620000, the storage space address of the rootfs file is: 0x620000-0xC00000, the storage space address of the fpga.bit file is: 0xC00000-0x1000000, the storage space address of the VxWorks operating system is: 0x1000000-0x1500000, and the storage space address of the devicetree file is: 0x1500000-0x1600000.
[0015] The u-boot file is needed in the boot phase of the operating system. The open source u-boot source code is used for the u-boot file. When configuration processing is required in u-boot, the address division of the DDR storage unit in the u-boot source code needs to be set. When dividing the address of the DDR storage unit in the u-boot source code, the divided interval is the same as the interval of the Linux operating system, that is, the divided address is (0, 0x10000000), and other interrupt peripherals are configured by default. After configuration, compile the u-boot project, set the environment variables, and configure the path of the cross-compiler by executing the export PATH instruction. The cross-compiler used in this embodiment is arm-linux-gnueabihf-gcc. The u-boot file is compiled by executing the make instruction. After compilation, it is downloaded to the QSPIFlash storage unit in the embedded device through the JTAG interface of the embedded device. Finally, open the SDK file and connect the JTAG interface of the embedded device.
[0016] In order to better implement the present invention, further, in step 1, the address range allocated by the Linux operating system is (0, 0x10000000), and the address range allocated by the VxWorks operating system is (0x10000000, 0x20000000).
[0017] In order to better implement the present invention, further, the specific steps for modifying the addresses of the Linux operating system and the VxWorks operating system are as follows: first, open the dts file directory of the Linux operating system and the VxWorks operating system, then find the corresponding dts file in the multi-core chip of the embedded device, and finally modify the memory configuration in the file.
[0018] In order to better implement the present invention, further, in step 2, when all interrupts are placed in the Linux operating system for configuration processing, the configuration processing is performed in the dts file of the multi-core chip of the corresponding embedded device in the Linux operating system source code, and in the dts file of the multi-core chip of the corresponding embedded device in the VxWorks operating system, operations on all peripherals are removed.
[0019] In order to better implement the present invention, further, step 3 modifies the specific location of the kernel source code of the Linux operating system in the boot_secondary file of the embedded device multi-core chip, and by passing in parameters (0x10000000, 1), executes the WMF jump instruction to jump to the address 0x10000000 for execution.
[0020] In order to better implement the present invention, further, in step 4, the loading address of the VxWorks operating system is set, specifically, loading is performed in the VxWorks kernel configuration file of the VxWorks operating system.
[0021] When compiling the Linux operating system, the files of the Linux operating system are divided into three parts, and the corresponding three files are uImage file, rootfs file, and devicetree file. When the present invention compiles the Linux operating system of the embedded device, it mainly configures the memory configuration and interrupt configuration in the devicetree file, configures the devicetree file and compiles it.
[0022] When compiling the VxWorks operating system, you must first configure the zynq-702.dts file. The default configuration is in the zynq-702.dts file in the Linux operating system source code. In the zynq-702.dts file in the VxWorks operating system source code, remove operations on all peripherals. By configuring the cpu@1 parameter in the interrupt cpus parameter and removing the intc:interrupt-controller node in the interrupt configuration, interrupt management is handed over to the Linux operating system, while retaining the L2:cache-controller controller configuration in the interrupt configuration. In the dts file for the multi-core chip of the embedded device corresponding to the VxWorks operating system, the interrupt configuration of all peripherals is not processed.
[0023] After the U-boot file is started, the Linux operating system and the VxWorks operating system are loaded. The specific loading method is to execute the sf read instruction, execute the sf read 0x8000 0x100000 0x400000 instruction to load the uImage file, execute the sf read 0x1000000 0x600000 0x20000 instruction to load the devicetree file, execute the sf read0x2000000 0x620000 0x60000 instruction to load the rootfs file, execute the sf read 0x10000000 0x10000000x60000 instruction to load the VxWorks file, and execute the sf read 0x12000000 0x0x15000000 0x20000 instruction to load the devicetree file; after successful loading, execute bootm 0x8000 0x2000000 The 0x1000000 instruction boots the Linux operating system to run; after waiting for the Linux operating system to finish running in core 1, the Linux operating system executes the boot instruction to boot the VxWorks operating system to run.
[0024] The present invention has the following beneficial effects:
[0025] The present invention proposes a method for simultaneously running multiple cores and multiple operating systems on an embedded device, which supports the operation of both real-time systems and non-real-time systems. The present invention has multiple implementation methods. According to actual conditions, some real-time programs can be run in a real-time system, or some non-real-time low-priority tasks can be run in a non-real-time system, thereby ensuring the real-time requirements of device operation, advantageously improving resource utilization, and greatly improving chip processing speed and code execution efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 Schematic diagram of the partitioning of the QSPIFLAH storage unit of the present invention;
[0027] Figure 2 This is a flowchart of loading the Linux operating system and the VxWorks operating system of the present invention. DETAILED DESCRIPTION
[0028] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. It should be understood that the described embodiments are only part of the embodiments of the present invention, not all of the embodiments, and therefore should not be regarded as limiting the scope of protection. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technical personnel in this field without making creative work are within the scope of protection of the present invention.
[0029] In the description of the present invention, it should be noted that, unless otherwise expressly specified or limited, the terms "disposed," "connected," and "connected" should be understood in a broad sense. For example, they may refer to fixed connections, detachable connections, or integral connections; mechanical connections, electrical connections; direct connections, indirect connections through an intermediate medium, or internal connections between two components. Those skilled in the art will understand the specific meanings of the above terms in the present invention based on the specific circumstances.
[0030] Example 1:
[0031] This embodiment proposes a method for simultaneously running multiple cores and multiple operating systems on an embedded device, including the following steps:
[0032] Step 1: Allocate the DDR memory unit of the embedded device, allocate half of the DDR memory unit address space to the Linux operating system, and the other half to the VxWorks operating system;
[0033] Step 2: Configure and process the interrupts of the embedded device. All interrupts are configured and managed in the Linux operating system. The VxWorks operating system does not configure peripheral interrupts and only processes tasks.
[0034] Step 3: Modify the Linux operating system kernel source code so that when executing the WMF jump instruction, it will jump to the address passed in the boot_secondary file of the embedded device for execution;
[0035] Step 4: Set the loading address of the VxWorks operating system;
[0036] Step 5: After setting the loading address of the VxWorks operating system, execute the loading instruction to load the Linux operating system and the VxWorks operating system. After the loading is successful, use the boot instruction to boot the Linux operating system to run;
[0037] Step 6: Wait for the Linux operating system to complete running in core 1. After the Linux operating system completes running in core 1, the Linux operating system executes the boot instruction to boot the VxWorks operating system to run.
[0038] Working principle: The multi-core chip used in the hardware environment of the embedded device implemented in this embodiment is the Zynq chip of Xilinx, and the real-time operating system and non-real-time operating system used are the Linux operating system and the VxWorks operating system.
[0039] The DDR storage unit size corresponding to the hardware environment used by the embedded device in this embodiment is 512MB. Half of the DDR storage unit space address, that is, 256MB of address space, is allocated to the Linux operating system, and the other half of the space address is allocated to the VxWorks operating system, that is, 256MB of address space is given to the VxWorks operating system.
[0040] Example 2:
[0041] This embodiment is based on the above embodiment 1. Figure 2 As shown in the figure, before allocating the DDR storage unit of the embedded device, the operating system needs to be booted. The u-boot file is needed in the boot stage of the operating system. First, open the u-boot source code of the u-boot file, and then divide the address space of the DDR storage unit in the u-boot source code that needs to be configured in the u-boot file. The address division interval of the u-boot file is the same as the interval of the Linux operating system. Other peripheral configurations are default. Configure and compile the u-boot project, set the environment variables, configure the path of the cross compiler by executing the export PATH instruction, and finally download the compiled file to the QSPIFlash storage unit of the embedded device.
[0042] Working principle: u-boot files are needed in the boot phase of the operating system. The open source u-boot source code is used for the u-boot files. When configuration processing is required in u-boot, the address division of the DDR storage unit in the u-boot source code needs to be set. When dividing the address of the DDR storage unit in the u-boot source code, the divided interval is the same as the interval of the Linux operating system, that is, the divided address is (0, 0x10000000), and other interrupt peripherals are configured by default. After configuration, compile the u-boot project, set the environment variables, and configure the path of the cross-compiler by executing the export PATH instruction. The cross-compiler used in this embodiment is arm-linux-gnueabihf-gcc. The u-boot file is compiled by executing the make instruction. After compilation, it is downloaded to the QSPIFlash storage unit in the embedded device through the JTAG interface of the embedded device. Finally, open the SDK file and connect the JTAG interface of the embedded device.
[0043] The rest of this embodiment is the same as that of the above-mentioned embodiment 1, and therefore will not be described in detail.
[0044] Example 3:
[0045] In this embodiment, based on any one of the above embodiments 1-2, in step 1, the address range allocated by the Linux operating system is (0, 0x10000000), and the address range allocated by the VxWorks operating system is (0x10000000, 0x20000000).
[0046] The specific steps for modifying the addresses of the Linux operating system and VxWorks operating system are as follows: first open the dts file directory of the Linux operating system and VxWorks operating system, then find the corresponding dts file in the embedded device multi-core chip, and finally modify the memory configuration in the file.
[0047] Working principle: When modifying the address of the operating system, the specific modification method is to modify it in the dts file directory of the operating system. The many core chips used by the embedded device in this embodiment are zynq chips. The specific file for modifying the address in this embodiment is the zynq-702.dts file, and the memory configuration in the zynq-702.dts file is modified.
[0048] The rest of this embodiment is the same as any of the above embodiments 1-2, so it will not be repeated here.
[0049] Example 4:
[0050] In this embodiment, based on any one of the above embodiments 1-3, when all interrupts are placed in the Linux operating system for configuration processing in step 2, the configuration processing is performed in the dts file of the multi-core chip of the corresponding embedded device in the Linux operating system source code, and in the dts file of the multi-core chip of the corresponding embedded device in the VxWorks operating system, operations on all peripherals are removed.
[0051] Working principle: The multi-core chip used in this embodiment is zynq. When configuring and processing interrupts, the default configuration is in the zynq-702.dts file in the Linux operating system source code. In the zynq-702.dts file in the VxWorks operating system source code, operations on all peripherals are removed. By configuring the cpu@1 parameter in the interrupt cpus parameter and removing the intc:interrupt-controller node in the interrupt configuration, interrupt management is handed over to the Linux operating system, and the configuration of the L2:cache-controller controller in the interrupt configuration is retained; in the dts file of the multi-core chip of the embedded device corresponding to the VxWorks operating system, the interrupt configuration of all peripherals is not processed.
[0052] The rest of this embodiment is the same as any of the above embodiments 1-3, so it will not be repeated here.
[0053] Example 5:
[0054] In this embodiment, based on any one of the above embodiments 1-4, step 3 is performed to modify the specific location of the kernel source code of the Linux operating system in the boot_secondary file of the multi-core chip of the embedded device.
[0055] Working principle: When the kernel source code of the Linux operating system needs to be modified, the multi-core chip used in the embodiment is a zynq chip. By calling the zynq_boot_secondary file and passing the parameters (0x10000000, 1) in the zynq_boot_secondary file, the WMF jump instruction is executed to jump to the address 0x10000000 to complete the modification operation of the kernel source code of the Linux operating system.
[0056] The rest of this embodiment is the same as any of the above embodiments 1-4, so it will not be repeated here.
[0057] Example 6:
[0058] In this embodiment, based on any one of the above embodiments 1-5, the loading address of the VxWorks operating system is set in step 4, specifically, loading is performed in the VxWorks kernel configuration file of the VxWorks operating system.
[0059] Working principle: In the VxWorks kernel configuration file, the loading address of the VxWorks operating system is set to 0x10000000.
[0060] The storage space of the QSPIFlash storage unit of the embedded device is divided. In this embodiment, the storage space size of the QSPIFlash storage unit we use is 64MB. The specific storage space is divided as follows: the storage space address of the u-boot file is: 0-0x100000, the storage space address of the uImgage file is: 0x100000-0x600000, the storage space address of the devicetree file is: 0x600000-0x620000, the storage space address of the rootfs file is: 0x620000-0xC00000, the storage space address of the fpga.bit file is: 0xC00000-0x1000000, the storage space address of the VxWorks operating system is: 0x1000000-0x1500000, and the storage space address of the devicetree file is: 0x1500000-0x1600000.
[0061] The rest of this embodiment is the same as any of the above embodiments 1-5, so it will not be repeated here.
[0062] Example 7:
[0063] In this embodiment, based on any one of the above embodiments 1-6, after setting the loading address of the VxWorks operating system in step 3, the Linux operating system and the VxWorks operating system need to be compiled. After the compilation is completed, the Linux operating system boots the VxWorks operating system to run by executing the boot instruction.
[0064] Working principle: When compiling the Linux operating system, the Linux operating system files are divided into three parts. The corresponding three files are uImage file, rootfs file, and devicetree file. In this embodiment, when we compile the Linux operating system for embedded devices, we mainly configure the memory and interrupt in the devicetree file, and configure the devicetree file for compilation.
[0065] When compiling the VxWorks operating system, you must first configure the zynq-702.dts file. The default configuration is in the zynq-702.dts file in the Linux operating system source code. In the zynq-702.dts file in the VxWorks operating system source code, remove operations on all peripherals. By configuring the cpu@1 parameter in the interrupt cpus parameter and removing the intc:interrupt-controller node in the interrupt configuration, interrupt management is handed over to the Linux operating system, while retaining the L2:cache-controller controller configuration in the interrupt configuration. In the dts file for the multi-core chip of the embedded device corresponding to the VxWorks operating system, do not process the interrupt configuration of all peripherals. After configuration, compile the VxWorks operating system.
[0066] After the U-boot file is started, the operating system is loaded. The specific loading method is to execute the sf read instruction, execute the sf read 0x8000 0x100000 0x400000 instruction to load the UImage file, execute the sf read0x1000000 0x600000 0x20000 instruction to load the devicetree file, execute the sf read 0x20000000 0x620000 0x60000 instruction to load the rootfs file, execute the sf read 0x10000000 0x1000000 0x60000 instruction to load the VxWorks operating system, and execute the sf read 0x12000000 0x0x15000000 0x20000 instruction to load the devicetree file; after successful loading, execute bootm 0x8000 0x2000000 The 0x1000000 instruction boots the Linux operating system to run; after waiting for the Linux operating system to run in core 1, the Linux operating system executes the boot instruction to boot the VxWorks operating system to run.
[0067] The rest of this embodiment is the same as any of the above embodiments 1-6, so it will not be repeated here.
[0068] The above description is only a preferred embodiment of the present invention and does not limit the present invention in any form. Any simple modification or equivalent change made to the above embodiment based on the technical essence of the present invention shall fall within the scope of protection of the present invention.
Claims
1. A method for simultaneously running multiple cores and multiple operating systems on an embedded device, for simultaneously running a multi-core embedded device in a Linux operating system and a VxWorks operating system, characterized in that: The following steps are included: Step 1: Allocate the DDR memory unit of the embedded device, allocate half of the DDR memory unit address space to the Linux operating system, and the other half to the VxWorks operating system; Step 2: Configure and process the interrupts of the embedded device. All interrupts are configured and managed in the Linux operating system. The VxWorks operating system does not configure peripheral interrupts and only processes tasks. Step 3: Modify the Linux operating system kernel source code so that when executing the WMF jump instruction, it will jump to the address passed in the boot_secondary file of the embedded device for execution; Step 4: Set the loading address of the VxWorks operating system; Step 5: After setting the loading address of the VxWorks operating system, execute the loading instruction to load the Linux operating system and the VxWorks operating system. After the loading is successful, use the boot instruction to boot the Linux operating system to run; Step 6: Wait for the Linux operating system to complete running in core 1. When the Linux operating system completes running in core 1, the Linux operating system executes the boot instruction to boot the VxWorks operating system; Before allocating the DDR storage unit of the embedded device, the operating system needs to be booted. During the boot phase of the operating system, the u-boot file is needed to boot the Linux operating system and the VxWorks operating system. The specific boot steps are: first open the u-boot source code of the u-boot file, and then divide the address space of the DDR storage unit in the u-boot source code that needs to be configured in the u-boot file. The address division interval of the u-boot file is the same as the address division interval of the Linux operating system. Other peripheral configurations are default. After the address space division is completed, configure and compile the u-boot project, set the environment variables, and configure the path of the cross compiler. Finally, download the compiled file to the QSPIFlash storage unit of the embedded device.
2. The method for simultaneously running multiple cores and multiple operating systems on an embedded device according to claim 1, wherein: In step 1, the address range allocated by the Linux operating system is (0, 0x10000000), and the address range allocated by the VxWorks operating system is (0x10000000, 0x20000000).
3. The method for simultaneously running multiple cores and multiple operating systems on an embedded device according to claim 2, wherein: The specific steps for modifying the addresses of the Linux operating system and VxWorks operating system are as follows: first open the dts file directory of the Linux operating system and VxWorks operating system, then find the dts file corresponding to the multi-core chip of the embedded device, and finally modify the memory configuration in the file.
4. The method for simultaneously running multiple cores and multiple operating systems on an embedded device according to claim 1, wherein: When all interrupts are placed in the Linux operating system for configuration processing in step 2, the configuration processing is performed in the dts file of the multi-core chip corresponding to the embedded device in the Linux operating system source code. Specifically, the cpu@ parameter in the interrupt cpus parameter is configured, and the intc:interrupt-controller node in the interrupt configuration is removed. Interrupt management is handled by the Linux operating system, and the configuration of the L2:cache-controller controller in the interrupt configuration is retained; in the dts file of the multi-core chip of the embedded device corresponding to the VxWorks operating system, the interrupt configuration of all peripherals is not processed.
5. The method for simultaneously running multiple cores and multiple operating systems on an embedded device according to claim 1, wherein: The specific steps of step 3 are: modifying the kernel source code of the Linux operating system in the boot_secondary file of the embedded device multi-core chip, and passing parameters (0x10000000, 1) into the boot_secondary file to achieve jumping to the address 0x10000000 for execution when executing the WMF jump instruction.
6. The method for simultaneously running multiple cores and multiple operating systems on an embedded device according to claim 1, wherein: The specific steps of setting the loading address of the VxWorks operating system in step 4 are as follows: setting the loading address of the VxWorks operating system by passing the loading address parameter 0x10000000 in the VxWorks kernel configuration file.
7. The method for simultaneously running multiple cores and multiple operating systems on an embedded device according to claim 1, wherein: The loading instruction executed in step 5 to load the Linux operating system and the VxWorks operating system is the sf read instruction.
8. The method for simultaneously running multiple cores and multiple operating systems on an embedded device according to claim 1, wherein: The boot instruction for booting the Linux operating system in step 5 is a bootm instruction.
Citation Information
Patent Citations
Customized dual system
CN110471705A
Asymmetric multiprocessor embedded operating system
CN113391821A