Firmware upgrading method, communication module, electronic equipment and storage medium

By backing up the target file in the communication module and writing the upgrade file in the nonvolatile memory, the file corruption problem caused by power outage or failure during the firmware upgrade process is solved, ensuring the stability and efficiency of the upgrade.

CN119046057APending Publication Date: 2024-11-29FIBOCOM TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411095484.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-09
Publication Date
2024-11-29

AI Technical Summary

Technical Problem

During the firmware upgrade process, the communication module is prone to file damage due to power outage or other faults, which affects the upgrade effect and module startup.

Method used

Provide a firmware upgrade method, by determining whether the target file has been backed up and backing it up to the backup partition of non-volatile memory when it is not backed up, obtaining and writing the upgrade file for firmware upgrade, ensuring that it remains in the event of a failure. There are full backup files available for upgrade.

Benefits of technology

Ensure data integrity and stability during firmware upgrade process, and even if a failure occurs during the write process, the backup file can be upgraded, avoiding the problem of upgrade failure and module failure caused by file corruption, and improving Backup and upgrade efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119046057A_ABST
    Figure CN119046057A_ABST
Patent Text Reader

Abstract

The invention provides a firmware upgrading method, a communication module, electronic equipment and a storage medium. The firmware upgrading method comprises the following steps: judging whether a target file is backed up or not; when the target file is not backed up, backing up the target file to a backup partition of a nonvolatile memory to obtain a backup file; obtaining an upgrade file corresponding to the target file; and at least writing the upgrading file into a target partition of the nonvolatile memory to perform firmware upgrading.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of firmware upgrade, and in particular to a firmware upgrade method, a communication module, an electronic device and a storage medium. Background Art

[0002] Communication module products usually need to upgrade the module firmware to optimize product performance, fix security vulnerabilities and improve user experience. However, during the firmware file upgrade process, the communication module may encounter power outages, such as power outages, user mistakenly removing the battery, etc., which may cause file corruption, affect the upgrade effect, and even cause the upgrade to fail and the communication module to fail to start normally. Summary of the invention

[0003] In order to solve the above technical problems, the present application provides a firmware upgrade method, a communication module, an electronic device and a storage medium.

[0004] The first aspect of the present application provides a firmware upgrade method, which includes the following steps: determining whether a target file has been backed up; when the target file has not been backed up, backing up the target file to a backup partition of a non-volatile memory to obtain a backup file; obtaining an upgrade file corresponding to the target file; and at least writing the upgrade file to the target partition of the non-volatile memory to perform a firmware upgrade.

[0005] The second aspect of the present application provides a communication module, which includes a non-volatile memory, a judgment module, a backup module, an acquisition module, and a writing module. The judgment module is used to judge whether the target file has been backed up, the backup module is used to back up the target file to the backup partition of the non-volatile memory to obtain a backup file when the target file has not been backed up, the acquisition module is used to obtain the upgrade file corresponding to the target file, and the writing module is used to write the upgrade file to the target partition of the non-volatile memory to perform a firmware upgrade.

[0006] A third aspect of the present application provides an electronic device, the electronic device comprising a memory and a processor, the memory storing a computer program, and the processor being used to call the computer program to execute the firmware upgrade method provided in the first aspect.

[0007] A fourth aspect of the present application provides a storage medium, wherein the storage medium stores a computer program, and the computer program is used to be called by a processor to execute the firmware upgrade method provided in the first aspect.

[0008] The firmware upgrade method, communication module, electronic device and storage medium provided by the present application obtain the backup file by backing up the target file to the non-volatile memory, and at least write the upgrade file to the non-volatile memory for firmware upgrade after the backup is completed, so that even if the power is lost or other faults occur during the process of writing the upgrade file to the non-volatile memory, resulting in damage to the target file, the non-volatile memory still stores a complete backup file of the target file, so that the backup file can be used for firmware upgrade, avoiding the problem that the firmware upgrade cannot be performed when the target file is damaged and the communication module cannot be started normally. In addition, since the embodiment of the present application backs up the target file to the non-volatile memory and then writes at least the upgrade file to the non-volatile memory, even if power is lost or other faults occur during the backup process, the target file will not be damaged, and the target file can be used for upgrade after power is turned on again, and the communication module can be started normally. In addition, before performing the firmware upgrade, the embodiment of the present application first determines whether the target file has been backed up, and performs the backup operation only when the target file has not been backed up, which can improve the file backup efficiency, thereby improving the firmware upgrade efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0009] In order to more clearly illustrate the technical solution of the present application, the drawings required for use in the implementation manner will be briefly introduced below. Obviously, the drawings described below are some implementation manners of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0010] Figure 1 A flowchart of a firmware upgrade method provided in one embodiment of the present application.

