Method, device and system for upgrading application firmware of electronic equipment

Through the boot program, the validity of the application firmware and the upgrade is solved, and the problems of inconsistent APP validity detection and power outage during the burning process in the prior art are solved, and the stability and reliability of the equipment upgrade process are achieved.

CN114138295BActive Publication Date: 2025-05-16SHENZHEN HONGHE INNOVATION INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111192972.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-13
Publication Date
2025-05-16
Estimated Expiration
2041-10-13

AI Technical Summary

Technical Problem

In the prior art, the flag detection mechanism of whether the APP is effective is inconsistent, resulting in the wrong APP being upgraded and run, resulting in equipment abnormality; at the same time, abnormal power outage during the burning process cannot be upgraded again, resulting in equipment abnormality or damage.

Method used

Use the boot program to determine the validity of the application firmware, including determining whether the stack address, device matching value and upgrade completion flag value is correct. If it is invalid, receive the upgrade instruction and execute the upgrade to ensure that the correct upgrade completion flag value is set after the upgrade is completed.

Benefits of technology

Ensure that the equipment upgrade process is stable and reliable, prevent the wrong program from being upgraded, ensure that the power failure will not cause equipment abnormality before the correct program is updated, and the equipment can also upgrade the firmware again.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114138295B_ABST
    Figure CN114138295B_ABST
Patent Text Reader

Abstract

The present invention provides an application firmware upgrade method for an electronic device, which includes running a boot program and judging whether the application firmware is valid, wherein the boot program includes a memory start address, a memory end address, a preset device matching value and a preset upgrade completion flag value; judging whether the application firmware is valid includes judging whether a stack address of the application firmware is within the range of a memory start address and a memory end address, judging whether a device matching value in the application firmware is the same as a preset device matching value, and judging whether an upgrade completion flag value in the application firmware is the same as a preset upgrade completion flag value; if yes, the application firmware is valid; otherwise, the application firmware is invalid; if the application firmware is invalid, receiving a first upgrade instruction and executing an application firmware upgrade; when the upgrade is completed, setting the upgrade completion flag value in the application firmware to the preset upgrade completion flag value.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method, device and system for upgrading application firmware of an electronic device. Background Art

[0002] When a device needs to add new functions or solve functional defects of existing products, it is necessary to upgrade the device firmware. The firmware upgrade process must be stable and reliable, otherwise it will cause device malfunctions and even require disassembly and rework, resulting in huge losses.

[0003] The device firmware upgrade method is generally as follows: the device program storage area includes two different areas, boot and App. When powered on, the program runs in the boot area. If the APP is detected to be valid, it jumps to the APP to run. If no valid APP is detected, it waits for the upgrade command to upgrade the APP firmware. When the APP is running, if a firmware upgrade command is received, the APP valid flag is cleared, reset and re-enter the boot to start the firmware upgrade.

[0004] The existing technology mainly has the following technical problems:

[0005] 1. The flag detection mechanism for whether the APP is valid is inconsistent. Some methods will run the APP even if the wrong APP is upgraded, causing the device to be abnormal and unable to be upgraded again;

[0006] 2. If the power is off abnormally during the burning process, the program cannot be run or upgraded, which will eventually cause the device to malfunction or be damaged. Summary of the invention

[0007] Based on the above situation, the main purpose of the present invention is to provide a method and device for upgrading application firmware of an electronic device to ensure that there are no errors in the entire device upgrading process.

[0008] To achieve the above purpose, the technical solution adopted by the present invention is as follows:

[0009] A method for upgrading application firmware of an electronic device, wherein a program storage area of ​​the electronic device includes a boot program area and an application program area, the boot program area stores a boot program, and the application program area stores application firmware, the method comprising:

[0010] Running the boot program to determine whether the application firmware is valid;

[0011] The boot program includes a memory start address, a memory end address, a preset device matching value, and a preset upgrade completion flag value; judging whether the application firmware is valid includes: judging whether the stack address of the application firmware is within the range of the memory start address and the memory end address, judging whether the device matching value in the application firmware is the same as the preset device matching value, and judging whether the upgrade completion flag value in the application firmware is the same as the preset upgrade completion flag value. If all of them are yes, the application firmware is considered valid; otherwise, the application firmware is considered invalid;

[0012] If the application firmware is invalid, receiving a first upgrade instruction and executing an application firmware upgrade;

