A method and system for online firmware upgrade

By comparing and backing up firmware data, and trying firmware storage and recovery multiple times, the existing firmware upgrade problems are solved, and the online upgrade is achieved, which improves the efficiency and security of firmware upgrades.

CN113986308BActive Publication Date: 2024-12-06CHINA TECHENERGY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111412754.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-25
Publication Date
2024-12-06
Estimated Expiration
2041-11-25

AI Technical Summary

Technical Problem

The existing firmware upgrade method is inefficient and costly, and requires disassembling and assembling the controller, which consumes a lot of manpower and time. After the upgrade, it is necessary to check the controller to operate normally.

Method used

By comparing the received target firmware and original firmware data, backing up the original firmware, trying to store the target firmware to the target storage location many times. If it fails, restore the original firmware data, feedback the upgrade results, and avoid disassembly and assembly process.

Benefits of technology

It improves the efficiency and success rate of firmware upgrades, reduces labor costs, realizes online upgrades, and reduces maintenance time and costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113986308B_ABST
    Figure CN113986308B_ABST
Patent Text Reader

Abstract

The present invention provides a method and system for online firmware upgrade, the method comprising: comparing the received target firmware and the original firmware data read from the target storage location to see if they are consistent; if they are inconsistent, backing up the original firmware data; performing multiple firmware upgrades on the controller using the target firmware; when multiple firmware upgrades are unsuccessful, performing a recovery operation on the controller's firmware using the backed-up original firmware data; when the controller's original firmware data is successfully recovered, feeding back a first failure message; when the controller's original firmware data is unsuccessful after multiple recovery operations, feeding back a second failure message. In the process of online firmware upgrade, the controller does not need to be disassembled and assembled, which reduces the time and labor costs; at the same time, the controller can be upgraded multiple times, and the original firmware can be restored when the firmware upgrade is unsuccessful, so as to improve the firmware upgrade success rate and ensure the stable operation of the controller.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of firmware upgrade, and in particular to a method and system for online firmware upgrade. Background Art

[0002] In the industrial control industry, the nuclear power digital instrumentation and control system is a key equipment in nuclear power plants, and the controller is the core of the system. In order to improve the stability of the controller and fix the vulnerabilities of the controller, the firmware in the controller needs to be upgraded. The current method for firmware upgrade is: the technicians first disassemble the controller and then use the upgrade equipment to upgrade the controller. However, the technicians need to spend time disassembling and assembling the controller, and after completing the firmware upgrade, they need to check whether the controller can operate normally. This method will consume a lot of manpower and time, and the upgrade efficiency is low and the upgrade cost is high. Summary of the invention

[0003] In view of this, an embodiment of the present invention provides a method and system for online firmware upgrade to solve the problems of low upgrade efficiency and high upgrade cost in the existing firmware upgrade method.

[0004] To achieve the above objectives, the embodiments of the present invention provide the following technical solutions:

[0005] A first aspect of an embodiment of the present invention discloses a method for online firmware upgrade, the method comprising:

[0006] Comparing the received target firmware and the original firmware data read from the target storage location for consistency, wherein the target storage location is a location in the memory of the controller for storing the firmware data;

[0007] If the original firmware data is inconsistent with the target firmware, backing up the original firmware data;

[0008] storing the target firmware to the target storage location;

[0009] Reading back the data in the target storage location to obtain first read-back data;

[0010] If the first read-back data is inconsistent with the target firmware, performing relevant operations on the controller according to the number of times the step of storing the target firmware in the target storage location is performed, and returning to perform the step of storing the target firmware in the target storage location;

[0011] When the number of times the step of storing the target firmware in the target storage location is executed is greater than a preset value, and when the first read-back data is inconsistent with the target firmware, storing the original firmware data in the target storage location;

[0012] Reading back the data in the target storage location to obtain second read-back data;

[0013] If the second read-back data is consistent with the original firmware data, first failure information is fed back, where the first failure information is used to indicate that the firmware upgrade has failed and the original firmware data has been successfully restored;

[0014] If the second read-back data is inconsistent with the original firmware data, returning to the step of storing the original firmware data in the target storage location;

[0015] When the number of times the step of storing the original firmware data in the target storage location is executed is greater than a preset value, and when the second read-back data is inconsistent with the original firmware data, second failure information is fed back, and the second failure information is used to indicate a firmware upgrade failure and a failure to restore the original firmware data.

[0016] Preferably, performing relevant operations on the controller according to the number of times the step of storing the target firmware in the target storage location is performed includes:

[0017] When the number of times of executing the step of storing the target firmware in the memory is 1, stopping the read and write operations on the memory, and clearing the data in the target storage location;

[0018] When the number of times of executing the step of storing the target firmware in the memory is 2, all current processes of the controller are stopped, and the data in the target storage location is cleared.

[0019] Preferably, storing the original firmware data to the target storage location includes:

[0020] Clearing the data stored in the target storage location;

[0021] The original firmware data is stored in the target storage location.

[0022] Preferably, before comparing whether the received target firmware is consistent with the original firmware data read from the target storage location, the method further includes:

[0023] When receiving a firmware upgrade request, performing a correctness check on the target firmware; the request includes verification code information and the target firmware;

[0024] If the result of the correctness check is consistent with the verification code information, performing the step of comparing the received target firmware with the original firmware data read from the target storage location to see whether they are consistent;

[0025] If the result of the correctness check is inconsistent with the verification code information, information indicating a firmware data error is fed back.

