Burned firmware updating method and device, equipment and medium

By using the USB interface between the compilation software and the offline burner in the burning tool, the burning operation is directly performed in the terminal product, and the burning process in the prior art is solved, and the burning process is complicated, high cost and poor security is achieved, and more efficient and secure firmware updates are achieved.

CN119847541APending Publication Date: 2025-04-18ZHUHAI TAIWEI ELECTRONICS CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411721553.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-28
Publication Date
2025-04-18

AI Technical Summary

Technical Problem

In the prior art, a dedicated offline burner needs to be matched with a dedicated host computer software, and the burning process is cumbersome, the cost is high and the security is poor.

Method used

It provides a method of updating the recording firmware, transmitting the target firmware and instruction information through the USB interface between the compilation software and the offline burner, and executes the instruction information and generates configuration information, and directly enters the terminal product.

Benefits of technology

It simplifies the firmware burning process, improves the safety and efficiency of burning, reduces the burning cost, and is adapted to a variety of chips.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119847541A_ABST
    Figure CN119847541A_ABST
Patent Text Reader

Abstract

The invention provides a burnt firmware updating method. The burnt firmware updating method comprises the steps that compiling software issues target firmware and instruction information to an offline burner through a USB interface; storing the instruction information, executing all the instruction information by the off-line programmer, generating configuration information by the off-line programmer according to the instruction information, and inputting the configuration information into the terminal product; or analyzing the instruction information to obtain a downloading algorithm index, a downloading algorithm and target firmware information, and storing the downloading algorithm index, the downloading algorithm and the target firmware information into a storage module; the burning program generates a burning instruction according to the downloading algorithm index, the downloading algorithm and the target firmware information, and the off-line burner is moved to the terminal product and connected with the terminal product, so that the instruction execution module burns the terminal product according to the burning instruction. According to the technical scheme of the embodiment, the firmware burning safety can be improved, and the burning cost can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of chip burning, and in particular to a method, device, equipment and medium for updating burning firmware. Background Art

[0002] Currently, dedicated offline programmers on the market all need to be controlled by a dedicated host computer, and programmers designed by different manufacturers need to match different host computer software. In addition, it is necessary to find the cross-compiled target firmware from dozens to hundreds of files in a dedicated path, and then import it into the host computer and configure multiple parameters. When program debugging requires multiple modifications and downloads, the process is more cumbersome, and dedicated offline programmers are not compatible with all chips. The programmer manufacturer needs to re-adapt according to the program, resulting in high cost and poor security for firmware burning. Summary of the invention

[0003] The present invention aims to solve at least one of the technical problems existing in the prior art. To this end, the present invention provides a method, device, equipment and medium for updating firmware, which can improve the security of firmware burning and reduce the burning cost.

[0004] In a first aspect, an embodiment of the present invention provides a method for updating a firmware program, which is applied to a burning tool, wherein the burning tool includes a compiling software, an offline burning device, and a terminal product, wherein the offline burning device is connected to the compiling software and the terminal product, respectively, wherein the offline burning device is provided with an MCU, a storage module, and an instruction execution module, and the method for updating the firmware program includes:

[0005] The compiler software sends the target firmware and the instruction information to the offline burner through the USB interface;

[0006] The instruction information is saved, the offline programmer executes all the instruction information, the offline programmer generates configuration information according to the instruction information, and enters the configuration information into the terminal product;

[0007] Alternatively, the instruction information is parsed to obtain a download algorithm index, a download algorithm and target firmware information, and the download algorithm index, the download algorithm and the target firmware information are stored in the storage module;

[0008] The preset burning program in the offline burner obtains the download algorithm index, the download algorithm and the target firmware information;

[0009] The burning program generates a burning instruction according to the download algorithm index, the download algorithm and the target firmware information, moves the offline burner to the terminal product and connects it to the terminal product, so that the instruction execution module burns the terminal product according to the burning instruction.

[0010] In some embodiments of the present invention, the offline programmer executes all the instruction information, including:

[0011] The compiler software reads the register to obtain a command sequence of the register, and the offline burner determines whether the burning of the terminal product is completed according to the command sequence;

[0012] When the terminal product completes the burning, obtaining the burning completion time of the terminal product;

[0013] The compiling software queries the burning completion time according to a preset time interval to obtain a plurality of query instructions;

