Chip program upgrading method and device

By dividing the chip's memory into regions and using a bootloader for backup, the problem of application loss due to chip program upgrade failures was solved, ensuring the normal use of the chip.

CN114780112BActive Publication Date: 2026-05-01SUNGROW POWER SUPPLY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SUNGROW POWER SUPPLY CO LTD
Filing Date
2022-04-02
Publication Date
2026-05-01

AI Technical Summary

Technical Problem

When a chip program upgrade fails, the application is easily lost, causing the chip to malfunction.

Method used

The chip's memory is divided into areas for storing the bootloader, applications, and backup applications. The bootloader is used to upgrade the application, and the backup application is restored if the upgrade fails.

Benefits of technology

This effectively prevents application loss and ensures that the chip can still function normally even if the program upgrade fails.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114780112B_ABST
    Figure CN114780112B_ABST
Patent Text Reader

Abstract

This application discloses a chip program upgrade method and apparatus. The chip memory includes: a first region storing a bootloader, a second region storing an application program, and a third region storing a backup application program. The method includes: responding to a program upgrade instruction, receiving a program upgrade file, wherein the program upgrade instruction is at least one of an application program upgrade instruction and a bootloader upgrade instruction, and the program upgrade file is at least one of an application program upgrade file and a bootloader upgrade file; copying the application program from the second region to the third region to replace the backup application program using the bootloader, and burning the program upgrade file to the second region; performing a program upgrade based on the program upgrade file; and restoring the application program in the second region based on the new backup application program in the third region when the program upgrade fails. This application solves the technical problem in related technologies where a chip program upgrade failure may lead to application loss and chip damage.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of chip upgrade technology, and more specifically, to a chip program upgrade method and apparatus. Background Technology

[0002] The program within a chip typically includes a bootloader and an application program. The application program contains code that controls product functions, while the bootloader contains code that assists in upgrading the application program. Generally, the chip implements product-related functions by running the application program and upgrades the application program by running the bootloader. However, in related technologies, whether it's an application program upgrade or a bootloader self-upgrade, if the upgrade fails, the original application program can easily be lost, causing the chip to cease normal operation.

[0003] There is currently no effective solution to the above problems. Summary of the Invention

[0004] This application provides a chip program upgrade method and apparatus to at least solve the technical problem in the related art that application loss and chip damage may occur when chip program upgrade fails.

[0005] According to one aspect of the embodiments of this application, a chip program upgrade method is provided, wherein the chip memory includes: a first region storing a bootloader, a second region storing an application, and a third region storing a backup application. The method includes: receiving a program upgrade file in response to a program upgrade instruction, wherein the program upgrade instruction is at least one of an application upgrade instruction and a bootloader upgrade instruction, and the program upgrade file is at least one of an application upgrade file and a bootloader upgrade file; copying the application in the second region to the third region to replace the backup application through the bootloader, and burning the program upgrade file to the second region; performing a program upgrade based on the program upgrade file; and restoring the application in the second region based on the new backup application in the third region when the program upgrade fails.

[0006] Optionally, before receiving the program upgrade file in response to the program upgrade instruction, when the chip is powered on, the bootloader checks whether the application in the second area is valid; if the application is valid, the application is executed; if the application is invalid, the bootloader checks whether the backup application in the third area is valid; if the backup application is valid, the backup application is copied to the second area to replace the application, and the new application is executed; if the backup application is invalid, the bootloader remains in the bootloader state, waiting for the program upgrade instruction.

[0007] Optionally, the program upgrade instruction is an application upgrade instruction, the program upgrade file is an application upgrade file, and the application upgrade file includes at least: application file information, application code, and file checksum, wherein the application file information includes at least: file type, file size, file compilation date, checksum of the application code, and backup information.

[0008] Optionally, the backup application in the third region is erased by the bootloader, and the application in the second region is copied to the third region as a new backup application; the application in the second region is erased, and the application upgrade file is burned to the second region to upgrade the application; upon successful upgrade, the new application in the second region is executed.

[0009] Optionally, the program upgrade instruction is a bootloader upgrade instruction, the program upgrade file is a bootloader upgrade file, and the bootloader upgrade file includes at least: a small transport program, bootloader file information, bootloader code, and a file checksum. The small transport program is used to transport the bootloader code to the first region, and the bootloader file information includes at least: file type, file size, file compilation date, checksum of the bootloader code, and backup information.