[0026] Preferably, after comparing whether the received target firmware is consistent with the original firmware data read from the target storage location, the method further includes:

[0027] When the original firmware data is consistent with the target firmware, information indicating that the firmware upgrade is successful is fed back.

[0028] Preferably, after reading back the data in the target storage location to obtain the first read-back data, the method further includes:

[0029] When the first read-back data is consistent with the target firmware, information indicating that the firmware upgrade is successful is fed back.

[0030] Preferably, after feeding back the second failure information, the method further includes:

[0031] Detecting whether a dial control disposed on the controller is triggered;

[0032] If the dial control is triggered, the dial value currently pointed to by the dial control is obtained;

[0033] Reading controller firmware from a preset storage location in the memory corresponding to the dial value;

[0034] Using the read controller firmware as the target firmware, returning to execute the step of storing the target firmware in the target storage location;

[0035] When the second failure information is obtained and the dial value is a preset value, feedback is used to indicate a suggestion message for returning the device to the factory for repair;

[0036] When the second failure information is obtained and the dial value is not the preset value, the process returns to the step of detecting whether the dial control provided on the controller is triggered.

[0037] A second aspect of an embodiment of the present invention discloses a system for online firmware upgrade, the system comprising:

[0038] A first comparison unit is used to compare whether the received target firmware is consistent with the original firmware data read from the target storage location, where the target storage location is a location in the memory of the controller for storing firmware data; if the original firmware data is inconsistent with the target firmware, back up the original firmware data; and store the target firmware in the target storage location;

[0039] a second comparison unit, configured to read back the data in the target storage location to obtain first read-back data; if the first read-back data is inconsistent with the target firmware, performing relevant operations on the controller according to the number of times the step of storing the target firmware in the target storage location is performed, and returning to perform the step of storing the target firmware in the target storage location;

[0040] a storage unit, configured to store the original firmware data in the target storage location when the number of times the step of storing the target firmware in the target storage location is executed is greater than a preset value and when the first read-back data is inconsistent with the target firmware;

[0041] a third comparison unit, configured to read back the data in the target storage location to obtain second read-back data; if the second read-back data is consistent with the original firmware data, feedback first failure information, the first failure information being used to indicate that the firmware upgrade has failed and the original firmware data has been successfully restored; if the second read-back data is inconsistent with the original firmware data, return to execute the step of storing the original firmware data in the target storage location;

[0042] A feedback unit is used to feedback second failure information when the number of times the step of storing the original firmware data in the target storage location is executed is greater than a preset value and when the second read-back data is inconsistent with the original firmware data, wherein the second failure information is used to indicate a firmware upgrade failure and a failure to restore the original firmware data.

[0043] Preferably, the second comparison unit is specifically used for: when the number of times the step of storing the target firmware in the memory is executed is 1, stopping the read and write operations on the memory and clearing the data in the target storage location; when the number of times the step of storing the target firmware in the memory is executed is 2, stopping all current processes of the controller and clearing the data in the target storage location.

[0044] Preferably, the storage unit is specifically used for:

[0045] Clear the data stored in the target storage location; store the original firmware data in the target storage location.

[0046] Based on the above-mentioned embodiment of the present invention, a method and system for online firmware upgrade is provided. The method is as follows: compare the received target firmware and the original firmware data read from the target storage location to see if they are consistent; if they are inconsistent, back up the original firmware data; try to store the target firmware to the target storage location for multiple times, perform firmware upgrade operations, and if the firmware upgrade is unsuccessful, perform relevant operations on the controller according to the number of firmware upgrade attempts. After multiple attempts to upgrade the firmware still fail, try to restore the backed-up original firmware data. If the original firmware data is successfully restored, feedback to the upper computer software that the original firmware is successfully restored but the firmware upgrade fails; if multiple attempts to restore the original firmware data still fail, feedback to the upper computer software that the firmware upgrade fails and the restoration of the original firmware data fails. In the process of online upgrading the target firmware, the controller does not need to be disassembled and assembled, which reduces the time consumed and saves labor costs; after multiple attempts to upgrade the controller firmware still fail, the original firmware data can be restored, which improves the success rate of the firmware upgrade and the emergency recovery speed of the firmware upgrade failure. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0048] Figure 1 A flowchart of a firmware online upgrade method provided by an embodiment of the present invention;

[0049] Figure 2 A communication relationship diagram between the host computer software and the controller software provided in an embodiment of the present invention;

[0050] Figure 3 A flowchart of abnormal recovery of firmware upgrade provided by an embodiment of the present invention;

[0051] Figure 4 A schematic diagram of the relationship between a hardware dial, a dial value and a storage location provided in an embodiment of the present invention;

[0052] Figure 5 A structural block diagram of a firmware online upgrade system provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0053] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0054] In this application, the terms "comprises", "comprising" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device comprising the element.

[0055] As can be seen from the background technology, the current method for upgrading the firmware is: the technician first disassembles the controller, and then uses the upgrading equipment to upgrade the controller. However, the technician needs to spend time to disassemble and assemble the controller, and after completing the firmware upgrade, it is necessary to check whether the controller can operate normally. This method consumes a lot of manpower and time, and the upgrading efficiency is low and the upgrading cost is high.

