A decoupled upgrade method for firmware image integrated management system
By using the flash of the management module as the mirror cache area to form an asynchronous closed-loop upgrade method, the failure problem caused by multi-bus data transmission in large-scale control systems is solved, and a safer and more efficient firmware upgrade is achieved.
Patent Information
- Application Number
- CN202411926437.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-25
- Publication Date
- 2025-04-08
AI Technical Summary
In a large-scale control system, when the upper computer upgrades the firmware to the lower control module through the management module, due to the large-scale data transmission of multiple buses at the same time, data disorder and failure rate are high, threatening the use of the entire control system.
The flash of the management module is used as the cache area for all images. The image sent by the upper computer to the control module is stored in the flash of the management module through the management module, rather than directly issued through the communication protocol. This forms two asynchronous closed loops, and the upgrade time is independent and controllable.
It realizes unified image management, decouples the integrated upgrade process, alleviates the frequent occurrence of failures caused by the huge amount of data on the communication bus, shortens the upgrade time, and ensures that the normal operation of the system is not affected by firmware upgrades.
Smart Images

Figure CN119781799A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of control systems, and more specifically to a decoupled upgrade method for a firmware image integrated management system. Background Art
[0002] For a control system, the general mode is that a comprehensive management module manages multiple different types of control modules. The management module is responsible for handling information transmission with the host computer and each subordinate control module, including the host computer needs to upgrade the firmware of the subordinate control module. At present, the general solution is that the host computer transmits the image to the management module in binary form through the communication protocol, and the management module directly transmits the image information in binary form to the subordinate control module through protocol conversion. The subordinate module then writes the information into its own flash through parsing to execute the upgrade action. This method takes too long to upgrade, and it also involves large-scale and frequent data transmission on multiple buses at the same time. It has a high failure rate and is prone to data confusion, which even directly threatens the use of the entire control system. Summary of the invention
[0003] In order to overcome the defects existing in the above-mentioned prior art, the present invention discloses a decoupled upgrade method for a firmware image integrated management system. The purpose of the present invention is to solve the problem of data confusion and other faults caused by large-scale data transmission of multiple buses simultaneously in a large-scale control system in the prior art when the upper computer upgrades the lower control module through the management module. The present invention uses the flash of the management module as the cache area of all images, and the image sent by the upper computer to the control module through the management module will be stored in the flash of the management module, rather than being directly sent to the control module through the communication protocol. In this way, the upper computer and the management module form a closed loop, and the management module and the control module form a closed loop. The two closed loops are asynchronous, and the upgrade time is autonomous and controllable. During the working hours of the system, the image file can be written into the flash of the management module through the upper computer, and during non-working hours, an instruction is issued to let the management module upgrade the control module.
[0004] In order to achieve the above objectives, the technical solution adopted by the present invention is: A decoupled upgrade method for a firmware image integrated management system, the firmware image integrated management system comprising a host computer, a management module and a plurality of control modules, the host computer is communicatively connected to the management module, and the management module is communicatively connected to the plurality of control modules; The management module is provided with a cache area flash for caching image files, and the cache area flash divides the host computer, the management module and the control module into closed loop I and closed loop II, the host computer and the management module form closed loop I, the management module and the control module form closed loop II, and the closed loop I and closed loop II are asynchronous; The decoupled upgrade method includes: during working hours, based on the closed loop I host computer, the upgrade image file is written into the cache flash of the management module; during non-working hours, based on the closed loop II management module, the upgrade image file in the cache flash is sent to the control module, and the control module parses the upgrade image file and executes the upgrade.
[0005] Preferably, the number of cache flashes under the management module is set according to the number of control modules.
[0006] Preferably, the cache area flash caches the image file of the management module and the image file of the control module, and forms an image management table.
[0007] In the present invention, the image file cached in the cache area flash includes the image file of the management module and the image file of the control module, wherein the image file of the management module refers to the binary file of the computer program in the management module, and its function is to flash the binary code in the management module area in the flash to achieve the purpose of updating the program; the image file of the control module refers to the binary file of the computer program in the control module, and its function is to flash the binary code in the management module area in the flash to achieve the purpose of updating the program.
[0008] Preferably, the items in the image management table include serial number, module physical number, start position, end position, backup start position, backup end position, main area software version number, backup area software version number, and update completion flag, wherein: The serial number indicates the logical order of the image in the flash, and the serial number corresponds to the physical number of the module one by one; The module physical number represents the real number of the control module in the system; The start bit indicates the bit where the image refresh starts; The end bit indicates the end bit of the image refresh; The backup start bit indicates the bit where the backup image refresh starts; The backup end bit indicates the bit where the backup image refresh ends; The main area software version number indicates the software version of the main area; The backup area software version number indicates the software version of the backup area; The update completion flag is set to 0 or 1 according to whether the software version number of the main area is consistent with the software version number of the backup area, indicating whether the latest version has been updated to the lower level.
[0009] Preferably, the storage method of the image file in the flash includes the storage method in the main area and the backup area, including: START, DATA, CRC, reserved bit, END, delimiter, backup START, backup DATA, backup CRC, backup reserved bit, backup END, wherein: The START bit indicates the start of image refresh; The DATA represents mirror data; The CRC is used to calibrate the data after the data is written; The reserved bit indicates the extension of the data size; The END indicates the bit where the image refresh ends; The delimiter distinguishes the use areas of the primary image and the backup image; The backup START indicates the bit where the backup image refresh starts; The backup DATA represents backup image data; The backup CRC indicates the calibration of the data after the backup data is flushed; The backup reserved bit indicates the extension of the data size by the backup; The backup END indicates the bit where the refresh of the backup image ends.
[0010] Preferably, the method for refreshing the image file in the cache area flash comprises the following steps: S1, the host computer issues an upgrade instruction to the management module, the management module parses the module physical number in the upgrade instruction, queries the image management table to find out whether there is a serial number corresponding to the module physical number, and if there is a corresponding serial number, enters step S2; S2, the management module queries whether the update completion flag of the mirror management table is set to 1 or 0. If it is set to 1, the corresponding start bit is identified and the step S3 is entered. If it is set to 0, the data in the main area is copied to the data in the backup area and the step S3 is entered. S3, start refreshing. After refreshing, use CRC to check whether the refreshing is correct. If the verification is successful, update the data in the image management table and return a successful refresh prompt to the host computer. If the verification fails, first copy the backup area data to the main area data, and then return a refresh failure prompt to the host computer.
[0011] The setting of 0 in the above step S2 indicates that closed loop II has not yet been synchronized with the latest version updated in closed loop I. Before refreshing the new version, the unsynchronized version must be backed up, so the data in the main area is copied to the backup area. The purpose is to avoid processing errors during the update process that make the most adjacent version unable to be restored, resulting in the loss of the most adjacent version.
[0012] In step S3, the purpose of copying the backup area data to the main area data when the CRC check fails is to avoid being unable to restore the most recent version after the program fails to be flashed due to the CRC check failure.
[0013] Preferably, in step S1, if the query does not have a corresponding sequence number, proceed to step S4; S4. Determine whether flash1 satisfies the storage image file. If flash1 satisfies the storage image file, identify end(n)+1 and then enter step S3 to start refreshing from end(n)+1, where end(n) represents the end position corresponding to the largest sequence number in the table.
[0014] Preferably, in step S4, the determination of whether flash1 satisfies the storage of image files includes determining whether the following conditions are met, if so, then the determination is met: in, flash1_size express flash1 Size of space, end(n) Indicates the maximum sequence number in the table. end Bit, n Indicates the maximum sequence number, image_size Indicates the image file size. m Indicates other fixed positions.
[0015] Preferably, in step S4, if flash1 does not meet the requirements for storing the image file, then proceed to step S5; S5, determine whether flash2 meets the storage image file. If flash2 meets the storage image file, identify end(n)+1 and enter S3 to start refreshing from end(n)+1. If flash2 does not meet the storage image file, return a refresh failure prompt to the host computer.
[0016] Preferably, the determination of whether flash2 satisfies the storage of the image file includes determining whether the following conditions are met, if so, the determination is met: in, flash2_size express flash2 Size of space, end(n) Indicates the maximum sequence number in the table. end Bit, n Indicates the maximum sequence number, image_size Indicates the image file size. m Indicates other fixed positions.
[0017] Beneficial effects of the present invention: 1. The present invention stores all firmware images in the control system in the flash of the management module, realizes unified management of images, and decouples the previous integrated upgrade process from the host computer to the management module and then to the control module into two closed loops, which alleviates the phenomenon of frequent failures caused by the huge amount of communication bus data in the integrated upgrade and shortens the time required for the overall upgrade. Asynchronous upgrades from the host computer to the management module and from the management module to the control module are realized, which can ensure that the normal operation time of the system is not affected by the firmware upgrade as much as possible, and at the same time bring greater convenience to the maintenance of R&D personnel.
[0018] 2. The present invention solves the problem of large-scale data transmission on multiple buses at the same time, and also greatly reduces the failure rate in the entire upgrade process. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 This is a flash state structure diagram of the system of the present invention; Figure 2 This is a structural diagram of the image management table of the present invention; Figure 3 This is a structural diagram of the storage method of the image in the flash of the present invention; Figure 4 This is a flow chart of the flash image refresh method of the present invention. DETAILED DESCRIPTION
[0020] The concept, specific structure and technical effects of the present invention will be clearly and completely described below in conjunction with the embodiments and drawings to fully understand the purpose, characteristics and effects of the present invention.
[0021] A decoupled upgrade method for a firmware image integrated management system, the firmware image integrated management system comprising a host computer, a management module and a plurality of control modules, the host computer is communicatively connected to the management module, and the management module is communicatively connected to the plurality of control modules; The management module is provided with a cache area flash for caching image files, and the cache area flash divides the host computer, the management module and the control module into closed loop I and closed loop II, the host computer and the management module form closed loop I, the management module and the control module form closed loop II, and the closed loop I and closed loop II are asynchronous; The decoupled upgrade method includes: during working hours, based on the closed loop I host computer, the upgrade image file is written into the cache flash of the management module; during non-working hours, based on the closed loop II management module, the upgrade image file in the cache flash is sent to the control module, and the control module parses the upgrade image file and executes the upgrade.
[0022] In this embodiment, the flash of the management module is used as a cache area for all images, and the images sent by the host computer to the control module through the management module will be stored in the flash of the management module, rather than being sent directly to the control module through the communication protocol. In this way, the host computer and the management module form a closed loop, and the management module and the control module form a closed loop. The two closed loops are asynchronous, and the upgrade time is autonomous and controllable. During the working hours of the system, the image file can be written into the flash of the management module through the host computer, and then an instruction can be issued during non-working hours to let the management module upgrade the control module. This involves the storage method of the control module in the management module, the control module image processing method, and the instruction execution method.
[0023] The present invention can flexibly determine the number of flashes under the management module according to the number of control modules. Taking two flashes as an example, Figure 1 As shown, all images of the management module and the control module are pressed into the management module flash in sequence, and then an image management table is formed in the management module as shown in FIG. Figure 2 Taking flash1 as an example, the "serial number" indicates the logical order of the image in the flash, which corresponds to the "module physical number" one by one; the "module physical number" indicates the actual number of the control module in the system, which can be viewed on the hardware; the "start bit" indicates the bit where the image refresh starts; the "end bit" indicates the bit where the image refresh ends; the "start backup bit" indicates the bit where the backup image refresh starts; the "end backup bit" indicates the bit where the backup image refresh ends; the "main area software version number" indicates the software version of the main area; the "backup area software version number" indicates the software version of the backup area; the "update completion flag bit" is set to 0 or 1 according to whether the main area software version number is consistent with the backup area software version number, indicating whether the latest version has been updated to the lower level. The data rules of each module in the flash are as follows: Figure 3 As shown in the figure, "data" indicates the mirror data; "reserved bit" indicates the expansion of the data size; "CRC check bit" is for calibration of the data after the data is flushed; "delimiter" is used to distinguish the use area of the primary mirror and the backup mirror to avoid overlap. The same applies to the backup area. Figure 2 and Figure 3 , part of it is repeated, one is the storage method in flash, and the other is the management entry of the logical table in the code.
[0024] like Figure 4 As shown, the method for refreshing the image file in the cache area flash includes the following steps: S1, the host computer issues an upgrade instruction to the management module, the management module parses the module physical number in the upgrade instruction, queries the image management table to find out whether there is a serial number corresponding to the module physical number, if there is a corresponding serial number, enter step S2, if there is no corresponding serial number, enter step S4; S2, the management module queries whether the update completion flag of the mirror management table is set to 1 or 0. If it is set to 1, the corresponding start bit is identified and the step S3 is entered. If it is set to 0, the data in the main area is copied to the data in the backup area and the step S3 is entered. S3, start refreshing. After refreshing, use CRC to check whether the refreshing is correct. If the verification is successful, update the data in the image management table and return a successful refresh prompt to the host computer. If the verification fails, first copy the backup area data to the main area data, and then return a refresh failure prompt to the host computer.
[0025] S4, determine whether flash1 meets the storage image file. If flash1 meets the storage image file, identify end(n)+1 and then enter step S3 to start refreshing from end(n)+1, where end(n) represents the end position corresponding to the largest sequence number in the table; if flash1 does not meet the storage image file, enter step S5; The determination of whether flash1 is sufficient to store the image file includes determining whether the following is true, if true: in, flash1_size express flash1 Size of space, end(n) Indicates the maximum sequence number in the table. end Bit, n Indicates the maximum sequence number, image_size Indicates the image file size. m Indicates other fixed positions.
[0026] S5, determine whether flash2 meets the storage image file. If flash2 meets the storage image file, identify end(n)+1 and enter S3 to start refreshing from end(n)+1. If flash2 does not meet the storage image file, return a refresh failure prompt to the host computer.
[0027] The determination of whether flash2 is sufficient to store the image file includes determining whether the following is true, if true: in, flash2_size express flash2 Size of space, end(n) Indicates the maximum sequence number in the table. end Bit,n Indicates the maximum sequence number, image_size Indicates the image file size. m Indicates other fixed positions.
[0028] In this embodiment, the specific process is as follows Figure 4 As shown, the host computer issues an upgrade instruction to the management module. The management module analyzes the module physical number in the instruction and queries the image management table to find out whether there is a serial number corresponding to the physical number. If the corresponding relationship is established, it queries whether the image update completion flag is set to 1. If it is set to 1, it means that the subordinate has updated the latest image. By identifying the corresponding start bit, you can start refreshing. If the update completion flag is 0, you need to copy the main area data to the backup area data, and then start refreshing. If the corresponding relationship is not established, you need to open up new space for the image. First, calculate whether the flash1 space size-the end bit corresponding to the maximum serial number in the table is greater than 2*image+other fixed bits. If it is greater, it means that flash1 can store the image, and then start writing the image from end(n)+1 (n represents the maximum serial number). Conversely, it is necessary to calculate whether flash2 meets the requirements in the same way. If it meets the requirements, it can be written. If it does not meet the requirements, it means that the existing flash space is full and it is impossible to continue adding new module images. The host computer refresh failure prompt is returned. After the refresh is completed, you need to use CRC to verify whether the refresh is correct. If the verification result is correct, update the data in the table and return a successful refresh prompt to the host computer. If the verification fails, the data in the main area is damaged at this time. You need to copy the backup area data to the main area data first, and then return a refresh failure prompt to the host computer, and the process ends.
[0029] In the present invention, flash1 and flash2 indicate that multiple flashes can be used to store image files in the entire system. The main area backup area means that when the image of a module is stored in the flash, the area allocated to this module will be divided into the main area and the backup area. The main area stores the current latest version of the image, and the backup area may store the latest version or the previous version of the image. The main area backup area has no necessary connection with flash1 and flash2 and does not affect each other.
[0030] The above is a specific description of the implementation mode of the present invention, but the present invention is not limited to the described embodiments. Those skilled in the art may make various equivalent modifications or substitutions without violating the spirit of the present invention, and these equivalents or substitutions are all included in the scope defined by the claims of the present invention.
Claims
1. A decoupled upgrade method for a firmware image integrated management system, characterized in that: The firmware image integrated management system comprises a host computer, a management module and a plurality of control modules, wherein the host computer is communicatively connected to the management module, and the management module is communicatively connected to the plurality of control modules; The management module is provided with a cache area flash for caching image files, and the cache area flash divides the host computer, the management module and the control module into closed loop I and closed loop II, the host computer and the management module form closed loop I, the management module and the control module form closed loop II, and the closed loop I and closed loop II are asynchronous; The decoupled upgrade method comprises: within working hours, the upper computer writes the upgrade image file into the cache area flash of the management module based on the closed loop I; During non-working hours, the closed-loop II management module sends the upgrade image file in the cache flash to the control module, which parses the upgrade image file and executes the upgrade.
2. The decoupled upgrade method according to claim 1, characterized in that: Set the number of cache flashes under the management module according to the number of control modules.
3. The decoupled upgrade method according to claim 1, characterized in that: The cache area flash caches the image file of the management module and the image file of the control module, and forms an image management table.
4. The decoupled upgrade method according to claim 3, characterized in that: The items in the mirror management table include serial number, module physical number, start position, end position, backup start position, backup end position, main area software version number, backup area software version number, and update completion flag, where: The serial number indicates the logical order of the image in the flash, and the serial number corresponds to the physical number of the module one by one; The module physical number represents the real number of the control module in the system; The start bit indicates the bit where the image refresh starts; The end bit indicates the end bit of the image refresh; The backup start bit indicates the bit where the backup image refresh starts; The backup end bit indicates the bit where the backup image refresh ends; The main area software version number indicates the software version of the main area; The backup area software version number indicates the software version of the backup area; The update completion flag is set to 0 or 1 according to whether the software version number of the main area is consistent with the software version number of the backup area, indicating whether the latest version has been updated to the lower level.
5. The decoupled upgrade method according to claim 1, characterized in that: The storage method of the image file in the flash includes the storage method in the main area and the backup area, including: START, DATA, CRC, reserved bit, END, delimiter, backup START, backup DATA, backup CRC, backup reserved bit, backup END, where: The START bit indicates the start of image refresh; The DATA represents mirror data; The CRC is used to calibrate the data after the data is written; The reserved bit indicates the extension of the data size; The END indicates the bit where the image refresh ends; The delimiter distinguishes the use areas of the primary image and the backup image; The backup START indicates the bit where the backup image refresh starts; The backup DATA represents backup image data; The backup CRC indicates the calibration of the data after the backup data is flushed; The backup reserved bit indicates the extension of the data size by the backup; The backup END indicates the bit where the refresh of the backup image ends.
6. The decoupled upgrade method according to claim 1, characterized in that: The method for refreshing the image file in the cache area flash comprises the following steps: S1, the host computer issues an upgrade instruction to the management module, the management module parses the module physical number in the upgrade instruction, queries the image management table to find out whether there is a serial number corresponding to the module physical number, and if there is a corresponding serial number, enters step S2; S2, the management module queries whether the update completion flag of the mirror management table is set to 1 or 0. If it is set to 1, the corresponding start bit is identified and the step S3 is entered. If it is set to 0, the data in the main area is copied to the data in the backup area and the step S3 is entered. S3, start refreshing. After refreshing, use CRC to check whether the refreshing is correct. If the verification is successful, update the data in the image management table and return a successful refresh prompt to the host computer. If the verification fails, first copy the backup area data to the main area data, and then return a refresh failure prompt to the host computer.
7. The decoupled upgrade method according to claim 6, characterized in that: In step S1, if the query does not have a corresponding sequence number, proceed to step S4; S4. Determine whether flash1 satisfies the storage image file. If flash1 satisfies the storage image file, identify end(n)+1 and then enter step S3 to start refreshing from end(n)+1, where end(n) represents the end position corresponding to the largest sequence number in the table.
8. The decoupled upgrade method according to claim 7, characterized in that: In step S4, the determination of whether flash1 is sufficient to store the image file includes determining whether the following conditions are met, if so, the determination is satisfied: in, flash1_size express flash1 Size of space, end(n) Indicates the maximum sequence number in the table. end Bit, n Indicates the maximum sequence number, image_size Indicates the image file size. m Indicates other fixed positions.
9. The decoupled upgrade method according to claim 7, characterized in that: In step S4, if flash1 does not meet the requirements for storing the image file, then proceed to step S5; S5, determine whether flash2 meets the storage image file. If flash2 meets the storage image file, identify end(n)+1 and enter S3 to start refreshing from end(n)+1. If flash2 does not meet the storage image file, return a refresh failure prompt to the host computer.
10. The decoupled upgrade method according to claim 9, characterized in that: The determination of whether flash2 is sufficient to store the image file includes determining whether the following is true, if true: in, flash2_size express flash2 Size of space, end(n) Indicates the maximum sequence number in the table. end Bit, n Indicates the maximum sequence number, image_size Indicates the image file size. m Indicates other fixed positions.