[0011] Figure 2 FIG. 4 is a flowchart of detailed steps of step S1a in an example.

[0012] Figure 3 FIG. 4 is a flowchart of detailed steps of step S2a in an example.

[0013] Figure 4 FIG. 4 is a flowchart of detailed steps of step S4a in an example.

[0014] Figure 5 A flowchart of a firmware upgrade method provided in another embodiment of the present application.

[0015] Figure 6 This is a structural block diagram of a communication module provided in one embodiment of the present application. DETAILED DESCRIPTION

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

[0017] In the description of the present application, the terms "first", "second", etc. are used to distinguish different objects rather than to describe a specific order. In addition, the terms "upper", "inner", "outer", etc. indicate directions or positional relationships based on the directions or positional relationships shown in the accompanying drawings. They are only for the convenience of describing the present application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific direction, be constructed and operated in a specific direction. Therefore, they cannot be understood as limitations on the present application.

[0018] In the description of this application, unless otherwise clearly specified and limited, the term "connection" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a direct connection, an indirect connection through an intermediate medium, or the internal connection of two components; it can be a communication connection; it can be an electrical connection. For ordinary technicians in this field, the specific meanings of the above terms in this application can be understood according to specific circumstances.

[0019] See also Figure 1 , Figure 1 This is a flowchart of a firmware upgrade method provided by an embodiment of the present application. Figure 1 As shown, the firmware upgrade method includes the following steps:

[0020] S1a: Determine whether the target file has been backed up.

[0021] S2a: When the target file has not been backed up, back up the target file to a backup partition of a non-volatile memory to obtain a backup file.

[0022] S3a: Obtain the upgrade file corresponding to the target file.

[0023] S4a: writing at least the upgrade file into the target partition of the non-volatile memory to perform firmware upgrade.

[0024] The firmware upgrade method provided by the embodiment of the present application backs up the target file to the non-volatile memory to obtain the backup file, and at least writes the upgrade file to the non-volatile memory for firmware upgrade after the backup is completed, so that even if the power is lost or other faults occur during the process of writing the upgrade file to the non-volatile memory, resulting in damage to the target file, the non-volatile memory still stores a complete backup file of the target file, so that the backup file can be used to upgrade the firmware, avoiding the problem that the firmware upgrade cannot be performed when the target file is damaged and the communication module cannot be started normally. In addition, since the embodiment of the present application backs up the target file to the non-volatile memory and then writes at least the upgrade file to the non-volatile memory, even if power is lost or other faults occur during the backup process, the target file will not be damaged, and the target file can be used for upgrading after power is turned on again, and the communication module can be started normally. In addition, before performing the firmware upgrade, the embodiment of the present application first determines whether the target file has been backed up, and performs the backup operation only when the target file has not been backed up, which can improve the file backup efficiency, thereby improving the firmware upgrade efficiency.

[0025] The target file may be any file that needs to be upgraded. The non-volatile memory may include at least one of a read-only memory (ROM), a flash memory (Flash Memory) and a solid state drive (SSD). Other types of non-volatile memory may also be used.

[0026] The execution order of step S3a, step S1a and step S2a is not limited.

[0027] In some embodiments, after backing up the target file to the backup partition to obtain the backup file, the firmware upgrade method further includes the step of setting the target file flag to a first flag and storing the first flag in the backup partition, wherein the first flag is used to determine whether the target file has been backed up. Step S4a may be performed after this step is performed, so that even if a power outage or other failure occurs when this step is performed, the target file can still be used for backup because the target file is not damaged.

[0028] For example, the first flag is set to 1. Obviously, it can also be set to other values ​​according to requirements.

[0029] After backing up the target file to obtain the backup file, setting the first flag on the target file facilitates subsequent determination of whether the target file has been backed up by detecting the first flag. Furthermore, the first flag is stored in the non-volatile memory, and even if power is lost or other failures occur, the first flag will not be lost, so it can be continuously and reliably used to determine whether the target file has been backed up.

[0030] See also Figure 2 , is a flowchart of the detailed steps of step S1a in an example. In some embodiments, Figure 2 As shown, the determination of whether the target file has been backed up includes the following steps:

[0031] S11a: Obtain the flag of the target file.

