Differential upgrading method and system based on flash page alignment mode, and medium

By implementing a differential upgrade method based on Flash page alignment between the Internet of Things platform and the terminal device to be upgraded, the problem of excessive memory consumption in the existing technology is solved, and a wider application scenario and more efficient memory usage are achieved.

WO2025119139A1PCT designated stage expired Publication Date: 2025-06-12E SURFING IOT CO LTD

Patent Information

Application Number
PCT/CN2024/136142
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-12-07
Filing Date
2024-12-02
Publication Date
2025-06-12

AI Technical Summary

Technical Problem

The existing differential firmware upgrade method consumes too much memory to upgrade terminal devices, limiting its application scope.

Method used

The differential upgrade method based on Flash page alignment is adopted to initiate firmware upgrade requests to the terminal device to be upgraded through the Internet of Things platform. The terminal device to be upgraded receives and writes it to the Flash storage space, reducing the amount of memory usage.

Benefits of technology

It significantly reduces the memory consumption of terminal devices to be upgraded, broadens the types of equipment for differential upgrade applications, and is especially suitable for devices with resource limitations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024136142_12062025_PF_FP_ABST
    Figure CN2024136142_12062025_PF_FP_ABST
Patent Text Reader

Abstract

Disclosed in embodiments of the present invention are a differential upgrading method and system based on a Flash page alignment mode, and a medium. The method comprises: an Internet of Things platform receives differential firmware uploaded by a differential terminal device, verifies firmware transmission information reported by a terminal device to be upgraded to obtain a verification result, and if the verification is passed, issues firmware header information to the terminal device to be upgraded; on the basis of page upgrading point information requested by the terminal device to be upgraded, the Internet of Things platform issues firmware data block information in a page upgrading point to the terminal device to be upgraded; if the terminal device to be upgraded detects the completion of reception of the page upgrading point, the terminal device to be upgraded writes the page upgrading point into a Flash storage space; and if the terminal device to be upgraded detects the completion of transmission of differential firmware and writing of the differential firmware into the Flash storage space, the terminal device to be upgraded generates a differential upgrading result, and reports the differential upgrading result to the Internet of Things platform. Embodiments of the present application remarkably reduce memory consumption of the terminal device to be upgraded.
Need to check novelty before this filing date? Find Prior Art

Description

Differential upgrade method, system and medium based on Flash page alignment Technical Field

[0001] The present invention relates to the technical field of firmware upgrade, and in particular to a differential upgrade method, system and medium based on a Flash page alignment mode. Background Art

[0002] Existing firmware upgrades are mainly divided into full upgrades and differential upgrades. A full upgrade involves sending the entire firmware to the device being upgraded. Its advantage is a simple upgrade protocol that can be used with many file transfer protocols. However, its disadvantages are that even a small firmware change requires a full firmware upgrade, resulting in a slow upgrade and excessive data consumption or network bandwidth waste. This full upgrade method is primarily used in scenarios where the firmware is small and upgrade speed is not critical. To address the shortcomings of full firmware upgrades, differential upgrades were subsequently introduced. As the name suggests, this method takes the difference between the firmware being upgraded and the running firmware on the device to generate a differential firmware. This differential firmware is then compressed and sent to the device being upgraded. The device receives the firmware, decompresses it, and combines it with the terminal-side firmware to restore the new full firmware. This differential upgrade method has the advantages of a small firmware size, a fast upgrade speed, and significantly reduces data and bandwidth resources. However, its disadvantages are that the terminal device being upgraded must support the decompression algorithm and requires a large amount of memory to restore the new full firmware, placing a high memory requirement on the terminal device. This differential upgrade method is primarily used in scenarios where the firmware is large and upgrade time is critical. That is, the above differential upgrade method can only be applied to terminal devices to be upgraded that have abundant resources (especially memory resources). Summary of the Invention

[0003] The embodiments of the present invention provide a differential upgrade method, system and medium based on a Flash page alignment method, aiming to solve the problem that the existing differential upgrade method causes excessive memory consumption in the terminal device to be upgraded.

[0004] In a first aspect, an embodiment of the present invention provides a differential upgrade method based on a Flash page alignment method, comprising:

[0005] If the IoT platform receives the differential firmware uploaded by the differential terminal device, it initiates a firmware upgrade request to the terminal device to be upgraded, wherein the differential firmware includes firmware header information and an upgrade cluster, and the upgrade cluster includes at least one page upgrade point;

[0006] The terminal device to be upgraded returns upgrade permission information and reports firmware transmission information to the Internet of Things platform;

[0007] The IoT platform verifies the firmware transmission information to obtain a verification result. If the verification result is passed, the firmware header information is sent to the terminal device to be upgraded.

[0008] The Internet of Things platform sends the firmware data block information in the page upgrade point to the terminal device to be upgraded according to the page upgrade point information requested by the terminal device to be upgraded;

[0009] If the terminal device to be upgraded detects that the page upgrade point has been received, the terminal device writes the page upgrade point into the Flash storage space according to the firmware transmission information and the firmware header information;

[0010] If the terminal device to be upgraded detects that the differential firmware has been transferred and written into the Flash storage space, a differential upgrade result is generated based on the full firmware after the differential upgrade and the firmware header information, and the differential upgrade result is reported to the Internet of Things platform.

