Method, device, computer equipment and storage medium for resuming ECU flashing

By using the sector-based breakpoint continuous transfer and writing method in embedded operating systems, the sector accuracy and continuous transfer problems of MCU FLASH upgrade data are solved, and the rapid and accurate upgrade and writing are achieved, extending the FLASH Service life.

CN116483414BActive Publication Date: 2024-11-15CHONGQING SELIS PHOENIX INTELLIGENT INNOVATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310487794.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-04
Publication Date
2024-11-15
Estimated Expiration
2043-05-04

AI Technical Summary

Technical Problem

In the existing embedded operating system, MCU FLASH upgrade data breakpoint continuous transfer and write method has sector accuracy problems, resulting in low efficiency and cannot record sector numbers simultaneously in the cloud, resulting in MCU FLASH unable to continue upload upgrade and write data due to abnormality, and Full coverage brushing method takes a lot of time.

Method used

Using the sector-based breakpoint continuous transfer and writing method, read the number of flushed sectors from the ECU, determine the starting flushed sector position, and perform continuous Passing and writing, only some sectors that have been brushed are erased to avoid full coverage erasing, and use the OTA main control module and ECU to record the sector location at the same time to ensure the accuracy of continuous transmission.

Benefits of technology

It greatly saves the upgraded brushing time, extends the service life of FLASH, solves the problem of the inability to record the brushing position due to sudden power failure, and ensures the accuracy of the continuous transmission by recording the sector position in real time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116483414B_ABST
    Figure CN116483414B_ABST
Patent Text Reader

Abstract

The present invention discloses a method, device, computer equipment and storage medium for resuming the writing of an ECU at a breakpoint; including: reading the position of the number of sectors that have been written from the ECU to determine the starting position of the sector to be written; reading the ECU upgrade file from the OTA master control module UMC, and taking out the data of the previous sector corresponding to the starting position of the sector to be written from the upgrade data written into the ECU, and comparing the upgrade file with the data of the previous sector; if the comparison result is exactly the same, then start writing the data from the starting position of the starting position of the sector to be written; if the comparison result is not exactly the same, then return to the previous sector position for comparison until they are exactly the same, and continue the transmission based on the exactly the same sector position until the upgrade is completed. The present invention is to write in units of sectors. If the last upgrade of the upgrade file of the ECU has not been completed, the current upgrade only needs to continue writing from the sector at the position of the sector that has been written.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data communication, and in particular to a method, a device, a computer device and a storage medium for flashing an ECU based on OTA breakpoint resume transmission. Background Art

[0002] As we all know, OTA stands for Over the Air Technology, which means space download technology. Car OTA upgrade refers to firmware upgrade and software upgrade via air download technology. OTA not only brings a more convenient way to upgrade vehicles, but also allows consumers to experience a smarter and more convenient car experience. Downloading new software update packages from a remote server over the Internet to upgrade the system has the following significance for intelligent connected cars:

[0003] 1. Quickly repair system defects;

[0004] 2. Rapid iteration to improve product and user experience;

[0005] 3. Save time and money for both parties.

[0006] However, in the existing embedded operating system, the breakpoint resuming of data packets is as follows:

[0007] 1. It is mainly used for the breakpoint-resume download of the MPU upgrade package. The breakpoint-resume flashing method for the MCU FLASH upgrade data is relatively simple, that is, simply recording the sector number of the flashing and saving it to a certain location of the FLASH. The disadvantages of this solution are also obvious: (1) If there is a sudden power failure, there is no time to save the sector location of the flashing; (2) If a bad area appears at the location where the sector number is recorded, the recording will fail.

[0008] 2. Regarding the accuracy of the sector number of the current data written by the MCU FLASH upgrade data breakpoint, the sector number of the current data written is not recorded dynamically and timely according to the current system environment and transmission rate, which may lead to a large deviation in sector accuracy and re-flash the written data, resulting in reduced efficiency;

[0009] 3. Currently, the sector number of the MCUFLASH data flashing is not recorded synchronously in the cloud, resulting in the MCUFLASH being unable to continue to upgrade the flashing data due to an abnormality.