[0010] Optionally, the bootloader erases the backup application in the third region and copies the application in the second region to the third region as a new backup application; the application in the second region is erased and the bootloader upgrade file is burned to the second region; the small transfer program in the bootloader upgrade file is executed to perform a bootloader upgrade; when the upgrade is successful, the application in the second region is restored based on the new backup application in the third region.

[0011] Optionally, the small transfer program sends an inquiry command to inquire whether the bootloader code in the bootloader upgrade file needs to be transferred to the first area; in response to the transfer confirmation command, the small transfer program erases the bootloader in the first area and writes the bootloader code in the bootloader upgrade file into the first area as a new bootloader; if the transfer confirmation command is not received within a preset time period, the small transfer program self-destructs.

[0012] According to another aspect of the embodiments of this application, a chip program upgrade apparatus is also provided, wherein the chip memory includes: a first area for storing a boot program, a second area for storing an application program, and a third area for storing a backup application program. The apparatus includes: a receiving module, configured to receive a program upgrade file in response to a program upgrade instruction after the chip is powered on, wherein the program upgrade instruction is at least one of an application program upgrade instruction and a boot program upgrade instruction, and the program upgrade file is at least one of an application program upgrade file and a boot program upgrade file; an upgrade module, configured to copy the application program in the second area to the third area to replace the backup application program through the boot program, and to burn the program upgrade file to the second area, and to perform a program upgrade based on the program upgrade file; and a recovery module, configured to restore the application program in the second area based on the new backup application program in the third area when the program upgrade fails.

[0013] According to another aspect of the embodiments of this application, a non-volatile storage medium is also provided, the non-volatile storage medium including a stored program, wherein, when the program is running, the device where the non-volatile storage medium is located is controlled to execute the above-described chip program upgrade method.

[0014] According to another aspect of the embodiments of this application, an electronic chip is also provided, the electronic chip comprising: a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the chip program upgrade method of claim 1 through the computer program.

[0015] In this embodiment, when the chip is upgraded, it can receive the upgrade file in response to the upgrade command, then back up the existing application through the bootloader, and then burn the upgrade file to the area of ​​the original application. The chip is then upgraded based on the upgrade file. When the upgrade fails, the original application can be restored based on the backup application, avoiding the loss of the application and the resulting chip malfunction. This method is applicable to both application upgrade and bootloader upgrade scenarios, effectively solving the technical problem in related technologies that may lead to application loss and chip damage when the chip upgrade fails. Attached Figure Description

[0016] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:

[0017] Figure 1 This is a schematic flowchart of a chip program upgrade method according to an embodiment of this application;

[0018] Figure 2 This is a schematic diagram of a FLASH memory region division according to an embodiment of this application;

[0019] Figure 3 This is a schematic flowchart of a chip power-on process according to an embodiment of this application;

[0020] Figure 4 This is a schematic diagram of the structure of an application upgrade file according to an embodiment of this application;

[0021] Figure 5 This is a schematic diagram of the structure of a bootloader upgrade file according to an embodiment of this application;

[0022] Figure 6 This is a flowchart illustrating an application upgrade process according to an embodiment of this application;

[0023] Figure 7 This is a schematic flowchart of a bootloader upgrade process according to an embodiment of this application;

[0024] Figure 8 This is a schematic diagram of a chip program upgrade device according to an embodiment of this application. Detailed Implementation

[0025] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0026] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0027] Example 1

[0028] According to an embodiment of this application, a chip program upgrade method is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0029] Figure 1 This is a flowchart illustrating an optional chip program upgrade method according to an embodiment of this application, as shown below. Figure 1 As shown, the method includes at least steps S102-S106, wherein:

[0030] Step S102: In response to the program upgrade instruction, receive the program upgrade file, wherein the program upgrade instruction is at least one of the application upgrade instruction and the bootloader upgrade instruction, and the program upgrade file is at least one of the application upgrade file and the bootloader upgrade file.

