Chip updating method

By having the first chip lead the update process of the second chip, and utilizing version number matching and verification mechanisms, the chip update process is simplified, hardware complexity is reduced, R&D debugging efficiency and stability are improved, and reliable updates of the dual-chip architecture in wearable devices are ensured.

CN122111483APending Publication Date: 2026-05-29SPREADTRUM COMM (TIANJIN) INC

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SPREADTRUM COMM (TIANJIN) INC
Filing Date
2026-02-28
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

In existing wearable devices with dual-chip architecture, the chip update process is complex, the hardware layout is complex, and the update tools need to be plugged in and out many times, resulting in low R&D and debugging efficiency and poor stability, and it is difficult to ensure reliable chip updates.

Method used

The first chip leads the update process of the second chip, obtains the update data packet through a unique external interface, and ensures the integrity and legality of the update data packet through version number matching and verification mechanism. The electronic device is controlled to reset after the chip update is completed, so as to achieve reliable update.

Benefits of technology

It simplifies the chip update process, reduces hardware complexity, improves R&D and debugging efficiency and stability, ensures reliable chip updates, and reduces the risk of human error.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122111483A_ABST
    Figure CN122111483A_ABST
Patent Text Reader

Abstract

The application relates to a chip updating method. The method comprises the following steps: acquiring an updating data packet of a second chip; the updating data packet is used for the second chip to update the data packet; determining a first version number of the data packet running on the second chip; in the case that the first version number is different from a second version number corresponding to the updating data packet, sending the updating data packet to the second chip; receiving an updating completion message from the second chip; determining a third version number of the data packet currently running on the second chip; and in the case that the third version number is the same as the second version number, controlling an electronic device to reset. The method can ensure that the second chip is reliably updated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of chip update technology, and in particular to a chip update method. Background Technology

[0002] With the diversification of electronic devices, wearable devices have gradually entered people's lives, finding wide application in many fields such as health monitoring, sports assistance, and intelligent interaction. As the market demand for low-power wearable devices increases, the dual-chip architecture, due to its significant advantages in low power consumption, has gradually become one of the mainstream hardware architectures for wearable devices.

[0003] Therefore, in order to ensure that wearable devices with a dual-chip architecture can function properly, it is essential to ensure that the chips in the wearable devices can be reliably updated. Summary of the Invention

[0004] Therefore, it is necessary to provide a chip update method, electronic device, computer-readable storage medium, and computer program product that can ensure reliable updates of the second chip, addressing the aforementioned technical problems.

[0005] In a first aspect, this application provides a chip updating method applied to a first chip in an electronic device, the electronic device further including a second chip, the method comprising:

[0006] Obtain the update data packet from the second chip; the update data packet is used by the second chip to update the data packet.

[0007] Determine the first version number of the data packet running on the second chip;

[0008] If the first version number is different from the second version number corresponding to the update data packet, the update data packet will be sent to the second chip;

[0009] Receive update completion message from the second chip;

[0010] Determine the third version number of the data packet currently running on the second chip;

[0011] If the third version number is the same as the second version number, control the electronic device to reset.

[0012] In an exemplary embodiment, obtaining the update data packet of the second chip as described above includes:

[0013] The update data packet of the second chip is obtained through the external interface, which is the only interface used by the electronic device to obtain external data.

[0014] In one exemplary embodiment, the method further includes:

[0015] The update data package is stored in the first storage partition.

[0016] In an exemplary embodiment, obtaining the update data packet of the second chip as described above includes:

[0017] In response to an update command for the second chip, the update data packet for the second chip is obtained, and the target mode is entered;

[0018] The above determination of the first version number of the data packet running on the second chip includes:

[0019] With the first chip in target mode, determine the first version number of the data packet running on the second chip.

[0020] In one exemplary embodiment, the method further includes:

[0021] Determine the initial data volume of the update packet;

[0022] The above determination of the third version number of the currently running data packet on the second chip includes:

[0023] If the first data volume and the second data volume are the same, determine the third version number of the data packet currently running on the second chip; the second data volume is the amount of data sent by the first chip in the process of sending the update data packet to the second chip.

[0024] In one exemplary embodiment, resetting the control electronic device includes:

[0025] Control the electronic device to restart, or control the electronic device to shut down.

[0026] Secondly, this application also provides a chip updating method applied to a second chip in an electronic device, the electronic device further including a first chip, the method comprising:

[0027] Receive update data packets from the first chip;

[0028] Store the update data package in the second storage partition;

[0029] Verify the updated data packet and obtain the verification result;

[0030] If the verification result is satisfactory, restart the system.

[0031] After rebooting, the update package from the second storage partition will be installed to the third storage partition;

[0032] Once the update package is installed, an update completion message will be generated.

