ECU flash update method and system based on compression algorithm

By using compression algorithm to process the update data in ECU flash update, the problem of slow update speed of ECU programs is solved, and a more efficient update process and lower cost is achieved.

CN118897690BActive Publication Date: 2025-04-29SUZHOU LEEKR TECH CO LTD +2
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411355407.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-27
Publication Date
2025-04-29
Estimated Expiration
2044-09-27

AI Technical Summary

Technical Problem

After the PCBA is installed as an ECU, since there is no external debugging interface, the program can only be updated through BootLoader. The update speed is limited by physical factors, resulting in a long program update time, which increases time and cost.

Method used

The ECU flash writing and update method based on the compression algorithm is adopted to determine whether it is a compressed data block by parsing the update data file. If so, it is decompressed and written to the FLASH storage module of the vehicle ECU.

Benefits of technology

It significantly shortens the refresh write update time, improves update efficiency and reliability, and reduces dependence on communication network bandwidth.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118897690B_ABST
    Figure CN118897690B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention relates to the technical field of program update, and discloses an ECU flash update method and system based on a compression algorithm, including: parsing the acquired update data file to obtain the starting address field and update data content in the update data file; matching the data with a pre-configured address mapping table according to the starting address field to determine whether the corresponding starting address information is a compressed data block address; decompressing the complete compressed data information according to the set compression algorithm to obtain decompressed update data. The ECU flash update method based on a compression algorithm in the embodiment of the present invention can significantly reduce the amount of data that needs to be transmitted by processing the update data using a compression algorithm. This advantage is particularly obvious during the update process of the vehicle ECU, especially when the update file is large. Reducing the amount of data transmission can not only speed up the download speed, but also reduce the dependence on the communication network bandwidth, and improve the efficiency and reliability of the update process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of program update, and in particular to an ECU flash update method and system based on a compression algorithm. Background Art

[0002] At present, after the PCBA is assembled into an ECU, since there is no external debugging interface, the program can only be updated through the BootLoader. Since the updated program files can only be updated using the Can or CanFD method on some parts, the update speed will be limited by physical factors, and the program update time is directly limited by it. The above limitations make the time cost particularly high when updating the program during production or later maintenance. Therefore, designing a solution that can improve the overall update speed has become a technical problem that needs to be solved urgently by technical personnel in this field. Summary of the invention

[0003] In view of the above-mentioned defects, an embodiment of the present invention discloses an ECU flash update method based on a compression algorithm, which can shorten the flash update time and improve the update efficiency.

[0004] The first aspect of the embodiment of the present invention discloses an ECU flash update method based on a compression algorithm, comprising:

[0005] Parsing the acquired update data file to obtain the start address field and update data content in the update data file;

[0006] Performing data matching with a pre-configured address mapping table according to the start address field to determine whether the corresponding start address information is a compressed data block address, and if not, receiving update data content in the update data file, and writing the update data content into a FLASH storage module of the vehicle ECU;

[0007] If yes, then obtain the corresponding compressed data information according to the compressed data block address until the complete compressed data information is obtained;

[0008] The complete compressed data information is decompressed according to a set compression algorithm to obtain decompressed update data, and the decompressed update data is written into the FLASH storage module of the vehicle ECU.

[0009] As an optional implementation manner, in the first aspect of the embodiment of the present invention, the file to be updated includes a compressed data file; the compressed data file is obtained by the following steps:

[0010] Receiving an original update file, parsing the original update file into a plurality of original data segments, each of which includes original address information and original data information; wherein the original update file is a HEX file;

[0011] Traversing all original data segments, grouping each original data segment according to the continuity of the original address information to obtain a plurality of compressed data blocks, wherein the compressed data blocks include compressed address information, and the continuous original data segments are regarded as the same compressed data block;

[0012] Reading original data content associated with the compressed address information, and converting the corresponding original data content into original binary data;

[0013] Finding a repetitive sequence in the original binary data, obtaining corresponding compression mark information according to the repetitive sequence, and updating data of the compressed data block according to the compression mark information until all the compressed data blocks are processed, wherein the compression mark information includes a compression length and a compression offset;

[0014] The compressed data file is generated by combining the compressed address information of each compressed data block.

[0015] As an optional implementation manner, in the first aspect of the embodiment of the present invention, after the compressed data file is generated by combining the compressed address information of each compressed data block, the method further includes:

[0016] Determine first length information of each compressed data block, and determine second length information of the compressed data file according to the first length information of each compressed data block;

[0017] Determine whether the second length information is not greater than the set length information. If so, fill the end identifier to the end of the compressed data file until the length of the compressed data file reaches the set length. If not, perform an alarm operation.

