An incremental upgrade method for embedded DSP programs

By dividing the program into Image Header and Image Data data blocks in the embedded DSP system, and generating incremental upgrade packages, the problem of difficulty in achieving efficient incremental upgrades in the embedded DSP system is solved, and efficient and reliable remote upgrades are achieved. .

CN118885202BActive Publication Date: 2025-01-21HUNAN GREAT WALL GALAXY TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411354473.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-27
Publication Date
2025-01-21
Estimated Expiration
2044-09-27

AI Technical Summary

Technical Problem

The prior art is difficult to achieve efficient incremental upgrades in embedded DSP systems, especially when remote upgrades, and traditional complete upgrade methods are inefficient.

Method used

By dividing the embedded DSP program into an Image Header and several Image Data data blocks, and using the host computer to compare the differences between the historical version and the version to be upgraded, an incremental upgrade package is generated, and only the different data blocks and Image Header.

Benefits of technology

It achieves efficient incremental upgrade in the embedded DSP system, reduces the amount of data that needs to be transmitted during the upgrade process, and improves the upgrade efficiency and reliability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118885202B_ABST
    Figure CN118885202B_ABST
Patent Text Reader

Abstract

An incremental upgrade method for an embedded DSP program includes: S1, a user program receives an upgrade signal and enters an upgrade process; S2, a user Image upgrade package is divided; S3, the differences between the historical version of the user Image upgrade package and the newly obtained user Image upgrade package are compared to construct an incremental upgrade package; if the host computer does not receive the version number of the corresponding upgrade package or needs to be fully upgraded, then enter S4; otherwise enter S5; S4, use the entire upgrade package to upgrade the user program, and then enter S6; S5, use the incremental upgrade package to incrementally upgrade the user program, and then enter S6; S6, after restarting, the user program is started by SBL and enters the user program. The present invention realizes the incremental update function on the basis of SBL, and also has a user program backup function to prevent the user program from being unable to run successfully again when the program upgrade fails, and has high reliability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of program updating and upgrading, and in particular to an incremental upgrading method of an embedded DSP program. Background Art

[0002] Electronic products are updated quickly. Often, even after a product has been launched on the market, there are still vulnerabilities in the software that need to be upgraded. The product software firmware needs to be upgraded, or a functional upgrade is required. The program upgrade is updated in the form of data. Traditional program upgrades are complete upgrades of all data, while incremental upgrades only update updated data blocks, reducing the amount of data that needs to be updated during the upgrade process.

[0003] For embedded boards such as DSP, in non-open systems such as vehicles, trains, aerospace, and ships, which do not have a unified operating system, the program firmware is often fully upgraded. For some small embedded devices, the memory is only tens of KB, and the incremental upgrade has no obvious effect. However, some embedded control chips used in some embedded systems have 8 cores, 16 cores, or even more, and the program data after program compilation is in MB. If such devices need to be upgraded remotely, the difference between a full upgrade of several MB and an incremental upgrade of only a few KB is very obvious.

[0004] The Chinese patent application with the publication number CN116166304A is a method for efficiently incrementally upgrading MCU firmware based on distributed loading. The patent application uses distributed loading files to partition the program, and uses the MCU's FLASH minimum erase unit as the partition basis, as the minimum update unit, to automatically compile the program into the corresponding storage area. The distributed file described in the patent application is an ARM-specific compiler tool, which is only valid for ARM controllers. Therefore, an incremental upgrade method for embedded DSP programs is urgently needed. Summary of the invention

[0005] The present invention provides an incremental upgrade method for an embedded DSP program to solve the technical problem mentioned in the background technology.

[0006] To achieve the above object, the technical solution of the present invention is achieved as follows:

[0007] The present invention provides an incremental upgrade method for an embedded DSP program, comprising the following steps:

[0008] S1, the user program receives the upgrade signal, enters the upgrade process, and upgrades the user program;