[0032] S12a: Determine whether the acquired mark of the target file is the first mark. If the mark of the target file is the first mark, execute step S13a; if the mark of the target file is not the first mark, execute step S14a.

[0033] S13a: Determine that the target file has been backed up.

[0034] S14a: Determine that the target file has not been backed up.

[0035] Exemplarily, the first flag is 1, and when the flag of the target file is obtained to be 1, it is determined that the target file has been backed up; when the flag of the target file is not 1, it is determined that the target file has not been backed up.

[0036] By judging whether the target file is backed up according to the flag of the target file, the backup status of the target file can be quickly acquired, which simplifies the judgment process of the backup status of the target file. Moreover, the first flag set occupies little space, which is beneficial to improving the space utilization of the non-volatile memory.

[0037] In some embodiments, after backing up the target file to a backup partition of a non-volatile memory to obtain a backup file, the firmware upgrade method further includes the step of: checking the backup file backed up to the backup partition to determine whether the backup file is normal.

[0038] Specifically, a hash function can be used to calculate the hash value corresponding to the backup file, and then the hash value corresponding to the backup file is compared with the initial hash value corresponding to the target file. If the two hash values ​​are the same, it is determined that the backup file is normal; if the two hash values ​​are different, it is determined that the backup file is abnormal. Before the first firmware upgrade, the initial hash value corresponding to the target file can be calculated using a hash function. Since the firmware upgrade operation has not been performed at this time, the target file is in an initial state, that is, a normal state. The initial hash value corresponding to the target file reflects the target file in a normal state. Therefore, the initial hash value corresponding to the target file can be used to determine whether the backup file is normal. The MD5 (Message-Digest Algorithm 5) hash function can be used to calculate the corresponding MD5 hash value of the file; or, other types of hash functions can be used to calculate the corresponding hash value of the file, for example, a SHA series hash function, a CRC (Cyclic Redundancy Check) hash function, etc.

[0039] If the backup file obtained by the backup is abnormal, that is, the backup file is different from the target file, the hash value corresponding to the backup file will be different from the initial hash value corresponding to the target file.

[0040] The backup file may be abnormal due to damage, for example, the file is damaged during the creation, storage, and transmission of the backup file, resulting in the backup file being damaged. The backup file may also be abnormal due to incompleteness, for example, a power outage during the backup process causes the backup process to be incomplete, resulting in an incomplete backup file.

[0041] After backing up the target file to the backup partition, the backup file is checked to determine whether it is normal, so as to avoid continuing to execute step S4a when the backup file is abnormal. If the target file is damaged due to power failure or other faults during the execution of step S4a, the abnormal backup file may affect the normal startup of the communication module when the power is turned on again, and affect the operation of using the backup file for firmware upgrade.

[0042] In some embodiments, the aforementioned setting the target file flag as a first flag and storing the first flag in the backup partition includes: when the backup file backed up to the backup partition is normal, setting the target file flag as a first flag and storing the first flag in the backup partition. In some other embodiments, the first flag may be stored in other partitions of the non-volatile storage medium.

[0043] By setting the first flag and storing the first flag in the backup partition only when the backup file is normal, it is possible to avoid terminating the backup operation when the backup file is abnormal.

[0044] In some embodiments, the aforementioned step of writing at least the upgrade file to the target partition of the non-volatile memory for firmware upgrade includes: when the backup file backed up to the backup partition is normal, writing at least the upgrade file to the target partition of the non-volatile memory for firmware upgrade. Thus, during the process of writing at least the upgrade file to the target partition for firmware upgrade, if a power outage or other failure occurs, the normal backup file can meet the usage requirements.

[0045] See also Figure 3 , is a flowchart of the detailed steps of step S2a in an example. In some embodiments, Figure 3 As shown, when the target file is not backed up, backing up the target file to a backup partition of a non-volatile memory to obtain a backup file includes:

[0046] S21a: When the target file is not backed up, clear the files in the backup partition.

[0047] S22a: After clearing the files in the backup partition, backing up the target file to the backup partition to obtain the backup file.

[0048] If power failure or other failures occur during the last upgrade when backing up the target file to the backup partition, some of the data backed up during the last upgrade will remain in the backup partition. When the power is turned on again for backup, the remaining data will affect the backup operation of the target file during this upgrade, such as reducing the backup efficiency, or even causing the file backup to fail due to insufficient space in the backup partition. In the embodiment of the present application, the files in the backup partition are cleared before the backup, thereby preventing the residual data in the backup partition from affecting the backup operation and improving the storage space utilization of the backup partition, that is, improving the storage space utilization of the non-volatile memory.