[0013] When the upgrade is completed, the upgrade completion flag value in the application firmware is set to the preset upgrade completion flag value.

[0014] Preferably, the stack address includes: a value consisting of the starting N bytes of data in the application firmware area.

[0015] Preferably, the device matching value includes: program data of a preset length starting from a preset fixed position in the application firmware, and the preset length is the length of the preset device matching value.

[0016] Preferably, the device matching value also includes model information of the electronic device.

[0017] Preferably, the upgrade completion flag value includes: a program value of a fixed byte at the end of the application firmware.

[0018] Preferably, if the application firmware is valid, running the application firmware;

[0019] When a second upgrade instruction is received during the running of the application firmware, the upgrade completion flag value in the application firmware is set to a non-preset upgrade completion flag value;

[0020] Re-running the boot program to determine that the application firmware is invalid;

[0021] The boot program receives the first upgrade instruction, performs an upgrade on the application firmware, and sets an upgrade completion flag value in the application firmware to the preset upgrade completion flag value.

[0022] The present invention also provides an electronic device, which can use the application firmware upgrade method of the electronic device of the present invention to upgrade the application firmware of the electronic device.

[0023] The present invention also provides an application firmware upgrade device for an electronic device, comprising a boot program execution module and an application firmware execution module, wherein the boot program execution module comprises a judgment unit, an instruction receiving unit and an upgrade unit.

[0024] The boot program execution module is used to run the boot program, the application firmware execution module is used to run the application firmware, the judgment unit is used to judge whether the application firmware is valid, and the boot program includes a memory start address, a memory end address, a preset device matching value and a preset upgrade completion flag value;

[0025] The judging unit includes a first judging unit, a second judging unit and a third judging unit, wherein:

[0026] The first determination unit is used to determine whether the stack address of the application firmware is within the range of the memory start address and the memory end address.

[0027] The second determination unit is used to determine whether the device matching value in the application firmware is the same as the preset device matching value.

[0028] The third judgment unit is used to judge whether the upgrade completion flag value in the application firmware is the same as the preset upgrade completion flag value;

[0029] The judgment unit can determine that the application firmware is valid if the judgment results of the first judgment unit, the second judgment unit and the third judgment unit are all yes, otherwise, the application firmware is invalid;

[0030] The instruction receiving unit can receive a first upgrade instruction when the application firmware is invalid, and the upgrade unit can execute the application firmware upgrade, and after the upgrade is completed, set the upgrade completion flag value in the application firmware to the preset upgrade completion flag value.

[0031] Preferably, if the instruction receiving unit receives a second upgrade instruction during the process of the application execution module running the application firmware, the application execution module sets the upgrade completion flag value in the application data to a non-preset upgrade completion flag value, the boot program execution module re-runs the boot program, and the judgment unit determines that the application firmware is invalid;

[0032] After the instruction receiving unit receives the first upgrade instruction, the upgrade unit can execute the application firmware upgrade, and after the upgrade is completed, set the upgrade completion flag value in the application firmware to the preset upgrade completion flag value.

[0033] The present invention also provides an application firmware upgrade system for an electronic device, comprising a host computer and an application firmware upgrade device for an electronic device of the present invention.

[0034] The host computer is used to obtain the working mode of the application firmware upgrade device of the electronic device;

[0035] When the application firmware upgrade device of the electronic device operates in the boot program working mode, the host computer sends a first upgrade instruction to the application firmware upgrade device of the electronic device, and the application firmware upgrade device of the electronic device executes the application upgrade;

[0036] When the application firmware upgrade device of the electronic device runs in the application working mode, the host computer sends a second upgrade instruction to the application firmware upgrade device of the electronic device, the application firmware upgrade device of the electronic device sets the upgrade completion flag value to a non-preset upgrade completion flag value, and the application firmware upgrade device of the electronic device executes the application firmware upgrade.

[0037] The application firmware upgrade method and device of the electronic device of the present invention run a boot program after power-on to detect whether the application firmware is valid. If it is valid, the application firmware is entered into operation. Otherwise, the boot program receives an upgrade instruction and executes the application firmware upgrade. The boot program includes a memory start address, a memory end address, a preset device matching value and a preset upgrade completion flag value. The three values ​​of the memory start address, the memory end address and the preset device matching value are all correct, which can ensure that the upgraded file is correct and an erroneous program cannot be upgraded to the device. The preset upgrade completion flag value is written in the last stage of the upgrade process. The correct value can ensure that the upgrade of all data has been completed. If the power is off before the correct program is updated, it will not cause device abnormality. The device can also upgrade the application again, thereby ensuring that the upgrade process of the electronic device is error-free.

