Over-the-air upgrading method and device, electronic equipment and computer readable storage medium
By generating differential upgrade packages and performing lossless compression, the problems of large data volume and long time in OTA upgrades are solved, achieving an efficient and reliable upgrade process, improving user experience and reducing costs.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHONGQING TONGWO AUTOMOBILE TECHNOLOGY CO LTD
- Filing Date
- 2025-10-20
- Publication Date
- 2026-04-21
AI Technical Summary
In existing technologies, OTA upgrades involve large amounts of data transmission and long transmission times, and the multi-stage coordination mechanism increases the difficulty and cost of development and maintenance, affecting user experience.
By comparing the encoded files of historical and current versions, a differential upgrade package is generated, and the differential package is compressed using a lossless compression encoding method to reduce the amount of data transmitted; the target electronic control unit is then accurately reconstructed based on the address information of the differential upgrade package.
It significantly reduces network transmission load, shortens transmission time, reduces memory erase/write cycles, extends memory lifespan, and improves upgrade speed and reliability.
Smart Images

Figure CN121908255A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and in particular to an over-the-air (OTA) download upgrade method, apparatus, electronic device, and computer-readable storage medium. Background Technology
[0002] Over-the-Air (OTA) upgrade solutions rely on complex multi-stage coordination mechanisms, introducing a significant amount of additional development work and substantially increasing the complexity and cost of software development. Because the upgrade process is divided into multiple stages, the overall system update time is lengthy, and failure at any stage can severely impact user experience, often requiring a rollback mechanism to restore the software version, further increasing the difficulty, cost, and overall time commitment of development and maintenance.
[0003] Traditional OTA upgrades involve transmitting a complete software package, resulting in a large amount of data transmission and a long transmission time. Summary of the Invention
[0004] In view of this, embodiments of this application provide an over-the-air (OTA) upgrade method, apparatus, electronic device, and computer-readable storage medium to solve the problems of large data volume and long transmission time in the prior art.
[0005] A first aspect of this application provides an over-the-air (OTA) upgrade method, comprising: Obtain the first encoding file corresponding to the historical version of the software and the second encoding file corresponding to the current version of the software; Compare the data content at the same address in the first and second encoded files, extract the changed data content and its corresponding address information, and generate a differential upgrade package; The differential upgrade package is compressed using a lossless compression encoding method to obtain a compressed differential package; The compressed differential packet is sent to the target electronic control unit via a wireless communication network.
[0006] A second aspect of this application provides an over-the-air (OTA) upgrade method, comprising: The server receives a compressed differential packet, which is obtained by comparing the first encoded file corresponding to the historical version of the software with the second encoded file corresponding to the current version of the software. The compressed differential packet is decompressed to restore the differential upgrade package. Based on the address information and data content contained in the differential upgrade package, the current version of the software image is reconstructed in memory.
[0007] A third aspect of this application provides an over-the-air (OTA) upgrade device, comprising: The acquisition module is used to acquire the first encoding file corresponding to the historical version of the software and the second encoding file corresponding to the current version of the software. The generation module is used to compare the data content at the same address in the first encoded file and the second encoded file, extract the changed data content and its corresponding address information, and generate a differential upgrade package; The compression module is used to compress the differential upgrade package using a lossless compression encoding method to obtain a compressed differential package; The transmitting module is used to transmit the compressed differential packet to the target electronic control unit via a wireless communication network.
[0008] A fourth aspect of this application provides an over-the-air (OTA) upgrade device, comprising: The receiving module is used to receive compressed differential packets sent by the server. The compressed differential packets are obtained by the server by comparing the first encoded file corresponding to the historical version of the software with the second encoded file corresponding to the current version of the software. The compressed differential packets are decompressed to restore the differential upgrade package. The decompression module is used to decompress the compressed differential package and restore the differential upgrade package; The reconstruction module is used to reconstruct the current version software image in the memory based on the address information and data content contained in the differential upgrade package.
[0009] A fifth aspect of this application provides an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the above-described method.
[0010] A sixth aspect of the embodiments of this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the above-described method.
[0011] The beneficial effects of this application embodiment compared with the prior art are as follows: By obtaining the first encoded file corresponding to the historical version of the software and the second encoded file corresponding to the current version of the software; by comparing the data content at the same address in the first encoded file and the second encoded file, the changed data content and its corresponding address information are extracted to generate a differential upgrade package; since the differential upgrade package only contains the changed data content and its address information, rather than a complete software image, its data volume is much smaller than that of the complete second encoded file; then, the differential upgrade package is compressed using a lossless compression encoding method to obtain a compressed differential package, thereby further reducing the data volume on the basis of differentially reducing the data volume; the compressed differential package is sent to the target electronic control unit through a wireless communication network; since the data volume of the compressed differential package is doubly reduced, the network transmission load can be significantly reduced and the transmission time shortened. Attached Figure Description
[0012] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0013] Figure 1 This is a flowchart illustrating an over-the-air (OTA) upgrade method provided in an embodiment of this application. Figure 2 This is a flowchart illustrating another over-the-air (OTA) upgrade method provided in an embodiment of this application; Figure 3 This is a schematic diagram of an over-the-air (OTA) upgrade device provided in an embodiment of this application; Figure 4 This is a schematic diagram of another over-the-air (OTA) upgrade device provided in an embodiment of this application; Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0014] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.
[0015] An over-the-air (OTA) upgrade method and apparatus according to embodiments of this application will now be described in detail with reference to the accompanying drawings.
[0016] Figure 1 This is a flowchart illustrating an over-the-air (OTA) upgrade method provided in an embodiment of this application. Figure 1 The over-the-air (OTA) upgrade method can be executed by the server. For example... Figure 1 As shown, the over-the-air (OTA) upgrade method includes: Step S101: Obtain the first encoding file corresponding to the historical version of the software and the second encoding file corresponding to the current version of the software.
[0017] Encoded files: These are used to encode binary machine code or data in a printable hexadecimal format, facilitating transmission and processing via text tools. Encoded files can be S-Record (SREC) files. Each SREC record contains an address field, a data field, and a checksum field, explicitly indicating the specific location in the target processor's memory where the data should be programmed. In the automotive electronics field, it is one of the common programmable file formats generated after compilation and linking.
[0018] The server needs to obtain the historical version currently running in the ECU to be upgraded, corresponding to the first coded file, and the complete image file of the current version to be upgraded, corresponding to the second coded file. These two files are the basis for difference calculations. This provides the correct input source for subsequently generating an accurate difference package, ensuring the accuracy and targeting of the upgrade.
[0019] Step S102: Compare the data content at the same address in the first and second encoded files, extract the changed data content and its corresponding address information, and generate a differential upgrade package.
[0020] Address information: refers to the absolute storage location of data in the microcontroller's memory, which is the key to achieving accurate incremental updates.
[0021] Differential upgrade package: A collection of files containing all the changed data and their precise addresses, so its size is much smaller than the complete package.
[0022] The server uses specialized differential algorithms, such as byte-based binary comparison or hash-based block comparison, to parse two encoded files line by line. It compares the data content at the same memory addresses to identify which addresses have changed between the old and new versions—for example, a function might be optimized or a parameter might be corrected. Ultimately, only these changed "data-address pairs" are extracted and packaged into a differential upgrade package. This significantly reduces the amount of data that needs to be transmitted, resolving various bottlenecks caused by large data transfer volumes.
[0023] Step S103: Compress the differential upgrade package using lossless compression encoding to obtain a compressed differential package.
[0024] Lossless compression coding: A data compression algorithm that can compress files into smaller sizes and completely restore the original data without errors during decompression. This is essential for compressing program code, because even a single bit error can cause the program to malfunction.
[0025] Building upon the already significantly reduced differential packet size, further compression algorithms are applied. Since differential packets themselves consist of many scattered address-data pairs, they still contain a large amount of redundant information. The compression algorithm utilizes this statistical redundancy for encoding, thereby further reducing file size. This results in a second reduction in data volume. This further reduces network transmission load, shortens transmission time, and decreases the bandwidth and power consumption required for ECU download.
[0026] Step S104: The compressed differential packet is sent to the target electronic control unit via a wireless communication network.
[0027] Target Electronic Control Unit: refers to one or more specific control units (ECUs) on the vehicle that require this software upgrade.
[0028] The server transmits the processed compressed differential packet data to the target electronic control unit via a wireless network module. This completes the transfer of upgrade data from the cloud server to the terminal device. Due to the extremely small data volume, the transmission process is fast and reliable, with negligible impact on the vehicle's normal network usage, and significantly reduces the probability of transmission failure in unreliable wireless channels.
[0029] In the embodiments of this application, the server obtains a first encoded file corresponding to a historical version of the software and a second encoded file corresponding to the current version of the software; by comparing the data content at the same address in the first and second encoded files, the server extracts the changed data content and its corresponding address information to generate a differential upgrade package; since the differential upgrade package only contains the changed data content and its address information, rather than a complete software image, its data volume is much smaller than that of the complete second encoded file; then, the differential upgrade package is compressed using a lossless compression encoding method to obtain a compressed differential package, thereby further reducing the data volume on the basis of differentially reducing the data volume; the compressed differential package is sent to the target electronic control unit through a wireless communication network; since the data volume of the compressed differential package is doubly reduced, the network transmission load can be significantly reduced and the transmission time shortened.
[0030] In some embodiments, comparing the data content at the same address in the first encoded file and the second encoded file, extracting the changed data content and its corresponding address information, and generating a differential upgrade package includes: The binary differences between the first and second encoded files are compared using a differential processing tool. Export the difference file containing data lines in the second encoded file that differ from those in the first encoded file; The difference file is processed to remove data content belonging to the first encoding file, while retaining the changed data content and its address information in the second encoding file, and a differential upgrade package is generated.
[0031] Specifically, the server uses binary file comparison tools such as Beyond Compare and Ultra Compare to perform a fine-grained, byte-by-byte comparison between the first encoded file of the historical version and the second encoded file of the current version. This tool automatically analyzes and identifies all differences between the two files. After the comparison is complete, the tool exports a difference file containing all data lines in the second encoded file that differ from those in the first encoded file.
[0032] Since the exported difference files are typically presented in a comparison view, containing both removed old data rows and newly added data rows, post-processing is required. Using text processing tools or scripts, the old data content belonging to the first encoded file is removed, retaining only the changed, new data content from the second encoded file and its corresponding hexadecimal address information. Finally, the processed file becomes the required differential upgrade package.
[0033] For example, a binary difference comparison is performed on the first SREC file and the second SREC file using a differential processing tool. A difference file containing data lines in the second SREC file that differ from those in the first SREC file is exported. Then, the difference file is processed to remove the data content "0x00020000: AA BB CC DD" belonging to the first SREC file, and only retain the changed data and address information "0x00020000: EE FF GG HH" in the second SREC file, thereby generating a differential upgrade package.
[0034] Therefore, by utilizing binary differential tools, the difference finding and preliminary extraction can be completed efficiently and accurately in an automated manner. With the addition of targeted post-processing, the purity and correctness of the differential upgrade package content are guaranteed, greatly improving the generation efficiency.
[0035] In some embodiments, comparing the data content at the same address in the first encoded file and the second encoded file, extracting the changed data content and its corresponding address information, and generating a differential upgrade package includes: Import the contents of the first encoded file and the second encoded file into the first and second worksheets of the spreadsheet, respectively. Compare the data content of the same row number in two worksheets line by line using macro commands; When the data content of a certain row number is inconsistent, copy the data content of that row number from the second worksheet to the third worksheet; After completing all row number comparisons, export the contents of the third worksheet as a differential upgrade package.
[0036] Specifically, the server first pastes the contents of the two encoded files completely into two separate worksheets in a spreadsheet application such as Microsoft Excel or LibreOffice Calc. The first worksheet stores the contents of previous versions of the file, and the second worksheet stores the contents of the current version of the file.
[0037] Next, write or run a macro. This macro automatically calculates the total number of lines in the file and iterates through the files starting from a line number, comparing the string content of cells with the same line number in both worksheets. When the macro detects that the two strings at a certain line number are not completely identical, it determines that there is a difference in that line and then copies the entire row of data corresponding to that line number in the second worksheet to a newly created third worksheet.
[0038] After iterating through all row numbers, the third worksheet will contain all the new version data rows that differ from the original. Finally, the entire contents of the third worksheet will be exported as a text file, which will be the generated differential upgrade package.
[0039] For example, the contents of the first and second SREC files are imported into Excel Sheets 1 and 2, respectively. A macro is used to compare each row. When a discrepancy is detected in row 150, the data from row 150 in Sheet 2 is copied to Sheet 3. After all rows have been compared, the contents of Sheet 3 are exported, forming the differential upgrade package for this module. This achieves a low-cost, software-free differential package generation solution, suitable for scenarios with specific development environment limitations or where low implementation costs are a priority.
[0040] In some embodiments, before comparing the data content at the same address in the first encoded file and the second encoded file, the method further includes: Parse the formats of the first and second encoded files, and extract the data records and the storage address information corresponding to each data record; Based on the storage address information, the first encoded file and the second encoded file are divided into multiple data blocks; Generating a differential upgrade package includes: performing difference comparisons on a data block basis and generating difference information.
[0041] The encoded file format includes various types, and each record contains a starting address, data length, data content, and checksum. Parsing the encoded file format refers to the server reading the encoded file line by line, determining its type based on the header identifier of each record, and parsing out the starting address and data payload of the data contained in that record. Based on the storage address information, the first and second encoded files are divided into multiple data blocks, which may specifically include: After parsing all records, the server automatically merges records with consecutive or adjacent address values into a larger data block based on their starting addresses. For example, records starting at addresses 0x1000, 0x1010, and 0x1020 are merged into one data block. The server sets a fixed data block size and logically divides the file data into several blocks, starting from the beginning address of the encoded file. If the last data block is less than 4KB, padding is applied.
[0042] During the comparison, the server calculates the hash value (such as MD5, SHA-1) or performs a binary comparison for each pre-divided data block. Only when the hash value or binary content of the entire data block is inconsistent is the data block marked as a difference block, and its information is included in the differential upgrade package.
[0043] For example, before comparing the first SREC file and the second SREC file, the server first parses the formats of both, extracts the data records and corresponding storage address information, and divides the SREC file into multiple data blocks such as 0x00000000-0x0000FFFF and 0x00010000-0x0001FFFF according to the address. Then, the differences are compared on a unit of these data blocks. If a difference is found in the 0x00010000-0x0001FFFF data block, a differential upgrade package containing the difference information of that block is generated.
[0044] Therefore, by aggregating a large number of fragmented file records into larger data blocks by address and comparing them in blocks, the number of units that need to be compared is significantly reduced, the consumption of server computing resources is greatly reduced, and the efficiency of differential packet generation is improved. This method is particularly suitable for processing large encoded files.
[0045] Figure 2 This is a flowchart illustrating an over-the-air (OTA) upgrade method provided in an embodiment of this application. Figure 2 The over-the-air (OTA) upgrade method can be executed by the electronic control unit. For example... Figure 2 As shown, the over-the-air (OTA) upgrade method includes: Step S201: Receive the compressed differential packet sent by the server. The compressed differential packet is obtained by lossless compression of the differential upgrade packet generated by the server by comparing the encoding files of the historical version and the current version.
[0046] The ECU downloads compressed differential packets from the server via its wireless communication module or gateway. The ECU only needs to receive and store a very small data packet, which greatly saves its limited internal storage space and shortens the download time.
[0047] Step S202: Decompress the compressed differential package to restore the differential upgrade package.
[0048] The ECU uses a decompression algorithm corresponding to the server's compression algorithm to decompress the received compressed differential packet, completely restoring the original differential upgrade packet data and ensuring no data errors or omissions. This prepares accurate original differential data for subsequent reconstruction steps. Lossless compression guarantees 100% accuracy of the decompressed data.
[0049] Step S203: Based on the address information and data content contained in the differential upgrade package, reconstruct the current version software image in the memory.
[0050] Refactoring refers to the ECU not simply overwriting the old software, but rather "patching" it, precisely writing new data blocks into specified address locations in the Flash memory according to the instructions in the differential package. A software image refers to a complete, executable binary file of the new version of the software, directly executable by the MCU. The ECU's bootloader parses the differential upgrade package. For each record in the package, it contains a target address and a piece of new data. The ECU locates the corresponding memory area in the Flash memory at that address and overwrites the old data with the new data. By processing all records one by one, the historical version of the software image is ultimately updated to the current complete software image in situ within the ECU's Flash memory.
[0051] The ECU only performs erase and write operations on the memory sectors that have changed, ignoring a large number of unchanged areas. This significantly reduces the number of times the Flash memory needs to be erased and written, which not only speeds up the upgrade process but also helps extend the lifespan of the Flash memory, achieving precise and efficient updates.
[0052] The electronic control unit receives compressed differential packets sent by the server, decompresses the compressed differential packets, and restores them to obtain differential upgrade packets. Based on the address information and data content contained in the differential upgrade packets, it reconstructs the current version of the software image in the memory. Since the differential upgrade packets contain the changed data content and its accurate address information, the electronic control unit can accurately write the data content to the corresponding location in the memory according to the address information, realizing incremental updates without erasing and writing the entire storage area. This significantly reduces the number of times the Flash memory is erased and written, improves update efficiency, and extends the lifespan of the memory.
[0053] In some embodiments, the current version of the software image is reconstructed in memory based on the address information and data content contained in the differential upgrade package, including: The memory is divided into a dual-partition structure containing a first partition and a second partition, where the first partition stores the historical version of the software that is currently running; Write the reconstructed current version software image to the second partition.
[0054] The Electronic Control Unit (ECU)'s Flash memory is physically or logically divided into two separate parts: a first partition and a second partition. The first partition stores and runs the currently used historical software version. The second partition is the target partition for this upgrade.
[0055] Specifically, based on the address information in the received differential upgrade package, the ECU precisely writes the changed data content to the corresponding storage unit address in the second partition. By processing the instructions in the differential package line by line, the current version of the software image is finally reconstructed completely in the second partition. Throughout the entire flashing process, the ECU's application always starts and runs from the first partition, unaffected by write operations to the second partition.
[0056] Therefore, the dual-partition structure isolates the upgrade process from the operating state, forming a safe and reliable upgrade architecture. This ensures that even if an unexpected interruption occurs during the upgrade process, the ECU can still start and run normally using the intact software in the first partition.
[0057] In some embodiments, after reconstructing the current version software image in memory based on the address information and data content contained in the differential upgrade package, the method further includes: Perform integrity verification on the current version of the software image, and use the cyclic redundancy check algorithm to calculate the verification value of the current version of the software image; When the check value matches the preset value, the system jumps from the first partition running the historical version of the software to the second partition running the current version of the software image. When the checksum does not match the preset value, a security mechanism is triggered. The security mechanism includes: recording the error log, clearing the reconstructed software image, and maintaining the running of the historical version of the software in the first partition.
[0058] The preset value can be a checksum calculated and embedded in the differential upgrade package by the server, or it can be a fixed checksum known to the ECU and required for the new software version. A cyclic redundancy check algorithm, such as CRC-32, is used to calculate a 32-bit checksum for the entire current version software image reconstructed in the second partition.
[0059] Specifically, the ECU compares the calculated CRC checksum with a preset value. If they match, it indicates that no errors occurred during the software image download, decompression, and reconstruction process, and the image is complete and error-free. Subsequently, the ECU modifies the boot configuration and boots from the second partition upon the next reset, completing the version switch.
[0060] If the checksum fails to match, it indicates that the reconstructed software image may contain errors. The ECU immediately triggers a safety handling mechanism: First, it records this error event in non-volatile memory for subsequent diagnostic analysis; second, it erases all potentially corrupted software images already written to the second partition, freeing up storage space and preventing erroneous boots; finally, it keeps all boot configurations unchanged, ensuring the system continues to stably run historical software versions from the first partition.
[0061] Therefore, by adding a final integrity check and a robust security rollback mechanism, the entire OTA upgrade process is provided with ultimate security assurance, ensuring that only verified and correct software will be put into operation, thus forming a highly reliable closed-loop upgrade solution.
[0062] In summary, by performing differential extraction and compression on the server side, and decompression and precise reconstruction on the electronic control unit side, the method can greatly reduce the amount of data transmitted over the network, improve the upgrade speed and reliability, and at the same time reduce the occupation and consumption of electronic control unit storage resources, thus achieving efficient and reliable differential over-the-air upgrade.
[0063] All of the above-mentioned optional technical solutions can be combined in any way to form the optional embodiments of this application, and will not be described in detail here.
[0064] The following are embodiments of the apparatus described in this application, which can be used to execute the embodiments of the method described in this application. For details not disclosed in the apparatus embodiments of this application, please refer to the embodiments of the method described in this application.
[0065] Figure 3 This is a schematic diagram of an over-the-air (OTA) upgrade device provided in an embodiment of this application. Figure 3As shown, the over-the-air (OTA) upgrade device includes: The acquisition module 301 is used to acquire the first encoding file corresponding to the historical version of the software and the second encoding file corresponding to the current version of the software. The generation module 302 is used to compare the data content at the same address in the first encoded file and the second encoded file, extract the changed data content and its corresponding address information, and generate a differential upgrade package. Compression module 303 is used to compress the differential upgrade package using lossless compression encoding to obtain a compressed differential package; The transmitting module 304 is used to transmit compressed differential packets to the target electronic control unit via a wireless communication network.
[0066] According to the technical solution provided in this application embodiment, a differential upgrade package is generated by obtaining a first encoded file corresponding to a historical version of the software and a second encoded file corresponding to the current version of the software; by comparing the data content at the same address in the first and second encoded files, the changed data content and its corresponding address information are extracted; since the differential upgrade package only contains the changed data content and its address information, rather than a complete software image, its data volume is much smaller than that of the complete second encoded file; then, the differential upgrade package is compressed using a lossless compression encoding method to obtain a compressed differential package, thereby further reducing the data volume on the basis of differentially reducing the data volume; the compressed differential package is sent to the target electronic control unit through a wireless communication network; since the data volume of the compressed differential package is doubly reduced, the network transmission load can be significantly reduced and the transmission time shortened.
[0067] In some embodiments, the generation module 302 is specifically used for: The binary differences between the first and second encoded files are compared using a differential processing tool. Export the difference file containing data lines in the second encoded file that differ from those in the first encoded file; The difference file is processed to remove data content belonging to the first encoding file, while retaining the changed data content and its address information in the second encoding file, and a differential upgrade package is generated.
[0068] In some embodiments, the generation module 302 is specifically used for: Import the contents of the first encoded file and the second encoded file into the first and second worksheets of the spreadsheet, respectively. Compare the data content of the same row number in two worksheets line by line using macro commands; If the data content of the first row number is inconsistent, copy the data content of the first row number in the second worksheet to the third worksheet; After completing all row number comparisons, export the contents of the third worksheet as a differential upgrade package.
[0069] In some embodiments, the over-the-air upgrade device further includes: The parsing module 305 is used to parse the formats of the first encoded file and the second encoded file, and extract the data records and the storage address information corresponding to each data record. The partitioning module 306 is used to divide the encoded file into multiple data blocks according to the storage address information; the generation of differential upgrade packages includes: performing difference comparison on a data block basis and generating difference information.
[0070] Figure 4 This is a schematic diagram of an over-the-air (OTA) upgrade device provided in an embodiment of this application. Figure 4 As shown, the over-the-air (OTA) upgrade device includes: The receiving module 401 is used to receive the compressed differential packet sent by the server. The compressed differential packet is obtained by the first encoded file corresponding to the historical version of the server software and the second encoded file corresponding to the current version of the software. The decompression module 402 is used to decompress the compressed differential package and restore the differential upgrade package; The reconstruction module 403 is used to reconstruct the current version software image in memory based on the address information and data content contained in the differential upgrade package.
[0071] According to the technical solution provided in the embodiments of this application, the electronic control unit receives a compressed differential packet sent by the server, decompresses the compressed differential packet, and recovers the differential upgrade packet; based on the address information and data content contained in the differential upgrade packet, it reconstructs the current version software image in the memory; since the differential upgrade packet contains the changed data content and its accurate address information, the electronic control unit can accurately write the data content to the corresponding location in the memory according to the address information, realizing incremental updates without erasing and writing the entire storage area, thereby greatly reducing the number of times the memory is erased and written, and improving update efficiency.
[0072] In some embodiments, the reconstruction module 403 is specifically used for: The memory is divided into a dual-partition structure containing a first partition and a second partition, where the first partition stores the historical version of the software that is currently running; Write the reconstructed current version software image to the second partition.
[0073] It should be understood that the sequence number of each step in the above embodiments does not imply 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 this application.
[0074] Figure 5 This is a schematic diagram of the electronic device 6 provided in an embodiment of this application. Figure 5 As shown, the electronic device 6 of this embodiment includes a processor 601, a memory 602, and a computer program 603 stored in the memory 602 and executable on the processor 601. When the processor 601 executes the computer program 603, it implements the steps in the various method embodiments described above. Alternatively, when the processor 601 executes the computer program 603, it implements the functions of each module / unit in the various device embodiments described above.
[0075] Electronic device 6 can be a desktop computer, laptop, handheld computer, cloud server, or other electronic device. Electronic device 6 may include, but is not limited to, processor 601 and memory 602. Those skilled in the art will understand that... Figure 5 This is merely an example of electronic device 6 and does not constitute a limitation on electronic device 6. It may include more or fewer components than shown, or different components.
[0076] The processor 601 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
[0077] The memory 602 can be an internal storage unit of the electronic device 6, such as a hard disk or RAM of the electronic device 6. The memory 602 can also be an external storage device of the electronic device 6, such as a plug-in hard disk, Smart Media Card (SMC), Secure Digital (SD) card, Flash Card, etc., equipped on the electronic device 6. The memory 602 can also include both internal and external storage units of the electronic device 6. The memory 602 is used to store computer programs and other programs and data required by the electronic device.
[0078] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0079] If an integrated module / unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program may include computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. A computer-readable medium may include: any entity or device capable of carrying computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in a computer-readable medium can be appropriately added to or subtracted according to the requirements of legislation and patent practice in a jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electrical carrier signals and telecommunication signals.
[0080] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. An over-the-air (OTA) upgrade method, characterized in that, Applied to a server, the method includes: Obtain the first encoding file corresponding to the historical version of the software and the second encoding file corresponding to the current version of the software; Compare the data content at the same address in the first encoded file and the second encoded file, extract the changed data content and its corresponding address information, and generate a differential upgrade package; The differential upgrade package is compressed using a lossless compression encoding method to obtain a compressed differential package; The compressed differential packet is transmitted to the target electronic control unit via a wireless communication network.
2. The method according to claim 1, characterized in that, The step of comparing the data content at the same address in the first encoded file and the second encoded file, extracting the changed data content and its corresponding address information, and generating a differential upgrade package includes: The binary differences between the first encoded file and the second encoded file are compared using a differential processing tool. Export a difference file containing data lines in the second encoded file that differ from those in the first encoded file; The difference file is processed to remove data content belonging to the first encoded file, while retaining the changed data content and its address information in the second encoded file, thereby generating the differential upgrade package.
3. The method according to claim 1, characterized in that, The step of comparing the data content at the same address in the first encoded file and the second encoded file, extracting the changed data content and its corresponding address information, and generating a differential upgrade package includes: Import the contents of the first encoded file and the second encoded file into the first and second worksheets of the spreadsheet, respectively. Compare the data content of the same row number in two worksheets line by line using macro commands; When the data content of the first row number is inconsistent, copy the data content of the first row number in the second worksheet to the third worksheet; After completing all row number comparisons, the contents of the third worksheet are exported as the differential upgrade package.
4. The method according to claim 1, characterized in that, Before comparing the data content at the same address in the first encoded file and the second encoded file, the method further includes: Parse the formats of the first encoded file and the second encoded file, and extract the data records and the storage address information corresponding to each data record; Based on the storage address information, the first encoded file and the second encoded file are divided into multiple data blocks; The generation of the differential upgrade package includes: performing difference comparison on the basis of the data blocks to generate difference information.
5. An over-the-air (OTA) upgrade method, characterized in that, Applied to an electronic control unit, the method includes: The server receives a compressed differential packet, which is obtained by comparing the first encoded file corresponding to the historical version of the software with the second encoded file corresponding to the current version of the software. The compressed differential package is decompressed to restore the differential upgrade package; Based on the address information and data content contained in the differential upgrade package, the current version of the software image is reconstructed in the memory.
6. The method according to claim 5, characterized in that, The step of reconstructing the current version software image in memory based on the address information and data content contained in the differential upgrade package includes: The memory is divided into a dual-partition structure containing a first partition and a second partition, wherein the first partition stores the historical version of the software that is currently running; Write the reconstructed current version software image to the second partition.
7. An over-the-air (OTA) upgrade device, characterized in that, Applied to servers, including: The acquisition module is used to acquire the first encoding file corresponding to the historical version of the software and the second encoding file corresponding to the current version of the software; The generation module is used to compare the data content at the same address in the first encoded file and the second encoded file, extract the changed data content and its corresponding address information, and generate a differential upgrade package; The compression module is used to compress the differential upgrade package using a lossless compression encoding method to obtain a compressed differential package; The transmitting module is used to transmit the compressed differential packet to the target electronic control unit via a wireless communication network.
8. An over-the-air (OTA) upgrade device, characterized in that, Applied to electronic control units, including: The receiving module is used to receive compressed differential packets sent by the server. The compressed differential packets are obtained by the first encoded file corresponding to the historical version of the server software and the second encoded file corresponding to the current version of the software. The decompression module is used to decompress the compressed differential package and restore the differential upgrade package; The reconstruction module is used to reconstruct the current version software image in the memory based on the address information and data content contained in the differential upgrade package.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method as described in any one of claims 1 to 6.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method as described in any one of claims 1 to 6.