Vehicle-mounted ECU firmware updating method for vehicle-mounted TBox

By performing segmented differential processing and compression of the ELF format files of the on-board ECU, the problem of differential update package size caused by the Bsdiff algorithm ignoring the characteristics of file segmentation is solved, and more efficient firmware updates are achieved.

CN119166185APending Publication Date: 2024-12-20CHONGQING UNIV OF POSTS & TELECOMM
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411255500.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-09
Publication Date
2024-12-20

Smart Images

  • Figure CN119166185A_ABST
    Figure CN119166185A_ABST
Patent Text Reader

Abstract

The invention relates to a vehicle-mounted ECU (Electronic Control Unit) firmware updating method for a vehicle-mounted TBox, which belongs to the technical field of intelligent networked automobiles and comprises the following steps: S1, a cloud divides each section of an ELF format file into three types, namely a data type section, a program type section and other sections; s2, the cloud carries out different differential processing on various types of segments in the new and old version firmware files to generate corresponding control files, difference files and newly-added files; s3, the cloud carries out integration and compression on all the control files, the difference files and the newly-added files to obtain a difference package; and S4, the cloud side sends the differential package to the vehicle-mounted TBox, new-version firmware is generated in combination with the old-version firmware in the vehicle-mounted TBox, and finally, the vehicle-mounted TBox sends the new-version firmware to the vehicle-mounted ECU through the gateway, so that differential upgrading of the firmware is completed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of intelligent networked vehicles and relates to a vehicle-mounted ECU firmware update method for a vehicle-mounted TBox. Background Art

[0002] In recent years, intelligent connected vehicles have developed rapidly. Intelligent connected vehicles integrate advanced sensing technology, information fusion technology, intelligent decision-making technology, pattern recognition technology and other technologies. The specific implementation of these technologies is achieved through the software in the large electric control unit (ECU) installed on the car. With the development of intelligent connected vehicles, the demand for software updates is also increasing. In order to solve the problem that traditional recall and update of cars consumes a lot of manpower and material resources, the OTA (over the air) remote software upgrade technology first used in the field of smartphones has been introduced into the automotive industry.

[0003] In the firmware update of vehicle-mounted ECU, in order to reduce the use of network resources, differential update technology is widely used. Differential update is also called incremental update. Different from the update method of whole package transmission, differential update will obtain differential package by using differential algorithm for old version of firmware and new version of firmware in the cloud before updating. Compared with the size of original firmware, differential package will be much smaller. The most common differential update technology for vehicle-mounted ECU equipped with MCU is Bsdiff algorithm. Two sets of corresponding index strings are generated for new version and old version of firmware through suffix sorting. The two sets of index strings are compared and matched to obtain differential file, new file and control file; finally, the control file, differential file and new file are compressed and packaged into differential update package. However, in order to pursue the platformization of technology, Bsdiff algorithm simply regards the file to be processed as a binary file, and some characteristics of ELF format files widely used in vehicles will be ignored by Bsdiff algorithm. Summary of the invention

[0004] In view of this, an object of the present invention is to provide an ELF format firmware update method for a vehicle-mounted TBox to a vehicle-mounted ECU.

[0005] In order to achieve the above object, the present invention provides the following technical solutions:

[0006] A vehicle-mounted ECU firmware update method for a vehicle-mounted TBox comprises the following steps:

[0007] S1: The cloud classifies the segments of ELF format files into three types: data segments, program segments, and other segments;

[0008] S2: The cloud performs different differential processing on the segments of different types in the new and old versions of the firmware files to generate corresponding control files, difference files, and new files;

[0009] S3: The cloud integrates and compresses all control files, difference files, and newly added files to obtain a differential package;

[0010] S4: The cloud sends the differential package to the vehicle TBox, where the new version of firmware is generated by combining the old version of firmware. Finally, the vehicle TBox sends the new version of firmware to the vehicle ECU through the gateway, thereby completing the differential upgrade of the firmware.

[0011] Further, in step S1, the .data segment, .bss segment, and .interrupt segment in the ELF format file are

[0012] The .interrupts_ram segment is classified as a data segment; the .text segment is classified as a program segment; the .flash_config segment, the .code segment, the .heap segment, the .stack segment, the .ARM.atttributes segment, the .debug segment, the .comment segment, the .symtab segment, the .syrtab segment, the .strtab segment, and the .shstrtab segment are classified as other segments.