[0033] An update completion message is sent to the first chip. The update completion message is used by the first chip to determine the third version number of the data packet currently running on the second chip. If the third version number is the same as the second version number corresponding to the updated data packet, the electronic device is controlled to reset.

[0034] In an exemplary embodiment, the verification result includes a first verification result and a second verification result; the above-described verification of the update data packet to obtain the verification result includes:

[0035] Perform a validity check on the update data packet to obtain the first verification result;

[0036] If the first verification result is valid, perform an integrity verification on the update data packet to obtain the second verification result;

[0037] The above-mentioned restart process, which occurs when the verification result passes, includes:

[0038] If the second verification result is complete, then restart.

[0039] In one exemplary embodiment, the method further includes:

[0040] The first data volume of the update data packet is obtained, and the first data volume is determined by the first chip;

[0041] The above verification of the update data packet yields the following verification results:

[0042] If the first data volume and the third data volume are the same, the update data packet is verified to obtain the verification result; the third data volume is the amount of data received by the second chip during the process of receiving the update data packet from the first chip.

[0043] Thirdly, this application also provides a chip updating method applied to an electronic device, the electronic device including a first chip and a second chip, the first chip and the second chip being electrically connected, the method including:

[0044] The first chip obtains the update data packet from the second chip;

[0045] The first chip determines the first version number corresponding to the update data packet and the second version number of the data packet running on the second chip;

[0046] If the first version number and the second version number are different, the first chip will send the update data packet to the second chip;

[0047] The second chip updates the data packets based on the updated data packets;

[0048] Once the update is complete, the second chip sends an update completion message to the first chip;

[0049] The first chip determines the third version number of the data packet currently being processed by the second chip;

[0050] If the third version number is the same as the first version number, a reset will be performed.

[0051] Fourthly, this application also provides an electronic device, including a first chip and a second chip, wherein the first chip and the second chip are electrically connected;

[0052] A first chip is configured to perform the method as described in any of the first aspects of this application;

[0053] The second chip is used to perform the method as described in any of the second aspects of this application.

[0054] Fifthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, implements some or all of the steps described in any method of the first aspect of the embodiments of this application.

[0055] Sixthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, implements some or all of the steps described in any method of the first aspect of the embodiments of this application.

[0056] The aforementioned chip update method, electronic device, computer-readable storage medium, and computer program product involve the following steps: a first chip acquires an update data packet from a second chip; the first chip determines a first version number of the data packet running on the second chip; if the first version number differs from the second version number corresponding to the update data packet, the first chip sends the update data packet to the second chip; the first chip receives an update completion message from the second chip; the first chip determines a third version number of the currently running data packet on the second chip; and if the third version number is the same as the second version number, the first chip controls the electronic device to reset. By employing the chip update method provided in this application, the first chip can accurately determine that the second chip has been updated before controlling the electronic device to reset, by determining the first version number of the data packet running on the second chip before updating the second chip and determining the third version number of the currently running data packet on the second chip after the second chip update is completed. This ensures that the second chip is reliably updated. Attached Figure Description

[0057] 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.

[0058] Figure 1 This application provides an illustration of the application environment for a chip update method.

[0059] Figure 2 A schematic flowchart illustrating a chip update method provided in an embodiment of this application;

[0060] Figure 3 A flowchart illustrating another chip update method provided in an embodiment of this application;

[0061] Figure 4 A flowchart illustrating yet another chip update method provided in this application embodiment;

[0062] Figure 5 This is a flowchart illustrating another chip update method provided in an embodiment of this application. Detailed Implementation

[0063] 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.

[0064] The chip update method provided in this application can be applied to, for example... Figure 1 In the application environment shown, the electronic device 10 includes a first chip 102 and a second chip 104, and a data link exists between the first chip 102 and the second chip 104 to enable communication between them. The first chip 102 and the second chip 104 are different chips in the electronic device 10. In addition to the first chip 102 and the second chip 104, the electronic device 10 may also include other chips.

[0065] In one exemplary embodiment, such as Figure 2 As shown, a chip update method is provided, which is applied to Figure 1 The method involves steps 202 to 212, wherein: (The first chip in the electronic device, which also includes a second chip, is described.)

[0066] Step 202: Obtain the update data packet of the second chip; the update data packet is used by the second chip to update the data packet.

[0067] In this context, the first chip is the initiator of the update process, enabling the second chip to update. Therefore, the second chip is the entity being updated, which needs to be updated under the guidance of the first chip.

[0068] Optionally, the first chip can be a system-on-a-chip (SOC), and the second chip can be a micro-controller unit (MCU) chip.

[0069] Optionally, the first chip and the second chip can run on different operating systems. For example, the first chip can run on a smart operating system, and the second chip can run on a real-time operating system. The smart operating system could be, for example, Android. Since the response time of the real-time operating system is shorter than that of the smart operating system, the response time of the first chip can be greater than a preset response time, while the response time of the second chip can be less than or equal to the preset response time.