[0009] S2. Use the host computer to convert the executable file generated by the compiler into a complete upgrade package in the user Image format, obtain the user Image upgrade package to be upgraded, and start the user program by SBL. The user Image upgrade package to be upgraded is divided into Image Header and several Image Data blocks;

[0010] S3, the upper computer compares the historical version of the user Image upgrade package with the user Image upgrade package to be upgraded, compares the differences between the historical version of the user Image upgrade package and each Image Data block in the user Image upgrade package to be upgraded, and combines the Image Data blocks with differences and the ImageHeader in the user Image upgrade package to be upgraded into an incremental upgrade package; if the upper computer has not received the version number of the corresponding upgrade package or needs to be fully upgraded, the version number of the corresponding upgrade package is the version number of the user Image upgrade package to be upgraded before the division, then enter S4; otherwise enter S5;

[0011] S4, the host computer sends the entire upgrade package to upgrade the user program, and enters S6 after the upgrade;

[0012] S5, the host computer sends an incremental upgrade package to perform incremental upgrade on the user program, and enters S6 after the upgrade;

[0013] S6. After the upgrade, the user program is restarted. After the restart, the SBL guides the user program to start and finally enter the user program.

[0014] Furthermore, the Image Header in S2 mainly includes the CheckSum verification code of the user's Image upgrade package, the number of Image Data data blocks, and the entry address of the user program.

[0015] Furthermore, the Image Data data blocks in S2 include:

[0016] MAGIC_WORD starts with a magic word, which is used to check the legitimacy of the data;

[0017] Checksum, Checksum is the checksum of the Image Data block;

[0018] Sectors_used: Sectors_used is the number of memory sectors occupied by the data block;

[0019] Sectors_free, Sectors_free is the number of memory sectors that are not used by the data block;

[0020] Sector_index, Sector_index is the sector number where the data block needs to be stored in the memory;

[0021] Data_length, Data_length is the length of the data that needs to be moved to the running memory of the DSP controller, in bytes;

[0022] Data_destination, Data_destination is the destination address where the data needs to be moved to the running memory in the DSP controller;

[0023] User_Entry, User_Entry is the entry point of the user program;

[0024] Image_Data_Count, Image_Data_Count is the number of Image Data blocks;

[0025] Data: Data is the data to be moved.

[0026] Furthermore, the comparison of the difference between each Image Data block in the user Image upgrade package of the historical version and the user Image upgrade package to be upgraded in S3 is achieved by comparing the destination addresses and check codes of the Image Data blocks between the two versions.

[0027] Furthermore, the situations in which a complete upgrade is required in S3 include: the data volume of the Image Data block to be upgraded is larger than the originally reserved sector size or the user wants to perform a complete upgrade.

[0028] Furthermore, the S5 specifically includes the following steps:

[0029] S51, sending the user program version number to the upper computer;

[0030] S52, receiving and parsing the Image Header of the user Image upgrade package to be upgraded, thereby determining the Image Data block to be upgraded in the historical version;

[0031] S53, erasing the memory sectors occupied by the Image Data blocks to be upgraded, and writing the corresponding upgraded Image Data blocks;

[0032] S54, determine whether the data analysis is wrong, if so, jump to the SBL program, and use the SBL program to restart the user program; if not, enter S53, continue to write the remaining Image Data blocks to be upgraded until the reception is completed. At this time, the user program upgrade is completed, and after the upgrade, enter S6.

[0033] Furthermore, the S6 specifically includes the following steps:

[0034] S61, after the upgrade, the user program is restarted, and after the restart, the user program is started by the SBL;

[0035] S62, after SBL reads the user Image upgrade package from the storage and loads it into the memory, it checks whether the verification code of the Image Header is consistent with the verification code calculated during the data loading process. If they are consistent, it goes to S63, otherwise it goes to S64;

[0036] S63, SBL copies a copy of the user Image upgrade package to be upgraded in the memory to the backup area, and then enters the user program.