[0014] The query time of the query instruction is obtained. When the offline programmer replays the instruction information, the offline programmer actively waits for the terminal product to complete the burning and skips the continuous query instructions within the time interval.

[0015] In some embodiments of the present invention, the preset burning program in the offline burner obtains the download algorithm index, the download algorithm and the target firmware information, including:

[0016] Acquire the target programming address of the offline programmer according to the target algorithm;

[0017] Defining a first array in the burning program and obtaining a data storage address of the first array, wherein the first array at least includes a number of possible burning times, a burning speed, a number of burning retries, reset information and control information;

[0018] The offline programmer performs programming again on the terminal product according to the data storage address to inject programming control parameters into the terminal product.

[0019] In some embodiments of the present invention, after the preset burning program in the offline burner obtains the download algorithm index, the download algorithm and the target firmware information, the method further includes:

[0020] The compiling software responds to a click operation input by a user, so that the compiling software sends the target firmware to the offline burner;

[0021] The offline burner receives the target firmware and stores the target firmware in the storage module.

[0022] In some embodiments of the present invention, the instruction execution module burns the terminal product according to the burning instruction, including:

[0023] Connecting the offline burning tool to the terminal product;

[0024] The compiler software performs an online burning operation to confirm the correctness of the wiring of the burning tool;

[0025] When the compiler software, the offline burning tool and the terminal product are successfully connected, the offline burning tool reads the USB instructions of the USB interface one by one, and the offline burning tool sends the USB instructions to the USB decoder so that the offline burning tool can download online;

[0026] When the offline burning tool recognizes the preset first register instruction, the offline burning tool pauses reading the USB until the offline burning tool completes reading the USB instruction, until the offline burning tool recognizes the preset second register instruction, and all the USB instructions are re-executed.

[0027] In some embodiments of the present invention, the MCU is further provided with a decoding module and a temporary storage unit, and the instruction information is parsed to obtain a download algorithm index, a download algorithm and target firmware information, including:

[0028] The compiling software is opened, and the MCU communicates with the compiling software so that the compiling software confirms that the terminal product has been connected;

[0029] Controlling the offline burning tool to perform online burning on the terminal product;

[0030] The decoding module acquires the instruction information and decodes the instruction information to obtain a decoding instruction. The decoding module configures parameters of the offline burning tool, responds to the compilation software, and interacts with the MCU according to the decoding instruction.

[0031] The MCU responds to the decoding instruction, obtains an operation result, and returns the operation result to the compilation software. The compilation software confirms that the decoding instruction is normal, and continues to send all the instruction information to complete the online burning of the terminal product.

[0032] When the compilation software confirms that the decoding instruction is normal, the offline burning tool saves the download index parsed by the decoding module in the temporary storage unit, and saves the download algorithm and the target firmware parsed in real time by the decoding module in the storage module;

[0033] When the online burning is completed, the algorithm index is saved in the storage module, and the burning completion tag is obtained.

[0034] In some embodiments of the present invention, before the preset burning program in the offline burner obtains the download algorithm index, the download algorithm and the target firmware information, the method further includes:

[0035] Initialize the offline burning tool and control the terminal product to enter the debugging mode;

[0036] Writing the download algorithm into the terminal product and verifying it, calling a preset clearing program to erase the flash memory of the terminal product, and writing the download algorithm again and verifying it;

[0037] Call the preset program program to write the firmware to the terminal product, write the download algorithm again and verify it, and call the verify program to verify it.

[0038] In a second aspect, an embodiment of the present invention provides a burning firmware update device, comprising at least one control processor and a memory for communicating with the at least one control processor; the memory stores instructions that can be executed by the at least one control processor, and the instructions are executed by the at least one control processor so that the at least one control processor can execute the burning firmware update method as described in the first aspect above.

[0039] In a third aspect, an embodiment of the present invention provides an electronic device, comprising the device for updating firmware as described in the second aspect.

[0040] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are used to execute the method for updating the burning firmware as described in the first aspect above.

[0041] The firmware update method according to the embodiment of the present invention has at least the following beneficial effects:

[0042] The compiler software sends the target firmware and instruction information to the offline burner through the USB interface; the instruction information is saved, the offline burner executes all instruction information, the offline burner generates configuration information according to the instruction information, and enters the configuration information into the terminal product; or, the instruction information is parsed to obtain the download algorithm index, download algorithm and target firmware information, and the download algorithm index, download algorithm and target firmware information are stored in the storage module; the preset burning program in the offline burner obtains the download algorithm index, download algorithm and target firmware information; the burning program generates a burning instruction according to the download algorithm index, download algorithm and target firmware information, and the offline burner is moved to the terminal product and connected to the terminal product, so that the instruction execution module burns the terminal product according to the burning instruction. According to the technical solution of this embodiment, the security of burning firmware can be improved and the burning cost can be reduced. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] Figure 1 is a flow chart of a method for updating firmware provided by an embodiment of the present invention;

[0044] Figure 2 It is a flow chart of the offline programmer executing all instruction information provided by an embodiment of the present invention;

[0045] Figure 3 It is a flow chart of the preset burning program provided by the embodiment of the present invention obtaining the download algorithm index, the download algorithm and the target firmware information;

[0046] Figure 4 It is a flow chart after the preset burning program provided by the embodiment of the present invention obtains the download algorithm index, the download algorithm and the target firmware information;

[0047] Figure 5 It is a flow chart of the instruction execution module provided in the embodiment of the present invention burning the terminal product according to the burning instruction;

[0048] Figure 6 It is a flowchart of parsing instruction information to obtain a download algorithm index, a download algorithm and target firmware information provided by an embodiment of the present invention;

[0049] Figure 7 It is a flow chart before the preset burning program provided by the embodiment of the present invention obtains the download algorithm index, the download algorithm and the target firmware information;

[0050] Figure 8 is a structural diagram of a firmware updating device provided by another embodiment of the present invention;

[0051] Fig. 9 It is a principle block diagram of a burning tool provided by an embodiment of the present invention;

[0052] Fig.10 It is a principle block diagram of the parsing module and the storage module provided by the embodiment of the present invention. DETAILED DESCRIPTION

[0053] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be understood as limiting the present invention.

[0054] In the description of the present invention, it should be understood that descriptions involving orientations, such as up, down, front, back, left, right, etc., and orientations or positional relationships indicated are based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as a limitation on the present invention.

[0055] In the description of the present invention, "several" means one or more, "more" means more than two, "greater than", "less than", "exceed" etc. are understood as not including the number itself, and "above", "below", "within" etc. are understood as including the number itself. If there is a description of "first" or "second", it is only used for the purpose of distinguishing the technical features, and cannot be understood as indicating or implying the relative importance or implicitly indicating the number of the indicated technical features or implicitly indicating the order of the indicated technical features.

[0056] In the description of the present invention, unless otherwise clearly defined, terms such as setting, installing, connecting, etc. should be understood in a broad sense, and technicians in the relevant technical field can reasonably determine the specific meanings of the above terms in the present invention based on the specific content of the technical solution.

[0057] Reference Fig. 9 , the embodiment of the present invention provides a burning tool, the burning tool includes a compiler software, an off-line burner and a terminal product, the off-line burner is connected to the compiler software and the terminal product respectively, the off-line burner is connected to the compiler software through a USB interface, and the off-line burner is provided with an MCU, a storage module and an instruction execution module. Specifically, the compiler software (keil, IAR, GCC, etc.) generates a target firmware through cross-compilation, and then the compiler software communicates with the off-line burner through the USB interface to burn the terminal product. The off-line burning tool in the present embodiment only needs to normally execute an online program burning once, and the effective firmware can be extracted for off-line burning, and the terminal product when the firmware burning is not limited. In addition, the off-line burner in the present embodiment can also, when the interrupt product is not connected, directly simulate the terminal MCU by the built-in MCU in the off-line burner, thereby inducing the compiler software to issue the burning firmware and store it.

[0058] It should be noted that the target firmware needs additional storage media, such as Flash, EEPROM, NAND or SD card, etc. to be stored. For saving the cost of the off-line programmer, the preferred solution of this embodiment is to use the SPIFlash chip as the storage module of the off-line programmer. In addition, when the on-chip Flash of the MCU in the off-line programmer is large enough, the on-chip Flash can also be directly used as the storage module of the off-line programmer.

[0059] Furthermore, in this embodiment, a plurality of function buttons may be provided on the offline programmer to control firmware update and start offline download, and a buzzer, LED light, etc. may be added to indicate the programming result.

[0060] The control method of the embodiment of the present invention is further described below based on the accompanying drawings.