[0056] Therefore, the embodiment of the present invention provides a method and system for online firmware upgrade, which compares the received target firmware and the original firmware data read from the target storage location for consistency; if the original firmware data is inconsistent with the target firmware, backs up the original firmware data; stores the target firmware in the target storage location; determines whether the firmware upgrade of the controller is successful; if the upgrade fails, performs relevant operations on the controller according to the number of attempts to upgrade the firmware and stores the target firmware in the target storage location again, and attempts to upgrade the controller firmware multiple times; if the firmware upgrade fails after multiple attempts, the original firmware data backed up is stored in the target storage location, and the original firmware data is restored multiple times. If the original firmware data is restored successfully, a first failure message is sent; if multiple attempts to restore the original firmware data fail, a second failure message is sent. In the process of online upgrading the target firmware, the controller does not need to be disassembled and assembled, which reduces the time consumed, saves labor costs, and improves the efficiency of firmware upgrade; in the process of transmitting and storing the target firmware, the firmware in the target storage location is verified and compared multiple times, which improves the success rate of the online firmware upgrade.

[0057] It should be noted that the method for online firmware upgrade provided in an embodiment of the present invention can be applied to the upgrade of controller firmware of devices such as distributed control systems (DCS) and programmable logic controllers (PLC). Specifically, the controller software can be used to receive the online firmware upgrade request and target firmware sent by the host computer software, and then the target firmware can be updated to the target storage location (or updated to a specified path) through the controller software to complete the firmware upgrade of the controller.

[0058] See also Figure 1 , shows a flowchart of a method for online firmware upgrade provided by an embodiment of the present invention, the method for online firmware upgrade comprising:

[0059] Step S101: Compare the received target firmware and the original firmware data read from the target storage location to see if they are consistent. If the original firmware data is inconsistent with the target firmware, execute step S102; if the original firmware data is consistent with the target firmware, feedback information indicating that the firmware upgrade is successful is sent to the upper computer software, and the current firmware online upgrade is terminated, and the controller automatically restarts.

[0060] In the specific implementation of step S101, the host computer software sends a firmware upgrade request to the controller, wherein the firmware upgrade request includes the verification code information and the target firmware. The controller performs a correctness check on the received target firmware, and compares the target firmware after the correctness check with the original firmware data read from the target storage location (e.g., binary comparison). If the target firmware and the original firmware data are consistent, it indicates that the current firmware data is in the latest version, which can be regarded as a successful firmware upgrade, and feedbacks the firmware upgrade success information to the host computer software; if the target firmware and the original firmware data are inconsistent, it is determined that the firmware online upgrade is required, and step S102 is executed.

[0061] It should be noted that the target storage location is a location in the memory of the controller for storing firmware data.

[0062] It can be understood that the correctness check of the received target firmware means: when a firmware upgrade request sent by the host computer software is received, the target firmware is checked for correctness (e.g., 32-bit CRC check). If the result of the correctness check of the target firmware is consistent with the check code information, it means that the target firmware has passed the correctness check. At this time, the received target firmware and the original firmware data read from the target storage location can be compared for consistency; if the result of the correctness check of the target firmware is inconsistent with the check code information, information indicating firmware data errors is fed back to the host computer software.

[0063] It is understandable that the host computer software provides an operation interface for online firmware upgrades, which can respond to user operation instructions. The operation interface may include: user management, secondary confirmation window, target file path or file selection box to be updated, operation log, abnormal prompts, etc. The secondary confirmation window can be used to increase user management and secondary confirmation mechanisms to ensure that only authorized users can perform firmware upgrade operations to prevent accidental firmware upgrade operations. The communication relationship between the host computer software and the controller software can be seen in Figure 2 shown.

[0064] Step S102: If the original firmware data is inconsistent with the target firmware, back up the original firmware data.

[0065] In the specific implementation of step S102, when the original firmware data read from the target storage location is inconsistent with the received target firmware, it indicates that a firmware upgrade is currently required. At this time, in order to prevent the controller from failing to operate normally due to a firmware upgrade failure, the original firmware data is read and backed up so that when the firmware upgrade fails later, the original firmware data can be used for recovery to keep the controller operating normally.

[0066] Step S103: Store the target firmware to the target storage location.

[0067] In the process of implementing step S103, the target firmware is stored in the target storage location to upgrade the firmware of the controller. There may be two situations at this time. One situation is that the target firmware is successfully stored in the target storage location (that is, the firmware upgrade is successful), and the other situation is that the target firmware is not successfully stored in the target storage location (that is, the firmware upgrade is unsuccessful). For the above two situations, after the target firmware is stored in the target storage location, the data in the target storage location can be read back to determine whether the target firmware is successfully stored in the target storage location. See the following steps for details.

[0068] Step S104: Read back the data in the target storage location to obtain first read-back data.

[0069] In the specific implementation of step S104, the data in the target storage location is read back to obtain first read-back data, and the first read-back data is compared with the received target firmware to determine whether the target firmware is successfully stored in the target storage location.

[0070] Step S105: Compare the first read-back data and the target firmware to see if they are consistent. If the first read-back data and the target firmware are inconsistent, execute step S106; if the first read-back data and the target firmware are consistent, feedback is given to the upper computer software to indicate that the firmware upgrade is successful, and the current firmware online upgrade is terminated, and the controller automatically restarts.

[0071] It should be noted that when the first read-back data is inconsistent with the target firmware, the controller firmware is tried again, and the firmware upgrade can be tried twice more. Similarly, the number of firmware upgrade attempts can also be set according to actual conditions and is not limited here.

