Embedded software debugging method and device, electronic equipment and storage medium
By establishing a wireless network communication connection on the microcontroller unit in the vehicle, receiving and analyzing debugging requests, and transmitting debugging protocol command messages, the problem of embedded software debugging caused by complex and changeable external environment is solved, and efficient remote-end embedded software debugging is achieved.
Patent Information
- Application Number
- CN202411453980.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-17
- Publication Date
- 2025-02-28
AI Technical Summary
In the prior art, due to the complexity and change of the external environment, it is impossible to debug the embedded software of the microcontroller unit in the vehicle.
Establish a communication connection with the debugging device through the wireless network, receive debugging requests sent by the debugging device, parse and transmit debugging protocol command messages to the microcontroller unit, and realize debugging of embedded software.
This enables debuggers to debug embedded software directly through debugging devices at the remote end, avoiding external environment restrictions and improving debugging efficiency.
Smart Images

Figure 00000000_0000_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of vehicle control technology, and in particular to an embedded software debugging method, device, electronic device and storage medium. Background Art
[0002] As the electronic and electrical architecture of the vehicle is developing towards distributed control, regional control, and central control, the business functions that various microcontroller units (MCUs) in the vehicle body need to carry are becoming more and more complex, and the technical difficulty involved in software development and debugging is also increasing. In order to ensure the normal operation of related functions of the vehicle, the quality, safety and stability requirements of the embedded software running on the MCU are also increasing.
[0003] Embedded software development cannot be completed overnight. Due to the negligence of developers or inadequate demand analysis, many problems that affect the normal function of embedded software will be hidden in the embedded software. In actual embedded software testing, embedded software debugging is not only to find the logic problems of its own software, but also to verify whether there are problems with the related hardware design through code-assisted analysis. It can be seen from the above that embedded software debugging is not only a very important method and way to discover and solve hidden problems in embedded software, but also an important factor affecting whether the embedded software can achieve the required quality, safety and stability target level. Therefore, embedded software debugging becomes extremely important in the development process of the entire project. It exists not only in the MCU project development and testing stage, but also in the whole vehicle joint testing stage.
[0004] However, at present, whether in a real environment or in a joint test environment, the external environment of the MCU is usually complex and changeable. These complex and changeable external factors are usually the direct cause of discovering hidden problems in embedded software systems. Therefore, when problems occur in the operation of embedded system equipment, ensuring that it does not deviate from the current external environment is an important factor affecting whether the embedded software debugging process can quickly and accurately find the root cause of the problem. However, in related technologies, in a complex and changeable external environment, it is impossible to debug the embedded software due to the limitations of the external environment. Summary of the invention
[0005] In view of this, the embodiments of the present application provide an embedded software debugging method, device, electronic device and storage medium to solve the problem in the prior art that the embedded software of the microcontroller unit in the vehicle cannot be debugged due to external environmental limitations.
[0006] In a first aspect of an embodiment of the present application, a method for debugging embedded software is provided, the method comprising: establishing a communication connection with a debugging device via a wireless network, wherein the embedded software to be debugged is arranged in a microcontroller unit; receiving a debugging request for the embedded software sent by the debugging device, parsing the debugging request, and obtaining a debugging protocol instruction message; transmitting the debugging protocol instruction message to the microcontroller unit to debug the embedded software.
[0007] According to a second aspect of an embodiment of the present application, an embedded software debugging device is provided, which includes: a connection module, which is used to establish a communication connection with a debugging device through a wireless network when the embedded software debugging device is connected to a microcontroller unit of a vehicle, and the embedded software to be debugged is set in the microcontroller unit; a parsing module, which is used to receive a debugging request for the embedded software sent by the debugging device, parse the debugging request, and obtain a debugging protocol instruction message; and a debugging module, which is used to transmit the debugging protocol instruction message to the microcontroller unit to debug the embedded software.
[0008] According to a third aspect of an embodiment of the present application, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.
[0009] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, which stores a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.
[0010] Compared with the prior art, the embodiments of the present application have the following beneficial effects: when the debugging device is connected to the microcontroller unit of the vehicle, the method in the embodiments of the present application establishes a communication connection with the debugging device through a wireless network, and the embedded software to be debugged is set in the microcontroller unit; a debugging request for the embedded software sent by the debugging device is received, the debugging request is parsed, and a debugging protocol instruction message is obtained; the debugging protocol instruction message is transmitted to the microcontroller unit to debug the embedded software. The above method enables the debugging personnel to directly send the debugging request to the debugging device through the debugging device at the remote end to debug the embedded software, without being restricted by the environment in which the microcontroller unit of the vehicle is located, so that the debugging of the embedded software in the microcontroller unit is no longer restricted by the environment, and the debugging efficiency of the embedded software in the microcontroller unit of the vehicle is improved, avoiding the problem in the prior art that the embedded software of the microcontroller unit in the vehicle cannot be debugged due to external environmental restrictions. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0012] Figure 1 It is a flowchart of an embedded software debugging method provided by an embodiment of the present application;
[0013] Figure 2 It is a basic schematic diagram of a debugging device provided in an embodiment of the present application;
[0014] Figure 3 It is a flowchart of another embedded software debugging method provided by an embodiment of the present application;
[0015] Figure 4 It is a flowchart of another embedded software debugging method provided in an embodiment of the present application;
[0016] Figure 5 It is a flowchart of another embedded software debugging method provided by an embodiment of the present application;
[0017] Figure 6 It is a flowchart of another embedded software debugging method provided in an embodiment of the present application;
[0018] Figure 7 It is a flowchart of another optional embedded software debugging method provided in an embodiment of the present application;
[0019] Figure 8 It is a flowchart of another optional embedded software debugging method provided in an embodiment of the present application;
[0020] Fig. 9 It is a flowchart of another optional embedded software debugging method provided in an embodiment of the present application;
[0021] Fig.10 It is a structural diagram of an embedded software debugging device provided in an embodiment of the present application;
[0022] Fig.11 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0023] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0024] An embedded software debugging method and device according to an embodiment of the present application will be described in detail below with reference to the accompanying drawings.
[0025] Figure 1 This is an embedded software debugging method provided by an embodiment of the present application, such as Figure 1 As shown, the method includes:
[0026] S101, when the debugging device is connected to a microcontroller unit of a vehicle, establishing a communication connection with the debugging device through a wireless network, wherein the microcontroller unit is provided with embedded software to be debugged;
[0027] S102, receiving a debugging request for embedded software sent by a debugging device, parsing the debugging request, and obtaining a debugging protocol instruction message;
[0028] S103, transmitting the debugging protocol instruction message to the microcontroller unit to debug the embedded software.
[0029] It can be understood that the embedded software debugging method provided in this example is applied to a debugging device, which can be communicatively connected to a microcontroller unit of a vehicle. The debugging device can also be connected to a debugging device via a wireless network. The debugging device is used to receive user instructions and generate specific debugging requests based on the user's instructions.
[0030] The debugging device is connected to the debugging equipment via a wireless network, and the wireless network includes but is not limited to at least one of 3G (third generation mobile communication technology), 4G (fourth generation mobile communication technology), 5G (fifth generation mobile communication technology), and WI FI. Figure 2 As shown, a 4 / 5G module is provided in the debugging device. The debugging device is connected to the cellular network of a nearby base station in the form of dial-up Internet access through the internal 4 / 5G module. The base station dynamically allocates an IP address to the debugging device, and finally indirectly connects and communicates with the Internet or other debugging devices in the wide area network through the base station cellular network. For example, Figure 2As shown, a WI FI module is provided in the debugging device, and the WI FI module realizes the WI FI network connection with the nearby wireless router in STAT ION mode, and the wireless router dynamically allocates an IP, and finally indirectly realizes the connection and communication with the Internet or other debugging devices in the wide area network through the WAN port network of the wireless router. The above two wireless area network connection methods can enable the debugging device to connect to the Internet and have the ability to communicate data or access each other with external devices.
[0031] It is understandable that in the Internet world, intranet devices can communicate and access each other with external network servers, but an intranet device cannot communicate directly with other intranet devices. In this way, it is necessary to use an external network designated server to realize the forwarding function of communication data between devices in different intranets, which involves the forwarding of request or response information between devices. In order for the external network server to forward information, it is necessary to realize the port mapping of the intranet device. In some examples, by building a peanut shell device into the debugging device, the port mapping of the external network designated server to the debugging device port is realized, and then the intranet penetration function of the debugging device is realized, and finally the remote debugging device can realize remote communication access with any debugging device under the intranet through the Internet. In embedded debugging, when the debugging device sends a debugging request to the debugging device, the debugging request is sent to the external network designated server through the network to which the debugging device is connected. The designated server then forwards the debugging request to the debugging device under the intranet through port mapping. The forwarding path can be realized through any of the 3g, 4g, and 5g wireless networks. When the debugging device sends data to the debugging equipment, the data is also transmitted to the designated server in the external network through any of the 3G, 4G, and 5G wireless networks, and the designated server in the external network then forwards it to the debugging device for display.
[0032] It can be understood that the debugging device is connected to the microcontroller unit of the vehicle, thereby realizing the debugging of the embedded software in the microcontroller unit. The above-mentioned vehicles include vehicles with automatic driving or intelligent driving (including vehicles with manned functions (such as cars, buses, large buses, minibuses, etc.), vehicles with cargo functions (such as ordinary trucks, vans, trailers, closed trucks, tank trucks, flatbed trucks, container trucks, dump trucks, trucks with special structures), special vehicles (such as logistics distribution vehicles, automatic guided transport vehicles AGV, patrol cars, cranes, cranes, excavators, bulldozers, forklifts, rollers, loaders, off-road engineering vehicles, armored engineering vehicles, sewage treatment vehicles, sanitation vehicles, vacuum trucks, floor washing vehicles, sprinkler trucks, sweeping robots, food delivery robots, shopping guide robots, lawn mowers, golf carts, etc.), vehicles with entertainment functions (such as entertainment vehicles, amusement park automatic driving devices, balance cars, etc.), rescue vehicles (such as fire trucks, ambulances, power repair vehicles, engineering rescue vehicles, etc.)), etc.
[0033] It can be understood that when it is necessary to debug the embedded software in the vehicle's microcontroller unit, the relevant personnel connect the debugging device to the vehicle's microcontroller unit, and then the debugging device establishes a communication connection with the debugging equipment through a wireless network. The subsequent debugging personnel can directly send debugging requests through the debugging equipment at the remote end to debug the embedded software without being restricted by the environment in which the vehicle's microcontroller unit is located.
[0034] Specifically, the debugging apparatus receives a debugging request for embedded software sent by a debugging device, parses the debugging request, and obtains a debugging protocol instruction message; transmits the debugging protocol instruction message to a microcontroller unit to debug the embedded software.
[0035] According to the technical solution provided in the embodiment of the present application, when the debugging device is connected to the microcontroller unit of the vehicle, a communication connection is established with the debugging device through a wireless network, and the embedded software to be debugged is set in the microcontroller unit; a debugging request for the embedded software sent by the debugging device is received, the debugging request is parsed, and a debugging protocol instruction message is obtained; the debugging protocol instruction message is transmitted to the microcontroller unit to debug the embedded software. The above method enables the debugging personnel to directly send the debugging request to the debugging device through the debugging device at the remote end to debug the embedded software without being restricted by the environment in which the microcontroller unit of the vehicle is located, so that the debugging of the embedded software in the microcontroller unit is no longer restricted by the environment, and the debugging efficiency of the embedded software in the microcontroller unit of the vehicle is improved, avoiding the problem in the prior art that the embedded software of the microcontroller unit in the vehicle cannot be debugged due to external environmental restrictions.
[0036] In some embodiments, Figure 2 As shown, a debugging server is provided in the debugging device, and a debugging client is provided in the debugging device, such as Figure 3 As shown, a debugging request for embedded software sent by a debugging device is received, and the debugging request is parsed to obtain a debugging protocol instruction message, including:
[0037] S301, receiving a debugging request transmitted by a user through a debugging client, and parsing the debugging request to obtain an initial debugging protocol instruction message;
[0038] S302: Acquire configuration information of the microcontroller unit, and perform adaptation processing on the initial debugging protocol instruction message according to the configuration information of the microcontroller unit to obtain a debugging protocol instruction message.
[0039] It can be understood that the debugging device is installed with an operating system, and the above-mentioned debugging client is installed on the operating system of the debugging device. The debugging client can provide an interactive interface for embedded software development or debugging, and embedded software developers can observe or adjust the running status of embedded software on the microcontroller unit through the interactive interface. Similarly, the debugging device is installed with an operating system, and a debugging server is set in the operating system. The debugging server can receive the debugging request transmitted by the user through the debugging client, and parse the debugging request to obtain the initial debugging protocol instruction message.
[0040] Exemplarily, the operating system installed in the debugging device is Ubuntu, and the debugging client installed on Ubuntu is GDB client. The user can set debugging startup, set breakpoints, view variables, and execute code step by step through the GDB client. Correspondingly, the operating system installed in the debugging device is a miniaturized embedded system of Linux, and a debugging server GDB server is installed on the miniaturized embedded system of Linux. The GDB server can accept the debugging request transmitted by the user through the GDB client, and parse the debugging request to obtain the initial debugging protocol instruction message. In some examples, OpenOCD is installed in the debugging device, and the above-mentioned GDB server is installed through the OpenOCD, such as Figure 2 shown.
[0041] It is understandable that the debugging client will generate a debugging request based on the debugging operations set by the client, such as debugging startup, setting breakpoints, viewing variables, and single-stepping code, and send the debugging request to the debugging server. After receiving the debugging request, the debugging server will parse the debugging request and obtain the initial debugging protocol instruction message corresponding to each debugging operation. Among them, in order to accurately debug the embedded software in the microcontroller unit, the debugging server will adapt the initial debugging protocol instruction message according to the configuration information of the microcontroller unit to obtain the debugging protocol instruction message.
[0042] Exemplarily, after parsing and obtaining the initial debugging protocol instruction message corresponding to debugging operations such as debugging startup, setting breakpoints, viewing variables, and single-stepping code, the GDB server will determine the initial debugging protocol instruction message that can be applied to the microcontroller unit according to the hardware configuration of the microcontroller unit, and parse the initial debugging protocol instruction message applicable to the microcontroller unit into a debugging protocol instruction message that conforms to the specific hardware configuration. For example, different hardware may have different register layouts, instruction sets, etc. The Gdb Server needs to adapt the initial debugging protocol instruction message so that the obtained debugging protocol instruction message conforms to the hardware configuration of the microcontroller unit, and the microcontroller unit can correctly interpret and execute the debugging protocol instruction message when it receives it.
[0043] In some examples, after receiving a debugging request and parsing the debugging request to obtain the initial debugging protocol instruction message corresponding to the debugging operation, the debugging server will also determine the debugging operations it supports, and jointly determine the debugging protocol instruction message based on the debugging operations it supports and the hardware configuration of the microcontroller unit. For example, after receiving a debugging request and parsing the debugging request to obtain the initial debugging protocol instruction message corresponding to the A, B, and C debugging operations, and the debugging server determines that it supports the A and B debugging operations, the initial debugging protocol instruction message corresponding to the A and B debugging operations is converted into a debugging protocol instruction message supported by the microcontroller unit.
[0044] According to the technical solution provided in the embodiment of the present application, a debugging request transmitted by a user through a debugging client is received, and the debugging request is parsed to obtain an initial debugging protocol instruction message; the configuration information of the microcontroller unit is obtained, and the initial debugging protocol instruction message is adapted and processed according to the configuration information of the microcontroller unit to obtain a debugging protocol instruction message, so that the embedded software of the microcontroller unit can be debugged subsequently according to the debugging protocol instruction message, thereby avoiding the problem that the microcontroller unit does not support the debugging protocol instruction message, resulting in the failure of debugging the embedded software.
[0045] In some embodiments, the number of microcontroller units is multiple, such as Figure 4 As shown, the configuration information of the microcontroller unit is obtained, and the initial debugging protocol instruction message is adapted and processed according to the configuration information of the microcontroller unit to obtain the debugging protocol instruction message, including:
[0046] S401, respectively obtain configuration information of each microcontroller unit;
[0047] S402: Adapt the initial debugging protocol instruction according to the configuration information of each microcontroller unit to obtain the debugging protocol instruction message corresponding to each microcontroller unit.
[0048] Specifically, the debugging device can be connected to multiple microcontroller units at the same time, and each microcontroller unit is provided with corresponding embedded software to be debugged; wherein, in order to realize the adjustment of embedded software in multiple microcontroller units at the same time, in the method provided in this example, the debugging server will obtain the configuration information of each microcontroller unit.
[0049] Then, the initial debugging protocol instruction is adapted and processed according to the configuration information of each microcontroller unit to obtain the debugging protocol instruction message corresponding to each microcontroller unit.
[0050] Exemplarily, the debugging device is connected to microcontroller units A, B, C...N, then the debugging server in the debugging device obtains the configuration information of microcontroller units A, B, C...N respectively, and then adapts the initial debugging protocol instructions according to the configuration information of microcontroller unit A to obtain a debugging protocol instruction message corresponding to microcontroller unit A; adapts the initial debugging protocol instructions according to the configuration information of microcontroller unit A to obtain a debugging protocol instruction message corresponding to microcontroller unit A; adapts the initial debugging protocol instructions according to the configuration information of microcontroller unit B to obtain a debugging protocol instruction message corresponding to microcontroller unit B; adapts the initial debugging protocol instructions according to the configuration information of microcontroller unit C to obtain a debugging protocol instruction message corresponding to microcontroller unit C... adapts the initial debugging protocol instructions according to the configuration information of microcontroller unit N to obtain a debugging protocol instruction message corresponding to microcontroller unit N.
[0051] According to the technical solution provided in the embodiment of the present application, the configuration information of each microcontroller unit is obtained respectively; the initial debugging protocol instruction is adapted and processed according to the configuration information of each microcontroller unit to obtain the debugging protocol instruction message corresponding to each microcontroller unit, so that the debugging server can debug the embedded software in each microcontroller unit according to the debugging protocol instruction message corresponding to each microcontroller unit, thereby improving the debugging efficiency of the embedded software and avoiding the problem that the microcontroller unit does not support the debugging protocol instruction message, resulting in the failure of debugging the embedded software.
[0052] In some embodiments, Figure 5 As shown, after establishing a communication connection with the debugging device through a wireless network, the method further includes:
[0053] S501, receiving identity authentication information sent by a debugging device, where the identity authentication information is determined based on identification information of a vehicle;
[0054] S502: Transmit the identity authentication information to the microcontroller unit to authenticate the debugging device and determine whether the debugging device is an authorized device.
[0055] Specifically, since the method provided in this example is used to debug the embedded software of the microcontroller unit installed in the vehicle, in order to avoid malicious devices from maliciously debugging the embedded software, causing problems such as embedded software crashes, exceptions, and implantation of malicious code, this example also requires identity authentication of the debugging device.
[0056] In this example, the debugging device receives identity authentication information sent by the debugging equipment, and the identity authentication information is determined based on the identification information of the vehicle. The identity authentication information is transmitted to the microcontroller unit to authenticate the debugging device and determine whether the debugging device is an authorized device. If the debugging device is an authorized device, it indicates that the debugging device is qualified to debug the embedded software of the microcontroller unit on the vehicle, and will subsequently receive debugging requests for the embedded software sent by the debugging device; if the debugging device is not an authorized device, it indicates that the debugging device is not qualified to debug the embedded software of the microcontroller unit on the vehicle, and the subsequent debugging device will not receive debugging requests for the embedded software sent by the debugging device, thereby ensuring the security of the embedded software and further ensuring the safety of the vehicle.
[0057] According to the technical solution provided in the embodiment of the present application, identity authentication information sent by the debugging device is received, and the identity authentication information is determined based on the identification information of the vehicle; the identity authentication information is transmitted to the microcontroller unit to authenticate the debugging device and determine whether the debugging device is an authorized device. Subsequently, only authorized devices can debug the embedded software, and unauthorized devices cannot authenticate the debugging device. This method ensures the security of the embedded software, thereby ensuring the safety of the vehicle and avoiding debugging of the embedded software by malicious devices.
[0058] In some embodiments, a first debugging interface is provided on the debugging device, and the first debugging interface is used to establish a connection between the debugging device and the hardware emulator. The hardware emulator is provided with at least one second debugging interface, and the second debugging interface is used to connect the hardware emulator to the microcontroller unit.
[0059] It can be understood that the above-mentioned first debugging interface includes but is not limited to a Universal Serial Bus (USB) interface. Exemplarily, the debugging device provided in the present application establishes a connection with the hardware emulator via the USB interface; the above-mentioned second debugging interface includes but is not limited to a JTAG (Join Test Action Group) interface and a SW (Serial Wire) interface. Exemplarily, the hardware emulator provided in the present application is connected to the microcontroller via the JTAG interface; it can be understood that the hardware emulator provided in the present application is provided with at least one second debugging interface. When two or more second debugging interfaces are provided on the hardware emulator, the hardware emulator can be connected to different microcontrollers through different second debugging interfaces.
[0060] In some examples, such as Figure 6 As shown, the method provided by the present application also includes:
[0061] S601, obtaining the connection status between the debugging device and the hardware emulator, and obtaining the connection status between the hardware emulator and the microcontroller unit;
[0062] S602: If the connection status between the debugging device and the hardware emulator indicates that the debugging device and the hardware emulator are successfully connected, and the connection status between the hardware emulator and the microcontroller unit indicates that the hardware emulator and the microcontroller unit are successfully connected, determine that the debugging device and the microcontroller unit are successfully connected.
[0063] In the solution provided in this example, the debugging device is connected to the microcontroller unit through a hardware emulator, such as Figure 2 As shown, the debugging device obtains the connection status between itself and the hardware emulator, and obtains the connection status between the hardware emulator and the microcontroller unit; if the connection status between the debugging device and the hardware emulator indicates that the debugging device and the hardware emulator are successfully connected, and the connection status between the hardware emulator and the microcontroller unit indicates that the hardware emulator and the microcontroller unit are successfully connected, then it is determined that the debugging device and the microcontroller unit are successfully connected; if the connection status between the debugging device and the hardware emulator indicates that the debugging device and the hardware emulator fail to connect, or the connection status between the hardware emulator and the microcontroller unit indicates that the hardware emulator and the microcontroller unit fail to connect, then it is determined that the debugging device and the microcontroller unit fail to connect.
[0064] In some examples, a USB interface is provided on the debugging device, and the debugging device is connected to the hardware emulator by a USB cable; in some examples, a SW interface and a Jtag interface are provided on the hardware emulator, and the hardware emulator is connected to the microcontroller unit by a SW interface or a Jtag interface; wherein the hardware emulator serves as a hardware interface specification level converter for the debugging protocol instruction message. First, the debugging server transmits the debugging protocol instruction message to the hardware emulator through the USB port. Then the hardware emulator converts the debugging protocol instruction message into the level information of the communication link layer as the Sw or Jtag interface, and then transmits it to the microcontroller unit. Finally, the microcontroller unit executes the received debugging protocol instruction message, which plays a role in debugging the embedded software.
[0065] According to the technical solution provided in the embodiment of the present application, the connection status between the debugging device and the hardware emulator is obtained, and the connection status between the hardware emulator and the microcontroller unit is obtained; if the connection status between the debugging device and the hardware emulator indicates that the debugging device and the hardware emulator are successfully connected, and the connection status between the hardware emulator and the microcontroller unit indicates that the hardware emulator and the microcontroller unit are successfully connected, then it is determined that the debugging device and the microcontroller unit are successfully connected. The method determines whether the debugging device is successfully connected to the microcontroller unit by respectively obtaining the connection status between the debugging device and the hardware emulator, and the connection status between the hardware emulator and the microcontroller unit, thereby accurately obtaining the connection status between the debugging device and the microcontroller unit.
[0066] In some embodiments, Figure 7 As shown, the method also includes:
[0067] S701, receiving a response message for a debugging protocol instruction message returned by the embedded software;
[0068] S702: Convert the response message into response information supported by the debugging device, and send the response information to the debugging device through the wireless network.
[0069] Specifically, during the debugging process, the embedded software will return a response message to the debugging protocol instruction message. Similarly, when the debugging device (the debugging server in the debugging device) receives the response message, it will convert the response message into response information supported by the debugging device, and send the response information to the debugging device (the debugging client in the debugging device) via the wireless network, so that relevant personnel can know the debugging results of the embedded software.
[0070] It can be understood that when the debugging device is connected to the microcontroller unit through the hardware emulator, when the embedded software returns a response message, the response message is first transmitted to the hardware emulator through the Sw or Jtag interface of the microcontroller unit. The hardware emulator converts the response message into USB interface level information, and then transmits it to the debugging server. Finally, the debugging server converts the data through GDB_Server, and then transmits it to the Internet through the WI FI module or 4 / 5G module, and then forwards it to the debugging device that performs debugging through the server on the Internet, and finally realizes the execution and response process of debugging operations such as debugging startup, setting breakpoints, viewing variables, and single-step code execution.
[0071] According to the technical solution provided in the embodiment of the present application, a response message returned by the embedded software in response to the debugging protocol instruction message is received; the response message is converted into response information supported by the debugging device, and the response information is sent to the debugging device via a wireless network, thereby realizing the sending of the debugging results of the embedded software to the debugging device.
[0072] In some embodiments, Figure 8 As shown, after the debugging protocol instruction message is transmitted to the microcontroller unit and the embedded software is debugged, the method further includes:
[0073] S801: If the embedded software is abnormal, receiving a target replacement version for the embedded software sent by a debugging device;
[0074] S802: Transmit the target replacement version to the microcontroller unit to update the embedded software.
[0075] Specifically, when the debugging device determines that there is an abnormality in the embedded software based on the response information returned by the embedded software, in order to ensure the normal use of the vehicle, the debugging device will determine the target replacement version of the embedded software. The target replacement version may be a historical version of the embedded software, or the next version of the embedded software. This example does not limit this.
[0076] After receiving the target replacement version sent by the debugging device, the debugging apparatus transmits the target replacement version to the microcontroller unit and updates the embedded software so that the embedded software is adjusted to the target replacement version to ensure the normal use of the vehicle.
[0077] In order to better understand the present method, this embodiment provides a more specific example for illustration. Fig. 9As shown, the method provided in this example connects the debugging device to the designated server of the external network, and the designated server of the external network can be connected to the debugging device through the cellular network and / or WiFi network, and the debugging device is connected to the microcontroller unit through the hardware emulator; compared with the wired connection between the debugging device and the debugging device, the wireless Internet connection with the intranet penetration access function between the two can completely solve the drawbacks of software debugging caused by the changeable external environment in the traditional method. The embedded software system design can better facilitate the solution of on-site problems and promote the progress of project development.
[0078] According to the technical solution provided in the embodiment of the present application, if there is an abnormality in the embedded software, a target replacement version for the embedded software sent by the debugging device is received; the target replacement version is transmitted to the microcontroller unit, and the embedded software is updated so that the embedded software is adjusted to the target replacement version, thereby ensuring the normal use of the vehicle and avoiding abnormalities in the embedded software that may cause safety problems in the vehicle.
[0079] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present application, which will not be described one by one here.
[0080] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.
[0081] This embodiment also provides an embedded software debugging device, such as Fig.10 As shown, the device comprises:
[0082] A connection module 1001 is used to establish a communication connection with the debugging device through a wireless network when the embedded software debugging device is connected to a microcontroller unit of a vehicle, and the embedded software to be debugged is set in the microcontroller unit;
[0083] The parsing module 1002 is used to receive a debugging request for embedded software sent by a debugging device, parse the debugging request, and obtain a debugging protocol instruction message;
[0084] The debugging module 1003 is used to transmit the debugging protocol instruction message to the microcontroller unit to debug the embedded software.
[0085] In some examples, a debugging server is provided in the debugging device, and a debugging client is provided in the debugging device; the parsing module 1002 is also used to receive a debugging request transmitted by the user through the debugging client, and parse the debugging request to obtain an initial debugging protocol instruction message; obtain the configuration information of the microcontroller unit, and adapt the initial debugging protocol instruction message according to the configuration information of the microcontroller unit to obtain a debugging protocol instruction message.
[0086] In some examples, there are multiple microcontroller units, and configuration information of the microcontroller units is obtained. The parsing module 1002 is also used to obtain the configuration information of each microcontroller unit separately; the initial debugging protocol instructions are adapted according to the configuration information of each microcontroller unit to obtain the debugging protocol instruction message corresponding to each microcontroller unit.
[0087] In some examples, the connection module 1001 is also used to receive identity authentication information sent by the debugging device, where the identity authentication information is determined based on the identification information of the vehicle; the identity authentication information is transmitted to the microcontroller unit to authenticate the debugging device and determine whether the debugging device is an authorized device.
[0088] In some examples, the connection module 1001 is also used to obtain the connection status between the debugging device and the hardware emulator, and to obtain the connection status between the hardware emulator and the microcontroller unit; if the connection status between the debugging device and the hardware emulator indicates that the debugging device and the hardware emulator are successfully connected, and the connection status between the hardware emulator and the microcontroller unit indicates that the hardware emulator and the microcontroller unit are successfully connected, then it is determined that the debugging device and the microcontroller unit are successfully connected.
[0089] In some examples, the debugging module 1003 is also used to receive a response message returned by the embedded software to the debugging protocol instruction message; convert the response message into response information supported by the debugging device, and send the response information to the debugging device via a wireless network.
[0090] In some examples, the debugging module 1003 is also used to receive a target replacement version for the embedded software sent by a debugging device if an abnormality exists in the embedded software; transmit the target replacement version to the microcontroller unit to update the embedded software.
[0091] According to the technical solution provided in the embodiment of the present application, the embedded software debugging device provided in the present embodiment establishes a communication connection with the debugging device through a wireless network when the debugging device is connected to the microcontroller unit of the vehicle, and the embedded software to be debugged is set in the microcontroller unit; receives a debugging request for the embedded software sent by the debugging device, parses the debugging request, and obtains a debugging protocol instruction message; transmits the debugging protocol instruction message to the microcontroller unit to debug the embedded software. The above method enables the debugging personnel to directly send the debugging request to the debugging device through the debugging device at the remote end to debug the embedded software, without being restricted by the environment in which the microcontroller unit of the vehicle is located, so that the debugging of the embedded software in the microcontroller unit is no longer restricted by the environment, and improves the debugging efficiency of the embedded software in the microcontroller unit of the vehicle, avoiding the problem in the prior art that the embedded software of the microcontroller unit in the vehicle cannot be debugged due to external environmental restrictions.
[0092] Fig.11 Schematic diagram of an electronic device 11 provided in an embodiment of the present application. Fig.11 As shown, the electronic device 11 of this embodiment includes: a processor 1101, a memory 1102, and a computer program 1103 stored in the memory 1102 and executable on the processor 1101. When the processor 1101 executes the computer program 1103, the steps in the above-mentioned method embodiments are implemented. Alternatively, when the processor 1101 executes the computer program 1103, the functions of the modules / units in the above-mentioned device embodiments are implemented.
[0093] The electronic device 11 may be a desktop computer, a notebook, a PDA, a cloud server, or other electronic device. The electronic device 11 may include, but is not limited to, a processor 1101 and a memory 1102. Those skilled in the art will appreciate that Fig.11 The electronic device 11 is merely an example and does not limit the electronic device 11 , and may include more or fewer components than those shown in the figure, or different components.
[0094] The processor 1101 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
[0095] The memory 1102 may be an internal storage unit of the electronic device 11, for example, a hard disk or memory of the electronic device 11. The memory 1102 may also be an external storage device of the electronic device 11, for example, a plug-in hard disk, a smart memory card (Smart Med ia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device 11. The memory 1102 may also include both an internal storage unit of the electronic device 11 and an external storage device. The memory 1102 is used to store computer programs and other programs and data required by the electronic device.
[0096] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units.
[0097] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. The computer program may include computer program code, and the computer program code may be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of regional requirements and patent practice. For example, in some areas, according to regional requirements and patent practice, the computer-readable medium does not include electric carrier signals and telecommunication signals.
[0098] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. An embedded software debugging method, characterized in that: The embedded software debugging method is applied to a debugging device, and the method comprises: In the case where the debugging device is connected to a microcontroller unit of a vehicle, a communication connection is established with the debugging device via a wireless network, wherein the microcontroller unit has embedded software to be debugged; Receiving a debugging request for the embedded software sent by the debugging device, parsing the debugging request, and obtaining a debugging protocol instruction message; The debugging protocol instruction message is transmitted to the microcontroller unit to debug the embedded software.
2. The method according to claim 1, characterized in that The debugging device is provided with a debugging server, and the debugging equipment is provided with a debugging client; Receiving a debugging request for the embedded software sent by the debugging device, parsing the debugging request, and obtaining a debugging protocol instruction message, including: Receiving the debugging request transmitted by the user through the debugging client, and parsing the debugging request to obtain an initial debugging protocol instruction message; The configuration information of the microcontroller unit is acquired, and the initial debugging protocol instruction message is adapted and processed according to the configuration information of the microcontroller unit to obtain the debugging protocol instruction message.
3. The method according to claim 2, characterized in that The number of the microcontroller units is multiple, and the configuration information of the microcontroller units is obtained, and the initial debugging protocol instruction message is adapted according to the configuration information of the microcontroller units to obtain the debugging protocol instruction message, including: Respectively obtaining configuration information of each of the microcontroller units; The initial debugging protocol instruction is adapted and processed according to the configuration information of each microcontroller unit to obtain the debugging protocol instruction message corresponding to each microcontroller unit.
4. The method according to claim 1, characterized in that: After establishing a communication connection with the debugging device through the wireless network, the method further includes: Receiving identity authentication information sent by the debugging device, wherein the identity authentication information is determined based on the identification information of the vehicle; The identity authentication information is transmitted to the microcontroller unit to authenticate the debugging device and determine whether the debugging device is an authorized device.
5. The method according to claim 1, characterized in that The debugging device is provided with a first debugging interface, which is used for the debugging device to establish a connection with a hardware emulator. The hardware emulator is provided with at least one second debugging interface, which is used for the hardware emulator to connect with the microcontroller unit.
6. The method according to claim 1, characterized in that The method further comprises: Receiving a response message returned by the embedded software in response to the debugging protocol instruction message; The response message is converted into response information supported by the debugging device, and the response information is sent to the debugging device via a wireless network.
7. The method according to claim 6, characterized in that Afterwards, the method further comprises: If the embedded software is abnormal, receiving a target replacement version for the embedded software sent by the debugging device; The target replacement version is transmitted to the microcontroller unit to update the embedded software.
8. An embedded software debugging device, characterized in that: The device comprises: a connection module, used to establish a communication connection with a debugging device through a wireless network when the embedded software debugging device is connected to a microcontroller unit of a vehicle, wherein the embedded software to be debugged is arranged in the microcontroller unit; A parsing module, used for receiving a debugging request for the embedded software sent by the debugging device, parsing the debugging request, and obtaining a debugging protocol instruction message; The debugging module is used to transmit the debugging protocol instruction message to the microcontroller unit to debug the embedded software.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.