Adaptive differential firmware upgrade method and system for low-bandwidth wireless communication
By using an adaptive differential firmware upgrade method, which dynamically adjusts the fragment size and selective retransmission, the problems of low transmission efficiency and poor reliability in low-bandwidth wireless communication are solved, and efficient and secure firmware upgrades are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- 兴陆科技(河北)股份有限公司
- Filing Date
- 2026-06-24
- Publication Date
- 2026-07-24
AI Technical Summary
Existing differential OTA upgrade schemes for low-bandwidth wireless communication suffer from problems such as fixed fragmentation, high cost of retransmitting the entire packet, and lack of channel-aware closed loop, resulting in low transmission efficiency, energy waste, and poor equipment reliability.
An adaptive differential firmware upgrade method is adopted, which dynamically adjusts the fragment size by receiving channel quality parameters from the terminal device at the upgrade end, and uses fragment-level CRC-16 checksum and selective retransmission. Combined with the terminal device's fragment reception status table and closed-loop feedback mechanism, the reliability and efficiency of the upgrade process are ensured.
It improves the transmission efficiency of low-bandwidth wireless communication, reduces bandwidth and energy waste, ensures the reliability and security of the upgrade process, and avoids firmware synthesis failure caused by power outages during the upgrade process.
Smart Images