[0072] Step S106: Determine whether the number of times step S103 is executed is greater than a preset value. When the number of times step S103 is executed is not greater than the preset value, execute step S107; when the number of times step S103 is executed is greater than the preset value, execute step S108.

[0073] In the process of implementing step S106, when the first read-back data is inconsistent with the target firmware, it indicates that the firmware upgrade has failed, and it is determined whether the number of times step S103 is executed is greater than a preset value. If the number of times step S103 is executed is not greater than the preset value, the controller is operated according to the number of times step S103 is executed and the process returns to step S103; if the number of times step S103 is executed is greater than the preset value, it indicates that multiple attempts to upgrade the firmware have failed, and the original firmware data needs to be restored so that the controller can operate normally, and step S108 is executed at this time.

[0074] It is understandable that the purpose of determining the number of times step S103 is performed is to determine the number of times the firmware upgrade is attempted. When the number of firmware upgrade attempts is not greater than the preset value and the firmware upgrade fails, the firmware upgrade can be performed again until the firmware upgrade is successful, or until the number of firmware upgrade attempts is greater than the preset value. Execute the subsequent steps.

[0075] Step S107: Execute relevant operations on the controller according to the number of times step S103 is executed, and return to execute step S103.

[0076] It should be noted that the number of times step S103 is executed is the number of times the firmware of the controller is attempted to be upgraded. Before the firmware of the controller is upgraded, relevant operations may be performed on the controller according to the number of times step S103 is executed.

[0077] In some specific embodiments, when the number of times step S103 is executed is 1 (i.e., when the first firmware upgrade is unsuccessful), the read and write operations on the memory are stopped and the data in the target storage location is cleared; when the number of times step S103 is executed is 2 (i.e., when the second firmware upgrade is unsuccessful), all current processes of the controller are stopped and the data in the target storage location is cleared.

[0078] That is to say, the controller can be repeatedly upgraded with firmware for multiple times. When the first firmware upgrade fails, the read and write operations on the memory are stopped to avoid the problem of data loss caused by read and write failures; the data in the target storage location at this time is cleared, the target firmware is rewritten to the target storage location, and the controller is attempted to be upgraded with firmware for a second time. When the second firmware upgrade fails, all current processes of the controller are stopped, the data in the target storage location at this time is cleared, the target firmware is rewritten to the target storage location, and the controller is attempted to be upgraded with firmware for a third time. It is understandable that the aforementioned number of repetitions of the firmware upgrade of the controller is only for illustration and is not specifically limited.

[0079] Step S108: storing the original firmware data to the target storage location.

[0080] During the specific implementation of step S107, when the number of times step S103 is executed is greater than a preset value (for example, the preset value is 2), and when the first read-back data is inconsistent with the target firmware, that is, multiple firmware upgrades of the controller's firmware have failed, the original firmware data is stored in the target storage location to restore the original firmware data of the controller.

[0081] It should be noted that the specific implementation method of storing the original firmware data in the target storage location is: clearing the data stored in the target storage location, and then storing the original firmware data in the target storage location.

[0082] Step S109: Read back the data in the target storage location to obtain second read-back data.

[0083] In the specific implementation of step S109, after the original firmware data is stored in the target storage location, the data in the target storage location is read back to obtain second read-back data; the second read-back data is compared with the original firmware data to determine whether the original firmware data is successfully restored to the target storage location.

[0084] Step S110: Compare the second read-back data and the original firmware data to see if they are consistent. If the second read-back data and the original firmware data are consistent, execute step S112; if the second read-back data and the original firmware data are inconsistent, execute step S111.

[0085] It should be noted that after the original firmware data is stored in the target storage location, it is necessary to determine whether the original firmware data is successfully restored to the target storage location. In the specific implementation of step S110, the second read-back data obtained by reading back the data in the target storage location is compared with the backed-up original firmware data to determine whether the original firmware data is successfully restored.

[0086] Step S111: Determine whether the number of times step S108 is executed is greater than a preset value. If the number of times step S108 is executed is greater than the preset value, execute step S113; if the number of times step S107 is executed is not greater than the preset value, return to execute step S108.

[0087] In the specific implementation of step S111, when the second read-back data is inconsistent with the original firmware data, it indicates that the original firmware data recovery attempt failed. If the number of executions of step S108 is not greater than the preset value, it is necessary to try to recover the original firmware data again; if the number of executions of step S108 is greater than the preset value, it indicates that multiple attempts to recover the original firmware data have failed, and it is necessary to feedback the failure information to the upper computer software.

[0088] It can be understood that, similar to the purpose of the above step S106, the purpose of determining the number of times step S108 is executed is to determine the number of attempts to restore the original firmware data. When the number of attempts to restore the original firmware data is not greater than the preset value and the restoration of the original firmware data fails, it is necessary to restore the original firmware data again, that is, step S108. Step S108 is repeatedly executed until the original firmware data is successfully restored or the number of times step S108 is executed is greater than the preset value, and the subsequent steps are executed.

[0089] Step S112: If the second read-back data is consistent with the original firmware data, a first failure message is fed back.

[0090] In the specific implementation of step S112, when the second read-back data is consistent with the original firmware data, it indicates that the original firmware data has been successfully restored so that the controller can operate normally, but the firmware upgrade fails and the first failure information needs to be fed back to the upper computer software.

[0091] It should be noted that the first failure information is information used to indicate the failure of the firmware upgrade and the successful recovery of the original firmware data.

