Efficient remote equipment upgrading system and method thereof
The remote device upgrade system addresses inefficiencies in IoT device management by generating differential packages and automating the upgrade process, reducing traffic and time through Lz77 compression, thus improving upgrade efficiency.
Patent Information
- Application Number
- CN202411123311.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-15
- Publication Date
- 2024-12-13
AI Technical Summary
Existing IoT device management core programs face inefficiencies in remote upgrades due to large traffic requirements and long transmission times, which hinder convenience and maintenance.
An efficient remote device upgrade system utilizing a host computer to generate a differential upgrade package using the Lz77 compression algorithm, a slave computer to parse and apply the package, and an interface module for user interaction, optimizing upgrade efficiency by reducing data packet size and automating the process.
The system significantly reduces upgrade time and traffic by compressing upgrade data, enhancing efficiency and convenience in IoT device management core program updates.
Smart Images

Figure CN119127270A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of communication technologies, and in particular to an efficient remote device upgrade system and method thereof. Background Art
[0002] With the development of the times and the gradual advancement of technology, in the process of network information processing, software is usually used to control or operate hardware. However, in actual applications, due to factors such as cost and volume, it is often necessary to use the same software in different locations, which requires the software to be downloaded to computers in different locations for operation. However, when a program has loopholes or errors during use, in order to prevent the spread of the error, it is necessary to promptly update and upgrade all locations where the program is installed (referred to as "terminal devices"). At the same time, in order to ensure the normal operation of each terminal device and avoid losses caused by virus invasion of a large number of terminal devices, the updated code is generally published on the official websites of major host manufacturers for users to download and manually deploy to the corresponding terminal devices.
[0003] However, when most of the existing IoT meter management core programs are remotely upgraded, the traffic required for transmission is too large and the process takes too long, which is not only inconvenient to improve the efficiency and convenience of program upgrades, but also not conducive to subsequent program maintenance and improvement.
[0004] In order to solve the above technical problems, we propose an efficient remote device upgrade system and method, which can effectively reduce the drawbacks and other problems existing in the current upgrade method. Summary of the invention
[0005] 1. Technical issues to be resolved In view of the deficiencies in the prior art, the present invention provides an efficient remote device upgrade system and method thereof, which solves the problem in the prior art that the remote upgrade of the existing IoT table management core program transmits multiple traffic processes and takes too long.
[0006] (II) Technical solution To achieve the above objectives, the present invention is implemented through the following technical solutions: an efficient remote device upgrade system, including a host computer, a slave computer, an interface module and an operation module; The host computer is an upgrade package generation tool, which is used to analyze the original program and the target program, and generate a program upgrade package that can be used by the lower computer. The algorithm uses the feature that most of the contents of the upgrade program and the original program are the same, extracts the difference between the upgrade program and the original program, finds and marks the deleted content, performs difference calculation on the difference content, and marks the address of the new content. The data obtained after this processing contains a large number of "0", so the compression algorithm suitable for embedded systems, Lz77, is selected for compression to obtain a differential upgrade package that is much smaller than the original file size; The lower computer is an upgrade algorithm, which is used to parse the program upgrade package generated by the upper computer, generate the target program according to the upgrade package and itself, apply the upgrade, and ensure that the program survives the upgrade. After receiving the upgrade package file and the upgrade command, the upgrade package parsing algorithm library will be used to generate the target upgrade file. After verification, the program files in the / rollback directory will be moved to the custom backup path for backup, and the program files in the / backup directory will be moved to the / rollback directory as a recovery file when the signature verification fails after the upgrade. After that, the generated target upgrade file will be moved to the / backup directory, and finally the program files in the / bin directory will be deleted and the system will be restarted; The interface module includes a user interface, an internal interface and an external interface; The operation module is used to generate a program upgrade package file in an upgrade package generation tool using the original binary file to be upgraded and the upgrade target file through the upper computer, and then import the upgrade package into the upgrade interface. After confirming the upgrade time, the "Start Upgrade> Record Upgrade> Execute Upgrade" is executed in sequence. After receiving the upgrade command, the lower computer will automatically complete the upgrade operation. After testing and analysis, most of the time-consuming existing upgrade methods are distributed in the upgrade data upload process. Therefore, through the lower computer upgrade algorithm and the upper computer software for generating the upgrade package, the upgrade efficiency of the Internet of Things table management core program is optimized, and the file size of the upgrade data packet is compressed to shorten the upgrade upload time, thereby improving the upgrade efficiency and reducing the traffic required for transmission.
[0007] Preferably, the host computer hardware requirements are: Main frequency: 2.4GHz and above; Memory: 4G and above; The host computer system requirements are: Window10.
[0008] Preferably, the lower computer is in C language.
[0009] Preferably, for the combination of the running modules, if the developer needs to use the algorithm, he can directly add the static library provided by the docking and transplant the provided upgrade code. After the transplantation is successful, the upgrade operation can be performed through the host computer using the "user interface".
[0010] Preferably, the running time of the running module is that the upper computer generally takes less than half a second to generate the upgrade package file, and the specific time depends on the size of the input file. The time for issuing the upgrade command depends on the size of the upgrade package file, which is 1-2 minutes. The time for the lower computer to execute the upgrade is generally 1-2 minutes, which depends on the size of the upgrade package file and the target file.
[0011] Preferably, the user interface is an interactive mode between the user and the host computer. To upload the upgrade file and execute the upgrade, in "Special Function Test>Remote Upgrade>Differential Mode Upgrade", select the upgrade package file generated above, and execute "Start Upgrade>Mark Upgrade>Execute Upgrade" in sequence to complete the upgrade operation.
[0012] Preferably, the internal interface is a communication method between different components or modules within the system.
[0013] Preferably, the external interface is an interaction mode between the system and other external systems or users.
[0014] An efficient method for remote device upgrade system comprises the following steps: S1. Meter preparation: First, make sure that the program on the meter is a differentially upgradeable version (attached). It is recommended to burn or download the full version first; S2. Generate a differential package and open the differential file generation tool; "Padding character" only works on .hex files. The IoT table program is a .bin file and is useless here. "Old file" is the program file that has been downloaded to the table, and "new file" is the target program file that needs to be upgraded; After filling in the above two files, click the "Generate Patch File" button; Then select a location to save the "patch file". Here, the "patch file" is the differential upgrade file; S3. Execute the upgrade and copy the Lib_MultipleTest698.dll in the attachment to the MeterApp-698 installation directory; Open MeterApp-698, select "Special Function Test > Remote Upgrade > Differential Mode Upgrade", select the differential upgrade file generated above, and execute "Start Upgrade > Mark Upgrade > Execute Upgrade" in sequence to complete the upgrade operation; The upgrade execution time format is YYYYMMDDHHmmss, all FF means immediate upgrade, the original Lib_MultipleTest698.dll in S3 needs to be backed up, and after the differential upgrade command is normally executed in S3, it takes about 1 minute to execute the upgrade operation, and there is no response during this period.
[0015] Beneficial Effects The present invention provides an efficient remote device upgrade system and method thereof, which has the following beneficial effects: After testing and analysis, it was found that most of the time spent on the existing upgrade methods is spent on the upgrade data upload process. Therefore, the upgrade efficiency of the IoT table management core program is optimized through the lower computer upgrade algorithm and the upper computer software used to generate the upgrade package. The file size of the upgrade data packet is compressed to shorten the upgrade upload time, thereby improving the upgrade efficiency and reducing the traffic required for transmission. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 A flowchart of the algorithm steps of the lower computer of an efficient remote device upgrade system proposed by the present invention; Figure 2 The present invention provides a flowchart of the steps of a method for an efficient remote device upgrade system. DETAILED DESCRIPTION
[0017] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0018] like Figure 1-2 As shown, an embodiment of the present invention provides an efficient remote device upgrade system, including a host computer, a slave computer, an interface module and an operation module; The host computer is an upgrade package generation tool, which is used to analyze the original program and the target program, and generate a program upgrade package that can be used by the lower computer. The algorithm uses the feature that most of the contents of the upgrade program and the original program are the same, extracts the difference between the upgrade program and the original program, finds and marks the deleted content, performs difference calculation on the difference content, and marks the address of the new content. The data obtained after this processing contains a large number of "0", so the compression algorithm suitable for embedded systems, Lz77, is selected for compression to obtain a differential upgrade package that is much smaller than the original file size; Considering that hex files are more commonly used in embedded target programs, the program should support the parsing of hex files. Two hex files can be used to generate upgrade package files. Because different flash may be 00 or FF after erasing, when using hex files to generate upgrade packages, it should support the selection of empty address segment filling value 00 or FF; The lower computer is an upgrade algorithm, which is used to parse the program upgrade package generated by the upper computer, generate the target program according to the upgrade package and itself, and apply the upgrade, and ensure that the program survives the upgrade; The interface module includes a user interface, an internal interface and an external interface; The operation module is used to generate a program upgrade package file in the upgrade package generation tool using the original binary file to be upgraded and the upgrade target file through the upper computer, and then import the upgrade package into the upgrade interface. After confirming the upgrade time, execute "Start Upgrade>Mark Upgrade>Execute Upgrade" in sequence. After receiving the upgrade command, the lower computer will automatically complete the upgrade operation. Considering the data loss problem caused by the instability of wireless communication, relevant processing is specially done for this part: first, after each data is received, it is determined whether the received data is complete; second, if a transmission error is found, a new transmission is re-initiated until all data is received. In actual usage scenarios, due to the wireless link, data loss may occur. At this time, the client resends the data, and the server discards the excess part when receiving duplicate data.
[0019] The host computer hardware requirements are: Main frequency: 2.4GHz and above; Memory: 4G and above; The host computer system requirements are: Window10.
[0020] The lower computer uses C language.
[0021] The combination of the running modules, if the developer needs to use the algorithm, can directly add the static library provided by the docking, and transplant the provided upgrade code. After the transplantation is successful, the upgrade operation can be performed through the host computer using the "user interface".
[0022] The running time of the running module is that the upper computer generally takes less than half a second to generate the upgrade package file, and the specific time depends on the size of the input file. The time for issuing the upgrade command depends on the size of the upgrade package file, which is 1-2 minutes. The time for the lower computer to execute the upgrade is generally 1-2 minutes, which depends on the size of the upgrade package file and the target file.
[0023] The user interface is the interaction mode between the user and the host computer.
[0024] The internal interface is a communication method between different components or modules within the system.
[0025] The external interface is the interaction mode between the system and other external systems or users.
[0026] An efficient method for remote device upgrade system comprises the following steps: S1. Meter preparation: First, make sure that the program on the meter is a differentially upgradeable version (attached). It is recommended to burn or download the full version first; S2. Generate a differential package and open the differential file generation tool; "Padding character" only works on .hex files. The IoT table program is a .bin file and is useless here. "Old file" is the program file that has been downloaded to the table, and "new file" is the target program file that needs to be upgraded; After filling in the above two files, click the "Generate Patch File" button; Then select a location to save the "patch file". Here, the "patch file" is the differential upgrade file; S3. Execute the upgrade and copy the Lib_MultipleTest698.dll in the attachment to the MeterApp-698 installation directory; Open MeterApp-698, select "Special Function Test > Remote Upgrade > Differential Mode Upgrade", select the differential upgrade file generated above, and execute "Start Upgrade > Mark Upgrade > Execute Upgrade" in sequence to complete the upgrade operation; The upgrade execution time format is YYYYMMDDHHmmss. All FFs indicate immediate upgrade.
[0027] The original Lib_MultipleTest698.dll in S3 needs to be backed up. After the differential upgrade command is normally executed in S3, it takes about 1 minute to perform the upgrade operation, and there is no response during this period.
[0028] Lower computer algorithm This article only describes the application of this algorithm on the IoT table management chip. If you need to port it to a bare metal program, please refer to "Example of Bare Metal Porting of Upgrade Algorithm"; The parsing algorithm of the upgrade package has been packaged as a static link library, which can be used to restore the target upgrade file from the upgrade package file and the original file; The IoT table management core program runs on the real-time operating system provided by Zhixin. The system has a complete and reliable program recovery mechanism. During the system startup process, if it is detected that the application in the / bin directory does not exist, the program will be restored from the / backup directory to the / bin directory. If the program signature verification fails, the program will be restored from the / rollback directory to the / bin directory.
[0029] This solution uses this mechanism to perform the upgrade operation. After receiving the upgrade package file and the upgrade command, the upgrade package parsing algorithm library is used to generate the target upgrade file. After verification, the program files in the / rollback directory are moved to the custom backup path for backup, and the program files in the / backup directory are moved to the / rollback directory as the recovery file when the signature verification fails after the upgrade. Then the generated target upgrade file is moved to the / backup directory, and finally the program files in the / bin directory are deleted and the system is restarted. After the system restarts, the program files in the / bin directory cannot be found. The program files previously replaced by the target upgrade files are restored from the / backup directory to the / bin directory and the signature is verified. At this time, if the signature verification passes, the upgrade has been successful and the upgraded program is executed. If the signature verification fails, the system will restore the previous version of the program from the / rollback directory, thereby ensuring the survival of the application after the upgrade is executed. If the signature verification fails after the program is upgraded, the program version remains unchanged compared to before the upgrade. In this case, the files in the / backup and / rollback directories should be restored to the state before the upgrade to ensure their original backup function.
[0030] User Interface To generate an upgrade package file, you need a bin (or hex) file of the same version as the target device and the target bin (or hex) file. After selecting them through the software (the hex file needs to select additional blank segment filling characters), click the "Generate Patch File" button to generate the upgrade package file. The upgrade package is fixed as a bin file.
[0031] Upload the upgrade file and execute the upgrade. In "Special Function Test > Remote Upgrade > Differential Mode Upgrade", select the upgrade package file generated above, and execute "Start Upgrade > Meter Upgrade > Execute Upgrade" in sequence to complete the upgrade operation. The execution upgrade time is all FF for immediate upgrade. The protocol used for the upgrade communication function is shown in Appendix A: IoT Meter Management Chip Upgrade Interface (DL / T 698.45).
[0032] Internal Interface The underlying file interface functions in "file_api.h" need to be implemented by the porter. The upgrade package parsing algorithm library function will call this interface to perform underlying operations such as file reading and writing.
[0033] The above calling operation code is as follows: int file open(const char *file,int flags); int fileolose(int fd); int file read(int fd,void *buf,gize t len); int file write(int fd,const void *buf,size t len); off t file lseek(int fd,off t offset,int whence); The file interface can be directly connected to the POSIX file interface as follows: int file open(const char *file,int flags) { return open(file,flags); } int file_close(int fd) { return close(fd); } int file_read(int fd,void *buf,size_t len) { return read(fd,buf,len); } Int file_write(int fd,const void *buf,size_t len) { return write(fd,buflen); } Off_t file_lseek(int fd,off_t offset,int whence) { return lseek(fd,offset, whence); }
[0034] External Interface "dopatch.h" provides the interface functions for the static library of the upgrade package parsing algorithm. As shown below, the Get_PatchFileInfo_Check and do_BsPatch functions are called in sequence to generate the target upgrade file. The getFileCRC function is used to calculate the CRC32 of the file, which can be used to verify the generated target file.
[0035] typedef void(*VoidCB)(void); / * Get information about new and old files in the patch file and check the matching of old files Input: old file path, patch package file path, new file's CRC checksum (CRC storage address) Output: new file length Error: -1: File operation error -2: Old file matching error * / int Get_Patchfilenfo_Check(const char *OldFileName,const char *PatchfileName,uint32_t *OutPutNewFile CRC32); Execute the patching algorithm to generate new files Input: new file path, periodic callback function (processing time may be long, used to feed the dog) Output: length of the new file Error: -1 * / int do_BsPatch(const char *NewEileName,VoidCB cycallback); / *Calculate and generate the CRC check value of the new file Input: file path, calculated CRC checksum of new file, periodic callback function (for feeding the dog) Output: 0: Success - 1: Failed to open the file - 2: Failed to obtain the CRC check value * / int getFileCRC(const char *FileName,uint32_t *out_NewFile _CRC32,VoidCB cycallback);
[0036] System data structure design The system data structure design mainly includes the following contents: 1. Upgrade the communication structure object method parameter data structure design; 2. Design of upgrade package processing data structure.
[0037] System error handling design The system error handling design mainly includes: 1. When the host computer sends the upgrade command and the communication error occurs, the host computer can resend it; 2. When an error occurs when the lower computer generates the target upgrade file, the upgrade operation is interrupted, the error code is recorded, and the file is cleaned up; 3. When verification fails after the lower computer is restarted, record the error code, restore the backup file, and clean up the file.
[0038] The relationship between functional requirements and procedures is as follows: Appendix A: IoT meter management chip upgrade interface (DL / T 698.45) Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. An efficient remote device upgrade system, characterized in that: include: Host computer, slave computer, interface module and operation module; The host computer is an upgrade package generation tool, which is used to analyze the original program and the target program and generate a program upgrade package that can be used by the lower computer; The lower computer is an upgrade algorithm, which is used to parse the program upgrade package generated by the upper computer, generate the target program according to the upgrade package and itself, and apply the upgrade, and ensure that the program survives the upgrade; The interface module includes a user interface, an internal interface and an external interface; The operation module is used to generate a program upgrade package file in the upgrade package generation tool using the original binary file to be upgraded and the upgrade target file through the upper computer, and then import the upgrade package into the upgrade interface. After confirming the upgrade time, "Start Upgrade>Mark Upgrade>Execute Upgrade" is executed in sequence. After receiving the upgrade command, the lower computer will automatically complete the upgrade operation.
2. According to claim 1, an efficient remote device upgrade system is characterized in that: The host computer hardware requirements are: Main frequency: 2.4GHz and above; Memory: 4G and above; The host computer system requirements are: Window10.
3. The efficient remote device upgrade system according to claim 1, characterized in that: The lower computer uses C language.
4. The efficient remote device upgrade system according to claim 1, characterized in that: The combination of the running modules, if the developer needs to use the algorithm, can directly add the static library provided by the docking, and transplant the provided upgrade code. After the transplantation is successful, the upgrade operation can be performed through the host computer using the "user interface".
5. The efficient remote device upgrade system according to claim 1, characterized in that: The running time of the running module is that the upper computer generally takes less than half a second to generate the upgrade package file, and the specific time depends on the size of the input file. The time for issuing the upgrade command depends on the size of the upgrade package file, which is 1-2 minutes. The time for the lower computer to execute the upgrade is generally 1-2 minutes, which depends on the size of the upgrade package file and the target file.
6. The efficient remote device upgrade system according to claim 1, characterized in that: The user interface is the interaction mode between the user and the host computer.
7. The efficient remote device upgrade system according to claim 1, characterized in that: The internal interface is a communication method between different components or modules within the system.
8. The efficient remote device upgrade system according to claim 1, characterized in that: The external interface is the interaction mode between the system and other external systems or users.
9. A method for an efficient remote device upgrade system, applied to the efficient remote device upgrade system according to claims 1-8, characterized in that: The steps include: S1. Meter preparation: First, make sure that the program on the meter is a differentially upgradeable version. It is recommended to burn or download the entire program first. S2. Generate a differential package and open the differential file generation tool; "Padding character" only works on .hex files. The IoT table program is a .bin file and is useless here. "Old file" is the program file that has been downloaded to the table, and "new file" is the target program file that needs to be upgraded; After filling in the above two files, click the "Generate Patch File" button; Then select a location to save the "patch file". Here, the "patch file" is the differential upgrade file; S3. Execute the upgrade and copy the Lib_MultipleTest698.dll in the attachment to the MeterApp-698 installation directory; Open MeterApp-698, select "Special Function Test > Remote Upgrade > Differential Mode Upgrade", select the differential upgrade file generated above, and execute "Start Upgrade > Mark Upgrade > Execute Upgrade" in sequence to complete the upgrade operation; The upgrade execution time format is YYYYMMDDHHmmss. All FFs indicate immediate upgrade.
10. The method of an efficient remote device upgrade system according to claim 9, characterized in that: The original Lib_MultipleTest698.dll in S3 needs to be backed up. After the differential upgrade command is normally executed in S3, it takes about 1 minute to perform the upgrade operation, and there is no response during this period.