[0010] As we all know, for FLASH, a whole FLASH consists of multiple blocks, and a block consists of one or more sectors. Assume that the whole FLASH contains N blocks, a block contains 4 sectors, and a sector is 512 bytes. Figure 2As shown on the right (depending on the FLASH specifications). Their relationship is: whole chip FLASH> block (bank)> sector (sector). Every time you flash the FLASH to upgrade the program, you must first erase the FLASH address corresponding to the upgrade program before you can flash it. The FLASH erase method is to erase the whole chip, erase by block, and erase by sector. The current flash programming method is to erase the whole chip and fully overwrite the programming upgrade file. The disadvantages of this are obvious: (1) The whole chip erase time is long. The larger the FLASH capacity, the longer it takes, which may take tens of seconds to several minutes; (2) The full overwrite programming upgrade file is written to the ECU on the OTA master side through the low-speed CAN channel UDS. The transmission time plus the flash programming FLASH takes a lot of time. The larger the file, the longer it takes. For an 8Mbyte file, this method may take about 7-8 minutes. Summary of the invention

[0011] Therefore, in order to solve the above-mentioned shortcomings, the present invention provides a method, device, computer equipment and storage medium for ECU flashing based on OTA breakpoint continuation. The flashing programming of the present invention is flashing in sectors. If the last upgrade of the upgrade file of the ECU has not been completed, the current upgrade flashing only needs to continue to flash from the sector where the flashed sector position is recorded, so there is no need to flash from the beginning; this will inevitably greatly save the transmitted data content, flash programming is faster, and greatly save the upgrade flashing time.

[0012] The present invention is implemented as follows: a method for resuming the transmission of a breakpoint to flash an ECU, characterized in that it includes:

[0013] Read the number of sectors that have been flashed from the ECU to determine the starting sector position for flashing;

[0014] Read the ECU upgrade file from the OTA main control module UMC, and take out the data of the previous sector corresponding to the starting flashing sector position from the upgrade data written into the ECU, compare the upgrade file with the data of the previous sector, and obtain a comparison result;

[0015] If the comparison results are exactly the same, then start writing data from the starting position of the starting writing sector position;

[0016] If the comparison result is not exactly the same, then go back to the previous sector position for comparison until they are exactly the same, and continue the transmission based on the exactly the same sector position until the upgrade is completed.

[0017] Preferably, respectively read the position of the number of sectors that have been flashed from the OTA main control module UMC and the ECU, compare the arrays of the sectors that have been flashed in the OTA main control module UMC and the ECU, and take the larger sector value as the starting position of the sector that has been flashed.

[0018] Preferably, the following operation is also included before reading the position of the number of sectors that have been written:

[0019] Read the identification information of the flashed ECU, the identification information includes the total capacity of the ECU FLASH, the number of bytes of each sector of the ECU FLASH, and the ECU upgrade version information;

[0020] Read the current ECU upgrade file version number from the cloud;

[0021] Compare the file versions read from the cloud and the ECU. If they are consistent, the step of reading the flashed sector number position from the OTA master control module UMC and the ECU respectively is not performed.

[0022] If the comparison is inconsistent, read the record file saved in the OTA main control module UMC to determine whether the ECU has completed the OTA flash upgrade, and exit if completed; the record file is located in the OTA main control module UMC and forms a positioning mapping with the FLASH sector.

[0023] Preferably, in the process of continuing to flash the ECU FLASH, each time a sector of data is sent to the ECU, the flashed sector position field is increased by one in the OTA master control module UMC corresponding to the ECU record file.

[0024] Preferably, if an interrupt exception occurs during the continued flashing of the ECU, perform the following operations;

[0025] The OTA master control module UMC calculates the sectors that have been flashed, and through calculation, it is known that the file has been written to the location in the ECU device FLASH sector;

[0026] Among them, the sector sec written = the number of characters transmitted / the unit capacity of the sector;

[0027] If it is detected that the ECU has returned to normal, the flash will be continued from the starting address of the corresponding sec sector.

[0028] Preferably, in the process of continuing to flash the ECUFLASH, the ECU will accumulate the received data according to the number of bytes of a sector, and adjust the number of sectors that have been written to the last sector of the FLASH according to the current received data and the rate of writing to the FLASH.

