Electronic equipment program mistake-proofing upgrading method and system

By splitting the program upgrade package and setting the sequence code and hash value in the subcontract, the legality and integrity verification of the upgrade of electronic device programs is solved, and the problem of equipment damage caused by upgrade errors in the existing technology is solved, and the reliability of the upgrade is improved.

CN119861951APending Publication Date: 2025-04-22FUJIAN NEBULA ELECTRONICS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411689241.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-25
Publication Date
2025-04-22

AI Technical Summary

Technical Problem

The existing electronic device program upgrade methods lack unified standards on different platforms and chips, which can easily lead to cross-sie writing errors, resulting in loss or damage to the equipment functions, and traditional methods have problems such as large workload and risks that cannot be completely avoided.

Method used

By splitting the program upgrade package into several program subcontracts, setting the start sequence code in the first subcontract and setting the end sequence code in the last subcontract, hash calculation and verification for each subcontract, and preset the sequence code into the MCU's BootLoder program to realize the legality and integrity verification of the program subcontract.

Benefits of technology

It effectively avoids the loss or damage to equipment functions caused by upgrade errors, improves the reliability of electronic device program upgrades, reduces workload and reduces risks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119861951A_ABST
    Figure CN119861951A_ABST
Patent Text Reader

Abstract

The invention provides an electronic equipment program mistake-proofing upgrading method and system in the technical field of electronic equipment upgrading management, and the method comprises the steps: S1, splitting a program upgrading package into a plurality of program sub-packages, setting a starting sequence code in the first program sub-package, setting an ending sequence code in the last program sub-package, performing Hash calculation on each program sub-package to obtain a Hash value, adding the Hash value to the tail of each program sub-package, and presetting the starting sequence code and the ending sequence code into a BootLoder program of an MCU (Microprogrammed Control Unit); s2, sending an upgrading instruction to an MCU (Microprogrammed Control Unit) of the electronic equipment, and switching a currently running application from an APP (Application) program to a BootLoder program by the MCU based on the upgrading instruction; step S3, the BootLoder program obtains each program sub-package, verifies each program sub-package and stores the program sub-package to the FLASH; and step S4, the BootLoder program splices the program sub-packages stored in the FLASH into a program upgrade package so as to execute an upgrade operation. The method has the advantage that the program upgrading reliability of the electronic equipment is greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of electronic equipment upgrade management, and in particular to an electronic equipment program error-proof upgrade method and system. Background Art

[0002] With the advancement of technology, there are more and more types of electronic devices and their functions are becoming more and more complex. While electronic device developers are constantly improving functions, they also need to fix corresponding bugs, so they need to upgrade the programs (APPs) of electronic devices.

[0003] For the upgrade of electronic device programs, the boot that is solidified inside the chip by the original factory is traditionally used to upgrade the program (i.e., ISP upgrade). However, the upgrade protocols and methods of each chip manufacturer vary greatly, and there is no unified standard, making it difficult to achieve a unified upgrade platform. Later, the IAP upgrade method gradually became the mainstream. Since it is completely customizable, it can be used on different platforms and chips, easily realizing the platformization of program upgrades. Due to the platform design, when upgrading programs of different electronic devices or different series of the same electronic device, it is easy for the burning files to be confused and cross-burned, resulting in partial or complete unusable functions of the electronic device. In severe cases, the electronic device may be damaged. To avoid the above problems, although the error probability can be reduced through the control of APP burning files, there are still disadvantages such as large workload and the risk that cannot be completely avoided.

[0004] Therefore, how to provide a method and system for error-proof upgrading of electronic device programs to improve the reliability of upgrading electronic device programs has become a technical problem that needs to be solved urgently. Summary of the invention

[0005] The technical problem to be solved by the present invention is to provide a method and system for error-proofing the program upgrade of an electronic device, so as to improve the reliability of the program upgrade of the electronic device.

[0006] In a first aspect, the present invention provides a method for error-proofing an electronic device program upgrade, comprising the following steps:

[0007] Step S1, split the program upgrade package into several program sub-packages, set a start sequence code in the first program sub-package, set an end sequence code in the last program sub-package, perform hash calculation on each program sub-package to obtain a hash value, add the hash value to the end of each program sub-package, and preset the start sequence code and the end sequence code into the BootLoder program of the MCU;

[0008] Step S2: sending an upgrade instruction to the MCU of the electronic device, and the MCU switches the currently running application from the APP program to the BootLoder program based on the upgrade instruction;

[0009] Step S3, the BootLoder program obtains each program sub-package, verifies each program sub-package and stores it in FLASH;

[0010] Step S4, the BootLoder program combines the program subpackages stored in the FLASH into a program upgrade package to perform an upgrade operation, and switches to the APP program after the upgrade is completed.

[0011] Furthermore, the step S1 is specifically as follows:

[0012] The program upgrade package is split into several program subpackages, and each of the program subpackages is numbered in sequence. Based on the numbers, a starting sequence code is set in the first program subpackage, and an ending sequence code is set in the last program subpackage. Hash calculations are performed on each of the program subpackages to obtain hash values, and each hash value is added to the end of the corresponding program subpackage. The starting sequence code and the ending sequence code are preset in the BootLoder program of the MCU.

[0013] Furthermore, the step S2 is specifically as follows:

[0014] An upgrade instruction carrying a URL address for downloading the program sub-package is sent to the MCU of the electronic device, and the MCU switches the currently running application from the APP program to the BootLoder program in real time based on the upgrade instruction.

[0015] Furthermore, the step S3 is specifically as follows:

[0016] The BootLoder program sequentially obtains each program sub-package based on the URL address carried by the upgrade instruction, performs integrity check on the first program sub-package based on the hash value, performs legality check on the first program sub-package based on the preset starting sequence code, and then stores the verified first program sub-package to a designated location of the FLASH;

[0017] Then, after performing integrity check on each program sub-package in sequence based on the hash value, each of the program sub-packages is stored in a designated location of the FLASH;

[0018] After the integrity check is performed on the last program subpackage based on the hash value, the legality check is performed on the last program subpackage based on the preset end sequence code, and then the checked last program subpackage is stored in a designated location of the FLASH.

[0019] Furthermore, the step S4 is specifically as follows:

[0020] The BootLoder program combines the program subpackages stored in the FLASH into a program upgrade package based on the numbering sequence, and performs an upgrade operation on the APP program based on the program upgrade package; after the upgrade is completed, the MCU switches the currently running application from the BootLoder program to the APP program.

[0021] In a second aspect, the present invention provides an electronic device program error-proofing upgrade system, comprising the following modules:

[0022] An upgrade package sub-packaging module is used to split the program upgrade package into several program sub-packages, set a start sequence code in the first program sub-package, set an end sequence code in the last program sub-package, perform hash calculation on each program sub-package to obtain a hash value, add the hash value to the end of each program sub-package, and preset the start sequence code and the end sequence code into the BootLoder program of the MCU;

[0023] The application switching module is used to send an upgrade instruction to the MCU of the electronic device, and the MCU switches the currently running application from the APP program to the BootLoder program based on the upgrade instruction;

[0024] A program sub-package verification storage module is used for the BootLoder program to obtain each program sub-package, verify each program sub-package and store it in FLASH;

[0025] The program upgrade module is used for the BootLoder program to splice the program subpackages stored in the FLASH into a program upgrade package to perform the upgrade operation, and switch to the APP program after the upgrade is completed.

[0026] Furthermore, the upgrade package sub-packaging module is specifically used for:

[0027] The program upgrade package is split into several program subpackages, and each of the program subpackages is numbered in sequence. Based on the numbers, a starting sequence code is set in the first program subpackage, and an ending sequence code is set in the last program subpackage. Hash calculations are performed on each of the program subpackages to obtain hash values, and each hash value is added to the end of the corresponding program subpackage. The starting sequence code and the ending sequence code are preset in the BootLoder program of the MCU.

[0028] Furthermore, the application switching module is specifically used for:

[0029] An upgrade instruction carrying a URL address for downloading the program sub-package is sent to the MCU of the electronic device, and the MCU switches the currently running application from the APP program to the BootLoder program in real time based on the upgrade instruction.