[0018] As an optional implementation manner, in the first aspect of the embodiment of the present invention, after the compressed data file is generated by combining the compressed address information of each compressed data block, the method further includes:

[0019] Converting the compressed data file into a HEX file format;

[0020] The set length information is 50% of the file length of the original update file.

[0021] As an optional implementation manner, in the first aspect of the embodiment of the present invention, searching for a repetitive sequence in the original binary data and obtaining corresponding compression mark information according to the repetitive sequence includes:

[0022] Before compression begins, a fixed-size hash table is initialized, wherein each entry in the hash table stores a position index and a matching length;

[0023] Searching for repeated sequences in the original binary data through a sliding window, and calculating a hash value corresponding to the data under the corresponding sliding window by setting a hash function;

[0024] Search the hash table for the element corresponding to the hash value. If the corresponding element is empty, it means that no data block with the same hash value has been matched before. Update the corresponding element according to the obtained hash value.

[0025] If the corresponding element is not empty, it means that the location information of the data block with the same hash value is stored;

[0026] And check whether the current data block is the same as the matched data block; if they are the same, replace the corresponding repeated sequence according to the compression length and compression offset.

[0027] As an optional implementation manner, in the first aspect of the embodiment of the present invention, the decompressing the complete compressed data information according to the set compression algorithm to obtain the decompressed update data includes:

[0028] The complete compressed data information is read according to the set compression algorithm, and the compressed length, compressed offset and literal information in the compressed data information are obtained; and the original data is restored according to the compressed length, compressed offset and literal information.

[0029] As an optional implementation manner, in the first aspect of the embodiment of the present invention, after writing into the FLASH storage module of the vehicle ECU, it also includes:

[0030] A cyclic redundancy check algorithm is used to check and calculate the updated data content written into the FLASH storage module of the vehicle ECU or the decompressed updated content to obtain a redundancy check result;

[0031] The redundancy check result is compared with the redundancy calculation result of the original update data file to determine whether the data in the FLASH storage module of the vehicle ECU is correct.

[0032] A second aspect of an embodiment of the present invention discloses an ECU flash update system based on a compression algorithm, comprising:

[0033] Parsing module: used to parse the acquired update data file to obtain the starting address field and update data content in the update data file;

[0034] A judgment module: used to perform data matching with a pre-configured address mapping table according to the starting address field to determine whether the corresponding starting address information is a compressed data block address, and if not, receive the update data content in the update data file, and write the update data content into the FLASH storage module of the vehicle ECU;

[0035] Data acquisition module: used for acquiring corresponding compressed data information according to the compressed data block address until the complete compressed data information is acquired;

[0036] Decompression module: used to decompress the complete compressed data information according to the set compression algorithm to obtain decompressed update data, and write the decompressed update data into the FLASH storage module of the vehicle ECU.

[0037] The third aspect of an embodiment of the present invention discloses an electronic device, comprising: a memory storing executable program code; a processor coupled to the memory; the processor calls the executable program code stored in the memory to execute the ECU flash update method based on the compression algorithm disclosed in the first aspect of the embodiment of the present invention.

[0038] A fourth aspect of an embodiment of the present invention discloses a computer-readable storage medium storing a computer program, wherein the computer program enables a computer to execute the ECU flash update method based on a compression algorithm disclosed in the first aspect of an embodiment of the present invention.

[0039] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:

[0040] The ECU flash update method based on the compression algorithm in the embodiment of the present invention can significantly reduce the amount of data to be transmitted by using a compression algorithm to process the update data. This advantage is particularly obvious in the process of updating the vehicle ECU, especially when the update file is large. Reducing the amount of data transmission can not only speed up the download speed, but also reduce the dependence on the communication network bandwidth, and improve the efficiency and reliability of the update process. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, 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 invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0042] Figure 1 It is a flow chart of an ECU flash update method based on a compression algorithm disclosed in an embodiment of the present invention;

[0043] Figure 2 It is a schematic diagram of a specific process of data compression disclosed in an embodiment of the present invention;

[0044] Figure 3 It is a schematic diagram of the process of performing compression update disclosed in an embodiment of the present invention;

[0045] Figure 4 It is a structural schematic diagram of an ECU flash update system based on a compression algorithm provided by an embodiment of the present invention;

