Firmware batch burning method and terminal

By locking and processing the data to be burned in blocks in the memory, generating a burning chain and using erase instead of write, the problems of many file IO requests and large data transmission volume during firmware batch burning are solved, achieving faster burning speed.

CN113885898BActive Publication Date: 2025-09-30FUZHOU ROCKCHIP SEMICON
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111182080.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-11
Publication Date
2025-09-30
Estimated Expiration
2041-10-11

AI Technical Summary

Technical Problem

The existing technology has the problem of a large number of file IO requests and uncompressed data transmission during the firmware batch burning process, resulting in a slow burning speed.

Method used

The data to be burned is locked in the memory and divided into normal blocks, duplicate blocks and erase blocks. A burning chain is generated according to the data content. The corresponding data is sent to the burning program through the burning chain for firmware burning. The erase block is erased instead of written.

Benefits of technology

It reduces file IO operations and improves the firmware burning speed. In particular, it greatly reduces the amount of data transmission by erasing blocks and improves the burning efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113885898B_ABST
    Figure CN113885898B_ABST
Patent Text Reader

Abstract

The present invention provides a firmware batch burning method and terminal. The method acquires data to be burned and locks the data to be burned in a memory, thereby preventing a large number of file I / O operations from being generated during the burning process. The method further divides the data to be burned into burning blocks of the types of common blocks, repeated blocks, and erased blocks according to their content. The burning blocks in the same group are linked into a burning chain and burned. If a common block is burned, the corresponding read and write data in the common block is sent to a burning program for firmware burning. If a repeated block is burned, the burning address, the burning length, and repeated data in the repeated block are sent to the burning program for firmware burning. If an erased block is burned, the erased address and erased length in the erased block are sent to the burning program for firmware burning. Therefore, the burning speed can be improved by erasing instead of writing, and the repeated blocks and erased blocks do not need to transmit specific data, thereby reducing the amount of data transmitted to the burning program and improving the firmware burning speed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data burning, and in particular to a firmware batch burning method and terminal. Background Art

[0002] Currently, the main method for batch burning firmware based on PC is that the burning program will create a burning thread for each burning device. The burning thread is responsible for reading the burning data and transmitting it to the device through channels such as USB or serial port. After the device writes successfully, it notifies the burning thread until the burning thread completes the burning of all data.

[0003] This approach has the following shortcomings: 1. Since all burning threads directly access files, this will result in a large number of file IO requests during the burning process and cause jitter in the external storage; 2. The burning data is transmitted uncompressed. Summary of the Invention

[0004] The technical problem to be solved by the present invention is to provide a method and terminal for batch burning of firmware, which can improve the firmware burning speed.

[0005] In order to solve the above technical problems, the technical solution adopted by the present invention is:

[0006] A method for batch burning firmware includes the following steps:

[0007] Acquire data to be burned, and lock the data to be burned in the memory;

[0008] dividing the data to be programmed into programming blocks of types including common blocks, repeat blocks and erase blocks according to the data content of the data to be programmed;

[0009] Grouping the burning blocks according to group sizes, and linking the burning blocks in the same group into a burning chain;

[0010] If a common block in the burning chain is burned, the corresponding read and write data in the common block is sent to the burning program for firmware burning; if a repeated block in the burning chain is burned, the burning address, burning length and repeated data in the repeated block are sent to the burning program for firmware burning; if an erase block in the burning chain is burned, the erase address and erase length in the erase block are sent to the burning program for firmware burning.

[0011] In order to solve the above technical problems, another technical solution adopted by the present invention is:

[0012] A firmware batch burning terminal includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the following steps are implemented:

[0013] Acquire data to be burned, and lock the data to be burned in the memory;

[0014] dividing the data to be programmed into programming blocks of types including common blocks, repeat blocks and erase blocks according to the data content of the data to be programmed;

[0015] Grouping the burning blocks according to group sizes, and linking the burning blocks in the same group into a burning chain;

[0016] If a common block in the burning chain is burned, the corresponding read and write data in the common block is sent to the burning program for firmware burning; if a repeated block in the burning chain is burned, the burning address, burning length and repeated data in the repeated block are sent to the burning program for firmware burning; if an erase block in the burning chain is burned, the erase address and erase length in the erase block are sent to the burning program for firmware burning.

