Firmware upgrade method, system, device, computer equipment and storage medium

By determining the device upgrade priority and dynamically planning bandwidth resources in the photovoltaic energy storage system, the problem of low firmware upgrade efficiency in the photovoltaic energy storage system is solved, and rapid upgrades are achieved under limited bandwidth.

CN119718386BActive Publication Date: 2025-09-09GUANGZHOU RIMSEA TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510223598.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-02-27
Publication Date
2025-09-09
Estimated Expiration
2045-02-27

AI Technical Summary

Technical Problem

In photovoltaic energy storage systems, the increasing number and types of devices lead to limited network bandwidth during firmware upgrades. Traditional unified upgrade strategies lead to low upgrade efficiency and may even fail.

Method used

By obtaining the firmware upgrade package and communication bandwidth of each slave device, the upgrade priority is determined, the highest priority device is screened out for firmware upgrade, and a target firmware upgrade strategy is formulated for other devices to complete the upgrade in the shortest time. The greedy algorithm and dynamic programming are used to optimize bandwidth resource allocation.

Benefits of technology

Improves the efficiency of firmware upgrades, ensuring that firmware upgrades for all devices are completed quickly under limited bandwidth, reducing upgrade time and resource waste.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119718386B_ABST
    Figure CN119718386B_ABST
Patent Text Reader

Abstract

The present application relates to a firmware upgrade method, apparatus, system, computer device, and storage medium. The method includes: obtaining a firmware upgrade package and communication bandwidth for each slave device; determining the upgrade priority of each slave device based on the size of the firmware upgrade package and the communication bandwidth; screening out a first slave device with the highest upgrade priority; performing a firmware upgrade on the first slave device; and determining a target firmware upgrade strategy for each second slave device other than the first slave device, wherein the target firmware upgrade strategy is a firmware upgrade strategy with the shortest firmware upgrade time; and performing a firmware upgrade on the second slave device based on the target firmware upgrade strategy. This method can improve firmware upgrade efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of firmware upgrade, and in particular to a firmware upgrade method, apparatus, computer equipment, storage medium, and computer program product. Background Art

[0002] With the increasing popularity of photovoltaic energy storage systems, the number and types of devices in the system are constantly increasing. These devices have significant differences in communication bandwidth and processing capabilities. When the device firmware needs to be upgraded, it faces great challenges in bandwidth allocation and firmware upgrade sequence.

[0003] In traditional solutions, a unified upgrade strategy is usually adopted. The transmission method and installation process for firmware upgrades of each device are unified. All devices receive the update instructions at the same time, start downloading and installing the firmware, and upgrade to the same firmware version at the same time.

[0004] However, since firmware updates need to be transmitted over the network, especially in IoT devices such as optical storage devices, if the number of devices is too large, the network bandwidth will be limited, resulting in slower update speeds or even update failures. Therefore, the traditional firmware upgrade method has low upgrade efficiency. Summary of the Invention

[0005] Based on this, it is necessary to provide a firmware upgrade method, system, device, computer equipment, computer-readable storage medium and computer program product that can improve the efficiency of firmware upgrade in order to address the above technical problems.

[0006] In a first aspect, the present application provides a firmware upgrade method. The method comprises:

[0007] Obtain the firmware upgrade package and communication bandwidth of each slave device;

[0008] Determining the upgrade priority of each slave device according to the size of the firmware upgrade package and the communication bandwidth;

[0009] Screening out the first slave device with the highest upgrade priority, and performing firmware upgrade on the first slave device;

[0010] For the remaining second slave devices except the first slave device, determining a target firmware upgrade policy for the second slave device, the target firmware upgrade policy being a firmware upgrade policy with the shortest firmware upgrade time;

[0011] Performing a firmware upgrade on the second slave device according to the target firmware upgrade policy.

[0012] In one embodiment, determining the target firmware upgrade policy of the second slave device includes:

[0013] Determine an initial upgrade state of the second slave device as a current upgrade state, wherein the initial upgrade state indicates that the second slave device has not completed the firmware upgrade;

[0014] Determine a candidate upgrade state for the next time step, and determine a state transition equation value corresponding to each candidate upgrade state according to a preset state transition equation, wherein the state transition equation value represents the number of second slave devices that have completed the firmware upgrade in the candidate upgrade state;

[0015] Determining the upgrade state for the next time step according to the state transition equation value corresponding to each candidate upgrade state;

[0016] Updating the upgrade state of the next time step to the current upgrade state, returning to the step of determining the candidate upgrade state for the next time step, until the current upgrade state is the target upgrade state, obtaining the upgrade state of the second slave device at each time step, the target upgrade state indicating that the second slave device has completed the firmware upgrade, and the upgrade state indicating the upgrade status of the second slave device at each time step;

[0017] A target firmware upgrade strategy for the second slave device is determined according to the upgrade status of each time step.

[0018] In one embodiment, the method further comprises:

[0019] determining, based on the size of the firmware upgrade package of the second slave device, the communication bandwidth, and a preset evaluation function, an evaluation function value corresponding to each candidate upgrade state, the preset evaluation function including an actual cost function and an estimated cost function, the actual cost function representing the communication bandwidth allocated to the second slave device, and the estimated cost function representing the remaining firmware upgrade time for the second slave device;

[0020] The upgrade state for the next time step is determined according to the state transition equation value corresponding to the candidate upgrade state and the evaluation function value corresponding to each candidate upgrade state.

[0021] In one embodiment, determining the upgrade priority of each slave device according to the size of the firmware upgrade package and the communication bandwidth includes:

[0022] For each slave device, calculating a ratio of a communication bandwidth of the slave device to a size of the firmware upgrade package;

[0023] An upgrade priority of the slave device is determined based on the ratio, wherein the ratio is positively correlated with the upgrade priority.

[0024] In one embodiment, screening out the first slave device with the highest upgrade priority and performing firmware upgrade on the first slave device includes:

[0025] Filtering out the first slave device with the highest upgrade priority;

[0026] In a case where there are multiple first slave devices screened out, determining a firmware upgrade order for the first slave devices according to sizes of firmware upgrade packages of the first slave devices;

[0027] Performing firmware upgrade on the first slave device according to the firmware upgrade sequence of the first slave device.

[0028] In a second aspect, the present application also provides a firmware upgrade system. The system includes a master device and multiple slave devices connected to each other;

[0029] The master control device is configured to obtain a firmware upgrade package and a communication bandwidth of each slave device, determine an upgrade priority of each slave device based on the size of the firmware upgrade package and the communication bandwidth, screen out a first slave device with the highest upgrade priority, send the firmware upgrade package of the first slave device to the first slave device, and allocate a communication bandwidth to the first slave device; for the remaining second slave devices other than the first slave device, determine a target firmware upgrade policy for the second slave device, the target firmware upgrade policy being a firmware upgrade policy with the shortest firmware upgrade time, send the firmware upgrade package of the second slave device to the second slave device based on the target firmware upgrade policy, and allocate a communication bandwidth to the second slave device;

