Compression, encryption and upgrading method for automobile ECU (Electronic Control Unit) software

By adopting compression and encryption processing methods in the ECU software upgrade, the problems of traditional writing efficiency and insufficient security are solved, more efficient and secure data transmission is achieved, and OTA upgrade of the whole vehicle and UDS diagnostic writing are improved. performance.

CN118916054APending Publication Date: 2024-11-08WUHAN LINCONTROL AUTOMOTIVE ELECTRONICS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411056382.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-02
Publication Date
2024-11-08

AI Technical Summary

Technical Problem

The traditional automotive ECU software flashing method is inefficient and unsafe, especially due to the limited data transmission speed caused by plain text transmission, and the existing compression and upgrade systems do not consider the encryption function, resulting in insufficient flashing efficiency.

Method used

The program file is compressed and encrypted by using compression algorithms, and new data files are generated through negotiation between the host computer and the ECU, and data decryption and decompression are used to use a circular queue to transmit in blocks to improve the flushing efficiency and security.

Benefits of technology

It improves the writing efficiency and security of the ECU software upgrade process, avoids cache clearance, and significantly improves the performance of OTA upgrade and UDS diagnostic writing time of the whole vehicle.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118916054A_ABST
    Figure CN118916054A_ABST
Patent Text Reader

Abstract

The invention discloses an automobile ECU (Electronic Control Unit) software compression and encryption upgrading method. The method comprises the following steps: S1, compiling a project to generate a program file; s2, preprocessing the program file by an upper computer script; s3, transmitting a program file by the upper computer; s4, judging whether the upper computer transmits all data or not; s5, if yes, the ECU decompresses the data and judges whether the data length is consistent with the expectation or not, if yes, the ECU immediately writes the received data into the FLASH, and if not, the ECU displays that flashing is abnormal and quits the flashing process; s6, if not, the upper computer transmits a data block to the ECU, the ECU processes the received data block, the safety is improved by encrypting compressed data, a circular queue is adopted in the data decompression process, cache clearing is not needed, the flashing efficiency is guaranteed to a certain extent, and the data compression efficiency is improved. The automobile ECU software compression and encryption upgrading method provided by the invention has an encryption function and has the effect of improving the flashing efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of automobile production, and in particular relates to a method for compressing, encrypting and upgrading automobile ECU software. Background Art

[0002] The traditional flashing method is to directly transmit the contents of the program file in plain text based on the UDS protocol. First of all, this method is inefficient. If the program file data file is very large, the flashing speed will be limited by the message transmission speed, which seriously affects the flashing speed of the program. Secondly, the transmission process is not safe because it is plain text transmission.

[0003] A Chinese patent application with application number CN202210314502.6 and titled: Automobile ECU software compression upgrade system, method, electronic device and storage medium records, including, S1, compressing the executable program in the ECU software upgrade package; S2, deploying the ECU software upgrade package to the host computer node used to flash the ECU, and the host computer node parses the ECU software upgrade package to obtain a compressed package of the executable program; S3, transmitting the compressed package of the executable program to the ECU in blocks and storing it in the buffer; S4, the ECU decompresses the block compressed package in the buffer, and flashes the decompressed data to the ECU, and clears the buffer after the flashing is completed; S5, repeating steps S3-S4 until the flashing of the executable program is completed. The present invention effectively improves the flashing efficiency of the ECU software upgrade process and saves the OTA upgrade time or UDS diagnostic flashing time of the whole vehicle.

[0004] The above-mentioned prior art discloses a compression upgrade system, but does not take into account functions such as encryption, and the cache area needs to be cleared after each compression, and the flashing efficiency is insufficient and needs to be improved. Summary of the invention

[0005] In view of the above problems, a method for compressing and encrypting automobile ECU software and upgrading it is now provided to solve the problems existing in the prior art.

[0006] The specific technical solutions are as follows:

[0007] A method for compressing and encrypting automobile ECU software and upgrading the software comprises the following steps:

[0008] S1. Compile the project to generate program files;

[0009] S2, host computer script preprocessing program file;

[0010] S3, host computer transmits program files;

[0011] S4, determine whether the host computer transmits all data;

[0012] S5. If yes, the ECU decompresses the data and determines whether the data length is consistent with the expected value. If the length is consistent, the ECU will immediately write the received data into the FLASH. If the length is inconsistent, the ECU will display a flash writing exception and exit the flash writing process.

[0013] S6. If not, the host computer transmits a data block to the ECU. The ECU processes the received data block and decompresses the data block to determine whether its length is consistent with the expected length. If the length is consistent, it returns to step S3. If the length is inconsistent, the ECU displays a flashing exception and exits the flashing process.

[0014] The above-mentioned automobile ECU software compression encryption upgrade method also has the following characteristics: step S2 comprises:

[0015] S21, read program file: remove the file format related information, and only load the specific data in the file;

[0016] S22, compressing binary data based on a compression algorithm;

[0017] S23, concatenating the compressed data with the lengths before and after compression: concatenating the compressed data generated in step S22 with the original length and the length after compression to form a new data file;

[0018] S24, encrypting the combined data obtained in step S23;

[0019] S25. Using the address that does not exist in the single-chip microcomputer as the base address, address the data obtained in S24 or the data obtained in S23, and fill the generated new data file with data aligned with the length of 0x100.

[0020] The above-mentioned automobile ECU software compression encryption upgrade method also has the following characteristics: step S3 comprises:

[0021] S31, transmitting the processed new data in the form of a message;

[0022] S32. If the processed new data uses an encryption algorithm, the host computer needs to change the RequestDownload instruction in the UDS to distinguish it from the instruction that only uses the compression algorithm;

[0023] S33, transmitting the content of the new data in blocks.

[0024] The above-mentioned automobile ECU software compression encryption upgrade method also has the following characteristics: step S4 comprises:

[0025] S41, ECU receives the processed message: After obtaining the message, it is first stored in the message circular queue MsgCircularQueue. If the encryption algorithm is used, it goes to step S42, and if the encryption algorithm is not used, it goes to step S44;

[0026] S42, decrypt the data according to the decryption algorithm: the upper computer and the lower computer use the key agreed in advance to decrypt, and the decrypted data is stored in the decrypted circular queue DecryptedCircularQueue;

[0027] S43, decompressing data: decompressing the data in the decrypted circular queue DecryptedCircularQueue;

[0028] S44, decompressing data: decompressing the data in the message circular queue MsgCircularQueue.

[0029] In summary, the beneficial effects of this scheme are:

[0030] In the automobile ECU software compression and encryption upgrade method provided by the present invention, security is improved by encrypting the compressed data, and a circular queue is used in the data decompression process, and the flash writing efficiency is guaranteed to a certain extent without the need to clear the cache. The automobile ECU software compression and encryption upgrade method provided by the present invention has an encryption function and improves the flash writing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] Figure 1 It is a logic block diagram of the automobile ECU software compression encryption upgrade method of the present invention;

[0032] Figure 2 It is a detailed logic block diagram of step S2 of the automobile ECU software compression encryption upgrade method of the present invention;

[0033] Figure 3 It is a detailed logic block diagram of step S3 of the automobile ECU software compression encryption upgrade method of the present invention;

[0034] Figure 4 The detailed logic block diagram of step S4 of the automobile ECU software compression encryption upgrade method of the present invention. DETAILED DESCRIPTION

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

[0036] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments may be combined with each other.

[0037] The present invention will be further described below in conjunction with specific embodiments, but the present invention is not limited thereto.

[0038] Figure 1 This is a logic block diagram of the automobile ECU software compression encryption upgrade method of the present invention. Figure 2 The detailed logic block diagram of step S2 of the automobile ECU software compression encryption upgrade method of the present invention is as follows: Figure 3 The detailed logic block diagram of step S3 of the automobile ECU software compression encryption upgrade method of the present invention is as follows: Figure 4 The detailed logic block diagram of step S4 of the automobile ECU software compression encryption upgrade method of the present invention is as follows: Figure 1-Figure 4 As shown, the automobile ECU software compression encryption upgrade method provided in this embodiment includes the following steps:

[0039] S1. Compile the project to generate program files;

[0040] S2, host computer script preprocessing program file;

[0041] S3, host computer transmits program files;

[0042] S4, determine whether the host computer transmits all data;

[0043] S5. If yes, the ECU decompresses the data and determines whether the data length is consistent with the expected value. If the length is consistent, the ECU will immediately write the received data into the FLASH. If the length is inconsistent, the ECU will display a flash writing exception and exit the flash writing process.

[0044] S6. If not, the host computer transmits a data block to the ECU. The ECU processes the received data block and decompresses the data block to determine whether its length is consistent with the expected length. If the length is consistent, it returns to step S3. If the length is inconsistent, the ECU displays a flashing exception and exits the flashing process.

[0045] It should be noted that this method is implemented based on Infineon TC3XX chip, and the code executed by the algorithm is stored in RAM for execution.

[0046] In the above embodiment, step S2 includes:

[0047] S21, read program file: remove the file format related information, and only load the specific data in the file;

[0048] S22, compressing binary data based on a compression algorithm;

[0049] S23, concatenating the compressed data with the lengths before and after compression: concatenating the compressed data generated in step S22 with the original length and the length after compression to form a new data file;

[0050] S24, encrypting the combined data obtained in step S23;