[0017] The beneficial effects of the present invention are as follows: data to be burned is acquired and locked in a memory, and the burning data can be pre-written into the locked memory before data burning, thereby preventing a large number of file IO operations from being generated during the burning process; the data to be burned is divided into burning blocks of common blocks, repeated blocks, and erased blocks according to data content of the data to be burned, the burning blocks in the same group are linked into a burning chain, and the burning chain is burned; if a common block is burned, corresponding read-write data in the common block is sent to a burning program for firmware burning; if a repeated block is burned, a burning address, a burning length, and repeated data in the repeated block are sent to the burning program for firmware burning; and if an erased block is burned, an erased address and an erased length in the erased block are sent to the burning program for firmware burning; therefore, when burning an erased block, erasing can be used instead of writing to improve the burning speed, and the repeated blocks and erased blocks do not need to transmit specific data, thereby greatly reducing the amount of data transmitted to the burning program, and further improving the firmware burning speed. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] Figure 1 This is a flow chart of a firmware batch burning method according to an embodiment of the present invention;

[0019] Figure 2 A schematic diagram of a firmware batch burning terminal according to an embodiment of the present invention;

[0020] Figure 3 A schematic diagram of a burning data structure of a firmware batch burning method according to an embodiment of the present invention;

[0021] Figure 4 A batch burning flow chart of a firmware batch burning method according to an embodiment of the present invention;

[0022] Figure 5This is a workflow diagram of a burning thread of a firmware batch burning method according to an embodiment of the present invention. DETAILED DESCRIPTION

[0023] To illustrate the technical content, achieved objectives and effects of the present invention in detail, the following description is given in conjunction with the embodiments and accompanying drawings.

[0024] Please refer to Figure 1 , an embodiment of the present invention provides a method for batch burning of firmware, comprising the steps of:

[0025] Acquire data to be burned, and lock the data to be burned in the memory;

[0026] dividing the data to be programmed into programming blocks of types including common blocks, repeat blocks and erase blocks according to the data content of the data to be programmed;

[0027] Grouping the burning blocks according to group sizes, and linking the burning blocks in the same group into a burning chain;

[0028] If a common block in the burning chain is burned, the corresponding read and write data in the common block is sent to the burning program for firmware burning; if a repeated block in the burning chain is burned, the burning address, burning length and repeated data in the repeated block are sent to the burning program for firmware burning; if an erase block in the burning chain is burned, the erase address and erase length in the erase block are sent to the burning program for firmware burning.

[0029] As can be known from the foregoing description, the beneficial effects of the present invention are: obtain data to be burned, and data to be burned will be locked in the internal memory, can before data burning, burning data can be pre-written in the locked internal memory, prevent the burning process from producing a large amount of file IO operations; According to the data content of data to be burned, data to be burned will be divided into the burning block of type being common block, repetition block and erase block, the burning block in the same group is linked into a burning chain, burning chain is burned, if burning common block, then corresponding read-write data in the common block is sent to the burning program and carried out firmware burning; If burning repetition block, then burning address, burning length and the repeated data in the repetition block are sent to the burning program and carried out firmware burning, if burning erase block, then the erase address, the erase length in the erase block are sent to the burning program and carried out firmware burning; Therefore during burning erase block, can replace write to promote burning speed with erasure, and repetition block and erase block do not need to transmit specific data, greatly reduced the data transmission amount sent to burning program, further improved firmware burning speed.

[0030] Furthermore, dividing the data to be programmed into programming blocks of types including common blocks, duplicate blocks and erase blocks according to data content of the data to be programmed comprises:

[0031] Analyzing the data to be burned according to the group size, locating each sector of the data to be burned in sequence, determining whether the bytes in the sectors are all the same, and if they are all the same, determining whether the data in the sectors are all 1, and if they are all 1, the sector is an erased sector; otherwise, the sector is a duplicate sector; if they are not the same, the sector is a normal sector;

[0032] A preset lower limit number of sectors are formed into a programming block, and it is determined whether all the programming blocks are repeated sectors. If so, the programming block is a repeated block. Otherwise, it is determined whether all the programming blocks are erased sectors. If so, the programming block is an erased block. Otherwise, the programming block is a common block.

