Bootloader updating method and system of electric vehicle ECU and storage medium

By generating update files for the differing parts and dividing the storage space into blocks, only updating the blocks with differences, and encrypting the files, the problem of low update efficiency of ECU bootloader is solved, achieving efficient, safe, and low-cost update results.

CN116302031BActive Publication Date: 2026-03-03浙江奥思伟尔电动科技有限公司
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310298041.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-24
Publication Date
2026-03-03
Estimated Expiration
2043-03-24

AI Technical Summary

Technical Problem

In existing technologies, the ECU bootloader update efficiency is low, resulting in high update costs and low efficiency.

Method used

By generating update files for the differences, using an address table to record the location of the differences, updating only the blocks with differences, and encrypting the update files, efficient and secure bootloader updates are achieved.

Benefits of technology

It achieves efficient and low-cost bootloader updates, reduces update file size, facilitates remote transmission, and improves update security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116302031B_ABST
    Figure CN116302031B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of software, in particular to a bootloader updating method and system of an electric vehicle ECU and a storage medium, the method comprises the following steps: reading new_boot and old_boot, and generating an update refreshing file; the update refreshing file is sent to an ECU to be updated; the ECU to be updated is reset after executing the update refreshing file, and the updating of the bootloader is completed.The beneficial technical effects of the application include: the update refreshing file is generated, the updating of the bootloader is completed after the execution of the ECU, the updating of the bootloader is realized with high efficiency and low cost; the size of the update refreshing file is reduced by obtaining the differential part, so that remote transmission is facilitated; the updating efficiency of the bootloader is improved by updating only the differential part blocks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of software technology, and specifically to a bootloader update method, system, and storage medium for an electric vehicle ECU. Background Technology

[0002] Traditional automobiles typically use internal combustion engines for power, which accelerate the consumption of limited energy resources and cause serious environmental problems. New energy vehicles, characterized by zero emissions, low heat radiation, low noise, and environmental optimization, have gained significant attention and popularity. At different stages of electric vehicle controller development, updates to the control logic may be necessary, requiring software-level updates, i.e., controller software updates. However, updating the controller's bootloader requires removing it from the vehicle system, opening the controller housing, and performing the boot-level update via a simulator. This method is inefficient and requires on-site maintenance personnel. Therefore, there is a need to research technologies that enable more efficient bootloader updates for the ECU.

[0003] Existing technology discloses an ECU firmware update method based on bootloader self-updating, including: Step S1: Allocating the storage space of the ECU system; Step S2: Determining whether the ECU system receives an application update request or a bootloader update request. If it is an application update request, proceed to Step S3; if it is a bootloader update request, proceed to Step S4; Step S3: Updating the code in the application code area using an incremental update method, proceed to Step S5; Step S4: The bootloader program performs a comprehensive self-updating of the bootloader code area, proceed to Step S5; Step S5: Rewriting the corresponding version information in the version information area, and resetting the ECU system. Compared with existing technologies, this technical solution has the advantage of ensuring bootloader security. However, this technical solution still cannot solve the current technical problem of low bootloader update efficiency in ECUs. Summary of the Invention

[0004] The technical problem this invention aims to solve is the low efficiency of current ECU bootloader updates. This invention proposes a bootloader update method, system, and storage medium for electric vehicle ECUs, which can improve ECU bootloader update efficiency and reduce update costs.

[0005] To solve the above technical problems, the present invention adopts the following technical solution: a bootloader update method for an electric vehicle ECU, comprising the following steps:

[0006] Read new_boot and old_boot to generate the update file;

[0007] Send the update file to the ECU to be updated;

[0008] The ECU to be updated is reset after executing the update file, thus completing the bootloader update.

[0009] Preferred methods for generating update files include:

[0010] By comparing new_boot and old_boot, the differences between new_boot and old_boot are obtained;

[0011] The differences are sorted and numbered in order;

[0012] Establish an address table, which records the number, start address, and end address of the differing portion;

[0013] All the aforementioned differences and the address table constitute the update file.

[0014] Preferred methods for generating update files include:

[0015] The ECU's storage space is divided into several blocks, and each block is assigned a block number.

[0016] By comparing new_boot and old_boot, the differences between new_boot and old_boot are obtained;

[0017] Record all block numbers into which the difference portion falls, and denote them as the difference block numbers;

[0018] The update file is composed of the start and end addresses of all blocks, all the different block numbers, and the new_boot content corresponding to all the different block numbers.

[0019] As a preferred method, dividing the ECU's storage space into several blocks includes:

[0020] The ECU's storage space is divided into several blocks according to a preset length and then sorted.

[0021] After obtaining the difference portion, adjust the length of each block to minimize the number of blocks containing the difference portion;

[0022] Record the length and sequence number of each block, establish a block length function, the input of the block length function is the sequence number, and the output of the block length function is the length of the block corresponding to the sequence number.

[0023] Preferably, the block length function is a polynomial function, the independent variable x of the polynomial function is the index, and the function value of the polynomial function is the length of the block corresponding to the index.

[0024] Preferably, the method for sending the update file to the ECU to be updated includes:

[0025] The update file is encrypted, and the encrypted update file is sent to the ECU to be updated.

[0026] Preferably, the method for encrypting the update file includes:

[0027] The update file is converted into binary data, and the binary data is truncated into several binary numbers D;

[0028] Take the remainder of the binary number D modulo N1 to obtain the quotient k and the remainder u.

[0029] Take the remainder of quotient k with respect to N2 to obtain quotient k1 and remainder u1. Take the remainder u with respect to N3 to obtain quotient k2 and remainder u2.

[0030] Establish a cubic polynomial such that when the independent variable of the cubic polynomial takes the preset values ​​x1, x2, x3 and x4, the value of the cubic polynomial is equal to k1, u1, k2 and u2 respectively. Store the coefficients of the cubic polynomial as the encrypted value E of the binary number D.

[0031] The encrypted value E of all binary numbers D constitutes the ciphertext of the update file, and N1, N2, N3, x1, x2, x3 and x4 are all pre-agreed values.

[0032] Preferably, N1, N2 and N3 are all preset prime numbers, and satisfy N1>N3>N2.

[0033] An embedded system includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When executed by the processor, the computer program implements a bootloader update method for an electric vehicle ECU as described above.

[0034] A readable storage medium storing a program that, when executed by a processor, implements a bootloader update method for an electric vehicle ECU as described above.

[0035] The beneficial technical effects of this invention include: by generating an update file, which is then executed by the ECU to complete the bootloader update, a highly efficient and low-cost bootloader update is achieved; by obtaining the differences, the size of the update file is reduced, facilitating remote transmission; by dividing the storage space into blocks, only the blocks with differences are updated, thereby improving the efficiency of the bootloader update; and by encrypting the update file, the security of the update file is improved.

[0036] Other features and advantages of the present invention will be disclosed in detail in the following detailed description and accompanying drawings. Attached Figure Description

[0037] The invention will be further described below with reference to the accompanying drawings:

[0038] Figure 1 This is a schematic diagram of the bootloader update method for an ECU according to Embodiment 1 of the present invention.

[0039] Figure 2 This is a schematic diagram of the method for generating update files according to Embodiment 1 of the present invention.

[0040] Figure 3 This is a schematic diagram of the method for encrypting the update refresh file according to Embodiment 1 of the present invention.

[0041] Figure 4 This is a schematic diagram of the method for generating update files according to Embodiment 2 of the present invention.

[0042] Figure 5 This is a schematic diagram of the method for dividing the storage space of an ECU into several blocks according to Embodiment 2 of the present invention. Detailed Implementation

[0043] The technical solutions of the embodiments of the present invention will be explained and described below with reference to the accompanying drawings. However, the following embodiments are only preferred embodiments of the present invention and not all of them. Other embodiments obtained by those skilled in the art based on the embodiments in the implementation methods without creative effort are all within the protection scope of the present invention.