[0070] The response time of an intelligent operating system is in the millisecond to second range, while the response time of a real-time operating system is in the microsecond to millisecond range.

[0071] Optionally, the electronic device can be a laptop, smartphone, tablet, IoT device, portable wearable device, or other smart device. More optionally, if the electronic device is a wearable device, it can be a smartwatch, smart bracelet, smart glasses, smart headphones, etc.

[0072] The data packet contains data that can be run in the second chip to enable the second chip to function properly.

[0073] Optionally, the update data packet may be obtained by the second chip from a server that can communicate with the electronic device, or it may be manually burned into the second chip.

[0074] Optionally, after the first chip obtains the update data packet from the second chip, it can store the update data packet in the flash partition of the first chip.

[0075] It is easy to understand that the firmware data included in the update data packet corresponds to the second chip. For example, if the second chip is an MCU chip, then the update data packet contains MCU chip firmware data that enables the second chip to be updated.

[0076] Based on this, it can be understood that the update data package of the second chip refers to the firmware data package of the second chip. The firmware data of the update data package of the second chip includes executable code packages related to the software parameters of the second chip and the necessary hardware adaptation parameter settings of the second chip. Based on the software-related data that enables the second chip to operate normally, and the hardware-related data that enables the software-related data to be adapted to the second chip, the firmware update of the second chip can be accurately realized, and the updated second chip can operate normally.

[0077] Step 204: Determine the first version number of the data packet running on the second chip.

[0078] Here, "running data packet" refers to a data packet that is currently running on the second chip. Based on this, the first version number is the version number of a data packet that is currently running on the second chip.

[0079] Optionally, the first chip may send a version number request instruction to the second chip, so that the second chip sends the first version number of the data packet running on the second chip to the first chip, thereby enabling the first chip to determine the first version number of the data packet running on the second chip.

[0080] Step 206: If the first version number is different from the second version number corresponding to the update data packet, the update data packet is sent to the second chip.

[0081] In this context, it is easy to understand that if the first version number is the same as the second version number corresponding to the update data packet, then the first chip does not need to update the second chip, that is, it does not need to send the update data packet to the second chip.

[0082] Optionally, the first chip and the second chip can communicate via a Remote Procedure Call (RPC) data link. Based on this, the first chip can send update data packets to the second chip via the RPC data link.

[0083] It is easy to understand that using the RPC data link as the data link between the first chip and the second chip is merely one possible embodiment of the data link between chips. In addition to the RPC data link, the first chip and the second chip can also use the Serial Peripheral Interface (SPI), the Inter-Integrated Circuit (I2C), or the Universal Asynchronous Receiver / Transmitter (UART) as the data link. That is to say, the embodiments of this application do not limit the type of data link between the first chip and the second chip. Therefore, the embodiments of this application have strong compatibility and flexibility in terms of dual-chip communication methods.

[0084] Step 208: Receive the update completion message from the second chip.

[0085] The update completion message refers to a one-way notification message generated by the second chip and sent to the first chip to notify the first chip that its running data packet has been replaced with the updated data packet, i.e., the update has been completed.

[0086] Step 210: Determine the third version number of the data packet currently running on the second chip.

[0087] The currently running data packet on the second chip refers to the latest running data packet on the second chip. In this way, the third version number of the currently running data packet on the second chip can be determined, which helps the first chip to determine whether the second chip has been accurately updated to the second version number corresponding to the updated data packet.

[0088] Step 212: If the third version number is the same as the second version number, control the electronic device to reset.

[0089] In cases where the third version number is the same as the second version number, it indicates that the second chip has been accurately updated. Therefore, in order for the update of the second chip to take effect, the first chip controls the electronic device to reset, so that the second chip, after resetting and re-entering the working state, can reload the firmware data corresponding to the update data package to realize the new function corresponding to the update data package.

[0090] Optionally, if the third version number is different from the second version number, it indicates that the second chip has not been updated accurately or the update has failed. Therefore, the first chip can resend the update data packet to the second chip so that the second chip can update again.

[0091] In the above chip update method, the first chip obtains the update data packet from the second chip; the first chip determines the first version number of the data packet running on the second chip; if the first version number is different from the second version number corresponding to the update data packet, the first chip sends the update data packet to the second chip; the first chip receives an update completion message from the second chip; the first chip determines the third version number of the data packet currently running on the second chip; if the third version number is the same as the second version number, the first chip controls the electronic device to reset. Using the chip update method provided in this application embodiment, the first chip can accurately determine that the second chip has been updated before controlling the electronic device to reset, by determining the first version number of the data packet running on the second chip before the second chip is updated and determining the third version number of the data packet currently running on the second chip after the second chip is updated. This ensures that the second chip is reliably updated.