[0033] From the above description, it can be seen that by analyzing the data to be burned according to the group size, locating the sectors in the data to be burned at one time, and judging the sector type according to the bytes in the sector, the erase blocks can be classified based on the sectors, which facilitates the subsequent provision of corresponding data information to the burning program according to the sector type, thereby improving the firmware burning speed.

[0034] Furthermore, after dividing the data to be programmed into programming blocks of types including common blocks, duplicate blocks and erase blocks according to the data content of the data to be programmed, the method further comprises:

[0035] A preset lower limit number of sectors are formed into a burning block, and after confirming the type of the burning block, it is determined whether the type of the next sector is the same as the type of the burning block. If the type is the same, the next sector is added to the burning block until the number of sectors in the burning block reaches a preset upper limit;

[0036] If they are not the same, it is determined whether the burn block is an erase block. If it is an erase block, it is determined whether the size of the burn block reaches a value obtained by subtracting a preset redundant size at the end of the erase block from a preset size of the erase block. If so, the creation of the burn block is terminated. Otherwise, the next burn block is added to the burn block, and the type of the burn block is modified to a repeat block. If it is an erase block, the creation of the burn block is terminated.

[0037] As can be seen from the above description, a preset lower limit number of sectors are formed into a burning block, and after the burning block type is confirmed, if the type of the next sector is the same as the type of the burning block, the next sector is added to the burning block; if the types are different and the burning block is an erase block, the size of the burning block is used to determine whether the content of the next sector is added to the burning block and whether the type of the erase block is modified to a duplicate block accordingly, thereby accurately dividing the sectors and avoiding waste of resources.

[0038] Furthermore, linking the burning blocks in the same group into a burning chain includes:

[0039] Creating a burning thread for the burning chain;

[0040] If all the burning threads corresponding to the burning chain are burned and there is a continuing burning thread, it is determined whether there is an unburned burning chain. If so, the unburned burning chain is burned until all the burning chains are burned.

[0041] As can be seen from the above description, a corresponding burning thread is created for the burning chain. If all the burning threads corresponding to the burning chain have completed burning and there are threads that continue burning, it means that there are still burning chains that have not been burned. Therefore, it is necessary to burn the unburned burning chains to ensure the integrity of data burning.

[0042] Further, if a repeated block in the burning chain is burned, sending the burning address, burning length and repeated data in the repeated block to the burning program for firmware burning includes:

[0043] If a repeated block in the burning chain is to be burned, obtaining repeated data in the repeated block, and obtaining a burning length according to the number of times the repeated data appears in the repeated block, generating a repeat write command using the burning address in the repeated block, the repeated data, and the burning length, and sending the repeat write command to the burning program to burn the firmware;

[0044] If the erase block in the burn chain is burned, the erase address and erase length in the erase block are sent to the burning program for firmware burning, including:

[0045] If the erase block in the burn chain is burned, an erase command is sent to the burn program according to the erase address and erase length to burn the firmware.

[0046] From the above description, it can be seen that when burning a repeat block, the burning length can be obtained according to the repeated data, and the corresponding repeat write command can be generated according to the burning address, burning length and repeated data; when burning an erase block, the corresponding erase command can be generated according to the erase address and erase length. Therefore, for both the repeat block and the erase block, there is no need to provide the specific data to be burned to the burning program, which can reduce the amount of data transmission and thus improve the firmware burning speed.

[0047] Please refer to Figure 2 Another embodiment of the present invention provides a firmware batch burning terminal, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:

[0048] Acquire data to be burned, and lock the data to be burned in the memory;

[0049] dividing the data to be programmed into programming blocks of types including common blocks, repeat blocks and erase blocks according to the data content of the data to be programmed;

[0050] Grouping the burning blocks according to group sizes, and linking the burning blocks in the same group into a burning chain;

[0051] If a common block in the burning chain is burned, the corresponding read and write data in the common block is sent to the burning program for firmware burning; if a repeated block in the burning chain is burned, the burning address, burning length and repeated data in the repeated block are sent to the burning program for firmware burning; if an erase block in the burning chain is burned, the erase address and erase length in the erase block are sent to the burning program for firmware burning.

