CN111459508B - BootLoader self-upgrading method and system - Google Patents

BootLoader self-upgrading method and system Download PDF

Info

Publication number
CN111459508B
CN111459508B CN202010231994.3A CN202010231994A CN111459508B CN 111459508 B CN111459508 B CN 111459508B CN 202010231994 A CN202010231994 A CN 202010231994A CN 111459508 B CN111459508 B CN 111459508B
Authority
CN
China
Prior art keywords
area
bootloader
program
mark
running
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.)
Active
Application number
CN202010231994.3A
Other languages
Chinese (zh)
Other versions
CN111459508A (en
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.)
Beijing Jingwei Hirain Tech Co Ltd
Original Assignee
Beijing Jingwei Hirain Tech 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 Beijing Jingwei Hirain Tech Co Ltd filed Critical Beijing Jingwei Hirain Tech Co Ltd
Priority to CN202010231994.3A priority Critical patent/CN111459508B/en
Publication of CN111459508A publication Critical patent/CN111459508A/en
Application granted granted Critical
Publication of CN111459508B publication Critical patent/CN111459508B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/61Installation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping
    • G06F9/4406Loading of operating system

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses a BootLoader self-upgrading method and a BootLoader self-upgrading system, wherein the BootLoader self-upgrading method comprises the following steps: running a program in a starting start program area, and judging whether a BT flag is 0 or 1; copying the codes in the backup BT program area to the normal BT program area when the BT flag is 1, setting the BT flag in the running flag area to 0, and running the programs in the normal BT program area; judging whether the upgrading mark is 0 or 1; when the upgrading mark is 1, judging whether the upgrading area is a flash area of the BT and/or a flash area of the application program; when the BT flash area is the BT flash area, erasing the flash area of the backup BT program area and writing new BT program codes; the BT flag is set to 1, the upgrade flag is set to 0, and the program in the start-up program area is returned to be run again. The invention can simply and quickly realize the self-upgrading of BT.

Description