[0046] Figure 5 It is a structural schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0047] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0048] It should be noted that the terms "first", "second", "third", "fourth", etc. in the specification and claims of the present invention are used to distinguish different objects rather than to describe a specific order. The terms "including" and "having" in the embodiments of the present invention and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device including a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0049] At present, after the PCBA is assembled into an ECU, the program can only be updated through the BootLoader because there is no external debugging interface. Since the updated program files can only be updated using the Can or CanFD method on some parts, the update speed will be limited by physical factors, and the program update time is directly limited by it. The above limitations make the time cost particularly high when performing program updates during production or later maintenance. Based on this, the embodiment of the present invention discloses an ECU flash update method, system, electronic device and storage medium based on a compression algorithm, which can significantly reduce the amount of data that needs to be transmitted by processing the update data using a compression algorithm. This advantage is particularly obvious during the update process of the vehicle ECU, especially when the update file is large. Reducing the amount of data transmission can not only speed up the download speed, but also reduce the dependence on the communication network bandwidth, and improve the efficiency and reliability of the update process.

[0050] Embodiment 1

[0051] See also Figure 1 , Figure 1It is a flow chart of the ECU flash update method based on compression algorithm disclosed in the embodiment of the present invention. Among them, the execution subject of the method described in the embodiment of the present invention is an execution subject composed of software and / or hardware, and the execution subject can receive relevant information by wired or / and wireless means, and can send certain instructions. Of course, it can also have certain processing functions and storage functions. The execution subject can control multiple devices, such as a remote physical server or cloud server and related software, or it can be a local host or server and related software that performs related operations on a device placed somewhere. In some scenarios, multiple storage devices can also be controlled, and the storage devices can be placed in the same place or different places as the devices. For example Figure 1 As shown, the ECU flash update method based on the compression algorithm includes the following steps:

[0052] S101: parsing the acquired update data file to obtain the start address field and update data content in the update data file;

[0053] S102: performing data matching with a pre-configured address mapping table according to the start address field to determine whether the corresponding start address information is a compressed data block address; if not, receiving update data content in the update data file, and writing the update data content into a FLASH storage module of the vehicle ECU;

[0054] S103: If yes, obtain corresponding compressed data information according to the compressed data block address until the complete compressed data information is obtained;

[0055] S104: decompressing the complete compressed data information according to a set compression algorithm to obtain decompressed update data, and writing the decompressed update data into the FLASH storage module of the vehicle ECU.

[0056] The solution of the embodiment of the present invention can significantly reduce the amount of data that needs to be transmitted by processing the update data using a compression algorithm. This advantage is particularly evident in the update process of the vehicle ECU, especially when the update file is large. Reducing the amount of data transmission can not only speed up the download speed, but also reduce the dependence on the bandwidth of the communication network, and improve the efficiency and reliability of the update process. Although the compression algorithm itself does not directly improve the security of the data, by reducing the amount of data transmitted, the risk of data being intercepted or tampered with during the transmission process can be reduced. At the same time, the integrity check of the compressed data is also easier to implement, thereby further enhancing the security of the update data.

[0057] The method of the embodiment of the present invention determines whether the data is a compressed data block through the address mapping table, which means that it can flexibly process different types of updated data. Whether it is compressed data or non-compressed data, it can be processed according to the established process, which improves the compatibility and flexibility of the system.

[0058] The flashing process of the scheme of the embodiment of the present invention: Because the data is compressed, multiple checks are required to prevent data loss during the decompression process. Perform CRC check on the data during the transmission process, and the communicating parties compare the CRC check values ​​of the sent and received data. Perform CRC check on the original data, and add the CRC result to the end of the data. After the check passes during the transmission process, the MCU performs CRC check on the decompressed data again, and compares it with the CRC result added at the end of the data.

[0059] The decompression process of the scheme of the embodiment of the present invention: when decompressing data, due to the limitation of the RAM and flash space of the MCU, and also considering the time factor of reading and writing flash, all compressed data cannot be stored in the MCU storage and then decompressed together, so the data is decompressed while receiving the data. When the produced ECU products need to update the program uniformly, the time for updating each product can be saved by half, thereby saving a lot of manpower. The key point of the scheme of the embodiment of the present invention is to solidify the length of the flash file while ensuring the flash function by being compatible with compressed and uncompressed data, thereby saving the flash time.

[0060] More preferably, Figure 2 As shown, the file to be updated includes a compressed data file; the compressed data file is obtained by the following steps:

[0061] S100a: receiving an original update file, parsing the original update file into a plurality of original data segments, each of which includes original address information and original data information; wherein the original update file is a HEX file;

[0062] S100b: traversing all original data segments, and grouping each original data segment according to the continuity of the original address information to obtain a plurality of compressed data blocks, wherein the compressed data blocks include the compressed address information, and the continuous original data segments are taken as the same compressed data block;

[0063] S100c: reading original data content associated with the compressed address information, and converting the corresponding original data content into original binary data;

