Firmware upgrading method, firmware upgrading device, computer device, chip and chip module
By using a partition upgrade method, the read-only partition is upgraded first, and then a specific tool is used to upgrade the read-write partition. This solves the problem of insufficient flexibility in firmware upgrade methods and achieves a stable and flexible firmware upgrade process.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING SPREADTRUM HI TECH COMM TECH CO LTD
- Filing Date
- 2026-03-13
- Publication Date
- 2026-06-05
AI Technical Summary
In existing technologies, firmware upgrade methods are not very flexible, and data loss is easily caused, especially during the upgrade of readable and writable partitions.
The partition upgrade method is adopted. First, the read-only partition is upgraded, and then the read-write partition is upgraded using a specific upgrade tool. The upgrade tool extracts and replaces non-volatile data to ensure that the data is correctly preserved and adapted during version switching, avoiding upgrade failure caused by direct overwriting.
Simultaneous upgrades of both read-only and read-write partitions are possible, improving the flexibility and stability of firmware upgrades and ensuring data security and integrity.
Smart Images

Figure CN122152338A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of chip technology, and in particular to a firmware upgrade method, firmware upgrade device, computer equipment, chip, and chip module. Background Technology
[0002] As chip technology continues to develop, chip size is gradually decreasing, while computing power is gradually increasing. Firmware, a dedicated software program stored in internal or external non-volatile memory, controls chip behavior, initializes hardware, and implements functional logic. It is a crucial component of the chip and can be updated.
[0003] Currently, firmware upgrade methods suffer from a lack of flexibility. Summary of the Invention
[0004] Therefore, it is necessary to provide a firmware upgrade method, firmware upgrade device, computer equipment, chip, and chip module that can improve the flexibility of firmware upgrades in response to the above-mentioned technical problems.
[0005] In a first aspect, this application provides a firmware upgrade method, comprising: obtaining a firmware upgrade package, the firmware upgrade package including a first upgrade package for a read-only partition and a second upgrade package for a read-write partition; upgrading the read-only partition according to the first upgrade package; and upgrading the read-write partition according to the second upgrade package after the read-only partition upgrade is completed.
[0006] In one embodiment, the readable and writable partition includes non-volatile data to be upgraded. Upgrading the readable and writable partition according to the second upgrade package includes: obtaining the upgrade tool corresponding to the non-volatile data; and upgrading the readable and writable partition according to the upgrade tool and the second upgrade package.
[0007] In one embodiment, upgrading the readable and writable partition according to the upgrade tool and the second upgrade package includes: extracting the target non-volatile data included in the second upgrade package using the upgrade tool, and reading the candidate non-volatile data included in the readable and writable partition; and replacing the candidate non-volatile data with the target non-volatile data using the upgrade tool.
[0008] In one embodiment, obtaining the upgrade tool corresponding to the non-volatile data includes: obtaining the upgrade tool included in the firmware upgrade package; or, querying the upgrade tool stored in the storage space.
[0009] In one embodiment, the method further includes: in response to the upgrade failure information of the readable and writable partition, incrementing the upgrade failure count of the readable and writable partition by 1 to obtain the incremented upgrade failure count; upgrading the readable and writable partition again based on the incremented upgrade failure count, the upgrade tool, and the second upgrade package, or determining the upgrade result of the readable and writable partition as an upgrade failure based on the incremented upgrade failure count.
[0010] In one embodiment, the method further includes: in response to a power-down restart command, determining a firmware upgrade status based on a first upgrade identifier and / or a second upgrade identifier, wherein the first upgrade identifier is generated after the upgrade of the read-only partition is completed, and the second upgrade identifier is generated after the upgrade of the read-write partition is completed.
[0011] Secondly, this application also provides a firmware upgrade device, comprising: an upgrade package acquisition module for acquiring a firmware upgrade package, the firmware upgrade package including a first upgrade package for a read-only partition and a second upgrade package for a read-write partition; a first upgrade module for upgrading the read-only partition according to the first upgrade package; and a second upgrade module for upgrading the read-write partition according to the second upgrade package after the read-only partition upgrade is completed.
[0012] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the method provided in the first aspect above.
[0013] Fourthly, this application also provides a chip, including a processor and a communication interface, wherein the processor is configured to cause the chip to perform the steps of the method provided in the first aspect above.
[0014] Fifthly, this application also provides a chip module, including a communication module, a power module, a storage module, and a chip, wherein: the power module is used to provide electrical energy to the chip module; the storage module is used to store data and instructions; the communication module is used for internal communication within the chip module, or for communication between the chip module and external devices; and the chip is used to perform the steps of the method provided in the first aspect above.
[0015] Sixthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method provided in the first aspect above.
[0016] In a seventh aspect, this application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the method provided in the first aspect above.
[0017] The aforementioned firmware upgrade method, firmware upgrade device, computer equipment, chip, and chip module first obtain a firmware upgrade package, which includes a first upgrade package for a read-only partition and a second upgrade package for a read-write partition. The read-only partition is upgraded first according to the first upgrade package. After the read-only partition upgrade is completed, the read-write partition is upgraded according to the second upgrade package. This achieves the simultaneous upgrade of both the read-only partition and the read-write partition in a single upgrade, improving the flexibility of firmware upgrades. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 This is a diagram illustrating the application environment of a firmware upgrade method in one embodiment.
[0020] Figure 2 This is a flowchart illustrating a firmware upgrade method in one embodiment;
[0021] Figure 3 This is a flowchart illustrating the upgrade steps for a read / write partition in one embodiment;
[0022] Figure 4 This is a flowchart illustrating step 302 in one embodiment;
[0023] Figure 5 This is a flowchart illustrating step 301 in one embodiment;
[0024] Figure 6 This is a flowchart illustrating the upgrade failure steps of a readable and writable partition in one embodiment.
[0025] Figure 7 This is a flowchart illustrating the upgrade and power-off restart steps of a read / write partition in one embodiment.
[0026] Figure 8 This is a flowchart illustrating the firmware upgrade method in another embodiment;
[0027] Figure 9 This is a structural block diagram of a firmware upgrade device in one embodiment;
[0028] Figure 10 This is an internal structural diagram of a computer device in one embodiment;
[0029] Figure 11 This is an internal structure diagram of a chip module in one embodiment. Detailed Implementation
[0030] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0031] It should be noted that the terms "first," "second," etc., used in this application can be used to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish the first element from the second element. The terms "comprising" and "having," and any variations thereof, used in this application, are intended to cover non-exclusive inclusion. The term "multiple" used in this application refers to two or more. The term "and / or" used in this application refers to one of the embodiments, or any combination of multiple embodiments.
[0032] The firmware upgrade method provided in this application embodiment can be applied to, for example, Figure 1 The application environment shown includes at least a terminal device 101, which includes a chip 101-1.
[0033] The terminal device 101 is used to obtain firmware upgrade packages and upgrade the read-only partition according to the first upgrade package containing the read-only partition, and upgrade the read-write partition according to the second upgrade package containing the read-write partition. The terminal device 101 includes a chip 101-1, and the firmware is contained in the chip 101-1. The terminal device 101 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, drones, low-altitude aircraft, IoT devices, and portable wearable devices. IoT devices can be smart speakers, smart TVs, smart air conditioners, smart in-vehicle devices, projection devices, etc. Portable wearable devices can be smartwatches, smart bracelets, head-mounted devices, etc. Head-mounted devices can be virtual reality (VR) devices, augmented reality (AR) devices, smart glasses, etc.
[0034] Chip 101-1 is installed inside terminal device 101. Firmware is deployed in chip 101-1, which is divided into a readable partition and a readable-writable partition. Terminal device 101 can communicate with chip 101-1 via a bus.
[0035] In real-world scenarios, firmware upgrades typically involve upgrading read-only partitions, which can be done in full packages or differentially. Upgrading read-write partitions, however, cannot directly overwrite the image file containing them, as this would result in data loss. To address this, this application proposes integrating upgrades of both read-only and read-write partitions within a single upgrade process, with separate state management for each. After receiving the upgrade package, the terminal first upgrades the read-only partitions and records their status. Once the read-only partition upgrade is complete, its completion status is recorded. Then, a customized read-write partition upgrade tool from the system or the upgrade package is invoked to upgrade the read-write partitions. This customized upgrade tool can be an NV (non-volatile data) upgrade tool or other types of upgrade tools. Its function is to perform customized upgrades on specific read-write partitions. Taking NV as an example, our upgrade tool compares the latest modifiable NV data with the terminal's NV modifiable data, performing add, delete, and update operations to achieve the goal of upgrading the read-write partitions. After the read-write partition upgrade is complete, the upgrade status is updated. The entire upgrade process only ends after both the read-only and read-write partition upgrades are completed, thereby improving the flexibility of firmware upgrades.
[0036] In one exemplary embodiment, such as Figure 2 As shown, a firmware upgrade method is provided, which can be applied to... Figure 1 Terminal devices or applications Figure 1 The following steps are used as an example of a chip / chip module with data processing capabilities, including steps 201 to 203.
[0037] Step 201: Obtain the firmware upgrade package.
[0038] During the implementation process, the upgrade device first generates a firmware upgrade package for the read-only partition and / or read-write partition, and sends the firmware upgrade package to the terminal device; the terminal device receives the firmware upgrade package sent by the upgrade device.
[0039] During the execution process, the firmware upgrade package received by the terminal device may be in a compressed state or an encrypted state. The firmware upgrade package can be decompressed and / or decrypted to obtain the decompressed and / or decrypted firmware upgrade package.
[0040] In this application, the firmware upgrade package is a file package used for firmware upgrades. The firmware upgrade package includes one or more image files of a read-only partition and / or a read-write partition. The configuration files in the firmware partition can be upgraded using these image files to achieve higher version functionality. Specifically, the firmware upgrade package includes a first upgrade package with a read-only partition and a second upgrade package with a read-write partition.
[0041] Step 202: Upgrade the read-only partition according to the first upgrade package.
[0042] During implementation, the terminal device upgrades the read-only partition based on the first upgrade package included in the firmware upgrade package. Here, the upgrade of the read-only partition can be carried out by means of whole package upgrade, differential upgrade, compression upgrade, encryption upgrade, etc., which are not limited in this application.
[0043] Furthermore, after the terminal device completes the upgrade of the read-only partition, it can generate an upgrade completion marker for the read-only partition to indicate that the upgrade of the read-only partition is complete.
[0044] Step 203: After the read-only partition is upgraded, the read-write partition is upgraded according to the second upgrade package.
[0045] During implementation, after the read-only partition upgrade is completed, the terminal device upgrades the read-write partition according to the second upgrade package to complete the firmware upgrade. The read-write partition contains the non-volatile data to be upgraded.
[0046] During the process, since read-write partitions can be written to and read from, they cannot be directly overwritten during the upgrade, which may result in data loss. Therefore, upgrading read-write partitions requires the use of specific upgrade tools. To address this, after obtaining the firmware upgrade package, or after the read-only partition upgrade is completed, an upgrade tool for read-write partitions can be obtained. The upgrade process for read-write partitions can then be performed using the second upgrade package and the upgrade tool.
[0047] In the above firmware upgrade method, the firmware upgrade package is first obtained. The firmware upgrade package includes a first upgrade package for the read-only partition and a second upgrade package for the read-write partition. The read-only partition is upgraded first according to the first upgrade package. After the read-only partition is upgraded, the read-write partition is upgraded according to the second upgrade package. This achieves the upgrade of both the read-only partition and the read-write partition at the same time in one upgrade, which improves the flexibility of firmware upgrade.
[0048] Based on the above exemplary embodiment, the following provides a firmware upgrade method in one or more exemplary embodiments, which is applied to... Figure 1 Taking the terminal device in the example, the explanation includes the following content.
[0049] During the upgrade process of the read-write partition, the upgrade is performed using an upgrade tool corresponding to non-volatile data; in one optional implementation method provided in this application, such as... Figure 3 As shown, the upgrade steps for the read / write partition include steps 301 to 302:
[0050] Step 301: Obtain the upgrade tool corresponding to the non-volatile data.
[0051] During implementation, the terminal device acquires the upgrade tool corresponding to the non-volatile data. This upgrade tool is used to securely and reliably process the non-volatile data (NV) stored in the device during the firmware upgrade process, ensuring that this data can be correctly retained, adapted, migrated, or initialized when switching between old and new firmware versions. This avoids device malfunctions, configuration loss, or operational errors caused by incompatible data formats, missing fields, or structural changes. The upgrade tool may include at least one of the following: embedded local upgrade tool, host computer-assisted upgrade tool, OTA upgrade data migration module, database-style non-volatile storage manager, and bootloader integration tool.
[0052] Step 302: Upgrade the read / write partition using the upgrade tool and the second upgrade package.
[0053] During implementation, the terminal device uses the upgrade tool to process the image data in the second upgrade package to upgrade the readable and writable partition, thereby realizing the upgrade operation of the readable and writable partition.
[0054] One optional implementation provided in this application upgrades the readable and writable partition using an upgrade tool, avoiding the upgrade failure problem caused by direct overwriting and improving the upgrade stability of the readable and writable partition.
[0055] During the upgrade process using the upgrade tool, the read-write partition can be upgraded by reading and replacing data using the upgrade tool; in one optional implementation method provided in this application, such as... Figure 4 As shown, step 302 includes steps 401 to 402:
[0056] Step 401: Extract the target non-volatile data included in the second upgrade package using the upgrade tool, and read the candidate non-volatile data included in the read / write partition.
[0057] During implementation, the terminal device runs an upgrade tool to extract the target non-volatile data included in the second upgrade package, namely the new version of the configuration file, and reads the candidate non-volatile data to be upgraded from the read-write partition, namely the old version of the configuration file.
[0058] During the execution process, at the firmware upgrade startup phase, the upgrade tool first scans the preset readable and writable areas in the current firmware to identify non-volatile data items that need to be retained or adapted after the firmware update, such as user configuration information, calibration parameters, device operation logs, and security keys. It then compares the current version number of the identified non-volatile data with the target data version compatible with the new firmware. If they match, the upgrade process is skipped; otherwise, the data migration process is triggered.
[0059] Step 402: Replace the candidate non-volatile data with the target non-volatile data using the upgrade tool.
[0060] During implementation, the terminal device runs an upgrade tool to replace the candidate non-volatile data to be upgraded with the target non-volatile data.
[0061] During the process, the upgrade tool replaces the old version of non-volatile data with the target non-volatile data included in the second upgrade package according to the pre-set migration rule script. Furthermore, the upgrade tool can also perform a complete backup of the original non-volatile data before data migration and record the current firmware version and data status to a secure storage area. If an abnormality occurs during the upgrade process (such as power failure or verification failure), the system can be restored to the state before the upgrade based on the backup after restarting, ensuring the integrity of device functions and the security of user data.
[0062] One optional implementation method provided in this application upgrades the NV data of the readable and writable partition using an upgrade tool, achieving stable and reliable upgrade processing and ensuring data security in the readable and writable partition.
[0063] In practical scenarios, upgrade tools for read-write partitions can include multiple types. When creating a firmware upgrade package, the upgrade device can embed the upgrade tool within the firmware upgrade package. Alternatively, the terminal device can pre-store the upgrade tool, and during the upgrade process of the read-write partition, the upgrade tool for the read-write partition can be obtained first to perform the upgrade. In one optional implementation provided in this application, such as... Figure 5 As shown, step 301 includes either step 501 or step 502:
[0064] Step 501: Obtain the upgrade tools included in the firmware upgrade package.
[0065] During implementation, the terminal device obtains the upgrade tool included in the firmware upgrade package; previously, the upgrade device could write the upgrade tool into the firmware upgrade package and send it to the terminal device along with the firmware upgrade package.
[0066] Step 502: Query the storage space upgrade tool.
[0067] During implementation, the upgrade tool can also be stored in the terminal device's storage space. The terminal device can query the upgrade tool stored in the storage space and call the upgrade tool to perform upgrade processing on the readable and writable partition; previously, the terminal device can obtain and store the upgrade tool.
[0068] In one optional implementation provided by this application, the terminal device can obtain the upgrade tool in two ways. Furthermore, different upgrade tools can be selected according to different scenarios. For example, the upgrade tool in the firmware upgrade package can be selected first, which avoids upgrade failure caused by the lack of upgrade tools and improves the upgrade stability of the readable and writable partition.
[0069] In real-world scenarios, during the upgrade of a read-write partition, the partition may be undergoing a large number of read and write operations. Upgrading under these conditions could lead to upgrade failure. A retry process can be implemented after detecting upgrade failure information. One optional implementation provided in this application is as follows: Figure 6 As shown, the method further includes steps 601 and 602, or steps 601 and 603:
[0070] Step 601: In response to the upgrade failure information of the readable and writable partition, increment the upgrade failure count of the readable and writable partition by 1 to obtain the accumulated upgrade failure count.
[0071] During implementation, after a read / write partition upgrade fails, the terminal device generates upgrade failure information for the read / write partition. In response to this upgrade failure information, the upgrade failure count for the read / write partition is incremented by 1 to obtain the accumulated upgrade failure count.
[0072] Step 602: Based on the accumulated number of upgrade failures, the upgrade tool, and the second upgrade package, re-upgrade the read-write partition.
[0073] During implementation, upgrade retry processing can be performed after upgrade failure. The terminal device can detect whether the accumulated number of upgrade failures has reached the threshold. If the number of upgrade failures is less than the threshold, step 602 is executed. If the number of upgrade failures is equal to or greater than the threshold, step 603 is executed.
[0074] If the cumulative number of upgrade failures is less than the threshold, the terminal device will re-upgrade the readable and writable partitions using the upgrade tool and the second upgrade package. For specific upgrade methods, please refer to the above embodiments.
[0075] Step 603: Determine the upgrade result of the readable and writable partition as an upgrade failure based on the accumulated number of upgrade failures.
[0076] During implementation, if the cumulative number of upgrade failures is equal to or greater than the threshold, the terminal device determines that the upgrade result of the readable and writable partition is an upgrade failure.
[0077] This application provides an optional implementation that offers two options after an upgrade failure: retry and accept the upgrade failure. This avoids upgrade errors caused by reading and writing to the readable and writable partition, thus ensuring the upgrade reliability of the firmware's readable and writable partition.
[0078] In real-world scenarios, power outages may occur during the upgrade process, causing the terminal device to restart. After restarting, the firmware upgrade can be performed again. To address this, the firmware upgrade process can be marked. An upgrade marker is generated after the upgrade of the read-only partition and / or read-write partition is completed, allowing the terminal device to upgrade based on the upgrade marker. In one optional implementation provided by this application, such as... Figure 7 As shown, the method further includes step 701:
[0079] Step 701: In response to the power failure restart command, determine the firmware upgrade status based on the first upgrade identifier and / or the second upgrade identifier.
[0080] The firmware upgrade status is used to characterize the current upgrade partition of the firmware. If the first upgrade identifier is not detected, it indicates that the upgrade is being performed on the read-only partition. If the first upgrade identifier is detected but the second upgrade identifier is not detected, it indicates that the upgrade is being performed on the read-write partition. The first upgrade identifier is generated after the upgrade of the read-only partition is completed, and the second upgrade identifier is generated after the upgrade of the read-write partition is completed.
[0081] During implementation, after the terminal device loses power and restarts during the upgrade process, it generates and responds to the power-loss restart command to continue the firmware upgrade. First, it detects the first upgrade identifier and / or the second upgrade identifier, and determines the current firmware upgrade status based on the first upgrade identifier and / or the second upgrade identifier.
[0082] Furthermore, if the firmware upgrade status is a read-only partition upgrade status, it indicates that the first upgrade identifier and the second upgrade identifier were not detected, so step 202 is executed; if the firmware upgrade status is a read-write partition upgrade status, it indicates that only the first upgrade identifier was detected and the second upgrade identifier was not detected, so step 203 is executed; if the firmware upgrade status is upgrade complete, it indicates that the first upgrade identifier and the second upgrade identifier were detected, so the upgrade is confirmed to be complete.
[0083] One optional implementation provided in this application determines the upgrade status by setting an upgrade identifier, and then performs the firmware upgrade process again after a power failure and restart, thereby improving the stability of firmware upgrades and thus improving the flexibility of firmware upgrades.
[0084] In one embodiment, see Figure 8 The document illustrates a flowchart of a firmware upgrade method provided in an embodiment of this application, which can be applied to... Figure 1 In the terminal device shown. For example... Figure 8 As shown, the firmware upgrade method may include the following steps:
[0085] Step 801: Obtain the firmware upgrade package.
[0086] Step 802: Upgrade the read-only partition according to the first upgrade package included in the firmware upgrade package.
[0087] Step 803: Obtain the upgrade tools included in the firmware upgrade package.
[0088] Step 804: Extract the target non-volatile data included in the second upgrade package using the upgrade tool, and read the candidate non-volatile data to be upgraded included in the read / write partition.
[0089] Step 805: Replace the candidate non-volatile data with the target non-volatile data using the upgrade tool.
[0090] Step 806: In response to the upgrade failure information of the readable and writable partition, increment the upgrade failure count of the readable and writable partition by 1 to obtain the accumulated upgrade failure count.
[0091] Step 807: Based on the accumulated number of upgrade failures, the upgrade tool, and the second upgrade package, re-upgrade the read-write partition.
[0092] Step 808: In response to the power-down restart command, determine the firmware upgrade status based on the first upgrade identifier and / or the second upgrade identifier.
[0093] Step 809: In response to the upgrade status of the read-write partition, continue to upgrade the read-write partition according to the upgrade tool and the second upgrade package.
[0094] It should be noted that any one or more of steps 801 to 809 can be combined to form a new implementation method according to the needs of implementation and deployment. Furthermore, any one or more technical features in the technical solution composed of steps 801 to 809 can also be combined to form a new implementation method according to the actual deployment needs, or technical features in one or more optional implementations provided by one or more of the above embodiments can be combined to form a new implementation method. These will not be elaborated on here.
[0095] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps. It is understood that the steps in different embodiments can be freely combined as needed, and all non-contradictory solutions formed by such combinations are within the scope of protection of this application.
[0096] Based on the same inventive concept, this application also provides a firmware upgrade apparatus for implementing the firmware upgrade method described above. This apparatus can be applied to or integrated into a chip or chip module, for example. The solution provided by this apparatus is similar to the implementation scheme described in the above method; therefore, the specific limitations in one or more firmware upgrade apparatus embodiments provided below can be found in the limitations of the firmware upgrade method described above, and will not be repeated here.
[0097] In one exemplary embodiment, such as Figure 9 As shown, a firmware upgrade device is provided, including: an upgrade package acquisition module 901, a first upgrade module 902, and a second upgrade module 903, wherein: the upgrade package acquisition module 901 is used to acquire a firmware upgrade package, the firmware upgrade package including a first upgrade package for a read-only partition and a second upgrade package for a read-write partition; the first upgrade module 902 is used to upgrade the read-only partition according to the first upgrade package; and the second upgrade module 903 is used to upgrade the read-write partition according to the second upgrade package after the read-only partition upgrade is completed.
[0098] In one embodiment, the second upgrade module 903 includes a tool acquisition unit and an upgrade unit, wherein: the tool acquisition unit is used to acquire the upgrade tool corresponding to the non-volatile data; the upgrade unit is used to upgrade the readable and writable partition according to the upgrade tool and the second upgrade package.
[0099] In one embodiment, the upgrade unit includes a data reading unit and a data replacement unit, wherein: the data reading unit is used to extract the target non-volatile data included in the second upgrade package through the upgrade tool, and read the candidate non-volatile data included in the read-write partition; the data replacement unit is used to replace the candidate non-volatile data with the target non-volatile data through the upgrade tool.
[0100] In one embodiment, the tool acquisition unit includes a reading unit or a querying unit, wherein: the reading unit is used to acquire the upgrade tool included in the firmware upgrade package; the acquisition unit is used to query the upgrade tool stored in the storage space.
[0101] In one embodiment, the apparatus further includes a failure handling module and a retry module, wherein: the failure handling module is used to increment the upgrade failure count of the read-write partition by 1 in response to the upgrade failure information of the read-write partition, to obtain the incremented upgrade failure count; the retry module is used to re-upgrade the read-write partition according to the incremented upgrade failure count, the upgrade tool, and the second upgrade package.
[0102] In one embodiment, the device further includes a failure confirmation module. After the failure handling module has finished running, the failure confirmation module is run. The failure confirmation module is used to determine the upgrade result of the readable and writable partition as an upgrade failure based on the accumulated number of upgrade failures.
[0103] In one embodiment, the device further includes an upgrade status confirmation module, which is used to determine the firmware upgrade status according to a first upgrade identifier and / or a second upgrade identifier in response to a power-off restart command. The first upgrade identifier is generated after the upgrade of the read-only partition is completed, and the second upgrade identifier is generated after the upgrade of the read-write partition is completed.
[0104] Regarding the modules / units included in the various devices and products described in the above embodiments, they can be software modules / units, hardware modules / units, or a combination of both. For example, for various devices and products applied to or integrated into a chip, all of their modules / units can be implemented using hardware methods such as circuits, or at least some modules / units can be implemented using software programs that run on a processor integrated within the chip, while the remaining (if any) modules / units can be implemented using hardware methods such as circuits; for various devices and products applied to or integrated into a chip module, all of their modules / units can be implemented using hardware methods such as circuits, and different modules / units can be located in the same component (e.g., chip, circuit module, etc.) or different components of the chip module, or at least some modules / units can be implemented using hardware methods such as circuits. The components can be implemented using software programs that run on the processor integrated within the chip module. The remaining (if any) modules / units can be implemented using hardware methods such as circuits. For various devices and products applied to or integrated into the terminal, each of its components / units can be implemented using hardware methods such as circuits. Different modules / units can be located in the same component (e.g., chip, circuit module, etc.) or in different components within the terminal. Alternatively, at least some modules / units can be implemented using software programs that run on the processor integrated within the terminal, while the remaining (if any) modules / units can be implemented using hardware methods such as circuits.
[0105] In one exemplary embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 10As shown, the computer device includes a processor, memory, input / output interfaces, a communication interface, a display unit, and an input device. The processor, memory, and input / output interfaces are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interfaces. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The input / output interfaces are used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, Near Field Communication (NFC), or other technologies. When the computer program is executed by the processor, it implements a firmware upgrade method. The display unit is used to form a visually visible image and can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.
[0106] Those skilled in the art will understand that Figure 10 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0107] In one exemplary embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to perform the following steps: obtaining a firmware upgrade package, the firmware upgrade package including a first upgrade package for a read-only partition and a second upgrade package for a read-write partition; upgrading the read-only partition according to the first upgrade package; and upgrading the read-write partition according to the second upgrade package after the read-only partition upgrade is completed.
[0108] In one embodiment, when the processor executes the computer program, it further performs the following steps: obtaining an upgrade tool corresponding to the non-volatile data; and upgrading the readable and writable partition according to the upgrade tool and the second upgrade package.
[0109] In one embodiment, when the processor executes the computer program, it further performs the following steps: extracting the target non-volatile data included in the second upgrade package using an upgrade tool, and reading the candidate non-volatile data included in the read-write partition; replacing the candidate non-volatile data with the target non-volatile data using the upgrade tool.
[0110] In one embodiment, when the processor executes the computer program, it further performs the following steps: obtaining the upgrade tool included in the firmware upgrade package; or, querying the upgrade tool stored in the storage space.
[0111] In one embodiment, when the processor executes the computer program, it further performs the following steps: in response to the upgrade failure information of the readable and writable partition, incrementing the upgrade failure count of the readable and writable partition by 1 to obtain the incremented upgrade failure count; re-upgrading the readable and writable partition based on the incremented upgrade failure count, the upgrade tool, and the second upgrade package, or determining the upgrade result of the readable and writable partition as an upgrade failure based on the incremented upgrade failure count.
[0112] In one embodiment, when the processor executes the computer program, it further performs the following steps: in response to a power-down restart command, determining the firmware upgrade status based on a first upgrade identifier and / or a second upgrade identifier, wherein the first upgrade identifier is generated after the upgrade of the read-only partition is completed, and the second upgrade identifier is generated after the upgrade of the read-write partition is completed.
[0113] Based on the same inventive concept, embodiments of this application also provide a chip, including a processor and a communication interface; the communication interface is used to receive or send data; the processor is configured to cause the chip to perform the following steps: obtaining a firmware upgrade package, the firmware upgrade package including a first upgrade package for a read-only partition and a second upgrade package for a read-write partition; upgrading the read-only partition according to the first upgrade package; and upgrading the read-write partition according to the second upgrade package after the read-only partition upgrade is completed.
[0114] In one embodiment, the processor is configured to cause the chip to perform the following steps: obtain an upgrade tool corresponding to non-volatile data; and upgrade the readable and writable partition according to the upgrade tool and a second upgrade package.
[0115] In one embodiment, the processor is configured to cause the chip to perform the following steps: extracting target non-volatile data included in a second upgrade package using an upgrade tool, and reading candidate non-volatile data included in a read-write partition; replacing the candidate non-volatile data with the target non-volatile data using the upgrade tool.
[0116] In one embodiment, the processor is configured to cause the chip to perform the following steps: obtain an upgrade tool included in a firmware upgrade package; or, query the memory space for an upgrade tool stored therein.
[0117] In one embodiment, the processor is configured to cause the chip to perform the following steps: in response to upgrade failure information of the readable and writable partition, increment the upgrade failure count of the readable and writable partition by 1 to obtain the incremented upgrade failure count; re-upgrade the readable and writable partition based on the incremented upgrade failure count, the upgrade tool, and the second upgrade package, or determine the upgrade result of the readable and writable partition as an upgrade failure based on the incremented upgrade failure count.
[0118] In one embodiment, the processor is configured to cause the chip to perform the following steps: in response to a power-down restart command, determining a firmware upgrade status based on a first upgrade identifier and / or a second upgrade identifier, wherein the first upgrade identifier is generated after the upgrade of the read-only partition is completed, and the second upgrade identifier is generated after the upgrade of the read-write partition is completed.
[0119] It is understood that the chip involved in the embodiments of this application may be a field-programmable gate array (FPGA), may be an application-specific integrated circuit (ASIC), may be a system on chip (SoC), may be a central processor unit (CPU), may be a network processor (NP), may be a digital signal processor (DSP), may be a microcontroller unit (MCU), may be a programmable logic device (PLD), or other integrated chips, etc.
[0120] Based on the same inventive concept, this application also provides a chip module, such as... Figure 11 As shown, the chip module includes a communication module, a power module, a storage module, and a chip. Among them:
[0121] The power module is used to provide power to the chip module; the storage module is used to store data and instructions; the communication module is used for internal communication within the chip module, or for communication between the chip module and external devices; this chip corresponds to the chip in the above chip embodiment.
[0122] The implementation method of this chip module can be found in the relevant content of the above chip embodiment, and will not be repeated here.
[0123] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, performs the following steps: obtaining a firmware upgrade package, the firmware upgrade package including a first upgrade package for a read-only partition and a second upgrade package for a read-write partition; upgrading the read-only partition according to the first upgrade package; and upgrading the read-write partition according to the second upgrade package after the read-only partition upgrade is completed.
[0124] In one embodiment, when the processor executes the computer program, it further performs the following steps: obtaining an upgrade tool corresponding to the non-volatile data; and upgrading the readable and writable partition according to the upgrade tool and the second upgrade package.
[0125] In one embodiment, when the processor executes the computer program, it further performs the following steps: extracting the target non-volatile data included in the second upgrade package using an upgrade tool, and reading the candidate non-volatile data included in the read-write partition; replacing the candidate non-volatile data with the target non-volatile data using the upgrade tool.
[0126] In one embodiment, when the processor executes the computer program, it further performs the following steps: obtaining the upgrade tool included in the firmware upgrade package; or, querying the upgrade tool stored in the storage space.
[0127] In one embodiment, when the processor executes the computer program, it further performs the following steps: in response to the upgrade failure information of the readable and writable partition, incrementing the upgrade failure count of the readable and writable partition by 1 to obtain the incremented upgrade failure count; re-upgrading the readable and writable partition based on the incremented upgrade failure count, the upgrade tool, and the second upgrade package, or determining the upgrade result of the readable and writable partition as an upgrade failure based on the incremented upgrade failure count.
[0128] In one embodiment, when the processor executes the computer program, it further performs the following steps: in response to a power-down restart command, determining the firmware upgrade status based on a first upgrade identifier and / or a second upgrade identifier, wherein the first upgrade identifier is generated after the upgrade of the read-only partition is completed, and the second upgrade identifier is generated after the upgrade of the read-write partition is completed.
[0129] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, performs the following steps: obtaining a firmware upgrade package, the firmware upgrade package including a first upgrade package for a read-only partition and a second upgrade package for a read-write partition; upgrading the read-only partition according to the first upgrade package; and upgrading the read-write partition according to the second upgrade package after the read-only partition upgrade is completed.
[0130] In one embodiment, when the processor executes the computer program, it further performs the following steps: obtaining an upgrade tool corresponding to the non-volatile data; and upgrading the readable and writable partition according to the upgrade tool and the second upgrade package.
[0131] In one embodiment, when the processor executes the computer program, it further performs the following steps: extracting the target non-volatile data included in the second upgrade package using an upgrade tool, and reading the candidate non-volatile data included in the read-write partition; replacing the candidate non-volatile data with the target non-volatile data using the upgrade tool.
[0132] In one embodiment, when the processor executes the computer program, it further performs the following steps: obtaining the upgrade tool included in the firmware upgrade package; or, querying the upgrade tool stored in the storage space.
[0133] In one embodiment, when the processor executes the computer program, it further performs the following steps: in response to the upgrade failure information of the readable and writable partition, incrementing the upgrade failure count of the readable and writable partition by 1 to obtain the incremented upgrade failure count; re-upgrading the readable and writable partition based on the incremented upgrade failure count, the upgrade tool, and the second upgrade package, or determining the upgrade result of the readable and writable partition as an upgrade failure based on the incremented upgrade failure count.
[0134] In one embodiment, when the processor executes the computer program, it further performs the following steps: in response to a power-down restart command, determining the firmware upgrade status based on a first upgrade identifier and / or a second upgrade identifier, wherein the first upgrade identifier is generated after the upgrade of the read-only partition is completed, and the second upgrade identifier is generated after the upgrade of the read-write partition is completed.
[0135] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.
[0136] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.
[0137] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0138] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A firmware upgrade method, characterized in that, The method includes: Obtain a firmware upgrade package, wherein the firmware upgrade package includes a first upgrade package with a read-only partition and a second upgrade package with a read-write partition; The read-only partition is upgraded according to the first upgrade package; After the read-only partition is upgraded, the read-write partition is upgraded according to the second upgrade package.
2. The method according to claim 1, characterized in that, The readable and writable partition includes non-volatile data to be upgraded, and the upgrade of the readable and writable partition according to the second upgrade package includes: Obtain the upgrade tool corresponding to the non-volatile data; The read / write partition is upgraded using the upgrade tool and the second upgrade package.
3. The method according to claim 2, characterized in that, The upgrade of the readable and writable partition based on the upgrade tool and the second upgrade package includes: The upgrade tool extracts the target non-volatile data included in the second upgrade package and reads the candidate non-volatile data included in the read / write partition. The upgrade tool replaces the candidate non-volatile data with the target non-volatile data.
4. The method according to claim 2, characterized in that, The upgrade tool for obtaining the non-volatile data includes: Obtain the upgrade tool included in the firmware upgrade package; Alternatively, query the storage space for the aforementioned upgrade tool.
5. The method according to any one of claims 2 to 4, characterized in that, The method further includes: In response to the upgrade failure information of the readable and writable partition, the upgrade failure count of the readable and writable partition is incremented by 1 to obtain the accumulated upgrade failure count; The read-write partition is re-upgraded based on the accumulated number of upgrade failures, the upgrade tool, and the second upgrade package; or, the upgrade result of the read-write partition is determined to be an upgrade failure based on the accumulated number of upgrade failures.
6. The method according to any one of claims 1 to 4, characterized in that, The method further includes: In response to a power-off reboot command, the firmware upgrade status is determined based on a first upgrade identifier and / or a second upgrade identifier, wherein the first upgrade identifier is generated after the upgrade of the read-only partition is completed, and the second upgrade identifier is generated after the upgrade of the read-write partition is completed.
7. A firmware upgrade device, characterized in that, The device includes: The upgrade package acquisition module is used to acquire firmware upgrade packages, wherein the firmware upgrade packages include a first upgrade package with a read-only partition and a second upgrade package with a read-write partition; The first upgrade module is used to upgrade the read-only partition according to the first upgrade package; The second upgrade module is used to upgrade the read-write partition according to the second upgrade package after the read-only partition upgrade is completed.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.
9. A chip, characterized in that, The device includes a processor and a communication interface, wherein the processor is configured to cause the chip to perform the steps of the method described in any one of claims 1 to 6.
10. A chip module, characterized in that, This includes communication modules, power modules, storage modules, and chips, among which: The power module is used to provide power to the chip module; The storage module is used to store data and instructions; The communication module is used for internal communication within the chip module, or for communication between the chip module and external devices. The chip is used to perform the steps of the method according to any one of claims 1 to 6.