[0049] See also Figure 4 , is a flowchart of the detailed steps of step S4a in an example. In some embodiments, Figure 4 As shown, the step of writing at least the upgrade file into the target partition of the non-volatile memory to perform the firmware upgrade comprises:

[0050] S41a: Clear files in the target partition.

[0051] S42a: After clearing the files in the target partition, at least write the upgrade file into the target partition to perform firmware upgrade.

[0052] If power failure or other failure occurs during the last upgrade when at least the upgrade file is written to the target partition, some of the data written during the last upgrade will remain in the target partition. When the power is turned on again for writing, the remaining data will affect the write operation during this upgrade, such as reducing the write efficiency, and may even cause the upgrade to fail due to insufficient space in the target partition. In the embodiment of the present application, before at least the upgrade file is written to the target partition, the file of the target partition is cleared, thereby avoiding the residual data in the target partition from affecting the write operation, i.e., the upgrade operation, and improving the storage space utilization of the target partition, i.e., further improving the storage space utilization of the non-volatile memory.

[0053] The target file may be one or more files of the current firmware version, and the upgrade file may be one or more files corresponding to the target file in the new firmware version. The upgrade file may be a replacement file, i.e., used to completely replace the target file; or, the upgrade file may be a difference file, i.e., a patch file, used to modify and / or add part of the target file.

[0054] In some embodiments, the upgrade file is a patch file, and the aforementioned at least writing the upgrade file to the target partition for firmware upgrade includes: writing the upgrade file and the target file to a volatile memory to obtain the upgraded target file, and writing the upgraded target file to the target partition for firmware upgrade. The upgraded target file will replace and update the target file in the target partition, thereby completing the upgrade.

[0055] Among them, since the volatile memory has a fast reading and writing speed, by first writing the upgrade file and the target file into the volatile memory, the upgrade efficiency of the target file can be improved. Since the data of the non-volatile memory will not be lost when the power is off, by writing the upgraded target file into the non-volatile memory, it can be ensured that the upgraded target file will not be lost, which can enhance the stability of the system and reduce the maintenance cost.

[0056] In some embodiments, the upgrade file is a replacement file, and the aforementioned at least writing the upgrade file to the target partition for firmware upgrade includes: writing the upgrade file to the target partition of the volatile memory and the non-volatile memory for firmware upgrade.

[0057] Among them, writing the upgrade file into the volatile memory can improve the upgrade efficiency, so that users can experience the new functions and improvements brought by the upgraded firmware more quickly. Writing the upgrade file into the target partition of the non-volatile memory to replace the target file in the target partition can ensure that the upgrade file is not lost when power is off.

[0058] The volatile memory may be a random access memory (RAM) or other types of volatile memory. The random access memory may include a dynamic random access memory and / or a static random access memory.

[0059] In some other embodiments, the upgrade file is a patch file or a replacement file, and the aforementioned at least writing the upgrade file into the target partition for firmware upgrade includes: directly writing the upgrade file into the target partition for firmware upgrade. It can be understood that the upgrade file is used in the target partition to perform an upgrade operation on the target file in the target partition. When the upgrade file is a patch file, the upgrade file will modify some files of the target file and / or add some files; when the upgrade file is a replacement file, the upgrade file will completely replace the target file.

[0060] In some embodiments, after at least writing the upgrade file to the target partition of the non-volatile memory for firmware upgrade, the firmware upgrade method further includes the steps of: clearing the backup file in the backup partition; and / or, setting the flag of the target file to a second flag, and storing the second flag in the backup partition, wherein the second flag is different from the first flag. By clearing the backup file, the storage space utilization rate of the backup partition can be improved. By setting the flag of the target file to the second flag, it is convenient to judge whether the target file has been backed up. Among them, the second flag can also be stored in other partitions of the non-volatile memory.

[0061] Exemplarily, after clearing the backup file in the backup partition, the flag of the target file is set to 0, that is, the second flag is 0. When the flag of the target file is 0, it is determined that the target file is not backed up. Obviously, the second flag can also be set to other values.

[0062] In some embodiments, before determining whether the target file has been backed up, the firmware upgrade method further includes the step of: checking the target file to determine whether the target file is normal. Determining whether the target file has been backed up includes: when the target file is normal, determining whether the target file has been backed up.

