CN115993985A - Bootloader updating method, bootloader updating device, bootloader updating equipment and Bootloader updating medium - Google Patents

Bootloader updating method, bootloader updating device, bootloader updating equipment and Bootloader updating medium Download PDF

Info

Publication number
CN115993985A
CN115993985A CN202211714232.4A CN202211714232A CN115993985A CN 115993985 A CN115993985 A CN 115993985A CN 202211714232 A CN202211714232 A CN 202211714232A CN 115993985 A CN115993985 A CN 115993985A
Authority
CN
China
Prior art keywords
bootloader
area
updating
current
firmware
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211714232.4A
Other languages
Chinese (zh)
Inventor
冯锡斌
戴杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Imotion Automotive Technology Suzhou Co Ltd
Original Assignee
Imotion Automotive Technology Suzhou Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Imotion Automotive Technology Suzhou Co Ltd filed Critical Imotion Automotive Technology Suzhou Co Ltd
Priority to CN202211714232.4A priority Critical patent/CN115993985A/en
Publication of CN115993985A publication Critical patent/CN115993985A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Stored Programmes (AREA)

Abstract

The application discloses a Bootloader updating method, device, equipment and medium, which relate to the technical field of computers and comprise the following steps: the micro control unit is electrified, a starting information storage area is read through the management firmware to determine a current starting area, if the current starting area is a first Bootloader area, whether a current zone bit is a first preset value or not is judged, the current zone bit is updated to be a second preset value, the first application firmware area is checked to run a current application program for updating the Bootloader and the application firmware, and the updated zone bit is a third preset value; brushing the next application program to the second Bootloader area and the second application firmware area according to the updating instruction; and updating the zone bit of the second Bootloader area to be a first preset value, updating the starting information storage area based on the second Bootloader area, and powering on the micro control unit again. Bootloader self-updating is achieved.

Description