[0013] Further, in step S2, the data class segments in the new and old versions of the firmware are differentially processed to obtain control files, differential files and newly added files, specifically including:

[0014] S211: Obtain the starting position, offset and size of the data class segment through the address information in the Section Header Table in the ELF file;

[0015] S212: Perform qsufsort suffix processing on the data class segment data to obtain the corresponding string index;

[0016] S213: Set the longest matching string length, use the string index corresponding to the new and old versions to search for the longest character segment that is completely matched, and use the starting point and the ending point of the segment as the starting point to search for the longest character segment in front and behind, and generate an approximately matching segment; the rule of the approximate matching is that at least 50% of the bytes of the character segment to be searched forward and the character segment to be searched backward must match, and the character segment that does not meet the approximate matching is regarded as a difference character segment; thereby obtaining a difference file and position information generated by the data of the approximately matching string and a newly added file and position information generated by the difference character segment, and integrating the position information of the difference file and the newly added file together according to the position order to obtain a control file;

[0017] S214: Perform zero-value compression processing on the obtained difference file and the newly added file. First, set a window of size 256 bits, traverse the difference file, and record the consecutive zero values ​​in the difference file as two-bit hexadecimal data. When the number of consecutive zero values ​​is greater than or equal to 256, record the first 255 zero values ​​as 0FF and start recording again. After the traversal is completed, a new difference file is obtained.

[0018] Further, in step S2, the program class segments in the new and old versions of the firmware are differentially processed to obtain control files, differential files and newly added files, specifically including:

[0019] S221: Obtain the starting position, offset and size of the program class segment through the address information in the Section Header Table in the ELF file;

[0020] S222: Perform Libdivsusort suffix processing on the incoming program class segment data to obtain a corresponding string index;

[0021] S223: Set the longest matching string, use the string index corresponding to the new and old versions to find the longest character segment that fully matches, and use the starting point and end point of this segment as the starting point to search before and after the longest character segment to generate an approximately matching segment; the rule of approximate matching is that at least 50% of the bytes of the forward searched character segment and the backward searched character segment must match, and the character segments that do not meet the approximate match are regarded as difference character segments; thereby obtaining the difference file and position information generated by the data of the approximately matching string and the newly added file and its position information generated by the difference character segment, and integrating the position information of the difference file and the newly added file according to the position order to obtain the control file.

[0022] Further, in step S3, according to the address information in the control file, the difference files and the newly added files of the data class segment and the program class segment are respectively combined into new difference files and the newly added files according to the address order; the difference files and the newly added files of the data class segment and the program class segment are respectively marked; the total address information, difference files and the newly added files are compressed by the Bz2 algorithm to obtain a difference file package.

[0023] Further, in step S4, after the vehicle-mounted TBox receives the differential packet sent by the cloud, it performs the following steps:

[0024] S41: Verify the data of the difference package to ensure file integrity, determine whether it meets the version requirements based on the label of the difference package, and check whether the local old version firmware meets the requirements. If both meet the requirements, execute step S42;

[0025] S42: Load the old version firmware from the local;

[0026] S43: decompressing the difference package using the Bz2 algorithm to obtain the control file, the difference file, and the newly added file;

[0027] S44: determining the location to be operated in the old version firmware according to the location information in the control file;

[0028] S45: judging whether the file to be operated is a data file or a program file according to the label in the control file, if it is a data file, performing a 0 value expansion process on the data of the corresponding data segment difference file and the newly added file, and when a 0 value is read, reading the values ​​of the last two digits, expanding according to the values ​​of the last two digits; if it is a program segment, directly executing step S46;

[0029] S46: If it is a newly added file, the data is directly inserted into the corresponding position in the old version of the firmware; if it is a control file, the position information in the control file replaces the corresponding data in the old version of the firmware with the expanded data class segment difference file.

[0030] The beneficial effect of the present invention is that the improved difference technology proposed in the present invention can be combined with the segmentation characteristics of the ELF format file that is widely used in vehicle-mounted ECUs, and through the difference technology design of data class segments and program class segments, the size of the data to be processed is reduced, and the size of the final generated difference package can be increased.

[0031] Other advantages, objectives and features of the present invention will be described in the following description to some extent, and to some extent, will be obvious to those skilled in the art based on the following examination and study, or can be taught from the practice of the present invention. The objectives and other advantages of the present invention can be realized and obtained through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention will be described in detail below in conjunction with the accompanying drawings, wherein:

[0033] Figure 1 Schematic diagram of segment classification of ELF files

[0034] Figure 2 This is a schematic diagram of the on-board ECU remote upgrade system for intelligent connected vehicles;

[0035] Figure 3 This is a schematic diagram of the cloud difference package processing process;

[0036] Figure 4 Schematic diagram of the process of generating a new version of firmware for TBox to receive differential packages. DETAILED DESCRIPTION

[0037] The following describes the embodiments of the present invention by specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the illustrations provided in the following embodiments only illustrate the basic concept of the present invention in a schematic manner, and the following embodiments and features in the embodiments can be combined with each other without conflict.

[0038] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present invention, and thus the drawings only show components related to the present invention rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.

[0039] In the following description, numerous details are discussed to provide a more thorough explanation of the embodiments of the present invention. However, it is obvious to those skilled in the art that the embodiments of the present invention can be implemented without these specific details. In other embodiments, well-known structures and devices are shown in the form of block diagrams rather than in detail to avoid making the embodiments of the present invention difficult to understand.

[0040] like Figure 1 As shown, the present invention provides a vehicle-mounted ECU firmware update method for a vehicle-mounted TBox. In this embodiment, Figure 2 A remote upgrade system for an on-board ECU of an intelligent networked vehicle is shown, which is also the implementation environment of the method for updating the on-board ECU firmware of an intelligent networked vehicle of the present invention. Figure 2 As shown, the vehicle-mounted ECU remote upgrade system used in this invention includes: a cloud server, a vehicle-mounted TBox, a gateway, and a vehicle-mounted ECU.

[0041] The cloud establishes a communication connection with the vehicle-mounted TBox through remote communication data, which is used to process the new version and the old version of the firmware, generate a difference upgrade package and send the difference upgrade package to the vehicle-mounted TBox;

[0042] The vehicle-mounted TBox is used to store ECU firmware and receive differential upgrade packages issued by the cloud and send upgrade status of the vehicle-mounted ECU. After receiving the differential upgrade package, the vehicle-mounted TBox inserts or rewrites the differential files and new files into the old version of the firmware stored locally through the control file to generate a new version of the firmware. The TBox loads the new version of the firmware information into the vehicle network signal payload and sends it to the gateway;

[0043] The gateway is used to receive the vehicle network signal transmitted by the vehicle TBox and distribute it to the network bus where the vehicle ECU that needs to be upgraded is located according to the network type;

[0044] After receiving the vehicle network signal containing the new version of the firmware information, the vehicle ECU reads the network information and writes the new version of the firmware information onto the firmware.

[0045] In the vehicle-mounted ECU equipped with MCU, ELF format files are generally used as firmware. ELF format files have the characteristics of segmentation, and different segments contain different information. When processing such files, Bsdiff technology simply regards this as a binary file for processing. Therefore, this embodiment takes the segmentation characteristics of the ELF format as the starting point and optimizes the Bsdiff technology in combination with the characteristics of its different segments. The specific implementation process of the technology is as follows:

[0046] After receiving the new version of the firmware, the cloud first performs version comparison and data verification. After completion, it is transmitted to the difference processing process together with the old version of the firmware. After reading the old and new versions of the firmware, the difference processing process obtains the control files, difference files and newly added files of the data class segments and program class segments. According to the control file, the difference files and newly added files of the data class segments and program class segments are combined into a unified difference file and newly added file, and finally the whole is compressed to obtain the final difference package.

[0047] The process of generating difference packages in the cloud is as follows Figure 3 As shown, specifically including:

[0048] 1) After receiving the new version of the firmware, the cloud searches for the old version of the firmware stored locally based on the information in the new version of the firmware and checks whether it is in accordance with the version and whether it is an ELF format file. If it is not in accordance with the version, the upgrade is terminated directly. After confirmation, the two versions of the firmware are transferred together to the difference file generation thread.

[0049] 2) Read the segment header table to obtain the starting position and data size corresponding to each segment in the data class segment and program class segment.

[0050] 3) Determine the segment type. For data-type segments, first perform qsufsort suffix processing to obtain difference files, newly added files, and control files. Traverse the generated difference files and newly added files. When encountering 0 values, record the number of consecutive 0 values ​​and compress the 0 values. If the number of 0 values ​​is greater than 255, restart the counting. For program-type segments, directly perform Libdivsusort suffix processing to obtain difference files, newly added files, and control files.