[0061] Reference Figure 1 , Figure 1 A flowchart of a method for updating a firmware by burning is provided in an embodiment of the present invention. The method for updating a firmware by burning includes but is not limited to the following steps:

[0062] Step S11, the compiling software sends the target firmware and instruction information to the offline burner through the USB interface;

[0063] It should be noted that after the compiler software generates the target firmware and instruction information, it is transmitted to the offline burner through the USB interface. During the data transmission process, the target firmware and instruction information will be encoded into a format suitable for USB interface transmission; after the offline burner receives the target firmware and instruction information, it will burn the terminal product according to the preset burning algorithm and configuration parameters according to the target firmware and instruction information.

[0064] It should be noted that the offline programmer can ensure the correct input of firmware information and instruction information, and at the same time, reduce errors and failures in the data transmission process by following specific communication protocols and specifications. In addition, the offline programmer supports a variety of terminal products and burning algorithms, and has high adaptability, so that users can burn firmware for different terminal products according to actual needs. Furthermore, the offline programmer does not require additional network connections and server resources, thereby reducing the burning cost. At the same time, the offline programmer can also be reused.

[0065] Step S12, the instruction information is saved, the offline programmer executes all the instruction information, the offline programmer generates configuration information according to the instruction information, and enters the configuration information into the terminal product;

[0066] It should be noted that all instruction information issued by the compilation software online is saved in the storage module of the offline burner. When the offline burner performs offline burning, all USB commands are executed from the beginning (instruction replay), and any terminal product can use it.

[0067] Step S13, or, parsing the instruction information to obtain the download algorithm index, the download algorithm and the target firmware information, and storing the download algorithm index, the download algorithm and the target firmware information in the storage module;

[0068] It should be noted that by parsing the instruction information, the download algorithm index, the complete download algorithm and the complete target firmware in the instruction information can be effectively extracted, and the download algorithm index, the download algorithm and the target firmware information are all stored in the storage module.

[0069] Step S14, the preset burning program in the offline burning device obtains the download algorithm index, the download algorithm and the target firmware information;

[0070] Step S15, the burning program generates a burning instruction according to the download algorithm index, the download algorithm and the target firmware information, moves the offline burner to the terminal product and connects it to the terminal product, so that the instruction execution module burns the terminal product according to the burning instruction.

[0071] It should be noted that when the offline programmer performs offline programming, the MCU calls the complete offline programming function program, and quickly generates programming instructions and executes programming operations based on the download algorithm index, download algorithm and target firmware information, thereby improving the programming efficiency of the offline programmer. In addition, the offline programmer can be moved to different terminal products for programming operations, further enhancing the flexibility and convenience of programming.

[0072] It should be noted that, in this embodiment, by simulating the MCU debugging component in the offline burner, the virtual MCU in the offline burner directly interacts with the compilation software through the USB interface, and induces the compilation software to send the target firmware to the offline burner, and the steamer process does not need to be connected to the actual terminal product. When the terminal product is firmware burned, it is only necessary to move the offline burner to the target product for connection, and then implement the firmware burning, so as to conveniently and quickly realize the program update of the terminal product without multiple wiring.

[0073] Further, a low-cost and easy-to-use offline burning tool is provided without limiting the use of the chip. Click to download on the compiler software to save the target firmware offline. Before the offline operation, the offline burner completes the online burning, and the offline burning function can be used. There is no need to purchase a license separately, and there is no need to provide information to the burner manufacturer, thereby avoiding the risk of data leakage. In addition, the offline burning tool in this embodiment realizes advanced burning restriction functions such as encryption protection and burning number limit by matching a dedicated download algorithm, without using the host computer software.

[0074] In addition, in one embodiment, referring to Figure 2 ,exist Figure 1 Step S11 of the illustrated embodiment also includes but is not limited to the following steps:

[0075] Step S21, the compiling software reads the register to obtain the command sequence of the register, and the offline burner determines whether the burning of the terminal product is completed according to the command sequence;

[0076] Step S22, when the terminal product completes the burning, obtain the burning completion time of the terminal product;

[0077] Step S23, the compiling software queries the burning completion time according to a preset time interval to obtain multiple query instructions;

[0078] Step S24, obtaining the query time of the query instruction. When the offline programmer replays the instruction information, the offline programmer actively waits for the terminal product to complete the burning and skips the continuous query instructions within the time interval.