[0092] Meanwhile, in the aforementioned chip update method, since the update action for the second chip is completed under the guidance of the first chip, that is, the download logic for the update data packet of the second chip is integrated on the first chip side, the software logic on the first chip side can uniformly manage the firmware data update process of the second chip. This avoids the cumbersome operation and time cost problems caused by repeatedly switching update targets during the R&D and debugging phases and mass production of electronic devices in the traditional way. Based on this, the chip update method provided in this application embodiment can significantly improve the overall efficiency of electronic devices in the development and production stages. Furthermore, since the first chip can automatically and procedurally guide the update action of the second chip, there is no longer a need for manual updates of the second chip. Thus, it can not only improve the mass production efficiency of electronic devices, but also significantly reduce the risk of operational errors when manually updating the second chip.

[0093] Existing chip update methods typically employ independent updates for each chip. This involves connecting different chips to their respective download interfaces to sequentially burn firmware data. While this approach is relatively simple and highly compatible, it has several drawbacks. First, it requires reserving a separate update interface for each chip in the electronic device. This increases the complexity of the hardware layout and the space occupied by the printed circuit board, hindering miniaturization. Second, the large number of update interfaces inevitably leads to more frequent plugging and unplugging of the update tool, impacting the efficiency and stability of the device's development and debugging.

[0094] In an exemplary embodiment, obtaining the update data packet of the second chip as described above includes:

[0095] The update data packet of the second chip is obtained through the external interface, which is the only interface used by the electronic device to obtain external data.

[0096] The external interface is the only interface used by the electronic device to obtain external data. This means that the entire electronic device can only obtain external data through this single interface, and this external interface corresponds to the first chip. Therefore, the electronic device, including the first chip and the second chip, has no other externally exposed interfaces besides this external interface.

[0097] Alternatively, the external interface may be a Universal Serial Bus (USB) interface.

[0098] In this embodiment, the update data packet of the second chip is obtained through an external interface. The external interface is the only interface used by the electronic device to obtain external data. Thus, on the one hand, when the electronic device or the second chip has an update requirement, it is only necessary for the first chip to obtain the update data packet of the second chip through the external interface, which significantly reduces the complexity of updating different chips in the electronic device. On the other hand, since the electronic device only exposes the external interface as a single interface, the electronic device does not need to set a separate interface for updating on the second chip. Based on this, the number of external pins of the electronic device can be reduced and the complexity of the internal hardware layout of the electronic device can be reduced. This not only reduces the manufacturing cost of the electronic device, enabling the electronic device to meet the requirements of lightweight and miniaturization, but also reduces the number of times update tools are plugged and unplugged during the research and development and debugging phase of the electronic device based on fewer external interfaces, thereby improving the research and development and debugging efficiency and the stability of the electronic device.

[0099] In one exemplary embodiment, the method further includes:

[0100] The update data package is stored in the first storage partition.

[0101] The first storage partition can be a storage partition that the user has pre-allocated in the storage space of the first chip for the update data packet. Based on this, after the first chip obtains the update data packet from the second chip, it can automatically store the data update packet in the first storage partition.

[0102] Optionally, the first storage partition may be a flash partition of the first chip.

[0103] Optionally, before the first chip implements the chip update method, the update logic code of the second chip can be compiled into a complete firmware data upgrade package ota_full.bin. Then, this firmware data upgrade package ota_full.bin is placed as a firmware data component into the final release file PAC package of the first chip, thereby determining the storage partition corresponding to the final release file PAC package as the first storage partition.

[0104] In this embodiment, after the first chip obtains the update data packet from the second chip, it can store the data update packet in the first storage partition. Thus, the update data packet of the second chip has a fixed first storage partition in the first chip, which can ensure that even if the download of the update data packet is interrupted, the download of the update data packet can continue to be completed based on the same first storage partition, thereby improving the storage reliability of the update data packet. Based on this, it can ensure that the second chip is reliably updated.

[0105] In an exemplary embodiment, obtaining the update data packet of the second chip as described above includes:

[0106] In response to an update command for the second chip, the update data packet for the second chip is obtained, and the target mode is entered;

[0107] The above determination of the first version number of the data packet running on the second chip includes:

[0108] With the first chip in target mode, determine the first version number of the data packet running on the second chip.

[0109] The update command for the second chip can be initiated by the user from the electronic device to the first chip.

[0110] The purpose of putting the first chip into target mode is to enable the first chip to update the running data packet of the second chip. To put it simply, if the first chip is not in target mode, even if the first chip receives an update data packet for the second chip, it will not send the update data packet to the second chip, that is, it will not initiate an update action for the second chip.