[0063] The target file is inspected. Specifically, a hash function can be used to calculate the hash value corresponding to the current target file, and then the hash value corresponding to the current target file is compared with the initial hash value corresponding to the aforementioned target file. If the two hash values ​​are the same, it is determined that the current target file is normal; if the two hash values ​​are different, it is determined that the current target file is abnormal. Since the initial hash value corresponding to the target file reflects the target file in a normal state, the initial hash value corresponding to the target file can be used to determine whether the current target file is normal. Among them, the MD5 (Message-Digest Algorithm 5) hash function can be used to calculate the file to obtain the corresponding MD5 hash value; or, other types of hash functions can be used to calculate the file to obtain the corresponding hash value, for example, SHA series hash functions, etc.

[0064] If the current target file is abnormal, that is, the current target file is different from the initial target file, the hash value corresponding to the current target file will be different from the initial hash value corresponding to the initial target file.

[0065] If power failure occurs when executing step S4a, the target file may be damaged and abnormal. There may be other situations that cause the target file to be abnormal, such as hardware failure, file system error, virus attack or improper user operation.

[0066] By judging whether the target file is normal before judging whether the target file has been backed up, it is possible to avoid backing up the target file when the target file is abnormal, thereby avoiding abnormal backup files.

[0067] In some embodiments, the step of writing at least the upgrade file to the target partition of the non-volatile memory for firmware upgrade includes: when the target file is normal, writing at least the upgrade file to the target partition of the non-volatile memory for firmware upgrade, thereby preventing abnormal target files from affecting the upgrade process.

[0068] Specifically, when the target file is normal, the target file and the upgrade file can be written into the volatile memory to obtain the upgraded target file, and the upgraded target file is written into the target partition, thereby preventing an abnormal target file from affecting the generation of the upgraded file and further affecting the process of writing into the target partition for upgrading.

[0069] In some embodiments, the firmware upgrade method further comprises the step of: when the target file is abnormal, obtaining a backup file in the backup partition. The step of writing at least the upgrade file to the target partition of the non-volatile memory for firmware upgrade comprises: when the target file is abnormal, writing the backup file and the upgrade file to the volatile memory to obtain an upgraded target file, and writing the upgraded target file to the target partition. That is, the backup file and the upgrade file are used to perform the firmware upgrade.

[0070] If power failure or other failure occurs during at least the process of writing the upgrade file to the target partition during the last upgrade, the target file may be damaged or incomplete. When the power is turned on again, by judging whether the target file is normal, and if it is judged to be abnormal, writing the backup file in the backup partition to the target partition can avoid upgrading the abnormal target file and achieve a successful upgrade. In the last upgrade, since power failure or other failure occurs during at least the process of writing the upgrade file to the target partition, the target file has been backed up in the backup partition at this time, so the backup file in the backup partition can be used for the upgrade operation after power is turned on again.

[0071] In some embodiments, before writing the backup file into the volatile memory, the firmware upgrade method further includes: checking the backup file to determine whether the backup file is normal.

[0072] Specifically, a hash function can be used to calculate the hash value corresponding to the backup file, and then the hash value corresponding to the backup file is compared with the initial hash value corresponding to the target file. If the two hash values ​​are the same, the backup file is determined to be normal; if the two hash values ​​are different, the backup file is determined to be abnormal. Since the initial hash value corresponding to the target file reflects the target file in a normal state, the initial hash value corresponding to the target file can be used to determine whether the backup file is normal. Among them, the MD5 (Message-Digest Algorithm 5) hash function can be used to calculate the file to obtain the corresponding MD5 hash value; or, other types of hash functions can be used to calculate the file to obtain the corresponding hash value, such as SHA series hash functions.

[0073] If during the aforementioned process of backing up the target file, the file is damaged or the backup process is not completed, the backup file may be abnormal.

[0074] Writing the backup file into the volatile memory includes: when the backup file is normal, writing the backup file into the volatile memory, thereby avoiding upgrading an abnormal backup file and further avoiding upgrade failure.

[0075] Wherein, when the backup file is abnormal, the upgrade operation is stopped, that is, the backup file is not written into the volatile memory.

[0076] In some embodiments, before at least writing the upgrade file to the target partition of the non-volatile memory for firmware upgrade, the firmware upgrade method further includes: verifying the upgrade file to determine whether the upgrade file matches the target file.

[0077] Among them, the differential package can be downloaded from the official website or software update tool, and the differential package includes the upgrade file. The upgrade file is the patch file corresponding to the target file. Upgrading the target file can be understood as patching the target file.

