A method and apparatus for multi-qemu inter-system communication
By creating a serial interface and building a data transmission channel in the host system, the problem of serial data transmission between QEMU simulation systems was solved, enabling flexible communication between multiple simulation systems and improving the efficiency of embedded software development and problem localization capabilities.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHANGHAI UNIV
- Filing Date
- 2023-04-11
- Publication Date
- 2026-05-29
AI Technical Summary
Existing QEMU simulation systems mainly focus on single-board simulation of embedded systems, neglecting the joint debugging between subsystems and lacking a serial data transmission method between multiple QEMU simulation systems, which leads to complex protocol debugging between modules in the embedded environment.
Create a usable serial interface in the host system, build a data transmission channel between multiple serial interfaces, and configure the serial interface as the device backend in the simulation system to realize serial data communication between multiple QEMU simulation systems, supporting point-to-point or point-to-multipoint communication.
It enables flexible serial data communication configuration, which can meet the communication requirements between multiple analog systems, save costs, improve the efficiency of embedded software development, and simplify the location of protocol issues and code defects.
Smart Images

Figure CN116662230B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of communication technology, and in particular to a method and apparatus for communication between multiple QEMU analog systems. Background Technology
[0002] Embedded systems are widely used in aerospace, automotive electronics, smart IoT, and many other fields. With increasingly diverse application scenarios and more complex development requirements, they pose significant challenges to the efficiency and reliability of traditional embedded system development. Virtualization technology, such as QEMU (Quick Emulator), provides a good solution. It can create a virtualized hardware environment before the embedded system hardware is fully available, improving the efficiency of software development, debugging, and integration testing, as well as enhancing hardware integration efficiency, reducing potential development risks, and thus shortening the overall project development cycle.
[0003] QEMU supports heterogeneous instruction translation and peripheral hardware device simulation. It employs dynamic binary translation technology to achieve cross-instruction set virtual machine simulation, enabling the simulation of cross-platform embedded systems with peripherals on various operating systems. Applying this technology to embedded system simulation can alleviate, to some extent, the problems of hardware dependence, long development cycles, low testing efficiency, and high testing costs associated with embedded software development.
[0004] Current embedded systems consist of multiple independent modular units that communicate via physical connections. To better address the aforementioned issues, in addition to simulating the entire embedded system, it is also necessary to consider the communication and collaboration between subsystems, especially the most common serial data communication. However, QEMU is currently mostly used for single-board simulation of embedded systems, neglecting the joint debugging between subsystems. Although it provides simulation of board-level serial interfaces, the lack of a way to simulate serial data transmission between multiple QEMU systems makes protocol debugging between modules in an embedded environment still very complex. Summary of the Invention
[0005] In view of the aforementioned shortcomings of the prior art, the technical problem to be solved by the present invention is that existing QEMU simulation systems focus on single-board simulation of embedded systems, neglecting the joint debugging between subsystems of embedded systems, and lack a method for serial data transmission between multiple QEMU simulation systems, resulting in the protocol debugging between modules in the embedded environment still being very complex. Therefore, the present invention provides a method and apparatus for communication between multiple QEMU simulation systems. Based on serial data transmission, it creates a usable serial interface in the host system, constructs a data transmission channel between multiple serial interfaces according to the communication plan, and configures each serial interface as a device backend for simulating serial interfaces within the simulation system to send and receive serial data. It offers flexible configuration and controllable testing, meeting the requirements of serial data communication between multiple simulation systems in various scenarios; it breaks through the requirements of traditional single-machine simulation, enabling joint development and debugging across multiple different host machines; it saves costs and facilitates the location of protocol problems and code defects, greatly improving the efficiency of embedded software development.
[0006] To achieve the above objectives, one embodiment of the present invention provides a method for inter-system communication simulating multiple QEMUs, the method comprising:
[0007] According to the communication requirements between multiple QEMU simulation systems, the main control system in the corresponding host system generates at least one serial interface and initializes the serial interface;
[0008] By connecting the two serial interface pairs that constitute the communication channel, the communication channel can be constructed within or between each host system.
[0009] Each main control system's management and configuration process starts at least one QEMU emulation system, mapping a pre-configured single-ended serial interface within the host system as the device backend for emulating the serial interface in the QEMU emulation system;
[0010] Multiple QEMU emulation systems perform system initialization, completing the simulation and loading of the kernel, resources, and operating system;
[0011] After system initialization is complete, multiple QEMU emulation systems can obtain the device files of the internal emulation serial interface and perform application development.
[0012] Each QEMU simulation system communicates with other simulation systems based on its own serial interface device file.
[0013] Furthermore, based on the communication requirements between multiple QEMU simulation systems, the main control system in the corresponding host system generates at least one serial interface and initializes the serial interface, specifically including:
[0014] The main control system generates a virtual serial interface using a purely virtual method, or generates a physical serial interface using real physical peripherals.
[0015] The creation and initialization of the serial interface includes device file registration and creation, driver file registration and loading, and serial interface parameter initialization.
[0016] Furthermore, the main control system in the corresponding host system generates at least one serial interface, including one or more host systems and one or more serial interfaces, wherein the number and distribution of host systems and serial interfaces depend on the communication requirements between the multiple QEMU simulation systems.
[0017] Furthermore, the two serial interface pairs constituting the communication channel are connected to realize the construction of communication channels within or between each host system, including:
[0018] The communication channel is a serial data transmission channel necessary for point-to-point or point-to-multipoint communication between multiple QEMU simulation systems. The multiple QEMU simulation systems that need to communicate are located within one or more host systems, and the communication channel is a channel within the host system or a channel across multiple host systems.
[0019] A serial interface on the same host system as one end of the communication channel is used as a single-end transceiver device for the communication channel, establishing a serial data transmission and reception channel for the transceiver devices at both ends of the communication channel;
[0020] Among them, for virtual serial interface pairs generated in the pure virtual mode, software communication methods are used to connect them, including using one or more of pipes, shared memory, files, message queues, and sockets to transmit messages sent by the virtual serial interfaces at both ends, and using software means to simulate the performance of real serial data transmission, such as performing software flow control to ensure the serial data transmission rate.
[0021] For physical serial interface pairs generated by real physical peripherals, physical serial interface lines are used, with both ends connected to the physical serial interface pairs to establish a transmit / receive channel for the serial interface pairs outside the physical machine.
[0022] Furthermore, the management configuration process of each main control system starts at least one QEMU emulation system, mapping a pre-configured single-ended serial interface within the host system as the device backend for emulating the serial interface in the QEMU emulation system, including:
[0023] The management and configuration process of the main control system is initiated through a graphical interface or script commands to start the QEMU simulation system;
[0024] The host system where the QEMU simulation system is located already has a single-ended serial interface that has been created, initialized, and has established a serial communication channel.
[0025] The QEMU simulation system internally registers an analog serial interface used for communication. This analog serial interface is called the device front end and is mainly intended for internal development and use within the simulation system.
[0026] When configuring the relevant parameters for starting the QEMU simulation system, the management and configuration process of the main control system configures the single-ended serial interface as the device backend of the QEMU simulation system's analog serial interface.
[0027] Furthermore, multiple QEMU emulation systems perform system initialization, including kernel emulation, resource emulation, and operating system loading. Resource emulation includes the emulation and creation of serial interfaces, and the serial interfaces are bound as device front-ends and device back-ends. The device back-end is the single-ended serial interface within the host system specified in the configuration parameters during system startup.
[0028] Furthermore, after system initialization is complete, multiple QEMU emulation systems can obtain the device files for the internal analog serial interface and perform application development, including:
[0029] After system initialization, the QEMU simulation system has already created and bound the analog serial interface to the backend of the device;
[0030] You can access the QEMU emulation system via command line or graphical interface, and view the device files of the emulated serial interface.
[0031] Once inside the QEMU simulation system, you can treat it as a real system and develop and run software within it.
[0032] Furthermore, any QEMU simulation system communicates between simulation systems based on its own serial interface device file, including:
[0033] Any QEMU simulation system can use software to operate the corresponding simulation serial interface to send and receive serial data, based on the serial interface device file.
[0034] The implementation of communication via the simulated serial interface relies on the device backend that it is configured to be bound to, which is the single-ended serial interface within the host system.
[0035] Furthermore, the communication via the simulated serial interface relies on its configured and bound device backend, which is the single-ended serial interface within the host system. Thus, when the QEMU simulation system needs to send serial data to another simulation system, it includes:
[0036] The QEMU simulation system sends data through a simulated serial interface. Depending on the configuration of the front-end and back-end relationships of the devices, the front-end will forward the data to the back-end, that is, the data sent by the simulated serial interface will be forwarded to the single-ended serial interface.
[0037] The single-ended serial interface sends data to the single-ended serial interface at the other end of the pre-configured serial communication channel.
[0038] After receiving the serial data, the single-ended serial interface on the other end forwards the data back to the front end of the device according to the front-end and back-end relationship configuration. That is, the data received by the single-ended serial interface on the other end will be forwarded to the corresponding analog serial interface in its configured analog system to complete the communication.
[0039] Another embodiment of the present invention provides an apparatus for communication between multiple QEMU analog systems, the apparatus comprising:
[0040] The serial interface initialization module, located in the main control system of each host system, is used to generate at least one serial interface according to the communication requirements between multiple QEMU simulation systems, and to initialize the serial interface.
[0041] The serial interface connection module, located in the main control system of each host system, is used to connect the two serial interface pairs that constitute the communication channel, so as to realize the construction of communication channels within or between each host system.
[0042] The management configuration module, located in the main control system of each host system, is used to start at least one QEMU emulation system and map the pre-configured single-ended serial interface in the host system as the device backend of the emulation serial interface in the QEMU emulation system.
[0043] The system initialization module is located in any QEMU emulation system in the host system. It is used to perform system initialization for that QEMU emulation system and complete the simulation and loading of the kernel, resources, and operating system.
[0044] The serial interface communication module is located in any QEMU emulation system of the host system and is used to communicate between multiple QEMU emulation systems according to the device file of the internal emulation serial interface of this system.
[0045] The application module is located in any QEMU emulation system within the host system. It is used to enter this system, treat it as a real system, and develop and run applications.
[0046] Technical effect
[0047] This invention provides a method and apparatus for communication between multiple QEMU simulation systems. Based on serial data transmission, it creates a usable serial interface in the host system, constructs a data transmission channel between multiple serial interfaces according to a communication plan, and configures each serial interface as a device backend for sending and receiving serial data. It offers flexible configuration and controllable testing, meeting the requirements for serial data communication between multiple simulation systems in various scenarios. It breaks through the traditional single-machine simulation requirements, enabling cross-host development and joint debugging across multiple different hosts. It saves costs and facilitates the location of protocol problems and code defects, greatly improving the efficiency of embedded software development.
[0048] The following will further explain the concept, specific structure, and technical effects of the present invention in conjunction with the accompanying drawings, so as to fully understand the purpose, features, and effects of the present invention. Attached Figure Description
[0049] Figure 1 This is a schematic diagram illustrating the relationship between the systems in a multi-system device according to a preferred embodiment of the present invention;
[0050] Figure 2 This is a schematic flowchart of a method for communication between multiple QEMU simulation systems according to a preferred embodiment of the present invention;
[0051] Figure 3 This is a schematic diagram of a device structure for communication between multiple QEMU analog systems according to a preferred embodiment of the present invention;
[0052] Figure 4 This is a schematic diagram of a device structure for inter-system communication using multiple QEMUs, according to another preferred embodiment of the present invention. Detailed Implementation
[0053] To make the technical problems, technical solutions, and beneficial effects of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. Throughout the drawings, the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
[0054] In the following description, specific details, such as particular internal procedures and techniques, are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of the invention. However, those skilled in the art will appreciate that the invention may be practiced in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of the invention with unnecessary detail.
[0055] like Figure 1As shown, the multi-system device in this embodiment of the invention includes: one or more host systems and a main control system, as well as two or more QEMU emulation systems. The relationship between the systems is as follows: multiple QEMU emulation systems located on the same or different host systems can communicate and interact using the main control system.
[0056] In this embodiment of the invention, the host system is a host terminal system capable of deploying QEMU virtualization software. The host terminal needs to have physical resources to support the operation of the system. It can be a personal PC, a server, or a virtual machine created using virtualization technology. Its operating system can be a Linux system, including Debian, Ubuntu, CentOS, etc., or a 32-bit or 64-bit Windows system, or a macOS system, as long as it can support QEMU emulation.
[0057] The main control system is located in the host system and is used to create and initialize multiple serial interfaces in the host system, manage the communication channels between serial interface pairs, and configure them in multiple QEMU simulation systems so that the simulation systems can use preset communication channels for serial data transmission.
[0058] Multiple QEMU emulation systems are multiple emulation systems launched based on different processes of QEMU. They can use different instruction sets than the host system and can emulate specific development boards, including different CPUs, memory sizes, on-board resources, operating systems, etc. Among them, emulating serial interfaces is a simulation of on-board resources.
[0059] like Figure 2 As shown, this embodiment of the invention provides a method for inter-system communication among multiple QEMU analog systems. This method is an inter-system communication method among multiple QEMU analog systems based on serial data transmission, including:
[0060] Step 101: Based on the communication requirements between multiple QEMU simulation systems, the main control system in the corresponding host system generates at least one serial interface and initializes the serial interface.
[0061] In this embodiment, one or more host systems are included, each running a corresponding master control system. Based on the communication requirements between the multiple QEMU simulation systems, the corresponding master control system can generate one or more virtual or physical serial interfaces using either a purely virtual method or by utilizing real physical peripherals, and initialize them. Within the host system, operations such as registering and creating serial interface device files, registering and loading driver files, and initializing serial interface parameters are completed. Furthermore, to ensure good readability during subsequent configuration of the serial interface, it is named "ttyS" along with the numbers of the two simulation systems and A / B terminal identifiers during creation.
[0062] For example, there are two physical terminal devices: a first host system and a second host system, with corresponding main control systems: a first main control system and a second main control system. The first host system is prepared to run a first QEMU emulation system and a second QEMU emulation system, while the second host system is prepared to run a third QEMU emulation system. These three emulation systems are numbered 1, 2, and 3, respectively. There is a need for serial data communication between the first and second QEMU emulation systems, and between the first and third QEMU emulation systems. Specifically, the first QEMU emulation system requires two serial interfaces for communication, while the second and third QEMU emulation systems each require one serial interface.
[0063] Based on this requirement, the first master control system needs to generate and initialize three serial interfaces, namely ttyS12A, ttyS13A, and ttyS12B, while the second master control system needs to generate and initialize one serial interface, ttyS13B. Pairs of serial interfaces must be generated using the same method. The two serial interfaces ttyS12A and ttyS12B used for serial communication between the first and second analog systems can be purely virtual; for example, the first master control system can use existing virtual serial port generation tools to create them. The two serial interfaces ttyS13A and ttyS13B used for serial communication between the first and third analog systems can utilize real physical peripherals. For example, two USB-to-serial adapters can be connected to each physical serial interface on the first and second master control systems, thus completing the creation and initialization of the serial interfaces as required.
[0064] Step 102: Connect the two serial interface pairs that constitute the communication channel to realize the construction of communication channels within or between each host system.
[0065] In this embodiment, the communication channel is a serial data transmission channel essential for point-to-point or point-to-multipoint communication between multiple QEMU emulation systems. This channel can be within a single host system or span multiple host systems. A serial interface on the same host system as one end of the communication channel is used as the single-end transceiver device for this communication channel, thereby establishing the channel. Different channel connection methods exist for different serial interface types: for virtual serial interface pairs generated in a purely virtual manner, software communication is required for connection; for physical serial interface pairs generated using real physical peripherals, physical serial interface cables are required for connection.
[0066] When using software communication for connection, the main considerations are transmission requirements and the location of the serial interface. When the virtual serial interface pairs are located on the same host system, methods such as pipes, shared memory, files, message queues, and sockets can be used to transmit messages sent by the two virtual serial interfaces. When the virtual serial interface pairs are located on different host systems, methods such as message queues and sockets can be used, leveraging the network to transmit messages sent by the two virtual serial interfaces. When using physical serial interface cables for connection, both ends of the physical peripheral cable must be connected to the physical serial interface pairs to establish a transmit / receive channel for the serial interface pairs outside the physical machine.
[0067] In addition, when using software communication to connect, besides achieving the connection of the virtual serial interface pairs at both ends through message passing, it also includes using software means to simulate the performance of real serial data transmission, such as performing software flow control to ensure the serial data transmission rate.
[0068] For example, based on the communication requirements of the aforementioned multi-QEMU simulation system, four serial interfaces have been created and initialized within the two host systems. Two serial communication channels need to be established between them: one for serial communication between the first and second QEMU simulation systems, with ttyS12A and ttyS12B located on the first host system (both virtual serial interfaces); and the other for serial communication between the first and third QEMU simulation systems, with ttyS13A on the first host system and ttyS13B on the second host system (both physical serial interfaces). Therefore, to connect the pairs of serial interfaces constituting these two communication channels, the virtual serial interfaces ttyS12A and ttyS12B can be connected by modifying the read / write functions of the driver file, using methods such as sockets or pipes, and employing software flow control to ensure the serial data transmission rate, or by automatically connecting them using existing serial interface generation tools. The physical serial interfaces ttyS13A and ttyS13B are two actual physical peripherals, connected via physical serial cables. This completes the construction of the communication channel, allowing ttyS12A and ttyS12B, and ttyS13A and ttyS13B to communicate with each other.
[0069] Step 103: The management configuration process of each main control system starts at least one QEMU emulation system and maps the pre-configured single-ended serial interface in the host system as the device backend of the emulation serial interface in the QEMU emulation system.
[0070] In this embodiment of the invention, each host system already has one or more single-ended serial interfaces that have been created, initialized, and have established serial communication channels. The management and configuration process of its main control system starts one or more QEMU simulation systems through a graphical interface or script commands. During startup parameter configuration, the simulated serial interface is registered inside the QEMU simulation system as a communication device front-end, mainly for internal development and use within the simulation system; and the pre-configured single-ended serial interface in the host system is mapped to the device back-end of the QEMU internal simulated serial interface.
[0071] For example, based on the communication requirements of the aforementioned multi-QEMU simulation system, two serial interface pairs with communication channels have already been created within the two host systems. For the simulation system to use these communication channels, parameter configuration is required during startup. The management configuration process of the first master control system starts the first QEMU simulation system and configures it to generate two internal simulated serial interfaces, designating ttyS12A and ttyS13A as the device backends for these two serial interfaces respectively. It also needs to start the second QEMU simulation system and configure it to generate one internal simulated serial interface, designating ttyS12B as the device backend for this serial interface. The management configuration process of the second master control system starts the third QEMU simulation system and configures it to generate one internal simulated serial interface, designating ttyS13B as the device backend for this serial interface. Data can be forwarded between the device frontend and backend; the device frontend can complete serial data transmission using the communication channels of the device backend.
[0072] Step 104: Multiple QEMU emulation systems perform system initialization, completing the simulation and loading of the kernel, resources, and operating system.
[0073] In this embodiment, the management and configuration process of each main control system has started one or more QEMU simulation systems configured with various parameters. Multiple simulation systems perform system initialization, completing the simulation and loading of the kernel, resources, and operating system. Resource simulation includes the simulation and creation of serial interfaces, and the serial interfaces in the simulation systems are bound as device front-ends and device back-ends. The device back-end is the single-ended serial interface in the host system specified in the configuration parameters at system startup.
[0074] For example, based on the communication requirements of the aforementioned multi-QEMU simulation system, the management and configuration process of the first master control system starts the first and second QEMU simulation systems, and the management and configuration process of the second master control system starts the third QEMU simulation system. All systems configure parameters such as kernel, resources, and operating system, especially parameters related to the simulation and binding of the serial interface. After starting, each of the three simulation systems performs system initialization, completing the simulation and loading of system resources. Whether synchronous initialization is necessary can be determined based on requirements.
[0075] Step 105: After system initialization is complete, multiple QEMU simulation systems can obtain the device files of the internal simulated serial interface and perform application development.
[0076] After system initialization is complete, multiple QEMU simulation systems have created and bound analog serial interfaces to the device backend. You can enter each QEMU simulation system through the command line or graphical interface, view the device file of its internal analog serial interface, and treat the simulation system as a real system for software development and operation.
[0077] For example, in this embodiment, based on the communication requirements of the aforementioned multi-QEMU simulation system, the first, second, and third QEMU simulation systems complete system initialization respectively. At this point, each simulation system can be accessed via command line or graphical interface. For instance, the second QEMU simulation system simulates a Raspberry Pi 3B development board. The Raspberry Pi 3B development board has two serial interfaces, ttyAMA0 and ttyS0. This simulation system also simulates these two serial interfaces, specifying ttyAMA0 for console input / output interaction and ttyS0 for serial data transmission. Therefore, ttyS0 is the device front-end of this serial interface, and tty12B is bound to it as its device back-end. Interacting via command line, entering the / dev directory of this simulation system, one can see the ttyS0 device and obtain its device file for subsequent development; simultaneously, this simulation system can be treated as a real Raspberry Pi 3B development board, allowing for code development and execution within it.
[0078] Step 106: Any QEMU simulation system communicates with other simulation systems based on the serial interface device file within its system.
[0079] Each QEMU emulation system operates its serial interface device using software based on the acquired serial interface device file, relying on the configured and bound device backend to send and receive serial data. When a QEMU emulation system needs to send serial data to another emulation system, the specific process is as follows:
[0080] The QEMU simulation system sends data through a simulated serial interface. Depending on the configuration of the front-end and back-end relationships of the devices, the front-end will forward the data to the back-end, that is, the data sent by the simulated serial interface will be forwarded to the single-ended serial interface.
[0081] The single-ended serial interface sends data to the single-ended serial interface at the other end of the pre-configured serial communication channel.
[0082] After receiving the serial data, the serial interface at the other end forwards the data back to the front end of the device according to the front-end and back-end relationship configuration. That is, the data received by the single-ended serial interface at the other end will be forwarded to the corresponding analog serial interface in its configured analog system to complete the communication.
[0083] For example, based on the communication requirements of the aforementioned multi-QEMU simulation system, the first, second, and third QEMU simulation systems are all in operation, and their internal analog serial interfaces are bound to the corresponding single-ended serial interfaces within the host system. For instance, the two analog serial interfaces in the first QEMU simulation system are ttyS0 and ttyS1, respectively configured with virtual serial interface ttyS12A and physical serial interface ttyS13A as their back-end devices; the analog serial interface in the second QEMU simulation system is ttyS0, configured with virtual serial interface ttyS12B as its back-end device; and the analog serial interface in the third QEMU simulation system is ttyS0, configured with physical serial interface ttyS13B as its back-end device. When the first and second QEMU simulation systems perform serial data communication, the specific process is as follows:
[0084] The first QEMU simulation system opens the analog serial interface ttyS0 and sends serial data. According to the configuration of the front-end and back-end relationship of the device, the sending function of ttyS0 will forward the data to the back-end ttyS12A of the device.
[0085] After receiving the serial data, ttyS12A sends the data to ttyS12B at the other end of the channel through the virtual communication channel that has been established in advance with ttyS12B.
[0086] After receiving serial data, the ttyS12B forwards the data to its corresponding front-end device, namely the analog serial interface ttyS0 within the second QEMU simulation system, according to the front-end / back-end relationship configuration. This completes the serial data transmission from the first simulation system to the second simulation system, and vice versa.
[0087] In addition, the process of serial data communication between the first and third QEMU simulation systems is the same as described above. The only difference is that the communication channel between ttyS13A and ttyS13B is a physical peripheral line, while the communication channel between ttyS12A and ttyS12B is a software virtual channel.
[0088] Based on the above steps, serial data communication can be achieved between multiple QEMU simulation systems.
[0089] like Figure 3 As shown, this embodiment of the invention provides a device structure for communication between multiple QEMU analog systems. The device includes:
[0090] The serial interface initialization module 21 is located in the main control system of the host system. It is used to generate at least two serial interfaces according to the communication requirements between multiple QEMU simulation systems and to initialize the serial interfaces.
[0091] The serial interface connection module 22 is located in the main control system of the host system and is used to connect the two serial interface pairs that constitute the communication channel to realize the construction of the internal communication channel of the host system.
[0092] The management configuration module 23 is located in the main control system of the host system. It is used to start at least two QEMU simulation systems and map the pre-configured single-ended serial interface in the host system as the device backend of the simulation serial interface in the QEMU simulation system.
[0093] The system initialization module 24 is located in any QEMU emulation system in the host system. It is used to perform system initialization for the QEMU emulation system and complete the simulation and loading of the kernel, resources, and operating system.
[0094] The serial interface communication module 25 is located in any QEMU simulation system of the host system and is used to communicate between multiple QEMU simulation systems according to the device file of the internal simulation serial interface of this system.
[0095] Application module 26 is located in any QEMU simulation system of the host system. It is used to enter this system and treat it as a real system for application development and operation.
[0096] This device represents the simplest device structure in this embodiment of the invention. The multi-QEMU simulation system is located in the same host system, and the serial interface and the communication channel between them are all created within the same system. It can simulate each subsystem of a complete embedded system and debug communication between subsystems on a single machine. It is suitable for assisting in the development of small-scale embedded systems or for scenarios with high security and confidentiality requirements.
[0097] like Figure 4 As shown, another preferred embodiment of the present invention provides a device structure for communication between multiple QEMU emulation systems. In this device, the system initialization module 24, serial interface communication module 25, application module 26, and [other components] of any QEMU emulation system located within the host system are [components]. Figure 3 The corresponding modules within the same system have identical functionality and are identical. Other modules differ slightly due to the existence of multiple host systems.
[0098] The serial interface initialization module 21 is located in the main control system of each host system. It is used to generate at least one serial interface according to the communication requirements between multiple QEMU simulation systems and to initialize the serial interface.
[0099] The serial interface connection module 22 is located in the main control system of each host system and is used to connect the two serial interface pairs that constitute the communication channel to realize the construction of communication channels within the host system or between multiple hosts.
[0100] The management configuration module 23 is located in the main control system of each host system. It is used to start at least one QEMU simulation system and map the pre-configured single-ended serial interface in the host system as the device backend of the simulation serial interface in the QEMU simulation system.
[0101] This device is a universal device structure according to embodiments of the present invention. It can include multiple host systems, each host system having a corresponding main control system and one or more QEMU emulation systems. The communication channels between serial interfaces can be built within the same host system or across different host systems. Compared to Figure 3 The device, which can be expanded from a single unit to multiple units, is suitable for the auxiliary development and subsequent dynamic expansion of large-scale embedded systems, and is more suitable for the development trend of digitalization, intelligence and cloud platform.
[0102] This invention provides a method and apparatus for communication between multiple QEMU simulation systems. Based on serial data transmission, it creates a usable serial interface in the host system, constructs a data transmission channel between multiple serial interfaces according to a communication plan, and configures each serial interface as a device backend for sending and receiving serial data. This supplements the lack of a serial communication channel between simulation systems provided by QEMU, and better solves the node communication problems such as complex serial protocol debugging between subsystems in embedded environments. This invention offers flexible configuration and controllable testing, meeting the requirements for serial data communication between multiple simulation systems in various scenarios. A single-host system mode can be used for small-scale embedded system development or scenarios with high confidentiality requirements, while a multi-host system mode can be used for large-scale embedded system development or scenarios requiring dynamic expansion or cloud platformization. It overcomes the shortcomings of traditional single-machine simulation, allowing for free selection of multiple machines for collaborative development and debugging. Compared to existing embedded system simulation technologies that typically focus only on single-board systems and neglect the joint debugging simulation between multiple boards in a complete embedded system, and require additional programming or tools to verify inter-board protocols, this invention is based on the overall simulation of the embedded system and focuses on the simulation method of serial data communication between its subsystems, which can better improve the efficiency of embedded software development and problem localization.
[0103] The preferred embodiments of the present invention have been described in detail above. It should be understood that those skilled in the art can make numerous modifications and variations based on the concept of the present invention without creative effort. Therefore, all technical solutions that can be obtained by those skilled in the art based on the concept of the present invention through logical analysis, reasoning, or limited experimentation on the basis of existing technology should be within the scope of protection defined by the claims.
Claims
1. A method for communication between multiple QEMU simulation systems, characterized in that, Includes the following steps: According to the communication requirements between multiple QEMU simulation systems, the main control system in the corresponding host system generates at least one serial interface and initializes the serial interface. The two serial interface pairs that constitute the communication channel are connected to realize the construction of communication channels within or between each of the host systems; The management and configuration process of each of the main control systems starts at least one of the QEMU emulation systems and maps the pre-configured single-ended serial interface in the host system as the device backend of the emulation serial interface in the QEMU emulation system; The multiple QEMU simulation systems perform system initialization, completing the simulation and loading of the kernel, resources, and operating system; After system initialization is completed, the multiple QEMU simulation systems can obtain the device files of the internal analog serial interface and perform application development; Each of the QEMU simulation systems communicates with each other based on the serial interface device file within the system.
2. The method for communication between multiple QEMU analog systems as described in claim 1, characterized in that, According to the communication requirements between multiple QEMU simulation systems, the main control system in the corresponding host system generates at least one serial interface and initializes the serial interface, specifically including: The main control system generates a virtual serial interface using a purely virtual method, or generates a physical serial interface using real physical peripherals. The creation and initialization operations of the serial interface include device file registration and creation, driver file registration and loading, and serial interface parameter initialization.
3. The method for communication between multiple QEMU analog systems as described in claim 2, characterized in that, The main control system in the corresponding host system generates at least one serial interface, including one or more host systems and one or more serial interfaces, wherein the number and distribution of the host systems and the serial interfaces depend on the communication requirements between the multi-QEMU simulation systems.
4. The method for communication between multiple QEMU analog systems as described in claim 2, characterized in that, The step of connecting the two serial interface pairs constituting the communication channel to construct the communication channel within or between each of the host systems includes: The communication channel is a serial data transmission channel necessary for point-to-point or point-to-multipoint communication between the multiple QEMU simulation systems; the multiple QEMU simulation systems that need to communicate are located within one or more of the host systems, and the communication channel is a channel within the host system or a channel across multiple host systems. A serial interface on the host system, with one end of the communication channel in the same location as the host system, is used as a single-end transceiver device for the communication channel, thereby establishing a serial data transmission and reception channel for the transceiver devices at both ends of the communication channel. Among them, the virtual serial interface pairs generated by the pure virtual method are connected by software communication methods, including using one or more of the following methods to transmit messages sent by the virtual serial interfaces at both ends: pipes, shared memory, files, message queues, and sockets; and using software means to simulate the performance of real serial data transmission, including performing software flow control to ensure the serial data transmission rate. For the physical serial interface pair generated by the real physical peripheral, a physical serial interface cable is used, with both ends connected to the physical serial interface pair, to establish a transmit / receive channel for the serial interface pair outside the physical machine.
5. The method for communication between multiple QEMU analog systems as described in claim 1, characterized in that, The management and configuration process of each of the main control systems starts at least one of the QEMU emulation systems, maps the pre-configured single-ended serial interface within the host system, and uses it as the device backend for emulating the serial interface in the QEMU emulation system, including: The management and configuration process of the main control system starts the QEMU simulation system through a graphical interface or script commands; The host system where the QEMU simulation system is located already has a single-ended serial interface that has been created, initialized, and has established a serial communication channel. The QEMU simulation system internally registers an analog serial interface for communication. This analog serial interface is called the device front end and is mainly for internal development and use within the simulation system. When configuring and starting the QEMU simulation system, the management and configuration process of the main control system configures the single-ended serial interface as the device backend of the simulation serial interface of the QEMU simulation system.
6. The method for communication between multiple QEMU analog systems as described in claim 1, characterized in that, The multiple QEMU emulation systems perform system initialization, including kernel emulation, resource emulation, and operating system loading. The resource emulation includes the emulation and creation of serial interfaces, and the serial interfaces are bound as device front-ends and device back-ends. The device back-end is the single-ended serial interface in the host system specified in the configuration parameters at system startup.
7. The method for communication between multiple QEMU analog systems as described in claim 1, characterized in that, After system initialization is complete, the multiple QEMU simulation systems can obtain the device files of the internal analog serial interface and perform application development, including: After system initialization, the simulated serial interface bound to the backend of the device has been created and bound within the QEMU simulation system; The QEMU simulation system can be accessed via command line or graphical interface, and the device file of the simulated serial interface can be obtained by viewing the device. Once inside the QEMU simulation system, the simulation system can be treated as a real system, allowing for software development and operation.
8. The method for communication between multiple QEMU analog systems as described in claim 1, characterized in that, The QEMU simulation system communicates between simulation systems according to the serial interface device file within the system, including: The QEMU simulation system operates the corresponding simulation serial interface in software according to the serial interface device file to send and receive serial data. The communication via the simulated serial interface is achieved by configuring and binding a device backend, which is the single-ended serial interface within the host system.
9. The method for communication between multiple QEMU analog systems as described in claim 8, characterized in that, The communication via the simulated serial interface relies on its configured and bound device backend, which is the single-ended serial interface within the host system. Therefore, when the QEMU simulation system needs to send serial data to another simulation system, it includes: The QEMU simulation system sends data through the simulated serial interface. According to the configuration of the front-end and back-end relationship of the device, the front-end of the device will forward the data to the back-end of the device, that is, the data sent by the simulated serial interface will be forwarded to the single-ended serial interface. The single-ended serial interface sends data to the single-ended serial interface at the other end of the pre-configured serial communication channel. After receiving the serial data, the single-ended serial interface at the other end forwards the data back to the front end of the device according to the front-end and back-end relationship configuration. That is, the data received by the single-ended serial interface at the other end will be forwarded to the corresponding analog serial interface in its configured analog system to complete the communication.
10. A device for communication between multiple QEMU analog systems, characterized in that, The device includes: The serial interface initialization module is located in the main control system of each host system. It is used to generate at least one serial interface according to the communication requirements between multiple QEMU simulation systems and to initialize the serial interface. A serial interface connection module, located in the main control system of each host system, is used to connect the two serial interface pairs that constitute the communication channel, thereby realizing the construction of communication channels within or between each host system. The management configuration module, located in the main control system of each host system, is used to start at least one of the QEMU emulation systems and map the pre-configured single-ended serial interface in the host system as the device backend of the emulation serial interface in the QEMU emulation system. The system initialization module is located in any QEMU emulation system in the host system, and is used to perform system initialization for the QEMU emulation system, and to complete the simulation and loading of the kernel, resources and operating system; A serial interface communication module, located in any QEMU emulation system of the host system, is used to communicate between the multiple QEMU emulation systems according to the device file of the internal emulation serial interface of this system. The application module is located in any QEMU emulation system within the host system. It is used to enter this system, treat it as a real system, and develop and run applications.