[0064] S100d: searching for a repetitive sequence in the original binary data, obtaining corresponding compression mark information according to the repetitive sequence, and updating data of the compressed data block according to the compression mark information until all compressed data blocks are processed, wherein the compression mark information includes a compression length and a compression offset;

[0065] S100e: Combining and generating a compressed data file according to the compressed address information of each compressed data block.

[0066] Since the original file may be HEX data with multiple discontinuous addresses, multiple discontinuous compressed data are generated by judging the continuity of the address. For example, if a HEX data consists of two segments of address data, two compressed data are generated according to the two segments of data addresses. A combined HEX file is regenerated based on the first address of the data.

[0067] The present invention is a specific process of compressing the original update file to obtain a compressed data file. The embodiment of the present invention needs to convert each pair of hexadecimal characters in the HEX file (such as "4A" represents 74 in decimal and 01001010 in binary) into a corresponding single byte. This process is the process of decoding the HEX string, and the result is a binary data stream. The compression algorithm of the embodiment of the present invention is a dictionary-based compression algorithm that uses repeated patterns in the data (i.e., "phrases" in the dictionary) to reduce storage space. During the compression process, the compression algorithm of the embodiment of the present invention will search for repeated sequences in the input data and replace these repeated sequences with a shorter tag (usually a length and an offset). In this way, when decompressing, the algorithm can use these tags and the previously decompressed data to reconstruct the original data.

[0068] The compression algorithm of the embodiment of the present invention can achieve high compression and decompression speeds, which makes it very suitable for scenarios where large amounts of data need to be processed quickly. Although the compression ratio of the compression algorithm of the embodiment of the present invention may not be as good as some other algorithms, it can generally achieve a good balance between reasonable compression rate and speed. The memory usage of the compression algorithm of the embodiment of the present invention is also very low, which is particularly important in resource-constrained environments. Therefore, it is particularly suitable for flashing vehicle ECUs.

[0069] In the embodiment of the present invention, the compressed data is in binary format and can be directly stored or transmitted through a network. If it is necessary to save or transmit these data in text form (such as a HEX string), the binary data can be converted into a HEX string again.

[0070] Specifically, the solution of the embodiment of the present invention can effectively identify and compress repeated data sequences in the file by parsing the original update file (such as a HEX file) and dividing it into original data segments, and then further performing group compression according to address continuity. This compression mechanism significantly reduces the size of the compressed data file finally generated, thereby reducing the storage space occupied and the bandwidth requirement during network transmission. During the update process, due to the reduction in the size of the compressed data file, the time for downloading, transmitting and decompressing it will be reduced accordingly. This not only speeds up the speed of the entire update process, but also reduces the waiting time of users and improves the user experience.

[0071] More preferably, after generating the compressed data file by combining the compressed address information of each compressed data block, the method further includes:

[0072] Determine first length information of each compressed data block, and determine second length information of the compressed data file according to the first length information of each compressed data block;

[0073] Determine whether the second length information is not greater than the set length information. If so, fill the end identifier to the end of the compressed data file until the length of the compressed data file reaches the set length. If not, perform an alarm operation.

[0074] The solution of the embodiment of the present invention determines the first length information of each compressed data block and calculates the second length information of the compressed data file accordingly, so that the system can accurately grasp the actual size of the entire compressed data file. On this basis, by filling the end identifier to the end of the file until the file length reaches the set standard length, the integrity and consistency of the file structure are ensured. This processing method helps the receiving end to accurately identify the file boundary when parsing the compressed data file, avoiding parsing errors caused by inconsistent file lengths.

[0075] The file length requirement is set and the end identifier is filled so that the generated compressed data file conforms to certain format specifications. This standardized file format is not only easy to manage and maintain, but also helps to improve the compatibility and interoperability between different systems or platforms.

[0076] When the second length information of the compressed data file exceeds the set length information, the system will issue an alarm. This mechanism enables users to find problems in time, such as errors in the data compression process, the original data file is too large, etc. Through the alarm operation, users can take corresponding measures in time, such as checking the original data file, adjusting the compression parameters or optimizing the system configuration, etc., to ensure the smooth progress of the update process.

[0077] More preferably, after generating the compressed data file by combining the compressed address information of each compressed data block, the method further includes:

[0078] Converting the compressed data file into a HEX file format;

[0079] The set length information is 50% of the file length of the original update file.

[0080] Since the length of the compressed file is not fixed, it is necessary to set 50% of the original data length as the length of the generated data. The compression algorithm of the embodiment of the present invention uses 0 as an identifier to mark the end of the file after compression is completed, and fills the insufficient length with 0 to fix the file length. Due to the specificity of the compression algorithm, the general algorithm will have an end mark character or character segment. Different compression algorithms have different end identifiers. In the embodiment of the present invention, 0 is used as the end identifier.