[0051] 5) Integrate all control files, difference files and newly added files according to the location information to obtain the total control files, difference files and newly added files;

[0052] 6) The total location information, difference files and newly added files are compressed into a difference file package using the Bz2 algorithm.

[0053] After generating the difference package, the cloud sends a firmware upgrade request to the TBox; after receiving the request and confirming the old version of the firmware, the TBox returns a confirmation mark to the cloud and starts accepting the difference package.

[0054] The process of TCU receiving the difference package sent by the cloud is as follows Figure 4 As shown, specifically including:

[0055] 1) After acceptance, verify the data in the difference package to ensure file integrity, determine whether it meets the version requirements based on the label of the difference package, and check whether the local old version of the firmware meets the requirements. If not, terminate the upgrade directly;

[0056] 2) Load the old version of firmware from the local computer;

[0057] 3) Decompress the difference package using the Bz2 algorithm to obtain the control file, difference file, and newly added file;

[0058] 4) Determine the location to be operated in the old version firmware according to the location information in the control file;

[0059] 5) Determine whether the operation is a data file or a program file based on the label in the control file. If it is a data file, the corresponding data segment difference file and the newly added file will be expanded to a value of 0. When a value of 0 is read, the values ​​of the last two digits are read and expanded according to the values ​​of the last two digits. If it is a program segment, proceed directly to the next step.

[0060] 6) If it is a newly added file, the data is directly inserted into the corresponding position in the old version of the firmware. If it is a control file, the position information in the control file replaces the corresponding data in the old version of the firmware with the expanded data class segment difference file.

[0061] After obtaining the new version of the firmware, TBox transmits it to the gateway through the vehicle network and finally transmits it to the ECU to complete the update of the ECU firmware. The characteristics of ELF file classification can reduce the size of the differential package during differential upgrades, improve the efficiency of differential upgrades, and reduce the network load required.

[0062] In the above embodiments, the description's reference to "this embodiment" indicates that a particular feature, structure, or characteristic described in conjunction with the embodiment is included in at least some embodiments, but not necessarily all embodiments. Multiple occurrences of "this embodiment" do not necessarily all refer to the same embodiment.

[0063] In the above-described embodiments, although the invention has been described in conjunction with specific embodiments of the invention, many substitutions, modifications, and variations of these embodiments will be apparent to those of ordinary skill in the art based on the foregoing description. For example, other storage structures (e.g., dynamic RAM (DRAM)) may use the embodiments discussed. Embodiments of the invention are intended to encompass all such substitutions, modifications, and variations that fall within the broad scope of the appended claims.

[0064] This embodiment further provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, any one of the methods in this embodiment is implemented.

[0065] This embodiment also provides an electronic terminal, including: a processor and a memory;

[0066] The memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory, so that the terminal executes any one of the methods in this embodiment.

[0067] The computer-readable storage medium in this embodiment can be understood by ordinary technicians in this field: all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to the computer program. The aforementioned computer program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, magnetic disk or optical disk and other media that can store program codes.

[0068] The electronic terminal provided in this embodiment includes a processor, a memory, a transceiver and a communication interface. The memory and the communication interface are connected to the processor and the transceiver and complete communication with each other. The memory is used to store computer programs, the communication interface is used to communicate, and the processor and the transceiver are used to run computer programs so that the electronic terminal executes each step of the above method.

[0069] In this embodiment, the memory may include a random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.

[0070] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0071] The present invention can be used in many general or special computing system environments or configurations, such as personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, and the like.

[0072] The present invention may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present invention may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.

[0073] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the purpose and scope of the technical solution, which should be included in the scope of the claims of the present invention.

Claims

1. A vehicle-mounted ECU firmware update method for a vehicle-mounted TBox, characterized in that: The following steps are involved: S1: The cloud classifies the segments of ELF format files into three types: data segments, program segments, and other segments; S2: The cloud performs different differential processing on the segments of different types in the new and old versions of the firmware files to generate corresponding control files, difference files, and new files; S3: The cloud integrates and compresses all control files, difference files, and newly added files to obtain a differential package; S4: The cloud sends the differential package to the vehicle TBox, where the new version of firmware is generated by combining the old version of firmware. Finally, the vehicle TBox sends the new version of firmware to the vehicle ECU through the gateway, thereby completing the differential upgrade of the firmware.

