A method and device for remotely upgrading dual systems of embedded software for outdoor power supply
By adopting the dual-system remote upgrade method in outdoor power embedded software and using the Bootloader module for system checksum update, the problem of remote upgrades in the existing technology is easily interrupted or caused system failure, and an efficient update process without restarting the system is realized.
Patent Information
- Application Number
- CN202210278353.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-17
- Publication Date
- 2025-05-02
- Estimated Expiration
- 2042-03-17
AI Technical Summary
Existing outdoor power embedded software can easily cause interruption or system failure during remote upgrades, which may cause equipment damage and safety accidents.
The dual-system remote upgrade method is adopted, and the first system or the second system is booted through the Bootloader module to perform checksum updates, and the update is achieved without restarting the system by jumping to another system to complete the update function.
Improve update efficiency, ensure that other tasks in the system run normally during the update process and are not interrupted, avoiding the problem of update failure or system inability to recover.
Smart Images

Figure CN115309436B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of embedded software upgrade and update, and in particular relates to a method and device for remotely upgrading dual systems of embedded software of an outdoor power supply. Background Art
[0002] With the rapid development of social economy and the continuous improvement of people's material needs, lithium batteries are the only choice to solve environmental problems. Many mobile terminals need lithium batteries and control systems for lithium batteries as outdoor power sources during operation. Lithium battery technology is also becoming more and more mature, so lithium batteries have good development prospects as power sources for outdoor mobile devices or terminals. For example, new energy vehicles that use lithium batteries as new energy sources are one of the ways to use lithium batteries as outdoor power sources. The annual growth rate of the number of cars in my country has remained high, and there are more and more vehicles. The application of advanced technology is one of the effective means to improve transportation conditions. At present, most vehicles are equipped with on-board monitoring terminals, which can collect various vehicle information and lithium battery power and operation information and upload them to the monitoring platform. The on-board monitoring terminal plays an indispensable role in the use of lithium batteries as new energy sources for outdoor power sources. The research and development of terminals is a major technical hotspot at present. Its application can ensure the safe and reliable operation of electric vehicles, complete the real-time monitoring of the lithium battery energy information transmission of vehicles, improve the efficiency of public transportation operation management and the operation management of the vehicle, and realize reasonable scheduling and convenient management of electric vehicles.
[0003] At present, most outdoor power supplies on the market do not have the remote upgrade function, which causes inconvenience to software iteration upgrades and remote debugging and troubleshooting. At present, during the remote upgrade process of embedded microcontrollers, other tasks will be blocked and interrupted. In outdoor power supplies, control failure may cause overheating, battery overcharge and overdischarge, battery overvoltage, etc., causing equipment damage, affecting service life, and even causing safety accidents.
[0004] During the update process of an embedded microcontroller, if the update is interrupted due to factors such as device power failure or network interruption, or if unverified firmware is updated, it may cause the system to fail and be unrecoverable. Summary of the invention
[0005] In view of the above-mentioned defects, the present invention provides a dual-system remote upgrade method for outdoor power embedded software, which can directly jump to the new system operation after the update is completed without restarting the system, thereby improving the update efficiency.
[0006] The present invention provides the following technical solution: a method for remotely upgrading dual systems of embedded software of an outdoor power supply, comprising the following steps:
[0007] S1: The server sends communication data to the embedded control chip of the outdoor power supply according to the offset address information of the first system MCU and the second system MCU of the outdoor power supply;
[0008] S2: The Bootloader module in the embedded control chip determines and boots the first system or the second system according to the communication data sent in step S1, and verifies the first system or the second system;
[0009] S3: If the verification fails, the update is stopped. If a system is verified, the system executes the shielded interrupt, reinitializes the MSP and PSP stack pointers, and jumps to another system by modifying the PC register;
[0010] S4: Check whether another system is running normally; if it is running normally, modify the startup flag bit, and the next boot can enter the updated system; if it is running abnormally, the watchdog resets and restarts the MCU, and the Bootloader module reboots and recovers to the original system.
[0011] Furthermore, in the step S1, the communication data sent by the server to the embedded control chip of the outdoor power supply includes a binary update file of the system to be updated and a verification code.
[0012] Furthermore, the step S2 includes the following steps:
[0013] S21: When the first system is started, the server sends communication data of the second system;
[0014] S22: The first system MCU burns the sent communication data into the second system partition, and then verifies the second system;
[0015] S23: when the second system is started, the server sends the communication data of the first system;
[0016] S24: The second system MCU burns the sent communication data into the first system partition, and then verifies the second system.
[0017] Furthermore, in the step S1, the method for the server to form the communication data to be sent according to the offset address information of the first system MCU and the second system MCU of the outdoor power supply includes the following steps:
[0018] S11: The server optimizes the offset address information of the first system MCU and the second system MCU by performing a global random walk using Levi Flight:
[0019]
[0020] Among them, g represents the number of current address information; α is the length of the offset from the address information, represents the Kronecker product, levy(·) is the iterative optimization calculation model with the Levy flight iteration interval of λ;
[0021] S12: In order to generate random numbers with symmetric distribution for flight, first obtain solutions X one by one from the initial population L i , and then build a new vector generation model to generate a new vector X i new Replace initial solution X i :
[0022]
[0023] Where W is the inertia coefficient, s is the step size, r is a random value, r∈[0,1], ε∈[0,1];
[0024] S13: Determine the new vector X i new Is the function value of the solution f(X) the maximum function value among the solutions obtained in the initial population? i new )>f(X j new ), i≠j and i,j∈L, if so, then determine the new vector X i new The optimal solution X best , otherwise repeat steps S11 to S12.
[0025] Furthermore, the iterative optimization calculation model with the Levy flight iteration interval λ in step S11 is as follows:
[0026] levy(λ)=t -λ , 1<λ≤5; where t is the number of iterations.
[0027] Furthermore, the step length s of step S12 satisfies the following conditions:
[0028] s=0.01×m×(X i -X best ), where m is the step coefficient.
[0029] Furthermore, the calculation formula of the step coefficient m is as follows:
[0030]
[0031] Where σ(β) is the standard deviation and β is a fixed constant for step coefficient calculation.
[0032] Furthermore, the calculation formula of the standard deviation σ(β) is as follows:
[0033]
[0034] Here, γ(·) is the gamma function.
[0035] Furthermore, the step coefficient calculation fixed constant has a value range of 1≤β≤3.
[0036] The present invention also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of the outdoor power embedded software dual-system remote upgrade method as described above are implemented.
[0037] The beneficial effects of the present invention are:
[0038] 1. The present invention adopts a Bootloader booting dual system mode in the embedded control chip of the outdoor power supply. When running system A, system B is updated. When running system B, system A is updated. After the update is completed, the update system is jumped to run, so that other tasks of the system can run normally without interruption during the update process.
[0039] 2. The method provided by the present invention can realize that after the embedded control chip of the outdoor power supply is updated to a new system, if an error occurs and causes the system to reset and restart, or the device is powered off and causes the update to be interrupted, the Bootloader can guide the normal system before the update, avoiding the problem of update failure or updating unverified firmware that causes the system to be unable to recover.
[0040] 3. After the update is completed, there is no need to restart the system, and the system can be directly jumped to the new system to improve the update efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] The present invention will be described in more detail below based on embodiments and with reference to the accompanying drawings, wherein:
[0042] Figure 1 A schematic diagram of a dual-system remote upgrade method for an outdoor power supply embedded software provided by the present invention;
[0043] Figure 2 A flowchart of a method for the server to generate and send the communication data in step S1 provided by the present invention.
[0044] Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making any creative work shall fall within the scope of protection of this application.
[0045] It should be noted that the descriptions of "first", "second", etc. in this application are only for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in this field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.
[0046] Secondly, all directional indications in the embodiments of the present application (such as up, down, left, right, front, back, etc.) are only used to explain the relative position relationship, movement status, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly. The connection can be a direct connection or an indirect connection. DETAILED DESCRIPTION
[0047] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0048] Example 1
[0049] like Figure 1 As shown, a method for remotely upgrading dual systems of embedded software of an outdoor power supply provided by the present invention comprises the following steps:
[0050] S1: The server sends communication data to the embedded control chip of the outdoor power supply according to the offset address information of the first system MCU and the second system MCU of the outdoor power supply;
[0051] S2: The Bootloader module in the embedded control chip determines to boot and start the first system (system A) or the second system (system B) according to the communication data sent in step S1, and verifies the first system or the second system;
[0052] Specifically, S21: when the first system (system A) is started, the server sends the communication data (ie, update file) of the second system (system B);
[0053] S22: The first system MCU burns the sent communication data into the second system partition (system B partition), and then verifies the second system (system B);
[0054] S23: When the second system (system B) is started, the server sends the communication data (i.e., update file) of the first system (system A);
[0055] S24: The second system MCU burns the sent communication data into the first system partition (system A partition), and then verifies the second system (system A).
[0056] S3: If the verification fails, the update is stopped. If a system is verified, the system executes the shielded interrupt, reinitializes the MSP and PSP stack pointers, and jumps to another system by modifying the PC register;
[0057] S4: Check whether another system is running normally; if it is running normally, modify the startup flag bit, and the next boot can enter the updated system; if it is running abnormally, the watchdog resets and restarts the MCU, and the Bootloader module reboots and recovers to the original system.
[0058] like Figure 1 As shown, if the first system (system A) successfully verifies the second system (system B), the interrupt is masked, the MSP and PSP stack pointers are reinitialized, and the second system (system B) is jumped to run by modifying the PC register. After detecting that the second system (system B) runs normally, the startup flag is modified, and the upgrade is successful. The next boot can enter the updated system; if the operation is abnormal, the watchdog resets and restarts the MCU, and the Bootloader module reboots to restore the original system operation, and the update fails.
[0059] Furthermore, in step S1, the communication data sent by the server to the embedded control chip of the outdoor power supply includes a binary update file of the system to be updated and a check code.
[0060] Example 2
[0061] like Figure 1 As shown, a method for remotely upgrading dual systems of embedded software of an outdoor power supply provided by the present invention comprises the following steps:
[0062] S1: The server sends communication data to the embedded control chip of the outdoor power supply according to the offset address information of the first system MCU and the second system MCU of the outdoor power supply;
[0063] S2: The Bootloader module in the embedded control chip determines to boot and start the first system (system A) or the second system (system B) according to the communication data sent in step S1, and verifies the first system or the second system; specifically, the following steps are included:
[0064] S21: When the first system (system A) is started, the server sends the communication data (i.e., update file) of the second system (system B);
[0065] S22: The first system MCU burns the sent communication data into the second system partition (system B partition), and then verifies the second system (system B);
[0066] S23: When the second system (system B) is started, the server sends the communication data (i.e., update file) of the first system (system A);
[0067] S24: the second system MCU burns the sent communication data into the first system partition (system A partition), and then verifies the second system (system A);
[0068] S3: If the verification fails, the update is stopped. If a system is verified, the system executes the shielded interrupt, reinitializes the MSP and PSP stack pointers, and jumps to another system by modifying the PC register;
[0069] S4: Check whether another system is running normally; if it is running normally, modify the startup flag bit, and the next boot can enter the updated system; if it is running abnormally, the watchdog resets and restarts the MCU, and the Bootloader module reboots and recovers to the original system.
[0070] like Figure 1 As shown, if the first system (system A) successfully verifies the second system (system B), the interrupt is masked, the MSP and PSP stack pointers are reinitialized, and the second system (system B) is jumped to run by modifying the PC register. After detecting that the second system (system B) runs normally, the startup flag is modified, and the upgrade is successful. The next boot can enter the updated system; if the operation is abnormal, the watchdog resets and restarts the MCU, and the Bootloader module reboots to restore the original system operation, and the update fails.
[0071] In step S1, the method in which the server generates and sends the communication data according to the offset address information of the first system MCU and the second system MCU of the outdoor power supply includes the following steps:
[0072] S11: The server optimizes the offset address information of the first system MCU and the second system MCU by performing a global random walk using Levi Flight:
[0073]
[0074] Among them, g represents the number of current address information; α is the length of the offset from the address information, represents the Kronecker product, levy(·) is the iterative optimization calculation model with the Levy flight iteration interval of λ;
[0075] levy(λ)=t -λ , 1<λ≤5;
[0076] Where t is the number of iterations.
[0077] Since Lévy flights have infinite mean and variance, iterative optimization methods using Lévy flights can explore the search space more efficiently than other standard Gaussian process algorithms. The combination of local search capabilities and guaranteed global convergence makes the iterative optimization solution very efficient.
[0078] The Lévy flight is classified as a Markov process, where after a large number of steps the distances from the origin of the random walk converge to a stable distribution. Statistically speaking, this is achieved by a random process with stationary and independent increments.
[0079] To generate random numbers with a symmetric Levy distribution, generate random numbers X according to a symmetric Levy flight-stable distribution i new The algorithm starts by taking the solutions one by one from the initial population and then replaces it with a new vector generated using the following steps: The generated new embedding is given by the following formula:
[0080] S12: In order to generate random numbers with symmetric distribution for flight, first obtain solutions X one by one from the initial population L i , and then build a new vector generation model to generate a new vector X i new Replace initial solution X i :
[0081]
[0082] Where W is the inertia coefficient, s is the step size, r is a random value, r∈[0,1], ε∈[0,1], preferably ε is 0.25;
[0083] s=0.01×m×(X i -X best );
[0084] Where m is the step factor. The step factor must be set appropriately to ensure that the Levy flight is not too radical, which would cause the new solution to jump out of the design domain;
[0085] The calculation formula of step coefficient m is as follows:
[0086]
[0087] Where σ(β) is the standard deviation and β is a fixed constant for step coefficient calculation;
[0088] The calculation formula of standard deviation σ(β) is as follows:
[0089]
[0090] Where, Υ(·) is the gamma function;
[0091] S13: Determine the new vector X i new Is the function value of the solution f(X) the maximum function value among the solutions obtained in the initial population? i new )>f(X j new ), i≠j and i,j∈L, if so, then determine the new vector X i new The optimal solution X best , otherwise repeat steps S11 to S12.
[0092] Furthermore, the value range of the fixed constant for calculating the step coefficient is 1≤β≤3, preferably 0.4≤β≤1.8.
[0093] The method provided by the present invention can first enable the server to send the update file and the verification code generated according to different system offset addresses according to the system information uploaded by the MCU of the outdoor power supply.
[0094] The present invention divides the Flash memory of the embedded control chip of the outdoor power supply into four areas to store the boot program, system A, system B, and system parameters respectively. The remote update of the embedded control chip of the outdoor power supply adopts a dual-system form. When one of the system programs is running, the update firmware is written into another system storage area.
[0095] The boot program of the embedded control chip of the outdoor power supply using the method provided by the present invention starts the system program from different addresses of the memory by judging the startup flag. The system program of the embedded control chip of the outdoor power supply changes the system started by the boot program next time by writing the startup flag.
[0096] Example 3
[0097] The present invention also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of the outdoor power supply embedded software dual-system remote upgrade method provided in Example 1 or Example 2 are implemented.
[0098] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and structure diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in an alternative implementation, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the structure diagram and / or the flow chart, and the combination of boxes in the structure diagram and / or the flow chart, can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0099] In addition, the functional modules or units in the various embodiments of the present invention may be integrated together to form an independent part, or each module may exist independently, or two or more modules may be integrated to form an independent part.
[0100] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a smart phone, a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, and other media that can store program codes.
[0101] The above description is only a specific implementation mode of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.
[0102] Although the present invention has been described with reference to preferred embodiments, various modifications may be made thereto and parts thereof may be replaced by equivalents without departing from the scope of the present invention. In particular, the various technical features mentioned in the various embodiments may be combined in any manner as long as there are no structural conflicts. The present invention is not limited to the specific embodiments disclosed herein, but includes all technical solutions falling within the scope of the claims.
Claims
1. A method for remotely upgrading dual systems of embedded software of an outdoor power supply, characterized in that: The following steps are involved: S1: The server sends communication data to the embedded control chip of the outdoor power supply according to the offset address information of the first system MCU and the second system MCU of the outdoor power supply; In the step S1, the method in which the server generates and sends the communication data according to the offset address information of the first system MCU and the second system MCU of the outdoor power supply includes the following steps: S11: The server optimizes the offset address information of the first system MCU and the second system MCU by performing a global random walk using Levi Flight: Among them, g represents the number of current address information; α is the length of the offset from the address information, represents the Kronecker product, levy(·) is the iterative optimization calculation model with the Levy flight iteration interval of λ; S12: In order to generate random numbers with symmetric distribution for flight, first obtain solutions X one by one from the initial population L i , and then build a new vector generation model to generate a new vector X i new Replace initial solution X i : Where W is the inertia coefficient, s is the step size, r is a random value, r∈[0,1], ε∈[0,1]; S13: Determine the new vector X i new Is the function value of the solution f(X) the maximum function value among the solutions obtained in the initial population? i new )>f(X j new ), i≠j and i,j∈L, if so, then determine the new vector X i new The optimal solution X best , otherwise repeat steps S11 to S12; S2: The Bootloader module in the embedded control chip determines and boots the first system or the second system according to the communication data sent in step S1, and verifies the first system or the second system; S3: If the verification fails, the update is stopped. If a system is verified, the system executes the shielded interrupt, reinitializes the MSP and PSP stack pointers, and jumps to another system by modifying the PC register; S4: Check whether another system is running normally; if it is running normally, modify the startup flag bit, and the next boot can enter the updated system; if it is running abnormally, the watchdog resets and restarts the MCU, and the Bootloader module reboots and recovers to the original system.
2. The outdoor power supply embedded software dual-system remote upgrade method according to claim 1 is characterized in that: In the step S1, the communication data sent by the server to the embedded control chip of the outdoor power supply includes the corresponding system binary update file to be updated and the verification code.
3. The outdoor power embedded software dual-system remote upgrade method according to claim 1 is characterized in that: The step S2 includes the following steps: S21: when the first system is started, the server sends communication data of the second system; S22: The first system MCU burns the sent communication data into the second system partition, and then verifies the second system; S23: when the second system is started, the server sends the communication data of the first system; S24: The second system MCU burns the sent communication data into the first system partition, and then verifies the second system.
4. The outdoor power supply embedded software dual-system remote upgrade method according to claim 3 is characterized in that: The iterative optimization calculation model with the Levy flight iteration interval λ in step S11 is as follows: levy(λ)=t -λ , 1<λ≤5; where t is the number of iterations.
5. The outdoor power supply embedded software dual-system remote upgrade method according to claim 1 is characterized in that: The step length s of step S12 satisfies the following conditions: s=0.01×m×(X i -X best ), where m is the step coefficient.
6. The outdoor power embedded software dual-system remote upgrade method according to claim 5 is characterized in that: The calculation formula of the step coefficient m is as follows: Where σ(β) is the standard deviation and β is a fixed constant for step coefficient calculation.
7. The outdoor power embedded software dual-system remote upgrade method according to claim 6 is characterized in that: The calculation formula of the standard deviation σ(β) is as follows: Here, γ(·) is the gamma function.
8. The outdoor power supply embedded software dual-system remote upgrade method according to claim 6 is characterized in that: The value range of the fixed constant for calculating the step coefficient is 1≤β≤3.
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 outdoor power supply embedded software dual-system remote upgrade method described in any one of claims 1-8 are implemented.
Citation Information
Patent Citations
Embedded system upgrading method and device and terminal equipment
CN110134426A
Dual-system terminal online upgrading method, device and equipment
CN113973108A