[0078] Verifying the upgrade file to determine whether the upgrade file matches the target file may be verifying the differential package to determine whether the differential package matches the target file. Specifically, the differential package includes a hash value corresponding to the old version of the firmware, and the hash value corresponding to the old version of the firmware in the differential package is compared with the hash value corresponding to the old version of the firmware stored in the communication module. If the two are the same, that is, the verification passes, the differential package matches the target file, that is, the upgrade file matches the target file; if the two are different, that is, the verification fails, the differential package does not match the target file, that is, the upgrade file does not match the target file.

[0079] The aforementioned step of at least writing the upgrade file into the target partition of the non-volatile memory for firmware upgrade includes: when the upgrade file matches the target file, writing the upgrade file into the target partition of the non-volatile memory for firmware upgrade, thereby avoiding upgrade failure caused by mismatch between the upgrade file and the target file.

[0080] In some embodiments, the firmware upgrade method further comprises the step of: when it is determined that the target file has been backed up, at least writing the upgrade file to the target partition for firmware upgrade. Thus, when the target file has been backed up, backing up again can be avoided, thereby improving the efficiency of firmware upgrade.

[0081] The target file and the upgrade file may be written into the volatile memory to obtain the upgraded target file, and then the upgraded target file may be written into the non-volatile memory.

[0082] See also Figure 5 , is a flowchart of a firmware upgrade method provided by another embodiment of the present application. In some embodiments, Figure 5 As shown, the firmware upgrade method includes the following steps:

[0083] S1b: Obtain the upgrade file corresponding to the target file, and verify the upgrade file to determine whether the upgrade file matches the target file. If the verification passes, execute step S2b; if the verification fails, execute step S15b.

[0084] S2b: Copy the target file.

[0085] S3b: Check the copied target file to determine whether the target file is normal. If the target file is normal, execute step S4b; if the target file is abnormal, execute step S10b.

[0086] S4b: Determine whether the target file is backed up. If the target file is not backed up, execute step S5b; if the target file is backed up, execute step S9b.

[0087] S5b: Clear the files in the backup partition.

[0088] S6b: Backing up the target file to the backup partition of the non-volatile memory to obtain a backup file.

[0089] S7b: Check the backup file to determine whether the backup file is normal. If the backup file is normal, execute step S8b; if the backup file is abnormal, execute step S5b.

[0090] S8b: Setting the flag of the target file to the first flag, and storing the first flag in the backup partition.

[0091] S9b: writing the target file and the upgrade file into the volatile memory to obtain the upgraded target file.

[0092] S10b: Copy the backup file in the backup partition.

[0093] S11b: Check the copied backup file to determine whether the backup file is normal. If the backup file is normal, execute step S13b; if the backup file is abnormal, execute step S15b.

[0094] S12b: Writing the copied backup file and the upgrade file into the volatile memory to obtain the upgraded target file.

[0095] S13b: Writing the upgraded target file into the target partition of the non-volatile memory.

[0096] S14b: Clear the backup file and the first mark in the backup partition, set the mark corresponding to the target file to the second mark, and store the second mark in the backup partition.

[0097] S15b: End.

[0098] Wherein, during the execution of steps S2b-S8b, S10b-S11b, even if a power outage or other fault occurs, since steps S9b, S12b, S13b are not executed, the target file is not damaged. When the power is turned on again, steps S2b-S3b and S4b-S8b or S10b-S11b can be executed, that is, the target file can still be used for the upgrade operation, thereby completing the upgrade. During the execution of steps S9b, S12b, S13b, even if a power outage or other fault occurs, resulting in damage to the target file, since steps S4b-S8b have been executed, the target file has been successfully backed up. When the power is turned on again, steps S9b or S12b, and S13b can be executed, that is, the backup file is used to perform the upgrade operation, thereby completing the upgrade. Therefore, even if a power outage or other fault occurs during the execution of any step, the upgrade can be ensured to be successful.

[0099] In some embodiments, the target file may be a source file.

[0100] See also Figure 6 , is a structural block diagram of a communication module 100 provided in an embodiment of the present application. Figure 6 As shown, the communication module 100 includes a non-volatile memory 10, a judgment module 20, a backup module 30, an acquisition module 40 and a writing module 50. The judgment module 20 is used to judge whether the target file has been backed up, the backup module 30 is used to back up the target file to the backup partition of the non-volatile memory 10 to obtain a backup file when the target file has not been backed up, the acquisition module 40 is used to obtain the upgrade file corresponding to the target file, and the writing module 50 is used to write the upgrade file to at least the target partition of the non-volatile memory 10 to perform firmware upgrade.