[0031] In some optional embodiments of this application, the chip to be upgraded can be a common TI series chip, whose memory is typically erasable memory, such as FLASH memory. To back up applications and prevent their loss, the chip memory can typically be divided into: a first area storing the bootloader, a second area storing the application, and a third area storing the backup application. Figure 2 An optional FLASH memory is shown, wherein region B is the first region, which stores the bootloader; region A is the second region, which stores the application; and region A_backup is the third region, which stores the backup application. Regions A and A_backup are the same size.

[0032] Before upgrading the chip, a chip power-on process needs to be performed. Specifically, when the chip is powered on, the bootloader can first check whether the application in the second area is valid. If the application is valid, the application is executed. If the application is invalid, the backup application in the third area is checked. If the backup application is valid, the backup application is copied to the second area to replace the application and the new application is executed. If the backup application is invalid, the bootloader remains in the bootloader state and waits for the program upgrade instruction. Figure 3 This is a complete flowchart illustrating an optional chip power-on process according to this application.

[0033] The backup application in the third area can be the application that was backed up during the last program upgrade of the chip. For example, if the upgrade failed during the last program upgrade, causing the application in the second area to be corrupted, the backup application in the third area can be restored to the second area after power-on. If the backup application in the third area is also corrupted, it can only remain in the boot program and wait for a subsequent program upgrade.

[0034] After the chip is powered on, it can respond to the program upgrade command sent by the host computer, receive the corresponding program upgrade file, and then upgrade the application program or the boot program, or both.

[0035] When the program upgrade instruction is an application upgrade instruction, the program upgrade file is the application upgrade file. Figure 4 A schematic diagram of the structure of an optional application upgrade file is shown. The application upgrade file includes at least three parts: 1) Part Z1, which is the application file information, including at least five parts: a) File type, used to identify whether the file is an application upgrade file or a bootloader upgrade file, usually occupying 6 bytes; b) File size, used to identify the size of the application file, usually occupying 4 bytes; c) File compilation date, used to identify the compilation date of the application file, usually occupying 8 bytes; d) Application code checksum, used to verify the application code, usually occupying 4 bytes; e) Backup information, usually occupying 10 bytes; 2) Part Z2, which is the application code, i.e., the executable code; 3) Part Z3, which is the file checksum, used to verify the application file information in Part Z1 and the application code in Part Z2, usually occupying 4 bytes.

[0036] When performing file verification, the commonly used Cyclic Redundancy Check (CRC) can be used. The checksum of the above application code and the file checksum can both be CRC32 checksums.

[0037] When the program upgrade instruction is a bootloader upgrade instruction, the program upgrade file is a bootloader upgrade file. Figure 5A schematic diagram of an optional bootloader upgrade file is shown. This bootloader upgrade file includes at least four parts: 1) Part Z1, a small transfer program containing only the communication part and part of the FLASH API, with erasing and transfer functions, mainly used to transfer the bootloader code in the bootloader upgrade file to the first area; 2) Part Z2, bootloader file information, similar to application file information, which also includes five parts: a, file type; b, file size; c, file compilation date; d, bootloader code checksum; e, backup information; 3) Part Z3, bootloader code, i.e., executable code; 4) Part Z4, file checksum, used to verify the small transfer program in Part Z1, the bootloader file information in Part Z2, and the bootloader code in Part Z3.

[0038] Step S104: The application in the second area is copied to the third area to replace the backup application through the bootloader, and the program upgrade file is burned to the second area to upgrade the program based on the program upgrade file.

[0039] In some optional embodiments of this application, when upgrading an application, the backup application in the third region can be erased by the bootloader, and the application in the second region can be copied to the third region as a new backup application; the application in the second region can be erased, and the application upgrade file can be burned to the second region to upgrade the application; when the upgrade is successful, the new application in the second region can be executed.

[0040] Figure 6 This is a complete flowchart of an optional application upgrade process according to this application. First, it checks whether an application upgrade command has been received. After receiving the upgrade command, it enters the boot program, replaces the backup application in the third area with the current application, and then burns the application upgrade file to the second area. After that, it uses a file verification code to verify. If it passes, the upgrade is considered successful and the application in the second area can be executed. If it fails, the upgrade is considered to have failed, the chip needs to be powered on again, and the application in the second area is restored based on the backup application in the third area to ensure that the chip can still work normally.