[0011] In a second aspect, an embodiment of the present invention further provides a differential upgrade system based on Flash page alignment, which includes: a receiving and initiating unit, a verification and issuing unit, and a receiving and issuing unit configured in an Internet of Things platform, and a return reporting unit, a detection and writing unit, and a detection and generating unit configured in a terminal device to be upgraded, wherein:

[0012] The receiving and initiating unit is used for initiating a firmware upgrade request to the terminal device to be upgraded if the IoT platform receives differential firmware uploaded by the differential terminal device, wherein the differential firmware includes firmware header information and an upgrade cluster, and the upgrade cluster includes at least one page upgrade point;

[0013] The return reporting unit is used for the terminal device to be upgraded to return upgrade permission information and report firmware transmission information to the Internet of Things platform;

[0014] The verification and issuing unit is used for the IoT platform to verify the firmware transmission information to obtain a verification result. If the verification result is passed, the firmware header information is issued to the terminal device to be upgraded.

[0015] The receiving and sending unit is used for the Internet of Things platform to send the firmware data block information in the page upgrade point to the terminal device to be upgraded according to the page upgrade point information requested by the terminal device to be upgraded;

[0016] The detection and writing unit is configured to write the page upgrade point into the Flash storage space according to the firmware transmission information and the firmware header information if the terminal device to be upgraded detects that the page upgrade point has been received;

[0017] The detection generation unit is used for the terminal device to be upgraded to generate a differential upgrade result based on the full firmware after differential upgrade and the firmware header information if it detects that the differential firmware has been transmitted and written into the Flash storage space, and report the differential upgrade result to the Internet of Things platform.

[0018] In a third aspect, an embodiment of the present invention further provides a differential upgrade system based on Flash page alignment, which includes an Internet of Things platform and a terminal device to be upgraded, wherein the Internet of Things platform and the terminal device to be upgraded both include a memory and a processor, a computer program is stored on the memory, and the Internet of Things platform and the processor of the terminal device to be upgraded implement the above method when executing the computer program.

[0019] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, wherein the storage medium stores a computer program, and the computer program can implement the above method when executed by a processor.

[0020] The embodiments of the present invention provide a differential upgrade method, system and medium based on a Flash page alignment mode. The method includes: if the Internet of Things platform receives the differential firmware uploaded by the differential terminal device, it initiates a firmware upgrade request to the terminal device to be upgraded, wherein the differential firmware includes firmware header information and an upgrade cluster, and the upgrade cluster contains at least one page upgrade point; the terminal device to be upgraded returns upgrade permission information and reports firmware transmission information to the Internet of Things platform; the Internet of Things platform verifies the firmware transmission information to obtain a verification result, and if the verification result is that the verification passes, it sends the firmware header information to the terminal device to be upgraded; the Internet of Things platform sends the firmware data block information in the page upgrade point to the terminal device to be upgraded based on the page upgrade point information requested by the terminal device to be upgraded; if the terminal device to be upgraded detects that the page upgrade point is received, it writes the page upgrade point into the Flash storage space according to the firmware transmission information and the firmware header information; if the terminal device to be upgraded detects that the differential firmware transmission and writing into the Flash storage space are completed, it generates a differential upgrade result based on the full firmware after the differential upgrade and the firmware header information, and reports the differential upgrade result to the Internet of Things platform. In the technical solution of the embodiment of the present invention, after the terminal device to be upgraded receives the page upgrade point in the differential firmware issued by the Internet of Things platform, it can be immediately written into the Flash storage space. There is no need to cache the entire differential firmware, restore it to a new full firmware, and then write it into the Flash storage space, thereby significantly reducing the memory consumption of the terminal device to be upgraded. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0022] FIG1 is a schematic diagram of a differential upgrade system based on Flash page alignment according to an embodiment of the present invention;

[0023] 2 is a flow chart of a differential upgrade method based on Flash page alignment according to an embodiment of the present invention;

[0024] FIG3 is a schematic diagram of manufacturing differential firmware provided by an embodiment of the present invention;

[0025] FIG4 is a schematic diagram of transmission of differential firmware according to an embodiment of the present invention;

[0026] FIG5 is a schematic diagram of writing differential firmware according to an embodiment of the present invention;

[0027] FIG6 is a timing diagram of differential firmware transmission provided by an embodiment of the present invention;

[0028] FIG7 is a schematic block diagram of a differential upgrade system based on Flash page alignment according to an embodiment of the present invention;

[0029] FIG8 is a schematic block diagram of a computer device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0030] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.

[0031] It will be understood that when used in this specification and the appended claims, the terms “comprises” and “comprising” indicate the presence of described features, integers, steps, operations, elements and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof.

[0032] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the present invention. As used in the specification and appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms unless the context clearly indicates otherwise.

[0033] It should be further understood that the term "and / or" used in the present description and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.

[0034] As used in this specification and the appended claims, the term "if" can be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.

[0035] Please refer to Figure 1, which is a schematic diagram of a differential upgrade system based on Flash page alignment provided by an embodiment of the present invention. The differential upgrade system based on Flash page alignment includes an Internet of Things platform and a terminal device to be upgraded. The Internet of Things platform and the terminal device to be upgraded communicate with each other to send firmware header information and page upgrade points and receive differential upgrade results. It should be noted that, as shown in Figure 1, the differential upgrade system based on Flash page alignment also includes a differential terminal device, which communicates with the Internet of Things platform to upload differential firmware.