BootLoader self-upgrading method and system
Technical Field
The invention relates to the technical field of electronic product software upgrading, in particular to a BootLoader self-upgrading method and system.
Background
At present, the ECU (Electronic Control Unit ) in the traditional automotive electronics field is a common single chip microcomputer, and the BootLoader (BT) is different from the BootLoader of the embedded Linux system, and is not responsible for hardware initialization before system application is started, but is an independent program, and is only responsible for application program upgrading. The BootLoader and the App can respectively perform initialization related to the BootLoader and the App, and the BootLoader and the App are independent of each other.
At present, the upgrade mode of the ECU in the traditional automobile electronic field is to transmit an upgrade packet of the ECU to a BootLoader of the ECU through an OBD (On Board Diagnostics) interface and a CAN bus communication mode, and then write flash operation is carried out by the BootLoader to finish the upgrade.
However, in the intelligent network-connected automobile era, the upgrade modes of the ECU software become various, and the ECU software can be remotely upgraded through OTA (Over the Air Technology, over-the-air technology), the ECU in the automobile can be upgraded through an automobile machine, and the original OBD upgrade mode can also be adopted. In the intelligent networking era, the user demand change is relatively fast, and the software updating speed is also accelerated, so that the requirement that the user continuously pursues driving experience is met.
From this it can be seen that the importance of BootLoader in charge of ECU upgrades is self-evident. The fast iteration of the application software needs to rely on the stability and reliability of BootLoader operation. In order to quickly develop a new product or a new project, sometimes, the stability of the BootLoader is not good enough to preempt the market, so that the upgrade failure rate is high, or the sleep current of the ECU is affected, etc., so that the BootLoader should also have the upgrade function like the application software, commonly called BootLoader self-upgrade. However, many conventional ECUs do not have the BootLoader self-upgrading function, once the bug of the BootLoader is found in the whole vehicle joint debugging, only the part can be replaced or disassembled, and then the BootLoader program is manually updated by using a programming tool, so that the time and the labor are consumed, and the efficiency is lower.
Therefore, how to simply and quickly implement the self-upgrading of BootLoader is a problem to be solved urgently.
Disclosure of Invention
In view of the above, the invention provides a BootLoader self-upgrading method and system, which can simply and quickly realize the self-upgrading of the BootLoader, and effectively solve the problems of time consumption, labor consumption and low efficiency caused by manually updating the BootLoader program in the prior art.
The invention provides a BootLoader self-upgrading method which is applied to an electronic control unit, wherein a programmable storage area of the electronic control unit is divided into: the method comprises the following steps of running a mark area, a starting start program area, a normal BootLoader program area, a backup BootLoader program area and an application program area, wherein the method comprises the following steps:
running a program in a start-up program area;
judging whether a BootLoader mark in the operation mark area is 0 or 1;
when the BootLoader mark in the operation mark area is 1, copying codes in the backup BootLoader program area to a normal BootLoader program area;
after the code copying is completed, setting a BootLoader flag in the running flag area to 0;
running the program in the normal BootLoader program area;
judging whether an upgrade mark in the operation mark area is 0 or 1;
when the upgrading mark in the operation mark area is 1, judging whether the upgrading area is a flash area of a BootLoader and/or a flash area of an application program;
when the upgrading area is a flash area of the BootLoader, erasing the flash area of the backup BootLoader program area, and writing in a new BootLoader program code;
setting a BootLoader flag in the running flag area to 1;
setting an upgrade flag in the run flag area to 0;
and returning to running the program in the starting start program area again.
Preferably, the method further comprises:
and when the BootLoader flag in the running flag area is 0, jumping to running the program in the normal BootLoader program area.
Preferably, the method further comprises:
when the upgrade flag in the running flag area is 0, the program in the application area is run.
Preferably, the method further comprises:
judging whether an upgrade request is received, if so, then:
setting an upgrade flag in the running flag area to 1;
and returning to running the program in the starting start program area again.
Preferably, the method further comprises:
and when the upgrading area is a flash area of the application program, erasing the flash area of the application program and writing in new application program codes.
A BootLoader self-upgrading system is applied to an electronic control unit, and a programmable storage area of the electronic control unit is divided into: the system comprises a running mark area, a starting program area, a normal BootLoader program area, a backup BootLoader program area and an application program area, and the system comprises:
the first operation module is used for operating the program in the starting program area;
the first judging module is used for judging whether the BootLoader mark in the running mark area is 0 or 1;
the copy module is used for copying codes in the backup BootLoader program area to the normal BootLoader program area when the BootLoader mark in the operation mark area is 1;
the first setting module is used for setting a BootLoader mark in the running mark area to be 0 after the code copying is completed;
the second operation module is used for operating the program in the normal BootLoader program area;
the second judging module is used for judging whether the upgrading mark in the running mark area is 0 or 1;
the third judging module is used for judging whether the upgrading area is a flash area of a BootLoader and/or a flash area of an application program when the upgrading mark in the running mark area is 1;
the first updating module is used for erasing the flash area of the backup BootLoader program area when the upgrading area is the flash area of the BootLoader, and writing in new BootLoader program codes;
the second setting module is used for setting a BootLoader mark in the running mark area to be 1;
a third setting module, configured to set an upgrade flag in the running flag area to 0;
and the return module is used for returning to re-run the program in the starting start program area.
Preferably, the system further comprises:
and the jump module is used for jumping to the program in the normal BootLoader program area when the BootLoader mark in the operation mark area is 0.
Preferably, the system further comprises:
and the third running module is used for running the program in the application program area when the upgrade mark in the running mark area is 0.
Preferably, the system further comprises:
a fourth judging module, configured to judge whether an upgrade request is received;
a fourth setting module, configured to set an upgrade flag in the running flag area to 1 when an upgrade request is received;
and the return module is also used for returning to re-run the program in the starting start program area.
Preferably, the system further comprises:
and the second updating module is used for erasing the flash area of the application program and writing in new application program codes when the upgrading area is the flash area of the application program.
In summary, the invention discloses a BootLoader self-upgrading method, when it is required to automatically upgrade BootLoader, firstly running a program in a starting program area, then judging whether a BootLoader mark in an operation mark area is 0 or 1, and when the BootLoader mark in the operation mark area is 1, copying codes in a backup BootLoader program area to a normal BootLoader program area; after the code copying is completed, setting a BootLoader mark in the running mark area to 0, running a program in the normal BootLoader program area, judging whether an upgrading mark in the running mark area is 0 or 1, and judging whether the upgrading area is a flash area of the BootLoader and/or a flash area of an application program when the upgrading mark in the running mark area is 1; when the upgrading area is a flash area of the BootLoader, erasing the flash area of the backup BootLoader program area, and writing in a new BootLoader program code; and setting a BootLoader flag in the running flag area to be 1, setting an upgrade flag in the running flag area to be 0, and returning to running the program in the starting start program area again. According to the invention, the BootLoader program code needing to be updated is written into the backup BootLoader program area, and when the BootLoader needs to be updated, the BootLoader program code written into the backup BootLoader program area is copied into the normal BootLoader program area, so that the BootLoader self-upgrading is realized simply and quickly.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flowchart of a method embodiment 1 of a BootLoader self-upgrade method disclosed in the present invention;
FIG. 2 is a flowchart of a method embodiment 2 of a BootLoader self-upgrade method disclosed in the present invention;
FIG. 3 is a schematic diagram of an embodiment 1 of a BootLoader self-upgrade system according to the present disclosure;
fig. 4 is a schematic structural diagram of a BootLoader self-upgrade system embodiment 2 disclosed in the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but 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.
As shown in fig. 1, a flowchart of a method embodiment 1 of BootLoader self-upgrade disclosed in the present invention is shown, where the method is applied to an electronic control unit, and a programmable memory area of the electronic control unit is divided into: the method may include the steps of:
s101, running a program in a starting program area;
when the self-elevating of the BootLoader needs to be realized, the programmable storage area of the electronic control unit is divided into: the method comprises the steps of running a mark area, a starting program area, a normal BootLoader program area, a backup BootLoader program area and an application program area; after the electronic control unit is powered on and started, the program in the starting start program area is firstly run.
S102, judging whether a BootLoader mark in an operation mark area is 0 or 1;
when a program in a program area is started to run, checking a mark in a running mark area, and judging whether a BootLoader mark in the running mark area is 0 or 1; when the BootLoader mark is 0, no BootLoader is characterized to be updated; when the BootLoader flag is 1, it is characterized that BootLoader needs to be updated.
S103, when the BootLoader mark in the running mark area is 1, copying codes in the backup BootLoader program area to a normal BootLoader program area;
when the BootLoader flag in the running flag area is 1, that is, when the BootLoader needs to be updated, the codes in the backup BootLoader program area are copied to the normal BootLoader program area, wherein the codes in the backup BootLoader program area are the BootLoader program codes needing to be updated.
S104, after the code copying is completed, setting a BootLoader mark in the running mark area to be 0;
after the code in the backup BootLoader program area is copied to the normal BootLoader program area, the BootLoader flag in the running flag area is set to 0 from 1, which indicates that no BootLoader needs to be updated at the moment.
S105, running a program in a normal BootLoader program area;
after copying the codes in the backup BootLoader program area to the normal BootLoader program area and setting the BootLoader flag in the running flag area to 0, jumping to the normal BootLoader program area, and running the programs in the normal BootLoader program area, wherein the updated BootLoader program codes are validated.
S106, judging whether an upgrade mark in the operation mark area is 0 or 1;
when the program in the normal BootLoader program area is operated, further checking the mark in the operation mark area to judge whether the upgrading mark in the operation mark area is 0 or 1; wherein, the upgrade mark is 0, which indicates that the electronic control unit has no upgrade requirement, the upgrade mark is 1, which indicates that the electronic control unit has upgrade requirement.
S107, when the upgrading mark in the running mark area is 1, judging whether the upgrading area is a flash area of a BootLoader and/or a flash area of an application program;
when the upgrading mark in the running mark area is 1, namely when the electronic control unit has the upgrading requirement, further judging whether the upgrading area is a flash area of the BootLoader and/or a flash area of the application program. When the upgrading area is a flash area of the BootLoader, the BootLoader is indicated to be required to be upgraded; and when the upgrading area is a flash area of the application program, indicating that the application program needs to be upgraded.
S108, when the upgrading area is a flash area of the BootLoader, erasing the flash area of the backup BootLoader program area, and writing in a new BootLoader program code;
and when the upgrading area is a flash area of the BootLoader, erasing the flash area of the backup BootLoader program area, and writing new BootLoader program codes into the flash area after the backup BootLoader program area is erased.
S109, setting a BootLoader flag in an operation flag area to be 1;
and after writing the new BootLoader program code into the flash area after the backup BootLoader program area is erased, further setting a BootLoader flag in the running flag area to be 1, wherein the BootLoader flag is 1, which indicates that the BootLoader needs to be updated.
S110, setting the upgrade flag in the operation flag area to 0, and returning to execute the step S101 again.
After writing the new BootLoader program code into the flash area after the backup BootLoader program area is erased, setting the upgrade flag in the running flag area to 0, wherein the upgrade flag is 0, and indicating that the electronic control unit has no upgrade requirement.
After the BootLoader flag in the running flag area is set to 1 and the upgrade flag in the running flag area is set to 0, the electronic control unit is reset and restarted, the program in the starting program area is restarted, and the corresponding BootLoader upgrade operation is executed.
In summary, in the above embodiment, when it is required to implement automatic upgrade of BootLoader, firstly, running a program in a starting start program area, then judging whether a BootLoader flag in an operation flag area is 0 or 1, and when the BootLoader flag in the operation flag area is 1, copying a code in a backup BootLoader program area to a normal BootLoader program area; after the code copying is completed, setting a BootLoader mark in the running mark area to 0, running a program in the normal BootLoader program area, judging whether an upgrading mark in the running mark area is 0 or 1, and judging whether the upgrading area is a flash area of the BootLoader and/or a flash area of an application program when the upgrading mark in the running mark area is 1; when the upgrading area is a flash area of the BootLoader, erasing the flash area of the backup BootLoader program area, and writing in a new BootLoader program code; and setting a BootLoader flag in the running flag area to be 1, setting an upgrade flag in the running flag area to be 0, and returning to running the program in the starting start program area again. According to the invention, the BootLoader program code needing to be updated is written into the backup BootLoader program area, and when the BootLoader needs to be updated, the BootLoader program code written into the backup BootLoader program area is copied into the normal BootLoader program area, so that the BootLoader self-upgrading is realized simply and quickly.
As shown in fig. 2, a flowchart of a BootLoader self-upgrading method embodiment 2 disclosed in the present invention is shown, where the method is applied to an electronic control unit, and a programmable storage area of the electronic control unit is divided into: the method may include the steps of:
s201, running a program in a starting program area;
when the self-elevating of the BootLoader needs to be realized, the programmable storage area of the electronic control unit is divided into: the method comprises the steps of running a mark area, a starting program area, a normal BootLoader program area, a backup BootLoader program area and an application program area; after the electronic control unit is powered on and started, the program in the starting start program area is firstly run.
S202, judging whether a BootLoader mark in an operation mark area is 0 or 1;
when a program in a program area is started to run, checking a mark in a running mark area, and judging whether a BootLoader mark in the running mark area is 0 or 1; when the BootLoader mark is 0, no BootLoader is characterized to be updated; when the BootLoader flag is 1, it is characterized that BootLoader needs to be updated.
S203, when the BootLoader flag in the running flag area is 0, jumping to the step S206;
when the BootLoader flag in the running flag area is 0, that is, when no BootLoader needs to be updated, the process directly jumps to the normal BootLoader program area, and the process in the normal BootLoader program area is run.
S204, when the BootLoader mark in the running mark area is 1, copying codes in the backup BootLoader program area to a normal BootLoader program area;
when the BootLoader flag in the running flag area is 1, that is, when the BootLoader needs to be updated, the codes in the backup BootLoader program area are copied to the normal BootLoader program area, wherein the codes in the backup BootLoader program area are the BootLoader program codes needing to be updated.
S205, after the code copying is completed, setting a BootLoader mark in an operation mark area to be 0;
after the code in the backup BootLoader program area is copied to the normal BootLoader program area, the BootLoader flag in the running flag area is set to 0 from 1, which indicates that no BootLoader needs to be updated at the moment.
S206, running the program in the normal BootLoader program area;
it should be noted that, when the program in the normal BootLoader program area is run, two cases are included. One of the methods is that when the BootLoader mark in the operation mark area is judged to be 0, the program in the current normal BootLoader program area is directly operated at the moment; in another aspect, after determining that the BootLoader flag in the running flag area is 1, copying the code in the backup BootLoader program area to the normal BootLoader program area, and setting the BootLoader flag in the running flag area to 0, jumping to the normal BootLoader program area, and running the program in the normal BootLoader program area, where the updated BootLoader program code is validated because the code in the backup BootLoader program area has been copied to the normal BootLoader program area. That is, the program running in the normal BootLoader program area at this time is the code in the backup BootLoader program area.
S207, judging whether an upgrade mark in the operation mark area is 0 or 1;
when the program in the normal BootLoader program area is operated, further checking the mark in the operation mark area to judge whether the upgrading mark in the operation mark area is 0 or 1; wherein, the upgrade mark is 0, which indicates that the electronic control unit has no upgrade requirement, the upgrade mark is 1, which indicates that the electronic control unit has upgrade requirement.
S208, when the upgrade mark in the operation mark area is 0, the program in the application program area is operated;
when the upgrade flag in the running flag area is 0, i.e. when the electronic control unit has no upgrade requirement, the program in the application area is directly run.
S209, judging whether an upgrade request is received, if yes, entering S210:
when the program in the application program area is run, it is further judged whether an upgrade request is received.
S210, setting an upgrade flag in the operation flag area to be 1, and returning to execute the step S201 again;
when an upgrade request is received, an upgrade flag in the operation flag area is set to be 1, the electronic control unit is reset and restarted, programs in the starting program area are operated again, and corresponding upgrade operation is executed.
S211, when an upgrading mark in the running mark area is 1, judging whether the upgrading area is a flash area of a BootLoader and/or a flash area of an application program;
when the upgrading mark in the running mark area is 1, namely when the electronic control unit has the upgrading requirement, further judging whether the upgrading area is a flash area of the BootLoader and/or a flash area of the application program. When the upgrading area is a flash area of the BootLoader, the BootLoader is indicated to be required to be upgraded; and when the upgrading area is a flash area of the application program, indicating that the application program needs to be upgraded.
S212, when the upgrading area is a flash area of the BootLoader, erasing the flash area of the backup BootLoader program area, and writing in a new BootLoader program code;
and when the upgrading area is a flash area of the BootLoader, erasing the flash area of the backup BootLoader program area, and writing new BootLoader program codes into the flash area after the backup BootLoader program area is erased.
S213, setting a BootLoader flag in the operation flag area to be 1;
and after writing the new BootLoader program code into the flash area after the backup BootLoader program area is erased, further setting a BootLoader flag in the running flag area to be 1, wherein the BootLoader flag is 1, which indicates that the BootLoader needs to be updated.
S214, when the upgrading area is a flash area of the application program, the flash area of the application program is erased, and new application program codes are written;
and when the upgrading area is a flash area of the application program, erasing the flash area of the application program, and then writing new application program codes into the flash area after application program erasing, so as to further realize the updating of the application program.
S215, the upgrade flag in the operation flag area is set to 0, and the process returns to step S201 again.
After writing the new BootLoader program code into the flash area after the backup BootLoader program area is erased, or after writing the new application program code into the flash area after the application program area is erased, the upgrade flag in the running flag area is further set to 0, the upgrade flag is set to 0, and the electronic control unit is characterized that no upgrade requirement exists.
After the upgrade flag in the running flag area is set to 0, the electronic control unit is reset and restarted, the program in the starting program area is run again, and corresponding upgrade operation is executed.
In summary, the present embodiment further implements, based on the foregoing embodiments, jumping to the program in the normal BootLoader program area when the BootLoader flag in the running flag area is 0, and running the program in the application program area when the upgrade flag in the running flag area is 0, to determine whether an upgrade request is received, if yes: setting the upgrade flag in the running flag area to 1, and returning to running the program in the starting program area again; and when the upgrading area is a flash area of the application program, the flash area of the application program can be erased, and new application program codes are written in, so that the application program is updated.
As shown in fig. 3, a schematic structural diagram of an embodiment 1 of a BootLoader self-upgrade system disclosed in the present invention is shown, where the system is applied to an electronic control unit, and a programmable storage area of the electronic control unit is divided into: the system may include a run flag area, a start-up program area, a normal BootLoader program area, a backup BootLoader program area, and an application program area:
a first operation module 301 for operating a program in a start-up program area;
a first judging module 302, configured to judge whether a BootLoader flag in the running flag area is 0 or 1;
the copy module 303 is configured to copy, when the BootLoader flag in the running flag area is 1, a code in the backup BootLoader program area to the normal BootLoader program area;
a first setting module 304, configured to set a BootLoader flag in the running flag area to 0 after the code copying is completed;
the second operation module 305 is configured to operate a program in the normal BootLoader program area;
a second judging module 306, configured to judge whether the upgrade flag in the running flag area is 0 or 1;
a third judging module 307, configured to judge whether the upgrade area is a flash area of the BootLoader and/or a flash area of the application program when the upgrade flag in the operation flag area is 1;
the first update module 308 is configured to erase the flash area of the backup BootLoader program area and write a new BootLoader program code when the upgrade area is the flash area of the BootLoader;
a second setting module 309, configured to set a BootLoader flag in the running flag area to 1;
a third setting module 310, configured to set the upgrade flag in the running flag area to 0, and return to running the program in the start-up program area again through a return module 311.
The working principle of the BootLoader self-upgrading system disclosed in the embodiment is the same as that of the BootLoader self-upgrading method embodiment 1, and is not described herein.
As shown in fig. 4, a schematic structural diagram of an embodiment 2 of a BootLoader self-upgrade system disclosed in the present invention is shown, where the system is applied to an electronic control unit, and a programmable storage area of the electronic control unit is divided into: the system may include a run flag area, a start-up program area, a normal BootLoader program area, a backup BootLoader program area, and an application program area:
a first operation module 401 for operating the program in the starting start program area
A first judging module 402, configured to judge whether a BootLoader flag in the running flag area is 0 or 1;
a skip module 403, configured to skip to the second operation module 406 when the BootLoader flag in the operation flag area is 0;
the copy module 404 is configured to copy, when the BootLoader flag in the running flag area is 1, the code in the backup BootLoader program area to the normal BootLoader program area;
a first setting module 405, configured to set a BootLoader flag in the running flag area to 0 after the code copying is completed;
a second operation module 406, configured to operate a program in the normal BootLoader program area;
a second judging module 407, configured to judge whether the upgrade flag in the running flag area is 0 or 1;
a third running module 408, configured to run the program in the application area when the upgrade flag in the running flag area is 0;
a fourth determining module 409, configured to determine whether an upgrade request is received;
a fourth setting module 410, configured to set an upgrade flag in the running flag area to 1 when receiving the upgrade request, and return to the first running module 401 through a return module 416;
a third determining module 411, configured to determine whether the upgrade area is a flash area of a BootLoader and/or a flash area of an application program when the upgrade flag in the operation flag area is 1;
the first updating module 412 is configured to erase the flash area of the backup BootLoader program area and write a new BootLoader program code when the upgrade area is the flash area of the BootLoader;
a second setting module 413, configured to set a BootLoader flag in the running flag area to 1;
the second updating module 414 is configured to erase the flash area of the application program and write new application program codes when the upgrade area is the flash area of the application program;
the third setting module 415 is configured to set the upgrade flag in the running flag area to 0, and return to the first running module 401 through the returning module 416.
The working principle of the BootLoader self-upgrading system disclosed in the embodiment is the same as that of the BootLoader self-upgrading method embodiment 1, and is not described herein.
In the present specification, each embodiment is described in a progressive manner, and each embodiment is mainly described in a different point from other embodiments, and identical and similar parts between the embodiments are all enough to refer 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 invention.
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.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. The BootLoader self-upgrading method is characterized by being applied to an electronic control unit, wherein a programmable storage area of the electronic control unit is divided into: the method comprises the following steps of running a mark area, a starting start program area, a normal BootLoader program area, a backup BootLoader program area and an application program area, wherein the method comprises the following steps:
after the electronic control unit is powered on and started, running the program in the starting program area;
judging whether a BootLoader mark in the operation mark area is 0 or 1;
when the BootLoader mark in the operation mark area is 1, copying codes in the backup BootLoader program area to a normal BootLoader program area;
after the code copying is completed, setting a BootLoader flag in the running flag area to 0;
running the program in the normal BootLoader program area;
judging whether an upgrade mark in the operation mark area is 0 or 1;
when the upgrading mark in the operation mark area is 1, judging whether the upgrading area is a flash area of a BootLoader and/or a flash area of an application program;
when the upgrading area is a flash area of the BootLoader, erasing the flash area of the backup BootLoader program area, and writing in a new BootLoader program code;
setting a BootLoader flag in the running flag area to 1;
setting an upgrade flag in the run flag area to 0;
and returning to running the program in the starting start program area again.
2. The method as recited in claim 1, further comprising:
and when the BootLoader flag in the running flag area is 0, jumping to running the program in the normal BootLoader program area.
3. The method as recited in claim 2, further comprising:
when the upgrade flag in the running flag area is 0, the program in the application area is run.
4. A method according to claim 3, further comprising:
judging whether an upgrade request is received, if so, then:
setting an upgrade flag in the running flag area to 1;
and returning to running the program in the starting start program area again.
5. The method as recited in claim 1, further comprising:
and when the upgrading area is a flash area of the application program, erasing the flash area of the application program and writing in new application program codes.
6. A BootLoader self-upgrade system, applied to an electronic control unit, wherein a programmable memory area of the electronic control unit is divided into: the system comprises a running mark area, a starting program area, a normal BootLoader program area, a backup BootLoader program area and an application program area, and the system comprises:
the first operation module is used for operating the program in the starting program area after the electronic control unit is electrified and started;
the first judging module is used for judging whether the BootLoader mark in the running mark area is 0 or 1;
the copy module is used for copying codes in the backup BootLoader program area to the normal BootLoader program area when the BootLoader mark in the operation mark area is 1;
the first setting module is used for setting a BootLoader mark in the running mark area to be 0 after the code copying is completed;
the second operation module is used for operating the program in the normal BootLoader program area;
the second judging module is used for judging whether the upgrading mark in the running mark area is 0 or 1;
the third judging module is used for judging whether the upgrading area is a flash area of a BootLoader and/or a flash area of an application program when the upgrading mark in the running mark area is 1;
the first updating module is used for erasing the flash area of the backup BootLoader program area when the upgrading area is the flash area of the BootLoader, and writing in new BootLoader program codes;
the second setting module is used for setting a BootLoader mark in the running mark area to be 1;
a third setting module, configured to set an upgrade flag in the running flag area to 0;
and the return module is used for returning to re-run the program in the starting start program area.
7. The system of claim 6, further comprising:
and the jump module is used for jumping to the program in the normal BootLoader program area when the BootLoader mark in the operation mark area is 0.
8. The system of claim 7, further comprising:
and the third running module is used for running the program in the application program area when the upgrade mark in the running mark area is 0.
9. The system of claim 8, further comprising:
a fourth judging module, configured to judge whether an upgrade request is received;
a fourth setting module, configured to set an upgrade flag in the running flag area to 1 when an upgrade request is received;
and the return module is also used for returning to re-run the program in the starting start program area.
10. The system of claim 6, further comprising:
and the second updating module is used for erasing the flash area of the application program and writing in new application program codes when the upgrading area is the flash area of the application program.
CN202010231994.3A 2020-03-27 2020-03-27 BootLoader self-upgrading method and system Active CN111459508B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010231994.3A CN111459508B (en) 2020-03-27 2020-03-27 BootLoader self-upgrading method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010231994.3A CN111459508B (en) 2020-03-27 2020-03-27 BootLoader self-upgrading method and system

