Firmware upgrading method

By simplifying the firmware packaging structure and upgrade process, using computers and cloud platforms to upgrade multi-chip firmware for embedded systems, the problems of low upgrade efficiency and high maintenance costs in the existing technology are solved, and efficient and simple firmware upgrades are achieved.

CN119668653APending Publication Date: 2025-03-21SHENZHEN HEWANG ENERGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411789518.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-06
Publication Date
2025-03-21

AI Technical Summary

Technical Problem

In the prior art, the multi-chip firmware upgrade method of embedded systems has a complex firmware packaging structure and low upgrade efficiency, resulting in high maintenance costs.

Method used

Obtain the upgrade firmware through the computer and add file headers according to its relevant information to form a firmware package. After splicing multiple firmware packages, add combination packages, package the file headers into a complete combination package, and send it to the cloud platform. After receiving the communication chip of the embedded device, it is unpacked and creates an upgrade task for upgrading.

Benefits of technology

It simplifies the firmware packaging structure, improves upgrade efficiency, reduces maintenance costs, and supports parallel upgrades of multiple chips, improving overall upgrade efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119668653A_ABST
    Figure CN119668653A_ABST
Patent Text Reader

Abstract

The invention discloses a firmware upgrading method, which is applied to a firmware upgrading system, the firmware upgrading system comprises a computer, a cloud platform and an embedded device communicating with the cloud platform through a communication gateway, the embedded device comprises a chip, the chip comprises a communication chip, and the communication chip is connected with the embedded device. The firmware upgrading method comprises the steps that a computer obtains at least one piece of upgrading firmware, a file header is added to the upgrading firmware according to related information of the upgrading firmware to form a firmware package, all the firmware packages are spliced, a combined package file header is added, and the combined package formed after packaging is sent to a cloud platform; the communication chip of the embedded device receives the combination packet from the cloud platform through the communication gateway; and the communication chip sequentially reads the file headers of the firmware packages in the combined package according to the splicing sequence, verifies the integrity of the upgrade firmware according to the information of the file headers, obtains the upgrade firmware, creates an upgrade task according to the file headers and the upgrade firmware, and upgrades the chips corresponding to the upgrade firmware.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of embedded system firmware upgrade, and in particular to a firmware upgrade method. Background Art

[0002] Embedded systems are computer systems that integrate hardware and software and can work independently. They are widely used in the industrial field. With the increasing requirements for product functions and performance, as well as the possible software defects, the demand for firmware upgrades for chips in embedded systems is becoming more and more common. At present, most products need to be manually upgraded on site when upgrading the firmware of the chip. This firmware upgrade method is feasible for places where the number of products is small and the distribution is relatively concentrated. However, in the case of products such as photovoltaic string inverters, which are used in large numbers, scattered application occasions and in a harsh distribution environment, this firmware upgrade method will greatly increase the product maintenance cost.

[0003] String inverters are mainly used in photovoltaic power generation systems to convert the direct current of photovoltaic cells into the alternating current required by the power grid. They mainly realize MPPT (Maximum Power Point Tracking, maximum power point tracking control solar controller), BOOST boost, inversion, active / reactive power control and fault protection functions. Due to the complexity of functions and standard requirements, string inverters generally contain multiple control chips, and multiple control chips need to be upgraded for firmware during product maintenance. In order to solve the problem of high maintenance cost of string inverters caused by the above manual upgrades, currently, the multi-chip upgrade of embedded systems uses multiple firmware packages for automatic upgrades, but the firmware package structure is complex and the upgrade speed is slow, which leads to low efficiency. Summary of the invention

[0004] The technical problem to be solved by the present invention is to provide a firmware upgrade method which has a simple firmware packaging structure and can improve the upgrade efficiency.

[0005] In order to solve the above technical problems, the present invention provides a firmware upgrade method, which is applied to a firmware upgrade system. The firmware upgrade system includes a computer, a cloud platform, and an embedded device that communicates with the cloud platform through a communication gateway. The embedded device includes a chip, and the chip includes a communication chip. The firmware upgrade method includes:

[0006] The computer obtains at least one upgrade firmware, and adds a file header to the upgrade firmware according to the relevant information of the upgrade firmware to form a firmware package, and sends the combined package formed by splicing all firmware packages and adding the combined package file header to the cloud platform;

[0007] The communication chip of the embedded device receives the combined package from the cloud platform through the communication gateway;

[0008] The communication chip reads the file header of each firmware package in the combination package in sequence according to the splicing order, verifies the integrity of each upgrade firmware according to the information in the file header and obtains each upgrade firmware, creates an upgrade task according to the file header and each upgrade firmware, and upgrades the chip corresponding to each upgrade firmware.

[0009] The further technical solution is: the computer obtains at least one upgrade firmware, and adds a file header to the upgrade firmware according to the relevant information of the upgrade firmware to form a firmware package, and the combined package formed by splicing all firmware packages and adding the combined package file header to the package is sent to the cloud platform, specifically including:

[0010] The computer obtains upgraded firmware of at least one chip in the embedded device;

[0011] Encrypt the upgrade firmware using an encryption algorithm to generate encrypted firmware;

[0012] Adding a file header of a predetermined size to the encrypted firmware according to the relevant information of the upgraded firmware to form a firmware package;

[0013] Splicing all firmware packages to obtain an intermediate combination package, and encrypting the intermediate combination package using an encryption algorithm to generate an encrypted intermediate combination package;

[0014] A combined file header of a predetermined size is added to the encrypted intermediate combined package according to relevant information of the intermediate combined package to form a combined package, and the combined package is sent to the cloud platform.

[0015] The further technical solution is: the communication chip of the embedded device receives the combination package from the cloud platform through the communication gateway, specifically including:

[0016] The cloud platform triggers the firmware upgrade command, the communication gateway downloads the combination package, and transmits it to the embedded device;

[0017] The communication chip of the embedded device receives the combined packet transmitted by the communication gateway;

[0018] After receiving the first packet of the combined package data, the communication chip obtains a combined package file header of a predetermined size, and verifies the integrity of the combined package file header according to the information of the combined package file header;

[0019] After the verification is passed, the integrity verification algorithm is used to perform integrity verification on the intermediate combined package formed by splicing all firmware packages in the received combined package. If the integrity verification of the intermediate combined package passes, the combined package is retained.

[0020] The present invention also provides a firmware upgrade method, which is applied to a computer. The firmware upgrade method comprises:

[0021] At least one upgrade firmware is obtained, and a file header is added to the upgrade firmware according to the relevant information of the upgrade firmware to form a firmware package, and the combined package formed by splicing all firmware packages and adding the combined package file header to the package is sent to the cloud platform, so that the cloud platform can send the combined package to the embedded device, so that the communication chip in the embedded device creates an upgrade task according to the file header of each firmware package in the combined package and the upgrade firmware, and upgrades the corresponding chip.

[0022] Its further technical solution is: obtaining at least one upgrade firmware, and adding a file header to the upgrade firmware according to the relevant information of the upgrade firmware to form a firmware package, and splicing all firmware packages and adding a combined package file header to form a combined package to send to the cloud platform, specifically including:

[0023] Obtaining upgraded firmware for at least one chip in the embedded device;

[0024] Encrypt the upgrade firmware using an encryption algorithm to generate encrypted firmware;

[0025] Adding a file header of a predetermined size to the encrypted firmware according to the relevant information of the upgraded firmware to form a firmware package;

[0026] Splicing all firmware packages to obtain an intermediate combination package, and encrypting the intermediate combination package using an encryption algorithm to generate an encrypted intermediate combination package;

[0027] A combined file header of a predetermined size is added to the encrypted intermediate combined package according to relevant information of the intermediate combined package to form a combined package, and the combined package is sent to the cloud platform.

[0028] The present invention also provides a firmware upgrade method, which is applied to an embedded device, wherein the embedded device includes a chip, and the chip includes a communication chip. The firmware upgrade method includes:

[0029] The communication chip of the embedded device receives a combined package consisting of an intermediate combined package and a combined package file header formed according to relevant information of the intermediate combined package from the communication gateway; wherein the intermediate combined package is formed by splicing all firmware packages, and the firmware package is composed of upgraded firmware and a file header formed according to relevant information of the upgraded firmware;

[0030] The communication chip reads the file headers of each firmware package in the combination package in sequence according to the splicing order, and verifies the integrity of each upgraded firmware according to the information in the file header and obtains each upgraded firmware;

[0031] Create an upgrade task according to the file header and each upgrade firmware, and upgrade the chip corresponding to each upgrade firmware.

[0032] A further technical solution is that the communication chip receives a combination package consisting of an intermediate combination package and a combination package file header formed according to relevant information of the intermediate combination package from a communication gateway, specifically including:

[0033] The communication chip of the embedded device receives the combined packet transmitted by the communication gateway;

[0034] After receiving the first packet of the combined package data, the communication chip obtains a combined package file header of a predetermined size, and verifies the integrity of the combined package file header according to the information of the combined package file header;

[0035] After the verification is passed, the communication chip uses the integrity verification algorithm to perform integrity verification on the intermediate combination package formed by splicing all firmware packages in the received combination package;

[0036] If the integrity check of the intermediate combined package passes, the combined package is retained.

[0037] The further technical solution is: using the integrity check algorithm in the communication chip to perform integrity check on the intermediate combination package formed by splicing all firmware packages in the received combination package, and also including:

[0038] If the combined package file header contains a key, the intermediate combined package formed by splicing all firmware packages in the received combined package is decrypted according to the key.

[0039] A further technical solution is that when the communication chip of the embedded device receives the combined package, the combined package data is read and processed according to the fixed byte buffer size, and is saved in the memory after the processing is completed.

[0040] The further technical solution is: the communication chip reads the file headers of each firmware package in the combination package in sequence according to the splicing order, and verifies the integrity of each upgraded firmware according to the information in the file header and obtains each upgraded firmware, specifically including:

[0041] The communication chip obtains the file header of the first firmware package spliced ​​in the combined package according to the size of the file header, and verifies the integrity of the file header of the first firmware package according to the information of the obtained file header;

[0042] After the verification is passed, the start address and end address of the first firmware package are searched according to the relevant information of the firmware upgrade in the obtained file header;

[0043] Obtain the upgrade firmware according to the start address and end address of the first firmware package searched;

[0044] Repeat the above steps in the order of splicing to obtain the remaining upgraded firmware in the package.

[0045] Its further technical solution is: after obtaining the upgrade firmware according to the start address and the end address of the first firmware package searched, it also includes:

[0046] If the file header of the first firmware package contains a key, the obtained upgrade firmware is decrypted according to the key to obtain the original upgrade firmware.

[0047] The further technical solution is: create an upgrade task according to the file header and each upgrade firmware, and upgrade the chip corresponding to each upgrade firmware, specifically including:

[0048] The communication chip obtains the corresponding chip to be upgraded according to the obtained file header information of each firmware package;

[0049] A multi-threaded upgrade task is created according to the acquired chips to be upgraded, and the corresponding upgrade firmware is sent to the chips to be upgraded through the upgrade interface, so that multiple chips to be upgraded are upgraded in parallel.

[0050] The beneficial technical effect of the present invention is as follows: compared with the prior art, the firmware upgrade method of the present invention obtains at least one upgrade firmware through a computer, and adds a file header to the upgrade firmware according to the relevant information of the upgrade firmware to form a firmware package, and sends the combined package formed by splicing all firmware packages and adding the combined package file header to the cloud platform, and the cloud platform sends the combined package to the communication chip of the embedded device through the communication gateway, and the communication chip unpacks the combined package after receiving the combined package, and creates an upgrade task for upgrading, that is, the file header of each firmware package in the received combined package is read in sequence according to the splicing order, and the integrity of each upgrade firmware is verified according to the information of the file header and each upgrade firmware is obtained, and the upgrade task is created according to the file header and each upgrade firmware, and the chip corresponding to each upgrade firmware is upgraded; it can be known that in the firmware upgrade method of the present invention, a firmware package is obtained by adding a file header formed according to the relevant information of the upgrade firmware in each upgrade firmware, and multiple firmware packages can be spliced ​​and then the combined package file header is added to package them into a complete combined package, the packaging structure is simple, the operation is convenient, the upgrade rate can be improved, thereby improving the upgrade efficiency, and the versatility and expansibility are strong. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] Figure 1 is a flowchart of a firmware upgrade method according to a first embodiment of the present invention;

[0052] Figure 2 yes Figure 1 A schematic flow chart of a specific implementation of step S10;

[0053] Figure 3 It is a schematic diagram of the packaging process of a single upgraded firmware in the firmware upgrade method of the first embodiment provided by the present invention;

[0054] Figure 4 yes Figure 3 Schematic diagram of the composition of the file header;

[0055] Figure 5is a schematic diagram of a packaging process of multiple firmware packages in the firmware upgrade method of the first embodiment provided by the present invention;

[0056] Figure 6 yes Figure 1 A schematic flow chart of a specific implementation of step S20;

[0057] Figure 7 yes Figure 1 A schematic flow chart of a specific implementation of step S30;

[0058] Figure 8 It is a flowchart of the firmware upgrade method of the second embodiment provided by the present invention. DETAILED DESCRIPTION

[0059] In order to more fully understand the technical content of the present invention, the technical solution of the present invention is further introduced and illustrated below in conjunction with schematic diagrams, but is not limited thereto.

[0060] See also Figure 1 As shown, Figure 1 The flowchart of the firmware upgrade method provided by the first embodiment of the present invention is as follows. The firmware upgrade method of this embodiment is applied to a firmware upgrade system. The firmware upgrade system includes a computer, a cloud platform, and an embedded device that communicates with the cloud platform through a communication gateway. The embedded device includes a chip, and the chip at least includes a communication chip. Specifically, the firmware upgrade method includes the following steps:

[0061] S10. The computer obtains at least one upgrade firmware, and adds a file header to the upgrade firmware according to the relevant information of the upgrade firmware to form a firmware package, and sends the combined package formed by splicing all firmware packages and adding a combined package file header to the cloud platform.

[0062] In the present invention, a combination package usually includes multiple firmware packages, which are spliced ​​together and then a combination package file header is added to form a combination package. However, it is understandable that the combination package may also include only one firmware package. In this case, only the relevant combination package file header needs to be added to the firmware package, so that the embedded device can support both a single firmware upgrade and multiple firmware upgrades.

[0063] S20. The communication chip of the embedded device receives the combined package from the cloud platform through the communication gateway.

[0064] In the present invention, the cloud platform stores the upgraded firmware from the computer and is responsible for transmitting the upgraded firmware to the communication gateway. The communication gateway is used for networking of embedded devices. The cloud platform interacts directly with the communication gateway, and the communication gateway interacts directly with the embedded device. In this embodiment, the communication chip of the embedded device is responsible for communicating with the communication gateway, which is used to receive the combination package and verify the integrity of the received combination package. Subsequent firmware upgrade operations can only be performed after the verification is passed.

[0065] S30, the communication chip reads the file headers of each firmware package in the combination package in sequence according to the splicing order, verifies the integrity of each upgrade firmware according to the information in the file header and obtains each upgrade firmware, creates an upgrade task according to the file header and each upgrade firmware, and upgrades the chip corresponding to each upgrade firmware.

[0066] In this step, the communication chip unpacks the received combined package to obtain each upgrade firmware, and creates an upgrade task according to the upgrade file type in the file header, so as to realize multi-chip upgrade.

[0067] The firmware upgrade method provided by the embodiment of the present invention has the following beneficial technical effects: compared with the prior art, the firmware upgrade method of the present invention obtains at least one upgrade firmware through a computer, and adds a file header to the upgrade firmware according to the relevant information of the upgrade firmware to form a firmware package, and sends the combined package formed by splicing all firmware packages and adding the combined package file header to the cloud platform, and the cloud platform sends the combined package to the communication chip of the embedded device through the communication gateway, and the communication chip unpacks the combined package after receiving the combined package, and creates an upgrade task for upgrading, that is, the file header of each firmware package in the received combined package is read in sequence according to the splicing order, and the integrity of each upgrade firmware is verified according to the information of the file header and each upgrade firmware is obtained, and the upgrade task is created according to the file header and each upgrade firmware, and the chip corresponding to each upgrade firmware is upgraded; it can be seen that in the firmware upgrade method of the present invention, the firmware package is obtained by adding the file header formed according to the relevant information of the upgrade firmware in each upgrade firmware, and multiple firmware packages can be spliced ​​and then the combined package file header is added to package into a complete combined package, the packaging structure is simple, the operation is convenient, the upgrade rate can be improved, thereby improving the upgrade efficiency, and the versatility and expansibility are strong.

[0068] like Figure 2 As shown, step S10 includes the following steps:

[0069] S11. The computer obtains upgrade firmware of at least one chip in the embedded device.

[0070] S12. Encrypt the upgrade firmware using an encryption algorithm to generate encrypted firmware.

[0071] In this embodiment, the encryption algorithm is a bitwise AND encryption algorithm, that is, the obtained upgrade firmware is encrypted using the bitwise AND encryption algorithm to ensure the security of the upgrade firmware, and the bitwise AND encryption algorithm is a lightweight encryption algorithm that can improve the efficiency of encryption and decryption processing. It can be understood that in some other embodiments, other lightweight encryption algorithms can also be used to encrypt the upgrade firmware to generate encrypted firmware.

[0072] S13. Add a file header of a predetermined size to the encrypted firmware according to the relevant information of the upgraded firmware to form a firmware package.

[0073] like Figure 3 As shown, when a single upgrade firmware is packaged, a file header of a predetermined size is added to the encrypted firmware, and the added file header is formed according to the relevant information of the upgrade firmware.

[0074] In the present invention, the relevant information of the upgrade firmware may include the chip corresponding to the upgrade firmware, the size of the upgrade firmware or the encrypted firmware after encryption, etc., and may also include the MD5 hash value of the upgrade firmware, so that the MD5 integrity check algorithm can be used to perform integrity check on the combination package and the upgrade firmware when the combination package is subsequently received and unpacked.

[0075] Preferably, in this embodiment, if Figure 4 As shown, the size of the file header is 64 bytes, which includes fields such as file header version, file header length, upgrade file type, upgrade file length, upgrade file key, file header integrity check, upgrade file integrity check, and reserved. Among them, the file header version field is used to indicate the file header version number, the file header length field indicates the file header size, such as the file header size of 64 bytes, the upgrade file type field is used to identify the chip corresponding to the upgrade firmware, that is, to identify the upgrade firmware for which chip the upgrade firmware is, and the upgrade file type can be represented by a custom value, for example, the upgrade file type of the bootloader upgrade firmware of chip 1 can be represented by 0, and the APP upgrade firmware type of chip 1 can be represented by 1; the upgrade file length field is used to indicate the size of the upgrade firmware or the encrypted firmware, the upgrade file key field is used for the key for decryption of the encrypted firmware, the file header integrity check field is used for the integrity verification of the file header, preferably using the CRC16 algorithm, the upgrade file integrity check field is used for the integrity check of the upgrade firmware, to ensure that the upgrade firmware has not been accidentally tampered with or damaged, preferably using the MD5 algorithm, this implementation only uses the first 4 bytes of the MD5 hash value for representation, and the reserved field occupies 46 bytes for later expansion. It is understandable that in some other embodiments, the integrity check of the upgrade file may also use other integrity check algorithms, for example, CRC or cumulative sum integrity check algorithms may be used.

[0076] S14, splicing all firmware packages to obtain an intermediate combination package, and encrypting the intermediate combination package using an encryption algorithm to generate an encrypted intermediate combination package.

[0077] In this step, the encryption algorithm may also be a bitwise AND encryption algorithm.

[0078] S15. Add a combination file header of a predetermined size to the encrypted intermediate combination package according to the relevant information of the intermediate combination package to form a combination package, and send the combination package to the cloud platform.

[0079] like Figure 5 As shown, when the firmware of n chips needs to be upgraded, the single packaged firmware packages can be spliced, that is, the first firmware package (consisting of file header 1 and encrypted firmware 1), the second firmware package (consisting of file header 2 and encrypted firmware 2), ..., and the nth firmware package (consisting of file header n and encrypted firmware n) are spliced ​​to obtain an intermediate combined package. For the security of the intermediate combined package, it can also be encrypted, and a combined package file header of a predetermined size is added to the encrypted intermediate combined package to form a final combined package.

[0080] In this step, the added combination package file header is formed according to the relevant information of the intermediate combination package. The combination package file header is consistent with the file header data organization structure of a single upgrade firmware, only the upgrade file type is different to distinguish whether it is a combination package or a single firmware package. The combination package packaging process is similar to the single upgrade firmware packaging process, and supports the packaging combination of upgrade firmware of multiple chips. This packaging method is universal and scalable.

[0081] The firmware upgrade method provided by the embodiment of the present invention obtains the upgrade firmware of the chip to be upgraded through a computer respectively, encrypts each upgrade firmware and adds a file header to form a firmware package, and encrypts multiple firmware packages after splicing to form an encrypted intermediate combination package, and then adds the combination package file header to finally package them into a complete combination package. The above packaging method has a simple structure and is easy to operate, which can improve the upgrade rate, thereby improving the upgrade efficiency, and has strong versatility and extensibility, and at the same time has the advantages of high security.

[0082] like Figure 6 As shown, step S20 includes the following steps:

[0083] S21. The cloud platform triggers a firmware upgrade command, and the communication gateway downloads the combination package and transmits it to the embedded device.

[0084] In this step, after the cloud platform receives the combination package for firmware upgrade from the computer, it triggers the firmware upgrade command, causing the communication gateway to download the combination package, which is then transmitted to the embedded device after downloading is complete.

[0085] S22. The communication chip of the embedded device receives the combined packet transmitted by the communication gateway.

[0086] In this step, a communication chip in the embedded device that communicates with the communication gateway receives a combination package transmitted by the communication gateway, which is used to upgrade a single chip or multiple chips at a time.

[0087] S23. After receiving the first packet of the combined package data, the communication chip obtains a combined package file header of a predetermined size, and verifies the integrity of the combined package file header according to information in the combined package file header.

[0088] In this step, after receiving the first data packet, the information of the combined package file header is first read according to the number of bytes of the combined package file header, and the integrity of the combined package file header can be checked using the CRC algorithm according to the file header integrity check field in the combined package file header.

[0089] S24, after the verification is passed, the intermediate combined package formed by splicing all the firmware packages in the received combined package is decrypted.

[0090] In this embodiment, when multiple firmware packages are packaged, for the sake of data security, the intermediate combined package formed by splicing all the firmware packages is encrypted. After the combined package file header is verified, the encrypted intermediate combined package in the combined package needs to be decrypted. In some other embodiments, if no encryption operation is performed when multiple firmware packages are packaged, no decryption operation is required after the combined package file header integrity check is passed.

[0091] In this step, the encrypted intermediate combined package may be decrypted according to the upgrade file key in the combined package file header.

[0092] S25. After decryption, an integrity check algorithm is used to perform integrity check on the intermediate combined package formed by splicing all firmware packages in the received combined package. If the integrity check of the intermediate combined package passes, the combined package is retained.

[0093] In this step, the MD5 algorithm may be used in combination with the upgrade file integrity check field in the file header of the combination package to perform integrity check on the decrypted intermediate combination package. If the check passes, the received combination package is retained.

[0094] Preferably, when the communication chip of the embedded device receives the combined package, the combined package data can be read and processed according to the fixed byte buffer size, and saved to the memory in time after processing to reduce memory resource consumption. In this embodiment, the fixed byte buffer size can be 1024 bytes, and can also be increased or decreased according to demand.

[0095] In the firmware upgrade method provided by the embodiment of the present invention, the communication chip of the embedded device receives the combined package through the communication gateway, and unpacks it to obtain each upgraded firmware and its corresponding chip to be upgraded. During the receiving and unpacking process, data reading is processed according to a fixed buffer size to minimize memory resource consumption.

[0096] like Figure 7 As shown, step S30 includes the following steps:

[0097] S31. The communication chip obtains the file header of the first firmware package spliced ​​in the combined package according to the size of the file header, and verifies the integrity of the file header of the first firmware package according to the information of the obtained file header.

[0098] In this step, the communication chip reads the file header information of the first firmware package in the intermediate combination package spliced ​​by all firmware packages according to the predetermined bytes of the file header, and uses the CRC algorithm combined with the file header integrity check field in the file header to check the integrity of the file header of the first firmware package.

[0099] S32, after the verification is passed, searching for the start address and the end address of the first firmware package according to the relevant information of the firmware upgrade in the obtained file header.

[0100] After the verification is passed, the first and last positions of the first firmware package are searched according to the upgrade file length in the file header. Since the next address of the file header is the start address of the first firmware package, the end address of the first firmware package can be obtained according to the upgrade file length.

[0101] S33, obtaining the upgrade firmware according to the start address and end address of the first firmware package searched.

[0102] S34: decrypt the obtained upgrade firmware to obtain the original upgrade firmware.

[0103] In this embodiment, when a single upgrade firmware is packaged, the upgrade firmware is encrypted for the security of the upgrade firmware. After the file header verification is passed, the encrypted firmware needs to be decrypted to obtain the unencrypted upgrade firmware, that is, the original upgrade firmware. In some other embodiments, if the encryption operation is not performed when the single upgrade firmware is packaged, no decryption operation is required after the verification is passed.

[0104] In this step, the encrypted firmware can be decrypted according to the upgrade file key in the file header.

[0105] S35. Repeat the above steps S31-S34 in sequence according to the splicing order to obtain the remaining upgraded firmware in the combination package.

[0106] In the present invention, the remaining upgrade firmware is also obtained according to the method of the above steps S31-S34. For example, when obtaining the second original upgrade firmware, the communication chip first obtains the file header of the second firmware package in the intermediate combination package, and verifies the integrity of the file header of the second firmware package according to the information of the obtained file header. After the verification is passed, the start address and end address of the second firmware package are searched according to the upgrade file length in the file header, thereby obtaining the upgrade firmware, and the obtained upgrade firmware is decrypted to obtain the original upgrade firmware corresponding to the second firmware package. It can be understood that according to the above method, the upgrade firmware corresponding to the spliced ​​nth firmware package can be obtained in sequence, until the upgrade firmware corresponding to all the spliced ​​firmware packages in the received combination package is obtained.

[0107] S36. The communication chip obtains the corresponding chip to be upgraded according to the obtained file header information of each firmware package.

[0108] In this step, the communication chip obtains the chip corresponding to the upgraded firmware according to the upgrade file type in the file header of the firmware package. In this embodiment, the communication chip in the embedded device is connected to the other chips through an upgrade interface, which can be a UART serial port or SPI.

[0109] S37: Create a multi-threaded upgrade task according to the acquired chips to be upgraded, and send the corresponding upgrade firmware to the chips to be upgraded through the upgrade interface, so as to upgrade multiple chips to be upgraded in parallel.

[0110] In this step, multi-threading technology is used to upgrade multiple chips in parallel, which can improve the upgrade efficiency.

[0111] Furthermore, during the unpacking process of the communication chip, the combined packet can also be processed according to the fixed byte buffer size when it is read, which can minimize the consumption of memory resources.

[0112] According to the firmware upgrade method provided in the embodiment of the present invention, after unpacking, the communication chip also creates a multi-thread upgrade task according to each upgrade firmware and its corresponding chip to be upgraded, and upgrades the chip corresponding to each upgrade firmware in parallel to further improve the upgrade efficiency.

[0113] See also Figure 8 As shown, Figure 8 The flowchart of the firmware upgrade method provided by the second embodiment of the present invention is as follows. The firmware upgrade method of this embodiment is applied to an embedded device. The embedded device includes a chip, and the chip includes a communication chip. Specifically, in this embodiment, the firmware upgrade method includes the following steps:

[0114] S100. A communication chip of an embedded device receives a combined package consisting of an intermediate combined package and a combined package file header formed according to relevant information of the intermediate combined package from a communication gateway.

[0115] In this step, the intermediate combination package is formed by splicing all firmware packages, and the firmware package is composed of the upgraded firmware and a file header formed according to the relevant information of the upgraded firmware.

[0116] In this embodiment, the communication chip of the embedded device is responsible for communicating with the communication gateway. When the communication gateway downloads a combination package for firmware upgrade, the communication gateway transmits the combination package to the communication chip in the embedded device that communicates with it. The communication chip receives the combination package and verifies the integrity of the received combination package. Only after the verification is passed can the subsequent firmware upgrade operation be performed. The specific implementation method of this step in this embodiment is similar to step S20, and will not be repeated here.

[0117] S200, the communication chip reads the file headers of each firmware package in the combined package in sequence according to the splicing order, and verifies the integrity of each upgraded firmware according to the information in the file header and obtains each upgraded firmware.

[0118] S300: Create an upgrade task according to the file header and each upgrade firmware, and upgrade the chip corresponding to each upgrade firmware.

[0119] In this step, the communication chip unpacks the received combined package to obtain each upgrade firmware, and creates an upgrade task according to the upgrade file type in the file header to implement multi-chip upgrade. It can be understood that the specific implementation method of this step in this embodiment is similar to step S30, which will not be repeated here.

[0120] It can be seen that the combination package in the firmware upgrade method of this embodiment can also be formed by adding a combination package file header to an encrypted intermediate combination package formed by splicing and encrypting multiple firmware packages, and the firmware package can be formed by adding a file header after encrypting the upgraded firmware. The file header indicates the relevant information of the upgraded firmware, the packaging structure is simple, and the versatility and extensibility are strong. It also has the advantages of high security. The communication chip of the embedded device receives the combination package through the communication gateway and unpacks it to obtain each upgraded firmware and its corresponding chip to be upgraded. The data reading during the receiving and unpacking process can also be processed according to the fixed buffer size, which can minimize the memory resource consumption. After unpacking, the communication chip also creates a multi-threaded upgrade task according to each upgraded firmware and its corresponding chip to be upgraded, and upgrades the chips corresponding to each upgraded firmware in parallel to further improve the upgrade efficiency.

[0121] It can be understood that the present invention can also provide a firmware upgrade method, which is applied to a computer and specifically includes: obtaining at least one upgrade firmware, and adding a file header to the upgrade firmware according to the relevant information of the upgrade firmware to form a firmware package, and sending the combined package formed by splicing all firmware packages and adding the combined package file header to the cloud platform, so that the cloud platform can send the combined package to the embedded device, so that the communication chip in the embedded device creates an upgrade task according to the file header of each firmware package in the combined package and the upgrade firmware, and upgrades the corresponding chip. In this embodiment, the combined package can include multiple firmware packages, and the multiple firmware packages are spliced ​​and the combined package file header is added to form a combined package; the combined package can also include only one firmware package, so that the embedded device can support both a single firmware upgrade and multiple firmware upgrades. The steps performed by the computer in this embodiment are similar to S10, and the relevant descriptions in the aforementioned method embodiment can be referred to accordingly. To avoid repetition, they are not described one by one here.

[0122] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments can still be modified, or some of the technical features can be replaced by equivalents. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.

Claims

1. A firmware upgrade method, applied to a firmware upgrade system, wherein the firmware upgrade system comprises a computer, a cloud platform, and an embedded device that communicates with the cloud platform via a communication gateway, wherein the embedded device comprises a chip, wherein the chip at least comprises a communication chip, and wherein: The firmware upgrade method comprises: The computer obtains at least one upgrade firmware, and adds a file header to the upgrade firmware according to the relevant information of the upgrade firmware to form a firmware package, and sends the combined package formed by splicing all firmware packages and adding the combined package file header to the cloud platform; The communication chip of the embedded device receives the combined package from the cloud platform through the communication gateway; The communication chip reads the file header of each firmware package in the combination package in sequence according to the splicing order, verifies the integrity of each upgrade firmware according to the information in the file header and obtains each upgrade firmware, creates an upgrade task according to the file header and each upgrade firmware, and upgrades the chip corresponding to each upgrade firmware.

2. The firmware upgrade method according to claim 1, wherein: The computer obtains at least one upgrade firmware, and adds a file header to the upgrade firmware according to the relevant information of the upgrade firmware to form a firmware package, and sends the combined package formed by splicing all firmware packages and adding the combined package file header to the cloud platform, specifically including: The computer obtains upgraded firmware of at least one chip in the embedded device; Encrypt the upgrade firmware using an encryption algorithm to generate encrypted firmware; Adding a file header of a predetermined size to the encrypted firmware according to the relevant information of the upgraded firmware to form a firmware package; splicing all firmware packages to obtain an intermediate combined package, and encrypting the intermediate combined package using an encryption algorithm to generate an encrypted intermediate combined package; A combined file header of a predetermined size is added to the encrypted intermediate combined package according to relevant information of the intermediate combined package to form a combined package, and the combined package is sent to the cloud platform.

3. The firmware upgrade method according to claim 1, wherein: The communication chip of the embedded device receives the combined package from the cloud platform through the communication gateway, specifically including: The cloud platform triggers the firmware upgrade command, the communication gateway downloads the combination package, and transmits it to the embedded device; The communication chip of the embedded device receives the combined packet transmitted by the communication gateway; After receiving the first packet of the combined package data, the communication chip obtains a combined package file header of a predetermined size, and verifies the integrity of the combined package file header according to the information of the combined package file header; After the verification is passed, the integrity verification algorithm is used to perform integrity verification on the intermediate combined package formed by splicing all firmware packages in the received combined package. If the integrity verification of the intermediate combined package passes, the combined package is retained.