[0081] If the length of the compressed file is longer than 50% of the original data, the original data file is used. The above method can be well compatible with compressed files and non-compressed files. Since the refresh files used by vehicle manufacturers or 4S stores have many limitations on file formats, most devices may not support files of indefinite length. Therefore, a fixed length setting method is adopted in the embodiment of the present invention, so that the compressed file is easy to be identified.

[0082] More preferably, Figure 3 As shown, searching for a repetitive sequence in the original binary data and obtaining corresponding compression mark information according to the repetitive sequence includes:

[0083] S100d1: before compression starts, a hash table of a fixed size is initialized; wherein each entry in the hash table stores a position index and a matching length;

[0084] S100d2: searching for repeated sequences in the original binary data through a sliding window, and calculating a hash value corresponding to the data in the corresponding sliding window by setting a hash function;

[0085] S100d3: Search the hash table for the element corresponding to the hash value. If the corresponding element is empty, it means that no data block with the same hash value has been matched before. The corresponding element is updated according to the obtained hash value.

[0086] S100d4: If the corresponding element is not empty, it indicates that the location information of the data block with the same hash value is stored; and check whether the current data block is the same as the matched data block; if they are the same, replace the corresponding repeated sequence according to the compression length and compression offset.

[0087] The core of the compression algorithm of the embodiment of the present invention is to identify repeated sequences (also called "phrases" or "patterns") in the input data stream. These repeated sequences can be exactly the same byte sequences, and they may appear in different positions of the data. In order to efficiently find these repeated sequences, the compression algorithm of the embodiment of the present invention adopts a hash table or a similar fast search mechanism. During the compression process, the compression algorithm of the embodiment of the present invention maintains a hash table for quickly mapping data blocks to their most recent locations. When processing a new data block, the algorithm calculates the hash value of the data block and searches the hash table to see if the same hash value already exists. If so, it further checks whether the two data blocks are indeed the same.

[0088] If a matching repeated sequence is found, the compression algorithm of the embodiment of the present invention will replace the sequence in the original data with a shorter marker. This marker usually contains two key information: length information: indicating the length of the repeated sequence, that is, the number of bytes that need to be replaced. Offset information: indicating the distance between the current position and the last position of the repeated sequence. In this way, the repeated sequence in the original data is replaced with a shorter marker, thereby reducing the storage space requirement.

[0089] During the compression process, the compression algorithm of the embodiment of the present invention traverses the input data, continuously searches for and replaces repeated sequences until all data are processed, and finally generates a compressed data stream containing the original data and replacement marks.

[0090] Since the size of the hash table is limited, and the input data is infinite, hash collisions are inevitable. In the compression algorithm of the embodiment of the present invention, the method for handling hash collisions is usually to handle them through the chain address method, that is, when a hash collision is found, it does not stop searching immediately, but continues to search at a certain position in the hash table (such as the next position of the bucket) until an empty bucket is found or a matching data block is found.

[0091] The sliding window mentioned in the embodiment of the present invention is a technology used in the data compression and decompression process, which maintains a fixed-size data buffer for storing the most recently processed data blocks. This buffer is like a window that slides on the data stream and finds repeated patterns or data blocks by comparing the similarity between the current data block and the data in the window.

[0092] The compression algorithm of the embodiment of the present invention uses a sliding window to quickly find duplicates of the current data block in previously processed data. When the algorithm processes a new data block, it compares the data block with the data in the sliding window to find possible matches. By using the data in the sliding window, the compression algorithm of the embodiment of the present invention can identify and replace duplicate data blocks, thereby significantly reducing the amount of data that needs to be stored or transmitted. This replacement is usually achieved by referencing the offset and length of the data in the window, rather than directly storing the duplicate data.

[0093] The sliding window allows the compression algorithm of the embodiment of the present invention to remain efficient when processing continuous data streams. As the data stream continues to be input, the window will slide forward while retaining the latest data blocks for subsequent comparison. This mechanism enables the compression algorithm of the embodiment of the present invention to compress and decompress the data stream in real time.

[0094] The size of the sliding window of the embodiment of the present invention is fixed, which means that it can only store a limited number of data blocks. When the window slides forward, the earliest data block will be moved out of the window to make room for new data blocks. As the data stream is input, the content of the sliding window will be continuously updated. This dynamic update mechanism enables the compression algorithm of the embodiment of the present invention to always focus on the latest data blocks and find repeated patterns therein. By utilizing the data in the sliding window, the compression algorithm of the embodiment of the present invention can significantly reduce the amount of compressed data while maintaining a high compression and decompression speed.