[0029] Preferably, during the process of flashing the ECUFLASH, the OTA main control module UMC and the ECU simultaneously accumulate the flashed upgrade sectors.

[0030] A device for resuming the transmission of a breakpoint and flashing an ECU, comprising:

[0031] The module for reading the number of sectors that have been flashed is used to read the number of sectors that have been flashed from the ECU.

[0032] The file reading module is used to read the ECU upgrade file from the OTA main control module UMC.

[0033] A data fetching module is used to fetch data of a sector before the starting flashing sector position from the upgrade data written into the ECU;

[0034] A comparison module, used for comparing the upgrade file with the data of the previous sector;

[0035] The data writing module is used to write data to the ECU.

[0036] A computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method for resuming the transmission of the ECU by breakpoint when executing the computer program.

[0037] A storage medium includes a stored program, wherein when the program is running, the device where the storage medium is located is controlled to execute the computer program to implement the steps of the method of breakpoint resume flashing ECU.

[0038] The present invention has the following advantages: The present invention provides a method for resuming the transmission of MCU by breakpoint, specifically a method for resuming the transmission of MCU by breakpoint based on OTA, the method comprising: reading the position of the number of sectors that have been flashed from the ECU to determine the starting position of the flashing sector; reading the ECU upgrade file from the OTA main control module UMC, and taking out the data of the previous sector corresponding to the starting position of the flashing sector from the upgrade data written in the ECU, comparing the upgrade file with the data of the previous sector to obtain a comparison result; if the comparison result is exactly the same, then start flashing the data from the starting position of the starting position of the flashing sector; if the comparison result is not exactly the same, then return to the previous sector position for comparison until they are exactly the same, and resume transmission based on the exactly the same sector position until the upgrade is completed. (1) By resuming the transmission of the upgrade flashing data packet, the data is much less than that of the full overwrite flashing file, which greatly saves the upgrade flashing time, and the full overwrite erasure flashing also has a great impact on the service life of FLASH, greatly shortening the service life of FLASH. By resuming the upgrade flashing, only part of the sectors are erased and flashed, which can also greatly extend the service life of FLASH. (2) Solve the problem that the ECU itself cannot record the current flash sector location due to a sudden power outage and cannot continue the upgrade. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings in the following description are only exemplary, and for ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0040] Figure 1 This is a connection diagram of the vehicle-side OTA involved in the present invention;

[0041] Figure 2 This is a block diagram of OTA and ECU communication involved in the present invention;

[0042] Figure 3 It is a schematic diagram of the recording format composition involved in the present invention;

[0043] Figure 4 This is a schematic diagram of the OTA flashing logic process involved in the present invention;

[0044] Figure 5 It is a schematic diagram of FLASH address information involved in the present invention;

[0045] Figure 6 It is a schematic diagram of the implementation process corresponding to the continued transmission of the present invention;

[0046] Figure 7 It is a schematic diagram of the cloud upgrade file of the present invention;

[0047] Figure 8 This is a flowchart of the process after downloading the upgrade file from the cloud to the local computer;

[0048] Fig. 9 yes Figure 4 The corresponding part of the flow chart on the right side;

[0049] Fig.10 It is a schematic diagram of a device for resuming breakpoint transmission and flashing MCU according to the present invention;

[0050] Fig.11 4 is a structural diagram of a computer device in an embodiment of the present invention. DETAILED DESCRIPTION

[0051] The following will be combined with the attached Figure 1-Figure 11 The present invention is described in detail, and the technical solutions in the embodiments of the present invention are clearly and completely described. 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.

[0052] The present invention is applied to realize OTA upgrade and flashing ECU, so as to achieve the purpose of realizing continuous transmission and flashing ECU-MCU. The present invention mentions the MCU flashing and upgrading technology of vehicle-side OTA, which mainly involves OTA upgrade master control (UMC), OTA upgrade agent (UA), ECU FLASH, etc. This technology is mainly implemented in the TBOX, Gateway (GW) and ECU to be flashed, respectively. The corresponding connection is as follows: Figure 1 shown.

[0053] Another example Figure 2 As shown, Figure 2 This is a communication block diagram between OTA and ECU involved in the present invention. Figure 2 The ECU component is on the right side, which consists of an MCU controller and FLASH memory.