[0044] In the following description, terms such as “inner,” “outer,” “upper,” “lower,” “left,” and “right” are used only to indicate orientation or positional relationship for the convenience of describing the embodiments and simplifying the description, and are not intended to indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of the present invention.

[0045] For a method of updating the bootloader of an electric vehicle ECU, please refer to the appendix. Figure 1 This includes the following steps:

[0046] Read new_boot and old_boot to generate the update file;

[0047] Send the update file to the ECU to be updated;

[0048] The ECU to be updated executes the update file and then resets, completing the bootloader update. This solution generates an update file, which is then executed by the ECU to complete the bootloader update, achieving a high-efficiency and low-cost bootloader update.

[0049] In some embodiments, bootloader self-updating includes the following steps: filling and aligning the boot data that needs to be updated, wherein the size of the data alignment is related to the programming capability of the specific microcontroller flash driver, so that it can be flashed into the flash through the existing driver.

[0050] The generated files are processed to create a driver-acceptable array of C code source files and header files. This includes arrays of all generated blocks, the corresponding flash address and size for each array, and checksum data for each array. The generated files are then imported into an update project that includes a flash driver and compiled.

[0051] The generated update file is populated and aligned according to step 1. The Update is then updated to flash using the existing bootloader-based APP flashing scheme; any CAN, LIN, or Ethernet flashing protocol defined in the existing bootloader can be used. The update is then run from old_boot. The Update automatically updates the bootloader.

[0052] The automatic boot update process consists of several steps, specifically:

[0053] Step 1. Erase the flash block where the bootloader is located.

[0054] Step 2. Check if the boot flash block was successfully erased. If erased successfully, proceed to Step 3; if erased fails, proceed to the following sub-steps:

[0055] Step 2a. Update the data in the firmware jump address to the startup address of Update.

[0056] Step 2b. Reset the ECU and rerun the Update program.

[0057] Step 3. Program new_boot into the flash block area corresponding to boot in blocks.

[0058] Step 4. Perform relevant verification on the programmed area according to the fixed verification method. If the verification fails, proceed to the sub-step of Step 2 and terminate the update process; if the verification succeeds, proceed to Step 5.

[0059] Step 5. Determine if the size of the programmed data is less than the size of new_boot. If it is less, return to step 3 and program the next piece of data; if it is greater, proceed to step 6.

[0060] Step 6. Update the firmware jump data to the entry address of new_boot.

[0061] Step 7. Erase the validity of the update procedure.

[0062] Step 8. Reset and run the new bootloader.

[0063] On the other hand, please see the appendix Figure 2 Methods for generating update refresh files include:

[0064] Compare new_boot and old_boot to obtain the differences between them;

[0065] Sort and number the differences in order;

[0066] Establish an address table that records the number, starting address, and ending address of the differing parts;

[0067] The entire difference section and address table constitute the update file. By obtaining the difference section, the size of the update file is reduced, facilitating remote transmission.

[0068] By recording the differences using an address table, the location of the differences can be easily found. The starting address of the differences can be quickly located through the address bus of the flash memory. Writing the differences to the flash memory completes the updateloader update.

[0069] On the other hand, this embodiment provides a method for sending an update file to the ECU to be updated, specifically including: encrypting the update file and sending the encrypted update file to the ECU to be updated.

[0070] On the other hand, please see the appendix Figure 3 Methods for encrypting update files include:

[0071] Convert the update file to binary data, and truncate the binary data into several binary numbers D;

[0072] Take the remainder of the binary number D modulo N1 to obtain the quotient k and the remainder u.

[0073] Take the remainder of quotient k with respect to N2 to obtain quotient k1 and remainder u1. Take the remainder u with respect to N3 to obtain quotient k2 and remainder u2.

[0074] Establish a cubic polynomial such that when the independent variable of the cubic polynomial takes the preset values ​​x1, x2, x3 and x4, the value of the cubic polynomial is equal to k1, u1, k2 and u2 respectively. Store the coefficients of the cubic polynomial as the encrypted value E of the binary number D.

[0075] The encrypted value E of all binary numbers D constitutes the ciphertext of the update file, and N1, N2, N3, x1, x2, x3 and x4 are all pre-agreed values.