[0030] Furthermore, the program sub-packaging verification storage module is specifically used for:

[0031] The BootLoder program sequentially obtains each program sub-package based on the URL address carried by the upgrade instruction, performs integrity check on the first program sub-package based on the hash value, performs legality check on the first program sub-package based on the preset starting sequence code, and then stores the verified first program sub-package to a designated location of the FLASH;

[0032] Then, after performing integrity check on each program sub-package in sequence based on the hash value, each of the program sub-packages is stored in a designated location of the FLASH;

[0033] After the integrity check is performed on the last program subpackage based on the hash value, the legality check is performed on the last program subpackage based on the preset end sequence code, and then the checked last program subpackage is stored in a designated location of the FLASH.

[0034] Furthermore, the program upgrade module is specifically used for:

[0035] The BootLoder program combines the program subpackages stored in the FLASH into a program upgrade package based on the numbering sequence, and performs an upgrade operation on the APP program based on the program upgrade package; after the upgrade is completed, the MCU switches the currently running application from the BootLoder program to the APP program.

[0036] The advantages of the present invention are:

[0037] The program upgrade package is split into several program subpackages, a start sequence code is set in the first program subpackage, an end sequence code is set in the last program subpackage, a hash calculation is performed on each program subpackage to obtain a hash value and added to the end of each program subpackage, and the start sequence code and the end sequence code are preset in the BootLoder program of the MCU; then an upgrade instruction is sent to the MCU of the electronic device, and the MCU switches the currently running application from the APP program to the BootLoder program based on the upgrade instruction. The BootLoder program obtains each program subpackage, verifies each program subpackage and stores it in FLASH, and the BootLoder program stores the FLASH in the FLASH. The stored program subpackages are spliced ​​into a program upgrade package to perform the upgrade operation, and the APP program is switched after the upgrade is completed; since the start sequence code and the end sequence code are respectively set for the first program subpackage and the last program subpackage for anti-mistake, and the start sequence code and the end sequence code are preset in the BootLoder program, during the upgrade process, the BootLoder program can verify the legitimacy of the program subpackage based on the start sequence code and the end sequence code, and also perform integrity verification in combination with the hash value carried by the program subpackage, so as to avoid the APP program from causing the electronic device to be unable to be used normally or even damaged due to upgrade errors, thereby greatly improving the reliability of electronic device program upgrades. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] The present invention will be further described below in conjunction with embodiments with reference to the accompanying drawings.

[0039] Figure 1 The present invention is a flowchart of an electronic equipment program error-proof upgrade method.

[0040] Figure 2 The present invention is a structural diagram of an electronic equipment program error-proofing upgrade system. DETAILED DESCRIPTION

[0041] The technical solution in the embodiments of the present application has the following overall idea: a start sequence code and an end sequence code are respectively set for the first program subpackage and the last program subpackage for anti-mistakes, and the start sequence code and the end sequence code are preset in the BootLoder program. During the upgrade process, the BootLoder program verifies the legitimacy of the program subpackage based on the start sequence code and the end sequence code, and performs integrity verification in combination with the hash value carried by the program subpackage, so as to improve the reliability of the program upgrade of the electronic device.

[0042] Please refer to Figure 1 to Figure 2 As shown, a preferred embodiment of a method for error-proofing an electronic device program upgrade of the present invention comprises the following steps:

[0043] Step S1, split the program upgrade package into several program sub-packages, set a start sequence code in the first program sub-package, set an end sequence code in the last program sub-package, perform hash calculation on each program sub-package to obtain a hash value, add the hash value to the end of each program sub-package, and preset the start sequence code and the end sequence code into the BootLoder program of the MCU;

[0044] Step S2, sending an upgrade instruction to the MCU of the electronic device, and the MCU switches the currently running application from the APP program to the BootLoder program based on the upgrade instruction; the APP program is used to implement the corresponding application function and the jump of the BootLoder program; the BootLoder program is used to upgrade the APP program;

[0045] Step S3, the BootLoder program obtains each program sub-package, verifies each program sub-package and stores it in FLASH;

[0046] Step S4, the BootLoder program combines the program subpackages stored in the FLASH into a program upgrade package to perform an upgrade operation, and switches to the APP program after the upgrade is completed.

[0047] The step S1 is specifically as follows:

[0048] The program upgrade package is split into several program subpackages, and each of the program subpackages is numbered in sequence. Based on the numbers, a starting sequence code is set in the first program subpackage, and an ending sequence code is set in the last program subpackage. Hash calculations are performed on each of the program subpackages to obtain hash values, and each hash value is added to the end of the corresponding program subpackage. The starting sequence code and the ending sequence code are preset in the BootLoder program of the MCU.

[0049] The step S2 is specifically as follows:

[0050] An upgrade instruction carrying the URL address for downloading the program package is sent to the MCU of the electronic device through the RS485 interface, RS232 interface, CAN interface, SPI interface, Ethernet, Bluetooth or Wi Fi, and the MCU switches the currently running application from the APP program to the BootLoder program in real time based on the upgrade instruction.

[0051] The step S3 is specifically as follows:

[0052] The BootLoder program sequentially obtains each program sub-package based on the URL address carried by the upgrade instruction, performs integrity check on the first program sub-package based on the hash value, performs legality check on the first program sub-package based on the preset starting sequence code, and then stores the verified first program sub-package to a designated location of the FLASH;

[0053] Then, after performing integrity check on each program sub-package in sequence based on the hash value, each of the program sub-packages is stored in a designated location of the FLASH;

[0054] After the integrity check of the last program subpackage is performed based on the hash value, the legality check of the last program subpackage is performed based on the preset end sequence code, and then the last program subpackage after the check is stored in the specified location of FLASH. When the check fails, an error message is returned for prompting. By sequentially storing in the specified location of FLASH, each program subpackage can also be further checked based on the storage order.

[0055] The step S4 is specifically as follows:

[0056] The BootLoder program combines the program subpackages stored in the FLASH into a program upgrade package based on the numbering sequence, and performs an upgrade operation on the APP program based on the program upgrade package; after the upgrade is completed, the MCU switches the currently running application from the BootLoder program to the APP program.

[0057] A preferred embodiment of an electronic device program error-proofing upgrade system of the present invention includes the following modules:

[0058] An upgrade package sub-packaging module is used to split the program upgrade package into several program sub-packages, set a start sequence code in the first program sub-package, set an end sequence code in the last program sub-package, perform hash calculation on each program sub-package to obtain a hash value, add the hash value to the end of each program sub-package, and preset the start sequence code and the end sequence code into the BootLoder program of the MCU;

[0059] An application switching module, used to send an upgrade instruction to the MCU of the electronic device, and the MCU switches the currently running application from the APP program to the BootLoder program based on the upgrade instruction; the APP program is used to implement the corresponding application function and the jump of the BootLoder program; the BootLoder program is used to upgrade the APP program;

[0060] A program sub-package verification storage module is used for the BootLoder program to obtain each program sub-package, verify each program sub-package and store it in FLASH;

[0061] The program upgrade module is used for the BootLoder program to splice the program subpackages stored in the FLASH into a program upgrade package to perform the upgrade operation, and switch to the APP program after the upgrade is completed.

[0062] The upgrade package sub-packaging module is specifically used for:

[0063] The program upgrade package is split into several program subpackages, and each of the program subpackages is numbered in sequence. Based on the numbers, a starting sequence code is set in the first program subpackage, and an ending sequence code is set in the last program subpackage. Hash calculations are performed on each of the program subpackages to obtain hash values, and each hash value is added to the end of the corresponding program subpackage. The starting sequence code and the ending sequence code are preset in the BootLoder program of the MCU.

[0064] The application switching module is specifically used for:

[0065] An upgrade instruction carrying the URL address for downloading the program package is sent to the MCU of the electronic device through the RS485 interface, RS232 interface, CAN interface, SPI interface, Ethernet, Bluetooth or Wi Fi, and the MCU switches the currently running application from the APP program to the BootLoder program in real time based on the upgrade instruction.

[0066] The program sub-packaging verification storage module is specifically used for:

[0067] The BootLoder program sequentially obtains each program sub-package based on the URL address carried by the upgrade instruction, performs integrity check on the first program sub-package based on the hash value, performs legality check on the first program sub-package based on the preset starting sequence code, and then stores the verified first program sub-package to a designated location of the FLASH;

[0068] Then, after performing integrity check on each program sub-package in sequence based on the hash value, each of the program sub-packages is stored in a designated location of the FLASH;

[0069] After the integrity check of the last program subpackage is performed based on the hash value, the legality check of the last program subpackage is performed based on the preset end sequence code, and then the last program subpackage after the check is stored in the specified location of FLASH. When the check fails, an error message is returned for prompting. By sequentially storing in the specified location of FLASH, each program subpackage can also be further checked based on the storage order.

[0070] The program upgrade module is specifically used for:

[0071] The BootLoder program combines the program subpackages stored in the FLASH into a program upgrade package based on the numbering sequence, and performs an upgrade operation on the APP program based on the program upgrade package; after the upgrade is completed, the MCU switches the currently running application from the BootLoder program to the APP program.

[0072] In summary, the advantages of the present invention are:

[0073] The program upgrade package is split into several program subpackages, a start sequence code is set in the first program subpackage, an end sequence code is set in the last program subpackage, a hash calculation is performed on each program subpackage to obtain a hash value and added to the end of each program subpackage, and the start sequence code and the end sequence code are preset in the BootLoder program of the MCU; then an upgrade instruction is sent to the MCU of the electronic device, and the MCU switches the currently running application from the APP program to the BootLoder program based on the upgrade instruction. The BootLoder program obtains each program subpackage, verifies each program subpackage and stores it in FLASH, and the BootLoder program stores the FLASH in the FLASH. The stored program subpackages are spliced ​​into a program upgrade package to perform the upgrade operation, and the APP program is switched after the upgrade is completed; since the start sequence code and the end sequence code are respectively set for the first program subpackage and the last program subpackage for anti-mistake, and the start sequence code and the end sequence code are preset in the BootLoder program, during the upgrade process, the BootLoder program can verify the legitimacy of the program subpackage based on the start sequence code and the end sequence code, and also perform integrity verification in combination with the hash value carried by the program subpackage, so as to avoid the APP program from causing the electronic device to be unable to be used normally or even damaged due to upgrade errors, thereby greatly improving the reliability of electronic device program upgrades.

[0074] Although the specific implementation modes of the present invention are described above, those skilled in the art should understand that the specific implementation modes described are only illustrative and are not intended to limit the scope of the present invention. Equivalent modifications and changes made by those skilled in the art in accordance with the spirit of the present invention should be included in the scope of protection of the claims of the present invention.

Claims

1. A method for error-proofing an electronic device program upgrade, characterized in that: The steps include: Step S1, split the program upgrade package into several program sub-packages, set a start sequence code in the first program sub-package, set an end sequence code in the last program sub-package, perform hash calculation on each program sub-package to obtain a hash value, add the hash value to the end of each program sub-package, and preset the start sequence code and the end sequence code into the BootLoder program of the MCU; Step S2: sending an upgrade instruction to the MCU of the electronic device, and the MCU switches the currently running application from the APP program to the BootLoder program based on the upgrade instruction; Step S3, the BootLoder program obtains each program sub-package, verifies each program sub-package and stores it in FLASH; Step S4, the BootLoder program combines the program subpackages stored in the FLASH into a program upgrade package to perform an upgrade operation, and switches to the APP program after the upgrade is completed.

2. The method for preventing errors in upgrading electronic equipment programs according to claim 1, characterized in that: The step S1 is specifically as follows: The program upgrade package is split into several program subpackages, and each of the program subpackages is numbered in sequence. Based on the numbers, a starting sequence code is set in the first program subpackage, and an ending sequence code is set in the last program subpackage. Hash calculations are performed on each of the program subpackages to obtain hash values, and each hash value is added to the end of the corresponding program subpackage, and the starting sequence code and the ending sequence code are preset in the BootLoder program of the MCU.

3. The electronic device program error-proofing upgrade method according to claim 1, characterized in that: The step S2 is specifically as follows: An upgrade instruction carrying a URL address for downloading the program sub-package is sent to the MCU of the electronic device, and the MCU switches the currently running application from the APP program to the BootLoder program in real time based on the upgrade instruction.

4. The electronic device program error-proofing upgrade method according to claim 1, characterized in that: The step S3 is specifically as follows: The BootLoder program sequentially obtains each program sub-package based on the URL address carried by the upgrade instruction, performs integrity check on the first program sub-package based on the hash value, performs legality check on the first program sub-package based on the preset starting sequence code, and then stores the verified first program sub-package to a designated location of the FLASH; Then, after performing integrity check on each program sub-package in sequence based on the hash value, each of the program sub-packages is stored in a designated location of the FLASH; After the integrity check is performed on the last program subpackage based on the hash value, the legality check is performed on the last program subpackage based on the preset end sequence code, and then the checked last program subpackage is stored in a designated location of the FLASH.

5. The electronic device program error-proofing upgrade method according to claim 1, characterized in that: The step S4 is specifically as follows: The BootLoder program combines the program subpackages stored in the FLASH into a program upgrade package based on the numbering sequence, and performs an upgrade operation on the APP program based on the program upgrade package; after the upgrade is completed, the MCU switches the currently running application from the BootLoder program to the APP program.

6. An electronic equipment program error-proofing upgrade system, characterized in that: Includes the following modules: An upgrade package sub-packaging module is used to split the program upgrade package into several program sub-packages, set a start sequence code in the first program sub-package, set an end sequence code in the last program sub-package, perform hash calculation on each program sub-package to obtain a hash value, add the hash value to the end of each program sub-package, and preset the start sequence code and the end sequence code into the BootLoder program of the MCU; The application switching module is used to send an upgrade instruction to the MCU of the electronic device, and the MCU switches the currently running application from the APP program to the BootLoder program based on the upgrade instruction; A program sub-package verification storage module is used for the BootLoder program to obtain each program sub-package, verify each program sub-package and store it in FLASH; The program upgrade module is used for the BootLoder program to splice the program subpackages stored in the FLASH into a program upgrade package to perform the upgrade operation, and switch to the APP program after the upgrade is completed.

7. The electronic device program error-proofing upgrade system according to claim 6, characterized in that: The upgrade package sub-packaging module is specifically used for: The program upgrade package is split into several program subpackages, and each of the program subpackages is numbered in sequence. Based on the numbers, a starting sequence code is set in the first program subpackage, and an ending sequence code is set in the last program subpackage. Hash calculations are performed on each of the program subpackages to obtain hash values, and each hash value is added to the end of the corresponding program subpackage, and the starting sequence code and the ending sequence code are preset in the BootLoder program of the MCU.

8. The electronic device program error-proofing upgrade system according to claim 6, characterized in that: The application switching module is specifically used for: An upgrade instruction carrying a URL address for downloading the program sub-package is sent to the MCU of the electronic device, and the MCU switches the currently running application from the APP program to the BootLoder program in real time based on the upgrade instruction.

9. The electronic device program error-proofing upgrade system according to claim 6, characterized in that: The program sub-packaging verification storage module is specifically used for: The BootLoder program sequentially obtains each program sub-package based on the URL address carried by the upgrade instruction, performs integrity check on the first program sub-package based on the hash value, performs legality check on the first program sub-package based on the preset starting sequence code, and then stores the verified first program sub-package to a designated location of the FLASH; Then, after performing integrity check on each program sub-package in sequence based on the hash value, each of the program sub-packages is stored in a designated location of the FLASH; After the integrity check is performed on the last program subpackage based on the hash value, the legality check is performed on the last program subpackage based on the preset end sequence code, and then the checked last program subpackage is stored in a designated location of the FLASH.

10. The electronic device program error-proofing upgrade system according to claim 6, characterized in that: The program upgrade module is specifically used for: The BootLoder program combines the program subpackages stored in the FLASH into a program upgrade package based on the numbering sequence, and performs an upgrade operation on the APP program based on the program upgrade package; after the upgrade is completed, the MCU switches the currently running application from the BootLoder program to the APP program.