[0036] Figure 2 is a flow chart illustrating a differential upgrade method based on Flash page alignment, according to an embodiment of the present invention. This differential upgrade method based on Flash page alignment can be applied to a differential upgrade system based on Flash page alignment. For example, this method can be implemented by a software program configured in the differential upgrade system based on Flash page alignment to reduce memory consumption in the terminal device to be upgraded. As shown in Figure 2, the method includes the following steps, S100-S150.

[0037] S100. If the IoT platform receives differential firmware uploaded by a differential terminal device, it initiates a firmware upgrade request to the terminal device to be upgraded, wherein the differential firmware includes firmware header information and an upgrade cluster, and the upgrade cluster includes at least one page upgrade point.

[0038] In an embodiment of the present invention, before a differential terminal device uploads differential firmware to an IoT platform, it is necessary to perform firmware segmentation and production to obtain differential firmware. Specifically, the differential terminal device compiles a custom link script file through an IDE to generate new firmware, wherein the custom link script file uses a large rectangle to represent a firmware, a square in the large rectangle represents a Flash page, and the number on the Flash page is a page code. The custom link script file is used to store different codes or data in separate Flash pages; the difference between the new firmware and the old firmware page space data is compared one by one according to the Flash page alignment method to mark the differential page blocks with differences, and the page code of each differential page block is recorded as a page upgrade point to obtain multiple page upgrade points, wherein the old fixed component is the firmware generated by the custom link script file compiled by the IDE before the functional module code is written; the number of the page upgrade points, the Flash page size, the firmware base address, the CRC16 checksum of the new firmware, and the firmware size are saved in the firmware header to generate firmware header information; the firmware header information and the multiple page upgrade points are packaged into the differential firmware. More specifically, as shown in FIG3 , each color represents a type of code or data, and X represents the Flash page that the new firmware modifies relative to the old firmware, ie, the page upgrade point.

[0039] It should be noted that in this embodiment, the terminal firmware is generally stored in Flash, and the firmware is loaded from Flash upon power-up. The IDE or other compiler uses a customized link script to generate compiled firmware for the differential terminal device. The user's written functional module code or data will be randomly distributed throughout the target Flash space (for example: 0x0000 to 0x10000). If the user modifies a single functional module and upgrades the firmware, the generated differential package will be scattered across multiple discontinuous address spaces. It should be noted that Flash memory is managed in a page-based manner, and the page addresses are continuous. Data erasure and writing must be an integer multiple of the page. If there is a difference in one page of the firmware, the entire page needs to be erased and rewritten. To solve the problem of the firmware being scattered in Flash, the present invention rewrites the link script file to force the user's functional module code or data to be stored in one or more continuous Flash page spaces. Then, according to the Flash page alignment method, the differences in the page space data are compared one by one. As long as there is a difference of at least one byte in the page space, the page is marked as a differential page block, and the Flash page address is recorded as a page upgrade point. After the comparison is complete, the new firmware's checksum (CRC16), firmware size, number of upgrade points, and firmware base address are stored in the firmware header. The firmware format is: firmware header information (firmware size + Flash page size + number of upgrade points + firmware base address + CRC16 checksum) + upgrade cluster (page upgrade point 1 + page upgrade point 2 ... page upgrade point n).

[0040] Furthermore, after the differential terminal device completes the differential firmware, it uploads the differential firmware to the Internet of Things platform. The Internet of Things platform receives the differential firmware and initiates a firmware upgrade request to the terminal device to be upgraded. The differential firmware includes firmware header information and an upgrade cluster, and the upgrade cluster contains at least one page upgrade point.

[0041] S110: The terminal device to be upgraded returns upgrade permission information and reports firmware transmission information to the Internet of Things platform.

[0042] In an embodiment of the present invention, the terminal device to be upgraded receives a firmware upgrade request initiated by the Internet of Things platform, and returns upgrade permission information and reports firmware transmission information to the Internet of Things platform, wherein the firmware transmission information includes the size of the single-transmission firmware and the size of the upgraded Flash page. It should be noted that, in this embodiment, the existing differential firmware transmission uses the file transfer protocol, HTTP, block transfer protocol, etc. The above protocols can realize breakpoint resumption and block transmission, etc., but since the present embodiment requires the use of a storage-while-receiving solution, the traditional file or block transfer protocol cannot be used, so the block transfer protocol is redesigned. The firmware transmission protocol uses blocks as the basic unit, and the page upgrade point is decomposed into multiple transmission blocks according to negotiation. Each time a page upgrade point is completed, the terminal needs to complete a firmware storage.

[0043] S120: The IoT platform verifies the firmware transmission information to obtain a verification result. If the verification result is passed, the firmware header information is sent to the terminal device to be upgraded.

