Method for communication between IDE container and physical target machine serial port

By constructing virtual serial port devices in a cloud environment and establishing their mapping relationship with the physical target board, the problem that IDE containers cannot directly access the physical target board serial port is solved, and the efficiency of embedded software development and the convenience of physical target board management is improved.

CN119883997APending Publication Date: 2025-04-25XIAN AVIATION COMPUTING TECH RES INST OF AVIATION IND CORP OF CHINA
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411957013.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-29
Publication Date
2025-04-25

AI Technical Summary

Technical Problem

In a cloud environment, IDE containers cannot directly access the physical target board serial port, resulting in many inconveniences when developers use cloud integrated development environment for embedded system development.

Method used

By constructing a virtual serial port device, establishing a mapping relationship between the virtual serial port device and the physical target board, and realizing the virtual serial port sharing between the host and the IDE container based on the container configuration. The IDE container communicates with the physical target board through the virtual serial port device.

Benefits of technology

It effectively solves the problem that IDE containers cannot directly access the physical target board serial port in a cloud environment, and improves the efficiency of embedded software development and the convenience of physical target board management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119883997A_ABST
    Figure CN119883997A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of computer system software, and particularly relates to a serial port communication method for an IDE container and a physical target machine, which is used for realizing serial port communication between the container and a target board in a cloud platform and loading or debugging a program on the target board. The method comprises the following steps: constructing virtual serial port equipment on an IDE container host machine, and establishing a corresponding relation between the virtual serial port equipment and physical target machine serial port equipment; and mapping the virtual serial port equipment of the host machine to the IDE container, so that the container can send and receive data to the virtual serial port equipment. According to the invention, the problem that the IDE container cannot directly access the serial port of the physical target board in the cloud environment can be effectively solved. And the development efficiency of embedded software and the management convenience of the physical target board are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of computer system software, and in particular relates to a method for serial port communication between an IDE container and a physical target machine. Background Art

[0002] With the development of cloud computing technology, more and more developers and enterprises are migrating their development environments to the cloud. However, in the cloud environment, serial communication between the IDE (Integrated Development Environment) container and the physical target board has become a problem. The traditional serial communication method is suitable for scenarios where the development environment host and the target board are directly connected via serial ports, but cannot be directly applied to the cloud environment, causing developers to encounter many inconveniences when using the cloud integrated development environment to develop embedded systems. Summary of the invention

[0003] In view of this, the present invention provides a method for serial port communication between an IDE container and a physical target machine, constructs a virtual serial port device, establishes a mapping relationship between the virtual serial port device and the physical target board, realizes virtual serial port sharing between the host machine and the IDE container based on container configuration, and the IDE container communicates with the physical target board through the virtual serial port device. The present invention can effectively solve the problem that the IDE container cannot directly access the serial port of the physical target board in a cloud environment, and improves the efficiency of embedded software development and the convenience of physical target board management.

[0004] The technical solution of the present invention:

[0005] In one embodiment of the present invention, a method for serial port communication between an IDE container and a physical target machine is proposed, which is used to implement serial port communication between a container and a target board in a cloud platform, and load or debug a program on the target board; the communication method comprises: constructing a virtual serial port device on an IDE container host machine, and establishing a corresponding relationship between the virtual serial port device and the serial port device of the physical target machine; mapping the virtual serial port device of the host machine to the IDE container, so that the container can send and receive data to the virtual serial port device;

[0006] The IDE container communicates with the physical target board based on a virtual serial port device.

[0007] Furthermore, the corresponding relationship is specifically as follows: multiple virtual serial port devices are established on the host machine, and each IDE container is connected to the target board through the virtual serial port device.

[0008] Furthermore, the corresponding relationship is maintained through a list or a file.

[0009] Furthermore, a plurality of ports are arranged on the server at the management side of the target board, and each port is connected to a target board.

[0010] Furthermore, the host creates a virtual device, requests the intranet IP of each port on the server, establishes a mapping relationship between the virtual device and the intranet IP of each port on the server, and stores and maintains the mapping relationship in the form of a local file.

[0011] Furthermore, when the host machine communicates with the target board via serial port, the serial port communication data is encapsulated into an IP data packet to implement serial port communication based on IP.

[0012] Furthermore, the host machine is a working node in the cloud environment, a virtual serial port driver is installed on the host machine, a virtual serial port device is created, the virtual serial port device is synchronized to the server, and the correspondence between the virtual serial port device and the server port is maintained through a local configuration file.

[0013] Furthermore, on the host machine, the virtual serial port device is mapped to the IDE container, so that the IDE can access the physical target board through the virtual serial port device.