[0054] The following mainly describes FLASH. As we all know, a whole FLASH consists of multiple blocks, and a block consists of one or more sectors. Here, it is assumed that the whole FLASH contains N blocks, a block contains 4 sectors, and a sector is 512 bytes. Figure 2As shown on the right (depending on the FLASH specifications). Their relationship is: whole chip FLASH> block (bank)> sector (sector). Every time you flash the FLASH to upgrade the program, you must first erase the FLASH address corresponding to the upgrade program before you can flash it. The FLASH erase method is to erase the whole chip, erase by block, and erase by sector. The current flash programming method is to erase the whole chip and fully overwrite the programming upgrade file. The disadvantages of this are obvious: (1) The whole chip erase time is long. The larger the FLASH capacity, the longer it takes, which may take tens of seconds to several minutes; (2) The full overwrite programming upgrade file is written to the ECU on the OTA master side through the low-speed CAN channel UDS. The transmission time plus the flash programming FLASH takes a lot of time. The larger the file, the longer it takes. For an 8Mbyte file, this method may take about 7-8 minutes. Based on this, the present invention provides a method for resuming the transmission of MCU, specifically a method for resuming the transmission of MCU based on OTA. The flashing programming of the present invention is performed in sectors. If the last upgrade of the upgrade file of the ECU has not been completed, the current upgrade only needs to continue the transmission and flashing from the sector where the "flashed sector position" is recorded, and there is no need to transmit and flash from the beginning. This greatly saves the content of the transmitted data, makes the flashing programming faster, and greatly saves the upgrade flashing time. See the record format for details. Figure 3 shown.

[0055] The specific implementation of the present invention is described in detail below;

[0056] Embodiment 1: The present invention provides a method for resuming the transmission of a MCU at a breakpoint, specifically a method for resuming the transmission of a MCU at a breakpoint based on OTA, wherein the implementation process corresponding to the resuming transmission includes the following steps: Figure 6 As shown;

[0057] S101, reading the position of the number of sectors that have been flashed from the ECU to determine the starting position of the flashing sector;

[0058] S102, reading the ECU upgrade file from the OTA master control module UMC, and taking out data of a sector before the start flashing sector position from the upgrade data written into the ECU;

[0059] S103, comparing the upgrade file with the data of the previous sector to obtain a comparison result;

[0060] S104, if the comparison results are exactly the same, then start writing data from the starting position of the starting writing sector position;

[0061] S105, if the comparison result is not exactly the same, then go back to the previous sector position for comparison until they are exactly the same, and continue the transmission based on the exactly the same sector position until the upgrade is completed.

[0062] When implementing this embodiment, the positions of the flashed sector numbers are read from the OTA main control module UMC and the ECU respectively, the flashed sector arrays in the OTA main control module UMC and the ECU are compared, and the larger sector value is taken as the starting flashing sector position.

[0063] When the present invention is implemented, the following Figure 7 , before reading the location of the number of sectors that have been written, the following operations are also included;

[0064] J101, read the identification information of the flashed ECU, the identification information includes the total capacity of the ECU FLASH, the number of bytes of each sector of the ECU FLASH, and the ECU upgrade version information;

[0065] J102, read the current ECU upgrade file version number on the cloud;

[0066] J103, compare the file versions in the cloud and those read from the ECU, if they are consistent, do not execute the step of reading the number of flashed sectors from the OTA master control module UMC and the ECU respectively;

[0067] J104, if the comparison is inconsistent, read the record file saved in the OTA main control module UMC to determine whether the ECU has completed the OTA flash upgrade, and exit if completed; the record file is located in the OTA main control module UMC and forms a positioning mapping with the FLASH sector.

[0068] In order to more clearly embody the concept of the present invention, Figure 4 Provide specific instructions;

[0069] In this implementation, when the OTA task is started, the OTA master control module UMC will read information such as the total capacity of the ECU FLASH, the number of bytes in each sector, and the current ECU upgrade version from the ECU component being flashed.