[0030] The slave device is configured to receive the firmware upgrade package, perform an integrity check on the firmware upgrade package, and install the firmware upgrade package if the firmware upgrade package passes the integrity check.

[0031] In one embodiment, the system also includes a networking module connected to the master control device, which is used to obtain the firmware version information of each of the slave devices and the latest firmware version information. When the firmware version information does not match the latest firmware version information, the system obtains the firmware upgrade package of each of the slave devices and sends the firmware upgrade package of each of the slave devices to the master control device.

[0032] In a third aspect, the present application further provides a firmware upgrade device. The device comprises:

[0033] Data acquisition module, used to obtain the firmware upgrade package and communication bandwidth of each slave device;

[0034] a priority determination module, configured to determine the upgrade priority of each slave device according to the size of the firmware upgrade package and the communication bandwidth;

[0035] a first firmware upgrade module, configured to screen out the first slave device with the highest upgrade priority and perform firmware upgrade on the first slave device;

[0036] a policy formulation module, configured to determine, for each of the remaining second slave devices except the first slave device, a target firmware upgrade policy for the second slave device, wherein the target firmware upgrade policy is a firmware upgrade policy with the shortest firmware upgrade time;

[0037] The second firmware upgrade module is configured to perform a firmware upgrade on the second slave device according to the target firmware upgrade policy.

[0038] In a fourth aspect, the present application further provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps in the above-mentioned firmware upgrade method embodiments when executing the computer program.

[0039] In a fifth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps in the above-mentioned firmware upgrade method embodiments.

[0040] In a sixth aspect, the present application further provides a computer program product, which includes a computer program that implements the steps in the above-mentioned firmware upgrade method embodiments when executed by a processor.

[0041] The above-mentioned firmware upgrade method, system, apparatus, computer equipment, storage medium and computer program product obtain the firmware upgrade package size and communication bandwidth of each slave device, then determine the upgrade priority of each slave device, screen and select the first slave device with the highest upgrade priority, and perform a firmware upgrade on the first slave device. Since the firmware upgrade package size and communication bandwidth of different slave devices may be different, determining the upgrade priority by the firmware upgrade package size and communication bandwidth can better fit the specific characteristics of the slave device. Furthermore, when determining the target firmware upgrade strategy for the second slave device other than the first slave device, the firmware upgrade strategy with the shortest firmware upgrade time is selected as the target firmware upgrade strategy. Then, when performing a firmware upgrade on the second slave device, the firmware upgrade of the second slave device can be completed in the shortest possible time, thereby comprehensively improving the efficiency of the firmware upgrade of the slave devices in the entire system. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] Figure 1A diagram illustrating an application environment of a firmware upgrade method according to an embodiment;

[0043] Figure 2 1 is a flowchart of a firmware upgrade method according to an embodiment;

[0044] Figure 3 A schematic diagram of a flow chart of the steps of dynamically planning and determining a target firmware upgrade strategy in one embodiment;

[0045] Figure 4 1 is a flowchart of a firmware upgrade method according to another embodiment;

[0046] Figure 5 1 is a flowchart of a firmware upgrade method in another embodiment;

[0047] Figure 6 A flowchart of a firmware upgrade method according to a detailed embodiment is shown;

[0048] Figure 7 is a structural block diagram of a firmware upgrade system in one embodiment;

[0049] Figure 8 It is a structural block diagram of a firmware upgrade system in another embodiment;

[0050] Figure 9 is a structural block diagram of a firmware upgrade device in one embodiment;

[0051] Figure 10 FIG. 1 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0052] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.

[0053] The firmware upgrade method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown, the master device 102 communicates with the slave device 104 via a network. The data storage system can store data that the master device 102 needs to process. The data storage system can be integrated on the master device 102 or placed on the cloud or other network servers.

[0054] Specifically, the master device 102 can obtain the firmware upgrade package and communication bandwidth of each slave device 104 from the data storage system, and then determine the upgrade priority of each slave device 104 based on the size of the firmware upgrade package and the communication bandwidth. Furthermore, the master device 102 selects the first slave device with the highest upgrade priority among the slave devices 104, and performs a firmware upgrade on the first slave device. The master device 102 then determines the firmware upgrade policy with the shortest firmware upgrade time for the remaining second slave devices excluding the first slave device, and uses this policy as the target firmware upgrade policy. The master device 102 then performs a firmware upgrade on the second slave device according to the target firmware upgrade policy.

[0055] Taking a photovoltaic energy storage system as an example, the slave device 104 may be, but is not limited to, an inverter, a battery management system, a maximum power point tracking controller, etc. The master device 102 may be implemented as an independent server or a server cluster consisting of multiple servers.

[0056] In one embodiment, Figure 2 As shown in the figure, a firmware upgrade method is provided. The following is explained by taking the method applied to photovoltaic energy storage system as an example. Figure 1 Taking the master control device 102 in FIG. 1 as an example, the method includes the following steps:

[0057] S100: Obtain the firmware upgrade package and communication bandwidth of each slave device.

[0058] In a photovoltaic energy storage system, the master device can be a central monitoring unit, and the slave devices can be devices such as battery management systems and inverters. The master and slave devices can be elected by a master-slave election algorithm. Firmware refers to the device "driver" stored within the device. It is a type of software embedded in the hardware device and is usually stored in the device's internal non-volatile memory. The firmware upgrade package is a software package used to update the device firmware. It contains the binary file of the new firmware version as well as some configuration files and instruction documents required for the update. Communication bandwidth refers to the amount of data that can be transmitted by a communication line or communication device per unit time. All other conditions being equal, the higher the communication bandwidth, the faster the data transmission.

[0059] For example, the networking module can obtain the firmware upgrade package from the upgrade server. After downloading the firmware upgrade package from the upgrade server, the networking module distributes it to the master device, which then obtains the firmware upgrade package. Furthermore, the master device has a certain status monitoring function for the slave devices, and can obtain information such as the slave device's communication bandwidth and processing power (such as CPU frequency and memory).

[0060] S300: Determine the upgrade priority of each slave device according to the size of the firmware upgrade package and the communication bandwidth.

[0061] Specifically, a greedy algorithm can be used to calculate the upgrade priority of each slave device, thereby determining the order of firmware upgrades. For example, the firmware upgrade time of each slave device can be estimated, and the upgrade priority of each slave device can be determined according to the firmware upgrade time. The firmware upgrade time is equal to the ratio of the size of the firmware upgrade package to the communication bandwidth. After estimating the firmware upgrade time of each slave device, the slave devices can be sorted according to the firmware upgrade time. Slave devices with short firmware upgrade times have higher priorities because upgrading these slave devices first can complete the firmware upgrade tasks of some slave devices more quickly, reduce the overall firmware upgrade time, and release network bandwidth resources more quickly.

