Method for building embedded software simulation target based on general computing platform
Patent Information
- Application Number
- CN202310396587.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-14
- Publication Date
- 2026-09-18
- Estimated Expiration
- 2043-04-14
AI Technical Summary
在目标机硬件环境完成研制前,难以进行嵌入式软件测试,致使嵌入式软件开发测试无法与硬件平台研制并行开展,从而导致整个嵌入式系统的研制周期延长
[0030] (1) This invention proposes a low-cost method for constructing an embedded software simulation target machine. By simulating the dedicated hardware interface or bus device of the embedded system, there is no need to purchase and develop a dedicated target machine or dedicated hardware interface device. The embedded software simulation runtime environment can be constructed based solely on a common commercial computer platform or even a virtual machine technology platform.
Smart Images

Figure CN116401018B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of simulation technology, specifically relating to a method for constructing an embedded software simulation target machine based on a general computing platform. Background Technology
[0002] Embedded systems are widely used in many fields such as aviation, aerospace, industrial process control, and consumer electronics. Embedded systems are typically dedicated computer systems built on embedded platforms and with corresponding embedded software developed to perform various control, calculation, monitoring, and communication tasks, tailored to specific application requirements and working environments.
[0003] Embedded software runs on an embedded platform and communicates and interacts with peripheral devices through external interfaces or buses. Embedded software typically features embeddability, specialization, and strong hardware dependency. This strong hardware dependency means that debugging and testing of embedded software is primarily based on signal driving and responses from hardware interfaces; in other words, embedded software must rely on a dedicated target machine hardware environment to function correctly. Before the target machine hardware environment is fully developed, it is difficult to perform embedded software testing, preventing the parallel development of embedded software and hardware platform, thus extending the overall development cycle of the embedded system. Summary of the Invention
[0004] (a) Technical problems to be solved
[0005] The technical problem to be solved by this invention is: how to decouple the embedded hardware and software environment by simulating the dedicated hardware interface or bus device of the embedded system, and build an embedded software simulation target machine based on a general computing platform, so as to provide a low-cost simulation and verification environment for embedded software design, development, testing and verification.
[0006] (II) Technical Solution
[0007] To address the aforementioned technical problems, this invention provides a method for constructing an embedded software simulation target machine based on a general-purpose computing platform. This method adds a hardware interface simulation middleware between the application software (i.e., embedded software) and the operating system to simulate the functions of dedicated hardware interfaces, thereby eliminating the dependency of the application software on dedicated hardware interfaces and thus realizing the construction of an embedded software simulation target machine based on a general-purpose computing platform.
[0008] Preferably, the hardware interface simulation middleware is designed to consist of three parts: an interface adaptation layer, a device simulation layer, and a network communication layer.
[0009] The interface adaptation layer is used to redirect the access operations of the upper-layer embedded software to the real hardware interface device to the corresponding simulation device by adapting the dedicated hardware interface operation functions.
[0010] The device simulation layer is used to simulate the hardware interface state, input / output, and processing logic through pure software, and to simulate the corresponding hardware interface functions.
[0011] The network communication layer is used to realize the communication interaction between the dedicated hardware interface simulation device and the external system or device. On the one hand, it receives the excitation data of the external system or device, and on the other hand, it outputs response or feedback data to the external system or device.
[0012] Preferably, the interface adaptation layer has two implementation methods:
[0013] (1) Maintain the hardware interface function prototype and redirect the dedicated hardware interface operation to the operation of the corresponding virtual device in the device emulation layer by redefining the main part of the function;
[0014] (2) Register the operation functions of the virtual device in the device emulation layer to the operating system I / O system, so as to access the corresponding virtual device in the device emulation layer through standard I / O operations.
[0015] Preferably, in the simulation hardware interface implemented by the device simulation layer:
[0016] The simulated hardware interface function is implemented by redefining the function based on the interface function function in the driver, and converting the operation of the real hardware into read and write operation of memory data structure, or data input / output operation of network communication layer;
[0017] An interface device status table is used to maintain various status information during the operation of virtual hardware interface devices; the hardware interface device status includes general status information and special status information.
[0018] The simulation hardware interface input enables the reception of data input from the network communication layer, providing support for upper-layer application software to receive external stimulus data.
[0019] The simulated hardware interface output enables data output to the network communication layer, providing support for external systems or devices to obtain responses or feedback from upper-layer application software.
[0020] Preferably, the network communication layer is designed to include a network communication receiver, an I / O processor, and an I / O connector;
[0021] The network communication receiver adopts a TCP / UDP server, binds a fixed port number, and uses select to achieve multiplexing. It manages the connection and data reception of all external TCP / UDP clients. In other words, the connection and data interaction between the interface simulation device and external systems or devices are all realized through the network communication receiver.
[0022] The I / O processor is used to identify the type of simulation device for the TCP / UDP client interface, determine the communication link, and schedule communication data.
[0023] The I / O connector is used to maintain the mapping relationship between the interface emulation device and the TCP / UDP client, as well as to forward communication data. Specifically, it forwards data from the I / O processor to the corresponding interface emulation device according to the mapping relationship, or forwards data from the interface emulation device to the TCP / UDP client.
[0024] Preferably, the I / O processor identifies the device type by using the port number of the external TCP / UDP client itself to identify the type of the interface emulation device being connected; when the external TCP / UDP client connects to the network communication receiver, it needs to configure not only the server's IP address and port number, but also its own IP address and port number.
[0025] Preferably, the I / O processor determines the communication link in the following way: the communication link of the interface emulation device is determined by the port number of the external TCP / UDP client itself: the base number of the port number corresponding to the identified interface emulation device type is obtained, and then the offset of the port number of the TCP / UDP client itself relative to the base number of the port number corresponding to the interface emulation device is calculated. Based on the port offset, the mapping relationship between the interface emulation device and the TCP / UDP client can be determined, that is, the communication link from the interface emulation device to the TCP / UDP client is determined.
[0026] Preferably, the I / O processor implements communication data scheduling in the following manner: according to the communication link of the interface emulation device, it forwards the data frames received by the network communication receiver to the corresponding I / O connector.
[0027] Preferably, the embedded software simulation target machine is a simulation target machine for embedded software, which refers to a simulation environment that supports the operation of embedded software by means of interface adaptation and redirection, shielding specific dedicated hardware interface devices or bus access operations.
[0028] The present invention also provides an embedded software simulation target machine constructed using the method described above.
[0029] (III) Beneficial Effects
[0030] (1) This invention proposes a low-cost method for constructing an embedded software simulation target machine. By simulating the dedicated hardware interface or bus device of the embedded system, there is no need to purchase and develop a dedicated target machine or dedicated hardware interface device. The embedded software simulation runtime environment can be constructed based solely on a common commercial computer platform or even a virtual machine technology platform.
[0031] (2) This invention can be used to support the collaborative development and testing of embedded system software and hardware. Based on the embedded software simulation target machine, embedded software design, development, testing and verification can begin without waiting for the hardware platform to be developed, thereby improving the quality and development efficiency of embedded software.
[0032] (3) This invention can be used to support embedded software fault testing. Based on the embedded software simulation target machine, by controlling the state or input / output of the simulation device through the hardware interface, the problem that it is difficult to trigger or simulate abnormal or fault conditions in embedded systems can be solved to a certain extent, and the sufficiency of embedded software testing can be improved. Attached Figure Description
[0033] Figure 1 This is a schematic diagram of the embedded software simulation target machine construction method based on a general computing platform according to the present invention.
[0034] Figure 2 This is a hardware interface simulation middleware architecture diagram of the present invention;
[0035] Figure 3 This is a schematic diagram illustrating the adaptation of the virtual hardware interface operation functions in VxWorks to standard I / O operation functions according to the present invention.
[0036] Figure 4 This is a diagram illustrating the hardware interface (device) architecture of the device simulation layer of the present invention.
[0037] Figure 5 This is a diagram of the network communication layer architecture of the present invention. Detailed Implementation
[0038] To make the objectives, contents, and advantages of the present invention clearer, the specific embodiments of the present invention will be described in further detail below with reference to the accompanying drawings and examples.
[0039] This invention provides a method for constructing an embedded software simulation target machine based on a general-purpose computing platform. The embedded software simulation target machine in this invention is a simulation target machine for embedded software, referring to a simulation environment that supports the operation of embedded software by using interface adaptation and redirection to shield specific dedicated hardware interface devices or bus access operations.
[0040] The principle diagram of the embedded software simulation target machine construction method based on a general computing platform is shown below. Figure 1As shown, this method adds hardware interface simulation middleware between the application software (embedded software) and the operating system to simulate the functions of dedicated hardware interfaces such as AD / DA, DI / DO, RS422 / 485, and CAN bus, thereby eliminating the application software's dependency on dedicated hardware interfaces and enabling the construction of an embedded software simulation target machine based on a general-purpose computing platform. The general-purpose computing platform can be a regular commercial computer or industrial control computer, or a virtual machine technology platform such as VMware, QEMU, or VirtualBox.
[0041] The architecture diagram of the embedded software simulation target machine hardware interface simulation middleware is as follows: Figure 2 As shown. The hardware interface simulation middleware consists of three parts: the interface adaptation layer, the device simulation layer, and the network communication layer. The following details the specific construction steps of the hardware interface simulation middleware (the interface adaptation layer, device simulation layer, and network communication layer are implemented in layers, and the construction steps are not in any particular order).
[0042] Step 1: Implementation of the Interface Adaptation Layer
[0043] The interface adaptation layer redirects access operations from the upper-layer embedded software to the corresponding simulation device by adapting dedicated hardware interface operation functions. From the perspective of ensuring the operation of the embedded software, the embedded software only needs to obtain the same operational effect through the dedicated hardware interface operation functions, and is neither aware of nor concerned with the actual operation process of the underlying hardware interface.
[0044] There are two ways to implement the interface adaptation layer:
[0045] (1) Maintain the hardware interface function prototype and redirect the dedicated hardware interface operation to the operation of the corresponding virtual device in the device emulation layer by redefining the main part of the function.
[0046] (2) Register the operation functions of the virtual devices in the device emulation layer to the operating system I / O system, so that the corresponding virtual devices in the device emulation layer can be accessed and operated through standard I / O operations (such as device registration, device start / stop, device reset and exit, device interrupt, device read / write, etc.). Figure 3 This diagram illustrates how virtual hardware interface operation functions in the VxWorks real-time operating system are adapted to standard I / O operation functions, and how the virtual hardware interface operation function xxOpen is accessed through the standard operation function open (which enables device opening).
[0047] Step 2: Implementation of the Equipment Simulation Layer
[0048] The device simulation layer simulates the hardware interface state, input / output, and processing logic using pure software, thus simulating the corresponding hardware interface functions. The architecture diagram of the simulated hardware interface (device) is shown below. Figure 4 As shown.
[0049] (1) Simulate hardware interface function: The hardware interface device function is generally reflected by the interface function provided to the upper layer application software. The simulated hardware interface function can be implemented by referring to the interface function function in the driver and redefining the function. The operation of real hardware (such as register) is converted into the read and write operation of memory data structure (device status table) or the data input / output operation of network communication layer.
[0050] (2) Simulated Hardware Interface Status: The interface device status table maintains various status information during the operation of the virtual hardware interface device. The hardware interface device status includes general status information and specific status information. For example, whether the device is initialized or turned on belongs to the general status information of the device. For analog and discrete interface devices such as AD / DA and DI / DO, the analog value and switch status of each channel can be maintained through an array data structure; for interface devices such as RS422 / 485 and CAN bus, the data frame list can be maintained through a queue data structure.
[0051] (3) Simulation hardware interface input: The simulation hardware interface input mainly realizes the reception of data input from the network communication layer, providing support for the upper-layer application software to receive external stimulus data.
[0052] (4) Simulation hardware interface output: The simulation hardware interface output mainly realizes the data output to the network communication layer, providing support for external systems or devices to obtain responses or feedback from upper-layer application software.
[0053] Step 3: Implementation of the Network Communication Layer
[0054] The network communication layer primarily enables communication and interaction between dedicated hardware interface simulation devices such as AD / DA, DI / DO, RS422 / 485, and CAN bus and external systems or devices. It receives stimulus data from external systems or devices and outputs response or feedback data to them. The network communication layer architecture diagram is shown below. Figure 5 As shown, it includes:
[0055] (1) SocketAcceptor (network communication receiver) adopts TCP / UDP server, binds fixed port number, and implements multiplexing through select. It manages the connection and data reception of all external TCP / UDP clients. That is, the connection and data interaction between the interface simulation device and the external system or device are all implemented through SocketAcceptor.
[0056] (2) IoHandler (I / O processor) mainly implements the identification of the simulation device type of the TCP / UDP client interface, the determination of the communication link, and the scheduling of communication data.
[0057] Device Type Identification: The type of the interface emulation device being connected is identified by the port number of the external TCP / UDP client itself. When an external TCP / UDP client connects to the SocketAcceptor, it needs to configure not only the server's IP address and port number, but also its own IP address and port number. For example, if a port number between 8000 and 8099 is assigned to an RS422 / 485 interface emulation device, and the TCP / UDP client's own port number is within the range of 8000 to 8099, then the connected interface emulation device is indeed RS422 / 485.
[0058] Communication Link Determination: The communication link of the interface emulation device is determined by the port number of the external TCP / UDP client itself. Based on the interface emulation device type identified through "Device Type Identification," the base number of the port number corresponding to that type of interface emulation device can be obtained. Then, the offset of the TCP / UDP client's port number relative to the base number of the corresponding port number of the interface emulation device can be calculated. Based on the port offset, the mapping relationship between the interface emulation device and the TCP / UDP client can be determined, that is, the communication link from the interface emulation device to the TCP / UDP client can be determined. For example, if the base number of the port number corresponding to the RS422 / 485 interface emulation device is 8000, and the port number of the TCP / UDP client itself is found to be 8002, it indicates a connection to channel 2 of the RS422 / 485 interface emulation device.
[0059] Communication data scheduling: According to the communication link of the interface simulation device, the data frames received by the SocketAcceptor are forwarded to the corresponding IoConnector (I / O connector).
[0060] (3) IoConnector (I / O connector) mainly implements the maintenance of the mapping relationship between the interface emulation device and the TCP / UDP client, as well as the forwarding of communication data. For example, it forwards the data forwarded by IoHandler to the corresponding interface emulation device according to the mapping relationship, or forwards the data sent by the interface emulation device to the TCP / UDP client.
[0061] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the technical principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A method for constructing an embedded software simulation target machine based on a general-purpose computing platform, characterized in that, This method adds a hardware interface simulation middleware between the application software (embedded software) and the operating system to simulate the functions of dedicated hardware interfaces, thereby eliminating the dependency of the application software on dedicated hardware interfaces and realizing the construction of an embedded software simulation target machine based on a general computing platform. The hardware interface simulation middleware is designed to consist of three parts: an interface adaptation layer, a device simulation layer, and a network communication layer. The interface adaptation layer is used to redirect the access operations of the upper-layer embedded software to the real hardware interface device to the corresponding simulation device by adapting the dedicated hardware interface operation functions. The device simulation layer is used to simulate the hardware interface state, input / output, and processing logic through pure software, and to simulate the corresponding hardware interface functions. The network communication layer is used to realize the communication interaction between the dedicated hardware interface simulation device and the external system or device. On the one hand, it receives the excitation data from the external system or device, and on the other hand, it outputs response or feedback data to the external system or device. The interface adaptation layer can be implemented in two ways: (1) Maintain the hardware interface function prototype and redirect the dedicated hardware interface operation to the operation of the corresponding virtual device in the device emulation layer by redefining the main part of the function; (2) Register the operation functions of the virtual device in the device emulation layer to the operating system I / O system, so as to access the corresponding virtual device in the device emulation layer through standard I / O operations; In the simulation hardware interface implemented by the device simulation layer: The simulated hardware interface function is implemented by redefining the function based on the interface function function in the driver, and converting the operation of the real hardware into read and write operation of memory data structure, or data input / output operation of network communication layer; An interface device status table is used to maintain various status information during the operation of virtual hardware interface devices; the hardware interface device status includes general status information and special status information. The simulation hardware interface input enables the reception of data input from the network communication layer, providing support for upper-layer application software to receive external stimulus data. The simulated hardware interface output enables data output to the network communication layer, providing support for external systems or devices to obtain responses or feedback from upper-layer application software. The network communication layer is designed to include a network communication receiver, an I / O processor, and an I / O connector. The network communication receiver adopts a TCP / UDP server, binds a fixed port number, and uses select to achieve multiplexing. It manages the connection and data reception of all external TCP / UDP clients. In other words, the connection and data interaction between the interface simulation device and external systems or devices are all realized through the network communication receiver. The I / O processor is used to identify the type of simulation device for the TCP / UDP client interface, determine the communication link, and schedule communication data. The I / O connector is used to maintain the mapping relationship between the interface emulation device and the TCP / UDP client, as well as to forward communication data. Specifically, it forwards data from the I / O processor to the corresponding interface emulation device according to the mapping relationship, or forwards data from the interface emulation device to the TCP / UDP client.
2. The method as described in claim 1, characterized in that, The I / O processor identifies the device type by using the port number of the external TCP / UDP client itself to identify the type of the interface emulation device being connected. When the external TCP / UDP client connects to the network communication receiver, it needs to configure not only the server's IP address and port number, but also its own IP address and port number.
3. The method as described in claim 1, characterized in that, The I / O processor determines the communication link in the following way: it determines the communication link of the interface emulation device by using the port number of the external TCP / UDP client itself. It obtains the base number of the port number corresponding to the identified interface emulation device type, and then calculates the offset of the TCP / UDP client's port number relative to the base number of the corresponding port number of the interface emulation device. Based on the port offset, the mapping relationship between the interface emulation device and the TCP / UDP client can be determined, that is, the communication link from the interface emulation device to the TCP / UDP client can be determined.
4. The method as described in claim 1, characterized in that, The I / O processor implements communication data scheduling in the following way: according to the communication link of the interface simulation device, it forwards the data frames received by the network communication receiver to the corresponding I / O connector.
5. The method according to any one of claims 1 to 4, characterized in that, The embedded software simulation target machine is a simulation target machine for embedded software. It refers to a simulation environment that supports the operation of embedded software by using interface adaptation and redirection to shield specific dedicated hardware interface devices or bus access operations.
6. An embedded software simulation target machine constructed using the method described in any one of claims 1 to 5.
Citation Information
Patent Citations
Model-based airborne embedded software test environment construction method
CN107678946A