[0041] In some optional embodiments of this application, when upgrading the bootloader, the backup application in the third region can be erased by the bootloader, and the application in the second region can be copied to the third region as a new backup application; the application in the second region can be erased, and the bootloader upgrade file can be burned to the second region; a small transfer program in the bootloader upgrade file can be executed to upgrade the bootloader; when the upgrade is successful, the application in the second region can be restored based on the new backup application in the third region.

[0042] Specifically, when performing a small transfer program to upgrade the bootloader, the small transfer program can send an inquiry command to ask whether the bootloader code in the bootloader upgrade file needs to be transferred to the first area. In response to the transfer confirmation command, the small transfer program erases the bootloader in the first area and writes the bootloader code in the bootloader upgrade file into the first area as the new bootloader. If no transfer confirmation command is received within a preset time period, the small transfer program self-destructs.

[0043] For example, a small transfer program can send a query command to the host computer every 1 second, asking whether the bootloader code in the bootloader upgrade file needs to be transferred to the first area. If a transfer confirmation command is received from the host computer, the bootloader code in the bootloader upgrade file is transferred to the first area. If no transfer confirmation command is received after 20 minutes, the small transfer program self-destructs. Afterwards, the application in the second area can be restored based on the backup application in the third area to ensure that the chip can work normally. Figure 7 This is a complete flowchart of an optional bootloader upgrade process according to this application. It should be noted that the application upgrade process referred to here refers to burning the bootloader upgrade file to the second area with reference to the above application upgrade process, and does not refer to the complete execution of the application upgrade process.

[0044] Step S106: If the program upgrade fails, restore the application in the second region based on the new backup application in the third region.

[0045] Specifically, whether it is an application upgrade or a bootloader upgrade, if the upgrade fails, the chip power-on process can be re-executed to restore the original application backed up in the third area to the second area, thus preventing the chip from becoming unusable due to application loss.

[0046] In this embodiment, when the chip is upgraded, it can receive the upgrade file in response to the upgrade command, then back up the existing application through the bootloader, and then burn the upgrade file to the area of ​​the original application. The chip is then upgraded based on the upgrade file. When the upgrade fails, the original application can be restored based on the backup application, avoiding the loss of the application and the resulting chip malfunction. This method is applicable to both application upgrade and bootloader upgrade scenarios, effectively solving the technical problem in related technologies that may lead to application loss and chip damage when the chip upgrade fails.

[0047] Example 2

[0048] According to an embodiment of this application, a chip program upgrade apparatus for implementing the above-described chip program upgrade method is also provided, such as... Figure 8 As shown, the device includes at least a receiving module 81, an upgrade module 82, and a recovery module 83, wherein:

[0049] The receiving module 81 is configured to receive a program upgrade file in response to a program upgrade instruction after the chip is powered on, wherein the program upgrade instruction is at least one of an application program upgrade instruction and a bootloader upgrade instruction, and the program upgrade file is at least one of an application program upgrade file and a bootloader upgrade file.

[0050] Upgrade module 82 is used to copy the application from the second area to the third area through the bootloader to replace the backup application, and to burn the program upgrade file to the second area to perform program upgrade based on the program upgrade file.

[0051] Recovery module 83 is used to restore the application in the second zone based on the new backup application in the third zone when the program upgrade fails.

[0052] The chip to be upgraded can be a common TI series chip, whose memory is usually erasable memory, such as FLASH memory. To back up applications and prevent their loss, the chip memory can usually be divided into: a first area for storing the bootloader, a second area for storing the application, and a third area for storing backup applications.

[0053] In some optional embodiments of this application, the chip program upgrade device further includes a power-on detection module 84, which is used to detect whether the application in the second area is valid through the boot program when the chip is powered on; if the application is valid, the application is executed; if the application is invalid, the backup application in the third area is detected as valid; if the backup application is valid, the backup application is copied to the second area to replace the application and the new application is executed; if the backup application is invalid, the boot program is paused and the program upgrade instruction is awaited.

[0054] After the chip is powered on, the receiving module 81 can respond to the program upgrade command sent by the host computer, receive the corresponding program upgrade file, and then upgrade the program.

