A method and system for block-based parallel differential OTA upgrade of software for on-orbit spacecraft

CN122569987APending Publication Date: 2026-08-14TECH & ENG CENT FOR SPACE UTILIZATION CHINESE ACAD OF SCI
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-26
Publication Date
2026-08-14

AI Technical Summary

Technical Problem

[0005]本发明所要解决的技术问题是提供一种在轨飞行器软件分块并行差分OTA升级方法及系统,以解决深空探测星载应用软件和系统软件在变更升级迭代过程中因上注文件体积大导致的上注时间过长、影响在轨软件升级迭代效率的技术问题

Benefits of technology

[0014]采用上述进一步方案的有益效果是:改进LPAQ8-tiny压缩算法删减高阶冗余上下文,固定模型采样窗口,降低浮点运算频次,同时依托分块特性实现多线程独立压缩,在不损失压缩率的前提下降低运算耗时。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122569987A_ABST
    Figure CN122569987A_ABST
Patent Text Reader

Abstract

This invention discloses a method and system for on-orbit spacecraft software upgrade using a block-based parallel differential OTA (Over-The-Air) approach, relating to the field of on-orbit software upgrade technology. The method includes: a ground station dividing the first and second version files of the software to be upgraded into fixed-length blocks, classifying them as reuse blocks, difference blocks, or new blocks; extracting offset length encoding pairs and literal bytes from the difference blocks using sliding window matching to generate differential data; and performing block entropy compression on the differential data and new block data using an improved LPAQ8-tiny compression algorithm to obtain differential patch files, which are then uploaded to the on-orbit spacecraft. The on-orbit spacecraft then restores each block according to its block type differences to generate the second version file, thus completing the upgrade. This invention significantly compresses the upgrade package size and adapts to low-resource environments on embedded devices through block-based fault tolerance and streaming restoration, shortening the software upload time for deep-space spacecraft and improving upgrade efficiency and reliability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of on-orbit software upgrade technology for spacecraft, and in particular to a block-based parallel differential OTA upgrade method and system for on-orbit spacecraft software. Background Technology

[0002] As deep space exploration missions continue to advance, the size of application software, operating systems, and FPGA firmware carried by various deep space vehicles continues to increase. However, the obstruction of deep space objects leads to a scarcity of space-to-ground telemetry and control link establishment windows and low uplink transmission rates. Uploading complete software packages in their entirety would occupy an extremely long telemetry and control arc, severely restricting the efficiency of onboard software iteration. How to reduce the size of upgrade data packets and shorten the on-orbit uploading time has become a core business challenge that urgently needs to be solved in the field of on-orbit operation and maintenance of deep space vehicles.

[0003] Currently, the industry generally uses the bsdiff differential algorithm to achieve incremental OTA software upgrades. By comparing the old and new version files to generate a small differential patch package to replace the uploading of the complete program package, the amount of data transmitted uplink can be significantly reduced. In scenarios with sufficient link resources such as low-orbit satellites, the uploading time of software upgrades can be effectively shortened.

[0004] However, this differential scheme has inherent defects that make it difficult to adapt to the embedded hardware on deep space vehicles. The operation process requires loading both new and old complete files, and the memory peak increases linearly with the software size. In large file scenarios, memory overflow and crash are very likely to occur. At the same time, single-threaded differential and merge operations are inefficient, and the entire patch only has global verification. If a single block of data is corrupted, the entire upgrade process will fail. It cannot meet the actual on-orbit usage requirements of deep space vehicles with limited resources and strict upgrade reliability requirements. Summary of the Invention

[0005] The technical problem to be solved by the present invention is to provide a method and system for on-orbit spacecraft software block parallel differential OTA upgrade, so as to solve the technical problem that the large size of the upload file during the change, upgrade and iteration process of deep space exploration spaceborne application software and system software leads to excessive upload time and affects the efficiency of on-orbit software upgrade and iteration.

[0006] To achieve the above objectives, the embodiments of the present invention adopt the following technical solutions: Firstly, a method for block-based parallel differential OTA upgrade of on-orbit spacecraft software is provided, including: The ground station divides the first and second version files of the software to be upgraded into blocks, calculates hash values ​​in parallel using multi-threading and matches them, and classifies each block of the second version file into reuse blocks, difference blocks, or new blocks; wherein, the second version file is an upgraded version of the first version file; The ground station divides the second version file, which is classified as a difference block, into blocks. By performing sliding window matching in the corresponding blocks of the first version file, it extracts offset length code pairs and literal bytes to generate differential data. The differential data and the newly added block data are compressed to obtain a differential patch file. The ground station uploads the differential patch file to the on-orbit spacecraft; After receiving the differential patch file, the on-orbit spacecraft decompresses the differential patch file and, according to the block type of each block, restores the reused blocks, difference blocks, and new blocks block by block based on the local first version file and the decompressed data to generate the second version file. After the on-orbit spacecraft passes the verification, it loads the second version file. If loading fails, it automatically starts from the preset original area and runs the software version before the upgrade.

[0007] The beneficial effects of this invention are as follows: By using a block-based multi-threaded parallel differential algorithm and an improved LPAQ8-tiny compression algorithm, the size of the on-orbit software upgrade data packet is effectively reduced, thereby making better use of the satellite-to-ground link establishment time; the block-based strategy of differential upgrade data packets ensures that anomalies in a single file block will not cause the entire upgrade file to fail; by introducing a sparse hash table instead of the traditional full hash table for calculating the differential patch packet of the upgrade data packet, both embedded memory utilization and upgrade speed are balanced; the improved LPAQ8-tiny compression algorithm is introduced instead of the standard compression algorithm, further improving the speed and efficiency of the compression algorithm; this invention is universal and applicable to on-orbit upgrade and reconstruction of embedded CPU software, SOC architecture software, and pure FPGA software.

[0008] Based on the above technical solution, the following improvements can be made.