[0079] It should be noted that since the compiler software will generate more redundant instructions when inputting the target firmware into the offline burner, the redundant instructions occupy a large memory space, and some query commands require special processing. Therefore, the compiler software determines whether the burning is completed by reading the DHCSR register, where the command sequence is 05, 00, 02, 05, F0, ED, 00, E0, 0F. Since the main frequency of each terminal product is not exactly the same as the Flash characteristics in the storage module, the completion time of the burning is also different. The compiler software will query according to the preset time interval and generate query instructions. When burning, there will be multiple consecutive identical query instructions. Therefore, when the firmware burner encounters a query instruction during replay, it is necessary to actively wait for the burning to be completed and skip the subsequent continuous query instructions within the time interval.

[0080] In addition, in one embodiment, referring to Figure 3 ,exist Figure 1 Step S13 of the illustrated embodiment also includes but is not limited to the following steps:

[0081] Step S31, obtaining the target programming address of the offline programmer according to the target algorithm;

[0082] Step S32, defining a first array in the burning program and obtaining a data storage address of the first array, wherein the first array at least includes the number of possible burning times, the burning speed, the number of burning retries, reset information and control information;

[0083] Step S33, the off-line programmer performs programming on the terminal product again according to the data storage address to inject programming control parameters into the terminal product.

[0084] It should be noted that, in the present embodiment, the target algorithm is added, and the target burning address of the target algorithm points to 0x40000000, which is an invalid memory address. A first array is defined in the burning program, and the data storage address of the first array is set to the target burning address (0x40000000), and the content of the first array is the firmware burning name, the number of burning times, the burning speed, the number of burning retries, whether to reset the operation and other control information, etc. After the above steps are completed, the burning is performed again, so that the advanced burning control parameters are injected into the offline burner, so that there is no need to use a dedicated host computer to participate, and the occupied resources are reduced, so that the target firmware can be stored in the control module in the offline burner, and the offline burning function program is called to realize offline burning, thereby adding more advanced functions to the offline burner.

[0085] In addition, in one embodiment, referring to Figure 4 ,exist Figure 1 After step S13 of the illustrated embodiment, the following steps are also included but not limited to:

[0086] Step S41, the compiling software responds to the click operation input by the user, so that the compiling software sends the target firmware to the offline burner;

[0087] In step S42, the off-line programmer receives the target firmware and stores the target firmware in the storage module.

[0088] It should be noted that the user only needs to click to complete the transmission of the target firmware from the compiler software to the offline burner, and the offline burner is physically isolated from the computer to prevent the target firmware from being maliciously tampered with or stolen during the transmission process. In addition, the automated operation process reduces manual intervention in the burning process, thereby further speeding up the firmware burning process, and the communication between the offline burner and the compiler software is achieved through a stable data transmission protocol to ensure the integrity and accuracy of the target firmware during the transmission process. At the same time, after receiving the firmware, the offline burner will also perform a check to ensure that the firmware is stored correctly.

[0089] In addition, in one embodiment, referring to Figure 5 ,exist Figure 1 Step S15 of the illustrated embodiment also includes but is not limited to the following steps:

[0090] Step S51, connecting the offline burning tool to the terminal product;

[0091] Step S52, the compiling software performs an online burning operation to confirm the correctness of the wiring of the burning tool;

[0092] Step S53, when the compilation software, the offline burning tool and the terminal product are successfully connected, the offline burning tool reads the USB instructions of the USB interface one by one, and the offline burning tool sends the USB instructions to the USB decoder so that the offline burning tool can download online;

[0093] Step S54, when the offline burning tool recognizes the preset first register instruction, the offline burning tool pauses reading the USB instruction until the offline burning tool completes reading the USB instruction, until the offline burning tool recognizes the preset second register instruction, and all USB instructions are re-executed.