[0062] In addition to the firmware upgrade time, the importance of slave devices in the PV energy storage system can also be considered when determining the upgrade priority. For example, the upgrade priority of slave devices that directly affect the safe operation of the PV energy storage system (such as inverters and battery management modules) can be appropriately increased.

[0063] In addition, during the operation of the system, the operating status of the slave devices is also changing all the time. At this time, the priority of some slave devices may change. For example, a slave device with a lower priority originally needs to be upgraded first due to the increase in task importance. At this time, the existing upgrade priority needs to be adjusted.

[0064] S500: Filter out a first slave device with the highest upgrade priority, and perform firmware upgrade on the first slave device.

[0065] Following the above steps and determining the upgrade priority of each slave device, the master device can then send the corresponding firmware upgrade package to the first slave device and a firmware upgrade instruction to the selected first slave device, instructing it to begin the firmware upgrade operation. After receiving the firmware upgrade instruction, the first slave device downloads the firmware upgrade package. Before downloading the firmware upgrade package, it can also perform a series of decryption, identity authentication, integrity verification, and other operations. After the firmware upgrade package is completely downloaded to the first slave device, the first slave device installs the new firmware according to the established installation process and restarts the new firmware after installation is complete. If the new firmware can initialize normally and perform basic functions, the firmware upgrade of the first slave device is complete.

[0066] S700 : For the remaining second slave devices except the first slave device, determine a target firmware upgrade policy for the second slave devices, where the target firmware upgrade policy is a firmware upgrade policy with the shortest firmware upgrade time.

[0067] The firmware upgrade policy refers to a series of rules formulated by comprehensively considering various factors during the firmware upgrade process of the second slave device, including but not limited to the upgrade sequence of the second slave device, bandwidth allocation, etc.

[0068] Specifically, for the second slave device that has not yet performed a firmware upgrade, the size of the firmware upgrade package of different second slave devices may vary greatly, and different firmware upgrade strategies may have a significant impact on the total firmware upgrade time. Therefore, it is necessary to use the firmware upgrade strategy with the shortest firmware upgrade time as the target firmware upgrade strategy. It should be noted that if the total communication bandwidth resources of the system are sufficient, the greedy algorithm in the above steps can be used to evaluate the priority of all slave devices and perform firmware upgrades based on the priority. However, in reality, the total communication bandwidth resources of the system are usually relatively tight. For example, there are multiple slave devices performing firmware upgrades at the same time, and their bandwidth requirements exceed the total communication bandwidth of the system, or the CPU and memory resources of the master device are close to the upper limit and cannot process more firmware upgrade requests from slave devices. In addition, the greedy algorithm only considers the local optimum and is difficult to consider the global optimum. Therefore, for the second slave device that has not yet performed a firmware upgrade, a dynamic programming algorithm can be used. Dynamic programming takes into account that multiple slave devices share limited bandwidth and processing power, and can perform global optimal optimization sequence selection and bandwidth resource scheduling throughout the firmware upgrade process of the second slave device.

[0069] S900: Perform firmware upgrade on the second slave device according to the target firmware upgrade policy.

[0070] Continuing with the above embodiment, after determining the target firmware upgrade strategy, it is first necessary to confirm whether the current operating status of the second slave device is suitable for firmware upgrade. If the second slave device is in a busy data transmission stage or there is an abnormal error, it is necessary to solve the relevant problem first or wait for it to enter a relatively idle and stable state before starting the firmware upgrade process.

[0071] Furthermore, based on the bandwidth allocation scheme determined in the target firmware upgrade policy, the second slave device undergoing the upgrade is allocated corresponding communication bandwidth through the configuration functions of network devices (such as routers and switches) or the system's network management software. This allows the second slave device to stably use this bandwidth resource to download the firmware upgrade package during the upgrade process. Similar to the first slave device, after the second slave device has completely downloaded the firmware upgrade package, it initiates the firmware installation process, for example, guided by the installation script within the upgrade package or operating according to the device's built-in firmware update mechanism. After the firmware upgrade package is installed, the second slave device restarts the device to enable the new firmware to take effect.

[0072] It should be noted that during the firmware upgrade process, the device status of each secondary slave device must also be considered. For example, during the firmware upgrade process, some secondary slave devices may require temporary storage space to download the firmware upgrade package. If this storage space is insufficient, the secondary slave device will be unable to complete the download, and the target firmware upgrade policy will need to be readjusted. Alternatively, if a secondary slave device experiences a failure during the firmware upgrade process (such as a communication interruption or hardware failure), preventing it from receiving the firmware upgrade package, the target firmware upgrade policy will need to be dynamically adjusted. For example, if secondary slave device A experiences a failure during the firmware upgrade process and cannot continue, the bandwidth originally allocated to secondary slave device A can be reallocated to secondary slave devices B and C.

[0073] The above-mentioned firmware upgrade method obtains the firmware upgrade package size and communication bandwidth of each slave device, then determines the upgrade priority of each slave device, screens and selects the first slave device with the highest upgrade priority, and performs a firmware upgrade on the first slave device. Since the firmware upgrade package size and communication bandwidth of different slave devices may vary, determining the upgrade priority by the firmware upgrade package size and communication bandwidth can better fit the specific characteristics of the slave device. Furthermore, when determining the target firmware upgrade strategy for a second slave device other than the first slave device, the firmware upgrade strategy with the shortest firmware upgrade time is selected as the target firmware upgrade strategy. Then, when performing a firmware upgrade on the second slave device, the firmware upgrade of the second slave device can be completed in the shortest possible time, thereby comprehensively improving the efficiency of slave device firmware upgrades in the entire system.

[0074] In one embodiment, Figure 3 As shown, S700 includes:

[0075] S710: Determine the initial upgrade state of the second slave device as the current upgrade state.

[0076] S720: Determine candidate upgrade states for the next time step, and determine state transition equation values ​​corresponding to each candidate upgrade state according to a preset state transition equation.

[0077] S730 : Determine the upgrade state for the next time step according to the state transition equation value corresponding to each candidate upgrade state.

[0078] S740: Update the upgrade state of the next time step to the current upgrade state.

[0079] S750: Determine whether the current upgrade state is the target upgrade state. The target upgrade state indicates that the second slave device has completed the firmware upgrade. If not, return to S720.

[0080] S760: If yes, determine the target firmware upgrade strategy for the second slave device according to the upgrade status of each time step.

[0081] Among them, the initial upgrade state represents that the second slave device has not completed the firmware upgrade, and the state transition equation value represents the number of second slave devices that have completed the firmware upgrade in the candidate upgrade state. Assume that there are N second slave devices that need firmware upgrade, the communication bandwidth Bi of each second slave device and the size Si of the firmware upgrade package are different, and the total communication bandwidth Btotal of the system is limited. The goal of dynamic programming is to maximize the firmware upgrade efficiency and minimize the overall firmware upgrade time within the limited total communication bandwidth and time. In dynamic programming, the optimal firmware upgrade strategy for each time step can be found by recursively calculating the state transition equation.