[0037] S64, SBL boots the user Image upgrade package in the backup area to start and enter the user program.

[0038] Furthermore, the S64 specifically includes the following steps:

[0039] After the SBL reads the user Image upgrade package from the storage and loads it into the memory, it checks whether the verification code of the Image Header of the user Image upgrade package in the backup area is consistent with the verification code calculated during the data loading process. If they are consistent, the user program is entered; if they are inconsistent, an error is started.

[0040] Furthermore, the incremental upgrade method further comprises the following steps:

[0041] When upgrading the user program using the entire upgrade package or incrementally upgrading the user program using the incremental upgrade package, if a situation occurs that causes the upgrade process to fail, the SBL can be run again to start the old version of the program that has not been updated from the backup program to avoid the situation where the user program cannot be started normally because the historical version of the user Image upgrade package is destroyed during the upgrade process.

[0042] Furthermore, during the process of the SBL booting the user program to start up, when loading the data of the newly obtained user Image upgrade package or the user Image upgrade package in the backup area, it is necessary to parse it in a prescribed format to obtain the entry address of the user program, and move the data to the memory area of ​​the random access memory on the controller chip, and then jump to the user program execution, and end the SBL booting phase.

[0043] Beneficial effects of the present invention:

[0044] 1. The present invention provides an incremental upgrade method for an embedded DSP program. The present invention realizes the incremental update function based on SBL, and can also provide a backup function for the user program to prevent the user program from being unable to run successfully again when the program upgrade fails, and has high reliability.

[0045] 2. The upgraded user Image upgrade package involved in the present invention can be used as a complete upgrade package, or the unupdated Image Data blocks can be easily cut out as an incremental upgrade package by comparing the verification code of the user Image upgrade package with the historical version.

[0046] 3. The present invention does not need to provide complex communication protocols to the host computer developer. The host computer or external host only needs to query the version number of the program to send the corresponding incremental upgrade package or the complete user Image upgrade package. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] Figure 1 is a flow chart of S5 in the present invention;

[0048] Figure 2 This is a flow chart of S6 in the present invention;

[0049] Figure 3 It is a schematic diagram of the allocation of sectors of the Flash memory and the user Image upgrade package in the implementation of the present invention;

[0050] Figure 4 It is a schematic diagram of the difference between the new version Image upgrade package and the Image upgrade package to be upgraded in the implementation of the present invention. DETAILED DESCRIPTION

[0051] In order to facilitate the understanding of the present invention, the present invention will be described more fully below with reference to the relevant drawings. Preferred embodiments of the present invention are provided in the drawings. However, the present invention can be implemented in many other different forms and is not limited to the embodiments described herein. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present invention more thorough and comprehensive.

[0052] All technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used herein in the specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The term "and / or" used herein includes any and all combinations of one or more related listed items.

[0053] Embedded DSP controllers all provide basic boot functions, generally called RBL (ROM BootLoader, primary boot system), which boots the SBL (Second BootLoader, secondary boot system) program. SBL is used to boot the user program. Therefore, such a system needs to be divided into SBL and user program in non-volatile memory (such as NorFlash, SPI Flash, EEPROM, eMMC, SD). Systems with high reliability requirements also need to back up user programs to prevent damage to user programs during program updates, which may cause the system to malfunction. Therefore, the memory needs to be divided into three parts in the memory: SBL, user program, and backup program (i.e., program in the backup area). SBL is used to boot the user program, and the data format stored in the user program needs to determine the SBL parsing format.

[0054] In order to quickly upgrade the program in the embedded DSP controller, the present invention provides an incremental upgrade method of the embedded DSP program, which is as follows:

[0055] Reference Figure 1 The embodiment of the present application provides an incremental upgrade method of an embedded DSP program, comprising the following steps:

[0056] S1, the user program receives the upgrade signal, enters the upgrade process, and upgrades the user program;

