CN111433739A - Program upgrading method and embedded device - Google Patents

Program upgrading method and embedded device Download PDF

Info

Publication number
CN111433739A
CN111433739A CN201880068994.7A CN201880068994A CN111433739A CN 111433739 A CN111433739 A CN 111433739A CN 201880068994 A CN201880068994 A CN 201880068994A CN 111433739 A CN111433739 A CN 111433739A
Authority
CN
China
Prior art keywords
program
address
application program
bootstrap
storage area
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
CN201880068994.7A
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.)
SZ DJI Technology Co Ltd
Original Assignee
SZ DJI Technology 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 SZ DJI Technology Co Ltd filed Critical SZ DJI Technology Co Ltd
Publication of CN111433739A publication Critical patent/CN111433739A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • 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/445Program loading or initiating

Landscapes

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

Abstract

A program upgrade method and an embedded device (100). The program upgrading method is applied to the embedded device (100), a first bootstrap program and a first application program are stored in a memory (21) of the embedded device (100), and the method comprises the following steps: starting a first bootstrap program, and acquiring a first jump address of the first bootstrap program; the first jump address is the running address of the first application program (S301); if the firmware upgrading packet is received, deleting the first application program according to the first jump address, and storing the firmware upgrading packet; the firmware upgrade package includes a second application program and a second boot program (S302); restarting the first bootstrap program to obtain a second jump address of the first bootstrap program; the second jump address is the running address of the second application program (S303); the second application is executed according to the second jump address to replace the first boot program with the second boot program (S304). The operating address of the application program is automatically addressed through the bootstrap program, so that the program upgrading is completed, and the efficiency of the program upgrading is improved.

Description