Publications (2)

Publication Number Publication Date
CN111459508A CN111459508A (en) 2020-07-28
CN111459508B true CN111459508B (en) 2023-12-01

Family

ID=71685731

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010231994.3A Active CN111459508B (en) 2020-03-27 2020-03-27 BootLoader self-upgrading method and system

Country Status (1)

Country Link
CN (1) CN111459508B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112261089B (en) * 2020-09-28 2022-07-05 中国科学院沈阳自动化研究所 Method and device for remotely upgrading program of underwater glider
CN112631625B (en) * 2020-11-20 2022-10-21 展讯通信(上海)有限公司 System upgrading method and device for embedded equipment and embedded equipment

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104360877A (en) * 2014-10-24 2015-02-18 同济大学 ECU (electronic control unit) firmware updating method based on Bootloader self update
CN105511929A (en) * 2015-12-31 2016-04-20 青岛高校信息产业股份有限公司 Remote wireless upgrading method for equipment
CN106569847A (en) * 2016-10-14 2017-04-19 数源科技股份有限公司 Method for realizing IAP remote upgrade through vehicle-mounted system based on mobile network
CN106933641A (en) * 2017-05-16 2017-07-07 江苏新安电器有限公司 A kind of scm software is from upgrade method and system
WO2018120213A1 (en) * 2016-12-30 2018-07-05 深圳配天智能技术研究院有限公司 Firmware updating method and controller
CN109582372A (en) * 2018-11-12 2019-04-05 青岛海信电器股份有限公司 A kind of starting method and device of system
CN109933348A (en) * 2019-01-21 2019-06-25 宁波普瑞均胜汽车电子有限公司 The update method and device of Bootloader in a kind of electronic control unit
CN109992280A (en) * 2017-12-29 2019-07-09 深圳市优必选科技有限公司 Method for upgrading embedded software, terminal device and storage device
CN110532014A (en) * 2019-08-20 2019-12-03 海信(广东)空调有限公司 Program upgrading method and device, terminal equipment and computer readable storage medium
CN110618825A (en) * 2019-08-02 2019-12-27 惠州市德赛西威汽车电子股份有限公司 Self-updating method for Boot Loader of car machine

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104360877A (en) * 2014-10-24 2015-02-18 同济大学 ECU (electronic control unit) firmware updating method based on Bootloader self update
CN105511929A (en) * 2015-12-31 2016-04-20 青岛高校信息产业股份有限公司 Remote wireless upgrading method for equipment
CN106569847A (en) * 2016-10-14 2017-04-19 数源科技股份有限公司 Method for realizing IAP remote upgrade through vehicle-mounted system based on mobile network
WO2018120213A1 (en) * 2016-12-30 2018-07-05 深圳配天智能技术研究院有限公司 Firmware updating method and controller
CN106933641A (en) * 2017-05-16 2017-07-07 江苏新安电器有限公司 A kind of scm software is from upgrade method and system
CN109992280A (en) * 2017-12-29 2019-07-09 深圳市优必选科技有限公司 Method for upgrading embedded software, terminal device and storage device
CN109582372A (en) * 2018-11-12 2019-04-05 青岛海信电器股份有限公司 A kind of starting method and device of system
CN109933348A (en) * 2019-01-21 2019-06-25 宁波普瑞均胜汽车电子有限公司 The update method and device of Bootloader in a kind of electronic control unit
CN110618825A (en) * 2019-08-02 2019-12-27 惠州市德赛西威汽车电子股份有限公司 Self-updating method for Boot Loader of car machine
CN110532014A (en) * 2019-08-20 2019-12-03 海信(广东)空调有限公司 Program upgrading method and device, terminal equipment and computer readable storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
王毅.BootLoader 跳转程序设计及CANBootLoader 实现.电动汽车智能远程监控及控制终端设计.2020,第63-65页. *