[0057] Specifically, before receiving the upgrade signal, the upgrade function of the user program can be triggered by the host computer or the external host. At the same time, when the upgrade package to be upgraded is transmitted to the host computer, the transmission medium can be a physical interface such as a serial port or a network port;

[0058] S2. Use the host computer to convert the executable file generated by the compiler into a complete upgrade package in the user Image format, and obtain the user Image upgrade package to be upgraded. The SBL guides the user program to start. The user Image upgrade package to be upgraded is divided into an Image Header and several Image Data blocks; each Image Data block is used as the smallest incremental upgrade unit;

[0059] Specifically, users need to manually divide the program so that after the user program is modified, the compiled code or data is stored in different segments; many user programs will use some basic libraries, which do not involve application logic, such as the basic runtime library of C language, mathematical library, encryption and decryption library, audio and video library, etc. The .text segment (code segment) can be divided into sub-segments such as .text:crc32. As long as this type of code is assigned to a fixed position during compilation, the subsequent program data will not change. The compiler will provide a method to manually specify the compilation location. Taking the C6000 series DSP of TI (Texas Instruments) as an example, the link script ending with the *.CMD file name can be used to specify the code compiled from the specified code segment or the specified .c source code file to the memory area expected to be compiled. In this way, the code segment can be divided into several segments. Generally, only the logic of the application layer and some basic libraries need to be divided.

[0060] The process of generating Image Data blocks:

[0061] At present, most compilers compile and generate executable files (i.e., target codes) that support the ELF (Executable Linkable Format) format. When compiling the user program, select the ELF format as the output format, generate the Image Data data segment, parse it in the ELF format, obtain the entry address of the target code, the size of each segment, the destination address, and the data, and then you can get the various parameters of the Image Data data block. Sectors_used also needs to know the storage sector size of the user Image upgrade package. Taking SPI Flash as an example, the minimum erase sector of SPI Flash with a storage capacity of 16MB is 4KB, and the normal sector size is 64KB. If the storage capacity is not very tight, select 64KB as the sector size. By traversing all the segments of the target code, you can get all the Image Data data blocks.

[0062] At the same time, for the Image Header, after obtaining all the Image Data blocks, the Checksum of the entire user Image upgrade package is calculated by calculating the Checksum of all the ImageData blocks. The user entry address can be directly obtained from the executable file (i.e., the target code);

[0063] S3, the upper computer compares the historical version of the user Image upgrade package with the user Image upgrade package to be upgraded, compares the differences between the historical version of the user Image upgrade package and each Image Data block in the user Image upgrade package to be upgraded, and combines the Image Data blocks with differences and the ImageHeader in the user Image upgrade package to be upgraded into an incremental upgrade package; if the upper computer has not received the version number of the corresponding upgrade package or needs to be fully upgraded, the version number of the corresponding upgrade package is the version number of the user Image upgrade package to be upgraded before the division, then enter S4; otherwise enter S5;

[0064] by Figure 4 For example, the differences between each Image Data block in the historical version of the user Image upgrade package and the user Image upgrade package to be upgraded are compared and described as follows:

[0065] As shown in Figure 4, the data blocks with asterisks are different Image Data blocks. When version V1.0 is upgraded to version V1.1, only the Image Data 2 data block is changed. Only the data of this data block and the Image Header need to be upgraded. When version V1.0 is upgraded to version V1.2, only the data blocks of Image Data 2 and Image Data N are changed. Only the data of these two data blocks and the Image Header need to be upgraded.

[0066] S4, the host computer sends the entire upgrade package to upgrade the user program, and enters S6 after the upgrade;

[0067] S5, the host computer sends an incremental upgrade package to perform incremental upgrade on the user program, and enters S6 after the upgrade;

[0068] S6. After the upgrade, the user program is restarted. After the restart, the SBL guides the user program to start and finally enter the user program.