[0076] For example, given the binary number D = 10000111110011100B = 69532, N1 = 18269, N2 = 269, and N3 = 6551, taking the remainder of D with respect to N1 = 47963 yields a quotient k = 3 and a remainder u = 14725. Taking the remainder k = 3 with respect to N2 = 269 yields a quotient k1 = 0 and a remainder u1 = 3. Taking the remainder u = 14725 with respect to N3 = 6551 yields a quotient k2 = 2 and a remainder u2 = 1623. Therefore, k1 = 0, u1 = 3, k2 = 2, and u2 = 1623. If the preset x1, x2, x3, and x4 are x1 = 5, x2 = 8, x3 = 10, and x4 = 150 respectively, then the cubic polynomial in one variable can be:

[0077] F(x) = 0.002655588704641665*x^3 - 0.36107854020675745*x^2 + 5.351450079789073*x - 18.062235481856636. It's important to note that the established cubic polynomial is not unique. The encrypted value E of the binary number D is {0.002655588704641665, -0.36107854020675745, 5.351450079789073, -18.062235481856636}. Each binary number D corresponds to an encrypted value E. All encrypted values ​​E, along with N1, N2, N3, x1, x2, x3, and x4, constitute the ciphertext for updating the file.

[0078] In another embodiment, N1, N2 and N3 are all preset prime numbers, and satisfy N1>N3>N2.

[0079] The technical solution described in this embodiment improves the efficiency of bootloader updates by dividing the storage space into blocks and updating only the blocks with differences; and improves the security of update files by encrypting the update files.

[0080] Example 2:

[0081] A method for updating the bootloader of an electric vehicle ECU is presented in this embodiment. Based on Embodiment 1, this embodiment proposes a new technical solution for generating the update file. Please refer to the appendix. Figure 4 The method for generating the update file in this embodiment includes:

[0082] The ECU's storage space is divided into several blocks, and each block is assigned a block number.

[0083] Compare new_boot and old_boot to obtain the differences between them;

[0084] Record all block numbers into which the difference portion falls, and denote them as the difference block number;

[0085] The update file contains the new_boot content corresponding to the difference block number. The start and end addresses of all blocks, all difference block numbers, and the new_boot content corresponding to all difference block numbers constitute the update file.

[0086] The update file is constructed by combining all the difference block numbers and their corresponding start and end addresses with the corresponding new_boot content. During the update, the content of the corresponding block is written to flash.

[0087] Please see the appendix Figure 5 Methods for dividing the ECU's storage space into several blocks include:

[0088] The ECU's storage space is divided into several blocks according to a preset length and then sorted.

[0089] After obtaining the differences, adjust the length of each block to minimize the number of blocks with differences.

[0090] Record the length and sequence number of each block, establish a block length function, the input of the block length function is the sequence number, and the output of the block length function is the length of the block corresponding to the sequence number.

[0091] The block length function is a polynomial function, where the independent variable x is the index, and the function value is the length of the block corresponding to the index.

[0092] There are minimum and maximum length restrictions for adjusting the block length. The block length can be obtained by substituting the sequence number as the independent variable x into the block length function.

[0093] An embedded system includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When executed by the processor, the computer program implements a bootloader update method for an electric vehicle ECU as described above.

[0094] On the other hand, embodiments of this application provide an embedded system, which includes a memory, a processor, and a program stored in the memory and executable on the processor. When the program is executed by the processor, it implements the method as described above.

[0095] An embedded system can be a general-purpose embedded system or a special-purpose embedded system. In specific implementations, an embedded system can be a server cluster including multiple servers, such as a blockchain system including multiple nodes. Those skilled in the art will understand that this is merely an example of an embedded system and does not constitute a limitation on the embedded system. It may include more or fewer components than illustrated, or combine certain components, or different components, such as input / output devices, network access devices, etc.

[0096] The processor can be a Central Processing Unit (CPU), or it can be 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. A general-purpose processor can be a microprocessor or any conventional processor.