4. A firmware upgrade method, characterized in that: Applied to a computer, the firmware upgrade method comprises: At least one upgrade firmware is obtained, and a file header is added to the upgrade firmware according to the relevant information of the upgrade firmware to form a firmware package, and the combined package formed by splicing all firmware packages and adding the combined package file header to the package is sent to the cloud platform, so that the cloud platform can send the combined package to the embedded device, so that the communication chip in the embedded device creates an upgrade task according to the file header of each firmware package in the combined package and the upgrade firmware, and upgrades the corresponding chip.

5. The firmware upgrade method according to claim 4, characterized in that: The obtaining of at least one upgrade firmware, adding a file header to the upgrade firmware according to the relevant information of the upgrade firmware to form a firmware package, and splicing all firmware packages and adding a combined package file header to form a combined package to send to the cloud platform, specifically includes: Obtaining upgraded firmware for at least one chip in the embedded device; Encrypt the upgrade firmware using an encryption algorithm to generate encrypted firmware; Adding a file header of a predetermined size to the encrypted firmware according to the relevant information of the upgraded firmware to form a firmware package; splicing all firmware packages to obtain an intermediate combined package, and encrypting the intermediate combined package using an encryption algorithm to generate an encrypted intermediate combined package; A combined file header of a predetermined size is added to the encrypted intermediate combined package according to relevant information of the intermediate combined package to form a combined package, and the combined package is sent to the cloud platform.

6. A firmware upgrade method, characterized in that: Applied to an embedded device, the embedded device includes a chip, the chip includes a communication chip, and the firmware upgrade method includes: The communication chip of the embedded device receives a combination package consisting of an intermediate combination package and a combination package file header formed according to relevant information of the intermediate combination package from a communication gateway; wherein the intermediate combination package is formed by splicing all firmware packages, and the firmware package is composed of upgraded firmware and a file header formed according to relevant information of the upgraded firmware; The communication chip reads the file headers of each firmware package in the combination package in sequence according to the splicing order, and verifies the integrity of each upgraded firmware according to the information in the file header and obtains each upgraded firmware; Create an upgrade task according to the file header and each upgrade firmware, and upgrade the chip corresponding to each upgrade firmware.

7. The firmware upgrade method according to claim 6, characterized in that: The communication chip receives a combined package consisting of an intermediate combined package and a combined package file header formed according to relevant information of the intermediate combined package from the communication gateway, specifically including: The communication chip of the embedded device receives the combined packet transmitted by the communication gateway; After receiving the first packet of the combined package data, the communication chip obtains a combined package file header of a predetermined size, and verifies the integrity of the combined package file header according to the information of the combined package file header; After the verification is passed, the communication chip uses the integrity verification algorithm to perform integrity verification on the intermediate combination package formed by splicing all firmware packages in the received combination package; If the integrity check of the intermediate combined package passes, the combined package is retained.

8. The firmware upgrade method according to claim 7, characterized in that: The communication chip uses an integrity check algorithm to perform integrity check on the intermediate combined package formed by splicing all firmware packages in the received combined package, and the process also includes: If the combined package file header contains a key, the intermediate combined package formed by splicing all firmware packages in the received combined package is decrypted according to the key.

9. The firmware upgrade method according to claim 7, characterized in that: When the communication chip of the embedded device receives the combined package, the combined package data is read and processed according to the fixed byte buffer size, and is saved in the memory after the processing is completed.

10. The firmware upgrade method according to claim 6, wherein: The communication chip sequentially reads the file headers of each firmware package in the combined package according to the splicing order, and verifies the integrity of each upgraded firmware according to the information in the file header and obtains each upgraded firmware, specifically including: The communication chip obtains the file header of the first firmware package spliced ​​in the combined package according to the size of the file header, and verifies the integrity of the file header of the first firmware package according to the information of the obtained file header; After the verification is passed, the start address and end address of the first firmware package are searched according to the relevant information of the firmware upgrade in the obtained file header; Obtain the upgrade firmware according to the start address and end address of the first firmware package searched; Repeat the above steps in the order of splicing to obtain the remaining upgraded firmware in the package.

11. The firmware upgrade method according to claim 10, wherein: After obtaining the upgrade firmware according to the start address and the end address of the first firmware package searched, the method further includes: If the file header of the first firmware package contains a key, the obtained upgrade firmware is decrypted according to the key to obtain the original upgrade firmware.

12. The firmware upgrade method according to claim 6, wherein: The step of creating an upgrade task according to the file header and each upgrade firmware and upgrading the chip corresponding to each upgrade firmware specifically includes: The communication chip obtains the corresponding chip to be upgraded according to the obtained file header information of each firmware package; A multi-threaded upgrade task is created according to the acquired chips to be upgraded, and the corresponding upgrade firmware is sent to the chips to be upgraded through the upgrade interface, so that multiple chips to be upgraded are upgraded in parallel.