[0069] The invention provides an incremental upgrade method for an embedded DSP program. The invention realizes the incremental update function based on SBL and can also provide a backup function for the user program to prevent the user program from being unable to run successfully again when the user program upgrade fails, and has high reliability.

[0070] In some embodiments, the Image Header in S2 mainly includes the CheckSum checksum of the user Image, the number of Image Data blocks, the entry address of the user program, etc.;

[0071] In some embodiments, the minimum storage unit in the Image Header data block in S2 is 4 bytes (ie, 32 bits) of data, including:

[0072] User_Entry, User_Entry is the entry point of the user program;

[0073] Image_Data_Count, Image_Data_Count is the number of Image Data blocks;

[0074] MAGIC_WORD starts with a magic word, which is used to check the legitimacy of the data;

[0075] Checksum, Checksum is the checksum of the Image Data block; the checksum is calculated from Data_length to the last Data [Data_length / 4];

[0076] Sectors_used, Sectors_used is the number of memory sectors occupied by the data block; the sector block size is related to the memory sector size and Data_length data length;

[0077] Sectors_free, Sectors_free is the number of memory sectors that are not used by the data block; when burning for the first time or upgrading completely, one sector is reserved as unused memory space. If the sector memory of some memory is relatively small, multiple sectors are reserved;

[0078] Figure 3 This is a schematic diagram of the storage of the user Image upgrade package in the Flash memory. As shown in the figure, the sectors before sector m are used to store the SBL program. Sector m is used to store the Image Header, occupying 1 sector. The sector starting from sector m+1 stores the first Image Data block and reserves a sector, actually occupying 2 sectors. The two sectors starting from sector m+n+1 store the last Image Data block and reserve a sector, actually occupying 3 sectors.

[0079] Sector_index, Sector_index is the sector number of the memory where the data block needs to be stored; when updating the user program, this number can be used to know which sector of the memory to start updating;

[0080] Data_length, Data_length is the length of the data that needs to be moved to the running memory of the DSP controller, in bytes;

[0081] Data_destination, Data_destination is the destination address where the data needs to be moved to the running memory in the DSP controller;

[0082] Data, Data is the data to be moved; that is, the binary data compiled by the compiler, the code segment data of the program, the data segment data, etc. The length of the data is Data_length bytes, Data_length / 4 words.

[0083] In some embodiments, the comparison of the difference between each Image Data block in the user Image upgrade package of the historical version and the user Image upgrade package to be upgraded in S3 is achieved by comparing the destination addresses and check codes of the Image Data blocks between the two versions.

[0084] In some embodiments, the situations in which a complete upgrade is required in S3 include:

[0085] The program architecture changes significantly, resulting in significant changes in the data blocks, so that the data size of the Image Data block to be upgraded is larger than the originally reserved sector size or the user wants to perform a complete upgrade.

[0086] For example: the amount of data required for the data block of Image Data 2 has increased significantly, exceeding the originally reserved sector size. Image Data 2 of version V1.0 or V1.1 only needs to occupy 2 sectors of storage space, while Image Data2 of version V1.2 needs to occupy 3 sectors of storage space. In this case, the incremental upgrade package needs to use all subsequent Image Data blocks as upgrade packages to ensure the correctness of the program update.

[0087] In some embodiments, in step S4 or S5, that is, when the user program is updated, if the user program is already the latest version and no longer needs to be updated, the host computer or external host can directly send an illegal magic word data to exit the upgrade process.

[0088] In some embodiments, S5 specifically includes the following steps:

[0089] S51, sending the user program version number to the upper computer;

[0090] S52, receiving and parsing the Image Header of the user Image upgrade package to be upgraded, thereby determining the Image Data block to be upgraded in the historical version;

[0091] S53, erasing the memory sectors occupied by the Image Data blocks to be upgraded, and writing the corresponding upgraded Image Data blocks;

[0092] S54, determine whether the data analysis is wrong, if so, jump to the SBL program, and use the SBL program to restart the user program; if not, enter S53, continue to write the remaining Image Data blocks to be upgraded until the reception is completed. At this time, the user program upgrade is completed, and after the upgrade, enter S6.