[0044] In an embodiment of the present invention, the Internet of Things platform verifies the firmware transmission information to obtain a verification result. If the verification result is a pass, the firmware header information is sent to the terminal device to be upgraded. It is understandable that if the verification result is a fail, the differential upgrade process is stopped and an error response message is sent to the terminal device to be upgraded. The Internet of Things platform verifies the firmware transmission information to obtain a verification result specifically in that the Internet of Things platform compares the single transmission firmware size with the upgrade Flash page size; if the single transmission firmware size is smaller than the upgrade Flash page size, the upgrade Flash page size is compared with the Flash page size in the firmware header information in the differential firmware; if the upgrade Flash page size is consistent with the Flash page size, the verification result is set to pass. It is understandable that if the single transmission firmware size is not smaller than the upgrade Flash page size and / or if the upgrade Flash page size is inconsistent with the Flash page size, the verification result is set to fail.

[0045] S130. The Internet of Things platform sends the firmware data block information in the page upgrade point to the terminal device to be upgraded according to the page upgrade point information requested by the terminal device to be upgraded.

[0046] In an embodiment of the present invention, after receiving the firmware header information, the terminal device to be upgraded starts block transmission and requests page upgrade point information from the Internet of Things platform. The Internet of Things platform sends the firmware data block information in the page upgrade point to the terminal device to be upgraded based on the page upgrade point information. Specifically, as shown in Figure 4, the differential firmware includes four page upgrade points, namely page upgrade point 0, page upgrade point 1, page upgrade point 2 and page upgrade point 3. Page upgrade point 0, page upgrade point 1, page upgrade point 2 and page upgrade point 3 each include 3 firmware blocks. The 3 firmware blocks in page upgrade point 0 are respectively identified as page 1+block 0, page 1+block 1 and page 1+block 2; the 3 firmware blocks in page upgrade point 1 are respectively identified as page 3+block 0, page 3+block 1 and page 3+block 2; the 3 firmware blocks in page upgrade point 2 are respectively identified as page 6+block 0, page 6+block 1 and page 6+block 2; the 3 firmware blocks in page upgrade point 3 are respectively identified as page 14+block 0, page 14+block 1 and page 14+block 2. It can be seen that the firmware blocks in page 1, page 3, page 6 and page 14 in the terminal device to be upgraded need to be upgraded.

[0047] S140: If the terminal device to be upgraded detects that the page upgrade point has been received, the page upgrade point is written into a Flash storage space according to the firmware transmission information and the firmware header information.

[0048] In an embodiment of the present invention, the terminal device to be upgraded receives the firmware data block information, and if it is detected that the page upgrade point has been received, the page upgrade point is written into the Flash storage space according to the firmware transmission information and the firmware header information, wherein the firmware header information includes the firmware base address. If the terminal device to be upgraded detects that the page upgrade point has been received, the page code and block number in each of the firmware data block information in the page upgrade point are extracted; the Flash first address of the data block is located according to the page code, the block number, the firmware base address, the single transmission firmware size, and the upgrade Flash page size, and the firmware data block in the firmware data block information is written into the Flash storage space according to the Flash first address. Specifically, the Flash storage space is a single Flash storage space or a dual Flash storage space. If the Flash storage space is the single Flash storage space, the firmware data block in the firmware data block information is written into the full Flash storage space of the old firmware according to the Flash first address; if the Flash storage space is the dual Flash storage space, the full Flash storage space of the old firmware is copied to the backup Flash storage space, and the firmware data block is written into the backup Flash storage space according to the Flash first address. Specifically, as shown in Figure 5, the single firmware space upgrade is to write the received differential firmware directly into the Flash storage space, while the dual firmware space upgrade is to first copy the old firmware backup to the backup Flash storage space, and then write the received differential firmware directly into the backup Flash storage space. It should be noted that in this embodiment, whether to copy the backup Flash storage space to the Flash storage space can be decided based on actual needs.

[0049] S150. If the terminal device to be upgraded detects that the differential firmware has been transferred and written into the Flash storage space, a differential upgrade result is generated according to the full firmware after the differential upgrade and the firmware header information, and the differential upgrade result is reported to the Internet of Things platform.

[0050] In an embodiment of the present invention, if the terminal device to be upgraded detects that the differential firmware has been transferred and written into the Flash storage space, a differential upgrade result is generated based on the full firmware after the differential upgrade and the firmware header information. Specifically, the full firmware after the differential upgrade is verified using a CRC16 checksum algorithm to obtain a checksum; the CRC16 checksum is compared with the checksum; if the CRC16 checksum is consistent with the checksum, the differential upgrade result is set to a differential upgrade success; if the CRC16 checksum is inconsistent with the checksum, the differential upgrade result is set to a differential upgrade failure. The differential upgrade result is reported to the Internet of Things platform.

[0051] Please refer to Figure 6, which is a timing diagram of differential firmware transmission provided by an embodiment of the present invention. In Figure 6, a. The Internet of Things platform initiates a firmware upgrade request (carrying the new firmware version number); b. The terminal device to be upgraded responds to allow the upgrade and reports the single transmission firmware size (the single transmission block size should be less than or equal to the Flash page size) information and the Flash page size information to constrain the subsequent transmission of firmware blocks by the Internet of Things platform; if the reported single transmission firmware size and Flash page size information are incorrect, the differential upgrade process is stopped and an error response message is issued; c. The Internet of Things platform issues firmware header information (CRC16 checksum, Flash page size, firmware size, number of page upgrade points, firmware base address); d. The terminal device to be upgraded receives the firmware header information for subsequent verification, starts block transmission, and requests page upgrade point (page upgrade point ID + block ID) information; e. The Internet of Things platform receives the requested page upgrade point information and issues the firmware page upgrade point ID + block ID + firmware data block; f. Repeat steps de to complete the reception of the single page upgrade point firmware and complete the writing of the Flash page to the Flash storage space once;