[0014] Furthermore, the container is a docker container, and a group of qualified virtual serial port devices are mapped to the container using the --device-cgroup-rule='c 188:*rmw' startup parameter, so that the processes in the container are given read, write and mknod permissions.

[0015] Furthermore, a serial port communication protocol is implemented inside the IDE container, and a serial port terminal is added. The serial port terminal user configures serial port parameters, sends and echoes data; the user uses the serial port terminal to send data to the virtual serial port device, and the data is forwarded to the server through the virtual serial port driver, and then the data is forwarded to the serial port device of the physical target board by retrieving the correspondence between the virtual serial port device and the physical target board ID.

[0016] Beneficial effects of the present invention:

[0017] The present invention can effectively solve the problem that the IDE container cannot directly access the serial port of the physical target board in the cloud environment, thereby improving the efficiency of embedded software development and the convenience of physical target board management. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0019] Figure 1 It is a schematic diagram of the framework of the serial port communication method between the IDE container and the physical target machine;

[0020] Figure 2 It is a timing diagram of the serial port communication method between the IDE container and the physical target machine. DETAILED DESCRIPTION

[0021] The embodiments of the present disclosure are described in detail below with reference to the accompanying drawings.

[0022] The following describes the embodiments of the present disclosure through specific examples, and those skilled in the art can easily understand other advantages and effects of the present disclosure from the contents disclosed in this specification. Obviously, the described embodiments are only a part of the embodiments of the present disclosure, rather than all of the embodiments. The present disclosure can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present disclosure. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present disclosure.

[0023] It should be noted that various aspects of the embodiments within the scope of the appended claims are described below. It should be apparent that the aspects described herein can be embodied in a wide variety of forms, and any specific structure and / or function described herein is merely illustrative. Based on the present disclosure, it should be understood by those skilled in the art that an aspect described herein can be implemented independently of any other aspect, and two or more of these aspects can be combined in various ways. For example, any number of aspects described herein can be used to implement the device and / or practice the method. In addition, other structures and / or functionalities other than one or more of the aspects described herein can be used to implement this device and / or practice this method.

[0024] It should also be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present disclosure. The illustrations only show components related to the present disclosure rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.

[0025] Additionally, in the following description, specific details are provided to facilitate a thorough understanding of the examples. However, it will be understood by those skilled in the art that the aspects described may be practiced without these specific details.

[0026] In one embodiment of the present invention, a method for serial communication between an IDE container and a physical target machine is provided, which is used to implement serial communication between the container and the target board in a cloud platform, and load or debug a program on the target board; Figure 1-Figure 2, the communication method includes: constructing a virtual serial port device on an IDE container host machine, and establishing a corresponding relationship between the virtual serial port device and the serial port device of a physical target machine; mapping the virtual serial port device of the host machine to the IDE container, so that the container can send and receive data to the virtual serial port device;

[0027] The IDE container communicates with the physical target board based on a virtual serial port device.

[0028] In this embodiment, the corresponding relationship is specifically: multiple virtual serial port devices are established on the host machine, and each IDE container is connected to the target board through the virtual serial port device.

[0029] In this embodiment, the corresponding relationship is maintained through a list or a file.

[0030] In this embodiment, a plurality of ports are arranged on the server at the management side of the target board, and each port is connected to a target board.

[0031] In this embodiment, the host creates a virtual device, requests the intranet IP of each port on the server, establishes a mapping relationship between the virtual device and the intranet IP of each port on the server, and stores and maintains the mapping relationship in the form of a local file.

[0032] In this embodiment, when the host machine performs serial communication with the target board, the serial communication data is encapsulated into an IP data packet to implement IP-based serial communication.

[0033] In this embodiment, the host machine is a working node in the cloud environment. A virtual serial port driver is installed on the host machine, a virtual serial port device is created, the virtual serial port device is synchronized to the server, and the correspondence between the virtual serial port device and the server port is maintained through a local configuration file.

[0034] In this embodiment, on the host machine, the virtual serial port device is mapped to the IDE container, so that the IDE can access the physical target board through the virtual serial port device.

[0035] In this embodiment, the container is a docker container, and the --device-cgroup-rule='c188:*rmw' startup parameter is used to map a group of qualified virtual serial port devices into the container, and grant the processes in the container read, write and mknod permissions.

[0036] In this embodiment, a serial port communication protocol is implemented inside the IDE container, and a serial port terminal is added. The serial port terminal user configures serial port parameters, sends and echoes data; the user uses the serial port terminal to send data to the virtual serial port device, and the data is forwarded to the server through the virtual serial port driver. Then, by retrieving the correspondence between the virtual serial port device and the physical target board ID, the data is forwarded to the serial port device of the physical target board.