[0070] The OTA main control module reads the upgrade file version of the ECU from the cloud through the UMC; compares the software versions read from the cloud and from the ECU, and if they are consistent, it is considered that the version read from the ECU is the latest version. The OTA main control module UMC reads the data saved in the record file to reflect whether the ECU has completed the OTA flash upgrade ( Figure 3As shown), if completed, exit directly; if not completed, OTAUMC reads the upgrade progress from the record file to a specific sector, such as flashing to sector numbered 100. The upgrade file package file format is S19 or HEX. Convert the upgrade file .S19 or .HEX to the .bin file format that can be recognized by the ECU MCU. At the same time, extract the FLASH address information to be flashed to the ECU in the S19 / HEX file (see Figure 5 ), the starting content of the upgrade file corresponds to the starting address of ECU FLASH 0xa0108000; the starting address of FLASH 0xa0108000 corresponds to the starting position of FLASH sector 0, that is: 0xa0108000~0xa01081FF corresponds to sector 0, 0xa0108200~0xa01083FF corresponds to sector 1, and so on.

[0071] When the upgrade file is downloaded from the cloud to the local computer, the process is as follows: Figure 8 ,include;

[0072] F101, convert the upgrade files into file formats that can be recognized by the ECU MCU;

[0073] F102, at the same time, extract the FLASH address information to be flashed to the ECU in the upgrade file;

[0074] F103, read the total capacity of FLASH and the number of bytes per sector;

[0075] F104, determine whether the upgrade file capacity is greater than the ECUFLASH capacity;

[0076] F105, calculate the number of sectors required for the upgrade file S = upgrade file size / number of bytes per sector;

[0077] F106, write the upgrade file to a total of S sectors starting from the ECU FLASH address extracted from S19 / HEX;

[0078] F107, the OTA main control module UMC records and saves the number of sectors written according to the number of bytes of the written file / the number of bytes per sector; then the upgrade is completed.

[0079] exist Figure 4 In the right part of the process shown in the figure, if the software versions read from the cloud and the ECU are found to be inconsistent, the following operations are performed, that is, Fig. 9 Specific execution operations;

[0080] H101, read the upgraded sector number (position) UMC_N saved during upgrade flashing from OTA UMC;

[0081] H102, read the upgraded sector number (position) ECU_N saved during the upgrade flash from the ECU;

[0082] H103, make a judgment and take the larger sector value;

[0083] H104, read all data from ECU sector N;

[0084] H105, read all data in the corresponding sector N from the ECU upgrade file saved by OTA UMC;

[0085] H106, compare the data to see if they are the same. If they are the same, continue to transfer the flash data from the ECU sector number X with the same data; if they are different, take the data of the previous sector in the ECU for comparison;

[0086] H107, write the upgrade file to the corresponding sector ECUFLASH;

[0087] H108, OTA UMC records and saves the number of sectors written according to the number of bytes of the written file / the number of bytes per sector;

[0088] Upgrade flashing completed.

[0089] In the implementation process corresponding to the present invention, during the flashing process of the ECUFLASH, each time a sector byte is sent, the flashed sector position field in the OTA master control module UMC corresponding to the ECU record file is increased by one for accumulation. For example, for example: during the flashing process of the OTA master control module UMC, each time a sector byte is sent (assuming each sector is 512 bytes), the "flashed sector position" field in the OTA master control module UMC corresponding to the ECU record file is increased by one for accumulation. If the flashing is completed, the "software upgrade completion flag" field is set to "completed" ( Figure 3 as shown).

[0090] In the corresponding implementation process of the present invention, if an abnormal interruption occurs during the transmission of ECUFLASH, the OTA main control module UMC can calculate the sector that has been flashed, and through calculation, it is known that the file has been written to the location in the ECU device FLASH sector; when it returns to normal, it will continue to flash from the starting address of the corresponding sector.

[0091] For example, if a flashing exception occurs during the transmission process, such as communication interruption, ECU power failure, etc., for example, a flashing exception occurs when 57180 bytes of data are transmitted, OTAUMC can calculate the sector that has been flashed, sec (sector) = 57180 / 512 = 111, offset (offset address in the sector) = 57180%512 = 348, and through calculation, it is known that the file has been written to the 348-byte position in the FLASH sector 111 of the ECU device, 348<512. As mentioned earlier, it is known that file flashing is based on sector erasure and flashing. If it returns to normal, it will continue to flash from the starting address of sector 111 (that is, the offset address 0 in the sector). There is no need to restart the flashing from sector 0, which greatly saves the flashing time.