[0101] In some embodiments, the judgment module 20 judges whether the target file has been backed up, including: obtaining the flag of the target file; when the flag of the target file is the first flag, determining that the target file has been backed up; when the flag of the target file is not the first flag, determining that the target file has not been backed up.

[0102] After the backup module 30 backs up the target file to the backup partition to obtain the backup file, the writing module is further configured to set the flag of the target file to a first flag and store the first flag in the backup partition.

[0103] In some embodiments, Figure 5 As shown, the communication module 100 further includes a verification module 60. After the backup module backs up the target file to the backup partition of the non-volatile memory to obtain the backup file, the verification module is further used to verify the backup file backed up to the backup partition to determine whether the backup file is normal. The writing module at least writes the upgrade file to the target partition of the non-volatile memory for firmware upgrade, including: when the backup file backed up to the backup partition is normal, at least writes the upgrade file to the target partition of the non-volatile memory for firmware upgrade.

[0104] In some embodiments, Figure 5 As shown, the communication module 100 further includes a clearing module 70 for clearing files in the backup partition when the target file is not backed up. After the clearing module clears the files in the backup partition, the backup module 30 backs up the target file to the backup partition to obtain the backup file.

[0105] In some embodiments, the clearing module is further used to clear files of the target partition. After the clearing module clears files of the target partition, the writing module 50 at least writes the upgrade file into the target partition to perform firmware upgrade.

[0106] In some embodiments, the write module 50 is also used to set the flag of the target file to a second flag after at least writing the upgrade file to the target partition of the non-volatile memory 10 for firmware upgrade, and store the second flag in the backup partition, and the second flag is different from the first flag.

[0107] In some embodiments, the clearing module is further configured to clear the backup file in the backup partition after the writing module 50 writes at least the upgrade file into the target partition of the non-volatile memory 10 for firmware upgrade.

[0108] In some embodiments, Figure 5As shown, the communication module 100 also includes a volatile memory 80. The inspection module 60 is also used to inspect the target file before the judgment module 20 judges whether the target file has been backed up to determine whether the target file is normal. The judgment module 20 determines whether the target file has been backed up when the target file is normal. The writing module 50 writes the target file and the upgrade file into the volatile memory 80 when the target file is normal to obtain the upgraded target file, and writes the upgraded target file into the target partition.

[0109] In some embodiments, the write module is also used to obtain the backup file in the backup partition when the target file is abnormal, and write the backup file and the upgrade file into the volatile memory to obtain the upgraded target file, and write the upgraded target file into the target partition.

[0110] In some embodiments, the verification module 60 is further configured to verify the backup file before writing the backup file into the volatile memory to determine whether the backup file is normal.

[0111] In some embodiments, the verification module 60 is further used to verify the upgrade file to determine whether the upgrade file matches the target file before the writing module 50 at least writes the upgrade file to the target partition of the non-volatile memory for firmware upgrade.

[0112] The acquisition module 40 may be used to download the aforementioned differential package from an official website or a software update tool.

[0113] In some embodiments, the writing module 50 is further used to write the upgrade file into the target partition to perform a firmware upgrade when the target file has been backed up. The writing module 50 may write the target file and the upgrade file into the volatile memory 80 to obtain the upgraded target file, and then write the upgraded target file into the non-volatile memory 10.

[0114] The judgment module 20, the backup module 30, the writing module 50, the checking module 60 and the clearing module 70 may be processing chips such as a single chip microcomputer, a CPU (central processing unit), a DSP (digital signal processing), or hardware units in processing chips such as a single chip microcomputer, a CPU (central processing unit), a DSP (digital signal processing), or software program modules burned into processing chips such as a single chip microcomputer, a CPU (central processing unit), a DSP (digital signal processing), etc. The acquisition module 40 may be a communication module, such as a WIFI module, a Bluetooth module, a ZigBee module, a 4G / 5G module, etc.

[0115] Among them, the communication module 100 corresponds to the aforementioned firmware upgrade method. For a more detailed description, please refer to the contents of each embodiment of the aforementioned firmware upgrade method. The contents of the communication module 100 and the aforementioned firmware upgrade method can also refer to each other.

[0116] An embodiment of the present application further provides an electronic device, the electronic device comprising a memory and a processor, the memory storing a computer program, and the processor being configured to call the computer program to execute the firmware upgrade method described in any of the aforementioned embodiments.