[0009] Furthermore, the ground station divides the first and second version files of the software to be upgraded into blocks, including fixed-length blocks according to a preset block size, satisfying the following relationship: ; in, offset i This is the starting offset of the i-th data block. len i This represents the effective length of the current block. N B represents the total number of blocks in the corresponding file, B represents the preset block size, and S represents the size of the corresponding file in bytes.

[0010] The advantages of adopting the above-mentioned further scheme are: all data blocks are independent of each other and have no context dependency, providing a structural foundation for lock-free parallel computing. At the same time, the use of a streaming processing method with fixed block size can control the peak memory usage of the algorithm and avoid loading the entire file.

[0011] Furthermore, the ground station divides the second version file into blocks classified as difference blocks, and extracts offset length encoded pairs and literal bytes to generate differential data by performing sliding window matching on the corresponding blocks of the first version file, including: Within the dictionary window S formed by the first version file blocks, perform redundancy matching on the data stream P of the second version file blocks and solve for the global maximum matching length. Lmax : Lmax=max{L|S[pos,pos+L−1]=P[cur,cur+L−1]} ; The matched byte sequence is described in offset length encoded pairs (pos, L), and discrete bytes that cannot be matched are marked as literal bytes.

[0012] The beneficial effects of adopting the above-mentioned further scheme are: based on the LZ77 sliding dictionary matching idea, by solving the global maximum matching length to generate offset length encoding pairs, it is possible to effectively describe the repeating byte sequences between the old and new versions of the file, and achieve efficient differential encoding.

[0013] Furthermore, the ground station compresses the differential data and the newly added block data, including: Block entropy compression is performed using an improved LPAQ8-tiny compression algorithm; let the byte sequence to be compressed be X={x1,x2,...,x...} n The byte conditional probability is obtained through a lightweight context model, and the compression mapping is completed using arithmetic coding. ; in, For the context of the i-th byte, Let be the conditional probability of byte xi occurring in the given context.

[0014] The beneficial effects of adopting the above-mentioned further scheme are: improving the LPAQ8-tiny compression algorithm by removing high-order redundant context, fixing the model sampling window, reducing the frequency of floating-point operations, and at the same time, relying on the block characteristics to achieve multi-threaded independent compression, thereby reducing the computation time without losing the compression ratio.

[0015] Furthermore, the on-orbit spacecraft, based on the block type of each segment, restores the reused blocks, difference blocks, and new blocks block by block based on the local first version file and the decompressed data, generating the second version file, including: The global index table is parsed from the differential patch file to obtain the metadata of each block; The data structure of the metadata is as follows: BlockInfo[j]={Type j Offset j Len j CRC j } ; Type j For block type, Offset j This represents the offset of the block within the patch. Len j This is the length of the compressed block. CRC j This is the block check value; When the block type is a reused block, the corresponding block is read from the local first version file and used as the corresponding block for the second version file based on the first version file block number recorded in the index table. When the block type is a differential block, the compressed data is decompressed. Based on the LZ77 encoding logic, the decompressed differential data is parsed in reverse. The matching byte sequence of length L is extracted from the corresponding first version file block using the encoding pair (pos, L), and concatenated with the literal byte to restore the corresponding block of the second version file. When the block type is a new block, the decompressed data will be directly used as the corresponding block of the second version file; The restored blocks are then assembled in sequence to generate the second version file.

[0016] The beneficial effects of adopting the above-mentioned further solution are: through the differentiated restoration strategy of block type, the reused block does not need to be decompressed and can be directly copied, the differentiated block is restored by reverse parsing based on LZ77 encoding logic, the newly added block directly uses the decompressed data, the whole process is processed in a streaming and sequential manner, without loading the whole file into memory, which is suitable for the resource constraints of low memory and low computing power of embedded terminals.

[0017] Furthermore, after the on-orbit spacecraft passes verification, the second version file is loaded, including: After each block is restored, the CRC check value of the block is calculated and compared with the block check value CRCj. If the check fails, the decompression and restoration of the block are re-executed. When the cumulative failure reaches a preset number, an exception prompt is triggered. After all blocks are restored and spliced, the global hash value of the second version file is calculated and compared with the global check value in the differential patch file. If they are consistent, the check is deemed to have passed. During the process of restoring and generating the second version file block by block, the local first version file is retained and not overwritten.

[0018] The beneficial effects of adopting the above-mentioned further scheme are: through the dual verification mechanism of combining block-level CRC check and global hash check, the correctness of the restoration of a single block is guaranteed, and the integrity of the entire new file is verified; when the verification fails, the old file is retained and not overwritten, ensuring that the upgrade failure does not affect the current operation of the aircraft.

[0019] Furthermore, the hash index table constructed by the ground station adopts a sparse hash table structure; the first version file and the second version file are loaded in a streaming read-only manner at the ground station, without full memory loading; when the on-orbit spacecraft performs decompression and block restoration, it adopts single-threaded serial execution, and the peak memory usage is positively correlated with the preset block size.

[0020] The advantages of adopting the above-mentioned further solutions are: sparse hash tables take into account both embedded memory utilization and upgrade speed; streaming read-only loading avoids excessively high memory peaks caused by full file loading; single-threaded serial execution on the embedded side adapts to the low computing power environment of a single-core CPU, and the memory peak is only related to the block size, controlled in the KB to MB level.

[0021] Furthermore, the preset block size is 64KB.

[0022] The advantages of adopting the above-mentioned further solution are: the 64KB block size achieves a better balance between matching efficiency and memory usage, effectively utilizing the limited memory resources of the embedded device.