Bootloader updating method, bootloader updating device, bootloader updating equipment and Bootloader updating medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a Bootloader updating method, apparatus, device, and medium.
Background
The Bootloader program is the first program to run after the product is powered on, and bears the work of checking the integrity of the application firmware to ensure the data security, and when the function of the application firmware cannot meet the requirement of a customer or has defects, the update of the application firmware is completed in an online upgrading mode. Therefore, bootloader programs are critical, which affect whether the application firmware can run successfully, and whether the application firmware can be updated safely successfully when it is needed. However, once the Bootloader program is designed with defects or fails to meet the requirements, the Bootloader program needs to be upgraded.
The current method for self-updating Bootloader with the most use is a double Bootloader scheme, namely, after a product is powered on, a first Bootloader (namely boot 1) is operated, after the product is operated, the Bootloader 1 jumps to a second Bootloader (namely boot 2), the boot2 is responsible for checking and upgrading application firmware, and when the boot2 needs to be updated, the boot1 completes the updating of the boot2 so as to realize the self-updating of the Bootloader. Although the method can realize the self-updating requirement of Bootloader, the method has a disadvantage that once the boot2 is updated, if the boot2 is defective, the boot2 cannot normally operate. After restarting the product, the boot1 jumps to boot2 to run through the integrity check of the boot2, but the boot2 defect program cannot run to cause the crash, so that the product becomes brick.
In summary, how to realize self-updating of Bootloader program and reduce the risk of changing bricks after program updating is a problem to be solved at present.
Disclosure of Invention
Accordingly, the present invention is directed to a Bootloader updating method, device, apparatus, and medium, which can realize self-updating of Bootloader program and reduce the risk of brick change after program update. The specific scheme is as follows:
in a first aspect, the present application discloses a Bootloader updating method, including:
The method comprises the steps that a micro control unit is powered on, a current starting area is determined through Bootloader management firmware according to starting information in a starting information storage area, and if the current starting area is a first Bootloader area, whether a current zone bit of the first Bootloader area is a first preset value is judged;
if yes, updating the current zone bit into a second preset value through the first Bootloader region, and checking a first application firmware region corresponding to the first Bootloader region;
if the verification is passed, running a current application program for updating Bootloader and updating application firmware in the first application firmware area, and updating the current flag bit to a third preset value;
setting an upgrade flag bit after an update instruction is acquired, and brushing a next application program to a second Bootloader area and a second application firmware area corresponding to the second Bootloader area under the condition that the current flag bit is the third preset value;
updating the current zone bit of the second Bootloader area to the first preset value, updating the starting information to an option value corresponding to the second Bootloader area, resetting the upgrading zone bit, and then restarting to the power-on starting micro control unit.
Optionally, the Bootloader updating method further includes:
and dividing the flash memory area in the micro control unit into the Bootloader management firmware, the starting information storage area, the first Bootloader area, the first application firmware area, the second Bootloader area and the second application firmware area in advance.
Optionally, the Bootloader updating method further includes:
and determining a first updating program for updating the Bootloader and a second updating program for updating the application firmware, and packaging the first updating program and the second updating program to obtain the application program for updating the Bootloader and the application firmware.
Optionally, after the determining whether the current flag bit of the first Bootloader area is the first preset value, the method further includes:
if the current flag bit of the first Bootloader region is the second preset value, the second Bootloader region is operated, and whether the second Bootloader region has a corresponding upgrading flag bit or not is determined;
if no upgrade flag bit exists, the second application firmware area is checked, so that a current application program for updating Bootloader and updating application firmware is operated in the second application firmware area after the verification is passed;
And if the upgrading zone bit exists, the next application program is written into the first Bootloader area and the first application firmware area, the current zone bit of the first Bootloader area is updated to the first preset value, the starting information is updated to an option value corresponding to the first Bootloader area, the upgrading zone bit is reset, and then the step of starting the micro control unit in a power-on mode is skipped again.
Optionally, after the determining whether the current flag bit of the first Bootloader area is the first preset value, the method further includes:
if the current flag bit of the first Bootloader region is the third preset value, determining whether the first Bootloader region has a corresponding upgrading flag bit;
if no upgrade flag bit exists, directly jumping to the step of checking the first application firmware area corresponding to the first Bootloader area;
if the upgrade flag bit exists, the step of directly jumping to the step of brushing the next application program to the second Bootloader area and the corresponding second application firmware area.
Optionally, after the verifying the first application firmware area corresponding to the first Bootloader area, the method further includes:
And if the verification is not passed, running a current application program for updating the Bootloader and the updated application firmware in the second application firmware area, and updating the current flag bit of the second Bootloader area to a third preset value.
Optionally, the determining, by the Bootloader management firmware, the current startup area according to startup information in the startup information storage area includes:
starting Bootloader management firmware, and reading starting information in a starting information storage area through the Bootloader management firmware; the starting information storage area further comprises a current zone bit and an upgrading zone bit;
determining a target option value corresponding to the starting information so as to determine a current starting area according to the target option value; the target option value is an option value corresponding to the first Bootloader region or the second Bootloader region.
In a second aspect, the present application discloses a Bootloader updating device, including:
the starting region determining module is used for powering on the micro control unit, determining a current starting region according to starting information in a starting information storage region through Bootloader management firmware, and judging whether a current zone bit of a first Bootloader region is a first preset value or not if the current starting region is the first Bootloader region;
The application firmware verification module is used for updating the current zone bit into a second preset value through the first Bootloader region if yes, and verifying a first application firmware region corresponding to the first Bootloader region;
the application program running module is used for running a current application program for updating Bootloader and updating application firmware in the first application firmware area if the verification is passed, and updating the current flag bit to a third preset value;
the application program refreshing module is used for setting an upgrade flag bit after the update instruction is acquired, and refreshing the next application program to a second Bootloader area and a second application firmware area corresponding to the second Bootloader area under the condition that the current flag bit is the third preset value;
and the restarting module is used for updating the current zone bit of the second Bootloader area to the first preset value, updating the starting information to an option value corresponding to the second Bootloader area, resetting the upgrading zone bit and then restarting to the step of powering on the micro control unit.
In a third aspect, the present application discloses an electronic device comprising:
A memory for storing a computer program;
and the processor is used for executing the computer program to realize the steps of the Bootloader updating method disclosed above.
In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program; the computer program, when executed by the processor, implements the steps of the Bootloader updating method disclosed above.
As can be seen, the present application determines, by powering on the micro control unit and by the Bootloader management firmware, a current start area according to start information in the start information storage area, and if the current start area is a first Bootloader area, determines whether a current flag bit of the first Bootloader area is a first preset value; if yes, updating the current zone bit into a second preset value through the first Bootloader region, and checking a first application firmware region corresponding to the first Bootloader region; if the verification is passed, running a current application program for updating Bootloader and updating application firmware in the first application firmware area, and updating the current flag bit to a third preset value; setting an upgrade flag bit after an update instruction is acquired, and brushing a next application program to a second Bootloader area and a second application firmware area corresponding to the second Bootloader area under the condition that the current flag bit is the third preset value; updating the current zone bit of the second Bootloader area to the first preset value, updating the starting information to an option value corresponding to the second Bootloader area, resetting the upgrading zone bit, and then restarting to the power-on starting micro control unit. Therefore, after the micro control unit is powered on, bootloader management firmware in the micro control unit is started first, and the Bootloader management firmware determines a current starting area according to starting information in a starting information storage area, wherein the current starting area comprises a first Bootloader area and a second Bootloader area. If the current starting area is a first Bootloader area, judging whether the current zone bit is a first preset value, if so, updating the current zone bit into a second preset value through the first Bootloader area, checking the integrity of a corresponding first application firmware area, running a current application program for updating Bootloader and updating application firmware in the first application firmware area after the checking is passed, and updating the current zone bit into a third preset value; that is, the present application also completes the self-update of bootloader by packaging the bootloader program and the application firmware program into one application program when upgrading the application firmware. And after the application firmware is operated, waiting for updating, setting an upgrade flag bit after an updating instruction is acquired, and writing the next application program into a second Bootloader area and a second application firmware area corresponding to the second Bootloader area, updating the current flag bit of the second Bootloader area to be a first preset value, updating starting information to be an option value corresponding to the second Bootloader area, resetting the upgrade flag bit, and then powering on the micro control unit again. Because the starting information in the starting information storage area is updated to the option value corresponding to the second Bootloader area, after the Bootloader management firmware is powered on again, the current starting area determined by the Bootloader management firmware according to the starting information in the starting information storage area is the second Bootloader area, so that the rollback strategy of the Bootloader is realized through the sequential alternate brushing of the first Bootloader area and the second Bootloader area, the risk of changing bricks after program updating is reduced, and the maintenance cost caused by changing bricks is reduced.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are required to be used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only embodiments of the present invention, and that other drawings may be obtained according to the provided drawings without inventive effort to a person skilled in the art.
FIG. 1 is a flowchart of a Bootloader updating method disclosed in the present application;
FIG. 2 is a schematic diagram of a specific flash partition disclosed herein;
FIG. 3 is a flowchart of a Bootloader updating method disclosed in the present application;
FIG. 4 is a schematic diagram of a Bootloader update flow disclosed in the present application;
FIG. 5 is a schematic diagram of a Bootloader updating device disclosed in the present application;
fig. 6 is a block diagram of an electronic device disclosed in the present application.
Detailed Description
The following description of the technical solutions in the embodiments of the present application will be made clearly and completely with reference to the drawings in the embodiments of the present application, and it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The current method for self-updating Bootloader with the most use is a double Bootloader scheme, namely, after a product is powered on, a first Bootloader (namely boot 1) is operated, after the product is operated, the Bootloader 1 jumps to a second Bootloader (namely boot 2), the boot2 is responsible for checking and upgrading application firmware, and when the boot2 needs to be updated, the boot1 completes the updating of the boot2 so as to realize the self-updating of the Bootloader. Although the method can realize the self-updating requirement of Bootloader, the method has a disadvantage that once the boot2 is updated, if the boot2 is defective, the boot2 cannot normally operate. After restarting the product, the boot1 jumps to boot2 to run through the integrity check of the boot2, but the boot2 defect program cannot run to cause the crash, so that the product becomes brick. Therefore, the embodiment of the application discloses a Bootloader self-updating method, a Bootloader self-updating device, bootloader self-updating equipment and a Bootloader self-updating medium, which can realize self-updating of Bootloader programs and reduce the risk of brick changing after program updating.
Referring to fig. 1, an embodiment of the present application discloses a Bootloader updating method, which includes:
step S11: and powering on the micro control unit, determining a current starting area according to starting information in a starting information storage area through Bootloader management firmware, and judging whether the current zone bit of the first Bootloader area is a first preset value if the current starting area is the first Bootloader area.
In this embodiment, it should be noted that the Bootloader updating method in the present application further includes: and dividing the flash memory area in the micro control unit into the Bootloader management firmware, the starting information storage area, the first Bootloader area, the first application firmware area, the second Bootloader area and the second application firmware area in advance. That is, in this embodiment, the flash memory (i.e. flash) area of the micro control unit (Microcontroller Unit, i.e. MCU) is divided into six areas in advance, and specifically, see fig. 2, and fig. 2 is a schematic diagram of a specific flash memory partition disclosed in this application. The six areas are BooM, namely Bootloader management firmware and marked as T1; boot Information, namely starting an Information storage area and marking as T2; bootloader_a, the first Bootloader region, is denoted as T3; APP_A, the first application firmware area, is marked as T4; bootloader_b, the second Bootloader region, is denoted as T5; app_b, the second application firmware area, is denoted T6. The boot M is used for starting boot and judging whether bootloader_A or bootloader_B is started; the Boot Information is used for storing the starting Information of the Bootloader and the state of the flag bit in the upgrading process; bootloader_a and bootloader_b belong to Bootloader firmware areas and form an a/B area, which is used alternately in ascending, and one area is a current startup area and the other area is a backup area according to startup options; APP_A and APP_B are application programs, belong to application firmware areas, and form an A/B area which is used alternately in ascending order, and one area is a currently used area and the other area is a backup area according to a starting option. After the flash memory is divided into the areas, firmware is burned, namely T1, T2, T3, T4, T5 and T6 are burned into the micro control unit through a burner, wherein the current starting area recorded in the starting information storage area T2 runs from the first Bootloader T3 area by default, in addition, the data of the first Bootloader area T3 and the second Bootloader area T5 are completely consistent, and the initial values of the current mark bits of the first Bootloader area T3 and the second Bootloader area T5 are set to 1 by default, namely T3_OK=1 and T5_OK=1.
After the micro control unit is electrified and started, the Bootloader management firmware determines a current starting area according to the starting information in the starting information storage area, namely, whether the current starting area is a first Bootloader area T3 or a second Bootloader area T5 is determined. If the current flag bit t3_ok of the first Bootloader area T3 is the first preset value, the first preset value is specifically set to 0 in this embodiment.
Step S12: if yes, updating the current zone bit into a second preset value through the first Bootloader area, and checking a first application firmware area corresponding to the first Bootloader area.
In this embodiment, if the current flag bit t3_ok is 0, it indicates that T3 just after writing is started for the first time, and the first Bootloader area T3 updates t3_ok to a second preset value, and the second preset value is set to 2, and the integrity of the first application firmware area corresponding to the first Bootloader area, specifically, the integrity of the T4 area APP program is checked.
Step S13: and if the verification is passed, running a current application program for updating the Bootloader and the application firmware in the first application firmware area, and updating the current flag bit to a third preset value.
In this embodiment, if the verification is passed, the APP operation is skipped, that is, a current application program for updating Bootloader and updating application firmware is operated in the first application firmware area T4, and if the current application program can be successfully started, the current flag bit t3_ok is updated to a third preset value, where the third preset value is specifically set to 1. It should be noted that the above method further includes: and determining a first updating program for updating the Bootloader and a second updating program for updating the application firmware, and packaging the first updating program and the second updating program to obtain the application program for updating the Bootloader and the application firmware. That is, in this embodiment, the bootloader program that needs to be updated currently and the application firmware program that is updated currently are packaged into an updated application program in a splicing manner, when the application program is updated, the bootloader self-update is completed, the application firmware update is also completed, and the bootloader self-update implemented in this manner is safer.
Step S14: setting an upgrade flag bit after an update instruction is acquired, and under the condition that the current flag bit is the third preset value, brushing the next application program to a second Bootloader area and a second application firmware area corresponding to the second Bootloader area.
In this embodiment, after the current application program runs in the area T4, the current application program waits for updating in real time, after the update instruction is acquired, the update flag bit is set first, that is, the value of the update flag bit update_flag is assigned to 1, and the update is skipped to the first Bootloader area T3, and according to the foregoing, it is known that t3_ok is updated to the third preset value 0 at this time, if the current flag bit is 1, it is determined whether the update flag bit update_flag is assigned to 1 at this time, and if the update flag bit is 1, the next application program is written to the second Bootloader area T5 and the second application firmware area T6 corresponding to the second Bootloader area T5.
Step S15: updating the current zone bit of the second Bootloader area to the first preset value, updating the starting information to an option value corresponding to the second Bootloader area, resetting the upgrading zone bit, and then restarting to the power-on starting micro control unit.
In this embodiment, the current flag bit t5_ok of the second Bootloader area T5 is updated to 0, the startup information in the startup information storage area is updated to the option value corresponding to the T5 area, and the upgrade flag bit is reset, that is, the upgrade flag bit is assigned to 0 to clear the upgrade flag bit, so that the current Bootloader and application firmware update is completed. And then powering on the micro control unit again, wherein the current starting area determined by the Bootloader management firmware according to the starting information in the starting information storage area is a second Bootloader area T5, the current flag bit T5_OK of the T5 area is 0, and the follow-up flow is similar to the T3 area disclosed above. Therefore, the first Bootloader area and the second Bootloader area are sequentially and alternately written, so that a rollback strategy of the Bootloader is realized, the product clock is ensured to be in an active state, the whole product is not changed due to update failure, the factory return and shell disassembly caused by the product changing is reduced, the maintenance cost is further brought, the economic benefit is achieved, and the satisfaction degree of customers is also improved.
As can be seen, the present application determines, by powering on the micro control unit and by the Bootloader management firmware, a current start area according to start information in the start information storage area, and if the current start area is a first Bootloader area, determines whether a current flag bit of the first Bootloader area is a first preset value; if yes, updating the current zone bit into a second preset value through the first Bootloader region, and checking a first application firmware region corresponding to the first Bootloader region; if the verification is passed, running a current application program for updating Bootloader and updating application firmware in the first application firmware area, and updating the current flag bit to a third preset value; setting an upgrade flag bit after an update instruction is acquired, and brushing a next application program to a second Bootloader area and a second application firmware area corresponding to the second Bootloader area under the condition that the current flag bit is the third preset value; updating the current zone bit of the second Bootloader area to the first preset value, updating the starting information to an option value corresponding to the second Bootloader area, resetting the upgrading zone bit, and then restarting to the power-on starting micro control unit. Therefore, after the micro control unit is powered on, bootloader management firmware in the micro control unit is started first, and the Bootloader management firmware determines a current starting area according to starting information in a starting information storage area, wherein the current starting area comprises a first Bootloader area and a second Bootloader area. If the current starting area is a first Bootloader area, judging whether the current zone bit is a first preset value, if so, updating the current zone bit into a second preset value through the first Bootloader area, checking the integrity of a corresponding first application firmware area, running a current application program for updating Bootloader and updating application firmware in the first application firmware area after the checking is passed, and updating the current zone bit into a third preset value; that is, the present application also completes the self-update of bootloader by packaging the bootloader program and the application firmware program into one application program when upgrading the application firmware. And after the application firmware is operated, waiting for updating, setting an upgrade flag bit after an updating instruction is acquired, and writing the next application program into a second Bootloader area and a second application firmware area corresponding to the second Bootloader area, updating the current flag bit of the second Bootloader area to be a first preset value, updating starting information to be an option value corresponding to the second Bootloader area, resetting the upgrade flag bit, and then powering on the micro control unit again. Because the starting information in the starting information storage area is updated to the option value corresponding to the second Bootloader area, after the Bootloader management firmware is powered on again, the current starting area determined by the Bootloader management firmware according to the starting information in the starting information storage area is the second Bootloader area, so that the rollback strategy of the Bootloader is realized through the sequential alternate brushing of the first Bootloader area and the second Bootloader area, the risk of changing bricks after program updating is reduced, and the maintenance cost caused by changing bricks is reduced.
Referring to fig. 3 and fig. 4, a specific Bootloader updating method is disclosed in the embodiment of the present application, and compared with the previous embodiment, the technical solution of the present embodiment is further described and optimized.
The method specifically comprises the following steps:
step S21: powering on a micro control unit, starting Bootloader management firmware, and reading starting information in a starting information storage area through the Bootloader management firmware; the startup information storage area further comprises a current flag bit and an upgrade flag bit.
In this embodiment, after the micro control unit is powered on and started, the Bootloader management firmware therein starts first, and then reads the startup information in the startup information storage area through the Bootloader management firmware, so as to determine whether the current startup area is the first Bootloader area T3 or the second Bootloader area T5. It should be noted that, in addition to the startup information, the startup information storage area stores the current flag bit: t3_ok, t5_ok, and upgrade flag bit: and (3) upgrade_flag, when the current flag bit and the upgrade flag bit are changed, the stored information of the area is rewritten.
Step S22: determining a target option value corresponding to the starting information so as to determine a current starting area according to the target option value, and if the current starting area is a first Bootloader area, judging whether the current zone bit of the first Bootloader area is a first preset value or not; the target option value is an option value corresponding to the first Bootloader region or the second Bootloader region.
In this embodiment, a target option value corresponding to the start information is determined, so that a current start area is determined according to the target option value, where the target option value is an option value corresponding to the first Bootloader area or the second Bootloader area.
Step S23: if yes, updating the current zone bit into a second preset value through the first Bootloader area, and checking a first application firmware area corresponding to the first Bootloader area.
In a first embodiment, if the current flag bit of the first Bootloader area is a first preset value, that is, t3_ok=0, the current flag bit is updated to a second preset value, that is, t3_ok=2, by the first Bootloader area, and the integrity of the first application firmware area corresponding to the first Bootloader area is checked.
In a second embodiment, after determining whether the current flag bit of the first Bootloader area is the first preset value, the method further includes: if the current flag bit of the first Bootloader region is the second preset value, the second Bootloader region is operated, and whether the second Bootloader region has a corresponding upgrading flag bit or not is determined; if no upgrade flag bit exists, the second application firmware area is checked, so that a current application program for updating Bootloader and updating application firmware is operated in the second application firmware area after the verification is passed; and if the upgrading zone bit exists, the next application program is written into the first Bootloader area and the first application firmware area, the current zone bit of the first Bootloader area is updated to the first preset value, the starting information is updated to an option value corresponding to the first Bootloader area, the upgrading zone bit is reset, and then the step of starting the micro control unit in a power-on mode is skipped again. Referring specifically to fig. 4, if the current flag bit of the first Bootloader area is a second preset value, that is, t3_ok=2, it indicates that the last startup is the startup after the upgrade and the application firmware does not run successfully, it needs to jump to the second Bootloader area T5 to run, and return to the state before the upgrade. Determining whether a corresponding upgrading zone bit exists in the T5 area, namely whether the upgrade_flag is 1 at the moment; if the upgrade_flag=0, indicating that the upgrade flag bit is not available, checking the second application firmware area T6, so that after the verification is passed, running a current application program for updating Bootloader and updating application firmware in the area T6; if upgrade_flag=1 indicates that there is an upgrade flag bit, the next application program is written into the T3 area and the T4 area, t3_ok of the T3 area is updated to 0, the start information is updated to an option value corresponding to the T3 area, and the upgrade flag bit is reset, that is, upgrade_flag=0 is set, and then the micro control unit is restarted.
In a third embodiment, after determining whether the current flag bit of the first Bootloader area is the first preset value, the method further includes: if the current flag bit of the first Bootloader region is the third preset value, determining whether the first Bootloader region has a corresponding upgrading flag bit; if no upgrade flag bit exists, directly jumping to the step of checking the first application firmware area corresponding to the first Bootloader area; if the upgrade flag bit exists, the step of directly jumping to the step of brushing the next application program to the second Bootloader area and the corresponding second application firmware area. Specifically referring to fig. 4, if the current flag bit of the first Bootloader area is a third preset value, that is, t3_ok=1, it indicates that the application firmware is good, and it can operate normally, and further determines whether the first Bootloader area has a corresponding upgrade flag bit, that is, whether the upgrade_flag is 1 at this time; if the upgrade_flag=0 indicates that no upgrade flag bit exists, directly jumping to a step of checking a first application firmware area corresponding to the first Bootloader area; if upgrade_flag=1, indicating that there is an upgrade flag bit, directly jumping to the step of writing the next application program into the second Bootloader area and the corresponding second application firmware area.
Step S24: and if the verification is passed, running a current application program for updating the Bootloader and the application firmware in the first application firmware area, and updating the current flag bit to a third preset value.
In this embodiment, after the verifying the first application firmware area corresponding to the first Bootloader area, the method further includes: and if the verification is not passed, running a current application program for updating the Bootloader and the updated application firmware in the second application firmware area, and updating the current flag bit of the second Bootloader area to a third preset value. It can be understood that if the verification of the first application firmware area is not passed, a current application program for updating Bootloader and updating application firmware is run in the second application firmware area, and the current flag bit of the second Bootloader area is updated to a third preset value, that is, t5_ok=1 at this time.
Step S25: setting an upgrade flag bit after an update instruction is acquired, and under the condition that the current flag bit is the third preset value, brushing the next application program to a second Bootloader area and a second application firmware area corresponding to the second Bootloader area.
Step S26: updating the current zone bit of the second Bootloader area to the first preset value, updating the starting information to an option value corresponding to the second Bootloader area, resetting the upgrading zone bit, and then restarting to the power-on starting micro control unit.
For more specific processing procedures in steps S25 and S26, reference may be made to the corresponding contents disclosed in the foregoing embodiments, and no detailed description is given here.
Therefore, after the micro control unit is powered on and started, the Bootloader management firmware is started first, then the Bootloader management firmware reads the starting information in the starting information storage area, and the current starting area is further determined by determining the target option value corresponding to the starting information. In addition, the current flag bit and the upgrade flag bit are stored in the starting information storage area, and when the current flag bit and the upgrade flag bit are changed subsequently, the storage information of the area is rewritten. After the micro control unit is restarted, after the current zone bit of the current starting area is determined, corresponding steps are executed according to different values of the current zone bit.
Referring to fig. 5, an embodiment of the present application discloses a Bootloader updating method, which includes:
the starting region determining module 11 is configured to power up the micro control unit, determine, by using Bootloader management firmware, a current starting region according to starting information in a starting information storage area, and if the current starting region is a first Bootloader region, determine whether a current flag bit of the first Bootloader region is a first preset value;
The application firmware verification module 12 is configured to update the current flag bit to a second preset value through the first Bootloader area if yes, and verify a first application firmware area corresponding to the first Bootloader area;
the application program running module 13 is configured to run a current application program for updating Bootloader and updating application firmware in the first application firmware area if the verification is passed, and update the current flag bit to a third preset value;
the application program brushing module 14 is configured to set an upgrade flag bit after the update instruction is acquired, and brush a next application program to a second Bootloader area and a second application firmware area corresponding to the second Bootloader area if the current flag bit is the third preset value;
and a restarting module 15, configured to update the current flag bit of the second Bootloader area to the first preset value, update the start information to an option value corresponding to the second Bootloader area, reset the upgrade flag bit, and then restart to the step of powering on the micro control unit.
As can be seen, the present application determines, by powering on the micro control unit and by the Bootloader management firmware, a current start area according to start information in the start information storage area, and if the current start area is a first Bootloader area, determines whether a current flag bit of the first Bootloader area is a first preset value; if yes, updating the current zone bit into a second preset value through the first Bootloader region, and checking a first application firmware region corresponding to the first Bootloader region; if the verification is passed, running a current application program for updating Bootloader and updating application firmware in the first application firmware area, and updating the current flag bit to a third preset value; setting an upgrade flag bit after an update instruction is acquired, and brushing a next application program to a second Bootloader area and a second application firmware area corresponding to the second Bootloader area under the condition that the current flag bit is the third preset value; updating the current zone bit of the second Bootloader area to the first preset value, updating the starting information to an option value corresponding to the second Bootloader area, resetting the upgrading zone bit, and then restarting to the power-on starting micro control unit. Therefore, after the micro control unit is powered on, bootloader management firmware in the micro control unit is started first, and the Bootloader management firmware determines a current starting area according to starting information in a starting information storage area, wherein the current starting area comprises a first Bootloader area and a second Bootloader area. If the current starting area is a first Bootloader area, judging whether the current zone bit is a first preset value, if so, updating the current zone bit into a second preset value through the first Bootloader area, checking the integrity of a corresponding first application firmware area, running a current application program for updating Bootloader and updating application firmware in the first application firmware area after the checking is passed, and updating the current zone bit into a third preset value; that is, the present application also completes the self-update of bootloader by packaging the bootloader program and the application firmware program into one application program when upgrading the application firmware. And after the application firmware is operated, waiting for updating, setting an upgrade flag bit after an updating instruction is acquired, and writing the next application program into a second Bootloader area and a second application firmware area corresponding to the second Bootloader area, updating the current flag bit of the second Bootloader area to be a first preset value, updating starting information to be an option value corresponding to the second Bootloader area, resetting the upgrade flag bit, and then powering on the micro control unit again. Because the starting information in the starting information storage area is updated to the option value corresponding to the second Bootloader area, after the Bootloader management firmware is powered on again, the current starting area determined by the Bootloader management firmware according to the starting information in the starting information storage area is the second Bootloader area, so that the rollback strategy of the Bootloader is realized through the sequential alternate brushing of the first Bootloader area and the second Bootloader area, the risk of changing bricks after program updating is reduced, and the maintenance cost caused by changing bricks is reduced.
Fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present application. Specifically, the method comprises the following steps: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input output interface 25, and a communication bus 26. The memory 22 is configured to store a computer program, where the computer program is loaded and executed by the processor 21 to implement relevant steps in the Bootloader updating method performed by the electronic device disclosed in any of the foregoing embodiments.
In this embodiment, the power supply 23 is configured to provide an operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and an external device, and the communication protocol to be followed is any communication protocol applicable to the technical solution of the present application, which is not specifically limited herein; the input/output interface 25 is used for acquiring external input data or outputting external output data, and the specific interface type thereof may be selected according to the specific application requirement, which is not limited herein.
Processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 21 may be implemented in at least one hardware form of DSP (Digital Signal Processing ), FPGA (Field-Programmable Gate Array, field programmable gate array), PLA (Programmable Logic Array ). The processor 21 may also comprise a main processor, which is a processor for processing data in an awake state, also called CPU (Central Processing Unit ); a coprocessor is a low-power processor for processing data in a standby state. In some embodiments, the processor 21 may integrate a GPU (Graphics Processing Unit, image processor) for rendering and drawing of content required to be displayed by the display screen. In some embodiments, the processor 21 may also include an AI (Artificial Intelligence ) processor for processing computing operations related to machine learning.
The memory 22 may be a carrier for storing resources, such as a read-only memory, a random access memory, a magnetic disk, or an optical disk, and the resources stored thereon include an operating system 221, a computer program 222, and data 223, and the storage may be temporary storage or permanent storage.
The operating system 221 is used for managing and controlling various hardware devices on the electronic device 20 and the computer program 222, so as to implement the operation and processing of the processor 21 on the mass data 223 in the memory 22, which may be Windows, unix, linux. The computer program 222 may further include a computer program that can be used to perform other specific tasks in addition to the computer program that can be used to perform the Bootloader updating method performed by the electronic device 20 disclosed in any of the foregoing embodiments. The data 223 may include, in addition to data received by the electronic device and transmitted by the external device, data collected by the input/output interface 25 itself, and so on.
Further, the embodiment of the application also discloses a computer readable storage medium, wherein the storage medium stores a computer program, and when the computer program is loaded and executed by a processor, the method steps executed in the Bootloader updating process disclosed in any of the previous embodiments are realized.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described in a different point from other embodiments, so that the same or similar parts between the embodiments are referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant points refer to the description of the method section.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative elements and steps are described above generally in terms of functionality in order to clearly illustrate the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. The software modules may be disposed in Random Access Memory (RAM), memory, read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
Finally, it is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The Bootloader updating method, device, equipment and storage medium provided by the invention are described in detail, and specific examples are applied to illustrate the principle and implementation of the invention, and the description of the above examples is only used for helping to understand the method and core ideas of the invention; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in accordance with the ideas of the present invention, the present description should not be construed as limiting the present invention in view of the above.

