CN112230959A - Battery firmware processing method and device, intelligent battery and storage medium - Google Patents
Battery firmware processing method and device, intelligent battery and storage medium Download PDFInfo
- Publication number
- CN112230959A CN112230959A CN202011112224.3A CN202011112224A CN112230959A CN 112230959 A CN112230959 A CN 112230959A CN 202011112224 A CN202011112224 A CN 202011112224A CN 112230959 A CN112230959 A CN 112230959A
- Authority
- CN
- China
- Prior art keywords
- backup
- data
- area
- backup area
- battery
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000003672 processing method Methods 0.000 title claims abstract description 31
- 238000000034 method Methods 0.000 claims abstract description 33
- 238000011084 recovery Methods 0.000 claims description 47
- 238000012545 processing Methods 0.000 claims description 16
- 238000004891 communication Methods 0.000 claims description 12
- 238000004590 computer program Methods 0.000 claims description 4
- 230000002159 abnormal effect Effects 0.000 abstract description 4
- 238000012795 verification Methods 0.000 description 9
- 238000010586 diagram Methods 0.000 description 5
- 230000005856 abnormality Effects 0.000 description 4
- RZVHIXYEVGDQDX-UHFFFAOYSA-N 9,10-anthraquinone Chemical compound C1=CC=C2C(=O)C3=CC=CC=C3C(=O)C2=C1 RZVHIXYEVGDQDX-UHFFFAOYSA-N 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/60—Software deployment
- G06F8/65—Updates
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/14—Error detection or correction of the data by redundancy in operation
- G06F11/1402—Saving, restoring, recovering or retrying
- G06F11/1446—Point-in-time backing up or restoration of persistent data
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Software Systems (AREA)
- Quality & Reliability (AREA)
- Computer Security & Cryptography (AREA)
- Stored Programmes (AREA)
Abstract
The application relates to the technical field of intelligent batteries, and provides a battery firmware processing method, a device, an intelligent battery and a storage medium, wherein the method comprises the following steps: and acquiring battery firmware data sent by the unmanned aerial vehicle, if at least one of the first backup area and the second backup area has no backup data, taking the backup area without the backup data as a target backup area, and finally backing up the battery firmware data to the target backup area. Compared with the prior art, the battery firmware upgrading method and the battery firmware upgrading device have the advantages that the battery firmware data do not need to be stored firstly and then upgraded, the firmware upgrading efficiency is improved, meanwhile, due to the fact that the two backup areas are adopted, when the battery firmware is lost due to the fact that upgrading is abnormal, the battery firmware can be restored through the backup data in one of the two backup areas, and the reliability of battery firmware upgrading is improved.
Description
Technical Field
The application relates to the technical field of intelligent batteries, in particular to a battery firmware processing method and device, an intelligent battery and a storage medium.
Background
When the firmware of the battery of most of the existing unmanned aerial vehicles is upgraded, the upgrading is interrupted due to various uncertain factors appearing in the upgrading process, the firmware of the battery is lost, and the battery cannot work normally.
For the problem that the battery firmware is lost, in the prior art, the upgrading firmware of the battery is firstly transferred to the preset storage area, then the upgrading firmware in the preset storage area is verified, the battery is upgraded by using the upgrading firmware after the verification is passed, and due to the fact that the upgrading firmware needs to be transferred and then upgraded, the upgrading efficiency is influenced.
Disclosure of Invention
The application aims to provide a battery firmware processing method and device, an intelligent battery and a storage medium, and solves the problem that when a battery is upgraded, upgrading efficiency is low due to the fact that upgrading firmware needs to be stored firstly and then upgraded.
In order to achieve the above purpose, the embodiments of the present application employ the following technical solutions:
in a first aspect, the present application provides a battery firmware processing method, which is applied to an intelligent battery, where the intelligent battery includes a backup area for backing up battery firmware data, the backup area includes a first backup area and a second backup area, the intelligent battery is in communication connection with an unmanned aerial vehicle, the intelligent battery is in a firmware upgrade process, and the method includes: acquiring battery firmware data sent by the unmanned aerial vehicle; if at least one of the first backup area and the second backup area does not have backup data, taking the backup area without the backup data as a target backup area; and backing up the battery firmware data to the target backup area.
Optionally, the method further comprises: if the first backup area and the second backup area both have backup data, acquiring backup time and backup data of the first backup area and backup time and backup data of the second backup area; and determining the target backup area according to the backup time and the backup data of the first backup area and the backup time and the backup data of the second backup area.
Optionally, the step of determining the target backup area according to the backup time and the backup data of the first backup area and the backup time and the backup data of the second backup area includes: performing integrity check on the backup data of the first backup area and the backup data of the second backup area; if the backup data of at least one backup area does not pass the integrity check, taking the backup area corresponding to the backup data which does not pass the integrity check as the target backup area; and if the backup data of the first backup area and the backup data of the second backup area both pass the integrity check, taking the backup area with earlier backup time as the target backup area.
Optionally, each backup area includes a flag bit for characterizing whether backup data in each backup area is complete, and the method further includes: when the loss of the current firmware is detected, determining a target recovery area according to the zone bit and the backup time of the first backup area and the zone bit and the backup time of the second backup area; and recovering the firmware of the intelligent battery by using the battery firmware data in the target recovery area.
Optionally, the step of determining the target recovery area according to the flag bit and the backup time of the first backup area and the flag bit and the backup time of the second backup area includes: judging whether the backup data of the first backup area is complete according to the zone bit of the first backup area; judging whether the backup data of the second backup area is complete according to the zone bit of the second backup area; if one backup area with complete backup data exists in the first backup area and the second backup area, taking the backup area with complete backup data as the target recovery area; and if the backup data of the first backup area and the backup data of the second backup area are complete, taking the backup area with later backup time as the target recovery area.
In a second aspect, the present application provides a battery firmware processing apparatus, is applied to intelligent battery, intelligent battery is including the backup area that is used for backup battery firmware data, the backup area includes first backup area and second backup area, intelligent battery and unmanned aerial vehicle communication connection, intelligent battery is in the firmware upgrading in-process, the device includes: the acquisition module is used for acquiring battery firmware data sent by the unmanned aerial vehicle; the determining module is used for taking the backup area without the backup data as a target backup area if at least one of the first backup area and the second backup area does not have the backup data; and the backup module is used for backing up the battery firmware data to the target backup area.
Optionally, the determining module is further configured to: if the first backup area and the second backup area both have backup data, acquiring backup time and backup data of the first backup area and backup time and backup data of the second backup area; and determining the target backup area according to the backup time and the backup data of the first backup area and the backup time and the backup data of the second backup area.
Optionally, the determining module is specifically configured to: performing integrity check on the backup data of the first backup area and the backup data of the second backup area; if the backup data of at least one backup area does not pass the integrity check, taking the backup area corresponding to the backup data which does not pass the integrity check as the target backup area; and if the backup data of the first backup area and the backup data of the second backup area both pass the integrity check, taking the backup area with earlier backup time as the target backup area.
In a third aspect, the present application further provides a smart battery, including: one or more processors; a memory for storing one or more programs that, when executed by the one or more processors, cause the one or more processors to implement the battery firmware processing method described above.
In a fourth aspect, the present application also provides a computer-readable storage medium, on which a computer program is stored, which, when executed by a processor, implements the battery firmware processing method as described above.
Compared with the prior art, the method has the following beneficial effects: the application provides a battery firmware processing method, a device, an intelligent battery and a storage medium, wherein the intelligent battery comprises a backup area for backing up battery firmware data, the backup area comprises a first backup area and a second backup area, the battery firmware data sent by an unmanned aerial vehicle is obtained when the intelligent battery is in a firmware upgrading process, if at least one of the first backup area and the second backup area has no backup data, the backup area without the backup data is taken as a target backup area, and finally the battery firmware data is backed up to the target backup area. The reliability of upgrading the battery firmware is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained from the drawings without inventive effort.
Fig. 1 shows a block schematic diagram of a smart battery provided in an embodiment of the present application.
Fig. 2 shows a schematic flow chart of a battery firmware processing method according to an embodiment of the present application.
Fig. 3 is a schematic flowchart illustrating another battery firmware processing method according to an embodiment of the present application.
Fig. 4 is a flowchart illustrating another battery firmware processing method according to an embodiment of the present application.
Fig. 5 is a diagram illustrating a comparison example of firmware before and after recovery provided by an embodiment of the present application.
Fig. 6 is a flowchart illustrating another battery firmware processing method according to an embodiment of the present application.
Fig. 7 shows a block schematic diagram of a battery firmware processing apparatus according to an embodiment of the present application.
Icon: 10-smart battery; 11-a processor; 12-an internal memory; 13-a bus; 14-a communication interface; 15-external memory; 100-battery firmware processing means; 110-an obtaining module; 120-a determination module; 130-backup module; 140-recovery module.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. The components of the embodiments of the present application, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the present application, presented in the accompanying drawings, is not intended to limit the scope of the claimed application, but is merely representative of selected embodiments of the application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
In the description of the present application, it should be noted that if the terms "upper", "lower", "inside", "outside", etc. are used for indicating the orientation or positional relationship based on the orientation or positional relationship shown in the drawings or the orientation or positional relationship which the present invention product is usually put into use, it is only for convenience of describing the present application and simplifying the description, but it is not intended to indicate or imply that the referred device or element must have a specific orientation, be constructed in a specific orientation and be operated, and thus, should not be construed as limiting the present application.
Furthermore, the appearances of the terms "first," "second," and the like, if any, are used solely to distinguish one from another and are not to be construed as indicating or implying relative importance.
It should be noted that the features of the embodiments of the present application may be combined with each other without conflict.
Present most unmanned aerial vehicle's intelligent battery all need the iteration to upgrade, generally when upgrading to intelligent battery through unmanned aerial vehicle's flight control system, if uncertain factor can appear in the upgrading in-process, for example, the unexpected disconnection of communication between unmanned aerial vehicle and the intelligent battery or unmanned aerial vehicle mistake are shut down, these unexpected condition can lead to upgrading the interrupt, intelligent battery firmware is lost, the unable normal work of intelligent battery, because intelligent battery can not carry out normal communication with unmanned aerial vehicle this moment, therefore, also can't carry out the firmware through flight control system to intelligent battery and resume, only rely on after sales support personnel to assist, burn the firmware of intelligent battery again, the intelligent battery just can resume normally. Thus, not only human resources are wasted but also production is interrupted, and economic loss is caused.
In order to improve the reliability of upgrading, before upgrading the intelligent battery, firstly, the battery firmware is transferred to a preset area of the intelligent battery, then, the battery firmware in the preset area is verified, the battery firmware is reused for upgrading the intelligent battery after the verification is passed, at the moment, the intelligent battery can be upgraded according to the battery firmware in the preset area, the upgrading at the moment can be independently completed by the intelligent battery, the normal communication with the unmanned aerial vehicle is not required, the upgrading is not influenced by the outside, and the upgrading reliability is improved.
However, this method needs to be transferred and then upgraded, which affects the upgrade efficiency.
In order to solve the above problem, embodiments of the present application provide a battery firmware processing method, which employs a policy that battery firmware upgrade and battery firmware backup are performed simultaneously, so that it is not necessary to first transfer battery firmware data and then perform firmware upgrade, thereby improving firmware upgrade efficiency, and the method will be described in detail below.
Referring to fig. 1, fig. 1 shows a block schematic diagram of a smart battery 10 provided in an embodiment of the present application. The intelligent battery 10 comprises a processor 11, an internal memory 12, a bus 13, a communication interface 14 and an external memory 15, wherein the processor 11 is connected with the external memory 15 through the bus 13, and the intelligent battery 10 is in communication connection with the unmanned aerial vehicle through the communication interface 14.
The internal memory 12 is used for storing programs, such as a battery firmware processing device, the battery firmware processing device includes at least one software functional module which can be stored in the internal memory 12 in a form of software or firmware (firmware), and the processor 11 executes the programs after receiving execution instructions to implement the battery firmware processing method disclosed in the embodiment of the present application.
The internal memory 12 is also used for storing the firmware of the smart battery, and when the smart battery needs to be upgraded, the upgraded firmware of the smart battery is overlaid on the firmware of the smart battery in the internal memory 12, so that the upgrade of the smart battery is realized.
The internal Memory 12 includes a Random Access Memory (RAM), a non-volatile Memory (NVM), and a flash Memory, and the battery firmware processing device may be generally stored in the RAM or the NVM in the internal Memory, and the smart battery firmware is generally stored in a flash storage medium in the internal Memory.
The processor 11 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware or instructions in the form of software in the processor 11. The processor 11 may be a general-purpose processor, and includes a Central Processing Unit (CPU), a Micro Control Unit (MCU), a Complex Programmable Logic Device (CPLD), a Field Programmable Gate Array (FPGA), and an embedded ARM.
The external memory 15 may be an EEPROM memory, and the external memory 15 includes a backup area for backing up battery firmware data, where the backup area includes a first backup area and a second backup area, and battery firmware data is backed up through the two backup areas, so that it can be ensured that when the battery firmware is lost due to an upgrade failure of the smart battery, at least one available battery firmware data exists to automatically recover the battery firmware, thereby improving the reliability of the upgrade of the smart battery.
Referring to fig. 2, fig. 2 shows a flow chart of a battery firmware processing method provided in an embodiment of the present application, where the method includes the following steps:
and step S101, acquiring battery firmware data sent by the unmanned aerial vehicle.
In this embodiment, the smart battery 10 is in communication connection with the unmanned aerial vehicle, and the unmanned aerial vehicle can acquire battery firmware data from a server or a cloud and send the acquired battery firmware data to the smart battery 10.
In this embodiment, after the smart battery 10 receives the battery firmware data, the battery firmware data may be directly overwritten with the existing battery firmware data in the smart battery to complete the upgrade of the smart battery 10, where the existing battery firmware data is pre-stored in the internal memory 12 in fig. 1. During the upgrade process, the smart battery 10 also backs up the battery firmware data, for example, to the external memory 15, so that the firmware of the smart battery 10 can be recovered in time through the battery firmware data backed up this time when the upgrade fails.
As a specific implementation manner, when the unmanned aerial vehicle sends the battery firmware data to the smart battery, a data block with a preset size may be sent to the smart battery 10 each time, and each time the smart battery 10 receives one data block, the data block is checked first, and after the check is passed, the data block is covered to a data block corresponding to the existing battery firmware data in the internal memory 12, and meanwhile, the data block that is passed through the check is backed up to the external memory 15. For example, the total size of the battery firmware data is 100KB, each time the unmanned aerial vehicle sends a 10KB data block to the smart battery, the smart battery 10 checks after receiving the first data block, and after checking, the first data block is covered to the previous 10KB data of the existing battery firmware data, and meanwhile, the first data block is backed up, and the second data block is processed in the same manner until the last data block is processed.
It can be understood that, when the data block is verified, if the verification fails, retry may be performed, that is, the data block is read again for verification, if the verification fails for a preset number of retries, the verification fails, and if the verification fails, the current upgrade of the battery firmware is stopped, and a firmware recovery process is started, where a specific firmware recovery process will be described below.
Step S102, if at least one of the first backup area and the second backup area does not have backup data, the backup area without the backup data is used as a target backup area.
In this embodiment, the absence of backup data in the backup area means that the backup area has not been written with backup data, for example, when the smart battery 10 is initialized, i.e., when the smart battery firmware data is first burned into the internal memory 12, neither the first backup area nor the second backup area has been written with backup data. As a specific embodiment, after the initialization of the smart battery 10 is completed, the current battery firmware data in the internal memory 12 may be backed up to the external memory 15 at a preset time (for example, when the drone is idle), so that the firmware of the smart battery 10 is recovered by using the backup data when the next upgrade fails.
In this embodiment, the target backup area is a backup area that needs to be used for backing up the battery firmware data this time, for example, the first backup area already stores backup data D1 when firmware of the smart battery 10 is upgraded at time T1, the second backup area does not yet store backup data, firmware of the smart battery 10 is upgraded at time T2, and the battery firmware data at this time is D2, and the second backup area is used as the target backup area, that is, D2 is backed up to the second backup area.
It should be noted that, when no backup data exists in the first backup area and the second backup area, one of the first backup area and the second backup area is randomly selected as the target backup area, or the first backup area or the second backup area is set as a default backup area in advance, and the default backup area is set as the target backup area.
Step S103, backing up the battery firmware data to the target backup area.
According to the battery firmware processing method provided by the embodiment of the application, due to the adoption of the strategy that the battery firmware upgrading and the battery firmware backup are carried out simultaneously, the battery firmware data does not need to be transferred and then the firmware upgrading is carried out, the firmware upgrading efficiency is improved, meanwhile, due to the adoption of the two backup areas, when the battery firmware is lost due to the abnormal upgrading, the battery firmware can be recovered through the backup data in one of the two backup areas, and the reliability of the battery firmware upgrading is improved.
In this embodiment, when backup data exists in both the first backup area and the second backup area, in order to ensure reliability of the backup data to the maximum extent and further ensure reliability of upgrade, on the basis of fig. 2, an embodiment of the present application further provides another implementation manner for determining a target backup area in this scenario, please refer to fig. 3, where fig. 3 shows a flowchart of another battery firmware processing method provided in the embodiment of the present application, and the method further includes the following steps:
step S104, if the first backup area and the second backup area both have backup data, the backup time and the backup data of the last backup of the first backup area and the backup time and the backup data of the last backup of the second backup area are obtained.
In this embodiment, for example, when the smart battery 10 performs firmware upgrade at time T1, the backup data D1 is stored in the first backup area, when the firmware upgrade is performed at time T2, the backup data D2 is stored in the second backup area, and when the firmware upgrade is performed again at time T3, the backup data exists in both the first backup area and the second backup area. The latest backup time of the first backup area is T1, the backup data is D1, the latest backup time of the second backup area is T2, the backup data is D2, and D1 and D2 may be the same or different.
Step S105, determining a target backup area according to the backup time and the backup data of the first backup area and the backup time and the backup data of the second backup area.
In this embodiment, as a specific implementation manner, the method for determining the target backup area may be:
firstly, integrity check is carried out on the backup data of the first backup area and the backup data of the second backup area.
In this embodiment, the backup data in the first backup area or the backup data in the second backup area may be accidentally destroyed after being stored, and in order to preferentially ensure that at least one complete backup data is reserved in the two backup areas, the backup area with incomplete backup data is preferentially selected as the target backup area.
In this embodiment, the integrity check of the backup data may be implemented by storing, at a preset position of each backup area, summary data of the backup data calculated by a preset algorithm, reading the backup data of the backup area when the integrity check of the backup data is performed, recalculating a summary data according to the preset algorithm, comparing the summary data calculated this time with the summary data stored in advance, if the summary data is consistent with the summary data stored in advance, determining that the backup data passes the integrity check, otherwise, determining that the backup data does not pass the integrity check, and the backup data may be accidentally damaged after being stored. The integrity check may be performed on the backup data in the first backup area and the backup data in the second backup area in the above manner, and of course, the integrity check may also be performed in other manners, for example, the MD5 that uses the backup data determines whether the backup passes the integrity check by comparing whether the MD5 calculated this time is consistent with the MD5 stored before.
And secondly, if the backup data of at least one backup area does not pass the integrity check, taking the backup area corresponding to the backup data which does not pass the integrity check as a target backup area.
And finally, if the backup data of the first backup area and the backup data of the second backup area both pass the integrity check, taking the backup area with earlier backup time as the target backup area.
In this embodiment, if the backup data of the first backup area and the backup data of the second backup area are both complete, in order to ensure that the backup data of the last backup is recovered as much as possible when the upgrade fails, the backup area with an earlier backup time may be selected as the target backup area.
It should be noted that, as another implementation, if the backup data of the first backup area and the backup data of the second backup area are both complete, the version numbers of the two backup areas may also be compared, the version number of the first backup area and the version number of the second backup area are selected as the target backup area, and the backup data of the second backup area and the version number of the old backup area are selected as the target backup area, so that the firmware of the latest version is recovered when the next upgrade fails, that is, the smart battery 10 is recovered to the firmware of the latest version number.
According to the battery firmware processing method provided by the embodiment of the application, the target backup area is determined according to the backup time and the backup data of the first backup area and the backup time and the backup data of the second backup area, so that the final backup area can keep a backup data which is complete or latest in backup time or a backup data which is complete and latest in backup time, and the reliability of upgrading is further ensured.
In this embodiment, when a current firmware is lost due to an abnormality occurring in a battery firmware during an upgrade process, an intelligent battery is not available, and the intelligent battery 10 cannot communicate with an unmanned aerial vehicle any more, in order to automatically restore the intelligent battery to an available state, this embodiment further provides a method for restoring the firmware of the intelligent battery 10, please refer to fig. 4, where fig. 4 shows a flowchart of another battery firmware processing method provided in this embodiment, and the method further includes the following steps:
step S201, when it is detected that the current firmware is lost, determining a target recovery area according to the flag bit and the backup time of the first backup area and the flag bit and the backup time of the second backup area.
In this embodiment, each backup area includes a flag bit for representing whether backup data in the backup area is complete, as a specific implementation manner, the flag bit may adopt 3 different values for representing the integrity of the backup data, if the backup data does not exist in the backup area, the flag bit is set to 0, if an abnormality occurs in the process of backing up the data to the backup area, which results in incomplete data in the backup area, the flag bit is set to 1, and if an abnormality does not occur in the process of backing up the data to the backup area, which results in successful data backup, the flag bit is set to 2.
It should be noted that, in the above description, only one specific implementation manner in which the flag bit represents whether the backup data is complete is described, and in fact, a person skilled in the art may also use other manners to achieve the same purpose of representing whether the backup data is complete according to actual needs, for example, a character string "init" is used to indicate that the backup data does not exist in the backup area, a character string "normal" is used to indicate that the backup data in the backup area is complete, and a character string "abnormal" is used to indicate that the backup data in the backup area is incomplete.
And step S202, performing firmware recovery on the intelligent battery by using the battery firmware data in the target recovery area.
In the present embodiment, the backup data in the external memory 15 of the smart battery 10 is copied to the storage location of the current battery firmware data in the internal memory 12 of the smart battery 10, i.e., the firmware recovery of the smart battery 10 is completed. For example, the target recovery area is the first backup area, where the backup data is D1, the current battery firmware data is stored in the 0x10000 position of the internal memory 12, and the firmware recovery for the smart battery 10 is to copy D1 to the 0x10000 position of the internal memory 12.
It should be noted that, when the firmware of the smart battery is recovered, to avoid that the firmware is failed to be recovered due to the fact that the backup data is damaged, a method of recovering while checking may be adopted, for example, a data block with a preset size is read from the target recovery area, the data block is checked, after the check is passed, the data block is copied to a corresponding position of the current battery firmware data in the internal memory 12, and then a data block with a preset size is sequentially read until all the backup data in the target recovery area are copied to the internal memory 12, so as to complete the firmware recovery. Referring to fig. 5, fig. 5 shows a comparison example of the firmware before and after recovery provided by the embodiment of the present application, in fig. 5, a way of performing a side check and side recovery is adopted, first, B1 in the external memory 15 is read, B1 is checked, B1 is written into a position of a1 of the internal memory 12, then, B2 is read, B2 is checked, B2 is written into a position of a2 of the internal memory 12, finally, B3 is read, B3 is checked, B3 is written into a position of A3 of the internal memory 12, and thus, the firmware recovery is completed.
It can be understood that, in the process of the check-while-recovery, if any data block fails to be checked, the firmware recovery process is not continued. In order to ensure that the firmware recovery is successful as much as possible, at this time, whether the backup data in another backup area other than the target recovery area is complete may be determined again, and if so, the firmware recovery using the backup data may be attempted. Of course, retry may be performed when the verification fails, that is, the data block is read again and verified again, and when the retry fails for the preset number of times, the data block is determined to have failed verification.
According to the battery firmware processing method provided by the embodiment of the application, when the current firmware is lost and the intelligent battery is unavailable due to the abnormality of the battery firmware in the upgrading process, the most appropriate backup data for firmware recovery is found by using the zone bit and the backup time of the first backup area and the zone bit and the backup time of the second backup area, so that the upgrading reliability of the intelligent battery is ensured.
In this embodiment, in order to ensure that the firmware is successfully recovered as much as possible and that the firmware can be recovered to the state of the latest successful upgrade when the firmware is recovered, an embodiment of the present application further provides a specific implementation manner of determining the target recovery area, please refer to fig. 6, where step S201 includes the following sub-steps:
in the substep S2010, whether the backup data in the first backup area is complete is determined according to the flag bit of the first backup area.
In the sub-step S2011, it is determined whether the backup data in the second backup area is complete according to the flag bit in the second backup area.
In the substep S2012, if there is a backup area with complete backup data in the first backup area and the second backup area, the backup area with complete backup data is used as the target recovery area.
In this embodiment, it is first ensured that the backup data used for firmware recovery is complete, so as to avoid failure of firmware recovery due to the fact that firmware recovery is performed by using incomplete backup data.
And step S2013, if the backup data of the first backup area and the backup data of the second backup area are complete, the backup area with the later backup time is used as the target recovery area.
In this embodiment, when both backup data are complete, the backup data with the later backup time is selected as the data for firmware recovery, so as to recover the smart battery to the last successful backup state.
If both backup data are complete, the latest version corresponding to the backup data may be selected as the data for firmware recovery, so as to restore the smart battery to the latest version.
In the battery firmware processing method provided in the embodiment of the application, when the firmware is restored, the backup area with complete backup data or complete backup data and late backup time is determined from the first backup area and the second backup area as the target restoration area, so as to ensure that the firmware is restored successfully as much as possible and restore to the state when the latest upgrade was successful as much as possible.
In order to execute the corresponding steps in the above-mentioned battery firmware processing method embodiments and various possible embodiments, an implementation manner of the battery firmware processing apparatus is given below. Referring to fig. 7, fig. 7 is a block diagram illustrating a battery firmware processing apparatus 100 according to an embodiment of the present disclosure. The battery firmware processing device 100 is applied to a smart battery, and the battery firmware processing device 100 includes: an acquisition module 110, a determination module 120, a backup module 130, and a restore module 140.
The obtaining module 110 is configured to obtain battery firmware data sent by the drone.
The determining module 120 is configured to, if at least one of the first backup area and the second backup area does not have the backup data, use the backup area without the backup data as the target backup area.
Optionally, the determining module 120 is further configured to: if the first backup area and the second backup area both have backup data, acquiring the backup time and the backup data of the first backup area and the backup time and the backup data of the second backup area; and determining the target backup area according to the backup time and the backup data of the first backup area and the backup time and the backup data of the second backup area.
Optionally, when the determining module 120 performs the step of determining the target backup area according to the backup time and the backup data of the first backup area and the backup time and the backup data of the second backup area, it is specifically configured to: carrying out integrity check on the backup data of the first backup area and the backup data of the second backup area; if the backup data of at least one backup area does not pass the integrity check, taking the backup area corresponding to the backup data which does not pass the integrity check as a target backup area; and if the backup data of the first backup area and the backup data of the second backup area both pass the integrity check, taking the backup area with earlier backup time as the target backup area.
The backup module 130 is configured to backup the battery firmware data to the target backup area.
A recovery module 140 for: when the loss of the current firmware is detected, determining a target recovery area according to the zone bit and the backup time of the first backup area and the zone bit and the backup time of the second backup area; and performing firmware recovery on the intelligent battery by using the battery firmware data in the target recovery area, wherein each backup area comprises a flag bit for representing whether the backup data in each backup area is complete or not.
Optionally, the recovery module 140 is specifically configured to: judging whether the backup data of the first backup area is complete according to the zone bit of the first backup area; judging whether the backup data of the second backup area is complete according to the zone bit of the second backup area; if one backup area with complete backup data exists in the first backup area and the second backup area, taking the backup area with complete backup data as a target recovery area; and if the backup data of the first backup area and the backup data of the second backup area are complete, taking the backup area with later backup time as a target recovery area.
The embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by the processor 11, the method for processing the battery firmware disclosed in the foregoing embodiment is implemented.
To sum up, the battery firmware processing method and apparatus, the intelligent battery and the storage medium provided by the present application include a backup area for backing up battery firmware data, where the backup area includes a first backup area and a second backup area, and the battery firmware data sent by the unmanned aerial vehicle is acquired when the intelligent battery is in a firmware upgrade process, and if at least one of the first backup area and the second backup area has no backup data, the backup area without the backup data is used as a target backup area, and finally the battery firmware data is backed up to the target backup area. Compared with the prior art, the strategy that the battery firmware upgrading and the battery firmware backup are carried out simultaneously is adopted, so that the battery firmware data does not need to be stored firstly and then the firmware upgrading is carried out, the firmware upgrading efficiency is improved, and meanwhile, due to the adoption of the two backup areas, when the battery firmware is lost due to the abnormal upgrading, the battery firmware can be recovered through the backup data in one of the two backup areas, and the reliability of the battery firmware upgrading is improved.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present application should be covered within the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims (10)
1. A battery firmware processing method is applied to an intelligent battery, the intelligent battery comprises a backup area for backing up battery firmware data, the backup area comprises a first backup area and a second backup area, the intelligent battery is in communication connection with an unmanned aerial vehicle, the intelligent battery is in a firmware upgrading process, and the method comprises the following steps:
acquiring battery firmware data sent by the unmanned aerial vehicle;
if at least one of the first backup area and the second backup area does not have backup data, taking the backup area without the backup data as a target backup area;
and backing up the battery firmware data to the target backup area.
2. The battery firmware processing method of claim 1, wherein the method further comprises:
if the first backup area and the second backup area both have backup data, acquiring backup time and backup data of the first backup area and backup time and backup data of the second backup area;
and determining the target backup area according to the backup time and the backup data of the first backup area and the backup time and the backup data of the second backup area.
3. The battery firmware processing method according to claim 2, wherein the step of determining the target backup area according to the backup time and the backup data of the first backup area and the backup time and the backup data of the second backup area comprises:
performing integrity check on the backup data of the first backup area and the backup data of the second backup area;
if the backup data of at least one backup area does not pass the integrity check, taking the backup area corresponding to the backup data which does not pass the integrity check as the target backup area;
and if the backup data of the first backup area and the backup data of the second backup area both pass the integrity check, taking the backup area with earlier backup time as the target backup area.
4. The battery firmware processing method according to claim 2, wherein each of the backup areas includes a flag bit for indicating whether the backup data in each of the backup areas is complete, the method further comprising:
when the loss of the current firmware is detected, determining a target recovery area according to the zone bit and the backup time of the first backup area and the zone bit and the backup time of the second backup area;
and recovering the firmware of the intelligent battery by using the battery firmware data in the target recovery area.
5. The battery firmware processing method according to claim 4, wherein the step of determining the target recovery area according to the flag bit and the backup time of the first backup area and the flag bit and the backup time of the second backup area comprises:
judging whether the backup data of the first backup area is complete according to the zone bit of the first backup area;
judging whether the backup data of the second backup area is complete according to the zone bit of the second backup area;
if one backup area with complete backup data exists in the first backup area and the second backup area, taking the backup area with complete backup data as the target recovery area;
and if the backup data of the first backup area and the backup data of the second backup area are complete, taking the backup area with later backup time as the target recovery area.
6. The utility model provides a battery firmware processing apparatus, its characterized in that is applied to intelligent battery, intelligent battery is including the backup area that is used for backup battery firmware data, the backup area includes first backup area and second backup area, intelligent battery and unmanned aerial vehicle communication connection, intelligent battery is in the firmware upgrade in-process, the device includes:
the acquisition module is used for acquiring battery firmware data sent by the unmanned aerial vehicle;
the determining module is used for taking the backup area without the backup data as a target backup area if at least one of the first backup area and the second backup area does not have the backup data;
and the backup module is used for backing up the battery firmware data to the target backup area.
7. The battery firmware processing apparatus of claim 6, wherein the determination module is further to:
if the first backup area and the second backup area both have backup data, acquiring backup time and backup data of the first backup area and backup time and backup data of the second backup area;
and determining the target backup area according to the backup time and the backup data of the first backup area and the backup time and the backup data of the second backup area.
8. The battery firmware processing apparatus of claim 7, wherein the determining module is specifically configured to:
performing integrity check on the backup data of the first backup area and the backup data of the second backup area;
if the backup data of at least one backup area does not pass the integrity check, taking the backup area corresponding to the backup data which does not pass the integrity check as the target backup area;
and if the backup data of the first backup area and the backup data of the second backup area both pass the integrity check, taking the backup area with earlier backup time as the target backup area.
9. A smart battery, comprising:
one or more processors;
memory to store one or more programs that, when executed by the one or more processors, cause the one or more processors to implement the battery firmware processing method of any of claims 1-5.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out a battery firmware processing method according to any one of claims 1 to 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011112224.3A CN112230959A (en) | 2020-10-16 | 2020-10-16 | Battery firmware processing method and device, intelligent battery and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011112224.3A CN112230959A (en) | 2020-10-16 | 2020-10-16 | Battery firmware processing method and device, intelligent battery and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN112230959A true CN112230959A (en) | 2021-01-15 |
Family
ID=74118861
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011112224.3A Pending CN112230959A (en) | 2020-10-16 | 2020-10-16 | Battery firmware processing method and device, intelligent battery and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112230959A (en) |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6684396B1 (en) * | 2000-02-16 | 2004-01-27 | Data Connection Limited | Method for upgrading running software processes without compromising fault-tolerance |
CN102339227A (en) * | 2010-07-28 | 2012-02-01 | 环旭电子股份有限公司 | Multi-firmware embedded system and firmware update method thereof |
CN105653299A (en) * | 2014-11-12 | 2016-06-08 | 杭州华三通信技术有限公司 | Firmware upgrade method device |
CN106874033A (en) * | 2017-01-05 | 2017-06-20 | 重庆零度智控智能科技有限公司 | The firmware upgrade method of UAV Intelligent battery, device and intelligent battery |
CN110874237A (en) * | 2019-12-30 | 2020-03-10 | 深圳市英博超算科技有限公司 | Software upgrading method, device, terminal and readable storage medium |
CN111221553A (en) * | 2019-12-31 | 2020-06-02 | 深圳优地科技有限公司 | Firmware upgrading method and device |
-
2020
- 2020-10-16 CN CN202011112224.3A patent/CN112230959A/en active Pending
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6684396B1 (en) * | 2000-02-16 | 2004-01-27 | Data Connection Limited | Method for upgrading running software processes without compromising fault-tolerance |
CN102339227A (en) * | 2010-07-28 | 2012-02-01 | 环旭电子股份有限公司 | Multi-firmware embedded system and firmware update method thereof |
CN105653299A (en) * | 2014-11-12 | 2016-06-08 | 杭州华三通信技术有限公司 | Firmware upgrade method device |
CN106874033A (en) * | 2017-01-05 | 2017-06-20 | 重庆零度智控智能科技有限公司 | The firmware upgrade method of UAV Intelligent battery, device and intelligent battery |
CN110874237A (en) * | 2019-12-30 | 2020-03-10 | 深圳市英博超算科技有限公司 | Software upgrading method, device, terminal and readable storage medium |
CN111221553A (en) * | 2019-12-31 | 2020-06-02 | 深圳优地科技有限公司 | Firmware upgrading method and device |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN104834575B (en) | A kind of firmware restoration method and device | |
CN101593083B (en) | device, computer and method for protecting and restoring computer configuration information | |
CN109032632B (en) | FOTA upgrading method, wireless communication terminal and storage medium | |
CN106775610B (en) | Electronic equipment starting method and electronic equipment | |
US8341390B2 (en) | Computer system and method for backing up BIOS settings | |
JP2730534B2 (en) | Data backup method and apparatus for data communication network terminal | |
CN104636217A (en) | Root file system automatic backup and exception recovery method and partition structure | |
CN111309524A (en) | Distributed storage system fault recovery method, device, terminal and storage medium | |
CN108345464A (en) | A kind of the startup method and Android vehicle device of Android system | |
CN104063477A (en) | Processing method and processing device for startup abnormalities of embedded system | |
WO2012031567A1 (en) | Fault tolerance method and device for file system | |
CN114116280A (en) | Interactive BMC self-recovery method, system, terminal and storage medium | |
US6081892A (en) | Initial program load | |
CN111813753A (en) | File saving method, file restoring method, device and terminal equipment | |
EP3895939B1 (en) | Electronic control device and security verification method for electronic control device | |
CN115309589A (en) | Method, system and device for recovering temporary storage area of substrate management controller | |
CN108255644B (en) | File system recovery method and device | |
CN111090443A (en) | Method, equipment and storage medium for guaranteeing safe upgrade of linux system | |
CN112230959A (en) | Battery firmware processing method and device, intelligent battery and storage medium | |
CN113176891B (en) | Bootloader-based ECU (electronic control Unit) program programming method with backup function | |
WO2021115117A1 (en) | File backup method and device, file recovery method and device, and file update method and device | |
US20190171534A1 (en) | Method of error correction in a flash memory | |
CN213751052U (en) | Dual-core chip capable of performing program backup and recovery | |
CN111783162B (en) | Data protection implementation method and device and computer equipment | |
CN114185706A (en) | Lithium battery detection terminal system fault self-recovery method and system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
CB02 | Change of applicant information |
Address after: 510000 Block C, 115 Gaopu Road, Tianhe District, Guangzhou City, Guangdong Province Applicant after: XAG Co., Ltd. Address before: 510000 Block C, 115 Gaopu Road, Tianhe District, Guangzhou City, Guangdong Province Applicant before: Guangzhou Xaircraft Technology Co.,Ltd. |
|
CB02 | Change of applicant information |