[0037] In this embodiment, serial port server software is deployed on the physical target board side, and the serial port server software manages a group of physical target boards and binds a unique ID to the serial port device of each physical target board. Accessing a specific ID of the serial port server will be redirected to the serial port device of the specific physical target board.

[0038] Install the virtual serial port driver on the working node of the cloud environment, create a virtual serial port device, synchronize the virtual serial port device to the serial port server, and the server maintains the correspondence between the virtual serial port device and the physical target board ID.

[0039] Serial port servers and virtual serial port drivers can be implemented with the help of existing tools, such as NPort.

[0040] On the working node, map the virtual serial port device to the IDE container so that the IDE can access the physical target board through the virtual serial port device. For example, in a docker container, you can use the --device-cgroup-rule='c 188:*rmw' startup parameter to map a group of qualified devices to the container and grant the processes in the container read (r), write (w), and mknod (m) permissions.

[0041] Implement the serial communication protocol inside the IDE container and add a serial terminal to facilitate users to configure serial port parameters, send and echo data. Use the serial terminal to send data to the virtual serial port device, and the data is forwarded to the serial port server through the virtual serial port driver. Then, by retrieving the correspondence between the virtual serial port device and the physical target board ID, the data is forwarded to the serial port device of the physical target board.

[0042] The above is only a specific implementation of the present disclosure, but the protection scope of the present disclosure is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present disclosure should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.

Claims

1. A method for serial communication between an IDE container and a physical target machine, characterized in that: Used to realize serial port communication between the container and the target board in the cloud platform, and load or debug the program on the target board; the communication method includes: constructing a virtual serial port device on the IDE container host, and establishing a corresponding relationship between the virtual serial port device and the serial port device of the physical target machine; mapping the virtual serial port device of the host machine to the IDE container, so that the container can send and receive data to the virtual serial port device; The IDE container communicates with the physical target board based on a virtual serial port device.

2. The method for serial communication between an IDE container and a physical target machine according to claim 1, characterized in that: The specific corresponding relationship is: multiple virtual serial port devices are established on the host machine, and each IDE container is connected to the target board through the virtual serial port device.

3. The method for serial communication between an IDE container and a physical target machine according to claim 2, characterized in that: The correspondence is maintained via a list or a file.

4. The method for serial communication between an IDE container and a physical target machine according to claim 3, characterized in that: A plurality of ports are arranged on the server at the management side of the target board, and each port is connected to a target board.

5. The method for serial communication between an IDE container and a physical target machine according to claim 4, characterized in that: The host creates a virtual device, requests the intranet IP of each port on the server, establishes a mapping relationship between the virtual device and the intranet IP of each port on the server, and stores and maintains the mapping relationship in the form of a local file.

6. The method for serial communication between an IDE container and a physical target machine according to claim 5, characterized in that: When the host machine performs serial communication with the target board, the serial communication data is encapsulated into an IP data packet to implement IP-based serial communication.

7. The method for serial communication between an IDE container and a physical target machine according to claim 6, characterized in that: The host machine is a working node in the cloud environment. A virtual serial port driver is installed on the host machine to create a virtual serial port device, synchronize the virtual serial port device to the server, and maintain the corresponding relationship between the virtual serial port device and the server port through a local configuration file.

8. The method for serial communication between an IDE container and a physical target machine according to claim 1, characterized in that: On the host machine, map the virtual serial port device to the IDE container so that the IDE can access the physical target board through the virtual serial port device.

9. The method for serial communication between an IDE container and a physical target machine according to claim 8, characterized in that: The container is a docker container, and the --device-cgroup-rule='c 188:*rmw' startup parameter is used to map a group of qualified virtual serial port devices into the container, and the processes in the container are given read, write and mknod permissions.

10. The method for serial communication between an IDE container and a physical target machine according to claim 9, characterized in that: Implement the serial port communication protocol inside the IDE container and add a serial port terminal. The serial port terminal user configures serial port parameters, sends and echoes data. The user uses the serial port terminal to send data to the virtual serial port device. The data is forwarded to the server through the virtual serial port driver, and then the data is forwarded to the serial port device of the physical target board by retrieving the correspondence between the virtual serial port device and the physical target board ID.

Citation Information

Patent Citations

  • Onboard embedded computer data loading method

    CN102495746A

  • Equipment commissioning and testing method and device

    CN113094253A

  • Micro-service application cross-network communication method, device, system and equipment

    CN113301116A

  • Server system and container setting method and device

    CN114327741A

  • Server system, and container setting method and apparatus

    WO2022068753A1