[0082] For example, the current upgrade state is that all second slave devices are still in the process of completing the firmware upgrade. Assume that there are three second slave devices, namely device X, device Y, and device Z, which have not completed the firmware upgrade in the current upgrade state. At each time step, it is necessary to find all possible candidate upgrade states for the next time step based on the current actual situation (such as the dependencies between the second slave devices, the remaining communication bandwidth, and other factors). For example, considering the dependencies between the second slave devices, if the upgrade of device Y depends on the firmware upgrade of device X to be completed first, then at a certain time step, when device X has not yet completed the firmware upgrade, there will be no candidate upgrade state for device Y to upgrade its firmware alone. At the same time, the communication bandwidth situation must also be considered. If the current remaining communication bandwidth is not sufficient to support the simultaneous firmware upgrade of some devices, then the state of these devices upgrading their firmware simultaneously cannot be used as a candidate upgrade state. For each candidate upgrade state in the next time step, the state transition equation value can be calculated using a preset state transition equation, where the state transition equation is shown in formula (1):

[0083] (1)

[0084] In formula (1), Indicates that in the previous time step of the current time step, A second slave device is assigned The maximum benefit obtained per unit of communication bandwidth resources, Represents the benefit of allocating unit communication bandwidth resources to the second slave device i. When the communication bandwidth is allocated to the second slave device i, the original basic benefit Add , to reflect the additional benefits brought by allocating communication bandwidth resources to the second slave device i. is the value of the state transition equation, representing the maximum benefit that can be obtained by allocating j units of communication bandwidth resources to the first i second slave devices at time step t. For example, it represents the number of second slave devices that have completed the firmware upgrade in the candidate upgrade state, and can also represent the amount of firmware data transmitted. Specifically, the firmware upgrade packages of some second slave devices can be quickly downloaded and upgraded. If communication bandwidth resources can be preferentially allocated to such second slave devices, the upgrade of multiple second slave devices can be completed in a short period of time, bringing higher benefits.

[0085] It should be noted that some second slave devices may be more critical to the system than others, or some second slave devices may have better performance, allowing for faster firmware upgrades when allocated the same communication bandwidth resources. Alternatively, some second slave devices may have smaller communication bandwidths but can efficiently complete firmware upgrades within the allocated bandwidth resources, resulting in high bandwidth resource utilization. Alternatively, some second slave devices may have firmware upgrades that would impact system security if a firmware upgrade failed, and prioritizing these second slave devices for upgrades can also be considered to yield high returns. Furthermore, a weighted approach can be used to simultaneously consider multiple of these factors when evaluating returns.

[0086] Furthermore, a candidate upgrade state that appears to be optimal at the current time step is selected to enter the next time step. For example, the candidate upgrade state with the largest value of the state transfer equation is selected and determined as the upgrade state for the next time step. The upgrade state for the next time step is then set as the new current upgrade state, thus completing a state update iteration.

[0087] In this way, by recursively calculating the state transition at each time step until the current upgrade state reaches the target upgrade state, the target firmware upgrade strategy is gradually found. Specifically, the current upgrade state is the target upgrade state, and the upgrade state changes at each time step in the entire process can be reviewed. For example, the state transition table shown in Table 1 shows the upgrade state changes at each time step:

[0088] Table 1 State transition table

[0089]

[0090] Then, based on the state transition table, a target firmware upgrade strategy is determined. For example, the upgrade sequence of the second slave devices and the allocation of communication bandwidth resources at each time step can be determined. Then, according to the target firmware upgrade strategy, the firmware upgrade operation for the second slave devices is executed. Furthermore, for the three-dimensional state dynamic programming problem in this embodiment, the time complexity (O(T*N*B)) and space complexity (O(T*N*B)) of the dynamic programming can be calculated. The time complexity focuses on the time required for dynamic programming, representing the increase in the execution time of dynamic programming as the input scale increases. The space complexity focuses on the memory space required during the dynamic programming process, representing the increase in the memory occupied by dynamic programming as the input scale increases. T is the total time, N is the number of second slave devices, and B is the total communication bandwidth of the system. In order to reduce space complexity, a rolling array can be used to store the intermediate states of the dynamic programming process. In some cases, it is not necessary to retain all intermediate upgrade states, only the most recent part of the upgrade state is needed. At this time, a rolling array can be used instead of a regular array to reduce unnecessary space occupation. For example, dp[t][i] represents the upgrade state of the i-th second slave device at the t-th time. However, sometimes, the current upgrade state only depends on the state of the previous time step. At this time, the rolling array strategy can be used to store only the data of the previous time step and the current time step.

[0091] In this embodiment, considering that the importance of different second slave devices, the size of firmware upgrade packages, their own processing capabilities, etc. are different, and the total communication bandwidth resources are often limited, the introduction of state transition equations and the use of dynamic programming can effectively help system administrators formulate firmware upgrade strategies to achieve the best upgrade effect, such as completing the firmware upgrade of all devices in the shortest time, or allowing more important second slave devices to complete the firmware upgrade with high quality first, thereby improving the efficiency of firmware upgrade.

[0092] In one embodiment, the method also includes: determining the valuation function value corresponding to each candidate upgrade state based on the size of the firmware upgrade package of the second slave device, the communication bandwidth, and a preset valuation function, the preset valuation function includes an actual cost function and an estimated cost function, the actual cost function represents the communication bandwidth allocated to the second slave device, and the estimated cost function represents the remaining firmware upgrade time of the second slave device, and determining the upgrade state of the next time step based on the state transition equation value corresponding to the candidate upgrade state and the valuation function value corresponding to each candidate upgrade state.

[0093] Following the above embodiment, in order to shorten the time of screening the upgrade state of the next time step from the candidate upgrade states, a heuristic algorithm, such as the A-star algorithm, can be introduced to combine heuristic search with a cost function to find the target firmware upgrade strategy with the minimum cost.

[0094] Specifically, when planning the firmware upgrade strategy for the second slave device, we not only rely on the state transition equation to judge the pros and cons of different candidate upgrade states, but also introduce a preset evaluation function (including actual cost function and estimated cost function) to comprehensively consider multiple factors such as the allocated resources and the time required for the remaining devices to upgrade, so as to more comprehensively and accurately determine the upgrade state of the next time step. The evaluation function is shown in Equation (2):

[0095] (2)

[0096] In formula (2), This is the actual cost function. In this embodiment, it represents the communication bandwidth allocated to the second slave devices and reflects the communication bandwidth resources already allocated to the second slave devices in the current upgrade state. For example, in a candidate upgrade state, if 5 Mbps, 3 Mbps, and 4 Mbps communication bandwidths have been allocated to three second slave devices, respectively, then the value of this actual cost function is 12 Mbps. Alternatively, it can reflect the specific allocation of communication bandwidth resources to each second slave device. This can be used to measure the current communication bandwidth resource utilization and the remaining communication bandwidth resources that can be allocated subsequently. To estimate the cost function, in this embodiment, the firmware upgrade time of the remaining second slave devices is characterized. By considering the size of the firmware upgrade package of the remaining second slave devices and the communication bandwidth, it is possible to roughly calculate how long it will take to complete the upgrade of these remaining second slave devices, which is used to measure the difficulty and time cost of subsequent firmware upgrades under different candidate upgrade states.