[0092] Step S113: When the number of times step S108 is executed is greater than a preset value, and when the second read-back data is inconsistent with the original firmware data, a second failure message is fed back.

[0093] In the process of implementing step S113, when the number of executions of step S108 is greater than a preset value (for example, the preset value is 2), it indicates that the firmware upgrade has failed and multiple attempts to restore the original firmware data have failed, and a second failure information needs to be fed back to the host computer software.

[0094] It should be noted that the second failure information is information used to indicate a firmware upgrade failure and a failure to restore the original firmware data.

[0095] In actual applications, when the host computer software receives abnormal information that the firmware upgrade fails and the original firmware data fails to be restored, or recognizes that the controller cannot operate normally, it will prompt that manual intervention is required for recovery. When the technician turns the dial control set on the controller, the relevant response program is started. The implementation method of the relevant response program is detailed in the following embodiments of the present invention. Figure 3 The content in.

[0096] In an embodiment of the present invention, the received target firmware is compared with the original firmware data read from the target storage location; if the original firmware data is inconsistent with the target firmware, the original firmware data is backed up; the target firmware is used to perform a firmware upgrade operation on the controller, and the target firmware is stored in the target storage location; it is determined whether the target firmware is correctly written; if the write fails, the controller is subjected to relevant operations according to the number of times the step of storing the target firmware in the target storage location is executed, and the step of storing the target firmware in the target storage location is returned to; when multiple attempts to upgrade the firmware still fail, the firmware recovery operation is performed using the backed up original firmware data, and the original firmware data is stored in the target storage location; it is determined whether the original firmware data is successfully restored; if the original firmware data is successfully restored, a first failure message is sent; if the restoration of the original firmware data fails, the step of storing the original firmware data in the target storage location is returned to; when multiple attempts to restore the original firmware data still fail, a second failure message is sent. The online upgrade of the firmware eliminates the need to disassemble and reassemble the controller, avoids the firmware upgrade failure caused by operational errors, reduces the time and labor costs consumed by the firmware upgrade, and improves the success rate of the firmware upgrade.

[0097] The implementation method of the relevant response program for manual intervention to restore the normal operation of the controller according to the present invention is shown in Figure 3 , shows a flowchart of abnormal recovery of firmware upgrade provided by an embodiment of the present invention, including the following steps:

[0098] Step S301: Detect whether a dial control set on the controller is triggered.

[0099] In the specific implementation of step S301, after the second failure information is sent to the host computer software, indicating that the current controller cannot operate normally, the controller firmware can be upgraded again using the pre-burned controller firmware.

[0100] It is understandable that the dial control is set on the controller and can be identified in the boot loader (BootLoader, such as U-boot, etc.).

[0101] It should be noted that the controller firmware (e.g., operating system image) can be pre-burned to different preset storage locations in the memory, and the number of different preset storage locations is n (e.g., n>=3), where n is the number of toggle values ​​corresponding to the toggle control, that is, each toggle value corresponds to a preset storage location. The value of n can be determined based on the key value that the toggle can recognize, the space size of the storage device, and the design complexity.

[0102] Step S302: if the dial control is triggered, the dial value currently pointed to by the dial control is obtained.

[0103] It should be noted that different dial values ​​can be switched through the dial control, and when the dial control is detected to be triggered, the dial value currently pointed to by the dial control is obtained. From the above content, it can be seen that each dial value corresponds to a corresponding preset storage location, so the controller firmware can be determined from which preset storage location to read through the dial value currently pointed to by the dial control.

[0104] Step S303: Read the controller firmware from a preset storage location in the memory corresponding to the dial value.

[0105] In the process of implementing step S303, after obtaining the dial value currently pointed to by the dial control, the controller firmware pre-burned in the preset storage location is read according to the preset storage location in the memory corresponding to the dial value (the dial value currently pointed to by the dial control), and the controller firmware is upgraded again using the read controller firmware.

[0106] Step S304: Use the read controller firmware as the target firmware and return to execute step S103.

[0107] In the specific implementation of step S304, the pre-stored controller firmware read in step S303 is used as the target firmware, and the target firmware (the target firmware here is the controller firmware read from the preset storage location) is copied to the target storage location, that is, returning to execute the above embodiment of the present invention. Figure 1 In step S103, the firmware upgrade operation is performed again.

[0108] To better explain the above relationship between the dial value and the storage position, Figure 4 The relationship between the hardware dial, the dial value and the storage location is illustrated by way of example.

[0109] like Figure 4, by detecting that the hardware dial (that is, the dial control mentioned above) is triggered, obtaining the dial value (any value from 1 to n) currently pointed to by the hardware dial, wherein different dial values ​​correspond to different preset storage locations, such as the preset storage location corresponding to the dial value 1 is storage address 1, and the preset storage location corresponding to the dial value 2 is storage address 2; loading the controller firmware in the preset storage location corresponding to the dial value currently pointed to by the hardware dial; using the loaded controller firmware as the target firmware and returning to execute the above embodiment of the present invention Figure 1 Step S103 in (that is, performing the firmware upgrade operation again).

[0110] Step S305: When the second failure information is obtained and the dial value is a preset value, feedback is provided to indicate a suggestion message for returning the product to the factory for repair.

[0111] It should be noted that different dial values ​​correspond to different recovery difficulties. For example, when n is 2, there is still a chance to perform on-site recovery even if the update fails once; when n is 1, if the update fails, it indicates that the controller system cannot be started and there is no chance of recovery. At this time, it needs to be returned to the factory for repair. That is, the larger the value of n, the greater the probability of on-site recovery even if the update fails.