[0111] Optionally, while acquiring the update data packet from the second chip, the first chip can also acquire an update data packet specific to itself. Therefore, when the first chip is in target mode, it updates its own firmware data while simultaneously determining the first version number of the data packet running on the second chip, achieving synchronized updates between the two chips. When the first chip is not in target mode, it only updates its own firmware data. Based on this, since the first chip can simultaneously control the update actions of both itself and the second chip, the unified update mechanism set on the first chip can more accurately ensure the consistency of version numbers between the first and second chips.

[0112] In this embodiment, in response to an update command for the second chip, the update data packet for the second chip is obtained, and the target mode is entered. Based on this, it is equivalent to telling the first chip that the first chip needs to lead the update action of the second chip. Thus, when the first chip is in the target mode, the first version number of the data packet running on the second chip is determined to complete the subsequent update action of the second chip. This realizes flexible updates of the firmware inside the electronic device, that is, the user can decide whether to update the second chip, and the first chip only leads the update action of the second chip when the user has an update requirement for the second chip.

[0113] In one exemplary embodiment, the method further includes:

[0114] Determine the initial data volume of the update packet;

[0115] The above determination of the third version number of the currently running data packet on the second chip includes:

[0116] If the first data volume and the second data volume are the same, determine the third version number of the data packet currently running on the second chip; the second data volume is the amount of data sent by the first chip in the process of sending the update data packet to the second chip.

[0117] The first data volume refers to the size of the data packet being updated.

[0118] Optionally, the first data volume can be obtained by the first chip performing length statistics on the update data packets.

[0119] The first data volume is the same as the second data volume, indicating that the first chip has completely sent the update data packet to the second chip, that is, the data volume sent for the update data packet is complete.

[0120] Optionally, during the process of the first chip sending the update data packet to the second chip, the update data packet can be split into multiple update data sub-packets. The number of update data sub-packets is counted before transmission, and then transmitted packet by packet. Thus, the first chip counts once for each update data sub-packet transmitted. After transmitting the last update data sub-packet, the count at the end of transmission is matched with the count before transmission to determine the size of the second data volume. It is easy to understand that if the count at the end of transmission matches the count before transmission, it indicates that the first data volume matches the second data volume, meaning that the first chip has completely transmitted the update data packet to the second chip.

[0121] In this embodiment, when the first chip has completely sent the update data packet to the second chip, and the first data packet has the same first data packet size as the second data packet size, the third version number of the data packet currently running on the second chip is further determined. Thus, by implementing a dual determination mechanism of data packet size matching and version number matching for the update result, the adverse situations of the first chip not correctly sending the update data packet to the second chip completely and / or the second chip not updating accurately and mistakenly sending the update completion message can be avoided. Based on this, the first chip can more accurately determine that the second chip has been reliably updated.

[0122] In one exemplary embodiment, resetting the control electronic device includes:

[0123] Control the electronic device to restart, or control the electronic device to shut down.

[0124] Restarting an electronic device can be understood as first powering off the device and then powering it back on to restore normal operation. Conversely, putting an electronic device into a shutdown state can be understood as directly shutting it down, with the device only resuming normal operation upon the next power-on command. Therefore, restarting an electronic device does not require a user-issued power-on command to restore normal operation, while putting it into a shutdown state requires a user-issued power-on command.

[0125] In this embodiment, when the third version number is the same as the second version number, that is, when the first chip determines that the second chip has been accurately updated, the first chip controls the electronic device to restart or controls the electronic device to enter a shutdown state. In this way, the second chip, which has been reset and re-entered the working state, can reload the firmware data corresponding to the update data package to realize the new function corresponding to the update data package.

[0126] Corresponding to the chip update method applied to a first chip in an electronic device, in an exemplary embodiment, a chip update method is also provided, applied to a second chip in an electronic device, the electronic device further including the first chip, such as... Figure 3 As shown, the method includes steps 302 to 314. Wherein:

[0127] Step 302: Receive update data packets from the first chip.

[0128] Step 304: Store the update data package to the second storage partition.

[0129] Step 306: Verify the update data packet and obtain the verification result.

[0130] Step 308: If the verification result is successful, restart the system.

[0131] Step 310: After restarting, install the update data package from the second storage partition to the third storage partition.

[0132] Step 312: Once the update package has been installed, generate an update completion message.

[0133] Step 314: Send an update completion message to the first chip. The update completion message is used by the first chip to determine the third version number of the data packet currently running on the second chip. If the third version number is the same as the second version number corresponding to the updated data packet, control the electronic device to reset.

[0134] The second storage partition can be a temporary storage partition that the user pre-allocates within the storage space of the second chip for update data packets. Based on this, after receiving update data packets from the first chip, the second chip can automatically store the data update packets in the second storage partition. In other words, the second storage partition is a temporary partition used by the second chip to temporarily store update data packets before the firmware data of the update data packets is actually written into the chip.