[0097] It should be noted that, assuming that the communication bandwidth has been allocated to the first i second slave devices at the current moment, the actual cost function It can be expressed as the total transmission time spent by all second slave devices up to the current moment, or as the communication bandwidth ratio of the communication bandwidth allocated to the second slave devices to the total communication bandwidth, or as the normalized weighted sum of the total transmission time and the communication bandwidth ratio.

[0098] For example, assume there are three slave devices in the system. For slave A, the firmware upgrade package size Sa = 100MB, and the communication bandwidth Ba = 10Mbps; for slave B, the firmware upgrade package size Sb = 50MB, and the communication bandwidth Bb = 5Mbps; for slave C, the firmware upgrade package size Sc = 80MB, and the communication bandwidth Bc = 2Mbps; and the total bandwidth Btotal = 12Mbps. The estimated firmware upgrade time for slave A is h(A) = Sa / Ba = 100 / 10 = 10 seconds; the estimated firmware upgrade time for slave B is h(B) = Sb / Bb = 50 / 5 = 10 seconds; and the estimated firmware upgrade time for slave C is h(C) = Sc / Bc = 80 / 2 = 40 seconds.

[0099] Furthermore, after obtaining the state transition equation values ​​and the evaluation function values ​​corresponding to each candidate upgrade state, it is necessary to combine these two pieces of information to determine the upgrade state for the next time step. This is because, during the dynamic programming process, if there are N second slave devices, the number of possible firmware upgrade strategies will increase exponentially with the number of second slave devices. Traditional exhaustive search methods require traversing all possible firmware upgrade strategies to find the optimal solution. However, by introducing the aforementioned evaluation function, the search can be guided towards the most promising direction, significantly reducing the search space.

[0100] In this embodiment, by combining heuristic algorithms and dynamic programming, it is possible to find a firmware upgrade strategy that meets the target more quickly and efficiently. In the dynamic programming scenario of this embodiment, the planning goal is to find the target firmware upgrade strategy with the shortest firmware upgrade time. The introduction of the evaluation function can exclude some possible strategies in the search space that obviously deviate from the target firmware upgrade strategy, thereby finding the target firmware upgrade strategy more quickly and improving the firmware upgrade efficiency.

[0101] In one embodiment, Figure 4 As shown, S300 includes:

[0102] S310 , for each slave device, calculating a ratio of the communication bandwidth of the slave device to the size of the firmware upgrade package.

[0103] S320: Determine an upgrade priority of the slave device based on the ratio, where the ratio is positively correlated with the upgrade priority.

[0104] Specifically, the upgrade priority can be calculated based on formula (3):

[0105] (3)

[0106] In formula (3), is the communication bandwidth of the slave device, For the size of the firmware upgrade package, priority is given to those slave devices with high communication bandwidth and small firmware upgrade package to upgrade the firmware first, because these slave devices can complete the firmware upgrade quickly, thereby freeing up the system's communication bandwidth resources. For example, assuming there are 3 slave devices, the communication bandwidth and the size of the firmware upgrade package are: Slave device A: Communication bandwidth = 10Mbps, the size of the firmware upgrade package = 100Mb; Slave device B: communication bandwidth = 5Mbps, the size of the firmware upgrade package = 50MB; Slave device C: communication bandwidth = 2Mbps, the size of the firmware upgrade package = 80MB, the upgrade priority of each slave device is calculated as follows: The upgrade priority of slave device B = 5 / 50=0.1, the upgrade priority of slave device A =5 / 50=0.1, the upgrade priority of slave device C = 2 / 80=0.025. Therefore, slave devices A and B are prioritized for firmware upgrade. Slave device A has a larger communication bandwidth, so although the firmware upgrade package is larger, it can still be completed quickly. Slave device B can also complete the upgrade quickly because the firmware upgrade package is smaller.

[0107] In this embodiment, under the action of the greedy algorithm, the firmware upgrade order of each slave device is the optimal solution based on the current system state, which means that the optimal slave device is selected for firmware distribution. By giving priority to slave devices with smaller firmware upgrade packages and larger communication bandwidth, the upgrade of some slave devices can be completed quickly, thereby reducing the number of slave devices waiting for upgrade in the system, utilizing the largest possible bandwidth and the smallest possible waiting time, reducing the waste of communication bandwidth resources, and improving the efficiency of firmware upgrade.

[0108] In one embodiment, Figure 5 As shown, S500 includes:

[0109] S510: Filter out the first slave device with the highest upgrade priority.

[0110] S520 : When there are multiple first slave devices screened out, determine a firmware upgrade order for the first slave devices according to sizes of firmware upgrade packages of the first slave devices.

[0111] S530: Perform firmware upgrade on the first slave device according to the firmware upgrade sequence of the first slave device.

[0112] Continuing with the above embodiment, based on the ratio of communication bandwidth to firmware upgrade package size, which is positively correlated with the upgrade priority, all slave devices are evaluated and sorted, and those slave devices with the highest upgrade priority are screened out and marked as the first slave devices. In extreme cases, if a large number of slave devices have the same priority, without further prioritization, problems such as bandwidth competition and storage / processing bottlenecks may arise. That is, when multiple slave devices download the firmware upgrade package at the same time, they may consume too much communication bandwidth resources, resulting in a decrease in transmission speed, and may even cause timeouts or transmission errors. In addition, the processing power and storage space of the slave devices are limited. If multiple slave devices perform firmware reception and verification operations at the same time, it may cause resource overload and increase the risk of failure.

[0113] Therefore, when there are multiple first slave devices with the highest upgrade priority, the specific upgrade order can be determined based on the size of their firmware upgrade packages. For example, slave devices with smaller firmware upgrade packages are upgraded first. The upgrade priority of slave device B is Pb = 5 / 50=0.1, and the upgrade priority of slave device A is Pa=5 / 50=0.1. Since the firmware upgrade package of slave device B is relatively small, the firmware of slave device B is upgraded.