[0023] Secondly, an on-orbit spacecraft software block-based parallel differential OTA upgrade system is provided, including: A ground-based differential generation module, deployed at a ground station, is used to divide the first and second version files of the software to be upgraded into fixed-length blocks according to a preset block size. It calculates the block hash values ​​in parallel using multi-threading and classifies them into reused blocks, difference blocks, or new blocks. For the difference blocks, it extracts offset length code pairs and literal bytes based on sliding window matching to generate differential encoded data. It then performs block entropy compression on the differential encoded data and new block data using an improved LPAQ8-tiny compression algorithm to generate a differential patch file. The second version file is an upgraded version of the first version file. A ground transmission module, deployed at the ground station, is used to upload the differential patch file to the on-orbit spacecraft. A spaceborne restoration module, deployed on the on-orbit spacecraft, is used to decompress the received differential patch file into blocks. Based on the block type of each block, it restores the second version file block by block based on the local first version file and the decompressed data. After successful verification, the second version file is loaded; if loading fails, it automatically starts from a preset original area and runs the software version before the upgrade.

[0024] Thirdly, an electronic device is provided, the electronic device including a memory and one or more processors; the memory is coupled to the processors; wherein the memory stores computer program code, the computer program code including computer instructions, which, when executed by the processor, cause the electronic device to perform the method as described in any implementation of the first aspect.

[0025] Fourthly, a computer-readable storage medium is provided, including computer instructions that, when executed on an electronic device, cause the electronic device to perform a method as described in any implementation of the first aspect.

[0026] Fifthly, a computer program product is provided that, when run on a computer, causes the computer to perform the method in any implementation of the first aspect.

[0027] Understandably, the beneficial effects achieved by the system of the second aspect, the electronic device of the third aspect, the computer-readable storage medium of the fourth aspect, and the computer program product of the fifth aspect provided above can be referred to with reference to the beneficial effects of the first aspect and any of its possible design embodiments, which will not be repeated here. Attached Figure Description

[0028] Figure 1 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention; Figure 2 A flowchart of an on-orbit spacecraft software block-based parallel differential OTA upgrade method provided in an embodiment of the present invention; Figure 3 This is a schematic diagram of an upgrade system provided in an embodiment of the present invention. Detailed Implementation

[0029] The technical solutions of the embodiments of the present invention will be described below with reference to the accompanying drawings. In the description of the present invention, unless otherwise stated, " / " indicates that the objects before and after are in an "or" relationship. For example, A / B can represent A or B. The "or" in the present invention is merely a description of the relationship between the related objects, indicating that three relationships can exist. For example, A or B can represent: A alone, A and B simultaneously, and B alone. A and B can be singular or plural. Furthermore, in the description of the present invention, unless otherwise stated, "multiple" refers to two or more. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items.

[0030] Furthermore, to facilitate a clear description of the technical solutions of the embodiments of the present invention, the terms "first" and "second" are used in the embodiments of the present invention to distinguish identical or similar items with essentially the same function and effect. Those skilled in the art will understand that the terms "first" and "second" do not limit the quantity or execution order, and that the terms "first" and "second" are not necessarily different.

[0031] In this embodiment of the invention, the terms "exemplary" or "for example" are used to indicate that something is an example, illustration, or description. Any embodiment or design described as "exemplary" or "for example" in this embodiment of the invention should not be construed as superior or more advantageous than other embodiments or designs. Specifically, the use of terms such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner for ease of understanding.

[0032] As deep space exploration missions continue to advance, the size of application software, operating systems, and FPGA firmware carried by various deep space vehicles continues to increase. However, the obstruction of deep space objects leads to a scarcity of space-to-ground telemetry and control link establishment windows and low uplink transmission rates. Uploading complete software packages in their entirety would occupy an extremely long telemetry and control arc, severely restricting the efficiency of onboard software iteration. How to reduce the size of upgrade data packets and shorten the on-orbit uploading time has become a core business challenge that urgently needs to be solved in the field of on-orbit operation and maintenance of deep space vehicles.

[0033] Currently, the industry generally uses the bsdiff differential algorithm to achieve incremental OTA software upgrades. By comparing the old and new version files to generate a small differential patch package to replace the uploading of the complete program package, the amount of data transmitted uplink can be significantly reduced. In scenarios with sufficient link resources such as low-orbit satellites, the uploading time of software upgrades can be effectively shortened.

[0034] However, this differential scheme has inherent defects that make it difficult to adapt to the embedded hardware on deep space vehicles. The operation process requires loading both new and old complete files, and the memory peak increases linearly with the software size. In large file scenarios, memory overflow and crash are very likely to occur. At the same time, single-threaded differential and merge operations are inefficient, and the entire patch only has global verification. If a single block of data is corrupted, the entire upgrade process will fail. It cannot meet the actual on-orbit usage requirements of deep space vehicles with limited resources and strict upgrade reliability requirements.

[0035] In view of this, embodiments of the present invention provide a method for on-orbit spacecraft software block-based parallel differential OTA upgrade. The method includes: a ground station dividing the first version file and the second version file of the software to be upgraded into blocks, calculating hash values ​​in parallel through multi-threading and matching them, and classifying each block of the second version file into reuse blocks, difference blocks, or new blocks; wherein, the second version file is an upgraded version of the first version file; the ground station extracts offset length code pairs and literal bytes by performing sliding window matching on the corresponding blocks of the first version file for the second version file classified as difference blocks. Differential data is generated, and the differential data and newly added block data are compressed to obtain a differential patch file. The ground station uploads the differential patch file to the on-orbit spacecraft. After receiving the differential patch file, the on-orbit spacecraft decompresses the differential patch file and, according to the block type of each block, restores the reused blocks, differential blocks, and newly added blocks block by block based on the local first version file and the decompressed data to generate a second version file. After the on-orbit spacecraft passes the verification, it loads the second version file. If loading fails, it automatically starts from the preset original area and runs the software version before the upgrade.

[0036] The method provided by this invention effectively reduces the size of on-orbit software upgrade data packets by using a block-based multi-threaded parallel differential algorithm and an improved LPAQ8-tiny compression algorithm, thereby making better use of the satellite-to-ground link establishment time. The block-based strategy using differential upgrade data packets ensures that an anomaly in a single file block will not cause the entire upgrade file to fail. By introducing a sparse hash table instead of a traditional hash table, both embedded memory utilization and upgrade speed are balanced. Furthermore, the improved LPAQ8-tiny compression algorithm replaces the standard compression algorithm, further improving the speed and efficiency of the compression algorithm.