Claims (10)

1. A Bootloader updating method, comprising:
the method comprises the steps that a micro control unit is powered on, a current starting area is determined through Bootloader management firmware according to starting information in a starting information storage area, and if the current starting area is a first Bootloader area, whether a current zone bit of the first Bootloader area is a first preset value is judged;
if yes, updating the current zone bit into a second preset value through the first Bootloader region, and checking a first application firmware region corresponding to the first Bootloader region;
if the verification is passed, running a current application program for updating Bootloader and updating application firmware in the first application firmware area, and updating the current flag bit to a third preset value;
setting an upgrade flag bit after an update instruction is acquired, and brushing a next application program to a second Bootloader area and a second application firmware area corresponding to the second Bootloader area under the condition that the current flag bit is the third preset value;
updating the current zone bit of the second Bootloader area to the first preset value, updating the starting information to an option value corresponding to the second Bootloader area, resetting the upgrading zone bit, and then restarting to the power-on starting micro control unit.
2. The Bootloader updating method according to claim 1, further comprising:
and dividing the flash memory area in the micro control unit into the Bootloader management firmware, the starting information storage area, the first Bootloader area, the first application firmware area, the second Bootloader area and the second application firmware area in advance.
3. The Bootloader updating method according to claim 1, further comprising:
and determining a first updating program for updating the Bootloader and a second updating program for updating the application firmware, and packaging the first updating program and the second updating program to obtain the application program for updating the Bootloader and the application firmware.
4. The Bootloader updating method according to claim 1, wherein after the determining whether the current flag bit of the first Bootloader area is a first preset value, further comprises:
if the current flag bit of the first Bootloader region is the second preset value, the second Bootloader region is operated, and whether the second Bootloader region has a corresponding upgrading flag bit or not is determined;
If no upgrade flag bit exists, the second application firmware area is checked, so that a current application program for updating Bootloader and updating application firmware is operated in the second application firmware area after the verification is passed;
and if the upgrading zone bit exists, the next application program is written into the first Bootloader area and the first application firmware area, the current zone bit of the first Bootloader area is updated to the first preset value, the starting information is updated to an option value corresponding to the first Bootloader area, the upgrading zone bit is reset, and then the step of starting the micro control unit in a power-on mode is skipped again.
5. The Bootloader updating method according to claim 1, wherein after the determining whether the current flag bit of the first Bootloader area is a first preset value, further comprises:
if the current flag bit of the first Bootloader region is the third preset value, determining whether the first Bootloader region has a corresponding upgrading flag bit;
if no upgrade flag bit exists, directly jumping to the step of checking the first application firmware area corresponding to the first Bootloader area;
If the upgrade flag bit exists, the step of directly jumping to the step of brushing the next application program to the second Bootloader area and the corresponding second application firmware area.
6. The Bootloader updating method according to claim 1, wherein after the verifying the first application firmware area corresponding to the first Bootloader area, further comprises:
and if the verification is not passed, running a current application program for updating the Bootloader and the updated application firmware in the second application firmware area, and updating the current flag bit of the second Bootloader area to a third preset value.
7. The Bootloader updating method according to any one of claims 1 to 6, wherein the determining, by Bootloader management firmware, a current boot area according to boot information in a boot information storage area includes:
starting Bootloader management firmware, and reading starting information in a starting information storage area through the Bootloader management firmware; the starting information storage area further comprises a current zone bit and an upgrading zone bit;
determining a target option value corresponding to the starting information so as to determine a current starting area according to the target option value; the target option value is an option value corresponding to the first Bootloader region or the second Bootloader region.
8. A Bootloader updating device, comprising:
the starting region determining module is used for powering on the micro control unit, determining a current starting region according to starting information in a starting information storage region through Bootloader management firmware, and judging whether a current zone bit of a first Bootloader region is a first preset value or not if the current starting region is the first Bootloader region;
the application firmware verification module is used for updating the current zone bit into a second preset value through the first Bootloader region if yes, and verifying a first application firmware region corresponding to the first Bootloader region;
the application program running module is used for running a current application program for updating Bootloader and updating application firmware in the first application firmware area if the verification is passed, and updating the current flag bit to a third preset value;
the application program refreshing module is used for setting an upgrade flag bit after the update instruction is acquired, and refreshing the next application program to a second Bootloader area and a second application firmware area corresponding to the second Bootloader area under the condition that the current flag bit is the third preset value;
And the restarting module is used for updating the current zone bit of the second Bootloader area to the first preset value, updating the starting information to an option value corresponding to the second Bootloader area, resetting the upgrading zone bit and then restarting to the step of powering on the micro control unit.
9. An electronic device, comprising:
a memory for storing a computer program;
a processor for executing the computer program to implement the steps of the Bootloader updating method according to any of claims 1 to 7.
10. A computer-readable storage medium storing a computer program; wherein the computer program when executed by a processor implements the steps of the Bootloader updating method according to any of claims 1 to 7.
CN202211714232.4A 2022-12-27 2022-12-27 Bootloader updating method, bootloader updating device, bootloader updating equipment and Bootloader updating medium Pending CN115993985A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211714232.4A CN115993985A (en) 2022-12-27 2022-12-27 Bootloader updating method, bootloader updating device, bootloader updating equipment and Bootloader updating medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211714232.4A CN115993985A (en) 2022-12-27 2022-12-27 Bootloader updating method, bootloader updating device, bootloader updating equipment and Bootloader updating medium