[0038] The electronic device of the present invention can use the application firmware upgrade method of the present invention to upgrade the application of the electronic device, ensuring that an erroneous program cannot be upgraded to the device, and that power failure before the correct program is updated will not cause device abnormalities, and the device can upgrade its firmware again.

[0039] Other beneficial effects of the present invention will be explained in the specific implementation manner through the introduction of specific technical features and technical solutions. Through the introduction of these technical features and technical solutions, those skilled in the art should be able to understand the beneficial technical effects brought about by the technical features and technical solutions. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] The preferred implementation of the application program upgrade method and application program upgrade system of the electronic device according to the present invention will be described below with reference to the accompanying drawings.

[0041] Figure 1 A flowchart of a method for upgrading application firmware of an electronic device according to a preferred embodiment of the present invention;

[0042] Figure 2 A flowchart of a method for upgrading application firmware of an electronic device according to another preferred embodiment of the present invention;

[0043] Figure 3 A structural diagram of an application firmware upgrade device for an electronic device according to a preferred embodiment of the present invention;

[0044] Figure 4 A schematic diagram of an application firmware upgrade system according to a preferred embodiment of the present invention;

[0045] Figure 5 for Figure 4 The application firmware upgrade system workflow diagram is shown. DETAILED DESCRIPTION

[0046] Figure 1 This is a flow chart of an application firmware upgrade method for an electronic device according to a preferred embodiment of the present invention. The program storage area of ​​the electronic device of the present invention includes a boot program area and an application firmware area. The boot program area stores a boot program, and the application firmware area stores application firmware. In the present invention, the boot program can be used to perform an upgrade operation of the application firmware. Specifically, it can include the boot program determining whether the application firmware is valid and implementing the upgrade operation. Application firmware generally refers to an application used in conjunction with the hardware of the electronic device, and is an application that relies on the hardware. After the electronic device is turned on, the boot program is first run to determine whether the application firmware is valid. If valid, the application firmware is run. Otherwise, the upgrade instruction is waited for to execute the application firmware upgrade.

[0047] The method for upgrading application firmware of an electronic device of the present invention comprises:

[0048] S101: Run the boot program.

[0049] The boot program includes a memory start address preFlag1_L, a memory end address preFlag1_H, a preset device matching value preFlag2, and a preset upgrade completion flag value preFlag3.

[0050] S102: Determine whether the application firmware in the application firmware area is valid.

[0051] Wherein, judging whether the application firmware is valid includes:

[0052] S1021: Determine whether the stack address of the application firmware is within the range of the memory start address preFlag1_L and the memory end address preFlag1_H.

[0053] S1022: Determine whether the device matching value in the application firmware is the same as the preset device matching value preFlag2.

[0054] S1023: Determine whether the upgrade completion flag value in the application firmware data is the same as the preset upgrade completion flag value preFlag3.

[0055] If the judgment results of S1021, S1022 and S1023 are all yes, the application firmware is considered valid. If the judgment result of one of S1021, S1022 and S1023 is no, the application firmware is considered invalid. If the application firmware is invalid, S103 is executed.

[0056] S103: Receive a first upgrade instruction and upgrade the application firmware. In a specific implementation, the first upgrade instruction is usually issued by a host computer.

[0057] S104: When the upgrade is completed, the upgrade completion flag value in the application firmware is set to the preset upgrade completion flag value.

[0058] Typically, the application firmware is run when the application firmware is valid.

[0059] In the application firmware upgrade method of the electronic device of the present invention, after power-on, a boot program is run to detect whether the application firmware is valid. If it is valid, the application firmware is entered into operation. Otherwise, the boot program receives an upgrade instruction and executes the application firmware upgrade, wherein the boot program includes a memory start address preFlag1_L, a memory end address preFlag1_H, a preset device matching value preFlag2 and a preset upgrade completion flag value preFlag3. The three values ​​of the memory start address preFlag1_L, the memory end address preFlag1_H and the preset device matching value preFlag2 are all correct, which can ensure that the upgraded file is correct and an erroneous program cannot be upgraded to the device. The preset upgrade completion flag value preFlag3 is written in the last stage of the upgrade process. The correct value can ensure that the upgrade of all data has been completed. If the correct program is not updated before the power is off, it will not cause device abnormality. The device can also upgrade the application again, thereby ensuring that the upgrade process of the electronic device is error-free.