[0037] In some embodiments, the on-orbit spacecraft software block parallel differential OTA upgrade method provided by the present invention can be executed by an on-orbit spacecraft software block parallel differential OTA upgrade system 100 (hereinafter referred to as upgrade system 100).

[0038] It should be noted that the upgrade system 100 includes any electronic device 200 with data processing capabilities installed at the ground station and on the orbital spacecraft, such as a general-purpose computer, personal computer, laptop, server or tablet computer, etc. The specific implementation method of the upgrade system 100 is not limited here.

[0039] This can also be understood as follows: The method provided by this invention involves collaborative execution between the ground station and the on-orbit spacecraft. The ground station is responsible for dividing the first and second version files of the software to be upgraded into blocks, performing multi-threaded parallel hash matching and block classification, sliding window differential encoding, and improved LPAQ8-tiny block entropy compression to generate differential patch files. These differential patch files are then uploaded to the on-orbit spacecraft via the space-to-ground telemetry and control link. The on-orbit spacecraft, acting as the execution terminal for differential upgrades, is limited by the low computing power of its single-core embedded hardware and its KB- to MB-level memory resources. It is responsible for decompressing the received differential patch files into blocks, and based on the block type of each block, reconstructing the second version file block by block using the locally pre-stored first version file and the decompressed differential data. After verification, the second version file is loaded and run. The ground station and the on-orbit spacecraft interact via a space-to-ground link, with the computational processes on both sides sequentially connected in time and transmitted via the differential patch files.

[0040] Figure 1 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present invention is shown. The electronic device 200 includes a processor 210, a memory 220, and a communication interface 230.

[0041] Processor 210 may include one or more processing cores. Processor 210 connects to various parts within electronic device 200 using various interfaces and lines, and performs various functions and processes data of electronic device 200 by running or executing instructions, programs, code sets, or instruction sets stored in memory 220, and by calling data stored in memory 220. Optionally, processor 210 may be implemented using at least one of the following hardware forms: Central Processing Unit (CPU), Graphics Processing Unit (GPU), Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA).

[0042] The memory 220 may include random access memory (RAM) or read-only memory (ROM). Optionally, the memory 220 may include a non-transitory computer-readable storage medium. The memory 220 may be used to store instructions, programs, code, code sets, or instruction sets. The memory 220 may include a stored program area. The stored program area may store instructions for implementing an operating system, instructions for implementing at least one function, instructions for implementing the various method embodiments described above, etc.

[0043] Communication interface 230 is used to communicate with other devices, equipment or communication networks, such as data storage devices, image processing devices or Ethernet, wireless access network (RAN), wireless local area network (WLAN), etc.

[0044] In terms of physical implementation, the aforementioned devices (such as processor 210, memory 220, and communication interface 230) can each be devices within the same device (such as a laptop computer). Alternatively, at least two of these devices can be located within the same device, i.e., as different devices within the same device, similar to the deployment of devices or components in a distributed system.

[0045] It is understood that the structure illustrated in this embodiment does not constitute a specific limitation on the electronic device 200. In other embodiments of the present invention, the electronic device 200 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0046] The following description, in conjunction with the accompanying drawings, illustrates an embodiment of the present invention providing a modular parallel differential OTA upgrade method for on-orbit spacecraft software.

[0047] Figure 2 This is a flowchart illustrating a block-based parallel differential OTA upgrade method for on-orbit spacecraft software, provided as an embodiment of the present invention. Optionally, this method can be... Figure 1 The illustrated electronic device performs this operation. The method includes the following steps: S1. The ground station divides the first and second version files of the software to be upgraded into blocks, calculates hash values ​​in parallel through multi-threading and matches them, and classifies each block of the second version file into reuse blocks, difference blocks or new blocks.

[0048] The second version file is an upgraded version of the first version file.

[0049] Specifically, this invention uses embedded firmware incremental upgrades as an application scenario, employing a streaming, block-based, lock-free parallel hash matching architecture. The spacecraft payload software storage area is divided into an original area and an upload area. The original area has the initial version of the software program permanently stored on the ground and cannot be reconfigured. The upload area can be updated and iterated based on actual on-orbit operation. It is assumed that the original area and upload area in the spacecraft already contain the first version of the software program, and the second version is the upgraded version that will be uploaded and reconfigured.

[0050] In one possible implementation, the ground station divides the first and second version files of the software to be upgraded into blocks, including fixed-length blocks according to a preset block size. The algorithm uses a fixed-length splitting strategy for the old and new files, and the physical offset of the file and the block length satisfy the following relationship: ; in, offset i This is the starting offset of the i-th data block. len i This represents the effective length of the current block. N B represents the total number of blocks in the corresponding file, B represents the preset block size, and S represents the size of the corresponding file in bytes.

[0051] All data blocks are independent of each other and have no context dependencies, providing a structural foundation for lock-free parallel computing.

[0052] In one possible implementation, the hash index table constructed by the ground station adopts a sparse hash table structure, balancing embedded memory utilization and hash matching speed. The first and second version files are loaded on the ground station using a streaming read-only loading method, without full memory loading, to control the algorithm's memory peak.

[0053] Specifically, firstly, the hash values ​​of all data blocks in the first version file are calculated in parallel using a thread pool. A hash mapping table Map(HashValue) = Blockold is generated using the Rabin-Karp rolling hash function to complete the hash index construction. Secondly, the hash values ​​Hash[j] = H(Blocknew[j]) of each block in the second version file are calculated in parallel and matched with the hash index table. Second version file blocks with matching hash values ​​are classified as reused blocks; second version file blocks with mismatched hash values ​​but corresponding blocks from the first version file are classified as difference blocks; and second version file blocks with mismatched hash values ​​but no corresponding blocks from the first version file are classified as new blocks.

