Compression algorithm-based ECU reflash update method and system
By using a compression algorithm to process ECU update data, the problem of limited ECU program update speed is solved, resulting in a faster update process and higher reliability.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2025-02-14
- Publication Date
- 2026-04-02
AI Technical Summary
In existing technologies, the speed of ECU program updates is limited by physical factors, resulting in high time costs during production and maintenance.
Compression algorithms are used to process the updated data. Through parsing, compression, and decompression operations, the amount of data transmitted is reduced and the update efficiency is improved.
It significantly reduces data transmission time, lowers dependence on communication network bandwidth, and improves the efficiency and reliability of the update process.
Smart Images

Figure CN2025077390_02042026_PF_FP_ABST
Abstract
Description
ECU flashing update method and system based on compression algorithm TECHNICAL FIELD
[0001] The present application relates to the technical field of program updating, in particular to an ECU flashing update method and system based on compression algorithm. BACKGROUND
[0002] At present, after the PCBA is assembled into the ECU, the program update can only be performed through the BootLoader because there is no external debugging interface. The updated program file can only be updated in the Can or CanFD mode on some components, so that the update speed is limited by physical factors, and the program update time is directly limited. The above-mentioned limitation makes the time cost particularly high when the program update is performed in production or later maintenance. Therefore, it is an urgent technical problem for those skilled in the art to design a scheme capable of improving the overall update speed. SUMMARY
[0003] In view of the above-mentioned defects, the embodiment of the present application discloses an ECU flashing update method based on compression algorithm, which can shorten the flashing update time and improve the update efficiency.
[0004] The first aspect of the embodiment of the present application discloses an ECU flashing update method based on compression algorithm, comprising:
[0005] The obtained update data file is parsed to obtain the start address field and the update data content in the update data file;
[0006] The start address field is matched with the pre-configured address mapping table to determine whether the corresponding start 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;
[0007] If yes, the corresponding compressed data information is obtained 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 the 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 application, the to-be-updated file includes a compressed data file; the compressed data file is obtained through the following steps:
[0010] Receiving an original update file, parsing the original update file into a plurality of original data segments, each of which comprises 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 block comprises compressed address information, and continuous original data segments are as a 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 repeated sequence in the original binary data, obtaining corresponding compressed marker information according to the repeated sequence, and performing data update on the compressed data block according to the compressed marker information until the processing of all compressed data blocks is completed, wherein the compressed marker information comprises a compressed length and a compressed offset;
[0014] Combining and generating a compressed data file according to the compressed address information of each compressed data block.
[0015] As an optional implementation, after the compressed data file is generated according to the compressed address information of each compressed data block in the first aspect of the embodiment of the present application, the method further comprises:
[0016] Determining first length information of each compressed data block, and determining second length information of the compressed data file according to the first length information of each compressed data block;
[0017] Determining whether the second length information is not greater than set length information, if yes, filling an end identifier to the tail of the compressed data file until the length of the compressed data file reaches the set length, and if no, performing an alarm operation.
[0018] As an optional implementation, after the compressed data file is generated according to the compressed address information of each compressed data block in the first aspect of the embodiment of the present application, the method further comprises:
[0019] Converting the format of 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, in the first aspect of the embodiment of the present application, the finding of the repeated sequence in the original binary data, and the obtaining of corresponding compressed marker information according to the repeated sequence, comprises:
[0022] Before compression starts, a hash table of fixed size is initialized, wherein each entry of the hash table stores a position index and a matching length;
[0023] The repeated sequence in the original binary data is found by using a sliding window, and a hash value corresponding to the data in the sliding window is calculated by setting a hash function;
[0024] The element corresponding to the hash value in the hash table is found, and if the corresponding element is empty, it indicates that no data block with the same hash value has been matched before; the corresponding element is updated according to the obtained hash value;
[0025] 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 it is checked whether the current data block is the same as the matched data block; if yes, the corresponding repeated sequence is replaced according to the compression length and the compression offset.
[0026] As an optional implementation, in the first aspect of the embodiment of the present application, the decompression operation on the complete compressed data information according to the set compression algorithm to obtain the decompression update data comprises:
[0027] The complete compressed data information is read according to the set compression algorithm, and the compression length, the compression offset and the literal quantity information in the compressed data information are obtained; and the original data is recovered according to the compression length, the compression offset and the literal quantity information.
[0028] As an optional implementation, in the first aspect of the embodiment of the present application, after being written into the FLASH storage module of the vehicle ECU, the method further comprises:
[0029] The cyclic redundancy check algorithm is used to perform a check calculation on the update data content or the decompression update content written into the FLASH storage module of the vehicle ECU to obtain a redundancy check result;
[0030] 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.
[0031] The second aspect of the embodiment of the present application discloses an ECU flashing update system based on a compression algorithm, comprising:
[0032] The analysis module is used to analyze the obtained update data file to obtain a start address field and update data content in the update data file;
[0033] A judging module is configured to perform data matching between the start address field and a preconfigured address mapping table to determine whether the corresponding start address information is a compressed data block address, and if not, receive update data content in the update data file and write the update data content into a FLASH storage module of the vehicle ECU.
[0034] A data acquisition module is configured to acquire corresponding compressed data information according to the compressed data block address until complete compressed data information is acquired, if the corresponding start address information is a compressed data block address.
[0035] A decompression module is configured to perform decompression operation on the complete compressed data information according to a set compression algorithm to obtain decompressed update data, and write the decompressed update data into the FLASH storage module of the vehicle ECU.
[0036] The third aspect of the embodiment of the present application discloses an electronic device, which comprises a memory storing executable program code, and a processor coupled with the memory; the processor invokes the executable program code stored in the memory, and is configured to execute the ECU flashing update method based on a compression algorithm disclosed in the first aspect of the embodiment of the present application.
[0037] The fourth aspect of the embodiment of the present application discloses a computer readable storage medium storing a computer program, wherein the computer program causes a computer to execute the ECU flashing update method based on a compression algorithm disclosed in the first aspect of the embodiment of the present application.
[0038] Compared with the prior art, the embodiment of the present application has the following beneficial effects:
[0039] The ECU flashing update method based on a compression algorithm in the embodiment of the present application can significantly reduce the amount of data to be transmitted by processing the update data by using a compression algorithm. In the update process of the vehicle ECU, especially when the update file is large, this advantage is particularly obvious. Reducing the amount of data transmission not only can accelerate the download speed, but also can reduce the dependence on the bandwidth of the communication network, and improve the efficiency and reliability of the update process. BRIEF DESCRIPTION OF DRAWINGS
[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiments will be briefly introduced as follows. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0041] FIG. 1 is a flowchart of the ECU flashing update method based on a compression algorithm disclosed in the embodiment of the present application;
[0042] Fig. 2 is a specific flowchart of data compression disclosed by the embodiment of the present application;
[0043] Fig. 3 is a flowchart of compression update disclosed by the embodiment of the present application;
[0044] Fig. 4 is a structural diagram of an ECU flashing update system based on a compression algorithm provided by the embodiment of the present application;
[0045] Fig. 5 is a structural diagram of an electronic device provided by the embodiment of the present application. DETAILED DESCRIPTION
[0046] The technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings of the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative work fall within the scope of protection of the present application.
[0047] It should be noted that the terms "first", "second", "third", "fourth" and the like in the specification and claims of the present application are used to distinguish different objects, rather than to describe a specific order. The terms "include" and "have" and any variations thereof in the embodiments of the present application are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device including a series of steps or units does not have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to the process, method, product or device.
[0048] At present, after the PCBA is assembled into an ECU, there is no debugging interface outside, so that program update can only be performed through BootLoader. Since the updated program file can only be updated in a Can or CanFD manner on some components, the update speed is limited by physical factors, and thus the program update time is directly limited. The above limitations make the time cost particularly high when performing program update in production or later maintenance. Based on this, the embodiment of the present application discloses an ECU flashing update method, system, electronic device and storage medium based on a compression algorithm, which can significantly reduce the amount of data to be transmitted by using a compression algorithm to process update data. In the update process of a vehicle ECU, especially when the update file is large, this advantage is particularly obvious. Reducing the data transmission amount not only can speed up the download speed, but also can reduce the dependence on the communication network bandwidth, improve the efficiency and reliability of the update process.
[0049] Embodiment one
[0050] Please refer to Fig. 1, which is a flowchart of the ECU flashing update method based on compression algorithm disclosed by the embodiment of the present application. The execution subject of the method described in the embodiment of the present application is an execution subject composed of software or / and hardware, which can receive relevant information through wired or / and wireless mode and can send certain instructions. Of course, it can also have certain processing function and storage function. The execution subject can control multiple devices, such as remote physical servers or cloud servers and related software, or local host or server and related software for performing relevant operations on devices placed somewhere. In some scenarios, it can also control multiple storage devices, which can be placed in the same place or different places as the devices. As shown in Fig. 1, the ECU flashing update method based on compression algorithm includes the following steps:
[0051] S101: parsing the obtained update data file to obtain the start address field and update data content in the update data file;
[0052] S102: performing data matching between the start address field and the pre-configured address mapping table to determine whether the corresponding start address information is a compressed data block address, if not, receiving the update data content in the update data file and writing the update data content into the FLASH storage module of the vehicle ECU;
[0053] S103: if yes, obtaining the corresponding compressed data information according to the compressed data block address until the complete compressed data information is obtained;
[0054] S104: decompressing the complete compressed data information according to the set compression algorithm to obtain decompressed update data and writing the decompressed update data into the FLASH storage module of the vehicle ECU.
[0055] The scheme of the embodiment of the present application can significantly reduce the amount of data to be transmitted by using compression algorithm to process the update data. In the update process of the vehicle ECU, especially when the update file is large, this advantage is particularly obvious. Reducing the amount of data transmission not only can speed up the download speed, but also can reduce the dependence on the bandwidth of the communication network, 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 transmission, the risk of interception or tampering of the data during transmission 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.
[0056] The method of the embodiment of the application judges whether the data is a compressed data block through an address mapping table, which means that it can flexibly process different types of update data. Whether compressed data or uncompressed data, it can be processed according to the established process, improving the compatibility and flexibility of the system.
[0057] The flashing process of the scheme of the embodiment of the application: because the data is compressed, multiple checks are needed to prevent data loss during decompression. The data in the transmission process is subjected to crc check, and the communication parties compare the crc check values of the sent and received data. The original data is subjected to crc check, and the crc result is added to the last of the data. After the transmission process is checked, the MCU performs crc check on the decompressed data and compares it with the crc result added to the last of the data.
[0058] The decompression process of the scheme of the embodiment of the application: because of the limitation of the RAM and flash space of the MCU, and considering the time factor of reading and writing the flash, all the compressed data cannot be stored in the MCU memory and decompressed together, so the data is decompressed while being received. When the produced ECU products need to be updated uniformly, the time for updating each product can be saved by half, thereby saving a large amount of manpower. The key point of the scheme of the embodiment of the application is to process compressed and uncompressed data compatibly, to ensure the flashing function, to fix the length of the flashing file, and to save the flashing time.
[0059] More preferably, as shown in FIG. 2, the to-be-updated file includes a compressed data file; the compressed data file is obtained through the following steps:
[0060] S100a: receiving an original update file, parsing the original update file into a plurality of original data segments, each original data segment including original address information and original data information; wherein the original update file is a HEX file;
[0061] S100b: 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 block includes compressed address information, and consecutive original data segments are the same compressed data block;
[0062] S100c: reading the original data content associated with the compressed address information, and converting the corresponding original data content into original binary data;
[0063] S100d: finding repeated sequences in the original binary data, obtaining corresponding compression marker information according to the repeated sequences, and performing data update on the compressed data blocks according to the compression marker information until the processing of all the compressed data blocks is completed, wherein the compression marker information includes a compression length and a compression offset;
[0064] S100e: combining and generating a compressed data file according to the compression address information of each compressed data block.
[0065] Since the original file can be HEX data with multiple discontinuous addresses, multiple discontinuous compressed data can be generated by judging the continuity of the addresses. If a HEX data is composed of two address data, two compressed data can be generated according to the two address data. A combined HEX file can be regenerated by the first address of the data.
[0066] The present application is a specific process of compressing an original update file to obtain a compressed data file. In the embodiment of the present application, each pair of hexadecimal characters (such as "4A" representing 74 in decimal and 01001010 in binary) in the HEX file needs to be converted into a corresponding single byte. This process is a process of decoding the HEX string, and the result is a binary data stream. The compression algorithm in the embodiment of the present application is a dictionary-based compression algorithm, which uses repeated patterns (i.e. "phrases" in the dictionary) in the data to reduce storage space. In the compression process, the compression algorithm in the embodiment of the present application finds repeated sequences in the input data and replaces these repeated sequences with a shorter marker (usually a length and an offset). In this way, when decompressing, the algorithm can use these markers and the previously decompressed data to reconstruct the original data.
[0067] The compression algorithm in the embodiment of the present application can achieve high compression and decompression speed, which makes it very suitable for scenarios that require fast processing of large amounts of data. Although the compression ratio of the compression algorithm in the embodiment of the present application can not be as high as some other algorithms, it can usually achieve a good balance between reasonable compression rate and speed. The memory usage of the compression algorithm in the embodiment of the present application is also very low, which is particularly important for resource-limited environments, so it is particularly suitable for flashing vehicle ECUs.
[0068] In the embodiment of the present application, 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 HEX string), the binary data can be converted into HEX string again.
[0069] Specifically, the scheme of the embodiment of the present application can effectively identify and compress repeated data sequences in the file by analyzing the original update file (such as a HEX file) and further grouping and compressing according to address continuity after the original update file is segmented into original data segments. This compression mechanism significantly reduces the size of the finally generated compressed data file, thereby reducing the storage space occupation and bandwidth demand in the network transmission process. In the update process, due to the reduction of the size of the compressed data file, the download, transmission and decompression time are all correspondingly reduced. This not only speeds up the entire update process, but also reduces the user waiting time and improves the user experience.
[0070] More preferably, after the compressed data file is generated according to the compressed address information of each compressed data block, the method further comprises:
[0071] determining first length information of each compressed data block, and determining second length information of the compressed data file according to the first length information of each compressed data block;
[0072] determining whether the second length information is not greater than the set length information, if yes, filling an end identifier to the tail of the compressed data file until the length of the compressed data file reaches the set length, and if not, performing an alarm operation.
[0073] The scheme of the embodiment of the present application can accurately master the actual size of the entire compressed data file by determining the first length information of each compressed data block and calculating the second length information of the compressed data file. On this basis, by filling the end identifier to the file tail 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 analyzing the compressed data file, avoiding analysis errors caused by inconsistent file lengths.
[0074] Setting the file length requirement and filling the end identifier make the generated compressed data file comply with certain format specifications. This standardized file format not only facilitates management and maintenance, but also helps to improve the compatibility and interoperability between different systems or platforms.
[0075] When the second length information of the compressed data file exceeds the set length information, the system performs an alarm operation. This mechanism can enable the user to discover problems in time, such as errors in the data compression process, too large original data file, etc. Through the alarm operation, the user 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.
[0076] More preferably, after the compressed data file is generated according to the compressed address information of each compressed data block, the method further comprises:
[0077] The format conversion of the compressed data file is converted into a HEX file format;
[0078] The set length information is 50% of the file length of the original update file.
[0079] Since the length of the compressed file is not fixed, 50% of the original data length is set as the length of the generated data. The compression algorithm of the embodiment of the present application uses 0 as an identifier to mark the end of the file after completing compression, and 0 is used to fill in the insufficient length, so as to fix the file length. Due to the specificity of the compression algorithm, the general algorithm will have an ending mark character or character segment. Different compression algorithms have different ending marks. In the embodiment of the present application, 0 is used as the ending mark.
[0080] If the length of the compressed file is longer than 50% of the original data, the original data file is used. Through the above-mentioned manner, the compressed file and the non-compressed file can be well compatible. Since the refresh file used by the vehicle manufacturer or the 4S store has many limitations on the file format, most devices may not support the indefinite length file, so the fixed length setting method is adopted in the embodiment of the present application, so that the compressed file is easy to be recognized.
[0081] More preferably, as shown in FIG. 3, the repeated sequence in the original binary data is found, and the corresponding compression mark information is obtained according to the repeated sequence, including:
[0082] S100d1: initializing a hash table with a fixed size before compression starts; wherein each entry of the hash table stores a position index and a matching length;
[0083] S100d2: finding the repeated sequence in the original binary data through a sliding window, and calculating the hash value of the data corresponding to the sliding window through a set hash function;
[0084] S100d3: finding the element corresponding to the hash value in the hash table. If the corresponding element is empty, it indicates that no data block with the same hash value has been matched before. The corresponding element is updated according to the obtained hash value;
[0085] S100d4: 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 yes, replacing the corresponding repeated sequence according to the compression length and the compression offset.
[0086] The core of the compression algorithm of the embodiments of the present application is to identify repeated sequences (also called "phrases" or "patterns") in the input data stream. These repeated sequences can be identical byte sequences that can appear at different positions in the data. To efficiently find these repeated sequences, the compression algorithm of the embodiments of the present application employs a hash table or similar fast lookup mechanism. During the compression process, the compression algorithm of the embodiments of the present application maintains a hash table that is used to quickly map a data block to its last occurrence. When processing a new data block, the algorithm calculates the hash value of the data block and looks up in the hash table whether there is an identical hash value already exists. If so, it further checks whether the two data blocks are indeed identical.
[0087] If a matching repeated sequence is found, the compression algorithm of the embodiments of the present application replaces the sequence in the original data with a shorter marker. This marker usually contains two key pieces of information: length information: indicates the length of the repeated sequence, i.e. the number of bytes that need to be replaced. offset information: indicates the distance between the current position and the last occurrence position of the repeated sequence. In this way, the repeated sequence in the original data is replaced by a shorter marker, thereby reducing the storage space requirement.
[0088] During the compression process, the compression algorithm of the embodiments of the present application traverses the input data, constantly looking for and replacing repeated sequences, until all data is processed. The final generated is a compressed data stream containing the original data and replacement markers.
[0089] Since the size of the hash table is limited, while the input data is infinite, hash collision is inevitable. In the compression algorithm of the embodiments of the present application, the method of handling hash collision is usually handled by the method of chaining address, that is, when a hash collision is found, instead of stopping the search immediately, the search is continued in a certain position of the hash table (such as the next position of the bucket), until an empty bucket is found or a matching data block is found.
[0090] The sliding window mentioned in the embodiments of the present application is a technique used in data compression and decompression process, which maintains a fixed size data buffer for storing the recently processed data blocks. This buffer is like a window, sliding on the data stream, finding repeated patterns or data blocks by comparing the similarity of the current data block and the data in the window.
[0091] The compression algorithm of the present embodiment utilizes a sliding window to quickly find duplicates of the current data block in previously processed data. As the algorithm processes new data blocks, it compares this data block with the data within the sliding window to find possible matches. By utilizing the data within the sliding window, the compression algorithm of the present embodiment is able to identify and replace duplicate data blocks, significantly reducing the amount of data that needs to be stored or transmitted. This replacement is typically achieved by referencing the offset and length of the data within the window, rather than directly storing the duplicate data.
[0092] The sliding window allows the compression algorithm of the present embodiment to remain efficient when processing continuous data streams. As the data stream is continuously inputted, the window slides forward while retaining the latest data blocks for subsequent comparisons. This mechanism enables the compression algorithm of the present embodiment to compress and decompress data streams in real-time.
[0093] The size of the sliding window of the present embodiment is fixed, meaning it can only store a limited number of data blocks. As the window slides forward, the earliest data blocks are removed from the window, making space for new data blocks. The content of the sliding window is continuously updated as the data stream is inputted. This dynamic updating mechanism enables the compression algorithm of the present embodiment to always focus on the latest data blocks and find duplicate patterns within them. By utilizing the data within the sliding window, the compression algorithm of the present embodiment is able to significantly reduce the amount of compressed data while maintaining a high compression and decompression speed.
[0094] More preferably, the decompression operation of the complete compressed data information according to the set compression algorithm to obtain the decompressed updated data comprises:
[0095] According to the set compression algorithm, the complete compressed data information is read, and the compression length, compression offset, and literal quantity information in the compressed data information are obtained. The original data is recovered according to the compression length, compression offset, and literal quantity information.
[0096] During the decompression process, the compression algorithm of the present embodiment reads the compressed data stream and, according to the length and offset information in the marker, copies the corresponding byte sequence from the previously decompressed data to recover the original data. This process does not require additional storage space to store dictionaries or hash tables, as all necessary information is contained in the compressed data stream.
[0097] The compression algorithm of the embodiments of the present application can achieve extremely fast compression and decompression speeds while maintaining a relatively high compression ratio, partly due to the ingenuity of its algorithm design. For example, it uses a fast hash function to reduce lookup time while limiting the size of the hash table to avoid excessive memory consumption. In addition, the compression algorithm of the embodiments of the present application also reduces the CPU cache miss rate through a series of optimization measures, thereby further improving performance. The compression algorithm of the embodiments of the present application focuses on the speed of compression and decompression, especially the decompression speed, and although its compression ratio is not as high as some other algorithms, it is sufficient to meet many scenarios that require fast processing of large amounts of data.
[0098] The compression algorithm of the embodiments of the present application is known for its extremely high compression and decompression speed, especially in terms of decompression speed, which can almost approach the speed of memory copying. In contrast, the compression speed of LZSS may be slightly slower because its matching mechanism is relatively complex.
[0099] More preferably, after being written into the FLASH storage module of the vehicle ECU, it further comprises:
[0100] The update data content or decompressed update content written into the FLASH storage module of the vehicle ECU is checked and calculated using the cyclic redundancy check algorithm to obtain a redundancy check result;
[0101] 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.
[0102] During data transmission, both parties of communication (such as the host computer and the ECU) will compare the CRC (cyclic redundancy check) check values of the sent and received data. This is to ensure that the data has not been tampered with or damaged during transmission. If the CRC check values do not match, it means that there may be a problem during data transmission, at which time the data needs to be re-sent or other remedial measures need to be taken.
[0103] Before the data is compressed, the original data will be CRC calculated, and the CRC result will be transmitted as part of the data (usually added to the end of the data). This is done to verify the integrity of the data again after decompression. If the decompressed data does not match the CRC result of the original data, it means that there may be a problem during compression, transmission, or decompression.
[0104] After receiving the compressed data, the ECU first performs CRC check to confirm that the data has not been tampered during transmission. Then, the ECU uses the pre-configured decompression algorithm to decompress the data. After decompression, the ECU performs CRC check on the data again and compares the result with the CRC result at the end of the data. If the two results match, it means that the data has not been tampered during transmission and decompression; if not, appropriate error handling measures need to be taken.
[0105] The ECU flashing update method based on compression algorithm in the embodiment of the present application can significantly reduce the amount of data to be transmitted by processing the update data using a compression algorithm. This advantage is particularly evident in the update process of vehicle ECU, especially when the update file is large. Reducing the amount of data transmission not only speeds up the download, but also reduces the dependence on the bandwidth of the communication network, improves the efficiency and reliability of the update process.
[0106] Embodiment two
[0107] Please refer to FIG. 4, which is a structural schematic diagram of the ECU flashing update system based on compression algorithm disclosed by the embodiment of the present application. As shown in FIG. 4, the ECU flashing update system based on compression algorithm can include:
[0108] The parsing module 21 is configured to parse the obtained update data file to obtain the start address field and the update data content in the update data file;
[0109] The judging module 22 is configured to perform data matching between the start address field and the pre-configured address mapping table to determine whether the corresponding start address information is a compressed data block address. If not, the update data content in the update data file is received and written into the FLASH storage module of the vehicle ECU;
[0110] The data acquisition module 23 is configured to, if yes, acquire the corresponding compressed data information according to the compressed data block address until the complete compressed data information is acquired;
[0111] The decompression module 24 is configured to perform decompression operation on 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.
[0112] The ECU flashing update method based on compression algorithm in the embodiment of the present application can significantly reduce the amount of data to be transmitted by processing the update data using a compression algorithm. This advantage is particularly evident in the update process of vehicle ECU, especially when the update file is large. Reducing the amount of data transmission not only speeds up the download, but also reduces the dependence on the bandwidth of the communication network, improves the efficiency and reliability of the update process.
[0113] Embodiment three
[0114] Referring to FIG. 5, FIG. 5 is a structural schematic diagram of an electronic device disclosed by an embodiment of the present application. The electronic device can be a computer, a server, and the like, and of course, in certain cases, can also be a smart device such as a mobile phone, a tablet computer, a monitoring terminal, and the like, and an image acquisition device having a processing function. As shown in FIG. 5, the electronic device can include:
[0115] a memory 510 storing executable program codes;
[0116] a processor 520 coupled with the memory 510;
[0117] The processor 520 calls the executable program codes stored in the memory 510 to execute part or all of the steps in the ECU flashing update method based on the compression algorithm in Embodiment one.
[0118] An embodiment of the present application discloses a computer readable storage medium storing a computer program, wherein the computer program causes a computer to execute part or all of the steps in the ECU flashing update method based on the compression algorithm in Embodiment one.
[0119] An embodiment of the present application further discloses a computer program product, wherein when the computer program product runs on a computer, the computer program product causes the computer to execute part or all of the steps in the ECU flashing update method based on the compression algorithm in Embodiment one.
[0120] An embodiment of the present application further discloses an application publishing platform, wherein the application publishing platform is used to publish a computer program product, and when the computer program product runs on a computer, the computer program product causes the computer to execute part or all of the steps in the ECU flashing update method based on the compression algorithm in Embodiment one.
[0121] In various embodiments of the present application, it should be understood that the size of the serial number of the processes does not mean the inevitable sequence of execution, and the execution sequence of the processes should be determined according to their functions and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0122] The units described as separate components can or can not be physically separated, and the components displayed as units can or can not be physical units, i.e., can be located in one place, or can be distributed on multiple network units. According to actual needs, part or all of the units can be selected to achieve the purpose of the embodiment of the present application.
[0123] In addition, each function unit in each embodiment of the present application can be integrated in one processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software function unit.
[0124] When the integrated unit is realized in the form of a software function unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solutions of the present application, essentially or in the form of a part or all of the technical solutions that contribute to the prior art, or the entire technical solutions, can be embodied in the form of a software product. The computer software product is stored in a memory and includes several steps for causing one computer device (which can be a personal computer, a server or a network device, and specifically can be a processor in the computer device) to execute the methods of the embodiments of the present application.
[0125] In the embodiments provided by the present application, 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 the determination of B according to A does not mean that B is determined only according to A, but B can also be determined according to A and / or other information.
[0126] A person of ordinary skill in the art can understand that some or all of the steps in the various methods of the embodiments can be instructed by a program to relevant hardware, and the program can be stored in a computer-readable 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 electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disk storage, a magnetic disk storage, a magnetic tape storage, or any other computer readable medium that can be used to carry or store data.
[0127] The ECU flashing update method and system based on the compression algorithm, the electronic device and the storage medium are described in detail above, and the principles and implementation manners of the present application are described by using specific examples. The above description of the embodiments is only used to help understand the method of the present application and its core idea; at the same time, for those skilled in the art, according to the idea of the present application, the specific implementation manner and application range will be changed, and the above description should not be understood as a limitation of the present application.
Claims
1. An ECU flashing update method based on a compression algorithm, characterized in that, The method comprises the following steps: parsing the obtained update data file to obtain a start address field and update data content in the update data file; the update data file comprises a compressed data file; the compressed data file is obtained by the following steps: receiving an original update file, and parsing the original update file into a plurality of original data segments, each of which comprises original address information and original data information; wherein the original update file is a HEX file; traversing all the original data segments, and grouping each of the original data segments according to the continuity of the original address information to obtain a plurality of compressed data blocks, wherein the compressed data blocks comprise compressed address information, and continuous original data segments are taken as the same compressed data block; reading the original data content associated with the compressed address information, and converting the corresponding original data content into original binary data; finding a repeated sequence in the original binary data, obtaining corresponding compression marker information according to the repeated sequence, and performing data update on the compressed data blocks according to the compression marker information until the processing of all the compressed data blocks is completed; the compression marker information comprises a compression length and a compression offset; the finding of the repeated sequence in the original binary data and the obtaining of the corresponding compression marker information comprise the following steps: before compression starts, initializing a hash table with a fixed size; each entry of the hash table stores a position index and a matching length; finding the repeated sequence in the original binary data through a sliding window, and calculating the hash value of the data in the corresponding sliding window through a hash function; finding the element corresponding to the hash value in the hash table; 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, the corresponding repeated sequence is replaced according to the compression length and the compression offset; generating a compressed data file according to the compressed address information of each compressed data block; performing data matching according to the start address field and a preconfigured address mapping table to determine whether the corresponding start address information is a compressed data block address; if not, receiving the update data content in the update data file, and writing the update data content into a FLASH storage module of a vehicle ECU; if yes, obtaining the corresponding compressed data information according to the compressed data block address until the complete compressed data information is obtained; performing decompression operation on 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.
2. The ECU flashing update method based on compression algorithm according to claim 1, characterized in that, After the generation of the compressed data file according to the compressed address information of each compressed data block, the method further comprises the following steps: determining the first length information of each compressed data block, and determining the 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 yes, fill the end identifier to the tail of the compressed data file until the length of the compressed data file reaches the set length, if not, perform the alarm operation.
3. The ECU flashing update method based on compression algorithm according to 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 comprises: Converting the format of 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 flashing update method based on compression algorithm according to claim 1, characterized in that, The decompression operation on the complete compressed data information according to the set compression algorithm to obtain the decompressed update data comprises: Reading the complete compressed data information according to the set compression algorithm, and obtaining the compressed length, the compressed offset and the literal quantity information in the compressed data information; and restoring the original data according to the compressed length, the compressed offset and the literal quantity information.
5. The ECU flashing update method based on compression algorithm according to claim 1, characterized in that, After the update data is written into the FLASH storage module of the vehicle ECU, the method further comprises: Using a cyclic redundancy check algorithm to perform a check calculation on the update data content or the decompressed update content written into the FLASH storage module of the vehicle ECU to obtain a redundancy check result; And comparing the redundancy check result with a 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, The method comprises: The analysis module is used for analyzing the obtained update data file to obtain a start address field and update data content in the update data file; the update data file comprises a compressed data file; the compressed data file is obtained by the following steps: Receiving an original update file, and analyzing the original update file into a plurality of original data segments; each original data segment comprises original address information and original data information; wherein the original update file is a HEX file; Traversing all the 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 block comprises compressed address information, and continuous original data segments are taken as the same compressed data block; Reading the original data content associated with the compressed address information, and converting the corresponding original data content into original binary data; finding a repeated sequence in the original binary data, obtaining corresponding compression marker information according to the repeated sequence, and performing data updating on a compressed data block according to the compression marker information until processing of all compressed data blocks is completed, the compression marker information including a compression length and a compression offset; the finding a repeated sequence in the original binary data and obtaining corresponding compression marker information includes: before compression starts, initializing a hash table of a fixed size; each entry of the hash table stores a position index and a matching length; finding a repeated sequence in the original binary data by using a sliding window, and calculating a hash value corresponding to data in the sliding window by setting a hash function; finding an element corresponding to the hash value in the hash table, if the corresponding element is empty, indicating that no data block with the same hash value has been matched before, updating the corresponding element according to the obtained hash value; if the corresponding element is not empty, indicating that 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 yes, replacing the corresponding repeated sequence according to the compression length and the compression offset; generating a compressed data file by combining according to compression address information of each compressed data block; a judging module configured to determine whether the corresponding start address information is a compressed data block address according to data matching between the start address field and a preconfigured address mapping table, 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; a data obtaining module configured to, if yes, obtaining corresponding compressed data information according to the compressed data block address until complete compressed data information is obtained; a decompression module configured to performing decompression operation on the complete compressed data information according to a set compression algorithm to obtain decompression update data, and writing the decompression update data into the FLASH storage module of the vehicle ECU.
7. An electronic device, comprising: comprise: a memory storing executable program codes; a processor coupled with the memory; the processor invokes the executable program codes stored in the memory, and is configured to execute the ECU flashing update method based on the compression algorithm 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 causes a computer to execute the ECU flashing update method based on the compression algorithm in any one of claims 1 to 5.
Citation Information
Patent Citations
Data matching method and device based on assembly line
CN103997346A
A server for data compression transmission
CN112380196A
Vehicle ECU data updating verification method and device
CN117149507A
ECU flash updating method and system based on compression algorithm
CN118897690A
Efficient method and system for reducing update requirements for a compressed binary image
US20050281469A1