Program upgrading method and embedded device Technical Field
The embodiment of the invention relates to the technical field of computers, in particular to a program upgrading method and embedded equipment.
Background
With the development of computer technology, embedded systems are more and more widely applied. In order to facilitate maintenance of the product, prolong the service life of the product and expand new product functions, the embedded system needs to be upgraded, including upgrading the boot program and upgrading the application program.
The boot program is a first segment program after the device is powered on, and the function of the boot program comprises booting the device into the application program.
Currently, a burner may be used to upgrade the boot program. However, disassembly of the product is required. Moreover, the burner is generally expensive. The operation of the boot program is complicated, the efficiency is too low, the cost is too high during upgrading, and the boot program is not easy to execute.
Disclosure of Invention
The invention provides a program upgrading method and embedded equipment, which improve the efficiency of upgrading programs of the embedded equipment and reduce the complexity and cost of operation.
In a first aspect, the present invention provides a method for upgrading a program, which is applied to an embedded device, where a memory of the embedded device stores a first boot program and a first application program, and the method includes:
starting the first bootstrap program, and acquiring a first jump address of the first bootstrap program; the first jump address is the running address of the first application program;
if a firmware upgrading packet is received, deleting the first application program according to the first jump address, and storing the firmware upgrading packet; the firmware upgrade package comprises a second application program and a second boot program;
restarting the first bootstrap program to acquire a second jump address of the first bootstrap program; the second jump address is the running address of the second application program;
and running the second application program according to the second jump address so as to replace the first bootstrap program with the second bootstrap program.
In a second aspect, the present invention provides an embedded device, comprising: a memory, a processor, and a transceiver; the memory stores a first bootstrap program and a first application program;
the memory is further to store instructions;
the processor is configured to execute the instructions to implement:
starting the first bootstrap program, and acquiring a first jump address of the first bootstrap program; the first jump address is the running address of the first application program;
if the transceiver receives a firmware upgrading packet, deleting the first application program according to the first jump address, and storing the firmware upgrading packet; the firmware upgrade package comprises a second application program and a second boot program;
restarting the first bootstrap program to acquire a second jump address of the first bootstrap program; the second jump address is the running address of the second application program;
and running the second application program according to the second jump address so as to replace the first bootstrap program with the second bootstrap program.
In a third aspect, the present invention provides a storage medium comprising: a readable storage medium and a computer program for implementing the method for upgrading a program provided in any of the embodiments of the first aspect.
In a fourth aspect, the invention provides a program product comprising a computer program (i.e. executing instructions), the computer program being stored on a readable storage medium. The processor may read the computer program from the readable storage medium, and execute the computer program to perform the upgrading method of the program provided by any of the embodiments of the first aspect.
The invention provides a program upgrading method and embedded equipment. When a first bootstrap program and a first application program are stored in a memory of the embedded device, a first jump address of the first bootstrap program is obtained by starting the first bootstrap program, if a firmware upgrading packet is received, the first application program is deleted according to the first jump address, the firmware upgrading packet is stored, the first bootstrap program is restarted, a second jump address of the first bootstrap program is obtained, and a second application program is operated according to the second jump address so as to replace the first bootstrap program with the second bootstrap program. The operating address of the application program is automatically addressed by the bootstrap program, and the application program is operated, so that the old application program can be deleted, the old bootstrap program is replaced by the new bootstrap program, and the program upgrading is completed. The efficiency of embedded equipment program upgrading is promoted, and the operation complexity and cost are reduced.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
FIG. 1 is a schematic diagram of an environment for program upgrade in an embedded device to which the present invention is applied;
FIG. 2 is a diagram illustrating firmware transmission between an embedded device and a server via a controller according to the present invention;
fig. 3 is a flowchart of an upgrading method of a program according to an embodiment of the present invention;
fig. 4 is a schematic diagram of a scenario of program update according to an embodiment of the present invention;
fig. 5 is a schematic diagram of another scenario of program update according to an embodiment of the present invention;
fig. 6 is a schematic diagram of a scenario of program update according to a second embodiment of the present invention;
fig. 7 is a schematic diagram of a scenario of program update according to a third embodiment of the present invention;
fig. 8 is a schematic structural diagram of an embedded device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, 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 some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 is a schematic diagram of an environment for program upgrade in an embedded device to which the present invention is applied. As shown in fig. 1, data transmission may be performed between the embedded device 100 and the server 300. Firmware may be stored on the server 300. The embedded device 100 may receive firmware from the server 300. The most basic, underlying layer of software in a hardware device is often referred to as firmware. In the present invention, firmware refers to composite firmware including an application program plus a boot program.
Optionally, a controller 200 may also be included. The controller 200 can perform data transmission with the embedded device 100 and the server 300, respectively. At this time, the controller 200 may receive the firmware from the server 300 and transmit the firmware to the embedded device 100.
Fig. 2 is a schematic diagram illustrating firmware transmission between an embedded device and a server through a controller according to an exemplary embodiment of the present invention. As shown in fig. 2, the embedded device 100 may include a memory 21, a processor 22, and a transceiver 23. The controller 200 may include a transceiver 24 and a processor 25. Optionally, the controller 200 may also include a network adapter 26. The network adapter 26 may obtain the latest firmware from the server 300. The transceiver 24 may send the latest firmware to the embedded device 100. Accordingly, the transceiver 23 may receive the latest firmware from the controller 200. After acquiring the latest firmware, the embedded device 100 stores the latest firmware in the memory 21.
It should be noted that the number and implementation of the embedded devices 100 are not limited in the present invention.
It should be noted that the implementation of the controller 200 is not limited in the present invention. Alternatively, the controller 200 may be implemented by hardware and/or software.
It should be noted that, in some scenarios of the present embodiment, the program upgrade and the program replacement have the same meaning.
Fig. 3 is a flowchart of a program upgrading method according to an embodiment of the present invention. As shown in fig. 3, the method for upgrading a program provided in this embodiment may be applied to an embedded device. The memory of the embedded device stores a first bootstrap program and a first application program. The method for upgrading a program provided by this embodiment may include:
s301, starting a first bootstrap program and acquiring a first jump address of the first bootstrap program.
And the first jump address is the running address of the first application program.
In this embodiment, in order to distinguish different boot programs and application programs involved in the program upgrading process, the boot program currently stored by the embedded device before the program upgrading is referred to as a first boot program, and the application program jumped to be executed by the first boot program is referred to as a first application program. At this time, the jump address of the first boot program is referred to as a first jump address, and the first jump address is a running address of the first application program.
The following description is made with reference to examples.
Fig. 4 is a schematic diagram of a scenario of program update according to an embodiment of the present invention. In this example, the first bootstrap program is bootstrap program 1, and the first application program is application program 1. As shown in fig. 4, after the embedded device is powered on, the boot program 1 is started from the address a of the memory. After that, it jumps to the running address B of the application 1. If the program does not need to be upgraded, application 1 will be run.
S302, if the firmware upgrading packet is received, deleting the first application program according to the first jump address, and storing the firmware upgrading packet.
The firmware upgrade package comprises a second application program and a second boot program.
Optionally, the second boot program may be preceded by a second application trailer.
It should be noted that the first boot program and the second boot program may be different or the same. The first application and the second application may or may not be the same.
The following description will be given by taking fig. 4 as an example. The second bootstrap program is bootstrap program 2, and the second application program is application program 2. As shown in fig. 4, the boot program 1 is addressed to the running address B of the application program 1. If the firmware upgrade package is received, the application 1 is deleted. And, storing the firmware upgrade package. In this example, the initial memory address of the application 2 is address C.
Optionally, in S302, receiving the firmware upgrade package may include:
a firmware upgrade package is received from a server. Alternatively, the first and second electrodes may be,
and receiving a firmware upgrading packet from the controller, wherein the firmware upgrading packet is received by the controller from the server through the network adapter.
Specifically, refer to fig. 1 and fig. 2, which are not described herein again.
Alternatively, the firmware upgrade package may include a plurality of data packages. In S302, receiving the firmware upgrade package may include:
a plurality of data packets are received on a packet-by-packet basis.
Optionally, in one implementation, the embedded device may receive a plurality of data packets from the server on a packet-by-packet basis.
Alternatively, in another implementation, the controller may receive a firmware upgrade package from a server. The controller may split the firmware upgrade package into a plurality of data packets, which are sent to the embedded device on a packet-by-packet basis. Accordingly, the embedded device may receive multiple data packets from the controller on a packet-by-packet basis.
Optionally, in another implementation, the controller may receive a plurality of data packets from the server packet by packet, and send the data packets to the embedded device packet by packet. Accordingly, the embedded device may receive multiple data packets from the controller on a packet-by-packet basis.
It should be noted that, in the present embodiment, the number of packets and the size of each packet are not limited.
Accordingly, in S302, storing the firmware upgrade package may include:
a plurality of data packets are stored packet by packet.
S303, restarting the first bootstrap program and acquiring a second jump address of the first bootstrap program.
And the second jump address is the running address of the second application program.
And S304, operating the second application program according to the second jump address so as to replace the first bootstrap program with the second bootstrap program.
Specifically, after the firmware upgrade package is stored, the first boot program is restarted. The first boot program may be automatically addressed to the running address of the second application program. At this time, the jump address of the first boot program is referred to as a second jump address, and the second jump address is a running address of the second application program. And then, by running the second application program, the first boot program can be replaced by the second boot program, and the upgrading of the old firmware into the new firmware is completed. And then the embedded device can be powered on again, and the second bootstrap program can automatically address the running address of the second application program and run the second application program.
Optionally, in S304, running the second application according to the second jump address to replace the first bootstrap with the second bootstrap may include:
the first boot program is deleted.
And storing the second bootstrap program according to the initial storage address of the first bootstrap program.
And deleting the second boot program in the stored firmware upgrade package.
The following description will be given by taking fig. 4 as an example.
After the embedded device stores the application 2 and the bootstrap program 2, the bootstrap program 1 is restarted. The boot program 1 is automatically addressed to the running address C of the application program 2. Then, the operation address C of the application 2 is jumped to, and the application 2 is operated. At the beginning of the operation, the boot program 1 is deleted, the boot program 2 is stored in the address A, and the boot program 2 behind the application program 2 is deleted, so that the firmware upgrade is completed.
Therefore, the program upgrading method provided by the embodiment can realize the program upgrading of the embedded device by automatically addressing the running address of the application program through the bootstrap program. In particular, the old application may be deleted upon receipt of the new firmware by the old boot program automatically addressing the running address of the old application. The old bootstrap program automatically addresses the running address of the new application program and skips to execute the new application program, so that the old bootstrap program can be replaced by the new bootstrap program to finish program upgrading. Because the expensive burner is not adopted for program upgrading, and the product is not required to be disassembled, the efficiency of program upgrading of the embedded device is improved, and the operation complexity and the cost are reduced. Moreover, the bootstrap program can automatically address the running address of the application program and jump to execute the application program, so that the sizes of the application program and the bootstrap program in the new firmware can be changed at will according to requirements. When the program is upgraded, the running address of the application program can be randomly modified, and the situation that a new application program covers a new bootstrap program or the new bootstrap program covers the new application program is avoided. Coupling degree between the bootstrap program and the application program is reduced, flexibility of storage space change during upgrading of the bootstrap program and the application program is improved, and program upgrading effect is improved.
Optionally, in an implementation manner, in S303, acquiring the second jump address of the first bootstrap program may include:
and determining whether the storage area is the first storage area of the second application program one by one according to the arrangement sequence of the storage areas from the terminal address of the first bootstrap program.
And if the storage area is determined to be the first storage area of the second application program, determining the running address of the second application program stored in the first storage area as a second jump address.
Specifically, the storage space in the memory may be divided into a plurality of storage areas in advance. In this embodiment, the dividing manner of the storage areas, the number of the storage areas, and the size of each storage area are not limited. The storage area may be different according to the embedded device and the memory.
And determining whether the storage area is the first storage area of the second application program one by one according to the arrangement sequence of the storage areas from the terminal address of the first bootstrap program. And if the current storage area is not the first storage area of the second application program, continuously determining whether the next storage area of the current storage area is the first storage area of the second application program according to the arrangement sequence of the storage areas until the first storage area of the second application program is found. If the current storage area is the first storage area of the second application, the running address of the second application stored in the first storage area of the second application may be obtained and determined as the second jump address of the first boot program.
Typically, the boot program is in close proximity or very small separation from the application program. At the current stage of program upgrade, the bootstrap program is an old bootstrap program, and the application program is a new application program. Whether the storage areas are the first storage area of the new application program is determined one by one according to the sequence of the storage areas from the end address of the old bootstrap program, and the accuracy and the efficiency of finding the first storage area of the new application program are improved.
Optionally, determining whether the storage area is the first storage area of the second application program may include:
and verifying the data stored in the storage area by adopting a verification algorithm.
And if the verification is passed, determining that the storage area is the first storage area of the second application program.
Specifically, the verification algorithm is a verification operation performed to ensure the integrity of data. There are various ways to implement the checking algorithm. For example, a check value may be calculated from the data stored in the storage area and compared to the check value stored in the storage area. If the two check values are the same, the check passes. The embodiment does not limit the specific implementation manner of the verification algorithm. For example, the Check Algorithm may be a Message Digest Algorithm (MD 5), a Cyclic Redundancy Check (CRC), or the like.
The first storage area of the second application program is determined through the verification algorithm, and the accuracy of finding the first storage area of the new application program is improved.
Optionally, before determining the running address of the second application program stored in the first storage area as the second jump address, the method may further include:
and verifying the data stored in each storage area by adopting a verification algorithm from the second storage area of the second application program to the last storage area of the second application program.
And if all the storage areas of the second application program pass the verification, determining the running address of the second application program stored in the first storage area as a second jump address.
And checking all storage areas of the second application program through a checking algorithm. And only when all the storage areas of the second application program pass the verification, determining the running address of the second application program stored in the first storage area of the second application program as the second jump address of the first bootstrap program, thereby further improving the accuracy of the first bootstrap program for automatically addressing the running address of the second application program.
Optionally, before verifying the data stored in each storage area by using a verification algorithm, the method may further include:
a memory space value of the second application stored in the first memory area is obtained.
And determining a second storage area to a last storage area of the second application program according to the storage space value of the second application program.
Specifically, the first storage area of the second application program stores the running address of the second application program, and also stores the storage space value of the second application program. The storage space value is the size of the second application. According to the running address and the storage space value of the second application program, all the storage areas of the second application program can be obtained.
It should be noted that the above-mentioned embodiments related to obtaining the second jump address are also applicable to obtaining the first jump address.
Optionally, in S302, before storing the firmware upgrade package, the method may further include:
and analyzing the second application program to obtain the running address of the second application program.
Accordingly, obtaining the second jump address of the first boot program may include:
and determining the running address of the second application program as a second jump address.
In this implementation, by parsing the second application, the running address of the second application may be obtained and determined as the second jump address of the first boot program. The efficiency of obtaining the second jump address is improved.
Optionally, analyzing the second application program to obtain the operation address of the second application program may include:
and temporarily storing the first data packet of the second application program in the memory.
And analyzing the first data packet to obtain the running address of the second application program.
Specifically, the second application may be received on a packet-by-packet basis. The running address and/or the memory space value of the second application is typically stored in the front end of the second application. Therefore, the first data packet of the second application program can be temporarily stored in the memory and analyzed. So that the running address and/or the memory space value of the second application can be retrieved.
The second application program does not need to be completely stored and then analyzed, and the operation address and/or the storage space value of the second application program can be obtained only by analyzing the first data packet, so that the processing efficiency is prompted.
Optionally, in the method for upgrading a program provided in this embodiment, in S302, storing the firmware upgrade package may include:
a memory space value of the second boot program is obtained.
And determining the initial storage address for storing the firmware upgrade package according to the storage space value of the second boot program and the initial storage address of the first boot program.
And storing the firmware upgrading packet according to the initial storage address of the firmware upgrading packet.
Specifically, after the program upgrade, the first boot program is replaced with the second boot program. The starting memory addresses of the first boot program and the second boot program are the same. Therefore, the initial storage address of the firmware upgrade package can be determined according to the size of the second boot program and the initial storage address of the first boot program in the firmware upgrade package, and it is ensured that the second boot program does not cover the second application program or the second application program does not cover the second boot program after the program of the embedded device is upgraded. Therefore, the sizes of the application program and the bootstrap program in the new firmware can be changed at will according to needs, the flexibility of storage space change when the bootstrap program and the application program are upgraded is improved, and the effect of program upgrading is improved.
Optionally, a difference between the start storage address of the firmware upgrade package and the start storage address of the first boot program is greater than or equal to a preset value.
It should be noted that, the specific value of the preset value is not limited in this embodiment. Optionally, the preset value may be a memory space value of the second boot program.
This is illustrated by way of example.
In one example, as shown in FIG. 4, the starting memory address of application 2 is address C. The boot program 1 has a starting memory address of address a. The difference between address C and address a is equal to the memory space value of the boot-loader 2. When the program is upgraded, the bootstrap program 1 is replaced by the bootstrap program 2. There is no gap between the bootstrap 2 and the application 2. The storage space is saved.
In another example, fig. 5 is a schematic diagram of another scenario of program update provided in the first embodiment of the present invention. As shown in fig. 5, the initial storage address of the application 2 is address D. The boot program 1 has a starting memory address of address a. The difference between address D and address a is greater than the memory space value of bootstrap 2. When the program is upgraded, the bootstrap program 1 is replaced by the bootstrap program 2. There is a gap between the bootstrap 2 and the application 2.
The embodiment provides a program upgrading method, which includes: starting a first bootstrap program, obtaining a first jump address of the first bootstrap program, wherein the first jump address is a running address of a first application program, if a firmware upgrade package is received, deleting the first application program according to the first jump address, and storing the firmware upgrade package, wherein the firmware upgrade package comprises a second application program and a second bootstrap program, restarting the first bootstrap program, obtaining a second jump address of the first bootstrap program, wherein the second jump address is a running address of the second application program, and running the second application program according to the second jump address so as to replace the first bootstrap program with the second bootstrap program. According to the program upgrading method provided by the embodiment, the operating address of the application program is automatically addressed through the bootstrap program, the application program is operated, the old application program can be deleted, the old bootstrap program is replaced by the new bootstrap program, and the program upgrading is completed. The efficiency of embedded equipment program upgrading is promoted, and the operation complexity and cost are reduced. Moreover, the flexibility of storage space change during upgrading of the bootstrap program and the application program is improved, and the effect of program upgrading is improved.
Fig. 6 is a schematic diagram of a scenario of program update according to a second embodiment of the present invention. The program upgrading method provided in this embodiment is similar to the program upgrading method provided in the embodiments shown in fig. 3 to 5, and the technical principle and the technical effect are similar to each other, and are not described again here.
The scenario shown in the present embodiment differs from the scenario shown in fig. 4 in that: in fig. 4, the firmware upgrade package includes an application program 2 and a boot program 2. In the present embodiment, the firmware upgrade package includes an application program 3 and a boot program 2. The boot program 1 can be upgraded to the boot program 2 by adding the same boot program to different application programs.
Specifically, in fig. 6, the first bootstrap program is bootstrap program 1, and the first application program is application program 1. The second bootstrap program is bootstrap program 3, and the second application program is application program 2.
After the embedded device is powered on, the bootstrap program 1 is started from the address a of the memory. After that, it jumps to the running address B of the application 1. Since the firmware upgrade package is received, the upgrade is performed according to the firmware upgrade package. The firmware upgrade package includes an application program 3 and a boot program 2. And deleting the application program 1 according to the running address B of the application program 1. And, the firmware upgrade package is stored at address C.
The boot program 1 is restarted. The boot program 1 is automatically addressed to the running address C of the application program 3. After that, the execution application 3 is jumped. At the beginning of the operation, the boot program 1 is deleted, the boot program 2 is stored in the address A, and the boot program 2 behind the application program 3 is deleted, so that the firmware upgrade is completed.
Fig. 7 is a schematic diagram of a scenario of program update according to a third embodiment of the present invention. The present embodiment provides another implementation manner of the program upgrading method based on the embodiments shown in fig. 3 to fig. 6.
Specifically, in S304, before executing the second application according to the second jump address to replace the first boot program with the second boot program, the method may further include:
and judging whether the first bootstrap program is the same as the second bootstrap program.
And if the first bootstrap program is different from the second bootstrap program, executing a second application program operated according to the second jump address so as to replace the first bootstrap program with the second bootstrap program.
And if the first boot program is the same as the second boot program, deleting the second boot program in the stored firmware upgrade package, and running the second application program.
This will be explained with reference to fig. 7.
In fig. 7, the first bootstrap program is bootstrap program 2, and the first application program is application program 2. The second bootstrap program is bootstrap program 3, and the second application program is application program 2.
After the embedded device is powered on, the bootstrap program 2 is started from the address a of the memory. After that, it jumps to the running address C of the application 2. Since the firmware upgrade package is received, the upgrade is performed according to the firmware upgrade package. The firmware upgrade package includes an application program 3 and a boot program 2. Because the current boot program of the embedded device is the same as the boot program in the firmware upgrade package and is boot program 2, the boot program of the embedded device does not need to be replaced, and only the application program needs to be replaced. At this time, the boot program 2 following the application program 3 is deleted, and the application program 3 is run.
The first boot program and the second boot program have different scenarios, and can be seen in fig. 4 to 6. And will not be described in detail herein.
In the program upgrading method provided in this embodiment, before executing the second application program that runs according to the second jump address to replace the first boot program with the second boot program, it is necessary to determine whether the first boot program and the second boot program are the same. The first boot program is replaced with the second boot program only if the first boot program and the second boot program are not identical. When the first bootstrap program is the same as the second bootstrap program, the second bootstrap program in the firmware upgrade package can be directly deleted, so that unnecessary operation of replacing the bootstrap program is avoided, and the efficiency of program upgrade is improved.
Fig. 8 is a schematic structural diagram of an embedded device according to an embodiment of the present invention. The embedded device provided in this embodiment is used to execute the program upgrading method provided in any one of the embodiments shown in fig. 3 to 7. As shown in fig. 8, the embedded device provided in this embodiment may include: memory 82, processor 81 and transceiver 83. The memory 82 stores a first boot program and a first application program.
The memory 82 is also used to store instructions.
Processor 81 is configured to execute instructions to implement:
and starting the first bootstrap program, and acquiring a first jump address of the first bootstrap program. The first jump address is the running address of the first application program.
If the transceiver 83 receives the firmware upgrade package, the first application program is deleted according to the first jump address, and the firmware upgrade package is stored. The firmware upgrade package includes a second application program and a second boot program.
And restarting the first bootstrap program to acquire a second jump address of the first bootstrap program. The second jump address is the running address of the second application program.
And running the second application program according to the second jump address to replace the first bootstrap program with a second bootstrap program.
Optionally, the processor 81 is specifically configured to:
and determining whether the storage area is the first storage area of the second application program one by one according to the arrangement sequence of the storage areas from the terminal address of the first bootstrap program.
And if the storage area is determined to be the first storage area of the second application program, determining the running address of the second application program stored in the first storage area as a second jump address.
Optionally, the processor 81 is specifically configured to:
and verifying the data stored in the storage area by adopting a verification algorithm.
And if the verification is passed, determining that the storage area is the first storage area of the second application program.
Optionally, the processor 81 is further configured to:
and verifying the data stored in each storage area by adopting a verification algorithm from the second storage area of the second application program to the last storage area of the second application program.
And if all the storage areas of the second application program pass the verification, determining the running address of the second application program stored in the first storage area as a second jump address.
Optionally, the processor 81 is further configured to:
a memory space value of the second application stored in the first memory area is obtained.
And determining a second storage area to a last storage area of the second application program according to the storage space value of the second application program.
Optionally, the processor 81 is further configured to:
and analyzing the second application program to obtain the running address of the second application program.
The processor 81 is specifically configured to:
and determining the running address of the second application program as a second jump address.
Optionally, the processor 81 is specifically configured to:
the first packet of the second application is temporarily stored in the memory 82.
And analyzing the first data packet to obtain the running address of the second application program.
Optionally, the processor 81 is specifically configured to:
a memory space value of the second boot program is obtained.
And determining the initial storage address for storing the firmware upgrade package according to the storage space value of the second boot program and the initial storage address of the first boot program.
And storing the firmware upgrading packet according to the initial storage address of the firmware upgrading packet.
Optionally, a difference between the start storage address of the firmware upgrade package and the start storage address of the first boot program is greater than or equal to a preset value.
Optionally, the preset value is a storage space value of the second application program.
Optionally, the processor 81 is specifically configured to:
the first boot program is deleted.
And storing the second bootstrap program according to the initial storage address of the first bootstrap program.
And deleting the second boot program in the stored firmware upgrade package.
Optionally, the processor 81 is further configured to:
and judging whether the first bootstrap program is the same as the second bootstrap program.
And if the first bootstrap program is different from the second bootstrap program, executing a second application program operated according to the second jump address so as to replace the first bootstrap program with the second bootstrap program.
Optionally, the processor 81 is further configured to:
and if the first boot program is the same as the second boot program, deleting the second boot program in the stored firmware upgrade package, and running the second application program.
Optionally, the transceiver 83 is specifically configured to:
a firmware upgrade package is received from a server. Alternatively, the first and second electrodes may be,
and receiving a firmware upgrading packet from the controller, wherein the firmware upgrading packet is received by the controller from the server through the network adapter.
Optionally, the firmware upgrade package includes a plurality of data packages, and the transceiver 83 is specifically configured to:
a plurality of data packets are received on a packet-by-packet basis.
Optionally, the second boot program is continued after the second application program.
The embedded device provided in this embodiment is used to execute the program upgrading method provided in any one of the embodiments of fig. 3 to fig. 7, and the technical principle and the technical effect are similar and will not be described herein again.
Those of ordinary skill in the art will understand that: all or a portion of the steps of implementing the above-described method embodiments may be performed by hardware associated with program instructions. The program may be stored in a computer-readable storage medium. When executed, the program performs steps comprising the method embodiments described above; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
Finally, it should be noted that: the above embodiments are only used for illustrating the technical solutions of the embodiments of the present invention, and are not limited thereto; although embodiments of the present invention have been described in detail with reference to the foregoing embodiments, those skilled in the art will understand that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.