[0052] Repeat step f to complete the transfer and writing of the entire differential firmware. The terminal device to be upgraded reports a transfer completion instruction, which includes the differential upgrade result.

[0053] It should be noted that, in this embodiment, the specific data frame format of the firmware transmission protocol is as follows: Upgrade request frame (firmware upgrade request): 0x01 + firmware version number; Upgrade request result frame (upgrade permission information and firmware transmission information): 0x02 + whether to allow upgrade (1 byte) + negotiation information [Flash page size (2 bytes) + negotiation block size information (1 byte)]; Firmware information frame (firmware header information): 0x03 + CRC16 check code (2 bytes) + Flash page size (2 bytes) + firmware size The following 5-byte frame contains the following: page size (4 bytes) + number of upgrade points (2 bytes) + firmware base address (4 bytes); data request frame (page upgrade point information): 0x04 + page code (1 byte) + block number (1 byte); data response frame (firmware data block information): 0x05 + page code (1 byte) + block number (1 byte) + firmware block; error response frame: 0x06 + result code (1 byte) (1: page upgrade point error, 2: block number error); transfer end frame: 0x07 + transfer result (1 byte) (0: success, 1: failure). It should also be noted that after receiving the firmware data frame, the terminal device to be upgraded extracts the page code and block number, as well as the firmware base address provided in the firmware information frame, and the flash page size and data block size information in the negotiation information frame. Based on this five-tuple information, it locates the flash first address of the data block and then burns the firmware data into the flash. For example, if the firmware base address is 0x800000, the page code is 0x07, the Flash page size is 4KB, the block size is 1KB, and the block code is 0x02, then the Flash address of the data block is 0x800000 + 0x07 * 4KB + 2KB, which is 0x807800. After regenerating the complete full firmware, you need to perform an integrity check on the full firmware after the differential upgrade using the CRC16 algorithm to generate the differential upgrade result.

[0054] Table 1 shows the memory and bandwidth resource usage comparison of different solutions (differential upgrade solution based on Flash page alignment, differential upgrade, and full upgrade in this embodiment), assuming that the old firmware is 100KB, the new firmware is 100KB, the differential firmware is 6KB, and the Flash page size is 4KB.

[0055] Table 1 shows the comparison of memory and bandwidth resource usage of different solutions

[0056]

[0057] As can be seen from the above table, compared with differential upgrades, the firmware size is basically the same, which significantly reduces the memory consumption of the terminal device to be upgraded and broadens the types of devices that can be used for differential upgrades, especially some resource-constrained devices; compared with full upgrades, the firmware size is significantly reduced and the upgrade speed is greatly improved; this embodiment uses block transmission and supports breakpoint resumption and specified block retransmission.

[0058] To sum up, in the embodiment of the present invention, after the terminal device to be upgraded receives the page upgrade point in the differential firmware issued by the Internet of Things platform, it can be immediately written into the Flash storage space. There is no need to cache the entire differential firmware, restore it to a new full firmware, and then write it into the Flash storage space, thereby significantly reducing the memory consumption of the terminal device to be upgraded.

[0059] FIG7 is a schematic block diagram of a differential upgrade system 200 based on Flash page alignment provided by an embodiment of the present invention. As shown in FIG7 , corresponding to the differential upgrade method based on Flash page alignment applied to the IoT platform and the terminal device to be upgraded, the differential upgrade system 200 based on Flash page alignment includes a unit for executing the differential upgrade method based on Flash page alignment. Specifically, referring to FIG7 , the differential upgrade system 200 based on Flash page alignment includes a receiving and initiating unit 101, a verification and issuing unit 102, and a receiving and issuing unit 103 configured in the IoT platform, and a return reporting unit 201, a detection and writing unit 202, and a detection and generating unit 203 configured in the terminal device to be upgraded.

[0060] Wherein, the receiving and initiating unit 101 is used for the Internet of Things platform to initiate a firmware upgrade request to the terminal device to be upgraded if the differential firmware uploaded by the differential terminal device is received, wherein the differential firmware includes firmware header information and an upgrade cluster, and the upgrade cluster includes at least one page upgrade point; the returning and reporting unit 201 is used for the terminal device to be upgraded to return the upgrade permission information and report firmware transmission information to the Internet of Things platform; the verifying and sending unit 102 is used for the Internet of Things platform to verify the firmware transmission information to obtain a verification result, and if the verification result is that the verification is passed, the firmware header information is sent to the terminal device to be upgraded. The receiving and sending unit 103 is used for the The Internet of Things platform sends the firmware data block information in the page upgrade point to the terminal device to be upgraded based on the page upgrade point information requested by the terminal device to be upgraded; the detection and writing unit 202 is used for the terminal device to be upgraded to write the page upgrade point into the Flash storage space based on the firmware transmission information and the firmware header information if it detects that the page upgrade point has been received; the detection and generation unit 203 is used for the terminal device to be upgraded to generate a differential upgrade result based on the full firmware after the differential upgrade and the firmware header information if it detects that the differential firmware has been transmitted and written into the Flash storage space, and report the differential upgrade result to the Internet of Things platform.