[0112] In the specific implementation of step S305, the controller firmware read is used as the target firmware and returns to execute the embodiment of the present invention. Figure 1 After step S103, if the second failure information is still obtained (that is, the firmware upgrade fails again), when the dial value currently pointed to by the dial control is the preset value (such as the dial value is 1), feedback is used to indicate the suggestion information for returning to the factory for repair.

[0113] Step S306: When the second failure information is obtained and the dial value is not the preset value, return to step S301.

[0114] It should be noted that when the second failure information is obtained and the dial value is not the preset value, it indicates that the normal operation of the controller cannot be restored, but there is still a chance to perform on-site recovery.

[0115] In the specific implementation of step S306, the controller firmware read is used as the target firmware and returns to execute the embodiment of the present invention. Figure 1 After step S103 in the above, if the second failure information is still obtained (that is, the firmware upgrade fails again), when the dial value currently pointed to by the dial control is not the preset value (such as the dial value is not 1), it means that there is still a chance to perform on-site recovery. At this time, the dial control can be triggered again to switch the currently pointed dial value to perform the firmware upgrade again.

[0116] For example: when the second failure information is obtained and the dial value is not 1, assuming that the dial value currently pointed to by the dial control is 2, if the second failure information is still obtained after the above steps, the dial control can be triggered again to change the dial value currently pointed to by the dial control to 1 (equivalent to triggering the dial control again), and return to execute step S301.

[0117] In an embodiment of the present invention, it is detected whether the dial control set on the controller is triggered; if the dial control is triggered, the dial value currently pointed to by the dial control is obtained; the controller firmware is read from the preset storage location corresponding to the dial value in the memory; the read controller firmware is used as the target firmware, and the step of storing the target firmware in the target storage location is returned; when the second failure information is obtained and the dial value is the preset value, the suggestion information indicating the return to the factory for repair is fed back; when the second failure information is obtained and the dial value is not the preset value, the step of detecting whether the dial control set on the controller is triggered is returned. When the firmware upgrade fails and the original firmware data cannot be restored, the pre-stored controller firmware can be read to back up and restore the normal operation of the controller, which speeds up the emergency processing after the firmware upgrade fails.

[0118] To better explain the above embodiments of the present invention Figure 1 The content is illustrated by examples from process A1 to process A22.

[0119] A1. Perform correctness check on the target firmware received from the host computer software.

[0120] A2. Read the original firmware data in the target storage location.

[0121] A3. Perform binary comparison between the original firmware data and the target firmware that has passed the correctness check.

[0122] A4. If the original firmware data is consistent with the target firmware that has passed the correctness check, the firmware upgrade success information is fed back to the host computer software, the upgrade is ended, and the controller automatically restarts.

[0123] A5. If the original firmware data is inconsistent with the target firmware that has passed the correctness check, read the original firmware data and back it up.

[0124] A6. Store the target firmware to the target storage location.

[0125] A7. Read back the data in the target storage location to obtain first read-back data.

[0126] A8. Perform binary comparison between the first read-back data and the target firmware.

[0127] A9. If the first read-back data is consistent with the target firmware, the firmware upgrade success information is fed back to the host computer software and the controller automatically restarts.

[0128] A10. If the first read-back data is inconsistent with the target firmware, stop the read and write operations on the controller's memory and clear the data in the target storage location.

[0129] A11. Store the target firmware to the target storage location.

[0130] A12. Read back the data in the target storage location again to obtain new first read-back data.

[0131] A13. Perform a binary comparison between the new first read-back data and the target firmware.

[0132] A14. If the new first read-back data is consistent with the target firmware, the firmware upgrade success information is fed back to the host computer software and the controller automatically restarts.

[0133] A15. If the new first read-back data is inconsistent with the target firmware, all current processes of the controller are stopped and the data in the target storage location is cleared.

[0134] A16. Store the target firmware to the target storage location.

[0135] A17. Read back the data in the target storage location again to obtain another new first read-back data.

[0136] A18. If the other new first read-back data is consistent with the target firmware, the firmware upgrade success information is fed back to the host computer software, and the controller automatically restarts.

[0137] A19. If the other new first read-back data is inconsistent with the target firmware, clear the data in the target storage location.

[0138] A20, storing the backed-up original firmware data in a target storage location, reading back the data in the target storage location to obtain second read-back data, and performing a binary comparison between the second read-back data and the original firmware data.

[0139] A21. If the second read-back data is consistent with the original firmware data, the first failure information is fed back to the upper computer software.

[0140] A22: If the second read-back data is inconsistent with the original firmware data, repeat process A20 twice. If the second read-back data is inconsistent with the original firmware data after executing process A20 twice, a second failure information is fed back to the upper computer software.

[0141] Corresponding to the firmware online upgrade method provided by the above embodiment of the present invention, see Figure 5The embodiment of the present invention also provides a structural block diagram of a firmware online upgrade system, which includes: a first comparison unit 501, a second comparison unit 502, a storage unit 503, a third comparison unit 504 and a feedback unit 505:

[0142] The first comparison unit 501 is used to compare whether the received target firmware is consistent with the original firmware data read from the target storage location. The target storage location is the location in the controller's memory for storing firmware data; if the original firmware data is inconsistent with the target firmware, back up the original firmware data; and store the target firmware in the target storage location.