Claims (33)

  1. A program upgrading method is applied to an embedded device, a first bootstrap program and a first application program are stored in a memory of the embedded device, and the method is characterized by comprising the following steps:
    starting the first bootstrap program, and acquiring a first jump address of the first bootstrap program; the first jump address is the running address of the first application program;
    if a firmware upgrading packet is received, deleting the first application program according to the first jump address, and storing the firmware upgrading packet; the firmware upgrade package comprises a second application program and a second boot program;
    restarting the first bootstrap program to acquire a second jump address of the first bootstrap program; the second jump address is the running address of the second application program;
    and running the second application program according to the second jump address so as to replace the first bootstrap program with the second bootstrap program.
  2. The method of claim 1, wherein obtaining the second jump address of the first boot program comprises:
    determining whether the storage area is the first storage area of the second application program one by one according to the arrangement sequence of the storage areas from the terminal address of the first bootstrap program;
    and if the storage area is determined to be the first storage area of the second application program, determining the running address of the second application program stored in the first storage area as the second jump address.
  3. The method of claim 2, wherein determining whether the storage area is a first storage area of the second application comprises:
    verifying the data stored in the storage area by adopting a verification algorithm;
    and if the verification is passed, determining that the storage area is the first storage area of the second application program.
  4. The method according to claim 2 or 3, wherein before determining the running address of the second application program stored in the first storage area as the second jump address, further comprising:
    verifying the data stored in each storage area by adopting a verification algorithm from the second storage area of the second application program to the last storage area of the second application program;
    and if all the storage areas of the second application program pass the verification, determining the running address of the second application program stored in the first storage area as the second jump address.
  5. The method of claim 4, wherein before verifying the data stored in each storage region using the verification algorithm, the method further comprises:
    acquiring a storage space value of the second application program stored in the first storage area;
    and determining a second storage area to a last storage area of the second application program according to the storage space value of the second application program.
  6. The method of claim 1, wherein prior to storing the firmware upgrade package, further comprising:
    analyzing the second application program to obtain the running address of the second application program;
    the obtaining the second jump address of the first bootstrap program comprises:
    and determining the running address of the second application program as the second jump address.
  7. The method of claim 6, wherein the parsing the second application to obtain the running address of the second application comprises:
    temporarily storing a first data packet of the second application program in the memory;
    and analyzing the first data packet to obtain the running address of the second application program.
  8. The method of any of claims 1-7, wherein the storing the firmware upgrade package comprises:
    acquiring a storage space value of the second bootstrap program;
    determining an initial storage address for storing the firmware upgrade package according to the storage space value of the second boot program and the initial storage address of the first boot program;
    and storing the firmware upgrading packet according to the initial storage address of the firmware upgrading packet.
  9. The method of claim 8, wherein a difference between a starting memory address of the firmware upgrade package and a starting memory address of the first boot program is greater than or equal to a preset value.
  10. The method of claim 9, wherein the preset value is a memory space value of the second boot program.
  11. The method according to any one of claims 1-10, wherein the running the second application according to the second jump address to replace the first boot program with the second boot program comprises:
    deleting the first bootstrap program;
    storing the second bootstrap program according to the initial storage address of the first bootstrap program;
    deleting the second boot program in the stored firmware upgrade package.
  12. The method according to any of claims 1-11, wherein before the running the second application according to the second jump address to replace the first boot program with the second boot program, further comprising:
    judging whether the first bootstrap program is the same as the second bootstrap program;
    and if the first bootstrap program is different from the second bootstrap program, executing the second application program according to the second jump address so as to replace the first bootstrap program with the second bootstrap program.
  13. The method of claim 12, further comprising:
    and if the first boot program is the same as the second boot program, deleting the second boot program in the stored firmware upgrade package, and running the second application program.
  14. The method of any of claims 1-13, wherein receiving the firmware upgrade package comprises:
    receiving the firmware upgrade package from a server; alternatively, the first and second electrodes may be,
    and receiving the firmware upgrading packet from a controller, wherein the firmware upgrading packet is received by the controller from the server through a network adapter.
  15. The method of any one of claims 1-13, wherein the firmware upgrade package comprises a plurality of data packages, and wherein receiving the firmware upgrade package comprises:
    the plurality of data packets are received on a packet-by-packet basis.
  16. The method of any of claims 1-15, wherein the second boot program follows the second application trailer.
  17. An embedded device, comprising: a memory, a processor, and a transceiver; the memory stores a first bootstrap program and a first application program;
    the memory is further to store instructions;
    the processor is configured to execute the instructions to implement:
    starting the first bootstrap program, and acquiring a first jump address of the first bootstrap program; the first jump address is the running address of the first application program;
    if the transceiver receives a firmware upgrading packet, deleting the first application program according to the first jump address, and storing the firmware upgrading packet; the firmware upgrade package comprises a second application program and a second boot program;
    restarting the first bootstrap program to acquire a second jump address of the first bootstrap program; the second jump address is the running address of the second application program;
    and running the second application program according to the second jump address so as to replace the first bootstrap program with the second bootstrap program.
  18. The embedded device of claim 17, wherein the processor is specifically configured to:
    determining whether the storage area is the first storage area of the second application program one by one according to the arrangement sequence of the storage areas from the terminal address of the first bootstrap program;
    and if the storage area is determined to be the first storage area of the second application program, determining the running address of the second application program stored in the first storage area as the second jump address.
  19. The embedded device of claim 18, wherein the processor is specifically configured to:
    verifying the data stored in the storage area by adopting a verification algorithm;
    and if the verification is passed, determining that the storage area is the first storage area of the second application program.
  20. The embedded device of claim 18 or 19, wherein the processor is further configured to:
    verifying the data stored in each storage area by adopting a verification algorithm from the second storage area of the second application program to the last storage area of the second application program;
    and if all the storage areas of the second application program pass the verification, determining the running address of the second application program stored in the first storage area as the second jump address.
  21. The embedded device of claim 20, wherein the processor is further configured to:
    acquiring a storage space value of the second application program stored in the first storage area;
    and determining a second storage area to a last storage area of the second application program according to the storage space value of the second application program.
  22. The embedded device of claim 17, wherein the processor is further configured to:
    analyzing the second application program to obtain the running address of the second application program;
    the processor is specifically configured to:
    and determining the running address of the second application program as the second jump address.
  23. The embedded device of claim 22, wherein the processor is specifically configured to:
    temporarily storing a first data packet of the second application program in the memory;
    and analyzing the first data packet to obtain the running address of the second application program.
  24. The embedded device according to any one of claims 17-23, wherein the processor is specifically configured to:
    acquiring a storage space value of the second bootstrap program;
    determining an initial storage address for storing the firmware upgrade package according to the storage space value of the second boot program and the initial storage address of the first boot program;
    and storing the firmware upgrading packet according to the initial storage address of the firmware upgrading packet.
  25. The embedded device of claim 24, wherein a difference between a starting memory address of the firmware upgrade package and a starting memory address of the first boot program is greater than or equal to a preset value.
  26. The embedded device of claim 25, wherein the preset value is a memory space value of the second application.
  27. The embedded device according to any one of claims 17-26, wherein the processor is specifically configured to:
    deleting the first bootstrap program;
    storing the second bootstrap program according to the initial storage address of the first bootstrap program;
    deleting the second boot program in the stored firmware upgrade package.
  28. The embedded device of any one of claims 17-27, wherein the processor is further configured to:
    judging whether the first bootstrap program is the same as the second bootstrap program;
    and if the first bootstrap program is different from the second bootstrap program, executing the second application program according to the second jump address so as to replace the first bootstrap program with the second bootstrap program.
  29. The embedded device of claim 28, wherein the processor is further configured to:
    and if the first boot program is the same as the second boot program, deleting the second boot program in the stored firmware upgrade package, and running the second application program.
  30. The embedded device according to any one of claims 17-29, wherein the transceiver is specifically configured to:
    receiving the firmware upgrade package from a server; alternatively, the first and second electrodes may be,
    and receiving the firmware upgrading packet from a controller, wherein the firmware upgrading packet is received by the controller from the server through a network adapter.
  31. The embedded device of any one of claims 17-29, wherein the firmware upgrade package comprises a plurality of data packages, and wherein the transceiver is specifically configured to:
    the plurality of data packets are received on a packet-by-packet basis.
  32. The embedded device of any one of claims 17-31, wherein the second boot program follows the second application trailer.
  33. A storage medium, comprising: readable storage medium and computer program for implementing a method of upgrading a program according to any of claims 1-16.