[0061] In some embodiments, such as the present embodiment, the differential upgrade system 200 based on Flash page alignment further includes a compilation unit, a first comparison unit, a generation unit, and a packaging unit configured in a differential terminal device, and a sending unit configured in the Internet of Things platform.

[0062] Wherein, the compilation unit is used for the differential terminal device to compile a custom link script file through IDE to generate a new firmware, wherein the custom link script file uses a large rectangle to represent a firmware, the square in the large rectangle represents a Flash page, the number on the Flash page is a page code, and the custom link script file is used to store different codes or data in a separate Flash page; the first comparison unit is used to compare the differences between the page space data of the new firmware and the old firmware one by one according to the Flash page alignment method to mark the differential page blocks with differences, and record the page code of each differential page block. A plurality of page upgrade points are obtained for one page upgrade point, wherein the old fixed part is firmware generated by compiling the custom link script file through IDE before writing the functional module code; the generating unit is used to save the number of the page upgrade points, the Flash page size, the firmware base address, the CRC16 check code of the new firmware, and the firmware size in the firmware header to generate firmware header information; the packaging unit is used to package the firmware header information and the plurality of page upgrade points into the differential firmware; the sending unit is used to stop the differential upgrade process if the check result is a check failure, and send an error response message to the terminal device to be upgraded.

[0063] In some embodiments, such as this embodiment, the verification issuing unit 102 includes a first comparing subunit, a second comparing subunit, and a first setting unit.

[0064] Among them, the first comparison subunit is used by the Internet of Things platform to compare the single transmission firmware size with the upgrade Flash page size; the second comparison subunit is used to compare the upgrade Flash page size with the Flash page size in the firmware header information in the differential firmware if the single transmission firmware size is smaller than the upgrade Flash page size; the first setting unit is used to set the verification result as verification passed if the upgrade Flash page size is consistent with the Flash page size.

[0065] In some embodiments, such as this embodiment, the detection and writing unit 202 includes an extraction unit and a writing unit.

[0066] Among them, the extraction unit is used to extract the page code and block number in each firmware data block information in the page upgrade point if the terminal device to be upgraded detects that the page upgrade point reception is completed; the writing unit is used to locate the Flash first address of the data block according to the page code, the block number, the firmware base address, the single transmission firmware size and the upgrade Flash page size, and write the firmware data block in the firmware data block information into the Flash storage space according to the Flash first address.

[0067] In some embodiments, such as this embodiment, the writing unit includes a first writing sub-unit and a second writing sub-unit.

[0068] Among them, the first writing sub-unit is used to write the firmware data block in the firmware data block information into the full Flash storage space of the old firmware according to the Flash first address if the Flash storage space is the single Flash storage space; the second writing sub-unit is used to copy the full Flash storage space of the old firmware to the backup Flash storage space if the Flash storage space is the dual Flash storage space, and write the firmware data block into the backup Flash storage space according to the Flash first address.

[0069] In some embodiments, such as this embodiment, the detection generation unit 203 includes a verification unit, a second comparison unit, a second setting unit, and a third setting unit.

[0070] Among them, the verification unit is used to verify the full firmware after the differential upgrade through the CRC16 verification algorithm to obtain a verification code; the second comparison unit is used to compare the CRC16 verification code and the verification code; the second setting unit is used to set the differential upgrade result to a successful differential upgrade if the CRC16 verification code and the verification code are consistent; the third setting unit is used to set the differential upgrade result to a failed differential upgrade if the CRC16 verification code and the verification code are inconsistent.

[0071] It should be noted that those skilled in the art can clearly understand that the specific implementation process of the differential upgrade system 200 based on Flash page alignment and each unit can refer to the corresponding description in the aforementioned method embodiment. For the convenience and brevity of the description, it will not be repeated here.

[0072] The differential upgrade system based on the Flash page alignment method can be implemented in the form of a computer program, which can be run on a computer device as shown in FIG8 .

[0073] Please refer to Figure 8, which is a schematic block diagram of a computer device provided in an embodiment of the present application. The computer device 900 is an Internet of Things platform and a terminal device to be upgraded.

[0074] 8 , the computer device 900 includes a processor 902 , a memory, and an interface 907 connected via a system bus 901 , wherein the memory may include a storage medium 903 and an internal memory 904 .

[0075] The storage medium 903 can store an operating system 9031 and a computer program 9032. When the computer program 9032 is executed, the processor 902 can execute a differential upgrade method based on a Flash page alignment method.

[0076] The processor 902 is used to provide computing and control capabilities to support the operation of the entire computer device 900.

[0077] The internal memory 904 provides an environment for the operation of the computer program 9032 in the storage medium 903. When the computer program 9032 is executed by the processor 902, the processor 902 can execute a differential upgrade method based on the Flash page alignment.