2. The vehicle-mounted ECU firmware update method for a vehicle-mounted TBox according to claim 1, characterized in that: In step S1, the .data segment, .bss segment, .interrupt segment, and .interrupts_ram segment in the ELF format file are classified as data segments; the .text segment is classified as a program segment; the .flash_config segment, .code segment, .heap segment, and .stack segment are classified as The .ARM.atttributes segment, .debug segment, .comment segment, .symtab segment, .syrtab segment, .strtab segment, and .shstrtab segment are classified as other segments.

3. The vehicle-mounted ECU firmware update method for a vehicle-mounted TBox according to claim 1, characterized in that: In step S2, the data class segments in the new and old versions of the firmware are processed for difference, and a control file, a difference file, and a newly added file are obtained, which specifically includes: S211: Obtain the starting position, offset and size of the data class segment through the address letter in the segment header table in the ELF file; S212: Perform qsufsort suffix processing on the data class segment data to obtain a corresponding string index; S213: Set the longest matching string length, use the string index corresponding to the new and old versions to search for the longest character segment that is completely matched, and use the starting point and the ending point of the segment as the starting point to search for the longest character segment before and after, and generate an approximately matching segment; the rule of the approximately matching is that at least 50% of the bytes of the character segment to be searched forward and the character segment to be searched backward match, and the character segment that does not meet the approximately matching is regarded as a difference character segment; thereby obtaining a difference file and position information generated by the data of the approximately matching string and a newly added file and position information generated by the difference character segment, and integrating the position information of the difference file and the newly added file together according to the position order to obtain a control file; S214: Perform zero-value compression processing on the obtained difference file and the newly added file. First, set a window of size 256 bits, traverse the difference file, and record the consecutive zero values ​​in the difference file as two-bit hexadecimal data. When the number of consecutive zero values ​​is greater than or equal to 256, record the first 255 zero values ​​as 0FF and start recording again. After the traversal is completed, a new difference file is obtained.

4. The vehicle-mounted ECU firmware update method for a vehicle-mounted TBox according to claim 1, characterized in that: In step S2, the program class segments in the new and old versions of the firmware are processed for difference, and a control file, a difference file and a newly added file are obtained, which specifically includes: S221: Obtain the starting position, offset and size of the program class segment through the address information in the segment header table in the ELF file; S222: Perform Libdivsusort suffix processing on the incoming program class segment data to obtain a corresponding string index; S223: Set the longest matching string, use the string index corresponding to the new and old versions to find the longest character segment that fully matches, and use the starting point and end point of this segment as the starting point to search before and after the longest character segment to generate an approximately matching segment; the rule of approximate matching is that at least 50% of the bytes of the forward searched character segment and the backward searched character segment must match, and the character segments that do not meet the approximate match are regarded as difference character segments; thereby obtaining the difference file and position information generated by the data of the approximately matching string and the newly added file and its position information generated by the difference character segment, and integrating the position information of the difference file and the newly added file according to the position order to obtain the control file.

5. The vehicle-mounted ECU firmware update method for a vehicle-mounted TBox according to claim 1, characterized in that: In step S3, according to the address information in the control file, the difference files and the newly added files of the data class segment and the program class segment are respectively combined into new difference files and new files according to the address order; the difference files and the newly added files of the data class segment and the program class segment are marked respectively; the total address information, difference files and new files are compressed by the Bz2 algorithm to obtain a difference file package.

6. The vehicle-mounted ECU firmware update method for a vehicle-mounted TBox according to claim 1, characterized in that: In step S4, after the vehicle-mounted TBox receives the differential packet sent by the cloud, it performs the following steps: S41: Verify the data of the difference package to ensure file integrity, determine whether it meets the version requirements based on the label of the difference package, and check whether the local old version firmware meets the requirements. If both meet the requirements, execute step S42; S42: Load the old version firmware from the local; S43: decompressing the difference package using the Bz2 algorithm to obtain the control file, the difference file, and the newly added file; S44: determining the location to be operated in the old version firmware according to the location information in the control file; S45: judging whether the file to be operated is a data file or a program file according to the label in the control file, and if it is a data file, performing a 0-value expansion process on the data of the corresponding data segment difference file and the newly added file, and when a 0 value is read, the value of the last two digits is read and expanded according to the value of the last two digits; If it is a program segment, directly execute step S46; S46: If it is a newly added file, the data is directly inserted into the corresponding position in the old version of the firmware; If it is a control file, the location information in the control file replaces the corresponding data in the old version of the firmware for the expanded data class segment difference file.