[0135] Optionally, the update data packet can be verified by the second chip performing legality and integrity verification on the update data packet, and the verification result of the update data packet can be determined based on the legality verification result and the integrity verification result.

[0136] The second chip restarts under the control of the first chip. That is, in response to the restart command of the first chip, the second chip restarts and then installs the update data package of the second storage partition to the third storage partition.

[0137] The third storage partition can be a storage partition that the user has pre-allocated in the storage space of the second chip for the actual writing of the update data package. Based on this, after the second chip restarts, it will automatically install the update data package of the second storage partition to the third storage partition, thus completing the actual writing of the firmware data in the update data package. At this point, the second chip has completed the update operation.

[0138] In a straightforward manner, the second and third storage partitions are different storage partitions of the second chip, meaning that the second and third storage partitions are independent of each other.

[0139] Optionally, the second and third storage partitions can be different flash partitions of the second chip.

[0140] In the aforementioned chip update method, the second chip receives an update data packet from the first chip; the second chip stores the update data packet in a second storage partition; the second chip verifies the update data packet and obtains a verification result; if the verification result is successful, the second chip restarts; after restarting, the second chip installs the update data packet from the second storage partition to a third storage partition; after the update data packet installation is complete, the second chip generates an update completion message; and the second chip sends the update completion message to the first chip. Using the chip update method provided in this application embodiment, the update data packet temporarily stored in the second storage partition is installed to the third storage partition only when the second chip verifies the update data packet and obtains a verification result that passes, thus formally writing the update data packet to complete the firmware data update of the second chip itself. Therefore, based on the verification mechanism, the update completion message sent from the second chip to the first chip can be ensured to have higher reliability, ensuring that the first chip will only reset the electronic device after ensuring that the second chip has been reliably updated.

[0141] In an exemplary embodiment, the verification result includes a first verification result and a second verification result; the above-described verification of the update data packet to obtain the verification result includes:

[0142] Perform a validity check on the update data packet to obtain the first verification result;

[0143] If the first verification result is valid, perform an integrity verification on the update data packet to obtain the second verification result;

[0144] The above-mentioned restart process, which occurs when the verification result passes, includes:

[0145] If the second verification result is complete, then restart.

[0146] The purpose of verifying the legitimacy of the update data packets is to ensure that the source of the update data packets is legitimate, so as to avoid the data security of the second chip being compromised by human tampering with the update data packets.

[0147] Optionally, the second chip can verify the digital signature of the update data packet using a pre-stored digital public key to perform a legality check on the update data packet.

[0148] The integrity check of the update data packet is to ensure that the update data packet has not been lost or bit flipped, which would cause adverse conditions. In other words, it ensures that the update data packet received by the second chip is no different from the update data packet provided by the source channel.

[0149] Optionally, the second chip can perform integrity verification on the update data packet by calculating the CRC32 value of the entire update data packet.

[0150] In this embodiment, during the verification process of the update data packet by the second chip, the update data packet is considered legitimate and capable of reliably updating only if the first verification result is valid and the second verification result is complete. Therefore, the second chip will restart so that, after restarting, the update data packet from the second storage partition can be installed to the third storage partition. At this point, the second chip completes the update operation. It can be seen that the dual verification mechanism based on legitimacy and completeness can significantly improve the update success rate of the second chip.

[0151] In one exemplary embodiment, the method further includes:

[0152] The first data volume of the update data packet is obtained, and the first data volume is determined by the first chip;

[0153] The above verification of the update data packet yields the following verification results:

[0154] If the first data volume and the third data volume are the same, the update data packet is verified to obtain the verification result; the third data volume is the amount of data received by the second chip during the process of receiving the update data packet from the first chip.

[0155] The first data volume can be synchronized to the second chip after the first chip determines it, so as to ensure that the second chip can perform data size verification on the update data packet in the subsequent process.

[0156] Corresponding to the process of the first chip sending update data packets, optionally, during the process of the second chip receiving update data packets, update data sub-packets can be received one by one. Thus, the second chip counts once for each received update data sub-packet. After receiving the last update data sub-packet, the count at the end of reception is matched with the count before reception to determine the size of the first data volume. It is easy to understand that if the count at the end of reception matches the count before reception, it indicates that the first data volume matches the third data volume, meaning that the second chip has completely received the update data packet from the first chip.

[0157] In this embodiment, the second chip verifies the update data packet after the first data volume and the third data volume are the same, that is, the second chip has completely received the update data from the first chip. This improves the reliability of the subsequent verification results and further ensures that the second chip can be reliably updated.

[0158] The solution provided by the chip update method applied to the second chip is similar to the solution described in the chip update method applied to the first chip. Therefore, the specific limitations of one or more chip update method embodiments applied to the second chip provided above can be found in the limitations of the chip update method applied to the first chip above. The same applies to the chip update method applied to electronic devices below, and will not be repeated here or below.