CN201880068994.7A 2018-11-30 2018-11-30 Program upgrading method and embedded device Pending CN111433739A (en)

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2018/118666 WO2020107436A1 (en) 2018-11-30 2018-11-30 Program upgrade method and embedded device

Publications (1)

Publication Number Publication Date
CN111433739A true CN111433739A (en) 2020-07-17

Family

ID=70854476

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201880068994.7A Pending CN111433739A (en) 2018-11-30 2018-11-30 Program upgrading method and embedded device

Country Status (2)

Country Link
CN (1) CN111433739A (en)
WO (1) WO2020107436A1 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112905218A (en) * 2021-02-07 2021-06-04 杭州海康威视数字技术股份有限公司 Firmware upgrading method, device and equipment
CN113094067A (en) * 2021-03-30 2021-07-09 国核自仪系统工程有限公司 Firmware updating method of IO module and IO module
CN114880008A (en) * 2022-05-17 2022-08-09 联陆智能交通科技(上海)有限公司 Software upgrading method and system

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111984298B (en) * 2020-07-17 2023-07-25 歌尔科技有限公司 Program upgrading area in flash memory, program upgrading method and system

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104090796A (en) * 2014-07-08 2014-10-08 成都万维图新信息技术有限公司 Embedded device program updating method and system
CN105573797A (en) * 2015-12-18 2016-05-11 广州市中海达测绘仪器有限公司 Reversible off-line upgrade method and device for embedded system
CN106406955A (en) * 2016-09-22 2017-02-15 深圳市金溢科技股份有限公司 A method and a device for upgrades of a bootloader program in an RSU apparatus

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104346187B (en) * 2013-08-07 2017-10-17 西安诺瓦电子科技有限公司 The method for upgrading software of display screen video control card
CN104699500B (en) * 2015-01-06 2018-05-08 上海华测导航技术股份有限公司 The method that bootstrap upgrades automatically is realized in smart machine
CN107608721A (en) * 2017-09-13 2018-01-19 北京小鸟看看科技有限公司 Wear the upgrade method of virtual reality device and its bootstrap loader
CN107861745A (en) * 2017-11-30 2018-03-30 厦门科华恒盛股份有限公司 A kind of application program online upgrading method, apparatus, equipment and storage medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104090796A (en) * 2014-07-08 2014-10-08 成都万维图新信息技术有限公司 Embedded device program updating method and system
CN105573797A (en) * 2015-12-18 2016-05-11 广州市中海达测绘仪器有限公司 Reversible off-line upgrade method and device for embedded system
CN106406955A (en) * 2016-09-22 2017-02-15 深圳市金溢科技股份有限公司 A method and a device for upgrades of a bootloader program in an RSU apparatus

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112905218A (en) * 2021-02-07 2021-06-04 杭州海康威视数字技术股份有限公司 Firmware upgrading method, device and equipment
CN112905218B (en) * 2021-02-07 2023-05-26 杭州海康威视数字技术股份有限公司 Firmware upgrading method, device and equipment
CN113094067A (en) * 2021-03-30 2021-07-09 国核自仪系统工程有限公司 Firmware updating method of IO module and IO module
CN114880008A (en) * 2022-05-17 2022-08-09 联陆智能交通科技(上海)有限公司 Software upgrading method and system

