CN110874237A - Software upgrading method, device, terminal and readable storage medium - Google Patents
Software upgrading method, device, terminal and readable storage medium Download PDFInfo
- Publication number
- CN110874237A CN110874237A CN201911116702.5A CN201911116702A CN110874237A CN 110874237 A CN110874237 A CN 110874237A CN 201911116702 A CN201911116702 A CN 201911116702A CN 110874237 A CN110874237 A CN 110874237A
- Authority
- CN
- China
- Prior art keywords
- version
- software
- area
- execution
- terminal
- 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
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/60—Software deployment
- G06F8/65—Updates
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/14—Error detection or correction of the data by redundancy in operation
- G06F11/1402—Saving, restoring, recovering or retrying
- G06F11/1446—Point-in-time backing up or restoration of persistent data
- G06F11/1448—Management of the data involved in backup or backup restore
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/60—Software deployment
- G06F8/61—Installation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/70—Software maintenance or management
- G06F8/71—Version control; Configuration management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computer Security & Cryptography (AREA)
- Quality & Reliability (AREA)
- Stored Programmes (AREA)
Abstract
The invention provides a software upgrading method, which is applied to a terminal, wherein the terminal stores a first version and a second version of the same software, and the first version and the second version are respectively stored in two different backup areas, and the method comprises the following steps: receiving an upgrade instruction for the software when the execution region runs any of the two versions; erasing versions in two different backup areas and the same as in the execution area; writing the new version into the erased backup area; if the terminal system is restarted, erasing the version in the other backup area and copying the version in the execution area to the backup area; and copying the new version from the corresponding backup area to the execution area and executing the new version. The invention can ensure the reliability of software upgrading.
Description
Technical Field
The present invention relates to the field of terminal technologies, and in particular, to a software upgrading method and apparatus, a terminal, and a readable storage medium.
Background
Note that the contents described in this section do not represent all the related art.
In the process of software upgrading, in order to avoid the loss of the original software version, upgrading is mainly performed in two ways.
One is a dual backup mode, i.e. the terminal FLASH includes an execution area (APP RUN) and a single backup area (appackup). The backup method is as follows: when the MCU is powered on, jumping into the BOOTLOADER (boot loader) to execute business program APP, and then jumping from the BOOTLOADER to the APP to execute the MCU, when upgrading, writing the program into the APP BACKUP, and when starting next time, the BOOTLOADER copies the new version program of the APP BACKUP to the APP RUN to execute. Although this method has a BACKUP area, APP BACKUP can only be used to store temporary files, and the terminal restarts to copy the program from appackup to APP RUN, so that the program versions in APP RUN and APP BACKUP are the same, and when there is a significant BUG in the program version, there is no other version in FLASH, so that the device is changed into a brick.
The other is an A/B plane mode, namely, the terminal FLASH comprises two execution areas (APP RUNA and APP RUNB), the upgrading program is directly written into the APP RUNA and the APP RUNB, and the terminal jumps from a new start to the execution area which executes the updated program. This approach, while saving two different versions, has the following disadvantages: (1) most of the MCU chips have no MMU control unit (memory management unit) to use the physical address of the storage device when compiling the program, so the program is strongly correlated to the physical address of the FLASH, that is, it has been determined that the program must be run in the FLASH area when compiling the program, because the program may be downloaded to the APP RUNA and the APP RUNB, so one version of the program needs to prepare two programs (the same code, different compiling configuration) for upgrading, which makes the maintenance very inconvenient. (2) Although two versions can be saved in this way, the other block area is erased in the program upgrading process, only one version of program is left in the whole system, and if the last unique program is found to have a BUG in the upgrading process, the system terminal does not become brick, but because the BUG exists in the program upgrading process, the terminal cannot be upgraded.
Disclosure of Invention
In view of the above, in order to solve one of the technical problems in the related art to a certain extent, it is necessary to provide a software upgrading method, device, terminal and readable storage medium, which can ensure the reliability of software upgrading.
The first aspect of the present invention provides a software upgrading method, which is applied to a terminal, wherein the terminal stores a first version and a second version of the same software, and the first version and the second version are respectively stored in two different backup areas, and the method includes the following steps:
receiving an upgrade instruction for the software when the execution region runs any of the two versions;
erasing versions in two different backup areas and the same as in the execution area;
writing the new version into the erased backup area;
if the terminal system is restarted, erasing the version in the other backup area and copying the version in the execution area to the backup area;
and copying the new version from the corresponding backup area to the execution area and executing the new version.
Further, the first version and the second version are different versions, which are respectively a high version and a low version.
Further, the execution region preferentially runs the highest version of the software.
Further, if the execution area fails to execute the new version or receives a version return instruction, the execution area executes the version copied from the execution area to the backup area last time.
Further, the upgrading process is OTA upgrading.
A second aspect of the present invention provides a software upgrading apparatus applied to a terminal, where the terminal stores a first version and a second version of the same software, and the first version and the second version are stored in two different backup areas, respectively, and the apparatus includes:
the upgrading module is used for receiving an upgrading instruction aiming at the software when the execution area runs any of the two versions;
the erasing module is used for erasing the versions in the two different backup areas and the same as the versions in the execution area;
the writing module is used for writing the new version into the erased backup area;
the copying module is used for erasing the version in the other backup area and copying the version in the execution area to the backup area when the terminal system is restarted;
and the execution module is used for copying the new version from the corresponding backup area to the execution area and executing the new version.
Further, the first version and the second version are different versions, which are respectively a high version and a low version.
Further, the execution region preferentially runs the highest version of the software.
A third aspect of the present invention provides a terminal, including:
a processor; and
a storage device comprising processor-executable instructions for performing the steps of the software upgrade method when executed by a processor.
A fourth aspect of the invention provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the software upgrade method.
According to the scheme, in the upgrading process, the upgrading safety can be effectively guaranteed, the terminal can be ensured to run smoothly, and brick change is avoided.
Drawings
Fig. 1 is a flowchart of a software upgrading method according to an embodiment of the present invention.
FIG. 2 is a layout diagram of an embodiment of a memory device according to the present invention.
FIG. 3 is a diagram illustrating the state of the storage device during execution of the region.
Fig. 4 is a schematic diagram illustrating a state of the memory device after step S110 is executed.
Fig. 5 is a schematic diagram of the state of the memory device after step S120 is executed.
Fig. 6 is a schematic diagram illustrating a state of the memory device after step S140 is performed.
Fig. 7 is a schematic structural diagram of a terminal according to the present invention.
Fig. 8 is a schematic structural diagram of a software upgrading apparatus according to the present invention.
The following detailed description will further illustrate the invention in conjunction with the above-described figures.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present invention without any inventive step, are within the scope of the present invention. It is to be understood that the drawings are provided solely for the purposes of reference and illustration and are not intended as a definition of the limits of the invention.
The software upgrading method provided by the embodiment of the present invention may be applied to any terminal that needs application software, for example, may be applied to an automobile, where the automobile may include a processor and a storage device (e.g., FLASH), and the storage device includes an execution area and a backup area, specifically, the layout of the storage device of the embodiment may be shown in fig. 1, and includes a BOOTLOADER, an execution area (APP RUN), a first backup area (APP backup area), and a second backup area (APPBACKUPB). Specifically, as shown in fig. 2, the software upgrading method provided in this embodiment may include the following steps:
s100: and receiving an upgrading instruction aiming at the software when the execution area runs any one of the two versions.
In this embodiment, preferably, the first version and the second version are different versions, that is, high and low versions, respectively, for example, the first version is a low version, the second version is a high version, and the execution region may run the high version or the low version. Of course, when leaving the factory, the manufacturer may write two identical software versions (completely qualified versions) into the first backup area and the second backup area, respectively. The upgrade order may be a conventional upgrade or an OTA upgrade.
In this embodiment, to ensure that the upgraded software can be reasonably applied, the execution region preferentially runs the high version (which may be the second version in this embodiment).
At this time, the state of the memory device is as shown in fig. 3.
S110: the versions in two different backup areas and the same as in the execution area are erased.
After receiving the upgrade instruction, the same version in the backup area as that in the execution area is erased, and in this embodiment, the second version in the second backup area is erased.
At this time, the state of the memory device is as shown in fig. 4.
S120: and writing the new version into the erased backup area.
The new version may be a third version. After writing into the erased second spare area, the state of the storage device is as shown in fig. 5.
S130: and if the terminal system is restarted, erasing the version in the other backup area and copying the version in the execution area to the backup area.
And after the terminal is restarted, erasing the first version in the first generation partition area, and copying the second version in the original execution area to the first backup area.
S140: and copying the new version from the corresponding backup area to the execution area and executing the new version.
The third version is copied from the second backup area to the execution area, and the execution area executes the third version, at which time the state of the storage device is as shown in fig. 6.
Thus, if the software has a new version to be upgraded again, the steps S100-S140 can be repeated to complete the upgrade.
After step S140, if the execution area fails to execute the new version or receives a version rollback instruction, the execution area executes the version that was last copied from the execution area to the backup area.
If the upgraded version is invalid, the execution area cannot execute the third version, and the abnormal condition of the version can be detected through an abnormal detection mechanism. When the execution region cannot execute the third version, the execution region may then fall back to executing the second version.
In the software upgrading method provided by the embodiment, after the upgrading is completed, three software versions exist, and after the terminal is restarted, the backup area includes programs of two versions, even if the new version cannot be started, at least one of the two versions has normal OTA function, so that the terminal is ensured to still have a normal software version available for subsequent upgrading, and the upgrading safety is ensured.
Fig. 7 is a block diagram of an embodiment of the terminal 100 according to the present invention, where the terminal 100 may include a processor 10, a storage device 20, and a software upgrading device, and further includes a computer program, such as a software upgrading program, stored in the storage device 20 and executable on the processor 10.
The processor 10 may be a Central Processing Unit (CPU), but may also be other general purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may be any conventional processor or the like, which is the control center of the terminal 100 and connects the various parts of the entire terminal 100 using various interfaces and lines.
The storage device 20 may be used to store the computer programs and/or modules, and the processor 10 implements various functions of the vehicle by operating or executing the computer programs and/or modules stored in the storage device 20 and calling data stored in the storage device 20. The storage device 20 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, a program required for at least one function, and the like; the storage data area may store data created according to the use of the mobile phone, and the like. In addition, the storage device 20 may include a high speed random access storage device, and may also include a non-volatile storage device, such as a hard disk, a memory, a plug-in hard disk, a smart memory card, a secure digital card, a flash memory card, at least one piece of magnetic disk storage, a flash memory device, or other non-volatile solid state storage device.
Fig. 8 is a schematic structural diagram of a software upgrading apparatus 200 provided by the invention, where the software upgrading apparatus 200 may include an upgrading module 21, an erasing module 22, a writing module 23, a copying module 24, and an executing module 25.
The upgrading module 21 is configured to receive an upgrading instruction for the software when the execution region runs any one of the two versions;
the erasing module 22 is configured to erase the same version in the two different backup areas and the execution area;
the writing module 23 is configured to write the new version into the erased backup area;
the copy module 24, when the terminal system is restarted, erases the version in another backup area and copies the version in the execution area to the backup area;
the executing module 25 is configured to copy the new version from the corresponding backup area to the executing area and execute the new version.
Further, the first version and the second version are different versions, which are respectively a high version and a low version.
Further, the execution region preferentially runs the highest version of the software.
Further, the software upgrading apparatus 200 further includes a rollback module 26.
The rollback module 26 is configured to, when the execution area fails to execute the new version or receives a version rollback instruction, execute the version that was last copied from the execution area to the backup area.
Further, the upgrading process is OTA upgrading.
An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of the software upgrading method.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents and improvements made within the spirit and principle of the present invention are intended to be included within the scope of the present invention.
Claims (10)
1. A software upgrading method is applied to a terminal, and is characterized in that the terminal stores a first version and a second version of the same software, and the first version and the second version are respectively stored in two different backup areas, and the method comprises the following steps:
receiving an upgrade instruction for the software when the execution region runs any of the two versions;
erasing versions in two different backup areas and the same as in the execution area;
writing the new version into the erased backup area;
if the terminal system is restarted, erasing the version in the other backup area and copying the version in the execution area to the backup area;
and copying the new version from the corresponding backup area to the execution area and executing the new version.
2. The software upgrading method according to claim 1, wherein the first version and the second version are different versions, respectively a high version and a low version.
3. The software upgrading method of claim 2, wherein the execution region preferentially runs the highest version of the software.
4. The software upgrading method according to claim 1 to 3, wherein if the execution area fails to execute the new version or receives a version rollback instruction, the execution area executes the version that was last copied from within the execution area to the backup area.
5. The software upgrade method according to claim 1, wherein the upgrade procedure is an OTA upgrade.
6. A software upgrading device applied to a terminal, wherein the terminal stores a first version and a second version of the same software, and the first version and the second version are respectively stored in two different backup areas, the device comprising:
the upgrading module is used for receiving an upgrading instruction aiming at the software when the execution area runs any of the two versions;
the erasing module is used for erasing the versions in the two different backup areas and the same as the versions in the execution area;
the writing module is used for writing the new version into the erased backup area;
the copying module is used for erasing the version in the other backup area and copying the version in the execution area to the backup area when the terminal system is restarted;
and the execution module is used for copying the new version from the corresponding backup area to the execution area and executing the new version.
7. The software upgrading apparatus according to claim 6, wherein the first version and the second version are different versions, respectively a high version and a low version.
8. The software upgrading apparatus according to claim 7, wherein the execution region preferentially runs the highest version of the software.
9. A terminal, characterized in that the terminal comprises:
a processor; and
a storage device comprising processor-executable instructions which, when executed by a processor, are for performing the steps of the software upgrade method of any one of claims 1 to 5.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the software upgrading method as claimed in any one of claims 1-5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911116702.5A CN110874237A (en) | 2019-12-30 | 2019-12-30 | Software upgrading method, device, terminal and readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911116702.5A CN110874237A (en) | 2019-12-30 | 2019-12-30 | Software upgrading method, device, terminal and readable storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110874237A true CN110874237A (en) | 2020-03-10 |
Family
ID=69718183
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201911116702.5A Pending CN110874237A (en) | 2019-12-30 | 2019-12-30 | Software upgrading method, device, terminal and readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110874237A (en) |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111679848A (en) * | 2020-04-16 | 2020-09-18 | 福建星网物联信息系统有限公司 | Software updating method and terminal |
CN112230959A (en) * | 2020-10-16 | 2021-01-15 | 广州极飞科技有限公司 | Battery firmware processing method and device, intelligent battery and storage medium |
CN112486549A (en) * | 2020-10-30 | 2021-03-12 | 广汽零部件有限公司 | Automobile embedded software upgrading method and device and storage medium |
CN114189440A (en) * | 2021-11-01 | 2022-03-15 | 深圳拓邦股份有限公司 | Remote upgrading method and device for multiple control boards of Internet of things equipment and storage medium |
CN115756561A (en) * | 2022-10-14 | 2023-03-07 | 广州汽车集团股份有限公司 | Software upgrading method and device, computer equipment and storage medium |
CN117270914A (en) * | 2023-11-17 | 2023-12-22 | 西安第六镜网络科技有限公司 | System upgrading method, device, equipment and medium of terminal equipment |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101557583A (en) * | 2009-03-19 | 2009-10-14 | 珠海银邮光电技术发展股份有限公司 | Remote-updating and version-switching method of repeater equipment embedded software |
CN102360298A (en) * | 2011-09-27 | 2012-02-22 | 青岛海信电器股份有限公司 | Software upgrading method of terminal equipment |
CN105912356A (en) * | 2016-03-31 | 2016-08-31 | 武汉光迅科技股份有限公司 | Optical module firmware program online upgrade method supporting version fallback |
CN106897092A (en) * | 2017-02-23 | 2017-06-27 | 深圳市英威腾电气股份有限公司 | A kind of remote software upgrade method and controller |
CN107179909A (en) * | 2017-05-16 | 2017-09-19 | 广东美的暖通设备有限公司 | Method for upgrading software, device and computer-readable recording medium |
WO2018177193A1 (en) * | 2017-03-27 | 2018-10-04 | 中兴通讯股份有限公司 | Software upgrade method and device |
-
2019
- 2019-12-30 CN CN201911116702.5A patent/CN110874237A/en active Pending
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101557583A (en) * | 2009-03-19 | 2009-10-14 | 珠海银邮光电技术发展股份有限公司 | Remote-updating and version-switching method of repeater equipment embedded software |
CN102360298A (en) * | 2011-09-27 | 2012-02-22 | 青岛海信电器股份有限公司 | Software upgrading method of terminal equipment |
CN105912356A (en) * | 2016-03-31 | 2016-08-31 | 武汉光迅科技股份有限公司 | Optical module firmware program online upgrade method supporting version fallback |
CN106897092A (en) * | 2017-02-23 | 2017-06-27 | 深圳市英威腾电气股份有限公司 | A kind of remote software upgrade method and controller |
WO2018177193A1 (en) * | 2017-03-27 | 2018-10-04 | 中兴通讯股份有限公司 | Software upgrade method and device |
CN107179909A (en) * | 2017-05-16 | 2017-09-19 | 广东美的暖通设备有限公司 | Method for upgrading software, device and computer-readable recording medium |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111679848A (en) * | 2020-04-16 | 2020-09-18 | 福建星网物联信息系统有限公司 | Software updating method and terminal |
CN112230959A (en) * | 2020-10-16 | 2021-01-15 | 广州极飞科技有限公司 | Battery firmware processing method and device, intelligent battery and storage medium |
CN112486549A (en) * | 2020-10-30 | 2021-03-12 | 广汽零部件有限公司 | Automobile embedded software upgrading method and device and storage medium |
CN114189440A (en) * | 2021-11-01 | 2022-03-15 | 深圳拓邦股份有限公司 | Remote upgrading method and device for multiple control boards of Internet of things equipment and storage medium |
CN115756561A (en) * | 2022-10-14 | 2023-03-07 | 广州汽车集团股份有限公司 | Software upgrading method and device, computer equipment and storage medium |
CN117270914A (en) * | 2023-11-17 | 2023-12-22 | 西安第六镜网络科技有限公司 | System upgrading method, device, equipment and medium of terminal equipment |
CN117270914B (en) * | 2023-11-17 | 2024-04-16 | 西安第六镜网络科技有限公司 | System upgrading method, device, equipment and medium of terminal equipment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110874237A (en) | Software upgrading method, device, terminal and readable storage medium | |
US9164756B2 (en) | Software updating process for an embedded device | |
US20110283274A1 (en) | Firmware image update and management | |
CN104123153A (en) | Apparatus and method for firmware upgrade using USB | |
US10579300B2 (en) | Information handling system firmware persistent memory runtime reclaim | |
US20140304497A1 (en) | Electronic device having function of booting operating system by bootloader, method of performing the same function, and storage medium | |
WO2015154538A1 (en) | Memory booting method and device | |
CN109582332B (en) | System upgrading method and device for Internet camera | |
US20140258699A1 (en) | Boot fault tolerant device and method thereof | |
TW201319942A (en) | Method for flashing firmware and booting method and electronic apparatus using the method thereof | |
CN111045712A (en) | Single system upgrading method and system with backup function | |
CN116578327B (en) | Program updating method and device, electronic equipment and storage medium | |
CN115061713A (en) | Method and device for upgrading electronic equipment | |
CN113157303A (en) | Upgrading method, embedded system, terminal and computer storage medium | |
CN102298531B (en) | Method for upgrading flash memory file system in embedded system | |
JP2009015428A (en) | Program update method, information processor, program, and recording medium | |
CN110716723A (en) | Firmware upgrading method and system | |
JP6192089B2 (en) | Information processing apparatus, control method and control program for information processing apparatus | |
CN114138314A (en) | CPU microcode upgrading method, system and related assembly | |
KR20070060448A (en) | Device and method for upgradin system using two step bootloader | |
CN110515665B (en) | Starting method, system and device of processor system | |
CN115686554A (en) | BootLoader program upgrading method and device | |
CN112667444A (en) | System upgrading method, storage medium and terminal equipment | |
US20120185686A1 (en) | Method, Apparatus and Computer Program for Loading Files During a Boot-Up Process | |
KR100575927B1 (en) | Method for booting the nand flash memory using multi boot loader in mobile station |
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 | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20200310 |
|
RJ01 | Rejection of invention patent application after publication |