Firmware upgrading method, chip and electronic equipment
By receiving and verifying firmware upgrade data on the chip, the accuracy and continuity of data are ensured, and the problem of data transmission disorder during firmware upgrade is solved and data transmission efficiency is improved.
Patent Information
- Application Number
- CN202411301209.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-18
- Publication Date
- 2025-02-07
AI Technical Summary
When the chip is firmware upgraded, data crosstalk or communication disorders will lead to data transmission disorders, affecting the accuracy of firmware upgrade data and data transmission efficiency.
By receiving the firmware upgrade data sent by the second chip, the first header information is used to perform the first verification, and if it is passed, the second verification is performed based on the first verification information to ensure the accuracy of the data. Then parse the firmware upgrade information and generate the corresponding firmware upgrade data request to ensure data continuity.
Improve the accuracy of firmware upgrade data and data transmission efficiency, ensuring the continuity and accuracy of upgrade data.
Smart Images

Figure CN119396428A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of firmware upgrade, and in particular to a firmware upgrade method, chip and electronic device. Background Art
[0002] EC (Embedded Controller) chip is a very important customized control chip in electronic devices such as laptops. The firmware is generally burned during chip manufacturing, and the firmware needs to be upgraded during the use of the electronic device.
[0003] Currently, when a chip performs a firmware upgrade, the firmware upgrade file needs to be imported into the chip. During the process of importing the upgrade data, if data crosstalk or communication failure occurs, data transmission will be disordered, which is not conducive to improving the accuracy of the firmware upgrade data and the efficiency of data transmission. Summary of the invention
[0004] In view of the above problems, the embodiments of the present application provide a firmware upgrade method, a chip and an electronic device to solve the above technical problems that are not conducive to improving the accuracy of firmware upgrade data and the efficiency of data transmission.
[0005] In a first aspect, an embodiment of the present application provides a firmware upgrade method, which is applied to a first chip, and the firmware upgrade method includes:
[0006] receiving current firmware upgrade data sent by the second chip, wherein the current firmware upgrade data includes first header information, firmware upgrade information, and first verification information, and the first verification information is generated according to the first header information and the firmware upgrade information;
[0007] Performing a first check on the firmware upgrade data according to the first header information;
[0008] When the first verification passes, performing a second verification on the firmware upgrade data according to the first verification information;
[0009] When the second check passes, the firmware upgrade information is parsed to obtain a parsing result;
[0010] A firmware upgrade data request is sent to the second chip according to the analysis result, so that the second chip sends the next fixed upgrade data according to the firmware upgrade data request.
[0011] In a second aspect, an embodiment of the present application provides a chip, wherein the chip includes a processing module;
[0012] a storage module coupled to the processing module;
[0013] And, instructions, which are stored in the storage module and can be executed by the processing module to implement the above-mentioned firmware upgrade method.
[0014] In a third aspect, an embodiment of the present application provides an electronic device, wherein the electronic device includes the above-mentioned chip.
[0015] The firmware upgrade method, chip and electronic device provided in the embodiments of the present application receive current firmware upgrade data sent by the second chip; perform a first check on the firmware upgrade data according to the first header information; when the first check passes, perform a second check on the firmware upgrade data according to the first check information; when the second check passes, parse the firmware upgrade information to obtain a parsing result; send a firmware upgrade data request to the second chip according to the parsing result, so that the second chip sends the corresponding fixed upgrade data according to the firmware upgrade data request; through the above method, after receiving the firmware upgrade data, perform a first check through its first header information to distinguish the upgrade data from other data; perform a second check through its first check information to ensure the accuracy of the upgrade data; generate a corresponding firmware upgrade data request through the parsing result of its firmware upgrade information to ensure the continuity of the upgrade data; it is beneficial to simultaneously improve the accuracy of the firmware upgrade data and the efficiency of data transmission.
[0016] These and other aspects of the present application will become more clearly understood in the description of the following embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 An application scenario diagram of the firmware upgrade method provided in an embodiment of the present application is shown.
[0018] Figure 2 A flowchart of a firmware upgrade method provided in an embodiment of the present application is shown.
[0019] Figure 3 A flow chart showing a firmware upgrade method according to an embodiment of the present application is shown.
[0020] Figure 4 A schematic diagram of the structure of firmware upgrade data in the firmware upgrade method provided in an embodiment of the present application is shown.
[0021] Figure 5 An application scenario diagram of the firmware upgrade method provided in an embodiment of the present application is shown.
[0022] Figure 6 A schematic diagram of the structure of a chip provided in an embodiment of the present application is shown.
[0023] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0024] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present application, and cannot be understood as limiting the present application.
[0025] In order to enable those skilled in the art to better understand the solutions of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present application.
[0026] In the embodiments of the present application, it should be noted that, in this article, relational terms such as first and second, etc. are merely used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations.
[0027] Moreover, the terms "comprises," "comprising," or any other variation thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus that includes a list of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes the element.
[0028] In the description of the embodiments of the present application, words such as "example" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "example" or "for example" in the embodiments of the present application is not to be interpreted as being more preferred or having more advantages than another embodiment or design. The use of words such as "example" or "for example" is intended to present relative concepts in a clear manner.
[0029] In addition, the "plurality" in the embodiments of the present application refers to two or more than two. In view of this, in the embodiments of the present application, "plurality" can also be understood as "at least two". "At least one" can be understood as one or more, for example, one, two or more. For example, including at least one means including one, two or more, and there is no limit on which ones are included. For example, including at least one of A, B and C, then A, B, C, A and B, A and C, B and C, or A, B and C can be included.
[0030] It should be noted that, in the embodiments of the present application, "and / or" describes the association relationship of the associated objects, indicating that three relationships may exist. For example, A and / or B may represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / ", unless otherwise specified, generally indicates that the associated objects before and after are in an "or" relationship.
[0031] It should be noted that in the embodiments of the present application, "connection" can be understood as electrical connection, and the connection between two electrical components can be a direct or indirect connection between the two electrical components. For example, the connection between A and B can be either a direct connection between A and B or an indirect connection between A and B through one or more other electrical components.
[0032] The firmware upgrade method provided in the embodiment of the present application can be applied to Figure 1 In the application scenario shown, the first chip and the second chip exchange data through a bus. The second chip sends firmware upgrade data to the first chip through the bus. The first chip receives the firmware upgrade data through the bus, processes the firmware upgrade data, and then sends a corresponding firmware upgrade data request to the second chip. The second chip receives the firmware upgrade data request through the bus and generates the next firmware upgrade data according to the firmware upgrade data request.
[0033] An embodiment of the present application provides a firmware upgrade method applied to a first chip, see Figure 2 and Figure 3 As shown, the firmware upgrade method includes steps S11 to S15:
[0034] Step S11: receiving current firmware upgrade data sent by the second chip.
[0035] See also Figure 4 As shown, the firmware upgrade data includes first header information, firmware upgrade information and first verification information. The first verification information is generated according to the first header information and the firmware upgrade information.
[0036] Among them, the first header information can be used to characterize the received data related to firmware upgrade. The first chip can verify that the current firmware upgrade data is related to firmware upgrade through the first header information. The first header information can be used to distinguish the current firmware upgrade data from other data that may be received by the first chip.
[0037] Among them, the firmware upgrade information can be divided into at least two types. Exemplarily, the type of the firmware upgrade information can be an upgrade startup data packet. Accordingly, the firmware upgrade information can include an upgrade instruction and a second verification information. The upgrade instruction is used to start the firmware upgrade process. The second verification information is generated according to the firmware upgrade file. The second verification information can be used to verify the firmware upgrade file after the first chip receives the complete firmware upgrade file. The firmware upgrade file is divided into multiple firmware upgrade programs. Exemplarily, the type of the firmware upgrade information can also be an upgrade program data packet. Accordingly, the firmware upgrade information includes a firmware upgrade program and at least one description information of the firmware upgrade program.
[0038] Step S12: performing a first check on the firmware upgrade data according to the first header information.
[0039] Among them, whether the firmware upgrade data is data related to the firmware upgrade can be determined through the first header information. When the firmware upgrade data is data related to the firmware upgrade, the first check passes; when the firmware upgrade data is not data related to the firmware upgrade, the first check fails.
[0040] Step S13: When the first verification passes, a second verification is performed on the firmware upgrade data according to the first verification information.
[0041] Among them, the first verification information is generated by the second chip based on the first header information and the firmware upgrade information when assembling the firmware upgrade data. During the second verification process, the first chip can use the same operation method as the second chip to calculate the received first header information and firmware upgrade information; if the operation result is consistent with the first verification information, the second verification passes; if the operation result is inconsistent with the first verification information, the second verification fails.
[0042] Step S14: When the second verification passes, the firmware upgrade information is parsed to obtain a parsing result.
[0043] The parsing result may include the type of the firmware upgrade information and the data content of the firmware upgrade information.
[0044] Step S15: sending a firmware upgrade data request to the second chip according to the analysis result, so that the second chip sends corresponding fixed upgrade data according to the firmware upgrade data request.
[0045] Among them, the first chip can determine the current upgrade data processing node according to the analysis result, and generate a firmware upgrade data request to request the second chip to send the fixed upgrade data of the next upgrade data processing node. Exemplarily, the type of firmware upgrade information received by the first chip is an upgrade startup data packet, and it is necessary to request the second chip to send the first upgrade program data packet. The first chip generates a firmware upgrade data request pointing to the first firmware upgrade program, and the second chip sends the upgrade program data packet containing the first firmware upgrade data to the first chip based on the firmware upgrade data request. Exemplarily, the firmware upgrade information received by the first chip contains the nth firmware upgrade program, wherein n is a natural number greater than or equal to 1 and less than or equal to N, and N is the number of firmware upgrade programs. The first chip needs to request the second chip to send the n+1th upgrade program data packet, the first chip generates a firmware upgrade data request for the n+1th firmware upgrade program, and the second chip sends the upgrade program data packet containing the n+1th firmware upgrade data to the first chip based on the firmware upgrade data request. Exemplarily, the firmware upgrade information received by the first chip includes the Nth firmware upgrade program, and it is necessary to request the second chip to send firmware upgrade end information. The first chip generates a firmware upgrade data request for the firmware upgrade end information, and the second chip sends firmware upgrade data containing the firmware upgrade end information to the first chip based on the firmware upgrade data request.
[0046] In this embodiment, after receiving the firmware upgrade data, a first check is performed through its first header information to distinguish the upgrade data from other data; a second check is performed through its first check information to ensure the accuracy of the upgrade data; a corresponding firmware upgrade data request is generated through the analysis result of its firmware upgrade information to ensure the continuity of the upgrade data; this is conducive to improving both the accuracy of the firmware upgrade data and the efficiency of data transmission.
[0047] As an implementation method, the received first header information can be compared with the preset firmware upgrade verification information. If the first header information matches the preset firmware upgrade verification information, it is determined that the firmware upgrade data is data related to the firmware upgrade, and the first verification passes; if the first header information does not match the preset firmware upgrade verification information, it is determined that the firmware upgrade data is not data related to the firmware upgrade, and the first verification fails.
[0048] In this embodiment, the first header information includes a first magic check value and a first data type code value. The preset firmware upgrade check information includes a first preset magic value and a first preset code value. The first magic check value can be used to characterize the encoding format of the firmware upgrade data or to characterize the sending object of the firmware upgrade data. The first preset magic value can be configured for the first chip. The first preset magic value can be used to uniquely characterize the encoding format that the first chip can parse or to uniquely characterize the first chip. The first chip can determine whether the received data is data that it can parse or whether it is data sent to itself according to the first magic check value; the first data type code value can be used to characterize the data type, divide the interactive data of the first chip into different data types, and match a unique preset identification code for each data type. For example, the data type can include but is not limited to the firmware upgrade class, the control signal class, the first peripheral interaction class, and the second peripheral interaction class. Among them, the preset identification code corresponding to the firmware upgrade class is the first preset code value.
[0049] Step S12 specifically includes the following steps:
[0050] S121, extracting a first magic number check value and a first data type code value in the first header information;
[0051] S122: If the first magic number check value is the first preset magic value and the first data type code value is the first preset code value, the first check passes.
[0052] In this embodiment, the first magic number check value can be used to verify that the receiving object of the firmware upgrade data is the first chip, and the first data type code value can be used to verify that the data type of the firmware upgrade data is a firmware upgrade class, which can avoid data transmission disorder caused by the first chip receiving data sent by other chips or other electronic devices or other types of data during the upgrade process.
[0053] In some implementations, the first magic check value in the first header information may be first extracted; if the first magic check value is a first preset magic value, the first data type code value in the first header information is extracted; if the first data type code value is a first preset code value, the first verification passes. In this implementation, the first magic check value is first extracted and verified, and when the first magic check value is not the first preset magic value, the firmware upgrade data is stopped from being received, which is conducive to improving data processing efficiency.
[0054] As an implementation manner, step S13 specifically includes the following steps:
[0055] S131, performing calculation on the first header information and the firmware upgrade information according to a first preset algorithm to obtain first calculation data;
[0056] S132: If the first verification information matches the first operation data, the second verification passes.
[0057] The first verification information is obtained by the second chip calculating the first header information and the firmware upgrade information according to the first preset algorithm. If the firmware upgrade data is not wrong during packaging and / or transmission, the first verification information is consistent with the first calculation data, and the second verification passes. If the first verification information is inconsistent with the first calculation data, the second verification fails.
[0058] In this embodiment, a second check is performed for each firmware upgrade data to ensure that there is no error in the firmware upgrade data during the transmission process, which is conducive to improving the accuracy of the data.
[0059] Exemplarily, the first preset algorithm may be a CRC algorithm (Cyclic Redundancy Check), which is a fast algorithm that generates a short fixed-bit check code based on data such as a data packet or a file, and is mainly used to detect or check errors that may occur after data transmission or storage. The CRC algorithm is used to generate the first check information and the first operation data, with only two bytes of redundant code, which improves accuracy without affecting transmission time.
[0060] As an implementation manner, the parsing result includes the type of firmware upgrade information. The firmware upgrade method of this embodiment further includes the following steps after step S14 and before step S15:
[0061] Step S21: If the type of the firmware upgrade information is an upgrade program data packet, the firmware upgrade program obtained by parsing is stored in the first storage module.
[0062] The parsing result may include the type of firmware upgrade information and the data content of the firmware upgrade information. The type of firmware upgrade information is an upgrade program data packet, and the corresponding data content of the firmware upgrade information is a firmware upgrade program. The first storage module is an external storage medium, and the first storage module is not disposed inside the first chip. The first chip stores the firmware upgrade programs received in sequence in the first storage module respectively, and performs subsequent processing after all firmware upgrade programs are received.
[0063] As an implementation manner, the parsing result includes the type of firmware upgrade information. The firmware upgrade method of this embodiment further includes the following steps:
[0064] Step S31: if the type of the firmware upgrade information is an upgrade start data packet, the second verification information obtained by parsing is stored, the second verification information is generated according to the firmware upgrade file, and the firmware upgrade file includes multiple firmware upgrade programs.
[0065] The parsing result may include the type of firmware upgrade information and the data content of the firmware upgrade information. The type of firmware upgrade information is an upgrade startup data packet, and the corresponding data content of the firmware upgrade information includes an upgrade instruction and a second verification information. The second verification information is obtained by calculating the complete firmware upgrade file formed by all firmware upgrade programs when the second chip assembles the current firmware upgrade data. The second chip sends the upgrade instruction and the second verification information to the first chip at the same time, and the first chip initiates the upgrade data request according to the upgrade instruction. The second verification information can be stored in a storage medium inside the first chip, for example, the second verification information is stored in the memory or cache of the first chip.
[0066] Step S32: When the firmware upgrade file is completely received, a third verification is performed on the firmware upgrade file according to the second verification information.
[0067] Among them, during the third verification process, the first chip reads back all the firmware upgrade data from the first storage module. The first chip can adopt the same operation method as the second chip to merge all the received firmware upgrade programs into a completed firmware upgrade file, and perform operations on the obtained firmware upgrade file; if the operation result is consistent with the second verification information, the third verification passes; if the operation result is inconsistent with the second verification information, the third verification fails.
[0068] Step S33: When the third verification passes, the firmware is upgraded according to the firmware upgrade file.
[0069] After the third verification is passed, the first chip runs the firmware upgrade file to complete the firmware upgrade.
[0070] In this embodiment, on the basis of performing the first check and the second check on each firmware upgrade data, after receiving all the firmware upgrade programs, the first chip performs the third check according to the second check information stored when the upgrade is started, which is beneficial to improve the accuracy of the data.
[0071] In some implementations, performing a third verification on the firmware upgrade file according to the second verification information in step S32 specifically includes the following steps:
[0072] S321, calculating the firmware upgrade file according to a second preset algorithm to obtain second calculation data;
[0073] S322: If the second verification information matches the second operation data, the third verification passes.
[0074] The second verification information is obtained by the second chip calculating all the firmware upgrade data according to the second preset algorithm. If all the firmware upgrade data are correct during packaging and / or transmission, the second verification information is consistent with the second calculation data, and the third verification passes. If the second verification information is inconsistent with the second calculation data, the third verification fails.
[0075] In this embodiment, a third check is performed on a complete firmware upgrade file formed by all firmware upgrade data to ensure that all firmware upgrade data are error-free during the transmission process, which is beneficial to improving the accuracy of the data.
[0076] Exemplarily, the second preset algorithm may be an MD5 message-digest algorithm, which is a cryptographic hash function that can generate a 128-bit (16-byte) hash value to ensure that information transmission is complete and consistent. The MD5 message-digest algorithm is used to generate the second verification information and the second operation data, which improves accuracy without affecting transmission time or data operation time.
[0077] In some implementations, the parsing result includes the type of firmware upgrade information, and step S15 specifically includes the following steps:
[0078] S151: When the type of the firmware upgrade information is an upgrade program data packet, generate request object representation information according to at least one description information of a next firmware upgrade program.
[0079] Among them, the type of firmware upgrade information received by the first chip is an upgrade program data packet, and the data content of the firmware upgrade information includes the nth firmware upgrade program. The first chip needs to request the second chip to send the n+1th upgrade program data packet, and the first chip generates a firmware upgrade data request for the n+1th firmware upgrade program. The firmware upgrade data request includes at least one description information of the n+1th firmware upgrade program. The description information may be, for example, an index of the firmware upgrade program, a request address of the firmware upgrade program, or a data size of the firmware upgrade program.
[0080] S152, obtaining second header information, and generating third verification information according to the second header information and the request object representation information.
[0081] Among them, the second header information can be used to characterize the received data related to the firmware upgrade request. The second chip can verify that the current firmware upgrade data request is data related to the firmware upgrade request through the second header information. The second header information can be used to distinguish the current firmware upgrade data request from other data that the second chip may receive. Exemplarily, the second header information includes a second magic number check value and a second data type code value. The second magic number check value can be used to characterize the encoding format of the firmware upgrade data request or to characterize the sending object of the firmware upgrade data request. The second preset magic value can be configured for the second chip. The second preset magic value can be used to uniquely characterize the encoding format that the second chip can parse or to uniquely characterize the second chip. The second chip can determine whether the received data is data that it can parse or whether it is data sent to itself according to the second magic number check value; the second data type code value can be used to characterize the data type of the second chip, divide the interaction data of the second chip into different data types, and match a unique preset identification code for each data type. For example, the data type of the second chip can include but is not limited to the firmware upgrade request class of the first chip, the firmware upgrade request class of the third chip, the third peripheral interaction class, and the fourth peripheral interaction class. The preset identification code corresponding to the firmware upgrade request class of the first chip is the second preset code value.
[0082] Wherein, a first preset algorithm is used to operate the second header information and the request object representation information to obtain third verification information.
[0083] S153: Generate a firmware upgrade data request according to the second header information, the request object representation information, and the third verification information.
[0084] S154, sending a firmware upgrade data request to the second chip.
[0085] Among them, after the second chip receives the firmware upgrade data request, it first verifies the second header information; after the second header information is verified, the third verification information is verified; after the third verification information is verified, the second chip parses the request object representation information, obtains the corresponding firmware upgrade program according to the parsing result of the request object representation information, and packages the firmware upgrade program to generate corresponding firmware upgrade data, namely the next firmware upgrade data.
[0086] In this embodiment, after the first chip completes processing of the previous firmware upgrade data, it requests the second chip for the next firmware upgrade data, which is beneficial to improve the accuracy and efficiency of data transmission at the same time. In some embodiments, the type of firmware upgrade information can also include an error feedback data packet, which is used to indicate that the firmware upgrade data request sent by the first chip has a verification error.
[0087] Accordingly, step S15 specifically includes the following steps:
[0088] S151', when the type of the firmware upgrade information is an error feedback data packet, generating request object representation information according to at least one description information of the firmware upgrade program pointed to by the error feedback.
[0089] Among them, the second chip receives the firmware upgrade data request of the nth upgrade program data packet, verifies the firmware upgrade data request, and if the verification fails, sends the corresponding error feedback data packet to the first chip, and the error feedback data packet serves as the firmware upgrade information of the next firmware upgrade data. The error feedback data packet may include a verification error prompt and description information of the firmware upgrade program. The types in the parsing result of the first chip are error feedback data packet, verification error prompt and description information of the firmware upgrade program. The first chip needs to re-request the second chip to send the nth upgrade program data packet, and the first chip regenerates the firmware upgrade data request of the nth upgrade program data packet. The firmware upgrade data request includes at least one description information of the nth firmware upgrade program. The description information may be, for example, the index of the firmware upgrade program, the request address of the firmware upgrade program, or the data size of the firmware upgrade program.
[0090] S152', obtaining the second header information, and generating third verification information according to the second header information and the request object representation information.
[0091] S153', generating a firmware upgrade data request according to the second header information, the request object representation information and the third verification information.
[0092] S154', sending a firmware upgrade data request to the second chip.
[0093] For details of steps S152 ′ to S154 ′, please refer to the description of steps S152 to S154 , which will not be described in detail here.
[0094] In this implementation, when an error feedback data packet is received, a firmware upgrade data request of the firmware upgrade program pointed to by the error feedback is resent, which is beneficial to improving both the accuracy and efficiency of data transmission.
[0095] In some embodiments, in order to further improve the speed of firmware upgrade, the firmware upgrade information may include a type tag and the data content of the firmware upgrade information. The type of the firmware upgrade information can be directly determined according to the type tag without determining the type through the data content. The type tag can be an upgrade start instruction tag, an upgrade program tag, or an error feedback tag.
[0096] In some embodiments, when the type of the firmware upgrade information is an upgrade program data packet, the firmware upgrade information may include an upgrade program tag, a firmware upgrade program, and at least one description information of the firmware upgrade program. Before the firmware upgrade program is stored in the first storage module, each description information may be verified in turn. Exemplarily, the firmware upgrade information may include an upgrade program tag, a firmware upgrade program, an index of the firmware upgrade program, a request address of the firmware upgrade program, and a data size of the firmware upgrade program; before the firmware upgrade program is stored in the first storage module, determine whether the index of the firmware upgrade program is consistent with the index recorded in the generated firmware upgrade data request; when the index is consistent, determine whether the request address of the firmware upgrade program is consistent with the request address recorded in the generated firmware upgrade data request; when the request address is consistent, determine whether the data size of the firmware upgrade program is consistent with the data size recorded in the generated firmware upgrade data request; when the data size is consistent, store the firmware upgrade program in the first storage module.
[0097] In some embodiments, when the type of the firmware upgrade information is an upgrade startup data packet, the firmware upgrade information may include an upgrade instruction, a firmware upgrade file description information, and a second verification information. The firmware upgrade file description information includes the data size of the firmware upgrade file, the storage address of the firmware upgrade file, and the index information of the firmware upgrade file. The second chip can split the firmware upgrade file into multiple firmware upgrade programs according to the data size of the firmware upgrade file and determine the data size of each firmware upgrade program; determine the request address of each firmware upgrade program in turn according to the storage address of the firmware upgrade file and the data size of each firmware upgrade program; determine the index of each firmware upgrade program in turn according to the index information of the firmware upgrade file and the data size of each firmware upgrade program. Exemplarily, the firmware upgrade file description information may further include firmware upgrade file version information, and the first chip can check the firmware upgrade file version information.
[0098] Accordingly, after step S31, the following steps are also included:
[0099] S41, obtaining the number of firmware upgrade programs according to the firmware upgrade file description information obtained by parsing.
[0100] Among them, it can be determined by the number of firmware upgrade programs whether the current firmware upgrade program is the last firmware upgrade program, and further determine whether the firmware upgrade program has been received.
[0101] Accordingly, the firmware upgrade method of this embodiment further includes the following steps before step S15:
[0102] S51, when the parsing result includes that the type of the firmware upgrade information is an upgrade program data packet and the firmware upgrade information includes the last firmware upgrade program, it is determined that the firmware upgrade file is completely received.
[0103] Accordingly, step S15 specifically includes the following steps:
[0104] S15a, obtaining the second header information, and generating third verification information according to the second header information and the upgrade data reception completion information.
[0105] The method for generating the third verification information refers to the above-mentioned embodiments and implementation methods.
[0106] S15b, generating a firmware upgrade data request according to the second header information, the upgrade data reception completion information and the third verification information.
[0107] S15c, sending a firmware upgrade data request to the second chip.
[0108] After receiving the firmware upgrade data request including the upgrade data reception completion information, the second chip generates corresponding third verification information according to the second header information and the upgrade completion information, and generates corresponding firmware upgrade data according to the second header information, the upgrade completion information and the third verification information, and the type of the firmware upgrade data is an upgrade completion data packet, wherein the upgrade completion information can be an upgrade completion code or an upgrade completion instruction. After receiving the firmware upgrade data including the upgrade completion information, the first chip erases all firmware upgrade programs in the first storage module according to the upgrade completion information.
[0109] As an implementation mode, if the current firmware upgrade data fails the first verification or the second verification, the first chip generates the current firmware upgrade data verification error information, generates the third verification information according to the second header information and the current firmware upgrade data verification error information, assembles the second header information, the current firmware upgrade data verification error information and the third verification information to form a firmware upgrade data request, and sends the firmware upgrade data request to the second chip. After receiving the firmware upgrade data request, the second chip regenerates and sends the current firmware upgrade data.
[0110] In this implementation, for different types of firmware upgrade data, if the first check or the second check fails, the first chip re-requests the firmware upgrade data, which is beneficial to improving the accuracy and efficiency of the firmware upgrade.
[0111] As an implementation manner, the firmware upgrade method of this embodiment further includes the following steps after step S15:
[0112] S61, when a first preset time has passed after a firmware upgrade data request is sent and no firmware upgrade data sent by the second chip is received, a reset operation is performed.
[0113] Among them, if the time difference between the current time and the sending time of the firmware upgrade data request is greater than or equal to the first preset time, and the firmware upgrade data is not received, it is determined that the second chip has timed out and has not responded to the firmware upgrade data, and communication may fail. The first chip resets itself to repair potential communication obstacles.
[0114] S62, when the first preset time passes after the reset and no firmware upgrade data is received from the second chip, a bus abnormality recovery request is sent to the second chip through the first interface so that the second chip re-establishes communication with the first chip according to the bus abnormality recovery request.
[0115] The first interface may be, for example, a general purpose input / output (GPIO) interface, and the bus abnormality recovery request may be a string of specific sequence codes, which are used to characterize the I2C communication abnormality of the second chip and request recovery of the I2C communication.
[0116] In this embodiment, after sending a firmware upgrade data request, if the first chip does not receive the firmware upgrade data sent by the second chip after a first preset time, it first resets itself to eliminate its own potential communication failure. If it still cannot receive the firmware upgrade data after resetting, it sends a request to re-establish communication to the second chip through the first interface to improve the efficiency of communication recovery.
[0117] After the second chip re-establishes communication with the first chip according to the bus abnormality recovery request, if no firmware upgrade data request is received after a second preset time, prompt information for indicating the abnormality of the bus communication of the first chip is sent, and the display module is controlled to display the prompt information.
[0118] As an implementation method, the first chip and the second chip communicate through a human-computer interaction protocol (Human Interface Device over Inter-Integrated Circuit, HID over I2C) protocol based on I2C communication. The human-computer interaction protocol based on I2C communication extends the HID (Human Interface Device) protocol to I2C (Inter-Integrated Circuit) and combines the I2C protocol and the HID protocol to achieve communication between the first chip and the second chip.
[0119] In this embodiment, the first chip sends the firmware upgrade data request to the second chip through the bus according to the human-computer interaction protocol based on I2C communication, and the second chip sends the firmware upgrade data to the second chip through the bus according to the human-computer interaction protocol based on I2C communication, which can improve the communication rate.
[0120] In some embodiments, see Figure 5 As shown, the first chip may be an EC chip, and the second chip may be a SOC (System on Chip) chip. The EC chip and the SOC chip are arranged in the same electronic device, and the SOC chip is the main control chip of the electronic device. In this embodiment, the firmware of the EC chip is upgraded by the SOC chip, which is conducive to improving the efficiency of the firmware upgrade.
[0121] In some embodiments, the first storage module may be a flash memory (Flash), and the first storage module may be connected to the first chip via an SPI (Serial Peripheral interface) bus, and the first chip sends a firmware upgrade program to the first storage module via the SPI bus and reads back the firmware upgrade program from the first storage module. Exemplarily, the SOC chip executes the upper computer program, and the EC chip executes the lower computer program to complete the firmware upgrade.
[0122] An embodiment of the present application provides a chip 300, see Figure 6 As shown, the chip 300 is used to implement the above-mentioned firmware upgrade method, and the chip 300 includes a firmware upgrade program for implementing the above-mentioned firmware upgrade method. A chip (Integrated Circuit, IC) is also called a chip, and the chip can be, but is not limited to, a SOC (System on Chip, chip-level system) chip, a SIP (system in package, system-level packaging) chip, or an EC chip.
[0123] The chip 300 includes a processing module 31 , a storage module 32 and instructions. The storage module 32 is coupled to the processing module 31 . The instructions are stored in the storage module 32 and can be executed by the processing module 31 to implement the above-mentioned firmware upgrade method.
[0124] The processing module 31 can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc.
[0125] The storage module 32 may be non-volatile or volatile. The instruction may be a program instruction, and the program instruction may be stored in the storage module 32 in the form of a software product. For example, the storage module 32 may include: a read-only memory (ROM) or a random access memory (RAM) or other media that can store program codes.
[0126] After receiving the firmware upgrade data, the chip of this embodiment performs a first check through its first header information to distinguish the upgrade data from other data; performs a second check through its first check information to ensure the accuracy of the upgrade data; generates a corresponding firmware upgrade data request through the analysis result of its firmware upgrade information to ensure the continuity of the upgrade data; and is conducive to improving both the accuracy of the firmware upgrade data and the efficiency of data transmission.
[0127] The present application embodiment also provides an electronic device 400, see Figure 7 As shown, the electronic device 400 includes a device body and a chip 300 as described above, which is arranged in the device body. The electronic device can be, but is not limited to, a weight scale, a body fat scale, a nutrition scale, a pulse oximeter, a human body composition analyzer, a display, a USB (Universal Serial Bus) docking station, a car, a smart wearable device, a mobile terminal, and a smart home device. Smart wearable devices include, but are not limited to, smart watches, smart bracelets, and cervical massagers. Mobile terminals include, but are not limited to, smart phones, laptops, tablet computers, and POS (point of sales terminal). Smart home devices include, but are not limited to, smart sockets, smart rice cookers, smart sweepers, and smart lights.
[0128] After receiving the firmware upgrade data, the electronic device of this embodiment performs a first check through its first header information to distinguish the upgrade data from other data; performs a second check through its first check information to ensure the accuracy of the upgrade data; generates a corresponding firmware upgrade data request through the analysis result of its firmware upgrade information to ensure the continuity of the upgrade data; this is beneficial to simultaneously improve the accuracy of the firmware upgrade data and the efficiency of data transmission.
[0129] The above is only an implementation method of the present application. It should be pointed out that a person skilled in the art can make improvements without departing from the inventive concept of the present application, but these improvements are within the scope of protection of the present application.
Claims
1. A firmware upgrade method, characterized in that: Applied to the first chip, the firmware upgrade method includes: receiving current firmware upgrade data sent by the second chip, wherein the current firmware upgrade data includes first header information, firmware upgrade information, and first verification information, and the first verification information is generated according to the first header information and the firmware upgrade information; Performing a first check on the firmware upgrade data according to the first header information; When the first verification passes, performing a second verification on the firmware upgrade data according to the first verification information; When the second check passes, the firmware upgrade information is parsed to obtain a parsing result; A firmware upgrade data request is sent to the second chip according to the analysis result, so that the second chip sends the next fixed upgrade data according to the firmware upgrade data request.
2. The firmware upgrade method according to claim 1, characterized in that: The first header information includes a first magic number check value and a first data type code value; The performing a first check on the firmware upgrade data according to the first header information includes: Extracting a first magic number check value and a first data type code value from the first header information; If the first magic check value is a first preset magic value and the first data type code value is a first preset code value, the first check passes.
3. The firmware upgrade method according to claim 1, characterized in that: The performing a second verification on the firmware upgrade data according to the first verification information includes: Performing calculation on the first header information and the firmware upgrade information according to a first preset algorithm to obtain first calculation data; If the first verification information matches the first operation data, the second verification passes.
4. The firmware upgrade method according to claim 1, characterized in that: The parsing result includes the type of the firmware upgrade information; The firmware upgrade method further includes: If the type of the firmware upgrade information is an upgrade program data packet, the firmware upgrade program obtained by parsing is stored in the first storage module.
5. The firmware upgrade method according to claim 4, characterized in that: The firmware upgrade method further includes: If the type of the firmware upgrade information is an upgrade startup data packet, storing the second verification information obtained by parsing, wherein the second verification information is generated according to a firmware upgrade file, and the firmware upgrade file includes a plurality of the firmware upgrade programs; When the firmware upgrade file is received, performing a third verification on the firmware upgrade file according to the second verification information; When the third check passes, the firmware upgrade is performed according to the firmware upgrade file.
6. The firmware upgrade method according to claim 5, characterized in that: The performing a third verification on the firmware upgrade file according to the second verification information includes: Performing operation on the firmware upgrade file according to a second preset algorithm to obtain second operation data; If the second verification information matches the second operation data, the third verification passes.
7. The firmware upgrade method according to claim 5, characterized in that: The sending a firmware upgrade data request to the second chip according to the parsing result includes: When the type of the firmware upgrade information is an upgrade program data packet, generating request object representation information according to at least one description information of a next firmware upgrade program; Obtaining second header information, and generating third verification information according to the second header information and the request object representation information; Generate the firmware upgrade data request according to the second header information, the request object representation information and the third verification information; Send a firmware upgrade data request to the second chip.
8. The firmware upgrade method according to claim 5, characterized in that: The sending a firmware upgrade data request to the second chip according to the parsing result includes: When the type of the firmware upgrade information is an error feedback data packet, generating request object representation information according to at least one description information of the firmware upgrade program pointed to by the error feedback; Obtaining second header information, and generating third verification information according to the second header information and the request object representation information; Generate the firmware upgrade data request according to the second header information, the request object representation information and the third verification information; Send a firmware upgrade data request to the second chip.
9. The firmware upgrade method according to claim 5, characterized in that: After storing the second verification information obtained by parsing, the method further includes: Obtaining the number of firmware upgrade programs according to the firmware upgrade file description information obtained by parsing; Accordingly, the firmware upgrade method further includes: When the type of the firmware upgrade information is an upgrade program data packet and the firmware upgrade information includes the last firmware upgrade program, determining that the firmware upgrade file has been received; Accordingly, sending a firmware upgrade data request to the second chip according to the parsing result includes: Acquire the second header information, and generate third verification information according to the second header information and the upgrade data reception completion information; generating the firmware upgrade data request according to the second header information, the upgrade data reception completion information and the third verification information; Send a firmware upgrade data request to the second chip.
10. The firmware upgrade method according to any one of claims 1 to 9, characterized in that: After sending the firmware upgrade data request to the second chip according to the analysis result, the method further includes: When the firmware upgrade data request is sent and the firmware upgrade data sent by the second chip is not received within a first preset time, a reset operation is performed; When the first preset time has passed after resetting and no firmware upgrade data is received from the second chip, a bus abnormality recovery request is sent to the second chip through the first interface so that the second chip re-establishes communication with the first chip according to the bus abnormality recovery request.
11. The firmware upgrade method according to claim 1, characterized in that: The first chip and the second chip communicate with each other via a human-computer interaction protocol based on I2C communication.
12. The firmware upgrade method according to claim 10, characterized in that: The first chip is an EC chip, and the second chip is a SOC chip.
13. A chip, characterized in that: include: Processing module; a storage module coupled to the processing module; and, instructions, wherein the instructions are stored in the storage module and can be executed by the processing module to implement the firmware upgrade method according to any one of claims 1 to 12.
14. An electronic device, characterized in that: Comprising the chip as claimed in claim 13.
Citation Information
Cited By
Battery parameter updating method, device, equipment, medium and program product
CN120073107A