[0054] The method provided by this invention combines streaming block partitioning with sparse hash tables to achieve efficient block-level matching and classification of new and old files while controlling memory peaks. All data blocks are independent of each other, providing a structural foundation for subsequent lock-free parallel differential computation. The streaming read-only loading method avoids excessive memory peaks caused by loading the full file, while the sparse hash table structure further reduces memory usage.

[0055] S2. The ground station divides the second version file, which is classified as a difference block, into blocks. By performing sliding window matching in the corresponding blocks of the first version file, it extracts the offset length code pair and literal bytes to generate differential data. The differential data and the newly added block data are compressed to obtain a differential patch file.

[0056] In one possible implementation, the ground station divides the second version file, classified as a difference block, into blocks and extracts offset length encoded pairs and literal bytes by performing sliding window matching on the corresponding blocks of the first version file to generate differential data, including: Within the dictionary window S formed by the first version file blocks, perform redundancy matching on the data stream P of the second version file blocks and solve for the global maximum matching length. Lmax : Lmax=max{L|S[pos,pos+L−1]=P[cur,cur+L−1]} ; The matched byte sequence is described in offset length encoded pairs (pos, L), and discrete bytes that cannot be matched are marked as literal bytes.

[0057] The above algorithm outputs offset length encoded pairs to describe repeating byte sequences, and unmatched discrete bytes are marked as literal bytes, thus completing single-block differential encoding.

[0058] In one possible implementation, the ground station compresses the differential data and the newly added block data, including: Block entropy compression is performed by improving the LPAQ8-tiny compression algorithm. The native LPAQ8-tiny is an adaptive context hybrid compression algorithm that implements entropy encoding based on a probabilistic prediction model. In this embodiment, the improved scheme optimizes the model refresh logic, reduces the context sampling level, and is adapted to low-computing devices such as embedded platforms.

[0059] Let the differential byte sequence to be compressed be X = {x1, x2, ..., x...} n The improved algorithm calculates byte conditional probabilities using a lightweight context model and completes the compression mapping using arithmetic coding. ; in, For the context of the i-th byte, Let be the conditional probability of byte xi occurring in the given context.

[0060] Compared to the native LPAQ8-tiny, the improved algorithm reduces high-order redundant context, fixes the model sampling window, and reduces the frequency of floating-point operations. At the same time, relying on the block characteristics, it realizes multi-threaded independent compression, and individual compression tasks do not interfere with each other, reducing the computation time without losing the compression ratio.

[0061] As an example, when the package size of an on-orbit spacecraft is below MB, the compression encoding precision can be appropriately reduced to achieve a faster compression speed; when the package size is in the GB range, higher encoding precision is retained to ensure a high compression ratio. Users can configure this flexibly according to the actual file size.

[0062] The method provided in this invention solves for the global maximum matching length based on the LZ77 sliding dictionary matching idea, generates offset length encoded pairs and literal bytes, and then performs block entropy compression on differential encoded data and newly added block data using an improved LPAQ8-tiny compression algorithm. This overcomes the shortcomings of the traditional bsdiff algorithm, such as high memory peak, slow single-threaded execution, and poor fault tolerance. The improved LPAQ8-tiny compression algorithm reduces high-order redundant context, fixes the model sampling window, and achieves multi-threaded independent compression based on block characteristics.

[0063] S3. The ground station uploads the differential patch file to the on-orbit spacecraft.

[0064] Specifically, the ground station uploads the compressed differential patch file to the on-orbit spacecraft via satellite-to-ground link establishment. Because the differential patch file is significantly smaller than the full package upload, the upload time is greatly shortened, allowing for more efficient use of the limited ground station link establishment time.

[0065] S4. After receiving the differential patch file, the on-orbit spacecraft decompresses the differential patch file and, according to the block type of each block, restores the reused blocks, difference blocks, and new blocks block by block based on the local first version file and the decompressed data to generate the second version file.

[0066] As the execution terminal for differential upgrades, the on-orbit spacecraft is limited by low single-core computing power and KB-level and MB-level memory resources, necessitating the design of lightweight and highly reliable decompression and new file reconstruction algorithms. This embodiment, based on the patch file generated by the block-based multi-threaded parallel differential algorithm described above, employs an improved LPAQ8-tiny decompression algorithm combined with streaming block restoration logic to achieve efficient reconstruction from the first version file and differential patch to the second version file.

[0067] In one possible implementation, the on-orbit spacecraft performs decompression and block restoration using a single-threaded serial execution to avoid thread scheduling overhead and adapt to a single-core CPU; streaming processing is supplemented by memory reuse, and the memory peak is only positively correlated with the preset block size B, controlled at the 64KB level, which is lower than the embedded memory threshold.

[0068] Specifically, the on-orbit spacecraft, based on the block type of each segment, restores the reused blocks, difference blocks, and new blocks block by block based on the local first version file and the decompressed data, generating the second version file, including: The global index table is parsed from the differential patch file to obtain the metadata for each block. BlockInfo[j]= {Type j Offset j Len j CRC j } ; Type j For block type (reused block / different block / new block). Offset j This represents the offset of the block within the patch. Len j This is the length of the compressed block. CRC j This is the block check value.

[0069] According to the block order of the second version file, j=0,1,...,N new-1 Traverse the index table and extract the parameters required for decompression and restoration of each block in turn to ensure that the block order is consistent with the physical structure of the new file and avoid reconstruction errors.

[0070] For the difference blocks and new blocks in the patch, the improved LPAQ8-tiny decompression algorithm is used to decode them block by block. Reusable blocks do not need to be decompressed and only need to reference the old file data.