[0143] In a specific implementation, the first comparison unit 501 is also used to: when a firmware upgrade request is received, perform a correctness check on the target firmware; the request includes verification code information and the target firmware; if the result of the correctness check is consistent with the verification code information, perform the step of comparing the received target firmware and the original firmware data read from the target storage location to see if they are consistent; if the result of the correctness check is inconsistent with the verification code information, feedback is provided to indicate information indicating firmware data errors.

[0144] In a specific implementation, the first comparison unit 501 is further used to: when the original firmware data is consistent with the target firmware, feedback information indicating that the firmware upgrade is successful.

[0145] The second comparison unit 502 is used to read back the data in the target storage location to obtain the first read-back data; if the first read-back data is inconsistent with the target firmware, according to the number of times the step of storing the target firmware in the target storage location is executed, the controller is operated in a related manner, and the step of storing the target firmware in the target storage location is returned to be executed.

[0146] In a specific implementation, the second comparison unit 502 is specifically used for: when the number of times the step of storing the target firmware in the memory is executed is 1, stopping the read and write operations on the memory and clearing the data in the target storage location; when the number of times the step of storing the target firmware in the memory is executed is 2, stopping all current processes of the controller and clearing the data in the target storage location.

[0147] In a specific implementation, the second comparison unit 502 is further used to: when the first read-back data is consistent with the target firmware, feedback information indicating that the firmware upgrade is successful.

[0148] The storage unit 503 is used to store the original firmware data in the target storage location when the number of times the step of storing the target firmware in the target storage location is executed is greater than a preset value and when the first read-back data is inconsistent with the target firmware.

[0149] In a specific implementation, the storage unit 503 is specifically used to: clear the data stored in the target storage location; and store the original firmware data in the target storage location.

[0150] The third comparison unit 504 is used to read back the data in the target storage location to obtain second read-back data; if the second read-back data is consistent with the original firmware data, first failure information is fed back, and the first failure information is used to indicate that the firmware upgrade failed and the original firmware data was successfully restored; if the second read-back data is inconsistent with the original firmware data, return to execute the step of storing the original firmware data in the target storage location.

[0151] The feedback unit 505 is used to feedback second failure information when the number of times the step of storing the original firmware data in the target storage location is executed is greater than a preset value and when the second read-back data is inconsistent with the original firmware data. The second failure information is used to indicate that the firmware upgrade failed and the original firmware data recovery failed.

[0152] In an embodiment of the present invention, the received target firmware is compared with the original firmware data read from the target storage location for consistency; if the original firmware data is inconsistent with the target firmware, the original firmware data is backed up; the target firmware is stored in the target storage location; it is determined whether the controller firmware upgrade is successful; if the upgrade fails, the controller is subjected to relevant operations according to the number of firmware upgrade attempts and the target firmware is stored in the target storage location again, and the controller firmware is attempted to be upgraded multiple times; if the firmware upgrade fails after multiple attempts, the original firmware data backed up is stored in the target storage location, and the original firmware data is attempted to be restored multiple times. If the original firmware data is successfully restored, a first failure message is sent; if the original firmware data is restored multiple times, a second failure message is sent. The firmware implements an online upgrade method, and the firmware is verified, thereby improving the accuracy of the firmware upgrade; when the upgrade is abnormal, the original firmware data can be automatically restored, which greatly protects the normal operation of the controller, improves the security of the firmware upgrade, and also improves the efficiency of the firmware upgrade and reduces the maintenance cost.

[0153] Preferably, combined Figure 5 The content shown, the system for online firmware upgrade also includes:

[0154] A detection unit, used to detect whether a dial control set on the controller is triggered;

[0155] The acquisition unit is used to acquire the dial value currently pointed to by the dial control when the dial control is triggered; read the controller firmware from the preset storage location corresponding to the dial value in the memory; use the read controller firmware as the target firmware, and return to execute the first comparison unit 501 to execute the step of storing the target firmware in the target storage location;

[0156] The processing unit is used to feedback the suggestion information indicating the need to return the product to the factory for repair when the second failure information is obtained and the dial value is a preset value; and return to the execution detection unit when the second failure information is obtained and the dial value is not a preset value.

[0157] In summary, the embodiment of the present invention provides a method and system for online firmware upgrade, which compares the received target firmware with the original firmware data read from the target storage location; when the original firmware data and the target firmware are inconsistent, the original firmware data is read and backed up; the target firmware is stored in the target storage location, and it is determined whether the data in the target storage location is consistent with the target firmware; if not, the data in the target storage location is cleared; the target firmware is stored in the target storage location again; and at the same time, the controller is operated according to the number of times the step of storing the target firmware in the target storage location is executed. Multiple attempts are made to store the target firmware in the target storage location. If the data in the target storage location is still inconsistent with the target firmware, the original firmware data is stored in the target storage location. If the data in the target storage location is consistent with the original firmware data at this time, a first failure message is sent to the upper computer software; if multiple attempts are made to store the original firmware data in the target storage location, but the data in the target storage location is still inconsistent with the original firmware data at this time, a second failure message is sent to the upper computer software. The online firmware upgrade eliminates the need to disassemble and reassemble the controller, avoiding firmware upgrade failures due to operational errors and reducing the time and labor costs of firmware upgrades. The firmware is compared for correctness, greatly improving the efficiency of firmware upgrades.

[0158] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can refer to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system or system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can refer to the partial description of the method embodiment. The system and system embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without creative work.

[0159] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0160] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for online firmware upgrade, characterized in that: The method comprises: Comparing the received target firmware and the original firmware data read from the target storage location for consistency, wherein the target storage location is a location in the memory of the controller for storing the firmware data; If the original firmware data is inconsistent with the target firmware, backing up the original firmware data; storing the target firmware to the target storage location; Reading back the data in the target storage location to obtain first read-back data; If the first read-back data is inconsistent with the target firmware, performing relevant operations on the controller according to the number of times the step of storing the target firmware in the target storage location is performed, and returning to perform the step of storing the target firmware in the target storage location; When the number of times the step of storing the target firmware in the target storage location is executed is greater than a preset value, and when the first read-back data is inconsistent with the target firmware, storing the original firmware data in the target storage location; Reading back the data in the target storage location to obtain second read-back data; If the second read-back data is consistent with the original firmware data, first failure information is fed back, where the first failure information is used to indicate that the firmware upgrade has failed and the original firmware data has been successfully restored; If the second read-back data is inconsistent with the original firmware data, returning to the step of storing the original firmware data in the target storage location; When the number of times the step of storing the original firmware data in the target storage location is executed is greater than a preset value, and when the second read-back data is inconsistent with the original firmware data, second failure information is fed back, and the second failure information is used to indicate a firmware upgrade failure and a failure to restore the original firmware data.

2. The method according to claim 1, characterized in that: The performing relevant operations on the controller according to the number of times the step of storing the target firmware in the target storage location is performed includes: When the number of times the step of storing the target firmware in the memory is executed is 1, stopping the read and write operations on the memory and clearing the data in the target storage location; When the number of times of executing the step of storing the target firmware in the memory is 2, all current processes of the controller are stopped, and the data in the target storage location is cleared.

3. The method according to claim 1, characterized in that The storing the original firmware data to the target storage location includes: Clearing the data stored in the target storage location; The original firmware data is stored in the target storage location.

4. The method according to claim 1, characterized in that: Before comparing the received target firmware and the original firmware data read from the target storage location to see if they are consistent, the following is also included: When receiving a firmware upgrade request, performing a correctness check on the target firmware; the request includes verification code information and the target firmware; If the result of the correctness check is consistent with the verification code information, performing the step of comparing the received target firmware with the original firmware data read from the target storage location to see whether they are consistent; If the result of the correctness check is inconsistent with the verification code information, information indicating a firmware data error is fed back.

5. The method according to claim 1, characterized in that After comparing the received target firmware and the original firmware data read from the target storage location to see whether they are consistent, the method further includes: When the original firmware data is consistent with the target firmware, information indicating that the firmware upgrade is successful is fed back.

6. The method according to claim 1, characterized in that After reading back the data in the target storage location to obtain the first read-back data, the method further includes: When the first read-back data is consistent with the target firmware, information indicating that the firmware upgrade is successful is fed back.

7. The method according to any one of claims 1 to 6, characterized in that: After feeding back the second failure information, the method further includes: Detecting whether a dial control disposed on the controller is triggered; If the dial control is triggered, the dial value currently pointed to by the dial control is obtained; Reading controller firmware from a preset storage location in the memory corresponding to the dial value; Using the read controller firmware as the target firmware, returning to execute the step of storing the target firmware in the target storage location; When the second failure information is obtained and the dial value is a preset value, feedback is used to indicate a suggestion message for returning the device to the factory for repair; When the second failure information is obtained and the dial value is not the preset value, the process returns to the step of detecting whether the dial control provided on the controller is triggered.

8. A system for online firmware upgrade, characterized in that: The system comprises: A first comparison unit is used to compare whether the received target firmware is consistent with the original firmware data read from the target storage location, where the target storage location is a location in the memory of the controller for storing firmware data; if the original firmware data is inconsistent with the target firmware, back up the original firmware data; and store the target firmware in the target storage location; a second comparison unit, configured to read back the data in the target storage location to obtain first read-back data; if the first read-back data is inconsistent with the target firmware, performing relevant operations on the controller according to the number of times the step of storing the target firmware in the target storage location is performed, and returning to perform the step of storing the target firmware in the target storage location; a storage unit, configured to store the original firmware data in the target storage location when the number of times the step of storing the target firmware in the target storage location is executed is greater than a preset value and when the first read-back data is inconsistent with the target firmware; a third comparison unit, configured to read back the data in the target storage location to obtain second read-back data; if the second read-back data is consistent with the original firmware data, feedback first failure information, the first failure information being used to indicate that the firmware upgrade has failed and the original firmware data has been successfully restored; if the second read-back data is inconsistent with the original firmware data, return to execute the step of storing the original firmware data in the target storage location; A feedback unit is used to feedback second failure information when the number of times the step of storing the original firmware data in the target storage location is executed is greater than a preset value and when the second read-back data is inconsistent with the original firmware data, wherein the second failure information is used to indicate a firmware upgrade failure and a failure to restore the original firmware data.

9. The system according to claim 8, characterized in that The second comparison unit is specifically configured to: when the number of times the step of storing the target firmware in the memory is executed is 1, stop the read and write operations on the memory and clear the data in the target storage location; When the number of times of executing the step of storing the target firmware in the memory is 2, all current processes of the controller are stopped, and the data in the target storage location is cleared.

10. The system according to claim 8, characterized in that The storage unit is specifically used for: Clear the data stored in the target storage location; store the original firmware data in the target storage location.