[0095] More preferably, the decompressing the complete compressed data information according to the set compression algorithm to obtain the decompressed update data includes:

[0096] The complete compressed data information is read according to the set compression algorithm, and the compressed length, compressed offset and literal information in the compressed data information are obtained; and the original data is restored according to the compressed length, compressed offset and literal information.

[0097] During the decompression process, the compression algorithm of the embodiment of the present invention reads the compressed data stream and copies the corresponding byte sequence from the previously decompressed data according to the length and offset information in the tag to restore the original data. This process does not require additional storage space to store dictionaries or hash tables because all necessary information is contained in the compressed data stream.

[0098] The reason why the compression algorithm of the embodiment of the present invention can achieve extremely fast compression and decompression speeds while maintaining a high compression ratio is partly due to the ingenuity of its algorithm design. For example, it uses a fast hash function to reduce the search time, while limiting the size of the hash table to avoid excessive memory consumption. In addition, the compression algorithm of the embodiment of the present invention also reduces the cache miss rate of the CPU through a series of optimization measures, thereby further improving performance. The compression algorithm of the embodiment of the present invention focuses on the speed of compression and decompression, especially the decompression speed. Although its compression ratio is not as high as some other algorithms, it is sufficient to meet many scenarios that require rapid processing of large amounts of data.

[0099] The compression algorithm of the embodiment of the present invention is well-known for its extremely high compression and decompression speed, especially in the decompression speed, which is almost close to the speed of memory copy. In comparison, the compression speed of LZSS may be slightly slower because its matching mechanism is relatively complex.

[0100] More preferably, after writing into the FLASH storage module of the vehicle ECU, it also includes:

[0101] A cyclic redundancy check algorithm is used to check and calculate the updated data content written into the FLASH storage module of the vehicle ECU or the decompressed updated content to obtain a redundancy check result;

[0102] The redundancy check result is compared with the redundancy calculation result of the original update data file to determine whether the data in the FLASH storage module of the vehicle ECU is correct.

[0103] During the data transmission process, both communicating parties (such as the host computer and the ECU) will compare the CRC (Cyclic Redundancy Check) values ​​of the sent and received data. This is to ensure that the data has not been tampered with or damaged during the transmission process. If the CRC check value does not match, it means that there may be a problem with the data during the transmission process. At this time, the data needs to be resent or other remedial measures need to be taken.

[0104] Before the data is compressed, the CRC is calculated on the original data and the CRC result is transmitted as part of the data (usually added to the end of the data). This is done so that the integrity of the data can be verified again after decompression. If the CRC result of the decompressed data does not match the CRC result of the original data, it means that there may be a problem with the data during compression, transmission or decompression.

[0105] After receiving the compressed data, the ECU will first perform a CRC check to confirm that the data has not been tampered with during transmission. Then, the ECU will decompress the data using a pre-configured decompression algorithm. After decompression, the ECU will perform a CRC check on the data again and compare the result with the CRC result at the end of the data. If the two match, it means that there is no problem with the data during transmission and decompression; if they do not match, appropriate error handling measures need to be taken.

[0106] The ECU flash update method based on the compression algorithm in the embodiment of the present invention can significantly reduce the amount of data to be transmitted by using a compression algorithm to process the update data. This advantage is particularly obvious in the process of updating the vehicle ECU, especially when the update file is large. Reducing the amount of data transmission can not only speed up the download speed, but also reduce the dependence on the communication network bandwidth, and improve the efficiency and reliability of the update process.

[0107] Embodiment 2

[0108] See also Figure 4 , Figure 4 Schematic diagram of the structure of the ECU flash update system based on the compression algorithm disclosed in the embodiment of the present invention. Figure 4 As shown, the ECU flash update system based on the compression algorithm may include:

[0109] Parsing module 21: used to parse the acquired update data file to obtain the start address field and update data content in the update data file;

[0110] The judgment module 22 is used to perform data matching with a pre-configured address mapping table according to the starting address field to determine whether the corresponding starting address information is a compressed data block address. If not, the update data content in the update data file is received and the update data content is written into the FLASH storage module of the vehicle ECU.

[0111] Data acquisition module 23: used for acquiring corresponding compressed data information according to the compressed data block address until the complete compressed data information is acquired;

[0112] The decompression module 24 is used to decompress the complete compressed data information according to the set compression algorithm to obtain decompressed update data, and write the decompressed update data into the FLASH storage module of the vehicle ECU.