[0071] Let Compressj be a compressed block of data in the patch. The decompression process satisfies: Where Model is the improved and accelerated LPAQ8-tiny context probability model, and Uncompressj is the decompressed original differential data (the difference block is an LZ77 encoded pair and a literal, and the new block is the original binary stream).

[0072] The decompression process employs single-threaded serial decoding. After each block is decompressed, the compressed data memory for that block is immediately released, retaining only the temporary decompressed data. During decoding, the CRC (Uncompressj) is checked in real time. If it does not match the CRCj in the index table, the block is immediately marked as abnormal.

[0073] Perform the restoration operation block by block, following the block-by-block order of the second version file: When the block type is a reused block, the corresponding block is read from the local first version file and used directly as the corresponding block of the second version file according to the first version file block number i recorded in the index table: The restoration formula is: .

[0074] When the block type is a differential block, the compressed data is decompressed. Based on the LZ77 encoding logic, the decompressed differential data is parsed in reverse. The encoding pair (pos, L) is read, and a byte sequence of length L is extracted from the offset pos of the corresponding first version file block. This sequence is then concatenated with the decompressed literal bytes to reconstruct the corresponding block of the second version file. The restoration formula is: .

[0075] Where S is the dictionary window for the first version of the file chunks, Literal This is the decompressed literal byte sequence.

[0076] When the block type is a new block, the decompressed data is directly used as the corresponding block of the second version file, without relying on the local first version file data.

[0077] Each piece after restoration Write the corresponding offset positions of the second version file in sequence to complete the streaming splicing and avoid memory accumulation.

[0078] The method provided by this invention obtains the block type metadata of each block by parsing a global index table, and executes differentiated restoration strategies according to three types: reused blocks, differential blocks, and new blocks. Reuse blocks directly copy the old file blocks; differential blocks are restored by reverse parsing based on LZ77 encoding logic; and new blocks directly use the decompressed data. The entire process is stream-based, and the peak memory usage is controlled at the block size level, adapting to KB to MB level memory resources on embedded devices. On the in-orbit spacecraft, the entire process is executed serially using a single thread. The improved LPAQ8-tiny decompression algorithm reduces redundant calculations, increasing decoding speed by more than 30%, better meeting the real-time upgrade requirements of embedded systems.

[0079] S5. After the on-orbit spacecraft passes the verification, the second version file is loaded. If loading fails, it will automatically start from the preset original area and run the software version before the upgrade.

[0080] In one possible implementation, after the on-orbit spacecraft passes verification, it loads the second version file, including: After each block is restored, the CRC check value of that block is calculated and compared with the block check value CRCj. If the check fails, the decompression and restoration of that block are re-executed. When the cumulative failure reaches a preset number, an exception prompt is triggered.

[0081] After all blocks are restored and spliced, the global hash value of the second version file is calculated and compared with the global check value in the differential patch file. If they match, the check is deemed successful.

[0082] During the process of restoring and generating the second version file block by block, the local first version file is retained and not overwritten.

[0083] After successful verification, the second version file is written to the flash memory of the on-orbit spacecraft and the system is restarted for loading. If the second version software in the flash memory fails to load, the system automatically starts from the preset original memory and runs the software version before the upgrade. For scenarios such as decompression failure, verification error, or old file corruption, the old files are retained without being overwritten, and error logs are recorded to facilitate later troubleshooting and patch re-transmission.

[0084] The method provided by this invention uses a dual verification mechanism that combines block-level CRC check and global hash check to ensure the correctness of the restoration of individual blocks and verify the integrity of the entire new file. When the verification fails, the old file is retained without being overwritten, and when the loading fails, it automatically starts from the original area, ensuring that the upgrade failure does not affect the current operation of the spacecraft, thus realizing a safe and reliable on-orbit software upgrade.

[0085] In a specific application example, consider the software upgrade of a lunar orbiter. The first version of the application software on this spacecraft was 15MB in size, and the second version was 16MB. The ground station divided the two versions of the file into fixed-length blocks of 64KB each, resulting in 240 blocks for the first version and 256 blocks for the second version. Through multi-threaded parallel hash matching, 200 blocks in the second version were classified as reused blocks, 40 blocks as difference blocks, and 16 blocks as new blocks. For the 40 difference blocks, offset length encoded pairs and literal bytes were generated based on sliding window matching. Then, the difference data and new block data were compressed using an improved LPAQ8-tiny compression algorithm, resulting in a difference patch file of approximately 2.3MB. Compared to the full 16MB of the second version file, the difference patch file size was reduced by approximately 86%. Based on the CAN bus protocol of the satellite payload, each frame contains 96 bytes of valid data. The satellite-to-ground link is divided into an X-band connectivity test channel and an X-band data transmission channel, with corresponding rates ranging from 1 to 200 frames per second. The two channels operate independently and serve as backups for each other. If the data packet is uploaded at a rate of 1 frame per second on the X-band connectivity test channel, uploading a full 16MB data packet would take approximately 174,762 seconds, while uploading a differential 2.3MB data packet would take only approximately 25,123 seconds. If the data packet is uploaded at a rate of 200 frames per second on the X-band data transmission channel, uploading a full 16MB data packet would take approximately 874 seconds, while uploading a differential 2.3MB data packet would take only approximately 125 seconds. Each effective satellite-to-ground link establishment time is approximately 10 to 15 minutes. Adding the time for uploading and executing commands such as FLASH unlocking, erasing, and locking, the full uploading method cannot complete the upload in one link establishment arc, meaning that the software upload cannot be completed within a day. This shows that regardless of the link used for uploading files, differential betting significantly reduces betting time.

[0086] After the differential patch file is uploaded to the spacecraft in orbit, the spacecraft decompresses the file into blocks. Based on the block type of each block, reused blocks are directly copied to the corresponding blocks of the local first-version file. Difference blocks are restored using LZ77 reverse parsing. Newly added blocks directly use the decompressed data. All blocks are concatenated sequentially to generate the second-version file. After passing dual verification by block-level CRC check and global hash check, the second-version file is written to the upload area flash and the loading process is restarted. If an anomaly occurs during loading, the first-version software is automatically started from the original area. The retained first-version file is not overwritten during the restoration process, ensuring that upgrade failure does not affect the normal operation of the spacecraft in orbit.