[0055] The program upgrade instruction can be either an application upgrade instruction or a bootloader upgrade instruction. Correspondingly, the received program upgrade file can be either an application upgrade file or a bootloader upgrade file. The application upgrade file includes at least: application file information, application code, and a file checksum. The application file information includes at least: file type, file size, file compilation date, application code checksum, and backup information. The bootloader upgrade file includes at least: a small transporter, bootloader file information, bootloader code, and a file checksum. The small transporter is used to transport the bootloader code to the first region. The bootloader file information includes at least: file type, file size, file compilation date, bootloader code checksum, and backup information.

[0056] When upgrading an application, the upgrade module 82 can erase the backup application in the third region through the bootloader and copy the application in the second region to the third region as a new backup application; erase the application in the second region and burn the application upgrade file to the second region to perform the application upgrade; when the upgrade is successful, execute the new application in the second region.

[0057] During the bootloader upgrade, the upgrade module 82 can erase the backup application in the third region and copy the application in the second region to the third region as a new backup application; erase the application in the second region and burn the bootloader upgrade file to the second region; execute the small transfer program in the bootloader upgrade file to perform the bootloader upgrade; when the upgrade is successful, restore the application in the second region based on the new backup application in the third region.

[0058] Specifically, when performing a small transfer program to upgrade the bootloader, the small transfer program can send an inquiry command to ask whether the bootloader code in the bootloader upgrade file needs to be transferred to the first area. In response to the transfer confirmation command, the small transfer program erases the bootloader in the first area and writes the bootloader code in the bootloader upgrade file into the first area as the new bootloader. If no transfer confirmation command is received within a preset time period, the small transfer program self-destructs.

[0059] Whether it is an application upgrade or a bootloader upgrade, if the upgrade fails, the recovery module 83 can re-execute the chip power-on process and restore the original application backed up in the third area to the second area, so as to avoid the chip becoming unusable due to application loss.

[0060] It should be noted that each module in the chip program upgrade device in this application embodiment corresponds one-to-one with each implementation step of the chip program upgrade method in embodiment 1. Since embodiment 1 has been described in detail, some details not shown in this embodiment can be referred to embodiment 1, and will not be elaborated further here.

[0061] Example 3

[0062] According to an embodiment of this application, a non-volatile storage medium is also provided, which includes a stored program, wherein, when the program is running, the device where the non-volatile storage medium is located is controlled to execute the chip program upgrade method in Embodiment 1.

[0063] Optionally, during program execution, the device containing the non-volatile storage medium is controlled to perform the following steps: in response to a program upgrade instruction, receiving a program upgrade file, wherein the program upgrade instruction is at least one of an application upgrade instruction and a bootloader upgrade instruction, and the program upgrade file is at least one of an application upgrade file and a bootloader upgrade file; copying the application in the second region to the third region to replace the backup application through the bootloader, and burning the program upgrade file to the second region, performing a program upgrade based on the program upgrade file; and restoring the application in the second region based on the new backup application in the third region if the program upgrade fails.

[0064] According to an embodiment of this application, an electronic chip is also provided, the electronic chip including: a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the chip program upgrade method of Embodiment 1 through the computer program.

[0065] Optionally, the processor is configured to execute the following steps via a computer program: in response to a program upgrade instruction, receiving a program upgrade file, wherein the program upgrade instruction is at least one of an application upgrade instruction and a bootloader upgrade instruction, and the program upgrade file is at least one of an application upgrade file and a bootloader upgrade file; copying the application in the second region to the third region to replace the backup application via the bootloader, and burning the program upgrade file to the second region, performing a program upgrade based on the program upgrade file; and restoring the application in the second region based on the new backup application in the third region if the program upgrade fails.

[0066] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0067] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0068] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some interfaces; indirect couplings or communication connections between units or modules may be electrical or other forms.

[0069] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0070] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0071] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.

[0072] The above are merely preferred embodiments of this application. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. A chip program upgrade method, characterized in that, The chip memory includes: a first area for storing the bootloader, a second area for storing applications, and a third area for storing backup applications. The method includes: In response to a program upgrade instruction, a program upgrade file is received, wherein the program upgrade instruction includes only a bootloader upgrade instruction, and the program upgrade file includes only a bootloader upgrade file; or, the program upgrade instruction includes both an application upgrade instruction and a bootloader upgrade instruction, and the program upgrade file includes both an application upgrade file and a bootloader upgrade file; the bootloader upgrade file includes at least: a small transport program, bootloader file information, bootloader code, and a file verification code, wherein the small transport program is used to transport the bootloader code to the first region, and the bootloader file information includes at least: file type, file size, file compilation date, verification code of the bootloader code, and backup information; The bootloader copies the application from the second region to the third region to replace the backup application, and burns the program upgrade file to the second region, performing a program upgrade based on the program upgrade file. In the event of a program upgrade failure, the application in the second region is restored based on the new backup application in the third region.

2. The method according to claim 1, characterized in that, Before receiving the program upgrade file in response to the program upgrade instruction, the method further includes: When the chip is powered on, the bootloader detects whether the application in the second area is valid; If the application is valid, execute the application; if the application is invalid, check whether the backup application in the third area is valid. If the backup application is valid, it is copied to the second region to replace the application, and the new application is executed. If the backup application is invalid, the process remains in the bootloader, waiting for the application upgrade instruction.

3. The method according to claim 1, characterized in that, The application upgrade file includes at least: application file information, application code, and file verification code, wherein the application file information includes at least: file type, file size, file compilation date, verification code of the application code, and backup information.

4. The method according to claim 3, characterized in that, When upgrading an application, the application in the second region is copied to the third region via the bootloader to replace the backup application, and the application upgrade file is burned to the second region. The application upgrade is then performed based on the application upgrade file, including: The bootloader erases the backup application in the third region and copies the application in the second region to the third region as a new backup application. Erase the application in the second area and burn the application upgrade file to the second area to upgrade the application. Upon successful upgrade, execute the new application in the second region.

5. The method according to claim 1, characterized in that, During the upgrade bootloader, the application in the second region is copied to the third region to replace the backup application, and the program upgrade file is burned to the second region. The program upgrade is then performed based on the program upgrade file, including: The bootloader erases the backup application in the third region and copies the application in the second region to the third region as a new backup application. Erase the application in the second region and burn the bootloader upgrade file to the second region; Execute the small transfer program in the bootloader upgrade file to perform a bootloader upgrade; Upon successful upgrade, the application in the second region is restored based on the new backup application in the third region.

6. The method according to claim 5, characterized in that, Execute the small transfer program in the bootloader upgrade file to perform a bootloader upgrade, including: The small transfer program sends an inquiry command to ask whether the bootloader code in the bootloader upgrade file needs to be transferred to the first region. In response to the transport confirmation command, the bootloader in the first area is erased by the small transport program, and the bootloader code in the bootloader upgrade file is written into the first area as a new bootloader; If the transport confirmation instruction is not received within the preset time period, the mini transport program will self-destruct.

7. A chip program upgrade device, characterized in that, The chip memory includes: a first area for storing the bootloader, a second area for storing applications, and a third area for storing backup applications; the device includes: A receiving module is configured to receive a program upgrade file in response to a program upgrade instruction after the chip is powered on. The program upgrade instruction includes only a bootloader upgrade instruction, and the program upgrade file includes only a bootloader upgrade file; or, the program upgrade instruction includes both an application program upgrade instruction and a bootloader upgrade instruction, and the program upgrade file includes both an application program upgrade file and a bootloader upgrade file. The bootloader upgrade file includes at least: a small transport program, bootloader file information, bootloader code, and a file verification code. The small transport program is used to transport the bootloader code to the first region. The bootloader file information includes at least: file type, file size, file compilation date, the verification code of the bootloader code, and backup information. The upgrade module is used to copy the application from the second region to the third region through the bootloader to replace the backup application, and to burn the program upgrade file to the second region, and to perform a program upgrade based on the program upgrade file; The recovery module is used to restore the application in the second region based on the new backup application in the third region when the program upgrade fails.

8. A non-volatile storage medium, characterized in that, The non-volatile storage medium includes a stored program, wherein, when the program is executed, the device containing the non-volatile storage medium is controlled to perform the chip program upgrade method according to any one of claims 1 to 6.

9. An electronic chip, characterized in that, include: A memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the chip program upgrade method according to any one of claims 1 to 6 via the computer program.

Citation Information

Patent Citations

  • Feeder terminal apparatus and application remote upgrading method thereof

    CN106406815A

  • Chip program upgrading method and device and storage medium

    CN111309364A