[0060] In S101, preFlag1_L and preFlag1_H in the bootloader can be 32-bit unsigned integer values, which can represent the start address and end address of the RAM area of the electronic device, determined by the hardware. For example, if the hardware includes 192K of RAM with a starting address of 0x2000000, then preFlag1_L is equal to 0x2000000 and preFlag1_H is equal to 0x20030000. preFlag2 and preFlag3 can both be specific strings or arrays.

[0061] In S1021, the value composed of the starting N bytes of data read from the application firmware area is the stack address of the application firmware. For example, it can be a 32-bit unsigned integer data composed of the first 4 bytes of the application firmware area. When running the bootloader, first determine whether the stack address (Flag1) of the application firmware satisfies preFlag1_L < Flag1 < preFlag1_H. If not, it is determined that the application firmware is invalid, and the bootloader enters the waiting for upgrade state. The stack address of the application firmware is固化 in the software during the compilation process, representing the starting address where the application runs in memory. During the compilation process, the stack address is determined according to the memory address range of the electronic device. When incorrect memory information is input during the compilation process, the address may not be within the start address and end address range of the electronic device's RAM area, indicating that the application is not for this electronic device. Therefore, the correctness of Flag1 can ensure that the software is the correct firmware.

[0062] In S1022, the device matching value in the application firmware can be program data that starts at a preset fixed position in the application firmware and has a continuous preset length. The preset length is the length of the preset device matching value in the bootloader. For example, at a certain fixed position in the application firmware area, continuously read the program data (Flag2) of a fixed length (len), and determine whether Flag2 is consistent with the preset device matching value in the bootloader area. The size of len depends on the length of the preset device matching value. The preset device matching value is fixedly written in the program by the coder and can include the model information of the electronic device and some other specific marker information, etc. If it is an incorrect program, this value cannot be consistent either. If not consistent, it indicates that the firmware does not match the current device, and the application firmware is invalid, waiting for upgrade.

[0063] In the specific implementation, the preset device matching value is the string "MODEL_HA86_FLAG". If the read Flag2 is not equal to "MODEL_HA86_FLAG", the application firmware is invalid. The device matching value is固化 in the software, and the correctness of this value can ensure that the software is the correct firmware.

[0064] In S1023, the upgrade completion flag value (Flag3) can be the program value of the last fixed byte in the application firmware. The upgrade completion flag value (Flag3) is written into the application firmware at the last stage of the upgrade process. The correct flag can ensure that the upgrade of all data has been completed.

[0065] In S102, if the stack address of the application firmware is within the range of the memory start address preFlag1_L and the memory end address preFlag1_H, the device matching value in the application firmware is the same as the preset device matching value preFlag2, and the upgrade completion flag value in the application firmware data is the same as the preset upgrade completion flag value preFlag3, then the application firmware is judged to be valid; otherwise, as long as any one of the above three conditions is no, the application firmware is judged to be invalid, and the firmware upgrade is waited for.

[0066] In a specific implementation, the execution of S1021, S1022 and S1023 can be parallel or serial, or the priority can be set to judge one item first and then another item. For example, the judgment can be made in parallel, and when any item is negative, the application firmware is judged to be invalid. The judgment can also be made in series, first judging whether the stack address of the application firmware is within the range of the memory start address preFlag1_L and the memory end address preFlag1_H. If so, then judging whether the device matching value in the application firmware is the same as the preset device matching value preFlag2. If so, then judging whether the upgrade completion flag value in the application firmware data is the same as the preset upgrade completion flag value preFlag3. If so, then judging that the application firmware is valid. Otherwise, when any item is judged to be negative, the application firmware is judged to be invalid. The judgment priority of S1021, S1022 and S1023 can also be set according to the needs, and the judgment is performed according to the priority. Similarly, when any item is judged to be negative, the application firmware is judged to be invalid.

[0067] In one embodiment, if Figure 2 As shown, if the boot program determines that the application firmware is valid, step S105 is executed: the application firmware is run; step S106: if the second upgrade instruction is received during the running of the application firmware, step S107 is executed: the upgrade completion flag value in the application firmware is set to a non-preset upgrade completion flag value, for example, cleared; then the boot program is re-run, at this time, since the upgrade completion flag is a non-preset upgrade completion flag value, the boot program will determine that the application is invalid, the boot program will receive the first upgrade instruction, perform an upgrade on the application firmware, and set the upgrade completion flag value in the application firmware to the preset upgrade completion flag value, thereby completing the application firmware upgrade. In a specific implementation, the second upgrade instruction is usually issued by the host computer.