[0094] Connect the offline burner to the terminal product, open the compiler software, first perform an online burning to confirm the correctness of the wiring, then update the offline burner (the present embodiment adopts pressing the update button of the tool), the burning tool starts to record the current USB command, and then performs a burning download, and the offline burning tool will store all USB instructions in the storage module (the present embodiment adopts SPI Flash). Due to the large number of pre-instructions of the USB interface, the final size will reach more than 4 times the size of the original firmware. When the offline burner is successfully burned online, disconnect the offline burner from the computer, use an adapter to power the tool, so that the offline burner starts the offline burning (the present embodiment adopts pressing the button on the offline burner to start the offline burning), the offline burner will read the USB instructions one by one from the storage module (SPI Flash), and disguise as the compiler software to transmit the command to the USB decoder, and enter the subsequent online download process. After the first register instruction (query DHCSR register command) is identified (the command sequence is 05, 00, 02, 05, F0, ED, 00, E0, 0F), the USB instruction reading will be suspended, and the previous operation will be waited for to be completed, and then the subsequent continuous first register instruction (query DHCSR register command) will be read and discarded, until the second register instruction (the next non-query DHCSR register command) is identified, and this cycle will continue until all USB instructions are re-executed, and the program is burned. The burning method of this embodiment does not select terminal products, and as long as the online burning is successful, the offline burning can be realized.

[0095] In addition, in one embodiment, referring to Figure 6 and Fig.10 ,exist Figure 1 Step S13 of the illustrated embodiment also includes but is not limited to the following steps:

[0096] Step S61, opening the compiling software, and the MCU communicates with the compiling software so that the compiling software confirms that it has been connected to the terminal product;

[0097] Step S62, controlling the offline burning tool to perform online burning on the terminal product;

[0098] Step S63, the decoding module obtains the instruction information, and decodes the instruction information to obtain a decoding instruction. The decoding module configures the parameters of the offline burning tool, responds to the compilation software, and interacts with the MCU according to the decoding instruction;

[0099] Step S64, the MCU responds to the decoded instruction, obtains the operation result, and returns the operation result to the compiling software, the compiling software confirms that the decoded instruction is normal, and continues to send all instruction information to complete the online burning of the terminal product;

[0100] Step S65, when the compilation software confirms that the decoding instruction is normal, the offline burning tool saves the download index parsed by the decoding module in a temporary storage unit, and saves the download algorithm and target firmware parsed in real time by the decoding module in the storage module;

[0101] Step S66, when the online burning is completed, the algorithm index is saved in the storage module, and the downloaded algorithm index is marked.

[0102] It should be noted that before opening the compilation software, the offline burner is initialized. The specific initialization operations include: connect the burning tool to the computer, not to the terminal product, press the update button 5 times in a row, and the buzzer of the offline burner will sound 5 times in a row, indicating that it has entered the DAP instruction parsing mode. Then press and hold the update button for 3 seconds, and the buzzer will sound for 3 seconds, indicating that it has entered the virtual MCU mode. Add advanced configuration dedicated firmware to the project, add an array to the project, the array address points to 0x40000000, the array content is {123456, 100, 10000000, 5, 1}, that is, the burning firmware name is 123456, the number of burning times is 100, the burning speed is 10MHz, the number of failed retries is 5, and the reset operation is completed after the burning is completed.

[0103] Open the compiler software, MCU will communicate with the compiler software, so that the compiler software thinks that the terminal product has been connected. Then the offline burner performs an online burning, the compiler software communicates with the offline burner through USB, and the offline burner transmits the USB command to the DAP decoding module through the USB interface. The DAP decoding module performs parameter configuration, responds to the compiler software, and interacts with the virtual MCU through the virtual SWD according to the parsed DAP instruction. The virtual MCU will respond to the simulation component operation instruction, SRAM write instruction and program execution instruction, and return the operation result to the compiler software through the original path of SWD, DAP, and USB, so that the compiler software thinks that the instruction operation is normal, and then continue to send all USB instructions to complete the online burning. At the same time, the burning tool will save the download algorithm index parsed in real time in the temporary storage unit (SRAM), and save the download algorithm and target firmware parsed in real time in the storage module (the storage module of this embodiment is an external SPI Flash). After the final burning is completed, the algorithm index is saved in the storage module (SPI Flash), and a mark is made to inform the burning tool that the current storage module (SPI Flash) stores the parsed offline data, and the offline data is consistent with the actual size. After the target firmware is released, the compiler software will release the advanced configuration information at the address 0x40000000, and the burning tool will directly save the configuration information in the storage module (SPI Flash). After the virtual online burning is completed, disconnect the computer, use the adapter to power the tool, connect the terminal product, press the burning button, and the burning tool will recognize that the storage module (SPI Flash) stores complete offline data, call the complete offline burning program, and perform offline burning according to the advanced configuration information.