[0052] As can be seen from the above description, data to be burned is obtained and locked in the internal memory. Before data burning, the burning data can be pre-written into the locked internal memory to prevent the burning process from generating a large number of file IO operations; the data to be burned is divided into burning blocks of types such as common blocks, repeat blocks and erase blocks according to the data content of the data to be burned, the burning blocks in the same group are linked into a burning chain, and the burning chain is burned; if common blocks are burned, the corresponding read-write data in the common blocks are sent to the burning program for firmware burning; if repeat blocks are burned, the burning address, burning length and repeated data in the repeat blocks are sent to the burning program for firmware burning; if erase blocks are burned, the erase address and erase length in the erase blocks are sent to the burning program for firmware burning; therefore, when burning erase blocks, the burning speed can be improved by erasing instead of writing, and the repeat blocks and erase blocks do not need to transmit specific data, which greatly reduces the data transmission amount sent to the burning program, further improving the firmware burning speed.

[0053] Furthermore, dividing the data to be programmed into programming blocks of types including common blocks, duplicate blocks and erase blocks according to data content of the data to be programmed comprises:

[0054] Analyzing the data to be burned according to the group size, locating each sector of the data to be burned in sequence, determining whether the bytes in the sectors are all the same, and if they are all the same, determining whether the data in the sectors are all 1, and if they are all 1, the sector is an erased sector; otherwise, the sector is a duplicate sector; if they are not the same, the sector is a normal sector;

[0055] A preset lower limit number of sectors are formed into a programming block, and it is determined whether all the programming blocks are repeated sectors. If so, the programming block is a repeated block. Otherwise, it is determined whether all the programming blocks are erased sectors. If so, the programming block is an erased block. Otherwise, the programming block is a common block.

[0056] From the above description, it can be seen that by analyzing the data to be burned according to the group size, locating the sectors in the data to be burned at one time, and judging the sector type according to the bytes in the sector, the erase blocks can be classified based on the sectors, which facilitates the subsequent provision of corresponding data information to the burning program according to the sector type, thereby improving the firmware burning speed.

[0057] Furthermore, after dividing the data to be programmed into programming blocks of types including common blocks, duplicate blocks and erase blocks according to the data content of the data to be programmed, the method further comprises:

[0058] A preset lower limit number of sectors are formed into a burning block, and after confirming the type of the burning block, it is determined whether the type of the next sector is the same as the type of the burning block. If the type is the same, the next sector is added to the burning block until the number of sectors in the burning block reaches a preset upper limit;

[0059] If they are not the same, it is determined whether the burn block is an erase block. If it is an erase block, it is determined whether the size of the burn block reaches a value obtained by subtracting a preset redundant size at the end of the erase block from a preset size of the erase block. If so, the creation of the burn block is terminated. Otherwise, the next burn block is added to the burn block, and the type of the burn block is modified to a repeat block. If it is an erase block, the creation of the burn block is terminated.

[0060] As can be seen from the above description, a preset lower limit number of sectors are formed into a burning block, and after the burning block type is confirmed, if the type of the next sector is the same as the type of the burning block, the next sector is added to the burning block; if the types are different and the burning block is an erase block, the size of the burning block is used to determine whether the content of the next sector is added to the burning block and whether the type of the erase block is modified to a duplicate block accordingly, thereby accurately dividing the sectors and avoiding waste of resources.

[0061] Furthermore, linking the burning blocks in the same group into a burning chain includes:

[0062] Creating a burning thread for the burning chain;

[0063] If all the burning threads corresponding to the burning chain are burned and there is a continuing burning thread, it is determined whether there is an unburned burning chain. If so, the unburned burning chain is burned until all the burning chains are burned.

[0064] As can be seen from the above description, a corresponding burning thread is created for the burning chain. If all the burning threads corresponding to the burning chain have completed burning and there are threads that continue burning, it means that there are still burning chains that have not been burned. Therefore, it is necessary to burn the unburned burning chains to ensure the integrity of data burning.

[0065] Further, if a repeated block in the burning chain is burned, sending the burning address, burning length and repeated data in the repeated block to the burning program for firmware burning includes:

[0066] If a repeated block in the burning chain is to be burned, obtaining repeated data in the repeated block, and obtaining a burning length according to the number of times the repeated data appears in the repeated block, generating a repeat write command using the burning address in the repeated block, the repeated data, and the burning length, and sending the repeat write command to the burning program to burn the firmware;

[0067] If the erase block in the burn chain is burned, the erase address and erase length in the erase block are sent to the burning program for firmware burning, including:

[0068] If the erase block in the burn chain is burned, an erase command is sent to the burn program according to the erase address and erase length to burn the firmware.

[0069] From the above description, it can be seen that when burning a repeat block, the burning length can be obtained according to the repeated data, and the corresponding repeat write command can be generated according to the burning address, burning length and repeated data; when burning an erase block, the corresponding erase command can be generated according to the erase address and erase length. Therefore, for both the repeat block and the erase block, there is no need to provide the specific data to be burned to the burning program, which can reduce the amount of data transmission and thus improve the firmware burning speed.

[0070] The present invention provides a method and terminal for batch burning of firmware, which is applicable to batch burning of firmware based on a PC and can effectively improve the speed of batch burning of data. The method and terminal are described below through specific embodiments:

[0071] Example 1

[0072] Please refer to Figure 1 、 Figures 3 to 5 , a firmware batch burning method, comprising the steps of:

[0073] S1. Acquire data to be burned, and lock the data to be burned in a memory.

[0074] Specifically, before batch burning the firmware, you need to set and input the following data:

[0075] The lower limit of the programming block size is in sectors. One sector is 512 bytes. Since flash storage is programmed and written in pages, it is preferred to set the lower limit of the programming block to 4 sectors, i.e. one page size.

[0076] Erase block size, in sectors, recommended to be set to 512, 256k;

[0077] Group size, in megabytes, recommended setting is 32;

[0078] The redundant size of the erase block tail is in sectors. It is recommended to set it to 128, which is one-fourth of the erase block size.

[0079] The upper limit of the programming block size is in sectors. It is recommended to set it to 512, which is the same as the erase block size.

[0080] In order to prevent a large number of file IO operations from being generated during the burning process, the memory space is locked in advance. Before each group of data is burned, the data of this group is pre-written into the locked memory. At the same time, the synchronous burning is controlled to complete the data update in the memory, so that all burning threads will read data from the memory. The existing technology usually has different threads each maintain a piece of memory. During the multi-threaded burning process, data will be read from the external file into the memory, which will lead to an increase in the IO operations of the external file. Because the data locations read by each thread are different, IO bumps are caused. In this embodiment, multiple threads are synchronized to ensure that the data required for this step is read into the memory in advance, and only one external file IO operation is performed, thereby reducing the time overhead of reading data from the external storage and further improving the burning speed.

[0081] S2. Dividing the data to be programmed into programming blocks of types including common blocks, duplicate blocks and erase blocks according to the data contents of the data to be programmed.

[0082] S21. Analyze the data to be programmed according to the group size, locate each sector in the data to be programmed in sequence, and determine whether the bytes in the sectors are all the same. If they are all the same, determine whether the data in the sectors are all 1. If they are all 1, the sector is an erase sector. Otherwise, the sector is a duplicate sector. If they are not the same, the sector is a normal sector.

[0083] Specifically, memory is requested according to the group size to read data from the file into the memory. If the remaining data is larger than the requested size, the data of the requested size is read. If it is less than the requested size, the remaining data is read in full. The read data is analyzed, a burning block linked list is created, and the source file handle of the current data is saved in the linked list metadata.

[0084] Locate the sectors in the data to be burned one by one and analyze them to determine whether they are normal sectors, duplicate sectors or erased sectors: if the data in the sector is the same, it is a duplicate sector; if the duplicate data in the duplicate sector is 0xFF, it is an erased sector; otherwise, it is a normal sector;

[0085] Specifically, a sector consists of 512 bytes. Since the erase operation of the storage medium can only set the storage unit to 1, and one storage unit is one bit, 8 bits set to 1 is 0xFF. Therefore, when the repeated data is 0xFF, it is an erased sector. If all 512 bytes in the sector are the same value except 0xff, for example, 512 bytes of 0xCC, it is a duplicate sector.