[0068] In S106, the second upgrade instruction received is different from the first upgrade instruction received in S103. The first upgrade instruction is issued when the application is invalid. At this time, the electronic device runs in the boot program area and can directly perform the upgrade. The second upgrade instruction is issued when the application is valid. At this time, the electronic device runs in the application area and needs to first set the upgrade completion flag value to a non-preset upgrade completion flag value, then run the boot program, and then perform the upgrade.

[0069] The upgrade method of the application firmware upgrade method of the electronic device of the present invention can be USB, serial port, U disk, SD card, etc., and the upgrade triggering method can be a custom USB command, serial port command, button trigger, etc., which is not limited.

[0070] The present invention also provides an electronic device, which can use the application firmware upgrade method of the electronic device of the present invention to upgrade the application firmware of the electronic device. By adopting the firmware upgrade method of the present invention, it is ensured that the wrong program cannot be upgraded to the device, and the power failure before the correct program is updated will not cause the device to be abnormal, and the device can upgrade the firmware again. The electronic device can be a large-screen device, such as a large conference screen, for example, it can be an upgrade operation for the application of the infrared touch box in the large-screen device.

[0071] The present invention also provides an application firmware upgrade device for an electronic device, such as Figure 3As shown, the application firmware upgrade device includes a boot program execution module 20 and an application execution module 30, and the boot program execution module 20 includes a judgment unit 201, an instruction receiving unit 202 and an upgrade unit 203. The boot program execution module 20 is used to run the boot program, and the application firmware execution module is used to run the application firmware. The boot program includes a memory start address preFlag1_L, a memory end address preFlag1_H, a preset device matching value preFlag2 and a preset upgrade completion flag value preFlag3; the judgment unit 201 is used to judge whether the application is valid, and the judgment unit 201 includes a first judgment unit 2011, a second judgment unit 2012 and a third judgment unit 2013. The first judgment unit 2011 is used to judge whether the stack address of the application firmware is within the range of the memory start address and the memory end address, and the second judgment unit 2012 is used to judge whether the application firmware is valid. The device matching value in the application firmware is the same as the preset device matching value, and the third judgment unit 2013 is used to judge whether the upgrade completion flag value in the application firmware is the same as the preset upgrade completion flag value; the judgment unit 201 can consider that the application firmware is valid and run the application firmware when the judgment results of the first judgment unit 2011, the second judgment unit 2012 and the third judgment unit 2013 are all yes, otherwise, the application firmware is considered invalid; the instruction receiving unit 202 receives the first upgrade instruction when the application firmware is invalid, the upgrade unit 203 can execute the application firmware upgrade, and after the upgrade is completed, set the upgrade completion flag value in the application firmware to the preset upgrade completion flag value.

[0072] The application firmware upgrade device of the electronic device of the present invention runs the boot program by the boot program execution module 20 after power-on, and judges whether the application firmware is valid through the judgment unit 201 therein. If it is valid, the application firmware execution module 30 runs the application firmware, otherwise, the instruction receiving unit 202 receives the upgrade instruction, and the upgrade unit 203 executes the application firmware upgrade, wherein the boot program includes the memory start address preFlag1_L, the memory end address preFlag1_H, the preset device matching value preFlag2 and the preset upgrade completion flag value preFlag3. The three values ​​of the memory start address preFlag1_L, the memory end address preFlag1_H and the preset device matching value preFlag2 are all correct, which can ensure that the upgraded file is correct, and the wrong program cannot be upgraded to the device. The preset upgrade completion flag value preFlag3 is written in the last stage of the upgrade process. The correct value can ensure that the upgrade of all data has been completed. If the correct program is not powered off before the update is completed, it will not cause the device to be abnormal, and the device can upgrade the application again, thereby ensuring that the firmware upgrade process of the electronic device is error-free.

[0073] In one embodiment, the instruction receiving unit 202 can receive the second upgrade instruction during the application execution module 30 running the application firmware, and the application execution module 30 sets the upgrade completion flag value in the application firmware to a non-preset upgrade completion flag value, for example, clearing it to zero; the boot program execution module 20 reruns the boot program, and the judgment unit 201 determines that the application firmware is invalid; the instruction receiving unit 202 receives the first upgrade instruction, and the upgrade unit 203 can execute the application firmware upgrade, and after the upgrade is completed, set the upgrade completion flag value in the application firmware to the preset upgrade completion flag value. During the running of the application firmware, the application firmware upgrade can also be successfully executed.

[0074] The present invention also provides an application firmware upgrade system, such as Figure 4 As shown, it includes a host computer and an application firmware upgrade device of an electronic device of the present invention, the host computer is used to obtain the working mode of the application firmware upgrade device of the electronic device, when the application firmware upgrade device of the electronic device is in the boot program working mode, the host computer sends a first upgrade instruction to the application firmware upgrade device of the electronic device, and the application firmware upgrade device of the electronic device executes the application upgrade; when the application firmware upgrade device is in the application working mode, the host computer sends a second upgrade instruction to the application firmware of the electronic device, the application firmware upgrade device of the electronic device sets the upgrade completion flag value to a non-preset upgrade completion flag value, for example, clears it, and the application firmware upgrade device of the electronic device executes the application firmware upgrade. Among them, the boot program working mode refers to the state in which the application firmware upgrade device of the electronic device determines that the application firmware is invalid after running the boot program, and thus continues to run the boot program to wait for the upgrade instruction, and the application working mode refers to the state in which the application firmware upgrade device of the electronic device determines that the application firmware is valid after running the boot program, and runs the application firmware.

[0075] Through the communication between the host computer and the application firmware upgrade device of the electronic device, the working mode of the application firmware upgrade device of the electronic device is first determined, and different upgrade instructions are issued according to the working mode. The application firmware upgrade device of the electronic device then performs different processing according to different upgrade instructions, thereby completing the upgrade of the application firmware. It is ensured that the wrong program cannot be upgraded to the device, and the power is cut off before the correct program is updated, which will not cause the device to be abnormal, and the device can upgrade the firmware again.

[0076] like Figure 5As shown, it is a workflow diagram of the firmware upgrade system of the present invention, after the host computer establishes a communication connection with the application firmware upgrade device of the electronic device, step S401 is executed, and the host computer obtains the working mode of the application firmware upgrade device of the electronic device; step S402, the host computer determines that the application firmware upgrade device of the electronic device is a boot program working mode or an application working mode, if it is a boot program working mode, step S403 is executed, the host computer sends a first upgrade instruction to the application firmware upgrade device of the electronic device, step S404, the application firmware upgrade device of the electronic device performs the upgrade; if the application firmware upgrade device of the electronic device is an application working mode, step S405 is executed, the host computer sends a second upgrade instruction to the application firmware upgrade device of the electronic device, step S406, the application firmware upgrade device of the electronic device sets the upgrade completion flag value to a non-preset upgrade completion flag value, for example, clears, and the application firmware upgrade device of the electronic device performs the upgrade. Usually, before the upgrade starts, the host computer will first read the file, and judge whether a fixed length of data (Flag2) starting from a specific position is equal to preFlag2. If it is inconsistent, it means that the firmware does not match the current device and cannot continue to upgrade until the user loads the correct file.

[0077] It should be noted that the use of step numbers (letters or numbers) to refer to certain specific method steps in the present invention is only for the purpose of convenience and brevity of description, and is by no means intended to limit the order of these method steps. Those skilled in the art will appreciate that the order of the relevant method steps should be determined by the technology itself and should not be inappropriately limited by the existence of step numbers.

[0078] Those skilled in the art will appreciate that, without conflict, the above-mentioned preferred solutions can be freely combined and superimposed.

[0079] It should be understood that the above-mentioned embodiments are merely illustrative and not restrictive. Without departing from the basic principles of the present invention, various obvious or equivalent modifications or substitutions that can be made by those skilled in the art to the above-mentioned details will all be included in the scope of the claims of the present invention.

Claims