[0114] Furthermore, when multiple slave devices have the same upgrade priority, a secondary upgrade priority strategy can be introduced, such as fine-grained sorting based on slave device identification, network access time, firmware upgrade package size, or the current status of the slave device (e.g., whether it's idle). Alternatively, a batch distribution strategy can be adopted to divide slave devices with the same upgrade priority into several groups, distributing the firmware gradually rather than all at once. For example, each batch can be distributed to N slave devices, waiting for these slave devices to complete receiving before distributing to the next batch of slave devices, or a maximum number of slave devices that can be upgraded in parallel can be set, limiting the number of slave devices that can upgrade their firmware at any one time. Download speeds can also be dynamically allocated to each slave device based on its communication bandwidth and the currently available communication bandwidth. By optimizing bandwidth allocation, the problem of all slave devices simultaneously consuming too much bandwidth, leading to resource constraints, can be reduced.

[0115] In this embodiment, by first screening out the first slave device with the highest upgrade priority for firmware upgrade, those slave devices that are theoretically upgraded faster or are more important to the system can complete the firmware upgrade first. If there are multiple slave devices with the highest upgrade priority, a subdivided priority strategy or a batch upgrade strategy can be introduced to reduce the problem of multiple slave devices consuming too much bandwidth at the same time, resulting in resource constraints.

[0116] In order to make a clearer description of the firmware upgrade method provided by this application, the following is a specific embodiment and the attached Figure 6To illustrate, this specific embodiment includes the following steps:

[0117] S601 : Obtain a firmware upgrade package and a communication bandwidth of each slave device, and calculate, for each slave device, a ratio of the communication bandwidth of the slave device to the size of the firmware upgrade package.

[0118] S602 : Determine the upgrade priority of the slave device based on the ratio, where the ratio is positively correlated with the upgrade priority, and select the first slave device with the highest upgrade priority.

[0119] S603: When there are multiple first slave devices screened out, determine a firmware upgrade order for the first slave devices according to the sizes of the firmware upgrade packages of the first slave devices, and perform firmware upgrades on the first slave devices according to the firmware upgrade order of the first slave devices.

[0120] S604: Determine the initial upgrade state of the second slave device as the current upgrade state.

[0121] S605, determine the candidate upgrade state of the next time step, determine the state transition equation value corresponding to each candidate upgrade state according to the preset state transition equation, and determine the valuation function value corresponding to each candidate upgrade state according to the size of the firmware upgrade package of the second slave device, the communication bandwidth, and the preset valuation function.

[0122] S606: Determine the upgrade state of the next time step based on the state transition equation value corresponding to the candidate upgrade state and the evaluation function value corresponding to each candidate upgrade state, and update the upgrade state of the next time step to the current upgrade state.

[0123] S607 , determining whether the current upgrade state is the target upgrade state. The target upgrade state indicates that the second slave devices have completed the firmware upgrade. If not, return to S606 .

[0124] S608: If yes, determine the target firmware upgrade policy for the second slave device according to the upgrade status of each time step, and perform firmware upgrade on the second slave device according to the target firmware upgrade policy.

[0125] It should be understood that, although the various steps in the flowcharts involved in the various embodiments described above are displayed in sequence according to the instructions of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowcharts involved in the various embodiments described above can include multiple steps or multiple stages, and these steps or stages are not necessarily executed and completed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of steps or stages in other steps.

[0126] In one embodiment, the present application also provides a firmware upgrade system 700, such as Figure 7 As shown, the firmware upgrade system 700 includes a master device 710 and a plurality of slave devices 720 connected to each other.

[0127] The master control device 710 is configured to obtain a firmware upgrade package and a communication bandwidth from each slave device 720, determine an upgrade priority for each slave device 720 based on the size of the firmware upgrade package and the communication bandwidth, select a first slave device 720 having the highest upgrade priority, send the firmware upgrade package of the first slave device 720 to the first slave device 720, and allocate communication bandwidth to the first slave device 720; and determine a target firmware upgrade policy for each second slave device 720 other than the first slave device 720, the target firmware upgrade policy being a firmware upgrade policy with the shortest firmware upgrade time; send the firmware upgrade package of the second slave device 720 to the second slave device 720 based on the target firmware upgrade policy, and allocate communication bandwidth to the second slave device 720;

[0128] The slave device 720 is configured to receive the firmware upgrade package, perform integrity verification on the firmware upgrade package, and install the firmware upgrade package if the firmware upgrade package passes the integrity verification.

[0129] Specifically, master device 710 combines a greedy algorithm and dynamic programming to distribute firmware upgrade packages and allocate communication bandwidth to slave device 720. Slave device 720 downloads the firmware upgrade package and then performs an integrity check on the firmware upgrade package to determine whether the firmware upgrade package has been damaged during transmission. The integrity check method includes, but is not limited to, using MD5 checksum when downloading the firmware upgrade package from slave device 720. The firmware upgrade package contains an MD5 checksum value (a 32-character hash value), which is the hash result of the entire firmware upgrade package. After downloading the firmware upgrade package, slave device 720 also calculates an MD5 checksum based on the received firmware upgrade package. After the download is complete, the calculated MD5 checksum is compared with the MD5 checksum value carried in the firmware upgrade package. If the two match, the downloaded firmware upgrade package is complete and correct. If they do not match, the firmware upgrade package data is corrupted during the download process and needs to be downloaded again.

[0130] The firmware upgrade package uses CRC16 checksum when it is transmitted. During the transmission process, the firmware upgrade package is usually split into multiple data packets. Each data packet is accompanied by a CRC16 checksum value (a 16-bit checksum). Whenever a data packet arrives at the slave device 720, the slave device 720 will recalculate the CRC16 value of the received data packet and compare it with the CRC16 value in the data packet. If the two are consistent, the data packet is complete. If the two are inconsistent, it means that an error occurred during the transmission of the data packet and the slave device requests to resend the data packet.

[0131] It should be noted that the specific greedy algorithm and dynamic programming strategy have been described in detail in the above firmware upgrade method embodiment and will not be repeated here.

[0132] In one embodiment, Figure 8 As shown, the firmware upgrade system 700 also includes a networking module 730 connected to the master device 710, which is used to obtain the firmware version information of each slave device 720 and the latest firmware version information. When the firmware version information does not match the latest firmware version information, the firmware upgrade package of each slave device 720 is obtained and the firmware upgrade package of each slave device 720 is sent to the master device.

[0133] Specifically, the master device 710 may send the firmware version information of the slave device 720 to the networking module 730, and the networking module 730 may periodically obtain the latest firmware version information from the upgrade server, compare the firmware version information of the slave device 720 with the latest firmware version information, and determine whether the slave device 720 requires a firmware upgrade. For example, the system 700 may determine whether the firmware version number is incremented, whether the slave device 720 is compatible with the new firmware, whether the upgrade is mandatory, the security verification of the firmware upgrade package (such as signature verification), and the current status of the slave device 720 (such as battery level, network conditions, etc.). Only when these conditions are met will the system 700 perform subsequent firmware upgrade operations.

[0134] In addition, during the firmware upgrade of the slave device 720 , the master device 710 monitors the upgrade status of the slave device 720 in real time and feeds back the status to the networking module 730 so that the user or server can monitor the firmware upgrade process of the slave device 720 in real time.

[0135] Based on the same inventive concept, embodiments of the present application also provide a firmware upgrade device for implementing the aforementioned firmware upgrade method. The solution provided by this device is similar to the solution described in the aforementioned method. Therefore, the specific limitations of one or more firmware upgrade device embodiments provided below can be found in the aforementioned limitations of the firmware upgrade method and will not be further elaborated here.

[0136] In one embodiment, Figure 9 As shown, a firmware upgrade device 800 is provided, comprising: a data acquisition module 810, a priority determination module 820, a first firmware upgrade module 830, a policy formulation module 840, and a second firmware upgrade module 850, wherein:

[0137] The data acquisition module 810 is used to acquire the firmware upgrade package and communication bandwidth of each slave device.

[0138] The priority determination module 820 is configured to determine the upgrade priority of each slave device according to the size of the firmware upgrade package and the communication bandwidth.

[0139] The first firmware upgrade module 830 is configured to screen out a first slave device with the highest upgrade priority and perform firmware upgrade on the first slave device.

[0140] The policy formulation module 840 is configured to determine a target firmware upgrade policy for the remaining second slave devices except the first slave device, where the target firmware upgrade policy is a firmware upgrade policy with the shortest firmware upgrade time.

[0141] The second firmware upgrade module 850 is configured to upgrade the firmware of the second slave device according to the target firmware upgrade policy.

[0142] In one embodiment, the policy formulation module 840 is also used to determine the initial upgrade state of the second slave device as the current upgrade state, the initial upgrade state indicates that the second slave device has not completed the firmware upgrade, determine the candidate upgrade state for the next time step, determine the state transfer equation value corresponding to each candidate upgrade state according to a preset state transfer equation, the state transfer equation value indicates the number of second slave devices that have completed the firmware upgrade under the candidate upgrade state, determine the upgrade state for the next time step according to the state transfer equation value corresponding to each candidate upgrade state, update the upgrade state for the next time step to the current upgrade state, and execute the step of determining the candidate upgrade state for the next time step again until the current upgrade state is the target upgrade state, and obtain the upgrade state of the second slave device at each time step, the target upgrade state indicates that the second slave devices have completed the firmware upgrade, and the upgrade state indicates the upgrade status of the second slave device at each time step, and determine the target firmware upgrade policy for the second slave device according to the upgrade state at each time step.

[0143] In one embodiment, the firmware upgrade apparatus 800 is further configured to determine a valuation function value corresponding to each candidate upgrade state based on the size of the firmware upgrade package of the second slave device, the communication bandwidth, and a preset valuation function. The preset valuation function includes an actual cost function and an estimated cost function. The actual cost function represents the communication bandwidth allocated to the second slave device, and the estimated cost function represents the remaining firmware upgrade time for the second slave device. The strategy formulation module 840 is further configured to determine the upgrade state for the next time step based on the state transition equation value corresponding to the candidate upgrade state and the valuation function value corresponding to each candidate upgrade state.

[0144] In one embodiment, the priority determination module 820 is further used to calculate the ratio of the communication bandwidth of each slave device to the size of the firmware upgrade package, and determine the upgrade priority of the slave device based on the ratio, where the ratio is positively correlated with the upgrade priority.

[0145] In one embodiment, the first firmware upgrade module 830 is also used to screen out the first slave device with the highest upgrade priority. When there are multiple first slave devices screened out, the firmware upgrade order of the first slave devices is determined according to the size of the firmware upgrade package of the first slave device, and the firmware of the first slave device is upgraded according to the firmware upgrade order of the first slave device.

[0146] Each module in the aforementioned firmware upgrade device may be implemented in whole or in part through software, hardware, or a combination thereof. Each module may be embedded in or independent of a processor in a computer device in the form of hardware, or may be stored in a memory in the computer device in the form of software, so that the processor can call and execute the corresponding operations of each module.

[0147] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 10 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O) and a communication interface. The processor, memory and input / output interface are connected via a system bus, and the communication interface is connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The database of the computer device is used to store data such as firmware upgrade packages and communication bandwidth of each slave device. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a firmware upgrade method is implemented.