[0086] S22. The sectors of the preset lower limit are grouped into a programming block, and it is determined whether the programming block contains all repeated sectors. If so, the programming block is a repeated block. Otherwise, it is determined whether the programming block contains all erased sectors. If so, the programming block is an erased block. Otherwise, the programming block is a normal block.

[0087] For details, please refer to Figure 3 When the analyzed data reaches the lower limit of the burning block size, a burning block data structure is created to save the file offset of the burning block start data, the burning address and the data size of the burning block;

[0088] Analyze the programming block type. If the programming block contains normal sectors, it is a normal programming block. If it contains only duplicate sectors, it is a duplicate programming block and the duplicate data is recorded in the programming block structure. If it contains only erased sectors, it is an erased programming block.

[0089] S23, determining whether the type of the next sector is the same as the type of the programming block, and if so, adding the next sector to the programming block until the number of sectors in the programming block reaches a preset upper limit;

[0090] If they are not the same, it is determined whether the burn block is an erase block. If it is an erase block, it is determined whether the size of the burn block reaches a value obtained by subtracting a preset redundant size at the end of the erase block from a preset size of the erase block. If so, the creation of the burn block is terminated. Otherwise, the next burn block is added to the burn block, and the type of the burn block is modified to a repeat block. If it is an erase block, the creation of the burn block is terminated.

[0091] Specifically, the next sector is analyzed. If the type of the next sector is the same as the current burn block, the burn block size is increased. When the burn block size reaches the upper limit, the burn block creation is terminated. If the type of the next sector is different from the current burn block, and the burn block type is determined not to be an erase block, the burn block creation is terminated. If the burn block type is an erase block, it is necessary to determine whether the burn block size reaches the erase block size minus the redundant size at the end of the erase block. If it exceeds, the burn block size is set to the erase block size, and the burn block creation is terminated. If it does not exceed, the burn block type is changed to a repeated burn block, and the burn block creation is terminated.

[0092] S3. Group the burning blocks according to group size, and link the burning blocks in the same group into a burning chain.

[0093] Specifically, the blocks are grouped according to a preset group size, and the burning blocks in the same group are linked into a linked list. When all the data in the memory are decomposed, the creation of a burning block linked list is completed.

[0094] The steps of linking the burning blocks in the same group into a burning chain include:

[0095] Creating a burning thread for the burning chain;

[0096] If all the burning threads corresponding to the burning chain are burned and there is a continuing burning thread, it is determined whether there is an unburned burning chain. If so, the unburned burning chain is burned until all the burning chains are burned.

[0097] For details, please refer to Figure 4 After reading the burning chain data, create the corresponding burning thread, burn the burning thread, and determine whether all burning threads have been burned. If not, continue to burn the threads that have not been burned.

[0098] If all the threads fail when all the burning is completed, the burning fails. If there is a thread to continue burning, it is determined whether there is an unburned burning chain. If there is an unburned burning chain, the burning chain data is read and burned. Otherwise, the burning is successful.

[0099] S4. If a common block in the burning chain is burned, the corresponding read-write data in the common block is sent to the burning program for firmware burning; if a repeated block in the burning chain is burned, the burning address, burning length and repeated data in the repeated block are sent to the burning program for firmware burning; if an erase block in the burning chain is burned, the erase address and erase length in the erase block are sent to the burning program for firmware burning.

[0100] If a repeated block in the burning chain is burned, the repeated data in the repeated block is obtained, and the burning length is obtained according to the number of times the repeated data appears in the repeated block, a repeated write command is generated by using the burning address in the repeated block, the repeated data and the burning length, and the repeated write command is sent to the burning program to burn the firmware;

[0101] If the erase block in the burn chain is burned, an erase command is sent to the burn program according to the erase address and erase length to burn the firmware.

[0102] For details, please refer to Figure 5 , process the programming block according to the programming block type. If it is a normal programming block, read the programming data and perform normal writing. If it is an erase block, send an erase command. If it is a duplicate block, take out the duplicate data and send a duplicate write command.

[0103] When the burning data fails to be written, the burning fails;