[0113] The ECU flash update method based on the compression algorithm in the embodiment of the present invention can significantly reduce the amount of data to be transmitted by using a compression algorithm to process the update data. This advantage is particularly obvious in the process of updating the vehicle ECU, especially when the update file is large. Reducing the amount of data transmission can not only speed up the download speed, but also reduce the dependence on the communication network bandwidth, and improve the efficiency and reliability of the update process.

[0114] Embodiment 3

[0115] See also Figure 5 , Figure 5 Schematic diagram of the structure of an electronic device disclosed in an embodiment of the present invention. The electronic device may be a computer, a server, etc. Of course, in certain circumstances, it may also be a smart device such as a mobile phone, a tablet computer, a monitoring terminal, and an image acquisition device with processing functions. Figure 5 As shown, the electronic device may include:

[0116] A memory 510 storing executable program codes;

[0117] a processor 520 coupled to the memory 510;

[0118] The processor 520 calls the executable program code stored in the memory 510 to execute part or all of the steps in the ECU flash update method based on the compression algorithm in the first embodiment.

[0119] An embodiment of the present invention discloses a computer-readable storage medium storing a computer program, wherein the computer program enables a computer to execute part or all of the steps in the ECU flash update method based on a compression algorithm in the first embodiment.

[0120] The embodiment of the present invention further discloses a computer program product, wherein when the computer program product is run on a computer, the computer is enabled to execute part or all of the steps in the ECU flash update method based on the compression algorithm in the first embodiment.

[0121] An embodiment of the present invention also discloses an application publishing platform, wherein the application publishing platform is used to publish a computer program product, wherein when the computer program product runs on a computer, the computer executes part or all of the steps in the ECU flash update method based on the compression algorithm in Embodiment 1.

[0122] In various embodiments of the present invention, it should be understood that the size of the serial numbers of the processes does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0123] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, i.e., they may be located in one place or distributed over multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0124] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0125] If the integrated 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-accessible memory. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a memory and includes several requests to enable a computer device (which can be a personal computer, server or network device, etc., specifically a processor in a computer device) to perform some or all steps of the method described in each embodiment of the present invention.

[0126] In the embodiments provided by the present invention, it should be understood that "B corresponding to A" means that B is associated with A, and B can be determined according to A. However, it should also be understood that determining B according to A does not mean determining B only according to A, and B can also be determined according to A and / or other information.