Publications (1)

Publication Number Publication Date
CN115993985A true CN115993985A (en) 2023-04-21

Family

ID=85994792

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211714232.4A Pending CN115993985A (en) 2022-12-27 2022-12-27 Bootloader updating method, bootloader updating device, bootloader updating equipment and Bootloader updating medium

Country Status (1)

Country Link
CN (1) CN115993985A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116302011A (en) * 2023-05-24 2023-06-23 广东电网有限责任公司佛山供电局 Firmware upgrading method for cable monitoring equipment
CN117762449A (en) * 2023-12-20 2024-03-26 苏州承泰科技有限公司 Millimeter wave radar software upgrading backup method

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116302011A (en) * 2023-05-24 2023-06-23 广东电网有限责任公司佛山供电局 Firmware upgrading method for cable monitoring equipment
CN116302011B (en) * 2023-05-24 2023-08-18 广东电网有限责任公司佛山供电局 Firmware upgrading method for cable monitoring equipment
CN117762449A (en) * 2023-12-20 2024-03-26 苏州承泰科技有限公司 Millimeter wave radar software upgrading backup method

Similar Documents

Publication Publication Date Title
CN115993985A (en) Bootloader updating method, bootloader updating device, bootloader updating equipment and Bootloader updating medium
CN102033790B (en) Method and device for upgrading embedded-type system BOOTROM
WO2013103023A1 (en) Information processing device, information processing method, and computer program
JP3838840B2 (en) Computer
CN109358887B (en) On-line upgrading method, device and system for single chip microcomputer program
CN110737481A (en) Starting method of embedded LINUX operating system based on multiple backup bootstrap programs
CN103577201A (en) Embedded dual system updating method and system
CN112506745B (en) Memory temperature reading method and device and computer readable storage medium
CN112433769A (en) BMC starting method and device, computer equipment and storage medium
CN107566169A (en) A kind of firmware upgrade method and router based on openwrt
US11640288B2 (en) System version upgrading method and apparatus
CN109375953B (en) Operating system starting method and device
JP2004046453A (en) Single chip microcomputer and boot sector switching method
CN110597532A (en) Data acquisition module, firmware upgrading method thereof and storage medium
CN116679962A (en) Method, device, equipment and medium for updating firmware of basic input/output system
JP6021597B2 (en) Information processing apparatus, information processing method, and computer program
CN114153477A (en) Method, device, system, equipment and medium for upgrading firmware of PCIE (peripheral component interface express) driver card
CN111885420B (en) Standby protection method and device, smart television and readable storage medium
CN113220319A (en) Data updating method and device and vehicle
CN112612498A (en) Embedded equipment upgrading method and embedded equipment
CN111399889A (en) Updating method, device and equipment of server uboot partition
CN115033261A (en) Program updating method, device, equipment and storage medium
JP2011175352A (en) Firmware updating device, communication apparatus, electronic apparatus, firmware updating system, firmware updating method and program
WO2012077604A1 (en) Processing device, program update method, and program
CN111858234A (en) Task execution method, device, equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination