Program upgrading method, device and equipment and computer readable storage medium

By using the backup address to perform erasure, download and verification operations during the application update process, and replacing the data in the running address after the verification is successful, the low applicability caused by the inconsistent addresses of APP1 and APP2 in the existing technology is solved. It solves the problem of wrong brush location and achieves the reliability and applicability of application updates.

CN118796235APending Publication Date: 2024-10-18ZHIXIN CONTROL SYST CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411013713.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-26
Publication Date
2024-10-18

AI Technical Summary

Technical Problem

In the existing technology, the application update method requires the two APP projects to be compiled and linked separately due to the inconsistent running addresses of APP1 and APP2, which is not very practical and prone to problems such as incorrect flash locations and inability to run.

Method used

By determining the target object based on the validity of the first boot loader, the second boot loader and the application, and using the backup address during the application upgrade process to perform erasure, download and verification operations, and only replace it after the verification is successful. Data in the running address ensures that the upgrade process does not affect running applications.

Benefits of technology

It realizes application updates without affecting the running applications, avoids the situation of wrong flash location, and improves the reliability and applicability of application updates.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118796235A_ABST
    Figure CN118796235A_ABST
Patent Text Reader

Abstract

The invention discloses a program upgrading method, device and equipment and a computer readable storage medium. The method comprises the following steps: running a target object, wherein the target object is any one of a first boot loader, a second boot loader and an application program; if the to-be-updated object is an application program, a second boot loader is run, an application program upgrading process is executed, and addresses used when erasing operation, downloading operation and verification operation in the application program upgrading process are executed are shifted to backup addresses; if the result of the verification operation is that the verification is successful, replacing the data in the application program running address with the data in the backup address; and if the replacement is successful, running a new application program based on the data in the application program running address. According to the method and the device, the running application program cannot be influenced even if the execution of the upgrading process fails, and the condition of mistakenly refreshing the position can be prevented.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of single chip microcomputer technology, and in particular to a program upgrading method, device, equipment and computer readable storage medium. Background Art

[0002] In the prior art, the method of updating an application is generally as follows: sending an upgrade instruction to the MCU, the MCU enters the bootloader by resetting or jumping, the bootloader will not erase the data in the address 1 corresponding to the current APP (recorded as APP1), but writes the received upgrade data into the address 2 corresponding to the erased APP2, and when all the upgrade data are received and verified successfully, the APP1 valid flag is cleared, the APP2 valid flag is set, and the bootloader enters APP2 according to the valid flag. Similarly, when updating APP2, first erase the data in address 1, then write the received upgrade data into address 1, receive and convert the valid flag, and then run APP1.

[0003] The current method of updating applications is not very practical because the executable addresses of APP1 and APP2 are inconsistent. It requires two APP projects to be compiled and linked separately. In addition, if APP1 and APP2 are updated to the wrong locations, they will not be able to run. Summary of the invention

[0004] In order to solve the above technical problems, the present application provides a program upgrade method, device, equipment and computer-readable storage medium.

[0005] In a first aspect, an embodiment of the present application provides a program upgrade method, the program upgrade method comprising:

[0006] Determine a target object according to the validity of the first boot loader, the second boot loader and the application program, and run the target object, the target object being any one of the first boot loader, the second boot loader and the application program;

[0007] Determine the object to be updated according to the upgrade request flag;

[0008] If the object to be updated is an application, the second boot loader is run and the application upgrade process is performed, wherein the address used when performing the erase operation, download operation and verification operation in the application upgrade process is offset to the backup address;

[0009] If the result of the verification operation is that the verification is successful, the data in the application running address is replaced with the data in the backup address;

[0010] If the replacement is successful, the new application is run based on the data in the application running address.

[0011] In combination with the first aspect, in one implementation, the step of determining the target object according to the validity of the first boot loader, the second boot loader, and the application program includes:

[0012] Detect whether the second boot loader is valid;

[0013] If the second boot loader is invalid, determining the target object is the first boot loader;

[0014] If the second boot loader is valid, then checking whether the application is valid;

[0015] If the application is valid, then the target object is determined to be the application;

[0016] If the application is invalid, the target object is determined to be a second boot loader.

[0017] In combination with the first aspect, in one implementation, after the step of determining the object to be updated according to the upgrade request flag, the method further includes:

[0018] If the object to be updated is the second boot loader, the first boot loader is run, and the second boot loader upgrade process is performed;

[0019] If the second boot loader is successfully upgraded, the successfully upgraded second boot loader is run.

[0020] In combination with the first aspect, in one implementation, if the object to be updated is an application, an application upgrade process is executed, wherein after the step of offsetting the address used in the erase operation, download operation, and verification operation in the application upgrade process to the backup address, it also includes:

[0021] If the result of the verification operation is verification failure, the application is run.

[0022] In combination with the first aspect, in one implementation, after the step of replacing the data in the application running address with the data in the backup address if the result of the verification operation is that the verification is successful, the method further includes:

[0023] If the replacement fails, the process returns to the step of replacing the data in the application running address with the data in the backup address.

[0024] In a second aspect, an embodiment of the present application provides a program upgrade device, the program upgrade device comprising:

[0025] An operation module, used for determining a target object according to the validity of the first boot loader, the second boot loader and the application program, and operating the target object, the target object being any one of the first boot loader, the second boot loader and the application program;

[0026] A judgment module, used to judge the object to be updated according to the requested upgrade flag;

[0027] A first upgrade module is used for running a second boot loader and executing an application upgrade process if the object to be updated is an application, wherein the address used when performing an erase operation, a download operation, and a verification operation in the application upgrade process is offset to a backup address; if the result of the verification operation is that the verification is successful, replacing the data in the application running address with the data in the backup address;

[0028] The running module is also used to run the new application based on the data in the application running address if the replacement is successful.

[0029] In conjunction with the second aspect, in one implementation, the operation module is used to:

[0030] Detect whether the second boot loader is valid;

[0031] If the second boot loader is invalid, determining the target object is the first boot loader;

[0032] If the second boot loader is valid, then checking whether the application is valid;

[0033] If the application is valid, then the target object is determined to be the application;

[0034] If the application is invalid, the target object is determined to be a second boot loader.

[0035] In conjunction with the second aspect, in one implementation, the program upgrade device further includes a second upgrade module, which is used to:

[0036] If the object to be updated is the second boot loader, the first boot loader is run, and the second boot loader upgrade process is performed;

[0037] If the second boot loader is successfully upgraded, the successfully upgraded second boot loader is run.

[0038] In conjunction with the second aspect, in one implementation, the operation module is further configured to:

[0039] If the result of the verification operation is verification failure, the application is run.

[0040] In conjunction with the second aspect, in one implementation, the program upgrade device further includes a jump module, which is used to:

[0041] If the replacement fails, the process returns to the step of replacing the data in the application running address with the data in the backup address.

[0042] In a third aspect, an embodiment of the present application provides a program upgrade device, comprising a processor, a memory, and a program upgrade program stored in the memory and executable by the processor, wherein when the program upgrade program is executed by the processor, the steps of the program upgrade method described in the first aspect are implemented.

[0043] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a program upgrade program is stored, wherein when the program upgrade program is executed by a processor, the steps of the program upgrade method described in the first aspect are implemented.

[0044] The beneficial effects brought by the technical solution provided in the embodiments of the present application include:

[0045] In the embodiment of the present application, the target object is determined according to the validity of the first boot loader, the second boot loader and the application, and the target object is run, and the target object is any one of the first boot loader, the second boot loader and the application; the object to be updated is determined according to the request upgrade flag; if the object to be updated is the application, the second boot loader is run and the application upgrade process is executed, wherein the address used when performing the erase operation, download operation and verification operation in the application upgrade process is offset to the backup address; if the result of the verification operation is that the verification is successful, the data in the application running address is replaced with the data in the backup address; if the replacement is successful, the new application is run based on the data in the application running address. Through the embodiment of the present application, in the process of updating the application, the backup address is used for the erase operation, download operation and verification operation. Because the backup address does not overlap with the address segment corresponding to the running application, even if an abnormal situation occurs and the upgrade process fails to execute, it will not affect the running application, and only when the verification is successful will the data in the backup address replace the data in the application running address, which can prevent the wrong flash position. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] Figure 1 This is a flow chart of an embodiment of the application program upgrade method;

[0047] Figure 2 This is a functional module diagram of an embodiment of the application program upgrade device;

[0048] Figure 3 This is a schematic diagram of the hardware structure of the program upgrade device involved in the embodiment of the present application. DETAILED DESCRIPTION

[0049] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0050] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.

[0051] In a first aspect, an embodiment of the present application provides a program upgrade method.

[0052] In one embodiment, referring to Figure 1 , Figure 1 This is a flow chart of an embodiment of the application program upgrade method. Figure 1 As shown, the program upgrade method includes:

[0053] Step S10, determining a target object according to the validity of the first boot loader, the second boot loader and the application, and running the target object, the target object being any one of the first boot loader, the second boot loader and the application;

[0054] In this embodiment, the program segment to be jumped to after power-on is determined by the status of each program in the MCU, thereby ensuring that the program in the MCU can run normally under abnormal conditions.

[0055] Furthermore, in one embodiment, the step of determining the target object according to the validity of the first boot loader, the second boot loader, and the application program includes:

[0056] Detect whether the second boot loader is valid; if the second boot loader is invalid, determine the target object to be the first boot loader; if the second boot loader is valid, detect whether the application is valid; if the application is valid, determine the target object to be the application; if the application is invalid, determine the target object to be the second boot loader.

[0057] In this embodiment, the BOOT valid flag and the BOOT upgrade success flag are used to determine whether the second boot loader is valid at this time. Among them, the BOOT valid flag is updated when the data is transmitted and written to the specified PLASH address. This flag is used to indicate whether the downloaded data is written successfully. Specifically, it is detected whether the data at the head and tail of the Code Flash address after the upgrade is completed is consistent with the data at the head and tail in the hex output after the code is compiled. The BOOT upgrade success flag is updated at the end of the upgrade process, that is, after the data dependency is successfully verified. This flag is used to indicate whether the written data is correct. Specifically, it is compared whether the CRC value of the hex file calculated by the CRC32 algorithm when transmitting data is consistent with the CRC value of the corresponding data written in CodeFlash.

[0058] The validity of the application is determined based on the APP valid flag and the APP upgrade success flag. The APP valid flag is updated when data is transmitted and written to the specified PLASH address. This flag is used to indicate whether the downloaded data is written successfully. The APP upgrade success flag is updated at the end of the upgrade process: after the data dependency is successfully verified. This flag is used to detect whether the written data is correct.

[0059] The condition for jumping from the first boot loader to the application is that the second boot loader and the application are both valid. If both are valid, the application is jumped to; if the application is invalid, it is considered that the application needs to be upgraded, so it stays in the second boot loader. Similarly, if the second boot loader is invalid, it is considered that the second boot loader needs to be updated, so it stays in the first boot loader.

[0060] The first boot loader is an original boot loader, and the second boot loader is a boot loader that needs to be upgraded through the first boot loader.

[0061] Step S20, determining the object to be updated according to the upgrade request flag;

[0062] In this embodiment, the object to be updated is one of the application and the second boot loader, and the request upgrade flags written when requesting to upgrade the second boot loader and requesting to upgrade the application are different. Based on the current request upgrade flag, it can be determined whether the object to be updated is the application or the second boot loader.

[0063] Furthermore, in one embodiment, after step S30, the method further includes:

[0064] If the object to be updated is the second boot loader, the first boot loader is run, and the second boot loader upgrade process is performed; if the second boot loader is successfully upgraded, the successfully upgraded second boot loader is run.

[0065] In this embodiment, if the object to be updated is the second boot loader, the first boot loader is run, and the second boot loader upgrade process is executed. The second boot loader upgrade process may specifically be:

[0066] The data in the second boot loader running address is erased, and then the upgrade package of the second boot loader is downloaded to the second boot loader running address. After the download is completed, the upgrade package of the second boot loader in the second boot loader running address is verified. If the verification is successful, it indicates that the second boot loader is successfully upgraded, and the second boot loader that is successfully upgraded can be run based on the upgrade package of the second boot loader in the second boot loader running address. It should be noted that this is a description of the upgrade process of the second boot loader by full update. Of course, the second boot loader can also be upgraded by incremental update.

[0067] Among them, based on the object to be updated, a preset routine service instruction is sent to the MCU, and after the MCU successfully receives the preset routine service instruction, the request upgrade flag corresponding to the object to be updated is written, so that when resetting, the request upgrade flag is used to determine whether the object to be updated is a second boot program or an application program. That is, the preset routine service instruction is sent first, and the object to be updated is determined later according to the request upgrade flag.

[0068] For example, if the current upgrade request flag corresponds to an application program, then the object to be updated is determined to be the application program; similarly, if the current upgrade request flag corresponds to a second boot loader program, then the object to be updated is determined to be the second boot loader program.

[0069] Step S30, if the object to be updated is an application, the second boot loader is run and the application upgrade process is performed, wherein the address used when performing the erase operation, download operation and verification operation in the application upgrade process is offset to the backup address;

[0070] In this embodiment, if the object to be updated is an application, the second boot loader is run and the application upgrade process is executed. There is no special processing for the steps before erasing the application in the application upgrade process, and the existing application upgrade process is referred to. However, there are differences from the prior art when performing the erasing operation, downloading operation and verification operation. Specifically, when erasing the application, downloading data and verifying the application data, the address used is offset to the backup address to ensure that the data of the current application is not destroyed, so that it can be rolled back to the current application when the upgrade process fails.

[0071] Step S40, if the result of the verification operation is that the verification is successful, the data in the application running address is replaced with the data in the backup address;

[0072] In this embodiment, when verifying the application data in the last step of the programming stage, the data in the backup address is verified, and whether to update the data in the application running address is determined based on whether the verification result is successful. If the verification is successful, the data in the application running address is updated, that is, the data in the application running address is replaced with the data in the backup address. Specifically, during the ECU reset process in the post-programming stage, the data in the application running address is first erased, and then the data in the backup address is moved to the application running address, and then the reset action is performed.

[0073] Furthermore, in one embodiment, after step S30, the method further includes:

[0074] If the result of the verification operation is verification failure, the application is run.

[0075] In this embodiment, if the result of the verification operation is a verification failure, it means that the data downloaded to the backup address at this time is incorrect, and the application is run after the preset time expires, and the upgrade process returns to running the application.

[0076] Step S50: If the replacement is successful, the new application is run based on the data in the application running address.

[0077] In this embodiment, the APP update flag and the transfer success flag are used to determine whether the replacement is successful at this time. Among them, the APP update flag and the transfer success flag are updated after the data in the backup address is successfully transferred to the application running address.

[0078] Furthermore, in one embodiment, after step S40, the method further includes:

[0079] If the replacement fails, the process returns to the step of replacing the data in the application running address with the data in the backup address.

[0080] In this embodiment, if it is determined that the replacement has failed at this time based on the APP update flag and the transfer success flag, the step of replacing the data in the application running address with the data in the backup address is re-executed, that is, the data in the application running address is erased again, and then the data in the backup address is transferred to the application running address until the replacement is successful.

[0081] In the embodiment of the present application, the target object is determined according to the validity of the first boot loader, the second boot loader and the application, and the target object is run, and the target object is any one of the first boot loader, the second boot loader and the application; the object to be updated is determined according to the request upgrade flag; if the object to be updated is the application, the second boot loader is run and the application upgrade process is executed, wherein the address used when performing the erase operation, download operation and verification operation in the application upgrade process is offset to the backup address; if the result of the verification operation is that the verification is successful, the data in the application running address is replaced with the data in the backup address; if the replacement is successful, the new application is run based on the data in the application running address. Through the embodiment of the present application, in the process of updating the application, the backup address is used for the erase operation, download operation and verification operation. Because the backup address does not overlap with the address segment corresponding to the running application, even if an abnormal situation occurs and the upgrade process fails to execute, it will not affect the running application, and only when the verification is successful will the data in the backup address replace the data in the application running address, which can prevent the wrong flash position.

[0082] In a second aspect, an embodiment of the present application also provides a program upgrading device.

[0083] In one embodiment, referring to Figure 2 , Figure 2 This is a functional module diagram of an embodiment of the application program upgrade device. Figure 2 As shown, the program upgrading device comprises:

[0084] An operating module 10 is used to determine a target object according to the validity of the first boot loader, the second boot loader and the application program, and to operate the target object, where the target object is any one of the first boot loader, the second boot loader and the application program;

[0085] A determination module 20, used to determine the object to be updated according to the upgrade request flag;

[0086] The first upgrade module 30 is used to run the second boot loader and perform the application upgrade process if the object to be updated is an application, wherein the address used when performing the erase operation, download operation and verification operation in the application upgrade process is offset to the backup address; if the result of the verification operation is that the verification is successful, the data in the application running address is replaced by the data in the backup address;

[0087] The running module 10 is also used to run the new application based on the data in the application running address if the replacement is successful.

[0088] Furthermore, in one embodiment, the operation module 10 is used to:

[0089] Detect whether the second boot loader is valid;

[0090] If the second boot loader is invalid, determining the target object is the first boot loader;

[0091] If the second boot loader is valid, then checking whether the application is valid;

[0092] If the application is valid, then the target object is determined to be the application;

[0093] If the application is invalid, the target object is determined to be a second boot loader.

[0094] Furthermore, in one embodiment, the program upgrade device further includes a second upgrade module, which is used to:

[0095] If the object to be updated is the second boot loader, the first boot loader is run, and the second boot loader upgrade process is performed;

[0096] If the second boot loader is successfully upgraded, the successfully upgraded second boot loader is run.

[0097] Furthermore, in one embodiment, the operation module 10 is further used to:

[0098] If the result of the verification operation is verification failure, the application is run.

[0099] Furthermore, in one embodiment, the program upgrade device further includes a jump module, which is used to:

[0100] If the replacement fails, the process returns to the step of replacing the data in the application running address with the data in the backup address.

[0101] Among them, the functional implementation of each module in the above-mentioned program upgrading device corresponds to each step in the above-mentioned program upgrading method embodiment, and its functions and implementation processes are no longer repeated here.

[0102] In a third aspect, an embodiment of the present application provides a program upgrading device.

[0103] Reference Figure 3 , Figure 3 Schematic diagram of the hardware structure of the program upgrade device involved in the embodiment of the present application. In the embodiment of the present application, the program upgrade device may include a processor, a memory, a communication interface and a communication bus.

[0104] The communication bus may be of any type and is used to interconnect the processor, the memory, and the communication interface.

[0105] The communication interface includes input / output (I / O) interfaces, physical interfaces, and logical interfaces, which are used to interconnect the devices inside the program upgrade device, and interfaces used to interconnect the program upgrade device with other devices (such as other computing devices or user devices). The physical interface can be an Ethernet interface, a fiber optic interface, an ATM interface, etc.; the user device can be a display, a keyboard, etc.

[0106] The memory can be various types of storage media, such as random access memory (RAM), read-only memory (ROM), non-volatile RAM (NVRAM), flash memory, optical storage, hard disk, programmable ROM (PROM), erasable PROM (EPROM), electrically erasable PROM (EEPROM), etc.

[0107] The processor may be a general-purpose processor, and the general-purpose processor may call the program upgrade program stored in the memory and execute the program upgrade method provided in the embodiment of the present application. For example, the general-purpose processor may be a central processing unit (CPU). The method executed when the program upgrade program is called may refer to the various embodiments of the program upgrade method of the present application, and will not be repeated here.

[0108] Those skilled in the art will understand that Figure 3 The hardware structure shown in the figure does not constitute a limitation on the present application, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.

[0109] In a fourth aspect, an embodiment of the present application also provides a computer-readable storage medium.

[0110] The computer-readable storage medium of the present application stores a program upgrade program, wherein when the program upgrade program is executed by a processor, the steps of the program upgrade method described above are implemented.

[0111] Among them, the method implemented when the program upgrade program is executed can refer to the various embodiments of the program upgrade method of this application, and will not be repeated here.

[0112] It should be noted that the serial numbers of the above-mentioned embodiments of the present application are only for description and do not represent the advantages or disadvantages of the embodiments.

[0113] The terms "including" and "having" and any variations thereof in the specification and claims of this application and the above-mentioned drawings are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices. The terms "first", "second" and "third" are used to distinguish different objects, etc., and do not represent a sequence, nor do they limit "first", "second" and "third" to different types.

[0114] In the description of the embodiments of the present application, "exemplary", "for example" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary", "for example" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary", "for example" or "for example" is intended to present related concepts in a specific way.

[0115] In the description of the embodiments of the present application, unless otherwise specified, “ / ” means or, for example, A / B can mean A or B; the “and / or” in the text is merely a description of the association relationship of associated objects, indicating that three relationships may exist, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, “multiple” refers to two or more than two.

[0116] In some processes described in the embodiments of the present application, multiple operations or steps that appear in a specific order are included, but it should be understood that these operations or steps may not be executed in the order in which they appear in the embodiments of the present application or in parallel, and the sequence number of the operation is only used to distinguish the different operations, and the sequence number itself does not represent any execution order. In addition, these processes may include more or fewer operations, and these operations or steps may be executed in sequence or in parallel, and these operations or steps may be combined.

[0117] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, disk, CD) as described above, and includes a number of instructions for a terminal device to execute the methods described in each embodiment of the present application.

[0118] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A program upgrade method, characterized in that: The program upgrade method comprises: Determine a target object according to the validity of the first boot loader, the second boot loader and the application program, and run the target object, the target object being any one of the first boot loader, the second boot loader and the application program; Determine the object to be updated according to the upgrade request flag; If the object to be updated is an application, the second boot loader is run and the application upgrade process is performed, wherein the address used when performing the erase operation, download operation and verification operation in the application upgrade process is offset to the backup address; If the result of the verification operation is that the verification is successful, the data in the application running address is replaced with the data in the backup address; If the replacement is successful, the new application is run based on the data in the application running address.

2. The program upgrade method according to claim 1, characterized in that: The step of determining the target object according to the validity of the first boot loader, the second boot loader and the application program comprises: Detect whether the second boot loader is valid; If the second boot loader is invalid, determining the target object is the first boot loader; If the second boot loader is valid, then checking whether the application is valid; If the application is valid, then the target object is determined to be the application; If the application is invalid, the target object is determined to be a second boot loader.

3. The program upgrade method according to claim 1, characterized in that: After the step of determining the object to be updated according to the upgrade request flag, the method further includes: If the object to be updated is the second boot loader, the first boot loader is run, and the second boot loader upgrade process is performed; If the second boot loader is successfully upgraded, the successfully upgraded second boot loader is run.

4. The program upgrade method according to claim 1, characterized in that: If the object to be updated is an application, the application upgrade process is executed, wherein after the step of shifting the address used in the erasing operation, the download operation and the verification operation in the application upgrade process to the backup address, the method further includes: If the result of the verification operation is verification failure, the application is run.

5. The program upgrade method according to claim 1, characterized in that: After the step of replacing the data in the application running address with the data in the backup address if the result of the verification operation is that the verification is successful, the method further includes: If the replacement fails, the process returns to the step of replacing the data in the application running address with the data in the backup address.

6. A program upgrade device, characterized in that: The program upgrading device comprises: An operation module, used for determining a target object according to the validity of the first boot loader, the second boot loader and the application program, and operating the target object, the target object being any one of the first boot loader, the second boot loader and the application program; A judgment module, used to judge the object to be updated according to the requested upgrade flag; A first upgrade module is used for running a second boot loader and executing an application upgrade process if the object to be updated is an application, wherein the address used when performing an erase operation, a download operation, and a verification operation in the application upgrade process is offset to a backup address; if the result of the verification operation is that the verification is successful, replacing the data in the application running address with the data in the backup address; The running module is also used to run the new application based on the data in the application running address if the replacement is successful.

7. The program upgrade device according to claim 6, characterized in that: Run modules for: Detect whether the second boot loader is valid; If the second boot loader is invalid, determining the target object is the first boot loader; If the second boot loader is valid, then checking whether the application is valid; If the application is valid, then the target object is determined to be the application; If the application is invalid, the target object is determined to be a second boot loader.

8. The program upgrade device according to claim 6, characterized in that: The program upgrade device also includes a second upgrade module, which is used to: If the object to be updated is the second boot loader, the first boot loader is run, and the second boot loader upgrade process is performed; If the second boot loader is successfully upgraded, the successfully upgraded second boot loader is run.

9. A program upgrade device, characterized in that: The program upgrade device includes a processor, a memory, and a program upgrade program stored in the memory and executable by the processor, wherein when the program upgrade program is executed by the processor, the steps of the program upgrade method according to any one of claims 1 to 5 are implemented.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a program upgrade program, wherein when the program upgrade program is executed by the processor, the steps of the program upgrade method according to any one of claims 1 to 5 are implemented.