[0092] In the corresponding implementation process of the present invention, during the process of flashing the ECU FLASH, the flashed ECU will accumulate and count the received data according to the number of bytes of a sector, and dynamically adjust the number of flashed sectors to be saved in the last sector of the FLASH based on the current received data and the rate of writing to the FLASH.

[0093] For example, if the data currently transmitted to the ECU is faster, more data needs to be written to the FLASH sector, the faster the sector value is updated, and the more system resources are occupied. In order to avoid system abnormalities caused by resource preemption, the current sector value must be written to the ECU for storage in a timely and faster manner to avoid the inability to record the sector position of the flash data in time due to system abnormalities, resulting in failure to resume transmission normally or a large deviation in the resume transmission position.

[0094] In the corresponding implementation process of the present invention, during the process of flashing the ECUFLASH, the OTA main control module UMC and the ECU simultaneously accumulate the flashed upgrade sectors. It is further believed that for a more accurate and safer approach, we use OTAUMC and ECU to simultaneously accumulate the flashed upgrade sectors. If one of them does not record in time or the other records, they protect each other. For example, if the ECU suddenly loses power, the ECU cannot record and save the flashed sector position in time, and the record will be lost. The OTA UMC end is not affected and will still record the current flashed sector position for timely updates.

[0095] This application is implemented based on OTA, and the OTA master control module UMC participates in the following operations: start the OTA task, the OTA master control module UMC will first read the total capacity of the ECU FLASH, the number of bytes in each sector, the current ECU upgrade version and other information from the ECU component to be flashed. The OTA master control module UMC reads the upgrade file version of the ECU component from the cloud; compares the software versions read from the cloud and from the ECU component, and if they are consistent, it is considered that the version read from the ECU is the latest version. The OTA master control module UMC reads whether the ECU has completed the OTA flash upgrade saved in the record file ( Figure 3 As shown), if completed, exit directly; if not completed, OTA UMC reads the upgrade progress from the record file to which specific sector ( Figure 3 As shown in the figure), for example, writing to sector numbered 100.

[0096] In the process of resuming transmission, it is necessary to read the position of the number of sectors that have been written from the OTA main control module UMC and ECU, and compare the array of sectors that have been written in the OTA main control module UMC and ECU, and take the value with the larger sector value; respectively read the ECU upgrade file from the OTA main control module UMC and the upgrade data written in the ECU to take out the data corresponding to the previous sector of the current sector for comparison. If the content of the previous sector of the current sector is exactly the same, it means that the data has indeed been written to the current sector position, and then the data is written from the starting position of the current sector; if it is not exactly the same, it means that the current position has not been written, and then go back to the previous sector for comparison until it is exactly the same. When resuming transmission, it is based on the exact same sector position until the upgrade is completed. It can ensure the accuracy of breakpoint resuming transmission and save writing time.

[0097] Embodiment 2: The present invention provides a device for resuming the transmission of a MCU at a breakpoint, such as Fig.10 ,include:

[0098] The module 101 for reading the number of sectors that have been flashed is used to read the number of sectors that have been flashed from the ECU.

[0099] The file reading module 102 is used to read the ECU upgrade file from the OTA main control module UMC.

[0100] The data fetching module 103 is used to fetch the data of the previous sector corresponding to the starting flashing sector position from the upgrade data written into the ECU;

[0101] A comparison module 104, used for comparing the upgrade file with the data of the previous sector;

[0102] The data writing module 105 is used to write data to the ECU.

[0103] The process corresponding to the device is:

[0104] The written sector number position reading module 101 reads the written sector number position from the ECU to determine the starting writing sector position;

[0105] The file reading module 102 reads the ECU upgrade file from the OTA main control module UMC.

[0106] The data fetching module 103 fetches data of a sector before the starting flashing sector position from the upgrade data in the ECU;

[0107] The comparison module 104 compares the upgrade file with the data of the previous sector to obtain a comparison result;

[0108] If the comparison results are exactly the same, the data flashing module 105 starts to flash data from the starting position of the flashing start sector position;

[0109] If the comparison result is not exactly the same, then go back to the previous sector position for comparison until they are exactly the same, and continue the transmission based on the exactly the same sector position until the upgrade is completed.