[0127] A person of ordinary skill in the art may understand that part or all of the steps in the various methods of the embodiments may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, the storage medium including a read-only memory (ROM), a random access memory (RAM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a one-time programmable read-only memory (OTPROM), an electronically-erasable programmable read-only memory (EEPROM), a compact disc (CD-ROM) or other optical disc storage, magnetic disk storage, magnetic tape storage, or any other computer-readable medium that can be used to carry or store data.

[0128] The above is a detailed introduction to the ECU flash update method, system, electronic device and storage medium based on the compression algorithm disclosed in the embodiments of the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for general technicians in this field, according to the ideas of the present invention, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. An ECU flash update method based on a compression algorithm, characterized in that: include: The acquired update data file is parsed to obtain the starting address field and update data content in the update data file; the update data file includes a compressed data file; the compressed data file is obtained by the following steps: Receiving an original update file, parsing the original update file into a plurality of original data segments, each of which includes original address information and original data information; wherein the original update file is a HEX file; Traversing all original data segments, grouping each original data segment according to the continuity of the original address information to obtain a plurality of compressed data blocks, wherein the compressed data blocks include compressed address information, and the continuous original data segments are taken as the same compressed data block; Reading original data content associated with the compressed address information, and converting the corresponding original data content into original binary data; Searching for a repetitive sequence in the original binary data, obtaining corresponding compression mark information according to the repetitive sequence, and updating the compressed data block according to the compression mark information until all compressed data blocks are processed, wherein the compression mark information includes a compression length and a compression offset; searching for a repetitive sequence in the original binary data, and obtaining corresponding compression mark information according to the repetitive sequence, comprises: before compression begins, initializing a hash table of a fixed size; wherein each entry in the hash table stores a position index and a matching length; searching for a repetitive sequence in the original binary data through a sliding window, and calculating a hash value corresponding to the data under the corresponding sliding window by setting a hash function; searching for an element corresponding to the hash value in the hash table, and if the corresponding element is empty, it indicates that no data block with the same hash value has been matched before, and the corresponding element is updated according to the obtained hash value; if the corresponding element is not empty, it indicates that the position information of the data block with the same hash value is stored; and checking whether the current data block is the same as the matched data block; if they are the same, replacing the corresponding repetitive sequence according to the compression length and the compression offset; Combining and generating a compressed data file according to the compressed address information of each compressed data block; Performing data matching with a pre-configured address mapping table according to the start address field to determine whether the corresponding start address information is a compressed data block address, and if not, receiving update data content in the update data file, and writing the update data content into a FLASH storage module of the vehicle ECU; If yes, then obtain the corresponding compressed data information according to the compressed data block address until the complete compressed data information is obtained; The complete compressed data information is decompressed according to a set compression algorithm to obtain decompressed update data, and the decompressed update data is written into the FLASH storage module of the vehicle ECU.

2. The ECU flash update method based on compression algorithm as claimed in claim 1, characterized in that: After the compressed data file is generated by combining the compressed address information of each compressed data block, the method further includes: Determine first length information of each compressed data block, and determine second length information of the compressed data file according to the first length information of each compressed data block; Determine whether the second length information is not greater than the set length information. If so, fill the end identifier to the end of the compressed data file until the length of the compressed data file reaches the set length. If not, perform an alarm operation.

3. The ECU flash update method based on compression algorithm as claimed in claim 2, characterized in that: After the compressed data file is generated by combining the compressed address information of each compressed data block, the method further includes: Converting the compressed data file into a HEX file format; The set length information is 50% of the file length of the original update file.

4. The ECU flash update method based on compression algorithm as claimed in claim 1, characterized in that: The decompressing the complete compressed data information according to the set compression algorithm to obtain the decompressed update data includes: The complete compressed data information is read according to the set compression algorithm, and the compressed length, compressed offset and literal information in the compressed data information are obtained; and the original data is restored according to the compressed length, compressed offset and literal information.

5. The ECU flash update method based on compression algorithm as claimed in claim 1, characterized in that: After the writing into the FLASH storage module of the vehicle ECU, the method further includes: A cyclic redundancy check algorithm is used to check and calculate the updated data content written into the FLASH storage module of the vehicle ECU or the decompressed updated content to obtain a redundancy check result; The redundancy check result is compared with the redundancy calculation result of the original update data file to determine whether the data in the FLASH storage module of the vehicle ECU is correct.

6. An ECU flash update system based on compression algorithm, characterized in that: include: Parsing module: used to parse the acquired update data file to obtain the starting address field and update data content in the update data file; the update data file includes a compressed data file; the compressed data file is obtained by the following steps: Receiving an original update file, parsing the original update file into a plurality of original data segments, each of which includes original address information and original data information; wherein the original update file is a HEX file; Traversing all original data segments, grouping each original data segment according to the continuity of the original address information to obtain a plurality of compressed data blocks, wherein the compressed data blocks include compressed address information, and the continuous original data segments are regarded as the same compressed data block; Reading original data content associated with the compressed address information, and converting the corresponding original data content into original binary data; Searching for a repetitive sequence in the original binary data, obtaining corresponding compression mark information according to the repetitive sequence, and updating the compressed data block according to the compression mark information until all compressed data blocks are processed, wherein the compression mark information includes a compression length and a compression offset; searching for a repetitive sequence in the original binary data, and obtaining corresponding compression mark information according to the repetitive sequence, comprises: before compression begins, initializing a hash table of a fixed size; wherein each entry in the hash table stores a position index and a matching length; searching for a repetitive sequence in the original binary data through a sliding window, and calculating a hash value corresponding to the data under the corresponding sliding window by setting a hash function; searching for an element corresponding to the hash value in the hash table, and if the corresponding element is empty, it indicates that no data block with the same hash value has been matched before, and the corresponding element is updated according to the obtained hash value; if the corresponding element is not empty, it indicates that the position information of the data block with the same hash value is stored; and checking whether the current data block is the same as the matched data block; if they are the same, replacing the corresponding repetitive sequence according to the compression length and the compression offset; Combining and generating a compressed data file according to the compressed address information of each compressed data block; A judgment module: used to perform data matching with a pre-configured address mapping table according to the starting address field to determine whether the corresponding starting address information is a compressed data block address, and if not, receive the update data content in the update data file, and write the update data content into the FLASH storage module of the vehicle ECU; Data acquisition module: used for acquiring corresponding compressed data information according to the compressed data block address until the complete compressed data information is acquired; Decompression module: used to decompress the complete compressed data information according to the set compression algorithm to obtain decompressed update data, and write the decompressed update data into the FLASH storage module of the vehicle ECU.

7. An electronic device, characterized in that: include: A memory storing executable program code; a processor coupled to the memory; The processor calls the executable program code stored in the memory to execute the ECU flash update method based on the compression algorithm as described in any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program enables a computer to execute the ECU flash update method based on a compression algorithm as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Method and system for transmitting a data file over a data network

    CN101523732A

  • Synchronous orthogonal frequency-hopping radio sorting method for odd number of user L-G models

    CN107528611A