[0097] In some embodiments, the memory can be an internal storage unit of the embedded system, such as a hard drive or RAM. In other embodiments, the memory can be an external storage device of the embedded system, such as a plug-in hard drive, Smart Media Card (SMC), Secure Digital (SD) card, or Flash Card. Furthermore, the memory can include both internal and external storage units of the embedded system. The memory is used to store the operating system, applications, boot loader, data, and other programs. The memory can also be used to temporarily store data that has been output or will be output.

[0098] On the other hand, embodiments of this application provide a readable storage medium storing a program that, when executed by a processor, implements the method as described above.

[0099] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Those skilled in the art should understand that the present invention includes, but is not limited to, the contents described in the accompanying drawings and the specific embodiments above. Any modifications that do not depart from the functional and structural principles of the present invention will be included within the scope of the claims.

Claims

1. A method for updating the bootloader of an electric vehicle ECU, characterized in that, Includes the following steps: Read new_boot and old_boot to generate the update file; Send the update file to the ECU to be updated; The ECU to be updated is reset after executing the update file, thus completing the bootloader update; The method for sending the update file to the ECU to be updated includes: The update file is encrypted, and the encrypted update file is sent to the ECU to be updated; The methods for encrypting the update file include: The update file is converted into binary data, and the binary data is truncated into several binary numbers D; Take the remainder of the binary number D modulo N1 to obtain the quotient k and the remainder u. Take the remainder of quotient k with respect to N2 to obtain quotient k1 and remainder u1. Take the remainder u with respect to N3 to obtain quotient k2 and remainder u2. Establish a cubic polynomial such that when the independent variable of the cubic polynomial takes the preset values ​​x1, x2, x3 and x4, the value of the cubic polynomial is equal to k1, u1, k2 and u2 respectively. Store the coefficients of the cubic polynomial as the encrypted value E of the binary number D. The encrypted value E of all binary numbers D constitutes the ciphertext of the update file, and N1, N2, N3, x1, x2, x3 and x4 are all pre-agreed values.

2. The bootloader update method for an electric vehicle ECU according to claim 1, characterized in that, Methods for generating update refresh files include: By comparing new_boot and old_boot, the differences between new_boot and old_boot are obtained; The differences are sorted and numbered in order; Establish an address table, which records the number, start address, and end address of the differing portion; All the aforementioned differences and the address table constitute the update file.

3. The bootloader update method for an electric vehicle ECU according to claim 1, characterized in that, Methods for generating update refresh files include: The ECU's storage space is divided into several blocks, and each block is assigned a block number. By comparing new_boot and old_boot, the differences between new_boot and old_boot are obtained; Record all block numbers into which the difference portion falls, and denote them as the difference block numbers; The update file is composed of the start and end addresses of all blocks, all the different block numbers, and the new_boot content corresponding to all the different block numbers.

4. The bootloader update method for an electric vehicle ECU according to claim 3, characterized in that, Methods for dividing the ECU's storage space into several blocks include: The ECU's storage space is divided into several blocks according to a preset length and then sorted. After obtaining the difference portion, adjust the length of each block to minimize the number of blocks containing the difference portion; Record the length and sequence number of each block, establish a block length function, the input of the block length function is the sequence number, and the output of the block length function is the length of the block corresponding to the sequence number.

5. The bootloader update method for an electric vehicle ECU according to claim 4, characterized in that, The block length function is a polynomial function, the independent variable x of the polynomial function is the index, and the function value of the polynomial function is the length of the block corresponding to the index.

6. The bootloader update method for an electric vehicle ECU according to claim 1, characterized in that, N1, N2, and N3 are all preset prime numbers, and satisfy N1>N3>N2.

7. An embedded system, characterized in that, The embedded system includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When executed by the processor, the computer program implements a bootloader update method for an electric vehicle ECU as described in any one of claims 1 to 6.

8. A readable storage medium, characterized in that, The readable storage medium stores a program that, when executed by a processor, implements a bootloader update method for an electric vehicle ECU as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Bootloader upgrading method and system based on UDS

    CN113986294A