[0087] As can be seen from S1-S5 above, the method provided by this embodiment of the invention divides the first version file and the second version file into blocks by the ground station, classifies them by multi-threaded parallel hash matching, extracts the offset length code pair and literal bytes of the difference blocks based on sliding window matching to generate differential data, compresses the differential data and the newly added block data by block entropy compression using the improved LPAQ8-tiny compression algorithm to obtain the differential patch file and uploads it to the on-orbit spacecraft, decompresses the differential patch file by block and restores it block by block according to the block type difference to generate the second version file, loads it after verification, and automatically starts from the original area if the loading fails. This achieves a significant reduction in the size of the onboard software upgrade data package, block-based fault tolerance of the differential patch file, and security guarantees such as retaining the old file without overwriting and automatic downgrading if the loading fails.

[0088] This invention can also be understood as follows: By using a block-based multi-threaded parallel differential algorithm and an improved LPAQ8-tiny compression algorithm, the size of the on-orbit software upgrade data packet is effectively reduced, thus making fuller use of the space-to-ground link establishment time; a block-based strategy is adopted for the differential upgrade data packet, ensuring that an anomaly in a single file block will not cause the entire upgrade file to fail; by introducing a sparse hash table instead of the traditional full hash table, both embedded memory utilization and upgrade speed are balanced; on the embedded end of the spacecraft, three lightweight designs are adopted to adapt to resource-constrained scenarios: decompression and restoration are executed serially in a single thread, streaming processing is supplemented by memory reuse so that the peak memory usage is only related to the block size, and the improved LPAQ8-tiny decompression algorithm reduces redundant calculations and improves decoding speed.

[0089] The foregoing mainly describes the solutions of the embodiments of the present invention from a methodological perspective. It is understood that, in order to achieve the above-mentioned functions, the upgrade system 100 includes at least one of the hardware structures and software modules corresponding to the execution of each function. Those skilled in the art should readily recognize that, in conjunction with the units and algorithm steps of the various examples described in the embodiments disclosed herein, the embodiments of the present invention can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the embodiments of the present invention.

[0090] In this embodiment of the invention, the upgrade system 100 can be divided into functional units according to the above method example. For example, the upgrade system 100 can be divided into functional units corresponding to each function, or two or more functions can be integrated into one processing unit. The integrated unit can be implemented in hardware or as a software functional unit. It should be noted that the unit division in this embodiment of the invention is illustrative and only represents one logical functional division; other division methods may be used in actual implementation.

[0091] For example, Figure 3 A schematic diagram of the hardware structure of an upgrade system provided by an embodiment of the present invention is shown. The upgrade system 100 includes: a ground differential generation module 110, deployed at a ground station, used to divide the first and second version files of the software to be upgraded into fixed-length blocks according to a preset block size; to calculate the block hash value in parallel using multi-threading and classify them into reuse blocks, difference blocks, or new blocks; to extract offset length code pairs and literal bytes from the difference blocks based on sliding window matching to generate differential encoded data; and to perform block entropy compression on the differential encoded data and new block data using an improved LPAQ8-tiny compression algorithm to generate a differential patch file; wherein the second version file is an upgraded version of the first version file; a ground transmission module 120, deployed at the ground station, used to upload the differential patch file to the on-orbit spacecraft; and a spaceborne restoration module 130, deployed on the on-orbit spacecraft, used to decompress the received differential patch file into blocks; to restore the second version file block by block based on the block type of each block, using the local first version file and the decompressed data; and to load the second version file after verification, or automatically start from the preset original area and run the software version before the upgrade if the loading fails.

[0092] It should be understood that specific descriptions of the above-mentioned optional methods can be found in the foregoing method embodiments, and will not be repeated here. Furthermore, explanations of any of the upgrade systems 100 provided above, as well as descriptions of their beneficial effects, can be found in the corresponding method embodiments described above, and will not be repeated here.

[0093] This invention also provides a computer-readable storage medium storing at least one computer instruction, which is loaded and executed by a processor to implement the methods of the various embodiments described above. Explanations of the relevant content and descriptions of the beneficial effects of any of the computer-readable storage media provided above can be found in the corresponding embodiments described above, and will not be repeated here.

[0094] This invention also provides a chip. This chip integrates a control circuit for implementing the functions of the aforementioned upgrade system 100 and one or more ports. Optionally, the functions supported by this chip are as described above and will not be repeated here.

[0095] Those skilled in the art will understand that the program for implementing all or part of the steps of the above embodiments, which can be executed by a program instructing related hardware, can be stored in a computer-readable storage medium. The storage medium mentioned above can be a read-only memory, a random access memory, etc. The processing unit or processor mentioned above can be a central processing unit, a general-purpose processor, an application-specific integrated circuit (ASIC), a microprocessor (DSP), a field-programmable gate array (FPGA), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof.

[0096] This invention also provides a computer program product containing instructions that, when executed on a computer, cause the computer to perform any of the methods described in the above embodiments. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the flow or function according to the embodiments of this invention is generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, computer instructions can be transmitted from one website, computer, server, or data center to another via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., SSD), etc.

[0097] It should be noted that the devices for storing computer instructions or computer programs provided in the embodiments of the present invention, such as, but not limited to, the aforementioned memory, computer-readable storage medium, and communication chip, are all non-transitory. Those skilled in the art should recognize that the functions described in the embodiments of the present invention in one or more of the above examples can be implemented using hardware, software, firmware, or any combination thereof. When implemented using software, these functions can be stored in a computer-readable storage medium or transmitted as one or more instructions or code on a computer-readable storage medium. Computer-readable storage media include computer storage media and communication media, wherein communication media include any medium that facilitates the transmission of computer programs from one place to another. Storage media can be any available medium accessible to general-purpose or special-purpose computers.