[0093] In some embodiments, the S6 specifically includes the following steps:

[0094] S61, after the upgrade, the user program is restarted, and after the restart, the user program is started by the SBL;

[0095] S62, after SBL reads the user Image upgrade package from the storage and loads it into the memory, it checks whether the verification code of the Image Header is consistent with the verification code calculated during the data loading process. If they are consistent, it goes to S63, otherwise it goes to S64;

[0096] S63, SBL copies a copy of the user Image upgrade package to be upgraded in the memory to the backup area, and then enters the user program.

[0097] S64, SBL boots the user Image upgrade package in the backup area to start and enter the user program.

[0098] In some embodiments, the S64 specifically includes the following steps:

[0099] After the SBL reads the user Image upgrade package from the storage and loads it into the memory, it checks whether the verification code of the Image Header of the user Image upgrade package in the backup area is consistent with the verification code calculated during the data loading process. If they are consistent, the user program is entered; if they are inconsistent, an error is started.

[0100] In some embodiments, the incremental upgrade method further includes the following steps:

[0101] When upgrading the user program using the entire upgrade package or incrementally upgrading the user program using the incremental upgrade package, if a situation occurs that causes the upgrade process to fail, the SBL can be run again to start the old version of the program that has not been updated from the backup program to avoid the situation where the user program cannot be started normally because the historical version of the user Image upgrade package is destroyed during the upgrade process.

[0102] In some embodiments, during the process of the SBL booting the user program to start up, when loading the data of the newly obtained user Image upgrade package or the user Image upgrade package in the backup area, it is necessary to parse it in a prescribed format to obtain the entry address of the user program, and move the data to the memory area of ​​the random access memory (RAM) on the controller chip, and then jump to the user program execution, and end the SBL boot phase.

[0103] In some embodiments, if the user program is already the latest version during the process of upgrading the user program using the entire upgrade package or incrementally upgrading the user program using the incremental upgrade package, sending an illegal magic word to the user program through the host computer will exit the upgrade.

[0104] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be covered within the protection scope of the present invention. In addition, the technical solutions between the various embodiments of the present invention can be combined with each other, but it must be based on the ability of ordinary technicians in the field to implement. When the combination of technical solutions is contradictory or cannot be implemented, it should be considered that such a combination of technical solutions does not exist and is not within the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.

Claims

1. A method for incrementally upgrading an embedded DSP program, characterized in that: The steps include: S1, the user program receives the upgrade signal, enters the upgrade process, and upgrades the user program; S2. Use the host computer to convert the executable file generated by the compiler into a complete upgrade package in the user Image format, obtain the user Image upgrade package to be upgraded, and start the user program guided by SBL to divide the user Image upgrade package to be upgraded into Image Header and several Image Data blocks; The Image Data data blocks in S2 include: MAGIC_WORD starts with a magic word, which is used to check the legitimacy of the data; Checksum, Checksum is the checksum of the Image Data block; Sectors_used: Sectors_used is the number of memory sectors occupied by the data block; Sectors_free, Sectors_free is the number of memory sectors that are not used by the data block; Sector_index, Sector_index is the sector number where the data block needs to be stored in the memory; Data_length, Data_length is the length of the data that needs to be moved to the running memory in the DSP controller; Data_destination, Data_destination is the destination address where the data needs to be moved to the running memory in the DSP controller; User_Entry, User_Entry is the entry point of the user program; Image_Data_Count, Image_Data_Count is the number of Image Data blocks; Data, Data is the data to be moved; S3, compare the differences between the historical version of the user Image upgrade package and each Image Data block in the user Image upgrade package to be upgraded, and combine the Image Data blocks with differences and the Image Header in the user Image upgrade package to be upgraded to form an incremental upgrade package; if the host computer has not received the version number of the corresponding upgrade package or needs to be fully upgraded, the version number of the corresponding upgrade package is the version number of the user Image upgrade package to be upgraded before the division, then enter S4; otherwise enter S5; S4, the host computer sends the entire upgrade package to upgrade the user program, and enters S6 after the upgrade; S5, the host computer sends an incremental upgrade package to perform incremental upgrade on the user program, and enters S6 after the upgrade; S6. After the upgrade, the user program is restarted. After the restart, the SBL guides the user program to start and finally enter the user program.