Figure CN122450490A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of IoT wireless communication and embedded device firmware upgrade technology, specifically to an adaptive differential firmware upgrade method and system for low-bandwidth wireless communication, which is particularly suitable for remote firmware upgrade of terminal devices in low-bandwidth, low-power wireless communication scenarios such as LoRa. Background Technology
[0002] With the rapid development of IoT technology, massive numbers of IoT terminals are being deployed in remote areas or complex industrial scenarios. Due to the need for software vulnerability fixes or feature updates in terminal firmware, over-the-air (OTA) firmware upgrades have become a core capability of product lifecycle management. However, in low-bandwidth wireless communication scenarios (typically LoRa and ZigBee, with bandwidth ranging from 0.3kbps to 250kbps), traditional full-package upgrade methods have significant bottlenecks: large firmware size leads to extremely long transmission times and high data costs, and upgrades are highly susceptible to failure due to transmission interruptions.
[0003] To reduce the amount of data transmitted, differential upgrades have emerged. Differential upgrades only transmit the differences between the old and new firmware, thus compressing the upgrade package size to a very small proportion of the original firmware. Existing technologies have attempted to apply differential algorithms such as BSDiff to LoRa OTA upgrades. For example, existing literature (Liu Yang and Wang Jian's "An OTA Differential Upgrade Method Using LoRa Communication" published in *IoT Technology* (2022)) discloses a LoRa OTA differential upgrade scheme using the BSDiff differential algorithm combined with a compression algorithm; a patent (CN117255337A) also discloses a dynamic broadcast differential OTA upgrade method based on LoRa networking.
[0004] However, existing differential OTA upgrade solutions for low-bandwidth wireless communication still have the following technical shortcomings:
[0005] 1. Fixed fragmentation granularity, unable to adapt to channel fluctuations: Existing solutions all use fixed frame lengths for fragmented transmission, which cannot adapt to the signal-to-noise ratio of the current wireless channel (SNR). ), Received signal strength indicator ( Dynamically adjust the fragment size. When the channel quality is good, small frames result in excessive overhead in the protocol header; when the channel quality is poor, large frames have a high error rate and high retransmission cost.
[0006] 2. Granularity-based verification of the entire packet: Partial errors lead to full retransmission. The existing solution addresses differential upgrade packets. Integrity verification is performed on a whole-packet basis. In low-bandwidth wireless channels, the probability of partial frame errors is high. Once the whole-packet verification fails, most of the successfully transmitted data must be discarded and retransmitted, resulting in a huge waste of bandwidth and energy.
[0007] 3. Unreliable power-off recovery mechanisms can easily brick devices: Existing solutions often attempt to resume transmission from the point of interruption after a transmission interruption. However, in low-bandwidth wireless scenarios, power outages or resets can easily corrupt or cause inconsistencies between the fragmented data temporarily stored in the terminal's memory and the progress status. If forced resumption of transmission or firmware synthesis is based on incomplete or corrupted data, the synthesized firmware package is likely to fail verification or even be corrupted, resulting in device bricking. At the same time, frequent power-off recovery attempts can also cause the device to be repeatedly woken up, accelerating battery wear.
[0008] 4. Lack of Channel Quality Awareness and Feedback Closed Loop: In existing solutions, the upgrade end does not actively sense the channel quality parameters reported by the terminal during the transmission phase, and the transmission strategy is open-loop control. When the channel deteriorates, the upgrade end cannot adjust the transmission parameters in time, causing the terminal to increase power consumption due to continuously receiving erroneous data. Summary of the Invention
[0009] The purpose of this invention is to overcome the shortcomings of the prior art and provide an adaptive differential firmware upgrade method and system for low-bandwidth wireless communication, so as to solve the problems of fixed fragmentation, high cost of whole packet retransmission and lack of channel-aware closed loop in the existing low-bandwidth differential upgrade scheme.
[0010] The technical solution adopted by this invention to solve its technical problem is: an adaptive differential firmware upgrade method for low-bandwidth wireless communication, including step S1: the upgrade end receives the current channel quality parameters reported by the terminal device, wherein the channel quality parameters include the signal-to-noise ratio. and received signal strength Step S2: The upgrade terminal is based on the above. and The optimal fragment size for this round of transmission is calculated based on a preset fragment size mapping function. The calculation process is as follows: when the channel quality is better than a preset threshold, the fragment size is increased to improve the effective payload ratio; when the channel quality is worse than a preset threshold, the fragment size is reduced to reduce the single-frame bit error rate; Step S3: The upgrade end follows the optimal fragment size. The differential upgrade package to be transmitted The data is divided into ordered fragment sequences, and a CRC-16 checksum is independently calculated for each fragment and appended to the end of the fragment to form a complete transmission unit; wherein, the differential upgrade packet... The new firmware and the old firmware are compared using the BSDiff differential algorithm to generate the complete transmission unit; Step S4: The upgrade terminal sends the complete transmission unit to the terminal device in sequence; Step S5: The terminal device receives the complete transmission unit and performs CRC-16 verification on each received fragment independently; fragments that pass the verification are marked as valid, fragments that fail the verification are marked as missing, and the fragment status is updated in the fragment reception status table in local memory. Step S6: After each reception window ends, the terminal device measures the current wireless link speed. and and the , and based on the fragmented reception status table The generated Selective Repeat Request (SRR) is reported to the upgrade end; the SRR carries a list of missing fragment numbers; Step S7: The upgrade end reports the updated SRR to the upgrade end. and Recalculate the optimal fragment size And only the fragments in the missing fragment number list are re-segmented, verified and resent; Step S8: Repeat steps S4 to S7 until the terminal device returns the fragment reception status table. All 1, the terminal device reads the complete differential upgrade package from memory. The BSDiff reverse synthesis algorithm is called to synthesize the new firmware by combining it with the local old firmware, thus completing the upgrade. If the terminal device experiences a power outage or reset during the upgrade process, the received fragment data and fragment reception status table in memory are cleared. After restarting, wait for the upgrade client to send the complete upgrade package again.
[0011] The above method, specifically the fragment size mapping function in step S2, is as follows: ,in, This is a truncation function. For reference Benchmark value and For configurable weighting coefficients, and These are the lower bound of the minimum fragment size and the upper bound of the maximum fragment size, respectively; when Higher than the first preset threshold and When it is higher than the second preset threshold, Approaching ;when Below the first preset threshold or When it is below the second preset threshold, Approaching This is to reduce the single-frame bit error rate when channel quality deteriorates.
[0012] In the above method, in step S3, each fragment header carries 6 bytes of metadata, including fragment number (2 bytes), total number of fragments (2 bytes), and effective payload length of the fragment (2 bytes).
[0013] In the above method, in step S5, the terminal device updates the fragmentation status to the fragmentation reception status table in its local memory. This includes: temporarily maintaining a length in the terminal device's RAM equal to the total number of fragments. Status record table , Indicates the first The image has passed verification. This indicates a missing segment; the fragment's receive status table. It is only used for receiving and scheduling in a single upgrade cycle and is not stored persistently.
[0014] In the above method, in step S8, after the terminal device synthesizes the new firmware, it also performs an overall verification step: the terminal device calculates the overall CRC-16 checksum for the new firmware and compares it with the reference checksum preset in the upgrade startup message by the upgrade end; if the verification passes, it writes it to the program storage area; if the verification fails, it clears the cache and sends an overall retransmission request to the upgrade end; if the cumulative number of overall retransmissions exceeds a preset maximum value... If so, the upgrade has failed.
[0015] An adaptive differential firmware upgrade system for low-bandwidth wireless communication includes an upgrade terminal and a terminal device; the upgrade terminal includes a firmware differential module for generating a differential upgrade package by calling the BSDiff algorithm. The channel quality assessment module is used to receive reports from the terminal. and And based on the mapping function The module calculates the optimal fragment size; the adaptive fragmentation module is used to calculate the optimal fragment size. Split Differential Upgrade Package The system comprises: an ordered fragment sequence; a fragment checksum generation module for independently calculating a CRC-16 checksum for each fragment; a wireless transmission module for sequentially transmitting complete transmission units and receiving SRR feedback from the terminal, retransmitting only missing fragments; and a terminal device including: a wireless receiving module for receiving complete transmission units; a fragment checksum module for independently performing CRC-16 checksums on each fragment; and a fragment reception status management module for temporarily maintaining a fragment reception status table in memory. Records the success or failure status of reception for each segment; the channel quality reporting module is used to measure the current link's... and It also periodically reports to the upgrade end; the firmware synthesis module is used to update the fragment receiving status table. When all 1s are active, read the complete differential upgrade package. The new firmware is then synthesized using the BSDiff reverse algorithm; if the terminal device loses power or is reset, the fragmented reception status table in memory is cleared. And the fragmented data has been received.
[0016] An electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, implements the steps of any of the methods described above.
[0017] A computer-readable storage medium having a computer program stored thereon that, when executed by a processor, implements the steps of any of the methods described above.
[0018] The beneficial effects of this invention are:
[0019] 1. Channel adaptive fragmentation improves transmission efficiency: Introducing a system based on... The adaptive fragmentation mechanism driven by the system increases the fragmentation to improve the effective payload ratio when the channel quality is good, and reduces the fragmentation to reduce the bit error rate of a single frame when the channel quality is poor, thus optimizing the transmission efficiency of low-bandwidth links from the physical layer.
[0020] 2. Independent verification and retransmission at the fragment level to avoid bandwidth waste: Each fragment carries an independent CRC-16 checksum, and the terminal can perform selective retransmission at the fragment level, requesting only lost or erroneous fragments, completely eliminating the huge bandwidth and energy waste caused by retransmitting the entire packet.
[0021] 3. Based on the in-memory fragmented receive status table The secure reset mechanism ensures absolute reliability of the upgrade: the terminal stores the fragmented reception status table only in memory. In the event of a power outage or reset, the memory data is automatically cleared, and the terminal directly waits to receive the complete new upgrade package. This invention abandons the unreliable power-off resume mechanism, fundamentally eliminating the risk of firmware synthesis failure or bricking caused by data incompleteness or inconsistent states due to power outages. It achieves absolute security and atomicity of the upgrade process at the cost of controllable full retransmission.
[0022] 4. Closed-loop feedback control reduces terminal power consumption: The terminal periodically reports channel quality, and the upgrade end dynamically adjusts the transmission strategy, avoiding long-term ineffective wake-up listening under weak signal conditions, and significantly reducing the communication power consumption of battery-powered equipment. Detailed Implementation
[0023] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0024] This invention provides an adaptive differential firmware upgrade method and system for low-bandwidth wireless communication, aiming to solve pain points such as packet retransmission caused by local bit errors due to channel fluctuations and upgrade interruptions due to power supply fluctuations during differential firmware over-the-air upgrades in low-bandwidth, low-power wireless scenarios. This invention is particularly suitable for industrial-grade terminals such as guidance and warning devices deployed along highways, demonstrating outstanding technical effectiveness in such scenarios. The terminal device is specifically an intelligent guidance device deployed along highways, which supports side mounting, vertical mounting, or carrying in its physical form, with an IP65 enclosure protection rating to meet the requirements of harsh outdoor weather environments. In terms of communication and power supply architecture, the device primarily uses LoRa wireless communication, supplemented by RS485 wired communication for some cluster nodes, and is compatible with DC36V, solar power, and battery power. In particular, under extreme conditions of nighttime or rainy days relying solely on battery power, the device needs to maintain continuous operation for up to 168 hours, which places extremely stringent requirements on communication power consumption during the upgrade process. In terms of business functions, the device is available in single-layer and dual-layer versions. The single-layer version supports red and yellow display, while the dual-layer version supports red and yellow text display. It incorporates multiple working modes, including standby, road contour enhancement, driving guidance, warning, accident, and running light modes. The flashing frequency must flexibly switch between 15 and 120 times per minute, and the brightness adapts to ambient light variations ranging from 500 to 7000 candela per square meter. Due to frequent adjustments in traffic control strategies and the need for continuous iteration of the display font library and mode algorithms, the terminal frequently requires remote firmware upgrades via a host computer. In the aforementioned actual deployment scenarios, due to signal deep fading caused by frequent obstruction by large vehicles on highways, road multipath effects, and fluctuations in solar cell power supply, traditional fixed-fragmentation whole-packet retransmission OTA solutions are prone to significant bandwidth waste and rapid battery depletion. Therefore, this invention introduces a channel quality-driven adaptive fragmentation and selective retransmission collaborative mechanism.
[0025] To support the above mechanism, this system operates collaboratively between the upgrade terminal and the terminal device. The upgrade terminal is typically a LoRa gateway deployed within a highway management station, which integrates a firmware differential module, a channel quality assessment module, an adaptive fragmentation module, a fragmentation checksum generation module, and a wireless transmission module. The firmware differential module is responsible for receiving the original firmware package of the current terminal firmware version. and the new firmware package to be upgraded The BSDiff differential algorithm is used to compare the binary data of the two datasets and generate a differential upgrade package. Differential upgrade package The size is usually the same as the original firmware package. The compression ratio ranges from 10% to 30%, with the specific ratio depending on the amount of code differences between firmware versions. The channel quality assessment module receives the current channel quality parameters, i.e., the signal-to-noise ratio, reported by the terminal device. and received signal strength Based on the preset fragment size mapping function, the optimal fragment size for this round of transmission is calculated. The core of the so-called adaptive mechanism lies in the fact that the mapping function can adapt to... and The system calculates the optimal packet size based on real-time data, ensuring high transmission success rates. The larger the calculated packet size, the better, reducing control and signaling overhead caused by fragmentation. Conversely, the smaller the calculated packet size, the better, preventing large amounts of data from being easily damaged in poorly configured links. The adaptive fragmentation module uses the optimal fragmentation size output by the channel quality assessment module. Differential upgrade package Divide into ordered fragment sequences, if differential upgrade package The total length cannot be The last fragment is divided by an integer, and the actual remaining length is taken. Each fragment header carries 6 bytes of metadata, including the fragment number, the total number of fragments, and the effective payload length of the fragment. The fragment checksum generation module independently calculates the CRC-16 checksum for each fragment and appends it to the fragment tail to form a complete transmission unit. The wireless transmission module transmits the fragment sequence in order, and only retransmits the fragment with the specified number after the receiving terminal's selective retransmission request.
[0026] Accordingly, the terminal device is equipped with a wireless receiving module, a fragment verification module, a fragment receiving status management module, a channel quality reporting module, a firmware synthesis module, and an upgrade verification module. The wireless receiving module continuously monitors the wireless channel and receives transmission units frame by frame. The fragment verification module recalculates and compares the checksum field of each received fragment. The fragment receiving status management module maintains a fragment receiving status table in memory. This table, temporarily stored in RAM as a list or array, records the arrival status of each slice. Indicates the first The image has passed verification. This indicates a missing value. This is why a fragmented receive status table is used. The design aims to allow the terminal to immediately identify which data is missing, enabling it to request data as needed rather than requiring a complete overhaul at the first sign of an error. The channel quality reporting module measures the current link's performance at the end of each reception window. and And report it. The firmware synthesis module is in the fragment reception status table. Read the complete differential upgrade package from memory when all are in use. The new firmware is then synthesized. The upgrade verification module performs overall verification and secure writing of the synthesized firmware. It is important to note that if the terminal experiences a power outage or unexpected reset, the temporary data in its RAM will be automatically cleared. This means that the received fragmented data and fragmented reception status table will also be deleted. All data will be erased. After the device restarts, you will have to wait for the upgrade server to initiate a complete upgrade process again, receiving a completely new differential upgrade package from beginning to end. data.
[0027] Regarding the specific interaction mechanism of the above system during the actual upgrade process, the upgrade end first receives the new firmware package. and the terminal's current original firmware package The BSDiff differential algorithm is used for comparison to generate a differential upgrade package. Subsequently, the upgrade device sends an upgrade start command to the terminal, which carries the overall CRC-16 checksum of the new firmware. Upon receiving the command, the terminal measures the signal-to-noise ratio of the current LoRa wireless channel. With received signal strength indication The terminal reports the channel parameters to the upgrade unit via the uplink. Based on these channel parameters, the upgrade unit's channel quality assessment module... and Based on the preset fragment size mapping function, the optimal fragment size for this round of transmission is calculated. Specifically, the optimal partition size mapping function is shown in equation (1): ,in, Indicates the numerical value Cut off to closed interval The function that takes ; For reference, the typical value is taken as... , used to Mapped to a positive increment; and These are configurable weighting coefficients, with typical values such as... , ; and These are the lower bound for the minimum fragment size and the upper bound for the maximum fragment size, typically 64 bytes and 512 bytes respectively. When the channel quality is good... High and When strong, Approaching the maximum fragment size, each frame carries more payload to reduce protocol header overhead; when channel quality is poor... Approaching the minimum fragment size reduces the probability of single-frame errors and improves the success rate of fragment transmission.
[0028] Next, the adaptive sharding module uses the calculated optimal shard size. Differential upgrade package Cut into There are ordered partitions, and the total number of partitions is [number]. The calculation method is shown in equation (2): ,in, For differential upgrade package byte size, sign This indicates rounding up. The fragment checksum generation module then appends a 6-byte metadata header and a 2-byte CRC-16 tail to each fragment, generating a variable-length transmission unit. Subsequently, the wireless transmission module sends these complete transmission units to the terminal device in sequence.
[0029] After receiving a complete transmission unit, the terminal device performs a CRC-16 check on each received fragment independently. Fragments that pass the check are marked as valid, while those that fail are marked as missing. The fragment reception status management module then updates the fragment status to the fragment reception status table in its local memory. In the middle. After each receiving window is completed, the terminal device measures the current wireless link. and And the channel quality parameters and the fragmented reception status table are used. The generated Selective Repeat Request (SRR) is reported to the upgrade end, and the SRR carries the fragmented receive status table. The set of missing fragment numbers with a value of 0. The set The definition is shown in equation (3): The upgrade end recalculates the optimal fragment size based on the updated channel quality parameters, and only re-segments, verifies, and retransmits fragments in the missing fragment number list, thus forming a closed-loop iteration. The terminal determines that all fragments have been received based on the fragment reception status table. All 1s, as shown in equation (4): This process continues until the terminal device returns the fragment reception status table. The condition of all 1s must be met. If the terminal experiences a power outage or reset during this transmission process, the fragmented data and fragmented reception status table temporarily stored in its memory will be affected. The data will be automatically cleared. After the device is powered on again, the upgrade terminal needs to re-initiate a complete upgrade start command and transmit the complete differential upgrade package from the beginning. .
[0030] After all fragments have been transmitted, the terminal device reads the data payloads of each fragment from memory in fragment number order and assembles them into a complete differential upgrade package. It also calls the BSDiff reverse synthesis algorithm to combine the local original firmware package. Synthesize new firmware package Subsequently, the terminal tested the new firmware package. Calculate the overall CRC-16 checksum and compare it with the reference checksum preset in the upgrade startup message on the upgrade device. If the overall checksum passes, write the new firmware to the program storage area to complete the upgrade and send an upgrade success feedback to the upgrade device; if the checksum fails, clear the cache and send an overall retransmission request. If the cumulative number of overall retransmissions exceeds the preset maximum value... (Typical value is 3 times), then the upgrade is declared a failure and an alarm is sent.
[0031] To more intuitively demonstrate the technical effectiveness of the above methods and systems in highway guidance device scenarios, a detailed quantitative analysis is presented below using a specific embodiment. Assume that multiple intelligent guidance devices are deployed as LoRa terminal nodes on a highway section, operating at a frequency of 433MHz, with a communication bandwidth of 125kHz and a transmission rate of approximately 10kbps. The nodes are powered by solar energy and lithium batteries and have 512KB of Flash storage. Due to road surface obstructions and weather conditions, the channel... span is to , span is to The upgrade terminal is a LoRa gateway deployed within a highway management station. The current firmware version of the device is V2.0, which is the original firmware package. The file is 100KB in size and contains the newly added "fog warning flow mode" and updated Chinese character fonts. It will be available in firmware version V2.1. The size has increased to 103KB. The upgrade process first modifies the original firmware package. and new firmware package Run the BSDiff algorithm to generate a differential upgrade package. The size has been compressed to approximately 22KB. The gateway calculates the new firmware package. The full CRC-16 value is sent to the node along with the upgrade startup command. The guidance device located in a medium signal coverage area on a bridge section measures the initial... for , for And report to the gateway. Set the mapping function parameters. for , for , for , It is 64 bytes. The size is 512 bytes. The initial optimal fragment size is calculated according to equation (1): Based on this, the gateway uses a differential upgrade package of 80 bytes to 22KB (22528 bytes). Perform fragmentation and calculate the total number of fragments according to formula (2): Each fragment is independently appended with 2 bytes of CRC-16 and 6 bytes of header metadata, with a complete transmission unit size of 88 bytes. The gateway sends 282 fragments in sequence. At the receiving end, after receiving 282 frames, the guiding device detects that the signal has momentarily fading due to the passing of a heavy truck, resulting in CRC-16 check failures in 15 frames. The fragment reception status table... The 15th position is 0. The node measured a slight deterioration in the updated channel state. for , for Based on this, a missing set is generated. And report to the gateway. After receiving the feedback, the gateway calculates the optimal size for the next round according to equation (1): After truncation, the smallest fragment size of 64 bytes is taken. The gateway only retransmits the missing 15 fragments, and the retransmission time is extremely short. After the retransmission is completed, the node checks again, and all 282 fragments pass, satisfying the fragment reception status table of equation (4). All conditions 1. The induction device extracts 282 payloads from memory and assembles them into a 22KB differential upgrade package. The BSDiff patch algorithm is executed to synthesize a new 103KB firmware package. .calculate The CRC-16 value matches the preset value, the verification passes, the node writes the new firmware to the application partition and restarts to take effect, and the "fog warning pipeline mode" is successfully loaded. In this typical embodiment, compared with the fixed 128-byte fragmentation scheme, adaptive fragmentation reduces the number of retransmissions by about 40%; fragment-level independent verification reduces the amount of retransmitted data to only 960 bytes, which is about 95.7% less than the 22KB full packet retransmission; the entire upgrade communication takes about 21 seconds, saving about 73% compared with the original full upgrade, fully verifying the great advantages of this invention in low-bandwidth and power-constrained scenarios on highways.
Claims
1. An adaptive differential firmware upgrade method for low-bandwidth wireless communication, characterized in that, include Step S1: The upgrade end receives the current channel quality parameters reported by the terminal device, the channel quality parameters including signal-to-noise ratio. and received signal strength ; Step S2: The upgrade terminal is based on the above. and The optimal fragment size for this round of transmission is calculated based on a preset fragment size mapping function. The calculation process is as follows: when the channel quality is better than a preset threshold, the fragment size is increased to improve the effective payload ratio; when the channel quality is worse than a preset threshold, the fragment size is reduced to reduce the single frame bit error rate. Step S3: The upgrade end follows the optimal shard size. The differential upgrade package to be transmitted The data is divided into ordered fragment sequences, and a CRC-16 checksum is independently calculated for each fragment and appended to the end of the fragment to form a complete transmission unit; wherein, the differential upgrade packet... It is generated by comparing the new firmware with the old firmware using the BSDiff differential algorithm; Step S4: The upgrade terminal sends the complete transmission units to the terminal device in sequence; Step S5: The terminal device receives the complete transmission unit and performs CRC-16 verification independently on each received fragment; fragments that pass the verification are marked as valid, fragments that fail the verification are marked as missing, and the fragment status is updated in the fragment reception status table in local memory. ; Step S6: After each reception window ends, the terminal device measures the current wireless link speed. and and the , and based on the fragmented reception status table The generated Selective Repeat Request (SRR) is reported to the upgrade end; the SRR carries a list of missing fragment numbers; Step S7: The upgrade client updates according to the new version. and Recalculate the optimal fragment size And only the fragments in the missing fragment number list are re-segmented, verified and reissued; Step S8: Repeat steps S4 to S7 until the terminal device returns the fragment reception status table. All 1, the terminal device reads the complete differential upgrade package from memory. The BSDiff reverse synthesis algorithm is called to synthesize the new firmware by combining it with the local old firmware, thus completing the upgrade. If the terminal device experiences a power outage or reset during the upgrade process, the received fragment data and fragment reception status table in memory are cleared. After restarting, wait for the upgrade client to send the complete upgrade package again.
2. The method according to claim 1, characterized in that, The specific fragment size mapping function in step S2 is as follows: ,in, This is a truncation function. For reference Benchmark value and For configurable weighting coefficients, and These are the lower bound of the minimum fragment size and the upper bound of the maximum fragment size, respectively; when Higher than the first preset threshold and When it is higher than the second preset threshold, Approaching ;when Below the first preset threshold or When it is below the second preset threshold, Approaching This is to reduce the single-frame bit error rate when channel quality deteriorates.
3. The method according to claim 1, characterized in that, In step S3, each fragment's header carries 6 bytes of metadata, including a fragment number (2 bytes), a total number of fragments (2 bytes), and the effective payload length of this fragment (2 bytes).
4. The method according to claim 1, characterized in that, In step S5, the terminal device updates the fragmentation status to the fragmentation reception status table in its local memory. ,include: The terminal device temporarily maintains a length in RAM equal to the total number of fragments. Fragmented Receive Status Table , Indicates the first The image has passed verification. This indicates a missing segment; the segment's receive status table. It is only used for receiving and scheduling in a single upgrade cycle and is not stored persistently.
5. The method according to claim 1, characterized in that, In step S8, after the terminal device synthesizes the new firmware, it also performs an overall verification step: The terminal device calculates the overall CRC-16 checksum for the new firmware and compares it with the reference checksum preset in the upgrade startup message on the upgrade end. If the verification passes, the data is written to the program storage area; if the verification fails, the cache is cleared and a full retransmission request is sent to the upgrade end; if the cumulative number of full retransmissions exceeds the preset maximum value... If so, the upgrade has failed.
6. An adaptive differential firmware upgrade system for low-bandwidth wireless communication, characterized in that, Including upgrade terminals and terminal devices; The upgrade terminal includes: The firmware differential module is used to call the BSDiff algorithm to generate differential upgrade packages. ; The channel quality assessment module is used to receive reports from the terminal. and And based on the mapping function Calculate the optimal partition size; The adaptive sharding module is used to determine the optimal shard size. Split Differential Upgrade Package It is an ordered fragmented sequence; The fragment checksum generation module is used to independently calculate the CRC-16 checksum for each fragment. The wireless transmission module is used to transmit complete transmission units in sequence and receive SRR feedback from the terminal, and only retransmits missing fragments; The terminal device includes: A wireless receiving module is used to receive complete transmission units; The fragment verification module is used to perform CRC-16 verification independently on each fragment; The fragmented reception status management module is used to temporarily maintain the fragmented reception status table in memory. Record the success or failure status of each segment's reception; The channel quality reporting module is used to measure the current link quality. and And periodically report to the upgrade end; Firmware synthesis module, used for fragmented receive status table When all 1s are active, read the complete differential upgrade package. The new firmware is then synthesized using the BSDiff reverse algorithm; if the terminal device loses power or is reset, the fragmented reception status table in memory is cleared. And the fragmented data has been received.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the method as described in any one of claims 1 to 5.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the steps of the method as described in any one of claims 1 to 5.