[0078] The interface 905 is used to communicate with other devices. Those skilled in the art will understand that the structure shown in FIG8 is merely a block diagram of a portion of the structure related to the solution of the present application, and does not constitute a limitation on the computer device 900 to which the solution of the present application is applied. The specific computer device 900 may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.

[0079] The processor 902 of each of the IoT platform and the terminal device to be upgraded is configured to run a computer program 9032 stored in a memory to implement any embodiment of the differential upgrade method based on Flash page alignment.

[0080] It should be understood that in the embodiment of the present application, the processor 902 may be a central processing unit (CPU), and the processor 902 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0081] Those skilled in the art will appreciate that all or part of the steps in the method of the above-described embodiment can be implemented by instructing relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. The computer program is executed by at least one processor in the wireless communication system to implement the steps in the method of the above-described embodiment.

[0082] Therefore, the present invention also provides a storage medium. The storage medium may be a computer-readable storage medium. The storage medium stores a computer program. When executed by a processor, the computer program causes the processor to perform any embodiment of the differential upgrade method based on the Flash page alignment method.

[0083] The storage medium may be any computer-readable storage medium that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a magnetic disk, or an optical disk.

[0084] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, wireless communication software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the composition and steps of each example according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0085] In the several embodiments provided herein, it should be understood that the disclosed systems and methods can be implemented in other ways. For example, the system embodiments described above are merely illustrative. For example, the division of the various units is merely a logical functional division, and actual implementations may employ other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be omitted or not implemented.

[0086] The steps in the method of the embodiment of the present invention may be adjusted in order, combined, or deleted as needed. The units in the system of the embodiment of the present invention may be combined, divided, or deleted as needed. In addition, the functional units in the various embodiments of the present invention may be integrated into a single processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit.

[0087] If this integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the existing technology, or all or part of the technical solution, can be embodied in the form of a software product. This wireless communication software product is stored in a storage medium and includes several instructions for causing a computer device (such as a personal wireless communication device, terminal, or network device) to execute all or part of the steps of the method described in various embodiments of the present invention.

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

[0089] Obviously, those skilled in the art may make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, to the extent such changes and modifications fall within the scope of the claims and their equivalents, the present invention is intended to include such changes and modifications.

[0090] The foregoing description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art will readily conceive of various equivalent modifications or substitutions within the technical scope disclosed herein, and such modifications or substitutions are intended to be encompassed within the scope of protection of the present invention. Therefore, the scope of protection of the present invention shall be subject to the scope of protection of the claims.

Claims

1. A differential upgrade method based on Flash page alignment, characterized in that: include: If the IoT platform receives the differential firmware uploaded by the differential terminal device, it initiates a firmware upgrade request to the terminal device to be upgraded, wherein the differential firmware includes firmware header information and an upgrade cluster, the upgrade cluster includes at least one page upgrade point, the page upgrade point is a Flash page modified by the new firmware relative to the old firmware, and the firmware header information is the number of the page upgrade points, the Flash page size, the firmware base address, the CRC16 checksum of the new firmware, and the firmware size are saved in the firmware header to generate the information; The terminal device to be upgraded returns upgrade permission information and reports firmware transmission information to the Internet of Things platform, wherein the firmware transmission information includes a single transmission firmware size and an upgrade Flash page size; The Internet of Things platform verifies the firmware transmission information to obtain a verification result, and if the verification result is that the verification passes, sends the firmware header information to the terminal device to be upgraded; The Internet of Things platform sends the firmware data block information in the page upgrade point to the terminal device to be upgraded according to the page upgrade point information requested by the terminal device to be upgraded; If the terminal device to be upgraded detects that the page upgrade point is received, the page upgrade point is written into the Flash storage space according to the firmware transmission information and the firmware header information; If the terminal device to be upgraded detects that the differential firmware is transmitted and written into the Flash storage space, a differential upgrade result is generated according to the full firmware after the differential upgrade and the firmware header information, and the differential upgrade result is reported to the Internet of Things platform; The Internet of Things platform verifies the firmware transmission information to obtain a verification result, including: The IoT platform compares the single transmission firmware size with the upgrade Flash page size; If the single transmission firmware size is smaller than the upgrade Flash page size, comparing the upgrade Flash page size with the Flash page size in the firmware header information in the differential firmware; If the upgrade Flash page size is consistent with the Flash page size, the verification result is set as verification passed.

2. The differential upgrade method based on Flash page alignment according to claim 1, characterized in that: If the IoT platform receives the differential firmware uploaded by the differential terminal device, before initiating a firmware upgrade request to the terminal device to be upgraded, the IoT platform also includes: The differential terminal device compiles a custom link script file through an IDE to generate a new firmware, wherein the custom link script file uses a large rectangle to represent a firmware, a square in the large rectangle represents a Flash page, the number on the Flash page is a page code, and the custom link script file is used to store different codes or data in a separate Flash page; Compare the differences between the page space data of the new firmware and the old firmware one by one according to the Flash page alignment mode to mark the differential page blocks with differences, record the page code where each differential page block is located as a page upgrade point to obtain multiple page upgrade points, wherein the old firmware is the firmware generated by the custom link script file before the functional module code is written by IDE compilation; The number of the page upgrade points, the Flash page size, the firmware base address, the CRC16 checksum of the new firmware, and the firmware size are stored in the firmware header to generate firmware header information; The firmware header information and the plurality of page upgrade points are packaged into the differential firmware.