[0104] When the burning data is written successfully, it is determined whether there are unprocessed burning blocks. If so, the unprocessed burning blocks are processed. Otherwise, the burning is terminated and the thread is exited.

[0105] Example 2

[0106] Please refer to Figure 2 A firmware batch burning terminal includes a memory, a processor, and a computer program stored in the memory and runnable on the processor. When the processor executes the computer program, each step of a firmware batch burning method of embodiment one is implemented.

[0107] In summary, the present invention provides a method and terminal for batch burning of firmware, which obtains data to be burned and locks the data to be burned in a memory. Before burning the data, the burning data can be pre-written into the locked memory to prevent the burning process from generating a large number of file IO operations. According to the data content of the data to be burned, the data to be burned is divided into burning blocks of the types of ordinary blocks, repeat blocks and erase blocks, and the burning blocks in the same group are linked into a burning chain. The burning chain is burned. If an ordinary block is burned, the corresponding read and write data in the ordinary block is sent to the burning chain. The data is sent to the burning program for firmware burning. If a repeat block is burned, the burning address, burning length, and repeated data in the repeat block are sent to the burning program for firmware burning. If an erase block is burned, the erase address and erase length in the erase block are sent to the burning program for firmware burning. Therefore, both repeat blocks and erase blocks greatly reduce the amount of data transferred from the PC to the device. At the same time, taking advantage of the fact that the erase speed of flash storage devices is several orders of magnitude faster than the write speed, some burning data is erased instead of written to increase the burning speed. By pre-locking the memory space and controlling the synchronous burning to complete the data update in the memory, all burning threads will read data from the memory, reducing the time overhead of reading data from external storage and further improving the burning speed.

[0108] The above descriptions are merely embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent transformations made using the contents of the present invention's description and drawings, or directly or indirectly applied in related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A method for batch burning of firmware, characterized in that: Including steps: Acquire data to be burned, and lock the data to be burned in the memory; Dividing the data to be programmed into programming blocks of types including common blocks, duplicate blocks, and erase blocks according to the data content of the data to be programmed, comprising: analyzing the data to be programmed according to the group size, sequentially locating each sector in the data to be programmed, determining whether bytes in the sectors are all identical, and if so, determining whether data in the sectors are all 1, and if so, determining the sectors are erased sectors; otherwise, determining the sectors are duplicated sectors; and if not, determining the sectors are common sectors; forming programming blocks with a preset lower limit number of sectors, determining whether all the programming blocks are duplicated sectors, and if so, determining the programming blocks are duplicated blocks; otherwise, determining whether all the programming blocks are erased sectors, and if so, determining the programming blocks are erased blocks; otherwise, determining the programming blocks are common blocks; Grouping the burning blocks according to group sizes, and linking the burning blocks in the same group into a burning chain; If a common block in the burning chain is burned, the corresponding read and write data in the common block is sent to the burning program for firmware burning; if a repeated block in the burning chain is burned, the burning address, burning length and repeated data in the repeated block are sent to the burning program for firmware burning; if an erase block in the burning chain is burned, the erase address and erase length in the erase block are sent to the burning program for firmware burning.

2. A method for batch burning of firmware according to claim 1, characterized in that, The method further comprises dividing the data to be programmed into programming blocks of types including common blocks, repeat blocks and erase blocks according to the data content of the data to be programmed: A preset lower limit number of sectors are formed into a burning block, and after confirming the type of the burning block, it is determined whether the type of the next sector is the same as the type of the burning block. If the type is the same, the next sector is added to the burning block until the number of sectors in the burning block reaches a preset upper limit; If they are not the same, it is determined whether the burn block is an erase block. If it is an erase block, it is determined whether the size of the burn block reaches a value obtained by subtracting a preset redundant size at the end of the erase block from a preset size of the erase block. If so, the creation of the burn block is terminated. Otherwise, the next burn block is added to the burn block, and the type of the burn block is modified to a repeat block. If it is an erase block, the creation of the burn block is terminated.

3. A method for batch burning of firmware according to claim 1, characterized in that, Linking the burning blocks in the same group into a burning chain includes: Creating a burning thread for the burning chain; If all the burning threads corresponding to the burning chain are burned and there is a continuing burning thread, it is determined whether there is an unburned burning chain. If so, the unburned burning chain is burned until all the burning chains are burned.

4. A method for batch burning of firmware according to claim 1, characterized in that, If a repeated block in the burning chain is burned, sending the burning address, burning length and repeated data in the repeated block to the burning program for firmware burning includes: If a repeated block in the burning chain is to be burned, obtaining repeated data in the repeated block, and obtaining a burning length according to the number of times the repeated data appears in the repeated block, generating a repeat write command using the burning address in the repeated block, the repeated data, and the burning length, and sending the repeat write command to the burning program to burn the firmware; If the erase block in the burn chain is burned, the erase address and erase length in the erase block are sent to the burning program for firmware burning, including: If the erase block in the burn chain is burned, an erase command is sent to the burn program according to the erase address and erase length to burn the firmware.

5. A firmware batch burning terminal, 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 following steps are implemented: Acquire data to be burned, and lock the data to be burned in the memory; Dividing the data to be programmed into programming blocks of types including common blocks, duplicate blocks, and erase blocks according to the data content of the data to be programmed, comprising: analyzing the data to be programmed according to the group size, sequentially locating each sector in the data to be programmed, determining whether bytes in the sectors are all identical, and if so, determining whether data in the sectors are all 1, and if so, determining the sectors are erased sectors; otherwise, determining the sectors are duplicated sectors; and if not, determining the sectors are common sectors; forming programming blocks with a preset lower limit number of sectors, determining whether all the programming blocks are duplicated sectors, and if so, determining the programming blocks are duplicated blocks; otherwise, determining whether all the programming blocks are erased sectors, and if so, determining the programming blocks are erased blocks; otherwise, determining the programming blocks are common blocks; Grouping the burning blocks according to group sizes, and linking the burning blocks in the same group into a burning chain; If a common block in the burning chain is burned, the corresponding read and write data in the common block is sent to the burning program for firmware burning; if a repeated block in the burning chain is burned, the burning address, burning length and repeated data in the repeated block are sent to the burning program for firmware burning; if an erase block in the burning chain is burned, the erase address and erase length in the erase block are sent to the burning program for firmware burning.

6. A firmware batch burning terminal according to claim 5, characterized in that: The method further comprises dividing the data to be programmed into programming blocks of types including common blocks, repeat blocks and erase blocks according to the data content of the data to be programmed: A preset lower limit number of sectors are formed into a burning block, and after confirming the type of the burning block, it is determined whether the type of the next sector is the same as the type of the burning block. If the type is the same, the next sector is added to the burning block until the number of sectors in the burning block reaches a preset upper limit; If they are not the same, it is determined whether the burn block is an erase block. If it is an erase block, it is determined whether the size of the burn block reaches a value obtained by subtracting a preset redundant size at the end of the erase block from a preset size of the erase block. If so, the creation of the burn block is terminated. Otherwise, the next burn block is added to the burn block, and the type of the burn block is modified to a repeat block. If it is an erase block, the creation of the burn block is terminated.

7. A firmware batch burning terminal according to claim 5, characterized in that: Linking the burning blocks in the same group into a burning chain includes: Creating a burning thread for the burning chain; If all the burning threads corresponding to the burning chain are burned and there is a continuing burning thread, it is determined whether there is an unburned burning chain. If so, the unburned burning chain is burned until all the burning chains are burned.

8. A firmware batch burning terminal according to claim 5, characterized in that: If a repeated block in the burning chain is burned, sending the burning address, burning length and repeated data in the repeated block to the burning program for firmware burning includes: If a repeated block in the burning chain is to be burned, obtaining repeated data in the repeated block, and obtaining a burning length according to the number of times the repeated data appears in the repeated block, generating a repeat write command using the burning address in the repeated block, the repeated data, and the burning length, and sending the repeat write command to the burning program to burn the firmware; If the erase block in the burn chain is burned, the erase address and erase length in the erase block are sent to the burning program for firmware burning, including: If the erase block in the burn chain is burned, an erase command is sent to the burn program according to the erase address and erase length to burn the firmware.

Citation Information

Patent Citations

  • Method and device for quickly programming data to EXT partition

    CN106933970A