[0051] S25. Using the address that does not exist in the single-chip microcomputer as the base address, address the data obtained in S24 or the data obtained in S23, and fill the generated new data file with data aligned with the length of 0x100.

[0052] It should be noted that step S24 is a non-essential procedure and is performed only when data encryption is required. If encryption is not required, the process can jump from step S23 to step S25.

[0053] In the above embodiment, step S3 includes:

[0054] S31, transmitting the processed new data in the form of a message;

[0055] S32. If the processed new data uses an encryption algorithm, the host computer needs to change the RequestDownload instruction in the UDS to distinguish it from the instruction that only uses the compression algorithm;

[0056] S33, transmitting the content of the new data in blocks.

[0057] It should be noted that the content of block transmission of new data includes block size, ECU buffer space allocation, compression algorithm, etc.

[0058] In the above embodiment, step S4 includes;.

[0059] S41, ECU receives the processed message: After obtaining the message, it is first stored in the message circular queue MsgCircularQueue. If the encryption algorithm is used, it goes to step S42, and if the encryption algorithm is not used, it goes to step S44;

[0060] S42, decrypt the data according to the decryption algorithm: the upper computer and the lower computer use the key agreed in advance to decrypt, and the decrypted data is stored in the decrypted circular queue DecryptedCircularQueue;

[0061] S43, decompressing data: decompressing the data in the decrypted circular queue DecryptedCircularQueue;

[0062] S44, decompressing data: decompressing the data in the message circular queue MsgCircularQueue.

[0063] It should be noted that compared with the traditional flashing scheme, for the same size of 0x590000 and the same clock configuration of 240Mhz, the original scheme takes 150s to 155s. If only the compression algorithm (LZ series algorithm) is used for flashing, the flashing time is 66s to 69s. If the encryption algorithm (TEA_ECB algorithm) is added, the time is about 73 to 75s. From the results, it can be seen that the speed performance and security of this method have been greatly improved. The algorithm of this method is mainly implemented in the DSPR of the Infineon chip. If it is implemented in the PSPR and the CPU main frequency is increased to the maximum main frequency, the flashing time can be further optimized.

[0064] The above are only preferred embodiments of the present invention, and are not intended to limit the implementation methods and protection scope of the present invention. Those skilled in the art should be aware that all solutions obtained by equivalent substitutions and obvious changes made using the contents of the specification of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for compressing and encrypting automobile ECU software and upgrading it, characterized in that: The following steps are involved: S1. Compile the project to generate program files; S2, host computer script preprocessing program file; S3, host computer transmits program files; S4, determine whether the host computer transmits all data; S5. If yes, the ECU decompresses the data and determines whether the data length is consistent with the expected value. If the length is consistent, the ECU will immediately write the received data into the FLASH. If the length is inconsistent, the ECU will display a flash writing exception and exit the flash writing process. S6. If not, the host computer transmits a data block to the ECU. The ECU processes the received data block and decompresses the data block to determine whether its length is consistent with the expected length. If the length is consistent, it returns to step S3. If the length is inconsistent, the ECU displays a flashing exception and exits the flashing process.

2. The method for compressing and encrypting automobile ECU software upgrade according to claim 1, characterized in that: The step S2 comprises: S21, read program file: remove the file format related information, and only load the specific data in the file; S22, compressing binary data based on a compression algorithm; S23, concatenating the compressed data with the lengths before and after compression: concatenating the compressed data generated in step S22 with the original length and the length after compression to form a new data file; S24, encrypting the combined data obtained in step S23; S25. Using the address that does not exist in the single-chip microcomputer as the base address, address the data obtained in S24 or the data obtained in S23, and fill the generated new data file with data aligned with the length of 0x100.

3. The method for compressing and encrypting automobile ECU software upgrade according to claim 2, characterized in that: The step S3 comprises: S31, transmitting the processed new data; S32. If the processed new data uses an encryption algorithm, the host computer needs to change the RequestDownload instruction in the UDS to distinguish it from the instruction that only uses the compression algorithm; S33. Transmit the content of new data in blocks: the size of the block is related to the ECU buffer space allocation and compression algorithm.

4. The method for compressing and encrypting automobile ECU software upgrade according to claim 3 is characterized in that: The step S4 includes;. S41, ECU receives the processed message: After obtaining the message, it is first stored in the message circular queue MsgCircularQueue. If the encryption algorithm is used, it goes to step S42, and if the encryption algorithm is not used, it goes to step S44; S42, decrypt the data according to the decryption algorithm: the upper computer and the lower computer use the key agreed in advance to decrypt, and the decrypted data is stored in the decrypted circular queue DecryptedCircularQueue; S43, decompressing data: decompressing the data in the decrypted circular queue DecryptedCircularQueue; S44, decompressing data: decompressing the data in the message circular queue MsgCircularQueue.