3. The differential upgrade method based on Flash page alignment according to claim 1, characterized in that: After the Internet of Things platform verifies the firmware transmission information to obtain a verification result, the method further includes: If the verification result is that the verification fails, the differential upgrade process is stopped, and an error response message is sent to the terminal device to be upgraded.

4. The differential upgrade method based on Flash page alignment according to claim 1, characterized in that: The firmware header information includes a firmware base address; if the terminal device to be upgraded detects that the page upgrade point is received, the page upgrade point is written into the Flash storage space according to the firmware transmission information and the firmware header information, including: If the terminal device to be upgraded detects that the page upgrade point is received, the page code and block number in each firmware data block information in the page upgrade point are extracted; The Flash first address of the data block is located according to the page code, the block number, the firmware base address, the single transmission firmware size and the upgrade Flash page size, and the firmware data block in the firmware data block information is written into the Flash storage space according to the Flash first address.

5. The differential upgrade method based on Flash page alignment according to claim 4, characterized in that: The Flash storage space is a single Flash storage space or a dual Flash storage space; The step of writing the firmware data block in the firmware data block information into the Flash storage space according to the Flash first address includes: If the Flash storage space is the single Flash storage space, writing the firmware data block in the firmware data block information into the full Flash storage space of the old firmware according to the Flash first address; If the Flash storage space is the dual Flash storage space, the full Flash storage space of the old firmware is copied to the backup Flash storage space, and the firmware data block is written into the backup Flash storage space according to the Flash first address.

6. The differential upgrade method based on Flash page alignment according to claim 1, characterized in that: The firmware header information includes a CRC16 check code; The generating a differential upgrade result according to the full firmware after differential upgrade and the firmware header information includes: The full firmware after differential upgrade is verified by CRC16 verification algorithm to obtain the verification code; Compare the CRC16 check code with the check code; If the CRC16 check code is consistent with the check code, the differential upgrade result is set as a differential upgrade success; If the CRC16 check code is inconsistent with the check code, the differential upgrade result is set as differential upgrade failure.

7. A differential upgrade system based on Flash page alignment, characterized in that: include: The receiving and initiating unit, the verification and issuing unit and the receiving and issuing unit configured in the Internet of Things platform, the return reporting unit, the detection writing unit and the detection generating unit configured in the terminal device to be upgraded, wherein: The receiving initiating unit is used for initiating a firmware upgrade request to the terminal device to be upgraded if the IoT platform receives the differential firmware uploaded by the differential terminal device, wherein the differential firmware includes firmware header information and an upgrade cluster, the upgrade cluster includes at least one page upgrade point, the page upgrade point is a Flash page modified by the new firmware relative to the old firmware, and the firmware header information is information generated by saving the number of the page upgrade points, the Flash page size, the firmware base address, the CRC16 checksum of the new firmware, and the firmware size in the firmware header; The return reporting unit is used for the terminal device to be upgraded to return the upgrade permission information and report the firmware transmission information to the Internet of Things platform, wherein the firmware transmission information includes the single transmission firmware size and the upgrade Flash page size; The verification and sending unit is used for the IoT platform to verify the firmware transmission information to obtain a verification result. If the verification result is a verification pass, the firmware header information is sent to the terminal device to be upgraded. The receiving and sending unit is used for the Internet of Things platform to send the firmware data block information in the page upgrade point to the terminal device to be upgraded according to the page upgrade point information requested by the terminal device to be upgraded; The detection writing unit is used for, if the terminal device to be upgraded detects that the page upgrade point has been received, to write the page upgrade point into the Flash storage space according to the firmware transmission information and the firmware header information; The detection generation unit is used for generating a differential upgrade result according to the full firmware after the differential upgrade and the firmware header information if the terminal device to be upgraded detects that the differential firmware is transmitted and written into the Flash storage space, and reporting the differential upgrade result to the Internet of Things platform; The verification issuing unit comprises: A first comparison subunit, configured for the Internet of Things platform to compare the single transmission firmware size with the upgrade Flash page size; A second comparison subunit is used for comparing the upgrade Flash page size with the Flash page size in the firmware header information in the differential firmware if the single transmission firmware size is smaller than the upgrade Flash page size; The first setting unit is used to set the verification result as verification passed if the upgrade Flash page size is consistent with the Flash page size.

8. A differential upgrade system based on Flash page alignment, characterized in that: The method comprises an Internet of Things platform and a terminal device to be upgraded, wherein the Internet of Things platform and the terminal device to be upgraded both comprise a memory and a processor, a computer program is stored in the memory, and the Internet of Things platform and the processor of the terminal device to be upgraded implement the method as described in any one of claims 1 to 6 when executing the computer program.

9. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 6 can be implemented.

Citation Information

Patent Citations

  • Differential upgrading method for embedded system based on storage container

    CN112286565A

  • In-situ upgrading method and device, network equipment and storage medium

    CN116932022A

  • Differential upgrading method and system based on Flash page alignment mode and medium

    CN117648109A

  • Memory optimized block-based differential update algorithm

    US20210004223A1

Cited By

  • FPGA online upgrading method based on MicroBlaze and PCIE bus

    CN121597302A