[0110] The device is programmed in sectors. If the last upgrade of the ECU's upgrade file has not been completed, the upgrade only needs to be continued from the sector where the sector has been recorded, so there is no need to re-transmit and re-write from the beginning. This will certainly save a lot of data content, make programming faster, and save a lot of time. The data of the upgrade data package is much less than that of the full overwrite file, and the full overwrite erase and rewrite also has a great impact on the service life of FLASH. The service life of FLASH can be greatly extended by re-transmitting and re-writing only part of the sector.

[0111] Embodiment 3: A computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein by implementing the above steps, the processor implements the following steps when executing the computer program;

[0112] Read the number of sectors that have been flashed from the ECU to determine the starting sector position for flashing;

[0113] Read the ECU upgrade file from the OTA main control module UMC, and take out the data of the previous sector corresponding to the starting flashing sector position from the upgrade data written into the ECU, compare the upgrade file with the data of the previous sector, and obtain a comparison result;

[0114] If the comparison results are exactly the same, then start writing data from the starting position of the starting writing sector position;

[0115] If the comparison result is not exactly the same, then go back to the previous sector position for comparison until they are exactly the same, and continue the transmission based on the exactly the same sector position until the upgrade is completed.

[0116] The computer equipment is flashed in sectors during programming. If the last upgrade of the ECU's upgrade file has not been completed, the upgrade only needs to be continued from the sector where the flashed sector is located, so there is no need to transfer and flash from the beginning. This will inevitably greatly save the transmitted data content, make the flashing programming faster, and greatly save the upgrade flashing time. The data package of the upgrade flashing is much less than the data of the full overwrite flashing file, and the full overwrite erase and flashing also has a great impact on the service life of FLASH. By continuing to upgrade and flashing, only part of the sectors are erased and flashed, which can also greatly extend the service life of FLASH.

[0117] Embodiment 4: A storage medium, characterized in that the storage medium includes a stored program, wherein when the program is executed, the device where the storage medium is located is controlled to perform the following operations:

[0118] Read the number of sectors that have been flashed from the ECU to determine the starting sector position for flashing;

[0119] Read the ECU upgrade file from the OTA main control module UMC, and take out the data of the previous sector corresponding to the starting flashing sector position from the upgrade data written into the ECU, compare the upgrade file with the data of the previous sector, and obtain a comparison result;

[0120] If the comparison results are exactly the same, then start writing data from the starting position of the starting writing sector position;

[0121] If the comparison result is not exactly the same, then go back to the previous sector position for comparison until they are exactly the same, and continue the transmission based on the exactly the same sector position until the upgrade is completed.

[0122] The storage medium is programmed in sectors. If the last upgrade of the ECU's upgrade file has not been completed, the upgrade only needs to be continued from the sector where the sector has been recorded, so there is no need to re-transmit and re-write from the beginning. This will certainly save a lot of data content, make programming faster, and save a lot of time. The data of the upgrade data package is much less than that of the full overwrite file, and the full overwrite erase and rewrite also has a great impact on the service life of FLASH. The service life of FLASH can be greatly extended by only erasing and re-writing some sectors through the upgrade.

[0123] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0124] The present invention has the following advantages:

[0125] (1) The data package of the upgrade flashing by retransmission contains much less data than the full overwrite flashing file, which greatly saves the upgrade flashing time. In addition, the full overwrite erase and flashing also has a great impact on the service life of the FLASH, greatly shortening the service life of the FLASH. The upgrade flashing by retransmission only erases and flashes some sectors, which can also greatly extend the service life of the FLASH.

[0126] (2) Solve the problem that the ECU itself cannot record the current flash sector location due to a sudden power outage and cannot continue the upgrade.

[0127] (3) The upgrade flash sector location is recorded simultaneously by OTA UMC and ECU to protect each other, and the failure of resuming the record location will not occur due to the loss of one of the records.

[0128] (4) Mapping of upgrade files and FLASH sector location; during upgrade flashing, the OTA UMC and ECU respectively record the sector location and sector number of the flashing sector in real time to locate the resumed transfer position.

[0129] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

[0130] As long as the expected results of the technical solution disclosed in the present invention can be achieved, this document does not impose any limitations here.