Also Published As

Publication number Publication date
CN111459508A (en) 2020-07-28

Similar Documents

Publication Publication Date Title
CN110231952B (en) ECU program backup and cyclic upgrade control method and device
CN109933348B (en) Method and device for updating Bootloader in electronic control unit
KR100506203B1 (en) Booting and boot code update method and system thereof
CN101557583B (en) Remote-updating and version-switching method of repeater equipment embedded software
WO2022007656A1 (en) Bootloader software updating method and apparatus, embedded controller, and storage medium
JP4548601B2 (en) Automotive control unit
CN111459508B (en) BootLoader self-upgrading method and system
CN106020861A (en) FOTA upgrading method and system for smart watch
CN112667265B (en) Method and device for updating bootstrap program
US20070250254A1 (en) On-vehicle control apparatus
CN110874237A (en) Software upgrading method, device, terminal and readable storage medium
CN112015447B (en) System updating method and device of electronic equipment, electronic equipment and storage medium
CN115718610A (en) Reliable method for updating application program of single chip microcomputer
CN113220319A (en) Data updating method and device and vehicle
JP2016126699A (en) Electronic control unit for vehicle
CN113176891B (en) Bootloader-based ECU (electronic control Unit) program programming method with backup function
CN115686554A (en) BootLoader program upgrading method and device
CN211427090U (en) Micro control unit device
KR100876748B1 (en) Method for updating boot code
CN111796839A (en) Controller program management method and device
CN112732301A (en) Vehicle upgrading method and device
CN112685053A (en) Remote upgrading control method for single chip microcomputer program
CN111831310B (en) Software updating method and system
CN115437670B (en) Automobile controller program upgrading system based on TFTP
CN115480795A (en) Method and system for upgrading vehicle-mounted ECU (electronic control Unit) supporting sleep function

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
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 4 / F, building 1, No.14 Jiuxianqiao Road, Chaoyang District, Beijing 100020

Applicant after: Beijing Jingwei Hirain Technologies Co.,Inc.

Address before: 8 / F, block B, No. 11, Anxiang Beili, Chaoyang District, Beijing 100101

Applicant before: Beijing Jingwei HiRain Technologies Co.,Ltd.

GR01 Patent grant
GR01 Patent grant