On-line repair method for trip computer software fault and storage medium
By using the enable register and memory drive to directly modify the fault code snippet in memory without shutting down, the problem of slow fault repair speed of driving computer software in the prior art is solved, and a fast and online fault repair effect is achieved.
Patent Information
- Application Number
- CN202411369935.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-29
- Publication Date
- 2025-02-18
AI Technical Summary
It is difficult for the existing technology to quickly repair the faults of driving computer software without shutting down. Traditional software repair methods require shutdown download and update, which consumes a lot of time and resources and affects the user experience.
通过定位行车电脑软件的静态代码故障代码片段,修改或重写得到新代码片段,计算编译后的地址段和地址区间,使用使能寄存器和内存驱动器在内存中直接修改故障片段,实现在线修复。
It realizes rapid repair of faults without interrupting the normal operation of the driving computer software, shortening the workload and time required for repair, and improving the user experience.
Smart Images

Figure CN119473368A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of software fault repair, and more specifically, to an on-board computer software fault online repair method and storage medium. Background Art
[0002] With the continuous improvement of automobile electronics, the Electronic Control Unit (ECU), as the core control unit of the vehicle, has a software stability that is crucial to the overall performance of the vehicle. However, during the software operation, software failures (bugs) may occur due to various reasons, which may lead to abnormal vehicle control or even safety accidents.
[0003] Traditional software repair methods usually require downtime to download and update the software, and all of them use offline repair methods. First, the code is modified locally, compiled by the compiler to generate a binary HEX file or BIN file, and then the entire HEX file or BIN file is pushed to the user, or the software fault is repaired by flashing the debugger. However, many times, the fault may be a simple line of code. For this line of code, it takes a lot of time and resources to perform a full or incremental update to iterate a version, which is not conducive to the rapid repair of the fault and greatly affects the user experience. Therefore, it is particularly important to develop a method to quickly repair vehicle computer software faults without stopping the machine.
[0004] In the prior art, the patent document with the authorization announcement number CN111897711B discloses a method, device, electronic device and readable storage medium for locating bugs in code, wherein the target program is repaired based on the bug code, including: after the bug code is repaired to obtain the repair code, the corresponding part of the code of the target program is replaced by the repair code. Replacing the wrong code with the correct code is a common technical means for repairing software faults, but it does not involve technical means for repairing without stopping the system.
[0005] The patent document with application publication number CN113672251A discloses an online update method for the Bootloader program of an on-vehicle ECU, including: S1: in a normal Application program source code project, modify the metadata configuration information of the Application Sector: cancel the Bootloader Sector erase protection in the Flash initialization code, add a reverse burning code module, and generate a burning file of the App_ReverseProg program; S2: the ECU communicates with the PC-side forward burning host computer and the reverse burning host computer respectively through the on-vehicle communication bus; S3: the forward burning host computer updates the original normal Application program to the App_ReverseProg application program containing the reverse burning code based on the original Bootloader program; S4: the reverse burning host computer reversely updates the original Bootloader program based on the App_ReverseProg application program containing the reverse burning code;
[0006] S5: Reverse burning: The host computer transmits the valid boot signature content contained in the burning file of the updated Bootloader as the final burning data to the App_ReverseProg program. Although this method can achieve online repair, the repair speed is slow.
[0007] In view of this, the present invention provides an on-line repair method and storage medium for a vehicle computer software fault, so as to quickly repair the vehicle computer software fault. Summary of the invention
[0008] In view of this, the present invention provides an online repair method and storage medium for a vehicle computer software fault, so as to realize online rapid repair of a vehicle computer software fault.
[0009] In one aspect, the present invention provides a method for online repairing of a vehicle computer software fault, comprising:
[0010] Locate the fault code fragment of the static code of the vehicle computer software;
[0011] Modifying or rewriting the faulty code fragment to obtain a new code fragment;
[0012] Calculating the address segment where the faulty code segment is located after compilation in the random access memory and the address interval where the faulty code segment is located in the read-write memory;
[0013] Select a memory driver according to the address range and download, download the new code fragment, and configure an enable register;
[0014] When the vehicle computer software is running, the content of the address segment and the content of the address interval are repaired; repairing the content of the address segment includes: compiling the new code fragment to obtain a new code block, and using the new code block to overwrite the content of the address segment through the enable register; repairing the content of the address interval includes: calling the memory driver to erase the content of the address interval, and writing the new code fragment into the address interval through the enable register.
[0015] Optionally, the new code snippet has the same programming language as the faulty code snippet, the new code snippet has the same architecture as the faulty code snippet, the new code snippet has the same interface name as the faulty code snippet, and the new code snippet has the same compilation parameters as the faulty code snippet.
[0016] Optionally, after the fault code fragment is modified or rewritten to obtain the new code fragment, the method further includes:
[0017] Uploading the new code snippet to the cloud;
[0018] Downloading the new code snippet includes: pulling the new code snippet from the cloud for downloading, and saving the new code snippet to the random access memory.
[0019] Optionally, configuring the enable register includes: configuring the enable register to perform data transmission when the enable register is at a high level.
[0020] Optionally, overwriting the content of the address segment with the new code block via the enable register includes:
[0021] Marking a label at the beginning of the address segment, and the driving computer software runs to the label and returns;
[0022] Overwriting the content of the address segment with the new code block via the enable register;
[0023] Delete said tag.
[0024] Optionally, calling the memory driver to erase the content of the address interval includes:
[0025] The memory driver comprises an erase function, and the erase function of the memory driver is called to erase the faulty code fragment located in the address interval.
[0026] Optionally, after repairing the content of the address segment, the content of the address interval is repaired; or after repairing the content of the address interval, the content of the address segment is repaired; or the content of the address segment is repaired while repairing the content of the address interval.
[0027] Optionally, the driving computer software runs, including:
[0028] The read-write memory includes a backup area and a storage area, and the storage area stores the static code of the vehicle computer software;
[0029] The static code of the on-board computer software stored in the storage area is backed up to the backup area, and the on-board computer software is run according to the backup area.
[0030] Optionally, the label is a stub function label.
[0031] On the other hand, the present invention further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the method for online repairing a vehicle computer software fault as described in any one of the above items is implemented.
[0032] Compared with the prior art, the on-line repair method and storage medium for vehicle computer software failure provided by the present invention achieve at least the following beneficial effects:
[0033] 1. The on-line repair method and storage medium for vehicle computer software faults provided by the present invention configure an enable register to directly access the memory, so that the fault fragment can be modified directly in the memory without interrupting the normal operation of the vehicle computer software, thereby achieving online repair.
[0034] 2. The method and storage medium for online repair of vehicle computer software faults provided by the present invention repair the contents of the address segment and the address interval when the vehicle computer software is running; repairing the contents of the address segment includes: compiling a new code segment to obtain a new code block, and using the new code block to overwrite the contents of the address segment through the enable register; repairing the contents of the address interval includes: calling a memory driver to erase the contents of the address interval, and writing a new code segment to the address interval through the enable register. By enabling the register and the memory driver to directly repair the erroneous segments in the random access memory and the read memory, the workload and time required for the repair are greatly shortened, thereby realizing online and rapid repair of the vehicle computer software.
[0035] Of course, any product implementing the present invention does not necessarily need to achieve all of the technical effects described above at the same time.
[0036] Further features and advantages of the present invention will become apparent from the following detailed description of exemplary embodiments of the present invention with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments of the invention and, together with the description, serve to explain the principles of the invention.
[0038] Figure 1 It is a flow chart of the method for online repairing of vehicle computer software failure provided by the present invention;
[0039] Figure 2 It is another flow chart of the method for online repairing of vehicle computer software failure provided by the present invention;
[0040] Figure 3 It is another flow chart of the method for online repairing of vehicle computer software failure provided by the present invention. DETAILED DESCRIPTION
[0041] Various exemplary embodiments of the present invention will now be described in detail with reference to the accompanying drawings. It should be noted that the relative arrangement of components and steps, numerical expressions and numerical values set forth in these embodiments do not limit the scope of the present invention unless otherwise specifically stated.
[0042] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the invention, its application, or uses.
[0043] Technologies, methods, and equipment known to ordinary technicians in the relevant art may not be discussed in detail, but where appropriate, the technologies, methods, and equipment should be considered as part of the specification.
[0044] In all examples shown and discussed herein, any specific values should be interpreted as merely exemplary and not limiting. Therefore, other examples of the exemplary embodiments may have different values.
[0045] It should be noted that like reference numerals and letters refer to similar items in the following figures, and therefore, once an item is defined in one figure, it need not be further discussed in subsequent figures.
[0046] Example 1
[0047] Reference Figure 1 , Figure 1 The following is a flow chart of the method for online repairing a vehicle computer software fault provided by the present invention, which is used to illustrate a specific embodiment of the method for online repairing a vehicle computer software fault provided by the present invention, including:
[0048] S101: locate the fault code fragment of the static code of the vehicle computer software;
[0049] S102: modify or rewrite the faulty code fragment to obtain a new code fragment;
[0050] S103: Calculate the address segment where the compiled faulty code segment in the random access memory is located and the address interval where the faulty code segment in the read-write memory is located;
[0051] S104: Select a memory driver according to the address range and download it, download a new code fragment, and configure an enable register;
[0052] S105: When the vehicle computer software is running, repair the content of the address segment and the content of the address interval; repair the content of the address segment, including: compiling a new code segment to obtain a new code block, and using the new code block to overwrite the content of the address segment through the enable register; repair the content of the address interval, including: calling the memory driver to erase the content of the address interval, and writing the new code segment into the address interval through the enable register.
[0053] It should be noted that repairing the content of the address segment is effective in real time, while repairing the content of the address interval requires restarting and resetting, so when repairing online, repairing the content of the address segment first will give a better user experience. Of course, the order of repairing the content of the address segment and repairing the content of the address interval can be adjusted according to actual needs, and this embodiment does not impose specific restrictions on this. It can be repairing the content of the address segment first, then repairing the content of the address interval; or repairing the content of the address interval first, then repairing the content of the address segment; or repairing the content of the address segment and repairing the content of the address interval at the same time.
[0054] It is understandable that locating the fault position of the static code of the vehicle computer software can be achieved through log analysis or performance monitoring. Specifically, the approximate module or function code segment where the problem is located can be obtained by analyzing the log, or the probability and regularity of the problem can be obtained through performance monitoring. On this basis, debugging breakpoints are performed to support the analysis conclusions. These are relatively common positioning methods and will not be elaborated on here. Of course, there are many other ways to locate the fault position of software code in the prior art, which are not limited to these and can be adjusted according to actual needs. By locating the fault position of the static code of the vehicle computer software, it can be known which line or function in the static code has a fault, which facilitates the division of the faulty code fragments. The divided faulty code fragments at least include the faulty code line or function.
[0055] By configuring the enable register to directly access the memory, it is possible to modify the faulty fragment directly in the memory without interrupting the normal operation of the on-board computer software, thereby achieving online repair. When the on-board computer software is running, the content of the address segment and the content of the address interval are repaired; the content of the address segment is repaired, including: compiling a new code fragment to obtain a new code block, and using the new code block to overwrite the content of the address segment through the enable register; repairing the content of the address interval includes: calling the memory driver to erase the content of the address interval, and writing the new code fragment to the address interval through the enable register. By enabling the register and the memory driver to directly repair the erroneous fragment in the random access memory and the read memory, the workload and time required for repair are greatly shortened, thereby achieving online and rapid repair of the on-board computer software.
[0056] Example 2
[0057] Reference Figure 2 and Figure 3 , Figure 2 It is another flow chart of the method for online repairing of vehicle computer software failure provided by the present invention. Figure 3 1 is another flow chart of the method for online repairing of vehicle computer software failure provided by the present invention, to illustrate another specific embodiment of the method for online repairing of vehicle computer software failure provided by the present invention, comprising:
[0058] S201: Locate the fault code fragment of the static code of the vehicle computer software.
[0059] S202: modify or rewrite the faulty code fragment to obtain a new code fragment;
[0060] In step S202 , the new code snippet and the faulty code snippet have the same programming language, the same architecture, the same interface name, and the same compilation parameters as the faulty code snippet.
[0061] S203: Upload the new code snippet to the cloud.
[0062] S204: Calculate the address segment where the compiled faulty code segment is located in the random access memory and the address interval where the faulty code segment is located in the read-write memory.
[0063] S205: Pull a new code snippet from the cloud for downloading, save the new code snippet to a random access memory, select a memory driver according to an address range and download it, and configure an enable register, including: configuring the enable register to perform data transmission when the high level is high.
[0064] S206: When the driving computer software is running, repair the content of the address segment and the content of the address interval;
[0065] Among them, repairing the content of the address segment includes: compiling a new code fragment to obtain a new code block, marking a label at the beginning of the address segment, and the on-board computer software runs to the label and returns; using the new code block to overwrite the content of the address segment through the enable register; deleting the label, the label is a stub function label.
[0066] Repairing the content of the address interval includes: calling a memory driver to erase the content of the address interval, including: the memory driver includes an erase function, calling the erase function of the memory driver to erase the faulty code fragment located in the address interval; writing a new code fragment into the address interval via an enable register.
[0067] In step S206, the driving computer software runs, including:
[0068] The read-write memory includes a backup area and a storage area, and the storage area stores the static code of the vehicle computer software;
[0069] The static code of the on-board computer software stored in the storage area is backed up to the backup area, and the on-board computer software is run according to the backup area.
[0070] It should be noted that when the on-board computer software is running, the static code of the on-board computer software stored in the storage area is first backed up to the backup area, and the on-board computer software is run according to the backup area. Therefore, when the content of the storage area is repaired online, the running on-board computer software will not crash. Set the programming language of the new code snippet to be the same as that of the faulty code snippet, the architecture of the new code snippet to be the same as that of the faulty code snippet, the interface name of the new code snippet to be the same as that of the faulty code snippet, and the compilation parameters of the new code snippet and the faulty code snippet to be the same, so as to ensure that the new code snippet is well compatible with the on-board computer software to be repaired. In order to further ensure that the new code snippet is compatible with the on-board computer software to be repaired, it is also possible to compile and test the new code snippet before uploading it to the cloud. The on-board computer configures the enable register. Setting the enable register is equivalent to establishing a direct access channel. The memory can be directly accessed through the direct access channel. The enable register is configured to be high for data transmission. Even if the value of the enable register is configured to be 1, data can be transmitted at a high level after configuration.
[0071] It is understandable that the content of the repair address segment can be modified during the program operation. After determining the address segment, at the starting address of the address segment in the random access memory, a pile function label is put. The pile function label may also be called pile function TAG. When the program runs to this point, it will directly return to ensure that the repair process is not affected. Then, the content of the address segment is covered by a new code block through a direct access channel. The pile function label is deleted after the coverage. When the program runs to this point again, it is the fragment that has been repaired, so the dynamic hot repair process is completed. The content of the repair address interval can also be modified during the program operation. The content of the repair address interval does not affect the program operation. The erase function of the memory driver is called, and the fault code fragment stored in the read-write memory is erased. At this moment, the address interval is blank. Through the enable register, the new code fragment is written to the address interval, and cold repair is completed, thereby realizing the online rapid repair of the driving computer software fault.
[0072] Example 3
[0073] Continue to refer to Figure 2 and Figure 3 , to illustrate another specific embodiment of the method for online repairing of vehicle computer software failure provided by the present invention, comprising:
[0074] S201: Locate the fault code fragment of the static code of the vehicle computer software.
[0075] S202: modify or rewrite the faulty code fragment to obtain a new code fragment;
[0076] In step S202 , the new code snippet and the faulty code snippet have the same programming language, the same architecture, the same interface name, and the same compilation parameters as the faulty code snippet.
[0077] S203: Upload the new code snippet to the cloud.
[0078] S204: Calculate the address segment where the compiled faulty code segment is located in the random access memory and the address interval where the faulty code segment is located in the read-write memory.
[0079] S205: Pull a new code snippet from the cloud for downloading, save the new code snippet to a random access memory, select a memory driver according to an address range and download it, and configure an enable register, including: configuring the enable register to perform data transmission when the high level is high.
[0080] S206: When the driving computer software is running, repair the content of the address segment and the content of the address interval;
[0081] Among them, repairing the content of the address segment includes: compiling a new code fragment to obtain a new code block, marking a label at the beginning of the address segment, and the on-board computer software runs to the label and returns; using the new code block to overwrite the content of the address segment through the enable register; deleting the label, the label is a stub function label.
[0082] Repairing the content of the address interval includes: calling a memory driver to erase the content of the address interval, including: the memory driver includes an erase function, calling the erase function of the memory driver to erase the faulty code fragment located in the address interval; writing a new code fragment into the address interval via an enable register.
[0083] In step S206, the driving computer software runs, including:
[0084] The read-write memory includes a backup area and a storage area, and the storage area stores the static code of the vehicle computer software;
[0085] The static code of the on-board computer software stored in the storage area is backed up to the backup area, and the on-board computer software is run according to the backup area.
[0086] It should be noted that the faulty code snippet can be modified or rewritten in a programming editor. A programming editor is a tool used by software developers. It supports writing and editing code, has syntax highlighting, can debug code, provides version control and other functions. Commonly used code editors include Visual Studio Code, Sublime Text, Atom, Notepad++, IntelliJ IDEA, Eclipse, PyCharm, Brackets, Vim, Emacs, etc., which can be selected according to needs.
[0087] It is understandable that the erase function of the memory driver realizes the erasure of the static code in the read-write memory, so the memory driver needs to be selected according to the address interval where the new code fragment is to be inserted. The random access memory of the driving computer stores the compiled file of the static code of the driving computer software, which is a MAP file. The address segment where the compiled fault code fragment is located in the random access memory is calculated, including: searching for the address segment corresponding to the compiled fault code fragment in the MAP file. In this embodiment, the address segment is 0x80010000-0x80011000. For example, the size of the address segment is 4KB in total. A label is marked before 0x80010000, and the driving computer software runs to the label and returns; the new code fragment is compiled to obtain a new code block; the new code block is used to overwrite the content of the address segment through the enable register, and the label is deleted after overwriting to complete the repair of the content of the address segment. Call the erase function of the memory driver to erase the faulty code fragment stored in the read-write memory. At this time, the address interval is blank, and the new code fragment is written into the address interval through the enable register to complete the cold repair, thereby realizing online rapid repair of the vehicle computer software fault.
[0088] Example 4
[0089] Based on the same inventive concept, the present invention also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, an online repair method for a vehicle computer software fault as described in any one of the above embodiments is implemented.
[0090] It can be seen from the above embodiments that the on-line repair method and storage medium for vehicle computer software failure provided by the present invention achieve at least the following beneficial effects:
[0091] 1. The on-line repair method and storage medium for vehicle computer software faults provided by the present invention configure an enable register to directly access the memory, so that the fault fragment can be modified directly in the memory without interrupting the normal operation of the vehicle computer software, thereby achieving online repair.
[0092] 2. The method and storage medium for online repair of vehicle computer software faults provided by the present invention repair the contents of the address segment and the address interval when the vehicle computer software is running; repairing the contents of the address segment includes: compiling a new code segment to obtain a new code block, and using the new code block to overwrite the contents of the address segment through the enable register; repairing the contents of the address interval includes: calling a memory driver to erase the contents of the address interval, and writing a new code segment into the address interval through the enable register. By enabling the register and the memory driver to directly repair the erroneous segments in the random access memory and the read memory, the workload and time required for the repair are greatly shortened, thereby realizing online and rapid repair of the vehicle computer software.
[0093] Although some specific embodiments of the present invention have been described in detail by way of example, it will be appreciated by those skilled in the art that the above examples are for illustration only and are not intended to limit the scope of the present invention. It will be appreciated by those skilled in the art that the above embodiments may be modified without departing from the scope and spirit of the present invention. The scope of the present invention is defined by the appended claims.
Claims
1. A method for online repair of vehicle computer software failure, characterized in that: include: Locate the fault code fragment of the static code of the vehicle computer software; Modifying or rewriting the faulty code fragment to obtain a new code fragment; Calculating the address segment where the faulty code segment is located after compilation in the random access memory and the address interval where the faulty code segment is located in the read-write memory; Select a memory driver according to the address range and download, download the new code fragment, and configure an enable register; When the driving computer software is running, repairing the content of the address segment and the content of the address interval; Repairing the content of the address segment includes: compiling the new code fragment to obtain a new code block, and using the new code block to overwrite the content of the address segment through the enable register; repairing the content of the address interval includes: calling the memory driver to erase the content of the address interval, and writing the new code fragment into the address interval through the enable register.
2. The method for online repairing of vehicle computer software failure according to claim 1, characterized in that: The new code snippet has the same programming language as the faulty code snippet, the same architecture as the faulty code snippet, the same interface name as the faulty code snippet, and the same compilation parameters as the faulty code snippet.
3. The method for online repairing of vehicle computer software failure according to claim 1, characterized in that: After modifying or rewriting the faulty code snippet to obtain the new code snippet, the method further includes: uploading the new code snippet to the cloud; Downloading the new code snippet includes: pulling the new code snippet from the cloud for downloading, and saving the new code snippet to the random access memory.
4. The method for online repairing of vehicle computer software failure according to claim 1, characterized in that: Configuring the enable register includes: configuring the enable register to perform data transmission when the enable register is at a high level.
5. The method for online repairing of vehicle computer software failure according to claim 1, characterized in that: Overwriting the content of the address segment with the new code block via the enable register includes: Marking a label at the beginning of the address segment, and the driving computer software runs to the label and returns; Overwriting the content of the address segment with the new code block via the enable register; Delete said tag.
6. The method for online repairing of vehicle computer software failure according to claim 1, characterized in that: Calling the memory driver to erase the content of the address interval includes: The memory driver comprises an erase function, and the erase function of the memory driver is called to erase the faulty code fragment located in the address interval.
7. The method for online repairing of vehicle computer software failure according to claim 1, characterized in that: After repairing the content of the address segment, the content of the address interval is repaired; or after repairing the content of the address interval, the content of the address segment is repaired; or the content of the address segment is repaired while repairing the content of the address interval.
8. The method for online repairing of vehicle computer software failure according to claim 1, characterized in that: The operation of the vehicle computer software includes: The read-write memory includes a backup area and a storage area, and the storage area stores the static code of the vehicle computer software; The static code of the on-board computer software stored in the storage area is backed up to the backup area, and the on-board computer software is run according to the backup area.
9. The method for online repairing of vehicle computer software failure according to claim 5, characterized in that: The label is a stub function label.
10. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed by a processor, the method for online repairing of vehicle computer software failure as claimed in any one of claims 1 to 9 is implemented.
Citation Information
Patent Citations
Methods, devices, electronic devices, and readable storage media for locating bugs in code.
CN111897711B
Bootloader program online updating method of vehicle-mounted ECU
CN113672251A