[0159] In one exemplary embodiment, a chip update method is also provided, applied to an electronic device. The electronic device includes a first chip and a second chip, the first chip and the second chip being electrically connected, such as... Figure 4 As shown, the method includes steps 402 to 416. Wherein:

[0160] Step 402: The first chip obtains the update data packet from the second chip.

[0161] Step 404: The first chip determines the first version number corresponding to the update data packet and the second version number of the data packet running on the second chip.

[0162] Step 406: If the first version number and the second version number are different, the first chip will send the update data packet to the second chip.

[0163] Step 408: The second chip updates the data packet based on the update data packet.

[0164] Step 410: If the update is complete, the second chip sends an update completion message to the first chip.

[0165] Step 412: The first chip determines the third version number of the data packet currently running by the second chip.

[0166] Step 414: If the third version number is the same as the first version number, perform a reset.

[0167] In cases where the third version number is the same as the first version number, resetting the electronic device will cause both the first chip 102 and the second chip 104 to be reset.

[0168] In the above chip update method, the update action of the second chip is completed under the leading role of the first chip. During the update process of the second chip, the first chip can determine the first version number of the data packet running on the second chip before the second chip is updated, and determine the third version number of the data packet currently running on the second chip after the second chip is updated. Thus, the first chip can accurately determine that the second chip has been updated before controlling the electronic device to reset. Based on this, by setting the procedural update logic on the first chip and the feedback mechanism on the second chip, it can be ensured that the second chip is indeed reliably updated.

[0169] In one exemplary embodiment, a chip update method is also provided, applied to an electronic device. The electronic device includes a first chip and a second chip, the first chip and the second chip being electrically connected, such as... Figure 5 As shown, the method includes steps 502 to 550. Wherein:

[0170] Step 502: In response to the update command for the second chip, the first chip obtains the update data packet of the second chip through the unique external interface of the electronic device and enters the target mode.

[0171] Step 504: The first chip stores the update data packet in the first storage partition;

[0172] Step 506: When the first chip is in target mode, it determines the first version number of the data packet running on the second chip;

[0173] Step 508: The first chip determines whether the first version number is the same as the second version number corresponding to the update data packet. If the first version number is different from the second version number corresponding to the update data packet, step 510 is executed. If the first version number is the same as the second version number corresponding to the update data packet, the first chip believes that no update action is needed for the second chip, and therefore step 552 is executed.

[0174] Step 510: The first chip sends the update data packet to the second chip;

[0175] Step 512: The second chip receives the update data packet from the first chip;

[0176] Step 514: The second chip stores the update data packet to the second storage partition;

[0177] Step 516: The second chip acquires the first data volume of the update data packet;

[0178] Step 518: The second chip determines whether the first data volume and the third data volume of the update data packet are the same. If the first data volume and the third data volume are the same, steps 520 and 534 are executed. If the first data volume and the third data volume are different, step 512 is executed again.

[0179] Step 520: The second chip generates a reception feedback message and sends the reception feedback message to the first chip;

[0180] Step 522: The first chip determines whether the received feedback message indicates that the second chip has successfully received the update data packet. If the received feedback message indicates that the second chip has not successfully received the update data packet, step 524 is executed. If the received feedback message indicates that the second chip has successfully received the update data packet, step 530 is executed.

[0181] Step 524: The first chip determines the number of times the second chip has failed to receive the update data packet.

[0182] Step 526: The first chip determines whether the number of counts is less than the preset number. If the number of counts is greater than or equal to the preset number, step 528 is executed. If the number of counts is less than the preset number, step 530 is executed.

[0183] Step 528, the first chip re-enters the target mode;

[0184] Step 530: The first chip determines whether the first data volume and the second data volume of the update data packet are the same. If the first data volume and the second data volume are the same, step 546 is executed. If the first data volume and the second data volume are not the same, step 510 is executed again.

[0185] Step 532: The second chip performs a validity check on the update data packet and obtains the first verification result;

[0186] Step 534: If the first verification result is valid, the second chip performs an integrity verification on the update data packet to obtain a second verification result.

[0187] Step 536: If the second verification result is complete, the second chip will be restarted.

[0188] Step 538: After restarting, the second chip installs the update data package from the second storage partition to the third storage partition;

[0189] Step 540: After the update data package is installed, the second chip generates an update completion message;

[0190] Step 542: The second chip sends an update completion message to the first chip;

[0191] Step 544: The first chip receives an update completion message from the second chip;

[0192] Step 546: When the first chip receives an update completion message from the second chip, the first chip determines whether the third version number of the currently running data packet on the second chip is the same as the second version number. If the third version number is the same as the second version number, step 548 is executed. If the third version number is different from the second version number, step 504 is executed again.