[0131] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for resuming the transmission of a breakpoint to flash an ECU, characterized in that: include: Read the number of sectors that have been flashed from the ECU to determine the starting sector position for flashing; Read the upgrade file of the ECU from the OTA main control module UMC, and take out the data of the previous sector corresponding to the starting flashing sector position from the upgrade data written into the ECU, compare the upgrade file with the data of the previous sector, and obtain a comparison result; If the comparison results are exactly the same, then the data is flashed from the starting position of the starting flashing sector position; wherein, in the process of continuing to flash the ECU FLASH, each time a sector of data is sent to the ECU, the flashed sector position field in the OTA main control module UMC corresponding to the ECU record file is increased by one; If the comparison result is not completely the same, then go back to the previous sector position for comparison until they are completely the same, and continue the transmission based on the completely the same sector position until the upgrade is completed; The determining of the starting flashing sector position includes: reading the flashed sector number position from the OTA main control module UMC and the ECU respectively, comparing the flashed sector arrays in the OTA main control module UMC and the ECU, and taking the larger sector value as the starting flashing sector position.

2. The method according to claim 1, characterized in that: Before reading the location of the number of sectors that have been written, the following operations are also included: Read the identification information of the flashed ECU, the identification information includes the total capacity of the ECU FLASH, the number of bytes of each sector of the ECU FLASH, and the ECU upgrade version information; Read the current ECU upgrade file version number from the cloud; Compare the file versions read from the cloud and the ECU. If they are consistent, the step of reading the flashed sector number position from the OTA master control module UMC and the ECU respectively is not performed. If the comparison is inconsistent, read the record file saved in the OTA main control module UMC to determine whether the ECU has completed the OTA flash upgrade, and exit if completed; the record file is located in the OTA main control module UMC and forms a positioning mapping with the FLASH sector.

3. The method according to claim 1, characterized in that: If an interrupt exception occurs during the continuous flashing process of the ECU, perform the following operations: The OTA master control module UMC calculates the sectors that have been flashed, and through calculation, it is known that the file has been written to the location in the ECU device FLASH sector; Among them, the sector sec that has been written = the number of characters transmitted / sector unit capacity; if it is detected that the ECU has returned to normal, the flashing will continue from the starting address of the corresponding sec sector.

4. The method according to claim 1, characterized in that: During the process of continuing to flash the ECU FLASH, the ECU will accumulate the received data according to the number of bytes of a sector, and save the number of written sectors in the last sector of the FLASH according to the current received data and the rate of writing to the FLASH.

5. The method according to claim 1, characterized in that: During the process of flashing the ECUFLASH, the OTA main control module UMC and the ECU simultaneously accumulate the flashed upgrade sectors.

6. A device for resuming the transmission of a breakpoint to flash an ECU, characterized in that: include: The module for reading the number of sectors that have been written is used to read the number of sectors that have been written from the ECU and determine the starting sector position for writing. The file reading module is used to read the upgrade file of the ECU from the OTA main control module UMC. A data fetching module is used to fetch data of a sector before the starting flashing sector position from the upgrade data written into the ECU; A comparison module, used for comparing the upgrade file with the data of the previous sector to obtain a comparison result; The data flashing module is used to flash data into the ECU; specifically: if the comparison results are exactly the same, then the data is flashed from the starting position of the starting flashing sector position; wherein, in the process of continuing to flash the ECU FLASH, each time a sector of data is sent to the ECU, the flashed sector position field in the OTA main control module UMC corresponding to the ECU record file is increased by one; if the comparison results are not exactly the same, then the comparison is returned to the previous sector position until they are exactly the same, and the data is continued based on the exactly the same sector position until the upgrade flashing is completed; The module for reading the number of sectors written is specifically used to read the number of sectors written from the OTA main control module UMC and the ECU respectively, compare the arrays of sectors written in the OTA main control module UMC and the ECU, and take the larger sector value as the starting sector position for writing.

7. A computer 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, the steps of the method according to any one of claims 1 to 5 are implemented.

8. A storage medium, characterized in that: The storage medium includes a stored program, wherein when the program is executed, the device where the storage medium is located is controlled to execute the method according to any one of claims 1 to 5.