[0098] Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.

Claims

1. A method for block-based parallel differential OTA upgrade of software for on-orbit spacecraft, characterized in that, include: The ground station divides the first and second version files of the software to be upgraded into blocks, calculates hash values ​​in parallel using multi-threading and matches them, and classifies each block of the second version file into reuse blocks, difference blocks, or new blocks; wherein, the second version file is an upgraded version of the first version file; The ground station divides the second version file, which is classified as a difference block, into blocks. By performing sliding window matching in the corresponding blocks of the first version file, it extracts offset length code pairs and literal bytes to generate differential data. The differential data and the newly added block data are compressed to obtain a differential patch file. The ground station uploads the differential patch file to the on-orbit spacecraft; After receiving the differential patch file, the on-orbit spacecraft decompresses the differential patch file and, according to the block type of each block, restores the reused blocks, difference blocks, and new blocks block by block based on the local first version file and the decompressed data to generate the second version file. After the on-orbit spacecraft passes the verification, it loads the second version file. If loading fails, it automatically starts from the preset original area and runs the software version before the upgrade.

2. The method according to claim 1, characterized in that, The ground station divides the first and second version files of the software to be upgraded into blocks, including fixed-length blocks according to a preset block size, satisfying the following relationship: ; in, offset i This is the starting offset of the i-th data block. len i This represents the effective length of the current block. N B represents the total number of blocks in the corresponding file, B represents the preset block size, and S represents the size of the corresponding file in bytes.

3. The method according to claim 1, characterized in that, The ground station divides the second version file, classified as a difference block, into blocks and extracts offset length encoded pairs and literal bytes by performing sliding window matching on the corresponding blocks of the first version file to generate differential data, including: Within the dictionary window S formed by the first version file blocks, perform redundancy matching on the data stream P of the second version file blocks and solve for the global maximum matching length. Lmax : Lmax=max{L|S[pos,pos+L−1]=P[cur,cur+L−1]} ; The matched byte sequence is described in offset length encoded pairs (pos, L), and discrete bytes that cannot be matched are marked as literal bytes.

4. The method according to claim 1, characterized in that, The ground station compresses the differential data and the newly added block data, including: Block entropy compression is performed using an improved LPAQ8-tiny compression algorithm; let the byte sequence to be compressed be X={x1,x2,...,x...} n The byte conditional probability is obtained through a lightweight context model, and the compression mapping is completed using arithmetic coding. ; in, For the context of the i-th byte, Let be the conditional probability of byte xi occurring in the given context.

5. The method according to claim 1, characterized in that, The on-orbit spacecraft, based on the block type of each segment, restores the reused blocks, difference blocks, and new blocks block by block based on the local first version file and the decompressed data, generating the second version file, including: The global index table is parsed from the differential patch file to obtain the metadata of each block; The data structure of the metadata is as follows: BlockInfo[j]={Type j Offset j Len j CRC j } ; Type j For block type, Offset j This represents the offset of the block within the patch. Len j This is the length of the compressed block. CRC j This is the block check value; When the block type is a reused block, the corresponding block is read from the local first version file and used as the corresponding block for the second version file based on the first version file block number recorded in the index table. When the block type is a differential block, the compressed data is decompressed. Based on the LZ77 encoding logic, the decompressed differential data is parsed in reverse. The matching byte sequence of length L is extracted from the corresponding first version file block using the encoding pair (pos, L), and concatenated with the literal byte to restore the corresponding block of the second version file. When the block type is a new block, the decompressed data will be directly used as the corresponding block of the second version file; The restored blocks are then assembled in sequence to generate the second version file.

6. The method according to claim 5, characterized in that, After the on-orbit spacecraft passes verification, it loads the second version file, which includes: After each block is restored, the CRC check value of the block is calculated and compared with the block check value; if the check fails, the decompression and restoration of the block is re-executed, and an exception prompt is triggered when the cumulative failure reaches a preset number. After all blocks are restored and spliced, the global hash value of the second version file is calculated and compared with the global check value in the differential patch file. If they are consistent, the check is deemed to have passed. During the process of restoring and generating the second version file block by block, the local first version file is retained and not overwritten.

7. The method according to claim 1, characterized in that, The hash index table constructed by the ground station adopts a sparse hash table structure; the first version file and the second version file are loaded in the ground station in a streaming read-only manner, without full memory loading; when the on-orbit spacecraft performs decompression and block restoration, it adopts single-threaded serial execution, and the peak memory usage is positively correlated with the preset block size.

8. The method according to claim 1, characterized in that, The preset block size is 64KB.

9. An on-orbit spacecraft software block-based parallel differential OTA upgrade system, characterized in that, include: The ground-based differential generation module, deployed at a ground station, is used to divide the first and second version files of the software to be upgraded into fixed-length blocks according to a preset block size. It then uses multi-threaded parallel computation of block hash values ​​and categorizes them into reused blocks, difference blocks, or new blocks. For the difference blocks, it extracts offset length code pairs and literal bytes based on sliding window matching to generate differential encoded data. Finally, it performs block entropy compression on the differential encoded data and new block data using an improved LPAQ8-tiny compression algorithm to generate a differential patch file. The second version file is an upgraded version of the first version file. A ground transmission module, deployed at the ground station, is used to upload the differential patch file to the on-orbit spacecraft; The onboard restoration module, deployed on the spacecraft in orbit, is used to decompress the received differential patch file in blocks. Based on the block type of each block, it restores the second version file block by block according to the local first version file and the decompressed data. After verification, the second version file is loaded. If loading fails, it automatically starts from the preset original area and runs the software version before the upgrade.

10. An electronic device, characterized in that, It includes a processor and a memory; the memory is used to store a computer program; the processor is used to implement the method as described in any one of claims 1 to 8 by invoking the computer program.