[0117] Among them, the electronic device corresponds to the aforementioned firmware upgrade method. For more detailed description, please refer to the contents of each embodiment of the aforementioned firmware upgrade method. The contents of the electronic device and the aforementioned firmware upgrade method can also refer to each other.

[0118] An embodiment of the present application further provides a storage medium, a memory and a processor, wherein the storage medium stores a computer program, and the computer program is used to be called by the processor to execute the firmware upgrade method described in any of the aforementioned embodiments.

[0119] The storage medium may be a flash drive, a solid state drive, a read-only memory, a random access memory, a magnetic disk, or an optical disk.

[0120] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.

[0121] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0122] The above is an implementation method of the embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the embodiment of the present application. These improvements and modifications are also considered to be within the scope of protection of the present application.

Claims

1. A firmware upgrade method, It is characterized in that The method comprises: Determine whether the target file has been backed up; When the target file has not been backed up, backing up the target file to a backup partition of a non-volatile memory to obtain a backup file; Obtaining an upgrade file corresponding to the target file; At least the upgrade file is written into the target partition of the non-volatile memory to perform firmware upgrade.

2. The firmware upgrade method according to claim 1, It is characterized in that The step of determining whether the target file has been backed up includes: Get the flag of the target file; When the mark of the target file is the first mark, determining that the target file has been backed up; When the mark of the target file is not the first mark, determining that the target file is not backed up; After backing up the target file to the backup partition to obtain the backup file, the method further includes: The flag of the target file is set to a first flag and the first flag is stored in the backup partition.

3. The firmware upgrade method according to claim 1, It is characterized in that After backing up the target file to a backup partition of a non-volatile memory to obtain a backup file, the method further includes: Checking the backup file backed up to the backup partition to determine whether the backup file is normal; The step of at least writing the upgrade file into the target partition of the non-volatile memory to perform the firmware upgrade comprises: When the backup file backed up to the backup partition is normal, at least the upgrade file is written into the target partition of the non-volatile memory to perform firmware upgrade.

4. The firmware upgrade method according to claim 1, It is characterized in that When the target file is not backed up, backing up the target file to a backup partition of a non-volatile memory to obtain a backup file comprises: When the target file is not backed up, clearing the files in the backup partition; After clearing the files in the backup partition, backing up the target file to the backup partition to obtain the backup file; The step of at least writing the upgrade file into the target partition of the non-volatile memory to perform the firmware upgrade comprises: Clear the files of the target partition; After clearing the files in the target partition, at least the upgrade file is written into the target partition to perform firmware upgrade.

5. The firmware upgrade method according to claim 2, It is characterized in that After at least writing the upgrade file to the target partition of the non-volatile memory for firmware upgrade, the method further includes: Clearing the backup file in the backup partition; and / or The flag of the target file is set to a second flag, and the second flag is stored in the backup partition, where the second flag is different from the first flag.

6. The firmware upgrade method according to claim 1, It is characterized in that Before determining whether the target file has been backed up, the method further includes: Checking the target file to determine whether the target file is normal; The step of determining whether the target file has been backed up includes: When the target file is normal, determining whether the target file has been backed up; The step of at least writing the upgrade file into the target partition of the non-volatile memory to perform the firmware upgrade comprises: When the target file is normal, the target file and the upgrade file are written into a volatile memory to obtain an upgraded target file, and the upgraded target file is written into the target partition.

7. The firmware upgrade method according to claim 6, It is characterized in that The method further comprises: When the target file is abnormal, obtaining the backup file in the backup partition; The step of at least writing the upgrade file into the target partition of the non-volatile memory to perform the firmware upgrade comprises: When the target file is abnormal, the backup file and the upgrade file are written into the volatile memory to obtain an upgraded target file, and the upgraded target file is written into the target partition.

8. A communication module, It is characterized in that The communication module comprises: Non-volatile memory; A judgment module, used to judge whether the target file has been backed up; A backup module, used for backing up the target file to a backup partition of the non-volatile memory to obtain a backup file when the target file has not been backed up; An acquisition module, used to acquire an upgrade file corresponding to the target file; A writing module is used to write at least the upgrade file into the target partition of the non-volatile memory to perform firmware upgrade after backing up the target file to the backup partition.

9. An electronic device, It is characterized in that The electronic device includes a memory and a processor, the memory stores a computer program, and the processor is used to call the computer program to execute the firmware upgrade method according to any one of claims 1 to 7.

10. A storage medium, It is characterized in that The storage medium stores a computer program, and the computer program is used to be called by a processor to execute the firmware upgrade method according to any one of claims 1 to 7.