1. A method for upgrading application firmware of an electronic device, characterized in that: The program storage area of ​​the electronic device includes a boot program area and an application program area, the boot program area stores a boot program, and the application program area stores application program firmware, and the method includes: Running the boot program to determine whether the application firmware is valid; The boot program includes a memory start address, a memory end address, a preset device matching value, and a preset upgrade completion flag value; judging whether the application firmware is valid includes: judging whether the stack address of the application firmware is within the range of the memory start address and the memory end address, judging whether the device matching value in the application firmware is the same as the preset device matching value, and judging whether the upgrade completion flag value in the application firmware is the same as the preset upgrade completion flag value. If all of them are yes, the application firmware is considered valid; otherwise, the application firmware is considered invalid; If the application firmware is invalid, receiving a first upgrade instruction and executing an application firmware upgrade; When the upgrade is completed, setting the upgrade completion flag value in the application firmware to the preset upgrade completion flag value; If the application firmware is valid, running the application firmware; When a second upgrade instruction is received during the running of the application firmware, the upgrade completion flag value in the application firmware is set to a non-preset upgrade completion flag value; Re-running the boot program to determine that the application firmware is invalid; The boot program receives the first upgrade instruction, performs an upgrade on the application firmware, and sets an upgrade completion flag value in the application firmware to the preset upgrade completion flag value.

2. The method for upgrading application firmware of an electronic device according to claim 1, characterized in that: The stack address includes: a value consisting of the starting N bytes of data in the application firmware area.

3. The method for upgrading application firmware of an electronic device according to claim 1, characterized in that: The device matching value includes: program data of a preset length starting from a preset fixed position in the application firmware, and the preset length is the length of the preset device matching value.

4. The method for upgrading application firmware of an electronic device according to claim 3, characterized in that: The device matching value also includes model information of the electronic device.

5. The method for upgrading application firmware of an electronic device according to claim 1, characterized in that: The upgrade completion flag value includes: a program value of a fixed byte at the end of the application firmware.

6. An electronic device, characterized in that: The application firmware of the electronic device can be upgraded by using the application firmware upgrade method of the electronic device as described in any one of claims 1 to 5.

7. An application firmware upgrade device for an electronic device, characterized in that: It includes a boot program execution module and an application firmware execution module, wherein the boot program execution module includes a judgment unit, an instruction receiving unit and an upgrade unit. The boot program execution module is used to run the boot program, the application firmware execution module is used to run the application firmware, the judgment unit is used to judge whether the application firmware is valid, and the boot program includes a memory start address, a memory end address, a preset device matching value and a preset upgrade completion flag value; The judging unit includes a first judging unit, a second judging unit and a third judging unit, wherein: The first determination unit is used to determine whether the stack address of the application firmware is within the range of the memory start address and the memory end address. The second determination unit is used to determine whether the device matching value in the application firmware is the same as the preset device matching value. The third judgment unit is used to judge whether the upgrade completion flag value in the application firmware is the same as the preset upgrade completion flag value; The judgment unit can determine that the application firmware is valid if the judgment results of the first judgment unit, the second judgment unit and the third judgment unit are all yes, otherwise, the application firmware is invalid; The instruction receiving unit is capable of receiving a first upgrade instruction when the application firmware is invalid, and the upgrade unit is capable of executing the application firmware upgrade, and after the upgrade is completed, setting the upgrade completion flag value in the application firmware to the preset upgrade completion flag value; If the instruction receiving unit receives a second upgrade instruction during the process of the application execution module running the application firmware, the application execution module sets the upgrade completion flag value in the application data to a non-preset upgrade completion flag value, the boot program execution module re-runs the boot program, and the judgment unit determines that the application firmware is invalid; After the instruction receiving unit receives the first upgrade instruction, the upgrade unit can execute the application firmware upgrade, and after the upgrade is completed, set the upgrade completion flag value in the application firmware to the preset upgrade completion flag value.

8. An application firmware upgrade system for an electronic device, characterized in that: The device comprises a host computer and an application firmware upgrade device for an electronic device as claimed in claim 7, The host computer is used to obtain the working mode of the application firmware upgrade device of the electronic device; When the application firmware upgrade device of the electronic device operates in the boot program working mode, the host computer sends a first upgrade instruction to the application firmware upgrade device of the electronic device, and the application firmware upgrade device of the electronic device executes the application upgrade; When the application firmware upgrade device of the electronic device runs in the application working mode, the host computer sends a second upgrade instruction to the application firmware upgrade device of the electronic device, the application firmware upgrade device of the electronic device sets the upgrade completion flag value to a non-preset upgrade completion flag value, and the application firmware upgrade device of the electronic device executes the application firmware upgrade.

Citation Information

Patent Citations

  • Early-warning method and system for internal memory stack abnormity of intranet terminal application program

    CN106560796A

  • An on-line upgrading method, device and system of a single chip microcomputer program

    CN109358887A