[0104] In addition, in one embodiment, referring to Figure 7 ,exist Figure 1 Before step S14 of the illustrated embodiment, the following steps are also included but not limited to:

[0105] Step S71, initializing the offline burning tool and controlling the terminal product to enter the debugging mode;

[0106] Step S72, writing the download algorithm to the terminal product and verifying it, calling the preset clearing program to erase the flash memory of the terminal product, and writing the download algorithm again and verifying it;

[0107] Step S73, calling the preset program program to write the firmware to the terminal product, re-writing the download algorithm and verifying it, and calling the verify program for verification.

[0108] It should be noted that according to the DAP protocol, to achieve online burning, at least the following processes are required: connect the chip and initialize the debugging component, control the chip to enter debug_halt mode, write the download algorithm to the chip SRAM and read it back for verification, call the erase program to erase the chip Flash, write the download algorithm again and verify, call the program program to write the firmware, write the download algorithm again and verify, and call the verify program to verify the firmware.

[0109] like Figure 8 As shown, Figure 8 : is a structural diagram of a firmware update device provided by an embodiment of the present invention. The present invention also provides a firmware update device, including:

[0110] The processor 801 may be implemented by a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application;

[0111] The memory 802 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 802 can store an operating system and other application programs. When the technical solution provided in the embodiment of this specification is implemented by software or firmware, the relevant program code is stored in the memory 802, and the processor 801 calls and executes the firmware update method of the embodiment of this application;

[0112] Input / output interface 803, used to implement information input and output;

[0113] The communication interface 804 is used to realize the communication interaction between the present apparatus and other devices. The communication can be realized through a wired manner (such as USB, network cable, etc.) or a wireless manner (such as mobile network, WIFI, Bluetooth, etc.);

[0114] A bus 805 that transmits information between the various components of the device (e.g., the processor 801, the memory 802, the input / output interface 803, and the communication interface 804);

[0115] The processor 801 , the memory 802 , the input / output interface 803 and the communication interface 804 are connected to each other in communication within the device via a bus 805 .

[0116] An embodiment of the present application also provides an electronic device, including the burning firmware update device as described above.

[0117] An embodiment of the present application further provides a storage medium, which is a computer-readable storage medium and stores a computer program. When the computer program is executed by a processor, the above-mentioned method for updating the burning firmware is implemented.

[0118] As a non-transient computer-readable storage medium, the memory can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage devices. In some embodiments, the memory may optionally include a memory remotely arranged relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned networks include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof. The device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and are implemented to be located in one place, or may also be distributed to multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment.