Also Published As

Publication number Publication date
WO2020107436A1 (en) 2020-06-04

Similar Documents

Publication Publication Date Title
CN111433739A (en) Program upgrading method and embedded device
EP3021218B1 (en) Upgrade packet generation method, server, software upgrade method, and mobile terminal
US9043778B2 (en) Method and system for upgrading software
CN107748668B (en) Method and device for upgrading application program
EP2876865B1 (en) Communication apparatus, communication system, communication method and recording medium
CN107066300B (en) Firmware upgrading method of storage device and storage device
EP2864873B1 (en) Auto-update while running a client software application with update handshake between versions and runtime validation of the successor version
CN110730090B (en) Batch updating method, device, medium and electronic equipment for agent terminals in cloud environment
CN106843933A (en) A kind of leak restorative procedure of application program, mobile terminal and patch server
EP3933573A1 (en) Zero differential upgrade method, non-volatile storage medium and electronic device
CN105897461A (en) Multi-system OTA upgrading method and multi-system equipment
CN103036706A (en) Local processing method of application upgrading abnormity
CN110633092A (en) Server for OTA (over the air) upgrading and embedded equipment upgrading method and device
CN111143031A (en) Method and device for changing capacity of virtual machine
CN111158729A (en) System upgrading method, device, equipment and storage medium
CN107967192B (en) System crash processing method and device for intelligent terminal
CN108664255B (en) Software upgrading method and device
CN111324481A (en) Linux platform repairing method and device
CN113312073B (en) Installation package file processing method and related device
CN112685063B (en) Feature library updating method, device, network equipment and readable storage medium
US20230032581A1 (en) Method and Apparatus for Processing Virtual Machine Component
CN111385613A (en) Television system repairing method, storage medium and application server
CN111176693B (en) Upgrading method of digital television system
CN114546455A (en) MCU software upgrading method and device for double partitions
CN112312213A (en) Upgrading method of digital television system and related device

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
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20200717

WD01 Invention patent application deemed withdrawn after publication