[0148] Those skilled in the art will understand that Figure 10 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.

[0149] In one embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the processor implements the steps in the above firmware upgrade method embodiment when executing the computer program.

[0150] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned firmware upgrade method embodiment are implemented.

[0151] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above firmware upgrade method embodiment when executed by a processor.

[0152] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions.

[0153] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the above-mentioned embodiments. In particular, any reference to memory, database, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The databases involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, distributed databases based on blockchains. The processors involved in the various embodiments provided herein may be, but are not limited to, general-purpose processors, central processing units (CPUs), graphics processing units (GPUs), digital signal processors (DSPs), programmable logic devices (PLDs), data processing logic devices based on quantum computing, and the like.

[0154] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0155] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present application. It should be noted that a person of ordinary skill in the art may make various modifications and improvements without departing from the spirit of the present application, and these modifications and improvements fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.

Claims

1. A firmware upgrade method, characterized in that: The method comprises: Obtain the firmware upgrade package and communication bandwidth of each slave device; Determining the upgrade priority of each slave device according to the size of the firmware upgrade package and the communication bandwidth; For slave devices with the same upgrade priority, priority sorting is performed on the slave devices with the same upgrade priority according to the identification of the slave devices, the time sequence of accessing the network, the size of the firmware upgrade package of the slave devices, or the current status of the slave devices, and the upgrade priority of each slave device is updated; Screening out the first slave device with the highest upgrade priority, and performing firmware upgrade on the first slave device; For the second slave devices remaining except the first slave device, the initial upgrade state of the second slave device is determined as the current upgrade state, the initial upgrade state represents that the second slave device has not completed the firmware upgrade, the candidate upgrade state of the next time step is determined, and the state transfer equation value corresponding to each candidate upgrade state is determined according to a preset state transfer equation, the state transfer equation value represents the number of second slave devices that have completed the firmware upgrade in the candidate upgrade state, and the valuation function value corresponding to each candidate upgrade state is determined according to the size of the firmware upgrade package of the second slave device, the communication bandwidth, and a preset valuation function, the preset valuation function includes an actual cost function and an estimated cost function, the actual cost function represents the communication bandwidth allocated to the second slave device, and the estimated cost function represents the communication bandwidth allocated to the second slave device. A cost function represents the firmware upgrade time of the remaining second slave devices; an upgrade state for a next time step is determined according to the state transition equation value corresponding to the candidate upgrade state and the evaluation function value corresponding to each candidate upgrade state; the upgrade state for the next time step is updated to the current upgrade state; the process returns to the step of determining the candidate upgrade state for the next time step until the current upgrade state is a target upgrade state; an upgrade state for the second slave device at each time step is obtained; the target upgrade state represents that the second slave devices have completed the firmware upgrade; the upgrade state represents the upgrade status of the second slave device at each time step; a target firmware upgrade strategy for the second slave device is determined according to the upgrade strategy at each time step; the target firmware upgrade strategy is a firmware upgrade strategy with the shortest firmware upgrade time; Acquire a device status of a second slave device, and adjust the target firmware upgrade policy according to the device status of the second slave device; Performing firmware upgrade on the second slave device according to the adjusted target firmware upgrade policy.