[0119] It will be appreciated by those skilled in the art that all or some of the steps and systems in the disclosed method above may be implemented as software, firmware, hardware and appropriate combinations thereof. Some physical components or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor or a microprocessor, or may be implemented as hardware, or may be implemented as an integrated circuit, such as an application specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or a non-transitory medium) and a communication medium (or a temporary medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, disk storage or other magnetic storage devices, or any other medium that may be used to store desired information and may be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media typically include computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.

[0120] The above is a specific description of the preferred implementation of the present invention, but the present invention is not limited to the above-mentioned implementation mode. Technical personnel familiar with the field can also make various equivalent deformations or substitutions under the shared conditions without violating the spirit of the present invention. These equivalent deformations or substitutions are all included in the scope defined by the claims of the present invention.

Claims

1. A method for updating burning firmware, characterized in that: Applied to a burning tool, the burning tool includes a compiling software, an offline burner and a terminal product, the offline burner is connected to the compiling software and the terminal product respectively, wherein the offline burner is provided with an MCU, a storage module and an instruction execution module, and the firmware burning and updating method includes: The compiler software sends the target firmware and the instruction information to the offline burner through the USB interface; The instruction information is saved, the offline programmer executes all the instruction information, the offline programmer generates configuration information according to the instruction information, and enters the configuration information into the terminal product; Alternatively, the instruction information is parsed to obtain a download algorithm index, a download algorithm and target firmware information, and the download algorithm index, the download algorithm and the target firmware information are stored in the storage module; The preset burning program in the offline burner obtains the download algorithm index, the download algorithm and the target firmware information; The burning program generates a burning instruction according to the download algorithm index, the download algorithm and the target firmware information, moves the offline burner to the terminal product and connects it to the terminal product, so that the instruction execution module burns the terminal product according to the burning instruction.

2. The method for updating the burning firmware according to claim 1, characterized in that: The offline programmer executes all the instruction information, including: The compiler software reads the register to obtain a command sequence of the register, and the offline burner determines whether the burning of the terminal product is completed according to the command sequence; When the terminal product completes the burning, obtaining the burning completion time of the terminal product; The compiling software queries the burning completion time according to a preset time interval to obtain a plurality of query instructions; The query time of the query instruction is obtained. When the offline programmer replays the instruction information, the offline programmer actively waits for the terminal product to complete the burning and skips the continuous query instructions within the time interval.

3. The method for updating the burning firmware according to claim 1, characterized in that: The preset burning program in the offline burning device obtains the download algorithm index, the download algorithm and the target firmware information, including: Acquire the target programming address of the offline programmer according to the target algorithm; Defining a first array in the burning program and obtaining a data storage address of the first array, wherein the first array at least includes a number of possible burning times, a burning speed, a number of burning retries, reset information and control information; The offline programmer performs programming again on the terminal product according to the data storage address to inject programming control parameters into the terminal product.

4. The method for updating the burning firmware according to claim 1, characterized in that: After the preset burning program in the offline burning device obtains the download algorithm index, the download algorithm and the target firmware information, the method further includes: The compiling software responds to a click operation input by a user, so that the compiling software sends the target firmware to the offline burner; The offline burner receives the target firmware and stores the target firmware in the storage module.

5. The method for updating the burning firmware according to claim 1, characterized in that: The instruction execution module burns the terminal product according to the burning instruction, including: Connecting the offline burning tool to the terminal product; The compiler software performs an online burning operation to confirm the wiring correctness of the burning tool; When the compiler software, the offline burning tool and the terminal product are successfully connected, the offline burning tool reads the USB instructions of the USB interface one by one, and the offline burning tool sends the USB instructions to the USB decoder so that the offline burning tool can download online; When the offline burning tool recognizes the preset first register instruction, the offline burning tool pauses reading the USB until the offline burning tool completes reading the USB instruction, until the offline burning tool recognizes the preset second register instruction, and all the USB instructions are re-executed.

6. The method for updating the burning firmware according to claim 1, characterized in that: The MCU is also provided with a decoding module and a temporary storage unit, and the instruction information is parsed to obtain a download algorithm index, a download algorithm and target firmware information, including: The compiling software is opened, and the MCU communicates with the compiling software so that the compiling software confirms that the terminal product has been connected; Controlling the offline burning tool to perform online burning on the terminal product; The decoding module acquires the instruction information and decodes the instruction information to obtain a decoding instruction. The decoding module configures parameters of the offline burning tool, responds to the compilation software, and interacts with the MCU according to the decoding instruction. The MCU responds to the decoding instruction, obtains an operation result, and returns the operation result to the compilation software. The compilation software confirms that the decoding instruction is normal, and continues to send all the instruction information to complete the online burning of the terminal product. When the compilation software confirms that the decoding instruction is normal, the offline burning tool saves the download algorithm index parsed by the decoding module in the temporary storage unit, and saves the download algorithm and the target firmware parsed by the decoding module in real time in the storage module; After the online burning is completed, the algorithm index is saved in the storage module, and the algorithm index is downloaded.

7. The method for updating the burning firmware according to claim 1, characterized in that: Before the preset burning program in the offline burning device obtains the download algorithm index, the download algorithm and the target firmware information, the method further includes: Initialize the offline burning tool and control the terminal product to enter the debugging mode; Writing the download algorithm into the terminal product and verifying it, calling a preset clearing program to erase the flash memory of the terminal product, and writing the download algorithm again and verifying it; Call the preset program program to write the firmware to the terminal product, write the download algorithm again and verify it, and call the verify program to verify it.

8. A firmware update device, characterized in that: It includes at least one control processor and a memory for communicating with the at least one control processor; the memory stores instructions that can be executed by the at least one control processor, and the instructions are executed by the at least one control processor so that the at least one control processor can execute the burning firmware update method as described in any one of claims 1 to 7.

9. An electronic device, characterized in that: It includes the burning firmware update device as described in claim 8.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the burning firmware update method according to any one of claims 1 to 7.

Citation Information

Cited By

  • Firmware loading method and device based on dual-chip collaboration

    CN120704717A