[0193] Step 548: Control the electronic device to restart, or control the electronic device to enter a shutdown state.

[0194] The first chip receiving the reception feedback message from the second chip, and the first chip receiving the update completion message from the second chip, can both be implemented based on the first chip's listening mechanism. That is to say, a listening mechanism can be preset in the first chip, so that when the second chip generates the reception feedback message and / or update completion message, the first chip can obtain the reception feedback message and / or update completion message from the second chip.

[0195] As can be seen, in the above chip update method, since the electronic device used only needs to set a single peripheral interface, the electronic device implementing the chip update method has a relatively simple structure. Moreover, the process update logic of the first chip to the second chip is highly efficient. At the same time, since there are no restrictions on the data link between the first chip and the second chip, the model of the first chip, the product type of the electronic device, or the peripheral circuits of the electronic device, the above chip update method has high adaptability to different electronic devices and is easy to deploy. Based on this, the above chip update method can effectively meet the overall requirements of efficiency and cost control for chip firmware data upgrades in wearable devices and other resource-constrained embedded systems at all stages of research and development, testing, generation, and maintenance.

[0196] 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 of other steps.

[0197] In one exemplary embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above-described method embodiments.

[0198] In one exemplary embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above-described method embodiments.

[0199] 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.

[0200] 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.

[0201] 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 chip update method, characterized in that, A first chip is used in an electronic device, the electronic device further comprising a second chip, the method comprising: Obtain the update data packet of the second chip; the update data packet is used by the second chip to update the data packet; Determine the first version number of the data packet running on the second chip; If the first version number is different from the second version number corresponding to the update data packet, the update data packet is sent to the second chip; Receive an update completion message from the second chip; Determine the third version number of the data packet currently running on the second chip; If the third version number is the same as the second version number, control the electronic device to reset.

2. The method according to claim 1, characterized in that, The step of obtaining the update data packet of the second chip includes: The update data packet of the second chip is obtained through an external interface, which is the only interface used by the electronic device to obtain external data.

3. The method according to claim 1, characterized in that, The method further includes: The updated data packet is stored in the first storage partition.

4. The method according to claim 2, characterized in that, The step of obtaining the update data packet of the second chip includes: In response to an update command for the second chip, the system acquires the update data packet for the second chip and enters the target mode; Determining the first version number of the data packet running on the second chip includes: When the first chip is in the target mode, determine the first version number of the data packet running on the second chip.

5. The method according to claim 1, characterized in that, The method further includes: Determine the first data volume of the update data packet; Determining the third version number of the currently running data packet on the second chip includes: If the first data volume and the second data volume are the same, determine the third version number of the data packet currently running on the second chip; the second data volume is the amount of data sent by the first chip during the process of sending the update data packet to the second chip.

6. The method according to claim 1, characterized in that, The control of resetting the electronic device includes: Control the electronic device to restart, or control the electronic device to enter a shutdown state.

7. A chip update method, characterized in that, A second chip is used in an electronic device, the electronic device further comprising a first chip, the method comprising: Receive update data packets from the first chip; The updated data packet is stored in the second storage partition; The updated data packet is verified to obtain the verification result; If the verification result is successful, restart the system. After restarting, the update data package from the second storage partition will be installed to the third storage partition; Once the update package has been installed, an update completion message is generated. The update completion message is sent to the first chip; the update completion message is used by the first chip to determine the third version number of the currently running data packet on the second chip, and if the third version number is the same as the second version number corresponding to the updated data packet, the electronic device is controlled to reset.

8. The method according to claim 7, characterized in that, The verification result includes a first verification result and a second verification result; the verification of the updated data packet to obtain the verification result includes: The validity of the update data packet is verified to obtain the first verification result; If the first verification result is valid, the integrity of the updated data packet is verified to obtain the second verification result; The step of restarting if the verification result is passed includes: If the second verification result is complete, then restart.

9. The method according to claim 7, characterized in that, The method further includes: The first data volume of the update data packet is obtained, and the first data volume is determined by the first chip. The step of verifying the updated data packet to obtain the verification result includes: When the first data volume and the third data volume are the same, the update data packet is verified to obtain a verification result; the third data volume is the amount of data received by the second chip during the process of receiving the update data packet from the first chip.

10. A chip update method, characterized in that, Applied to an electronic device, the electronic device including a first chip and a second chip, the first chip and the second chip being electrically connected, the method includes: The first chip obtains the update data packet from the second chip; The first chip determines the first version number corresponding to the update data packet and the second version number of the data packet running on the second chip; If the first version number is different from the second version number, the first chip will send the update data packet to the second chip; The second chip updates the data packet based on the update data packet; Upon completion of the update, the second chip sends an update completion message to the first chip; The first chip determines the third version number of the data packet currently running by the second chip; If the third version number is the same as the first version number, a reset is performed.