2. The incremental upgrade method according to claim 1, characterized in that: The Image Header in S2 mainly includes the CheckSum verification code of the user's Image upgrade package, the number of Image Data data blocks, and the entry address of the user program.

3. The incremental upgrade method according to claim 1, characterized in that: The comparison of the differences between each Image Data block in the user Image upgrade package of the historical version and the user Image upgrade package to be upgraded in S3 is achieved by comparing the destination addresses and check codes of the Image Data blocks between the two versions.

4. The incremental upgrade method according to claim 1, characterized in that: The situations in which a complete upgrade is required in S3 include: the data volume of the Image Data block to be upgraded is larger than the originally reserved sector size or the user wants to perform a complete upgrade.

5. The incremental upgrade method according to claim 1, characterized in that: The S5 specifically includes the following steps: S51, sending the user program version number to the upper computer; S52, receiving and parsing the Image Header of the user Image upgrade package to be upgraded, thereby determining the Image Data block to be upgraded in the historical version; S53, erasing the memory sectors occupied by the Image Data blocks to be upgraded, and writing the corresponding upgraded Image Data blocks; S54, determine whether the data analysis is wrong, if so, jump to the SBL program, and use the SBL program to restart the user program; if not, enter S53, continue to write the remaining Image Data blocks to be upgraded until the reception is completed. At this time, the user program upgrade is completed, and after the upgrade, enter S6.

6. The incremental upgrade method according to claim 1, characterized in that: The S6 specifically includes the following steps: S61, after the upgrade, the user program is restarted, and after the restart, the user program is started by the SBL; S62, after SBL reads the user Image upgrade package from the storage and loads it into the memory, it checks whether the verification code of the Image Header is consistent with the verification code calculated during the data loading process. If they are consistent, it goes to S63, otherwise it goes to S64; S63, SBL copies a copy of the user Image upgrade package to be upgraded in the memory to the backup area, and then enters the user program; S64, SBL boots the user Image upgrade package in the backup area to start and enter the user program.

7. The incremental upgrade method according to claim 6, characterized in that: The S64 specifically includes the following steps: After the SBL reads the user Image upgrade package from the storage and loads it into the memory, it checks whether the verification code of the Image Header of the user Image upgrade package in the backup area is consistent with the verification code calculated during the data loading process. If they are consistent, the user program is entered; if they are inconsistent, an error is started.

8. The incremental upgrade method according to claim 1, characterized in that: The following steps are also included: When upgrading the user program using the entire upgrade package or incrementally upgrading the user program using the incremental upgrade package, if a situation occurs that causes the upgrade process to fail, the SBL can be run again to start the old version of the program that has not been updated from the backup program to avoid the situation where the user program cannot be started normally because the historical version of the user Image upgrade package is destroyed during the upgrade process.

9. The incremental upgrade method according to any one of claims 1 to 8, characterized in that: During the process of SBL booting the user program to start, when loading the data of the newly obtained user Image upgrade package or the user Image upgrade package in the backup area, it is necessary to parse it in a specified format to obtain the entry address of the user program, and move the data to the memory area of ​​the random access memory on the controller chip, and then jump to the user program execution, and end the SBL boot phase.

Citation Information

Patent Citations

  • Scattered loading-based MCU firmware efficient increment upgrading method

    CN116166304A

  • On-orbit updating method of satellite-borne DSP (digital signal processor) software

    CN108089876A

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

    CN117648109A