2. The method according to claim 1, characterized in that Determining the upgrade priority of each slave device according to the size of the firmware upgrade package and the communication bandwidth includes: For each slave device, calculating a ratio of a communication bandwidth of the slave device to a size of the firmware upgrade package; An upgrade priority of the slave device is determined based on the ratio, wherein the ratio is positively correlated with the upgrade priority.

3. The method according to claim 1, characterized in that Screening out the first slave device with the highest upgrade priority and performing firmware upgrade on the first slave device includes: Filtering out the first slave device with the highest upgrade priority; In a case where there are multiple first slave devices screened out, determining a firmware upgrade order for the first slave devices according to sizes of firmware upgrade packages of the first slave devices; Performing firmware upgrade on the first slave device according to the firmware upgrade sequence of the first slave device.

4. A firmware upgrade system, characterized in that: The system includes a master device and a plurality of slave devices connected to each other; The master control device is used to obtain the firmware upgrade package and communication bandwidth of each slave device, determine the upgrade priority of each slave device according to the size of the firmware upgrade package and the communication bandwidth, and for slave devices with the same upgrade priority, sort the slave devices with the same upgrade priority according to the identifier of the slave device, the time sequence of access to the network, the size of the firmware upgrade package of the slave device or the current state of the slave device, update the upgrade priority of each slave device, screen out the first slave device with the highest upgrade priority, send the firmware upgrade package of the first slave device to the first slave device, and perform a maintenance for the first slave device. Allocate communication bandwidth; for the second slave devices remaining except the first slave device, determine the initial upgrade state of the second slave device as the current upgrade state, the initial upgrade state indicates that the second slave device has not completed the firmware upgrade, determine the candidate upgrade state of the next time step, and determine the state transfer equation value corresponding to each candidate upgrade state according to a preset state transfer equation, the state transfer equation value indicates the number of second slave devices that have completed the firmware upgrade in the candidate upgrade state, and determine the evaluation function corresponding to each candidate upgrade state according to the size of the firmware upgrade package of the second slave device, the communication bandwidth, and the preset evaluation function. Value, the preset evaluation function includes an actual cost function and an estimated cost function, the actual cost function represents the communication bandwidth allocated to the second slave device, the estimated cost function represents the firmware upgrade time of the remaining second slave devices, according to the state transition equation value corresponding to the candidate upgrade state, and the evaluation function value corresponding to each candidate upgrade state, determine the upgrade state of the next time step, update the upgrade state of the next time step to the current upgrade state, return to the step of determining the candidate upgrade state for the next time step, until the current upgrade state is the target upgrade state, and obtain the upgrade state of the second slave device at each time step. a level status, wherein the target upgrade status indicates that the second slave devices have completed the firmware upgrade, the upgrade status indicates the upgrade status of the second slave devices at each time step, determining a target firmware upgrade policy for the second slave device according to the upgrade status at each time step, the target firmware upgrade policy being a firmware upgrade policy with the shortest firmware upgrade time, obtaining a device status of the second slave device, adjusting the target firmware upgrade policy according to the device status of the second slave device, sending a firmware upgrade package of the second slave device to the second slave device according to the adjusted target firmware upgrade policy, and allocating communication bandwidth to the second slave device; The slave device is configured to receive the firmware upgrade package, perform an integrity check on the firmware upgrade package, and install the firmware upgrade package if the firmware upgrade package passes the integrity check.

5. The system according to claim 4, characterized in that The system also includes a networking module connected to the master device, which is used to obtain the firmware version information of each of the slave devices and the latest firmware version information. If the firmware version information does not match the latest firmware version information, the system obtains the firmware upgrade package of each of the slave devices and sends the firmware upgrade package of each of the slave devices to the master device.

6. A firmware upgrade device, characterized in that: The device comprises: Data acquisition module, used to obtain the firmware upgrade package and communication bandwidth of each slave device; a priority determination module, configured to determine an upgrade priority of each slave device based on the size of the firmware upgrade package and the communication bandwidth, and, for slave devices with the same upgrade priority, prioritize the slave devices with the same upgrade priority based on their identifiers, the time sequence of network access, the size of the firmware upgrade package of the slave device, or the current state of the slave device, and update the upgrade priority of each slave device; a first firmware upgrade module, configured to screen out the first slave device with the highest upgrade priority and perform firmware upgrade on the first slave device; a policy formulation module for determining, for the remaining second slave devices except the first slave device, an initial upgrade state of the second slave device as the current upgrade state, the initial upgrade state representing that the second slave device has not completed the firmware upgrade, determining a candidate upgrade state for the next time step, determining a state transition equation value corresponding to each candidate upgrade state according to a preset state transition equation, the state transition equation value representing the number of second slave devices that have completed the firmware upgrade in the candidate upgrade state, determining a valuation function value corresponding to each candidate upgrade state according to the size of the firmware upgrade package of the second slave device, the communication bandwidth, and a preset valuation function, the preset valuation function including an actual cost function and an estimated cost function, the actual cost function representing the communication bandwidth allocated to the second slave device, The estimated cost function represents the firmware upgrade time of the remaining second slave devices; the upgrade state of the next time step is determined according to the state transition equation value corresponding to the candidate upgrade state and the evaluation function value corresponding to each candidate upgrade state; the upgrade state of the next time step is updated to the current upgrade state; the process returns to the step of determining the candidate upgrade state of the next time step until the current upgrade state is the target upgrade state; the upgrade state of the second slave device at each time step is obtained; the target upgrade state represents that the firmware upgrade of each second slave device has been completed; the upgrade state represents the upgrade status of the second slave device at each time step; the target firmware upgrade strategy of the second slave device is determined according to the upgrade strategy of each time step; the target firmware upgrade strategy is the firmware upgrade strategy with the shortest firmware upgrade time; The apparatus is further configured to: obtain a device status of a second slave device, and adjust the target firmware upgrade policy according to the device status of the second slave device; The second firmware upgrade module is configured to perform firmware upgrade on the second slave device according to the adjusted target firmware upgrade policy.

7. The device according to claim 6, characterized in that The priority determination module is further configured to calculate, for each slave device, a ratio of the communication bandwidth of the slave device to the size of the firmware upgrade package, and determine an upgrade priority of the slave device based on the ratio, wherein the ratio is positively correlated with the upgrade priority.

8. The device according to claim 6, characterized in that The first firmware upgrade module is also used to screen out the first slave device with the highest upgrade priority. When there are multiple first slave devices screened out, the firmware upgrade order of the first slave devices is determined according to the size of the firmware upgrade package of the first slave device, and the firmware of the first slave device is upgraded according to the firmware upgrade order of the first slave device.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 3 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 3 are implemented.

Citation Information

Patent Citations

  • Security-based multi-device software upgrading method

    CN117850837A

  • Remote upgrading method and device for vehicle software and firmware and vehicle

    CN118714550A