WO2020107436A1 - 程序的升级方法和嵌入式设备 - Google Patents

程序的升级方法和嵌入式设备 Download PDF

Info

Publication number
WO2020107436A1
WO2020107436A1 PCT/CN2018/118666 CN2018118666W WO2020107436A1 WO 2020107436 A1 WO2020107436 A1 WO 2020107436A1 CN 2018118666 W CN2018118666 W CN 2018118666W WO 2020107436 A1 WO2020107436 A1 WO 2020107436A1
Authority
WO
WIPO (PCT)
Prior art keywords
program
boot program
address
application program
storage area
Prior art date
Application number
PCT/CN2018/118666
Other languages
English (en)
French (fr)
Inventor
邹旭
薛冰
杨小渊
Original Assignee
深圳市大疆创新科技有限公司
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 深圳市大疆创新科技有限公司 filed Critical 深圳市大疆创新科技有限公司
Priority to CN201880068994.7A priority Critical patent/CN111433739A/zh
Priority to PCT/CN2018/118666 priority patent/WO2020107436A1/zh
Publication of WO2020107436A1 publication Critical patent/WO2020107436A1/zh

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

Definitions

  • the embodiments of the present invention relate to the field of computer technology, and in particular, to a program upgrade method and an embedded device.
  • the boot programs and application programs of embedded devices are usually stored in readable and writable storage devices, such as non-volatile flash memory (such as NOR FLASH) devices.
  • the boot program is the first program after the device is powered on, and its function includes booting the device into the application program.
  • the jump address of the boot program of the embedded device is a preset address, and this jump address is bound to the running address of the application program.
  • the boot program needs to import the application program into a fixed address in the memory, and then jump to the fixed address to achieve the purpose of running the application program.
  • other basic functions will be added to the boot program, for example, human-computer interaction functions, external device link support functions, and so on. With the addition of basic functions of the boot program or in order to improve the reliability of the boot program, the capacity of the boot program may increase.
  • the invention provides a program upgrade method and embedded equipment, which improves the efficiency of embedded equipment program upgrade and reduces the operation complexity and cost.
  • the present invention provides a method for upgrading a program, which is applied to an embedded device.
  • the memory of the embedded device stores a first boot program and a first application program.
  • the first boot program starts the first boot program to obtain the first jump address of the first boot program;
  • the first jump address is the running address of the first application program;
  • firmware upgrade package If a firmware upgrade package is received, delete the first application program according to the first jump address and store the firmware upgrade package; the firmware upgrade package includes a second application program and a second boot program;
  • the present invention provides an embedded device, including: a memory, a processor, and a transceiver; the memory stores a first boot program and a first application program;
  • the memory is also used to store instructions
  • the processor is used to execute the instruction to realize:
  • the first boot program starts the first boot program to obtain the first jump address of the first boot program;
  • the first jump address is the running address of the first application program;
  • the transceiver receives a firmware upgrade package, delete the first application program according to the first jump address and store the firmware upgrade package;
  • the firmware upgrade package includes a second application program and a second boot program;
  • the present invention provides a storage medium, including: a readable storage medium and a computer program, where the computer program is used to implement the method for upgrading a program provided in any of the embodiments of the first aspect.
  • the present invention provides a program product that includes a computer program (ie, execution instructions), the computer program stored in a readable storage medium.
  • the processor may read the computer program from the readable storage medium, and the processor executes the computer program to perform the method for upgrading the program provided in any of the embodiments of the first aspect.
  • the invention provides a program upgrade method and an embedded device.
  • the first boot program and the first application program are stored in the memory of the embedded device, by starting the first boot program, the first jump address of the first boot program is obtained. Transfer the address to delete the first application, store the firmware upgrade package, restart the first boot program, obtain the second jump address of the first boot program, and run the second application according to the second jump address to boot the first
  • the program is replaced with the second boot program.
  • the boot program can automatically address the running address of the application program and run the application program.
  • the old application program can be deleted, and the old boot program can be replaced with the new boot program to complete the program upgrade. Improve the efficiency of embedded device program upgrade, reduce the operation complexity and cost.
  • FIG. 1 is a schematic diagram of an environment when a program is upgraded in an embedded device to which the invention is applicable;
  • FIG. 2 is a schematic diagram of firmware transmission between an embedded device and a server applicable to the present invention through a controller;
  • Embodiment 3 is a flowchart of a method for upgrading a program provided in Embodiment 1 of the present invention
  • Embodiment 4 is a schematic diagram of a scenario of program update provided by Embodiment 1 of the present invention.
  • Embodiment 1 of the present invention is a schematic diagram of another scenario of program update provided by Embodiment 1 of the present invention.
  • FIG. 6 is a schematic diagram of a scenario of program update provided by Embodiment 2 of the present invention.
  • FIG. 7 is a schematic diagram of a scenario of program update provided by Embodiment 3 of the present invention.
  • Embodiment 8 is a schematic structural diagram of an embedded device according to Embodiment 1 of the present invention.
  • FIG. 1 is a schematic diagram of an environment when a program is upgraded in an embedded device to which the present invention is applicable.
  • data transmission can be performed between the embedded device 100 and the server 300.
  • the server 300 may store firmware.
  • the embedded device 100 may receive firmware from the server 300.
  • firmware refers to a synthesized firmware including an additional boot program for an application program.
  • the 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 send the firmware to the embedded device 100.
  • FIG. 2 is a schematic diagram of firmware transmission between an embedded device and a server applicable to the present invention through a controller.
  • 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.
  • the controller 200 may further include a network adapter 26.
  • the network adapter 26 can obtain the latest firmware from the server 300.
  • the transceiver 24 can send the latest firmware to the embedded device 100.
  • the transceiver 23 can receive the latest firmware from the controller 200.
  • the embedded device 100 stores the latest firmware in the memory 21.
  • controller 200 may be implemented by hardware and/or software.
  • program upgrade and program replacement have the same meaning.
  • FIG. 3 is a flowchart of a program upgrade method provided in Embodiment 1 of the present invention.
  • the program upgrade method provided in this embodiment can be applied to embedded devices.
  • the memory of the embedded device stores the first boot program and the first application program.
  • the method for upgrading the program provided in this embodiment may include:
  • the first jump address is the running address of the first application program.
  • the boot program currently stored in the embedded device is called the first boot program, and the first boot program is skipped.
  • the application to be executed is called the first application.
  • the jump address of the first boot program is called a first jump address, and the first jump address is the running address of the first application program.
  • FIG. 4 is a schematic diagram of a scenario of program update provided by Embodiment 1 of the present invention.
  • the first boot program is boot program 1
  • the first application program is application program 1.
  • boot program 1 is started from address A of the memory. After that, jump to the run address B of the application 1. If the program does not need to be upgraded, application 1 will run.
  • the firmware upgrade package includes a second application program and a second boot program.
  • the second boot program may continue after the end of the second application program.
  • first boot program and the second boot program may be different or the same.
  • the first application and the second application may be different or the same.
  • the second boot program is boot program 2, and the second application program is application program 2.
  • the boot program 1 is addressed to the run address B of the application program 1. If the firmware upgrade package is received, the application 1 is deleted. Also, store firmware upgrade packages. In this example, the starting storage address of application 2 is address C.
  • receiving the firmware upgrade package may include:
  • the firmware upgrade package is received from the controller.
  • the firmware upgrade package is received by the controller from the server through the network adapter.
  • the firmware upgrade package may include multiple data packages.
  • receiving the firmware upgrade package may include:
  • the embedded device may receive multiple data packets from the server packet by packet.
  • the controller may receive the firmware upgrade package from the server.
  • the controller can split the firmware upgrade package into multiple data packages and send them to the embedded device one by one.
  • the embedded device can receive multiple data packets packet by packet from the controller.
  • the controller may receive multiple data packets packet by packet from the server and send the packet to the embedded device packet by packet.
  • the embedded device can receive multiple data packets packet by packet from the controller.
  • storing the firmware upgrade package may include:
  • the second jump address is the running address of the second application program.
  • the first boot program is restarted.
  • the first boot program can be automatically addressed to the running address of the second application program.
  • the jump address of the first boot program is called a second jump address
  • the second jump address is the running address of the second application program.
  • running the second application program according to the second jump address to replace the first boot program with the second boot program may include:
  • the second boot program is stored according to the starting storage address of the first boot program.
  • the embedded device stores the application program 2 and the boot program 2, restart the boot program 1.
  • the boot program 1 is automatically addressed to the running address C of the application program 2. After that, jump to the running address C of the application 2 and run the application 2. Initially, the boot program 1 is deleted, the boot program 2 is stored in the address A, and the boot program 2 after the application program 2 is deleted to complete the firmware upgrade.
  • the method for upgrading a program can automatically upgrade the program of the embedded device by automatically addressing the running address of the application program through the boot program.
  • the old boot program can automatically address the running address of the old application program, and the old application program can be deleted when the new firmware is received.
  • the old boot program can be automatically addressed to the running address of the new application program and jump to execute the new application program.
  • the old boot program can be replaced with the new boot program to complete the program upgrade. Since no expensive burner is used to upgrade the program, and there is no need to disassemble the product, the efficiency of the program upgrade of the embedded device is improved, and the operation complexity and cost are reduced.
  • the boot program can automatically address the running address of the application program and jump to execute the application program, the size of the application program and the boot program in the new firmware can be changed as needed.
  • the program is upgraded, the running address of the application program can be modified at will, and the new application program is prevented from covering the new boot program, or the new boot program covers the new application program.
  • the coupling between the boot program and the application program is reduced, the flexibility of the storage space change when the boot program and the application program are upgraded is improved, and the effect of the program upgrade is improved.
  • obtaining the second jump address of the first boot program may include:
  • the storage area is the first storage area of the second application program one by one according to the arrangement order of the storage areas.
  • the running address of the second application program stored in the first storage area is determined as the second jump address.
  • the storage space in the memory may be divided into multiple storage areas in advance.
  • the storage area can be different.
  • the storage area is the first storage area of the second application program one by one according to the arrangement order of the storage areas. If the current storage area is not the first storage area of the second application, according to the order of the storage areas, continue to determine whether the next storage area of the current storage area is the first storage area of the second application until it is found Until the first storage area of the second application. 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 can be obtained and determined as the first boot program The second jump address.
  • the bootloader and the application are close or very small.
  • the boot program is the old boot program and the application program is the new application program.
  • the storage area is the first storage area of the new application one by one in the order of storage area, which improves the accuracy and efficiency of finding the first storage area of the new application.
  • determining whether the storage area is the first storage area of the second application program may include:
  • a check algorithm is used to check the data stored in the storage area.
  • the storage area is determined to be the first storage area of the second application program.
  • the verification algorithm is a verification operation performed to ensure data integrity.
  • a check value can be calculated from the data stored in the storage area and compared with the check value stored in the storage area. If the two verification values are the same, the verification passes.
  • the check algorithm may be a message digest algorithm (Message-Digest Algorithm, MD5), a cyclic redundancy check (Cyclic Redundancy Check, CRC), and so on.
  • the verification algorithm determines the first storage area of the second application, which improves the accuracy of finding the first storage area of the new application.
  • the method may further include:
  • a verification algorithm is used to verify the data stored in each storage area.
  • the execution determines that the running address of the second application program stored in the first storage area is the second jump address.
  • All the storage areas of the second application program are verified through the verification algorithm. Only when all the storage areas of the second application pass the verification, the running address of the second application stored in the first storage area of the second application is determined as the second jump address of the first boot program To further improve the accuracy of the first boot program automatically addressing the running address of the second application program.
  • the method may further include:
  • the second storage area to the last storage area of the second application program are determined according to the storage space value of the second application program.
  • the first storage area of the second application program stores the storage space value of the second application program in addition to the running address of the second application program.
  • the storage space value is the size of the second application. According to the running address and storage space value of the second application, all storage areas of the second application can be obtained.
  • firmware upgrade package before storing the firmware upgrade package, it may further include:
  • obtaining the second jump address of the first boot program may include:
  • the running address of the second application program is determined as the second jump address.
  • the running address of the second application program can be obtained, and the running address is determined as the second jump address of the first boot program.
  • the efficiency of obtaining the second jump address is improved.
  • parsing the second application to obtain the running address of the second application may include:
  • the first data packet of the second application program is temporarily stored in the memory.
  • the second application can be received on a packet-by-packet basis.
  • the running address and/or storage space value of the second application is usually stored in the front end of the second application. Therefore, the first data packet of the second application can be temporarily stored in the memory, and the first data packet can be parsed. Therefore, the running address and/or the storage space value of the second application program can be obtained.
  • the running address and/or storage space value of the second application program can be obtained only by parsing the first data packet, prompting the processing efficiency.
  • the method for upgrading a program provided in this embodiment, in S302, storing a firmware upgrade package may include:
  • the starting storage address of the firmware upgrade package is determined.
  • the first boot program is replaced with the second boot program.
  • the starting storage addresses of the first boot program and the second boot program are the same. Therefore, according to the size of the second boot program in the firmware upgrade package and the starting storage address of the first boot program, the starting storage address of the firmware upgrade package can be determined to ensure that the second boot program after the program of the embedded device is upgraded.
  • the second application program will not be overwritten, or the second application program will not overwrite the second boot program. In this way, the size of the application program and boot program in the new firmware can be arbitrarily changed as needed, which increases the flexibility of the storage space change when the boot program and application program are upgraded, and improves the effect of program upgrade.
  • the 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.
  • the specific value of the preset value is not limited in this embodiment.
  • the preset value may be a storage space value of the second boot program.
  • the starting storage address of the application 2 is address C.
  • the initial storage address of boot program 1 is address A.
  • the difference between address C and address A is equal to the storage space value of bootloader 2.
  • boot program 1 is replaced with boot program 2. There is no gap between bootloader 2 and application 2. Saved storage space.
  • FIG. 5 is a schematic diagram of another scenario of program update provided in Embodiment 1 of the present invention.
  • the starting storage address of the application 2 is address D.
  • the initial storage address of boot program 1 is address A.
  • the difference between address D and address A is greater than the storage space value of bootloader 2.
  • boot program 1 is replaced with boot program 2. There is a gap between the bootloader 2 and the application 2.
  • This embodiment provides a method for upgrading a program, which includes: starting a first boot program, obtaining a first jump address of the first boot program, the first jump address is a running address of the first application program, and if a firmware upgrade is received Package, delete the first application program according to the first jump address and store the firmware upgrade package, the firmware upgrade package includes the second application program and the second boot program, restart the first boot program, and obtain the second of the first boot program Jump address, the second jump address is the running address of the second application program, and the second application program is run according to the second jump address to replace the first boot program with the second boot program.
  • the method for upgrading the program provided in this embodiment automatically addresses the running address of the application program through the boot program and runs the application program, which can delete the old application program, replace the old boot program with a new boot program, and complete the upgrade of the program .
  • Improve the efficiency of embedded device program upgrade reduce the operation complexity and cost.
  • the flexibility of the storage space change when the boot program and the application program are upgraded is improved, and the effect of the program upgrade is improved.
  • Embodiment 6 is a schematic diagram of a scenario of program update provided by Embodiment 2 of the present invention.
  • the method for upgrading the program provided in this embodiment is similar to the method for upgrading the program provided in the embodiments shown in FIG. 3 to FIG. 5, and the technical principles and technical effects are similar, which will not be repeated here.
  • the firmware upgrade package includes the application program 2 and the boot program 2.
  • the firmware upgrade package includes the application program 3 and the boot program 2.
  • the first boot program is boot program 1
  • the first application program is application program 1.
  • the second boot program is boot program 3, and the second application program is application program 2.
  • boot program 1 is started from address A of the memory. After that, jump to the run 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 application program 3 and boot program 2. The application 1 is deleted according to the running address B of the application 1. Also, store the firmware upgrade package at address C.
  • Restart bootloader 1 The boot program 1 is automatically addressed to the running address C of the application program 3. After that, jump to execute application 3. Initially, delete the boot program 1, store boot program 2 at address A, and delete boot program 2 after application program 3 to complete the firmware upgrade.
  • Embodiment 7 is a schematic diagram of a scenario of program update provided by Embodiment 3 of the present invention. This embodiment provides another implementation of the program upgrade method based on the embodiments shown in FIGS. 3 to 6 above.
  • the method may further include:
  • first boot program is different from the second boot program, executing the second application program according to the second jump address to replace the first boot program with the second boot program.
  • the first boot program is boot program 2 and the first application program is application program 2.
  • the second boot program is boot program 3, and the second application program is application program 2.
  • boot program 2 is started from address A of the memory. After that, jump to the run 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 application program 3 and boot program 2. Since the current boot program of the embedded device is the same as the boot program in the firmware upgrade package, both are boot programs 2. Therefore, there is no need to replace the boot program of the embedded device, only the application program needs to be replaced. At this time, delete the boot program 2 behind the application 3, and run the application 3.
  • the method for upgrading a program provided in this embodiment, before executing the second application program 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 the same. Only when the first boot program and the second boot program are different, the first boot program is replaced with the second boot program. When the first boot program is the same as the second boot program, the second boot program in the firmware upgrade package can be directly deleted, which avoids unnecessary operation of replacing the boot program and improves the efficiency of program upgrade.
  • the embedded device provided in this embodiment is used to execute the program upgrade method provided in any of the embodiments shown in FIG. 3 to FIG. 7.
  • the embedded device provided in this embodiment may include: a memory 82, a processor 81, and a transceiver 83.
  • the memory 82 stores a first boot program and a first application program.
  • the memory 82 is also used to store instructions.
  • the processor 81 is used to execute instructions to realize:
  • the first jump address is the running address of the first application program.
  • the transceiver 83 If the transceiver 83 receives the firmware upgrade package, it deletes the first application program according to the first jump address and stores the firmware upgrade package.
  • the firmware upgrade package includes a second application program and a second boot program.
  • the second jump address is the running address of the second application program.
  • the processor 81 is specifically used for:
  • the storage area is the first storage area of the second application program one by one according to the arrangement order of each storage area.
  • the running address of the second application program stored in the first storage area is determined as the second jump address.
  • the processor 81 is specifically used for:
  • a check algorithm is used to check the data stored in the storage area.
  • the storage area is determined to be the first storage area of the second application program.
  • the processor 81 is also used for:
  • a verification algorithm is used to verify the data stored in each storage area.
  • the execution determines that the running address of the second application program stored in the first storage area is the second jump address.
  • the processor 81 is also used for:
  • the second storage area to the last storage area of the second application program are determined according to the storage space value of the second application program.
  • the processor 81 is also used for:
  • the processor 81 is specifically used for:
  • the running address of the second application program is determined as the second jump address.
  • the processor 81 is specifically used for:
  • the first data packet of the second application program is temporarily stored in the memory 82.
  • the processor 81 is specifically used for:
  • the starting storage address of the firmware upgrade package is determined.
  • the 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.
  • the preset value is the storage space value of the second application.
  • the processor 81 is specifically used for:
  • the second boot program is stored according to the starting storage address of the first boot program.
  • the processor 81 is also used for:
  • first boot program is different from the second boot program, executing the second application program according to the second jump address to replace the first boot program with the second boot program.
  • the processor 81 is also used for:
  • the second boot program in the stored firmware upgrade package is deleted, and the second application program is run.
  • the transceiver 83 is specifically used for:
  • the firmware upgrade package is received from the controller.
  • the firmware upgrade package is received by the controller from the server through the network adapter.
  • the firmware upgrade package includes multiple data packets, and the transceiver 83 is specifically used to:
  • the second boot program continues after the end of the second application program.
  • the embedded device provided in this embodiment is used to execute the program upgrade method provided in any of the embodiments shown in FIG. 3 to FIG. 7.
  • the technical principles and technical effects are similar, and are not described here.

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

一种程序的升级方法和嵌入式设备(100)。其中,程序的升级方法应用于嵌入式设备(100),嵌入式设备(100)的存储器(21)存储有第一引导程序和第一应用程序,方法包括:启动第一引导程序,获取第一引导程序的第一跳转地址;第一跳转地址为第一应用程序的运行地址(S301);若接收到固件升级包,则根据第一跳转地址删除第一应用程序,并存储固件升级包;固件升级包包括第二应用程序和第二引导程序(S302);重新启动第一引导程序,获取第一引导程序的第二跳转地址;第二跳转地址为第二应用程序的运行地址(S303);根据第二跳转地址运行第二应用程序,以将第一引导程序替换为第二引导程序(S304)。通过引导程序自动寻址应用程序的运行地址,完成了程序升级,提升了程序升级的效率。

Description

程序的升级方法和嵌入式设备 技术领域
本发明实施例涉及计算机技术领域,尤其涉及一种程序的升级方法和嵌入式设备。
背景技术
随着计算机技术的发展,嵌入式系统的应用越来越广泛。为了便于产品的维护,延长产品的使用时长以及扩展新的产品功能,需要对嵌入式系统进行升级,包括对引导程序的升级和应用程序的升级。
嵌入式设备的引导程序和应用程序通常存放在可读写的存储器件中,例如,非易失闪存(例如NOR FLASH)器件等。引导程序为设备上电后的第一段程序,其功能包括引导设备进入应用程序。目前,嵌入式设备的引导程序跳转的地址为预先设定好的地址,这个跳转地址与应用程序的运行地址绑定。引导程序在引导设备进入应用程序时,需要将应用程序导入存储器固定的地址中,而后跳转到该固定的地址,从而达到运行应用程序的目的。此外,引导程序还会添加其他基本的功能,例如,人机交互功能、外扩设备链路支持功能等。随着引导程序的基础功能的添加或者为了提高引导程序的可靠性,可能导致引导程序容量的增加。
目前,可以使用烧录器对引导程序进行升级。但是,需要对产品进行拆卸。而且,烧录器一般价格昂贵。导致引导程序在升级时操作复杂、效率过低、成本过高,不利于执行。
发明内容
本发明提供一种程序的升级方法和嵌入式设备,提升了嵌入式设备程序升级的效率,降低了操作复杂度和成本。
第一方面,本发明提供一种程序的升级方法,应用于嵌入式设备,所述嵌入式设备的存储器存储有第一引导程序和第一应用程序,所述方法包括:
启动所述第一引导程序,获取所述第一引导程序的第一跳转地址;所述 第一跳转地址为所述第一应用程序的运行地址;
若接收到固件升级包,则根据所述第一跳转地址删除所述第一应用程序,并存储所述固件升级包;所述固件升级包包括第二应用程序和第二引导程序;
重新启动所述第一引导程序,获取所述第一引导程序的第二跳转地址;所述第二跳转地址为所述第二应用程序的运行地址;
根据所述第二跳转地址运行所述第二应用程序,以将所述第一引导程序替换为所述第二引导程序。
第二方面,本发明提供一种嵌入式设备,包括:存储器、处理器和收发器;所述存储器存储有第一引导程序和第一应用程序;
所述存储器还用于存储指令;
所述处理器用于运行所述指令以实现:
启动所述第一引导程序,获取所述第一引导程序的第一跳转地址;所述第一跳转地址为所述第一应用程序的运行地址;
若所述收发器接收到固件升级包,则根据所述第一跳转地址删除所述第一应用程序,并存储所述固件升级包;所述固件升级包包括第二应用程序和第二引导程序;
重新启动所述第一引导程序,获取所述第一引导程序的第二跳转地址;所述第二跳转地址为所述第二应用程序的运行地址;
根据所述第二跳转地址运行所述第二应用程序,以将所述第一引导程序替换为所述第二引导程序。
第三方面,本发明提供一种存储介质,包括:可读存储介质和计算机程序,所述计算机程序用于实现上述第一方面任一实施方式提供的程序的升级方法。
第四方面,本发明提供一种程序产品,该程序产品包括计算机程序(即执行指令),该计算机程序存储在可读存储介质中。处理器可以从可读存储介质读取该计算机程序,处理器执行该计算机程序用于执行上述第一方面任一实施方式提供的程序的升级方法。
本发明提供一种程序的升级方法和嵌入式设备。在嵌入式设备的存储器存储有第一引导程序和第一应用程序时,通过启动第一引导程序,获取第一引导程序的第一跳转地址,若接收到固件升级包,则根据第一跳转地址删除 第一应用程序,并存储固件升级包,重新启动第一引导程序,获取第一引导程序的第二跳转地址,根据第二跳转地址运行第二应用程序,以将第一引导程序替换为第二引导程序。通过引导程序自动寻址应用程序的运行地址,并运行应用程序,可以删除旧的应用程序,将旧的引导程序替换为新的引导程序,完成了程序的升级。提升了嵌入式设备程序升级的效率,降低了操作复杂度和成本。
附图说明
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作一简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1为本发明适用的嵌入式设备中程序升级时的环境示意图;
图2为本发明适用的嵌入式设备与服务器之间通过控制器进行固件传输的示意图;
图3为本发明实施例一提供的程序的升级方法的流程图;
图4为本发明实施例一提供的程序更新的一种场景的示意图;
图5为本发明实施例一提供的程序更新的另一种场景的示意图;
图6为本发明实施例二提供的程序更新的一种场景的示意图;
图7为本发明实施例三提供的程序更新的一种场景的示意图;
图8为本发明实施例一提供的嵌入式设备的结构示意图。
具体实施方式
为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
图1为本发明适用的嵌入式设备中程序升级时的环境示意图。如图1所示,嵌入式设备100与服务器300之间可以进行数据传输。服务器300上可 以存储固件。嵌入式设备100可以从服务器300接收固件。通常,将一个硬件设备中最基础、最底层工作的软件称为固件。在本发明中,固件是指包括应用程序追加引导程序形成的合成固件。
可选的,还可以包括控制器200。控制器200可以分别与嵌入式设备100和服务器300进行数据传输。此时,控制器200可以从服务器300接收固件,并将固件发送给嵌入式设备100。
示例性的,图2为本发明适用的嵌入式设备与服务器之间通过控制器进行固件传输的示意图。如图2所示,嵌入式设备100可以包括存储器21、处理器22和收发器23。控制器200可以包括收发器24和处理器25。可选的,控制器200还可以包括网络适配器26。网络适配器26可以从服务器300获取最新的固件。收发器24可以将最新的固件发送给嵌入式设备100。相应的,收发器23可以从控制器200接收最新的固件。嵌入式设备100获取到最新的固件后,将最新的固件存储在存储器21中。
需要说明的是,本发明对于嵌入式设备100的数量和实现方式不做限定。
需要说明的是,本发明对于控制器200的实现方式不做限定。可选的,控制器200可以通过硬件和/或软件实现。
需要说明的是,在本实施例的一些场景中,程序升级与程序替换的含义相同。
图3为本发明实施例一提供的程序的升级方法的流程图。如图3所示,本实施例提供的程序的升级方法,可以应用于嵌入式设备。嵌入式设备的存储器存储有第一引导程序和第一应用程序。本实施例提供的程序的升级方法,可以包括:
S301、启动第一引导程序,获取第一引导程序的第一跳转地址。
其中,第一跳转地址为第一应用程序的运行地址。
在本实施例中,为了对程序升级过程中涉及的不同的引导程序和应用程序进行区分,将程序升级之前,嵌入式设备当前存储的引导程序称为第一引导程序,将第一引导程序跳转执行的应用程序称为第一应用程序。此时,第一引导程序的跳转地址称为第一跳转地址,第一跳转地址为第一应用程序的运行地址。
下面结合示例进行说明。
图4为本发明实施例一提供的程序更新的一种场景的示意图。在该示例中,第一引导程序为引导程序1,第一应用程序为应用程序1。如图4所示,嵌入式设备上电后,从存储器的地址A启动引导程序1。之后,跳转到应用程序1的运行地址B。如果程序不需要升级,将运行应用程序1。
S302、若接收到固件升级包,则根据第一跳转地址删除第一应用程序,并存储固件升级包。
其中,固件升级包包括第二应用程序和第二引导程序。
可选的,第二引导程序可以接续在第二应用程序尾部之后。
需要说明的是,第一引导程序与第二引导程序可能不相同,也可能相同。第一应用程序与第二应用程序可能不相同,也可能相同。
下面还以图4为例进行说明。其中,第二引导程序为引导程序2,第二应用程序为应用程序2。如图4所示,引导程序1寻址到应用程序1的运行地址B。如果接收到固件升级包,则删除应用程序1。并且,存储固件升级包。在该示例中,应用程序2的起始存储地址为地址C。
可选的,S302中,接收到固件升级包,可以包括:
从服务器接收到固件升级包。或者,
从控制器接收到固件升级包,固件升级包为控制器通过网络适配器从服务器接收到的。
具体可以参见图1和图2,此处不再赘述。
可选的,固件升级包可以包括多个数据包。S302中,接收到固件升级包,可以包括:
逐包接收多个数据包。
可选的,在一种实现方式中,嵌入式设备可以从服务器逐包接收多个数据包。
可选的,在另一种实现方式中,控制器可以从服务器接收固件升级包。控制器可以将固件升级包拆分成多个数据包,逐包发送给嵌入式设备。相应的,嵌入式设备可以从控制器逐包接收多个数据包。
可选的,在另一种实现方式中,控制器可以从服务器逐包接收多个数据包,并逐包发送给嵌入式设备。相应的,嵌入式设备可以从控制器逐包接收 多个数据包。
需要说明的是,本实施例对于数据包的数量和每个数据包的大小不做限定。
相应的,S302中,存储固件升级包,可以包括:
逐包存储多个数据包。
S303、重新启动第一引导程序,获取第一引导程序的第二跳转地址。
其中,第二跳转地址为第二应用程序的运行地址。
S304、根据第二跳转地址运行第二应用程序,以将第一引导程序替换为第二引导程序。
具体的,将固件升级包进行存储后,重新启动第一引导程序。第一引导程序可以自动寻址到第二应用程序的运行地址。此时,第一引导程序的跳转地址称为第二跳转地址,第二跳转地址为第二应用程序的运行地址。之后,通过运行第二应用程序,可以实现将第一引导程序替换为第二引导程序,完成旧固件升级为新固件。之后,嵌入式设备可以重新上电,第二引导程序可以自动寻址到第二应用程序的运行地址,并运行第二应用程序。
可选的,S304中,根据第二跳转地址运行第二应用程序,以将第一引导程序替换为第二引导程序,可以包括:
删除第一引导程序。
根据第一引导程序的起始存储地址存储第二引导程序。
删除已存储的固件升级包中的第二引导程序。
下面还以图4为例进行说明。
嵌入式设备存储应用程序2和引导程序2之后,重新启动引导程序1。引导程序1自动寻址到应用程序2的运行地址C。之后,跳转到应用程序2的运行地址C,运行应用程序2。运行初始,会删除引导程序1、将引导程序2存储在地址A,以及删除应用程序2后面的引导程序2,完成固件升级。
可见,本实施例提供的程序的升级方法,通过引导程序自动寻址应用程序的运行地址,可以实现嵌入式设备的程序升级。具体的,通过旧的引导程序自动寻址旧的应用程序的运行地址,可以在接收到新固件时删除旧的应用程序。通过旧的引导程序自动寻址到新的应用程序的运行地址,并跳转执行新的应用程序,可以将旧的引导程序替换为新的引导程序,完成程序升级。 由于没有采用价格昂贵的烧录器进行程序升级,也不需要对产品进行拆卸,因此提升了嵌入式设备程序升级的效率,降低了操作复杂度和成本。而且,由于引导程序可以自动寻址应用程序的运行地址,并跳转执行应用程序,因此,可以根据需要随意改变新固件中应用程序和引导程序的大小。程序升级时,可以实现随意修改应用程序的运行地址,并且避免了新的应用程序覆盖新的引导程序,或者,新的引导程序覆盖新的应用程序。降低了引导程序与应用程序之间的耦合度,提升了引导程序和应用程序升级时存储空间变化的灵活度,提升了程序升级的效果。
可选的,在一种实现方式中,S303中,获取第一引导程序的第二跳转地址,可以包括:
从第一引导程序的末端地址开始,按照各个存储区域的排列顺序逐个确定该存储区域是否为第二应用程序的第一个存储区域。
若确定该存储区域为第二应用程序的第一个存储区域,则将第一个存储区域中存储的第二应用程序的运行地址确定为第二跳转地址。
具体的,存储器中的存储空间可以预先划分为多个存储区域。本实施例对于存储区域的划分方式、存储区域的个数和每个存储区域的大小不做限定。根据嵌入式设备的不同、存储器的不同,存储区域可以不同。
从第一引导程序的末端地址开始,按照各个存储区域的排列顺序逐个确定该存储区域是否为第二应用程序的第一个存储区域。如果当前的存储区域不是第二应用程序的第一个存储区域,则按照存储区域的排列顺序,继续确定当前存储区域的下一个存储区域是否为第二应用程序的第一个存储区域,直到找到第二应用程序的第一个存储区域为止。如果当前的存储区域是第二应用程序的第一个存储区域,则可以获得第二应用程序的第一个存储区域中存储的第二应用程序的运行地址,并将其确定为第一引导程序的第二跳转地址。
通常,引导程序与应用程序之间紧邻或者间隔非常小。在程序升级的当前阶段,引导程序为旧的引导程序,应用程序为新的应用程序。从旧的引导程序的末端地址开始,按照存储区域的顺序逐个确定存储区域是否为新的应用程序的第一个存储区域,提升了找到新的应用程序第一个存储区域的准确性和效率。
可选的,确定该存储区域是否为第二应用程序的第一个存储区域,可以包括:
采用校验算法对该存储区域存储的数据进行校验。
若校验通过,则确定该存储区域为第二应用程序的第一个存储区域。
具体的,校验算法是为了保证数据的完整性而进行的一种验证操作。校验算法的实现方式有多种。例如,可以根据存储区域存储的数据计算出一个校验值,与存储区域存储的校验值进行比较。如果两个校验值相同,则校验通过。本实施例对于校验算法的具体实现方式不做限定。例如,校验算法可以为消息摘要算法(Message-Digest Algorithm,MD5)、循环冗余校验(Cyclic Redundancy Check,CRC)等。
通过校验算法确定第二应用程序的第一个存储区域,提升了找到新的应用程序第一个存储区域的准确性。
可选的,将第一个存储区域中存储的第二应用程序的运行地址确定为第二跳转地址之前,还可以包括:
从第二应用程序的第二个存储区域开始直至第二应用程序的最后一个存储区域为止,采用校验算法对每个存储区域存储的数据进行校验。
若第二应用程序的所有存储区域均校验通过,则执行将第一个存储区域中存储的第二应用程序的运行地址确定为第二跳转地址。
通过校验算法对第二应用程序的所有存储区域进行校验。只有当第二应用程序的所有存储区域均校验通过时,才将第二应用程序的第一个存储区域中存储的第二应用程序的运行地址确定为第一引导程序的第二跳转地址,进一步提升了第一引导程序自动寻址第二应用程序运行地址的准确性。
可选的,采用校验算法对每个存储区域存储的数据进行校验之前,还可以包括:
获取第一个存储区域中存储的第二应用程序的存储空间值。
根据第二应用程序的存储空间值确定第二应用程序的第二个存储区域至最后一个存储区域。
具体的,第二应用程序的第一个存储区域除了存储有第二应用程序的运行地址之外,还存储有第二应用程序的存储空间值。存储空间值为第二应用程序的大小。根据第二应用程序的运行地址和存储空间值,可以获得第二应 用程序的所有存储区域。
需要说明的是,上述获取第二跳转地址的相关实施方式,也适用于获取第一跳转地址。
可选的,在S302中,存储固件升级包之前,还可以包括:
解析第二应用程序,获取第二应用程序的运行地址。
相应的,获取第一引导程序的第二跳转地址,可以包括:
将第二应用程序的运行地址确定为第二跳转地址。
在该种实现方式中,通过解析第二应用程序,可以获得第二应用程序的运行地址,并将该运行地址确定为第一引导程序的第二跳转地址。提升了获取第二跳转地址的效率。
可选的,解析第二应用程序,获取第二应用程序的运行地址,可以包括:
将第二应用程序的第一个数据包暂存在存储器中。
解析第一个数据包,获取第二应用程序的运行地址。
具体的,可以逐包接收第二应用程序。第二应用程序的运行地址和/或存储空间值,通常存储在第二应用程序的前端。因此,可以将第二应用程序的第一个数据包暂存在存储器中,并对第一个数据包进行解析。从而可以获取第二应用程序的运行地址和/或存储空间值。
由于不需要将第二应用程序全部存储后再进行解析,只通过解析第一个数据包就可以获取第二应用程序的运行地址和/或存储空间值,提示了处理效率。
可选的,本实施例提供的程序的升级方法,S302中,存储固件升级包,可以包括:
获取第二引导程序的存储空间值。
根据第二引导程序的存储空间值和第一引导程序的起始存储地址,确定存储固件升级包的起始存储地址。
根据固件升级包的起始存储地址,存储固件升级包。
具体的,在程序升级之后,第一引导程序被替换为第二引导程序。第一引导程序和第二引导程序的起始存储地址相同。因此,根据固件升级包中第二引导程序的大小和第一引导程序的起始存储地址,可以确定固件升级包的起始存储地址,确保了嵌入式设备的程序在升级后,第二引导程序不会覆盖 第二应用程序,或者,第二应用程序不会覆盖第二引导程序。这样,就可以根据需要随意改变新固件中应用程序和引导程序的大小,提升了引导程序和应用程序升级时存储空间变化的灵活度,提升了程序升级的效果。
可选的,固件升级包的起始存储地址与第一引导程序的起始存储地址之间的差值大于或者等于预设值。
需要说明的是,本实施例对于预设值的具体取值不做限定。可选的,预设值可以为第二引导程序的存储空间值。
下面通过示例进行说明。
在一个示例中,如图4所示,应用程序2的起始存储地址为地址C。引导程序1的起始存储地址为地址A。地址C与地址A之间的差值等于引导程序2的存储空间值。当程序升级后,引导程序1替换为引导程序2。引导程序2与应用程序2之间没有间隔。节省了存储空间。
在另一个示例中,图5为本发明实施例一提供的程序更新的另一种场景的示意图。如图5所示,应用程序2的起始存储地址为地址D。引导程序1的起始存储地址为地址A。地址D与地址A之间的差值大于引导程序2的存储空间值。当程序升级后,引导程序1替换为引导程序2。引导程序2与应用程序2之间存在间隔。
本实施例提供一种程序的升级方法,包括:启动第一引导程序,获取第一引导程序的第一跳转地址,第一跳转地址为第一应用程序的运行地址,若接收到固件升级包,则根据第一跳转地址删除第一应用程序,并存储固件升级包,固件升级包包括第二应用程序和第二引导程序,重新启动第一引导程序,获取第一引导程序的第二跳转地址,第二跳转地址为第二应用程序的运行地址,根据第二跳转地址运行第二应用程序,以将第一引导程序替换为第二引导程序。本实施例提供的程序的升级方法,通过引导程序自动寻址应用程序的运行地址,并运行应用程序,可以删除旧的应用程序,将旧的引导程序替换为新的引导程序,完成程序的升级。提升了嵌入式设备程序升级的效率,降低了操作复杂度和成本。而且,提升了引导程序和应用程序升级时存储空间变化的灵活度,提升了程序升级的效果。
图6为本发明实施例二提供的程序更新的一种场景的示意图。本实施例 提供的程序的升级方法,与图3~图5所示实施例提供的程序的升级方法相似,技术原理和技术效果相似,此处不再赘述。
本实施例所示场景与图4所示场景的区别在于:在图4中,固件升级包包括应用程序2和引导程序2。在本实施例中,固件升级包包括应用程序3和引导程序2。通过不同的应用程序追加相同的引导程序,均可以将引导程序1升级到引导程序2。
具体的,在图6中,第一引导程序为引导程序1,第一应用程序为应用程序1。第二引导程序为引导程序3,第二应用程序为应用程序2。
嵌入式设备上电后,从存储器的地址A启动引导程序1。之后,跳转到应用程序1的运行地址B。由于接收到固件升级包,因此,根据固件升级包进行升级。固件升级包包括应用程序3和引导程序2。根据应用程序1的运行地址B删除应用程序1。并且,将固件升级包存储在地址C。
重新启动引导程序1。引导程序1自动寻址到应用程序3的运行地址C。之后,跳转执行应用程序3。运行初始,删除引导程序1、将引导程序2存储在地址A,以及删除应用程序3后面的引导程序2,完成固件升级。
图7为本发明实施例三提供的程序更新的一种场景的示意图。本实施例在上述图3~图6所示实施例的基础上,提供了程序的升级方法的另一种实现方式。
具体的,在S304中,根据第二跳转地址运行第二应用程序,以将第一引导程序替换为第二引导程序之前,还可以包括:
判断第一引导程序与第二引导程序是否相同。
若第一引导程序与第二引导程序不同,则执行根据第二跳转地址运行第二应用程序,以将第一引导程序替换为第二引导程序。
若所述第一引导程序与所述第二引导程序相同,则删除已存储的所述固件升级包中的所述第二引导程序,并运行所述第二应用程序。
下面结合图7进行说明。
在图7中,第一引导程序为引导程序2,第一应用程序为应用程序2。第二引导程序为引导程序3,第二应用程序为应用程序2。
嵌入式设备上电后,从存储器的地址A启动引导程序2。之后,跳转到 应用程序2的运行地址C。由于接收到固件升级包,因此,根据固件升级包进行升级。固件升级包包括应用程序3和引导程序2。由于嵌入式设备当前的引导程序与固件升级包中的引导程序相同,均为引导程序2,因此,不需要替换嵌入式设备的引导程序,仅需要替换应用程序即可。此时,删除应用程序3后面的引导程序2,并运行应用程序3。
第一引导程序和第二引导程序不同的场景,可以参见图4~图6。此处不再赘述。
本实施例提供的程序的升级方法,在执行根据第二跳转地址运行第二应用程序,以将第一引导程序替换为第二引导程序之前,需要判断第一引导程序和第二引导程序是否相同。只有当第一引导程序和第二引导程序不相同时,才将第一引导程序替换为第二引导程序。当第一引导程序与第二引导程序相同时,可以直接删除固件升级包中的第二引导程序,避免了不必要的替换引导程序的操作,提升了程序升级的效率。
图8为本发明实施例一提供的嵌入式设备的结构示意图。本实施例提供的嵌入式设备,用于执行图3~图7任一所示实施例提供的程序的升级方法。如图8所示,本实施例提供的嵌入式设备,可以包括:存储器82、处理器81和收发器83。存储器82存储有第一引导程序和第一应用程序。
存储器82还用于存储指令。
处理器81用于运行指令以实现:
启动第一引导程序,获取第一引导程序的第一跳转地址。第一跳转地址为第一应用程序的运行地址。
若收发器83接收到固件升级包,则根据第一跳转地址删除第一应用程序,并存储固件升级包。固件升级包包括第二应用程序和第二引导程序。
重新启动第一引导程序,获取第一引导程序的第二跳转地址。第二跳转地址为第二应用程序的运行地址。
根据第二跳转地址运行第二应用程序,以将第一引导程序替换为第二引导程序。
可选的,处理器81具体用于:
从第一引导程序的末端地址开始,按照各个存储区域的排列顺序逐个确 定该存储区域是否为第二应用程序的第一个存储区域。
若确定该存储区域为第二应用程序的第一个存储区域,则将第一个存储区域中存储的第二应用程序的运行地址确定为第二跳转地址。
可选的,处理器81具体用于:
采用校验算法对该存储区域存储的数据进行校验。
若校验通过,则确定该存储区域为第二应用程序的第一个存储区域。
可选的,处理器81还用于:
从第二应用程序的第二个存储区域开始直至第二应用程序的最后一个存储区域为止,采用校验算法对每个存储区域存储的数据进行校验。
若第二应用程序的所有存储区域均校验通过,则执行将第一个存储区域中存储的第二应用程序的运行地址确定为第二跳转地址。
可选的,处理器81还用于:
获取第一个存储区域中存储的第二应用程序的存储空间值。
根据第二应用程序的存储空间值确定第二应用程序的第二个存储区域至最后一个存储区域。
可选的,处理器81还用于:
解析第二应用程序,获取第二应用程序的运行地址。
处理器81具体用于:
将第二应用程序的运行地址确定为第二跳转地址。
可选的,处理器81具体用于:
将第二应用程序的第一个数据包暂存在存储器82中。
解析第一个数据包,获取第二应用程序的运行地址。
可选的,处理器81具体用于:
获取第二引导程序的存储空间值。
根据第二引导程序的存储空间值和第一引导程序的起始存储地址,确定存储固件升级包的起始存储地址。
根据固件升级包的起始存储地址,存储固件升级包。
可选的,固件升级包的起始存储地址与第一引导程序的起始存储地址之间的差值大于或者等于预设值。
可选的,预设值为第二应用程序的存储空间值。
可选的,处理器81具体用于:
删除第一引导程序。
根据第一引导程序的起始存储地址存储第二引导程序。
删除已存储的固件升级包中的第二引导程序。
可选的,处理器81还用于:
判断第一引导程序与第二引导程序是否相同。
若第一引导程序与第二引导程序不同,则执行根据第二跳转地址运行第二应用程序,以将第一引导程序替换为第二引导程序。
可选的,处理器81还用于:
若第一引导程序与第二引导程序相同,则删除已存储的固件升级包中的第二引导程序,并运行第二应用程序。
可选的,收发器83具体用于:
从服务器接收到固件升级包。或者,
从控制器接收到固件升级包,固件升级包为控制器通过网络适配器从服务器接收到的。
可选的,固件升级包包括多个数据包,收发器83具体用于:
逐包接收多个数据包。
可选的,第二引导程序接续在第二应用程序尾部之后。
本实施例提供的嵌入式设备,用于执行图3~图7任一实施例提供的程序的升级方法,技术原理和技术效果相似,此处不再赘述。
本领域普通技术人员可以理解:实现上述各方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成。前述的程序可以存储于一计算机可读取存储介质中。该程序在执行时,执行包括上述各方法实施例的步骤;而前述的存储介质包括:ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。
最后应说明的是:以上各实施例仅用以说明本发明实施例的技术方案,而非对其限制;尽管参照前述各实施例对本发明实施例进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明实施例技术方案的范围。

Claims (33)

  1. 一种程序的升级方法,应用于嵌入式设备,所述嵌入式设备的存储器存储有第一引导程序和第一应用程序,其特征在于,所述方法包括:
    启动所述第一引导程序,获取所述第一引导程序的第一跳转地址;所述第一跳转地址为所述第一应用程序的运行地址;
    若接收到固件升级包,则根据所述第一跳转地址删除所述第一应用程序,并存储所述固件升级包;所述固件升级包包括第二应用程序和第二引导程序;
    重新启动所述第一引导程序,获取所述第一引导程序的第二跳转地址;所述第二跳转地址为所述第二应用程序的运行地址;
    根据所述第二跳转地址运行所述第二应用程序,以将所述第一引导程序替换为所述第二引导程序。
  2. 根据权利要求1所述的方法,其特征在于,所述获取所述第一引导程序的第二跳转地址,包括:
    从所述第一引导程序的末端地址开始,按照各个存储区域的排列顺序逐个确定该存储区域是否为所述第二应用程序的第一个存储区域;
    若确定该存储区域为所述第二应用程序的第一个存储区域,则将所述第一个存储区域中存储的所述第二应用程序的运行地址确定为所述第二跳转地址。
  3. 根据权利要求2所述的方法,其特征在于,所述确定该存储区域是否为所述第二应用程序的第一个存储区域,包括:
    采用校验算法对该存储区域存储的数据进行校验;
    若校验通过,则确定该存储区域为所述第二应用程序的第一个存储区域。
  4. 根据权利要求2或3所述的方法,其特征在于,所述将所述第一个存储区域中存储的所述第二应用程序的运行地址确定为所述第二跳转地址之前,还包括:
    从所述第二应用程序的第二个存储区域开始直至所述第二应用程序的最后一个存储区域为止,采用校验算法对每个存储区域存储的数据进行校验;
    若所述第二应用程序的所有存储区域均校验通过,则执行将所述第一个存储区域中存储的所述第二应用程序的运行地址确定为所述第二跳转地址。
  5. 根据权利要求4所述的方法,其特征在于,所述采用校验算法对每个 存储区域存储的数据进行校验之前,还包括:
    获取所述第一个存储区域中存储的所述第二应用程序的存储空间值;
    根据所述第二应用程序的存储空间值确定所述第二应用程序的第二个存储区域至最后一个存储区域。
  6. 根据权利要求1所述的方法,其特征在于,所述存储所述固件升级包之前,还包括:
    解析所述第二应用程序,获取所述第二应用程序的运行地址;
    所述获取所述第一引导程序的第二跳转地址,包括:
    将所述第二应用程序的运行地址确定为所述第二跳转地址。
  7. 根据权利要求6所述的方法,其特征在于,所述解析所述第二应用程序,获取所述第二应用程序的运行地址,包括:
    将所述第二应用程序的第一个数据包暂存在所述存储器中;
    解析所述第一个数据包,获取所述第二应用程序的运行地址。
  8. 根据权利要求1-7任一项所述的方法,其特征在于,所述存储所述固件升级包,包括:
    获取所述第二引导程序的存储空间值;
    根据所述第二引导程序的存储空间值和所述第一引导程序的起始存储地址,确定存储所述固件升级包的起始存储地址;
    根据所述固件升级包的起始存储地址,存储所述固件升级包。
  9. 根据权利要求8所述的方法,其特征在于,所述固件升级包的起始存储地址与所述第一引导程序的起始存储地址之间的差值大于或者等于预设值。
  10. 根据权利要求9所述的方法,其特征在于,所述预设值为所述第二引导程序的存储空间值。
  11. 根据权利要求1-10任一项所述的方法,其特征在于,所述根据所述第二跳转地址运行所述第二应用程序,以将所述第一引导程序替换为所述第二引导程序,包括:
    删除所述第一引导程序;
    根据所述第一引导程序的起始存储地址存储所述第二引导程序;
    删除已存储的所述固件升级包中的所述第二引导程序。
  12. 根据权利要求1-11任一项所述的方法,其特征在于,所述根据所述 第二跳转地址运行所述第二应用程序,以将所述第一引导程序替换为所述第二引导程序之前,还包括:
    判断所述第一引导程序与所述第二引导程序是否相同;
    若所述第一引导程序与所述第二引导程序不同,则执行根据所述第二跳转地址运行所述第二应用程序,以将所述第一引导程序替换为所述第二引导程序。
  13. 根据权利要求12所述的方法,其特征在于,还包括:
    若所述第一引导程序与所述第二引导程序相同,则删除已存储的所述固件升级包中的所述第二引导程序,并运行所述第二应用程序。
  14. 根据权利要求1-13任一项所述的方法,其特征在于,所述接收到所述固件升级包,包括:
    从服务器接收到所述固件升级包;或者,
    从控制器接收到所述固件升级包,所述固件升级包为所述控制器通过网络适配器从所述服务器接收到的。
  15. 根据权利要求1-13任一项所述的方法,其特征在于,所述固件升级包包括多个数据包,所述接收到所述固件升级包,包括:
    逐包接收所述多个数据包。
  16. 根据权利要求1-15任一项所述的方法,其特征在于,所述第二引导程序接续在所述第二应用程序尾部之后。
  17. 一种嵌入式设备,其特征在于,包括:存储器、处理器和收发器;所述存储器存储有第一引导程序和第一应用程序;
    所述存储器还用于存储指令;
    所述处理器用于运行所述指令以实现:
    启动所述第一引导程序,获取所述第一引导程序的第一跳转地址;所述第一跳转地址为所述第一应用程序的运行地址;
    若所述收发器接收到固件升级包,则根据所述第一跳转地址删除所述第一应用程序,并存储所述固件升级包;所述固件升级包包括第二应用程序和第二引导程序;
    重新启动所述第一引导程序,获取所述第一引导程序的第二跳转地址;所述第二跳转地址为所述第二应用程序的运行地址;
    根据所述第二跳转地址运行所述第二应用程序,以将所述第一引导程序替换为所述第二引导程序。
  18. 根据权利要求17所述的嵌入式设备,其特征在于,所述处理器具体用于:
    从所述第一引导程序的末端地址开始,按照各个存储区域的排列顺序逐个确定该存储区域是否为所述第二应用程序的第一个存储区域;
    若确定该存储区域为所述第二应用程序的第一个存储区域,则将所述第一个存储区域中存储的所述第二应用程序的运行地址确定为所述第二跳转地址。
  19. 根据权利要求18所述的嵌入式设备,其特征在于,所述处理器具体用于:
    采用校验算法对该存储区域存储的数据进行校验;
    若校验通过,则确定该存储区域为所述第二应用程序的第一个存储区域。
  20. 根据权利要求18或19所述的嵌入式设备,其特征在于,所述处理器还用于:
    从所述第二应用程序的第二个存储区域开始直至所述第二应用程序的最后一个存储区域为止,采用校验算法对每个存储区域存储的数据进行校验;
    若所述第二应用程序的所有存储区域均校验通过,则执行将所述第一个存储区域中存储的所述第二应用程序的运行地址确定为所述第二跳转地址。
  21. 根据权利要求20所述的嵌入式设备,其特征在于,所述处理器还用于:
    获取所述第一个存储区域中存储的所述第二应用程序的存储空间值;
    根据所述第二应用程序的存储空间值确定所述第二应用程序的第二个存储区域至最后一个存储区域。
  22. 根据权利要求17所述的嵌入式设备,其特征在于,所述处理器还用于:
    解析所述第二应用程序,获取所述第二应用程序的运行地址;
    所述处理器具体用于:
    将所述第二应用程序的运行地址确定为所述第二跳转地址。
  23. 根据权利要求22所述的嵌入式设备,其特征在于,所述处理器具体 用于:
    将所述第二应用程序的第一个数据包暂存在所述存储器中;
    解析所述第一个数据包,获取所述第二应用程序的运行地址。
  24. 根据权利要求17-23任一项所述的嵌入式设备,其特征在于,所述处理器具体用于:
    获取所述第二引导程序的存储空间值;
    根据所述第二引导程序的存储空间值和所述第一引导程序的起始存储地址,确定存储所述固件升级包的起始存储地址;
    根据所述固件升级包的起始存储地址,存储所述固件升级包。
  25. 根据权利要求24所述的嵌入式设备,其特征在于,所述固件升级包的起始存储地址与所述第一引导程序的起始存储地址之间的差值大于或者等于预设值。
  26. 根据权利要求25所述的嵌入式设备,其特征在于,所述预设值为所述第二应用程序的存储空间值。
  27. 根据权利要求17-26任一项所述的嵌入式设备,其特征在于,所述处理器具体用于:
    删除所述第一引导程序;
    根据所述第一引导程序的起始存储地址存储所述第二引导程序;
    删除已存储的所述固件升级包中的所述第二引导程序。
  28. 根据权利要求17-27任一项所述的嵌入式设备,其特征在于,所述处理器还用于:
    判断所述第一引导程序与所述第二引导程序是否相同;
    若所述第一引导程序与所述第二引导程序不同,则执行根据所述第二跳转地址运行所述第二应用程序,以将所述第一引导程序替换为所述第二引导程序。
  29. 根据权利要求28所述的嵌入式设备,其特征在于,所述处理器还用于:
    若所述第一引导程序与所述第二引导程序相同,则删除已存储的所述固件升级包中的所述第二引导程序,并运行所述第二应用程序。
  30. 根据权利要求17-29任一项所述的嵌入式设备,其特征在于,所述 收发器具体用于:
    从服务器接收到所述固件升级包;或者,
    从控制器接收到所述固件升级包,所述固件升级包为所述控制器通过网络适配器从所述服务器接收到的。
  31. 根据权利要求17-29任一项所述的嵌入式设备,其特征在于,所述固件升级包包括多个数据包,所述收发器具体用于:
    逐包接收所述多个数据包。
  32. 根据权利要求17-31任一项所述的嵌入式设备,其特征在于,所述第二引导程序接续在所述第二应用程序尾部之后。
  33. 一种存储介质,其特征在于,包括:可读存储介质和计算机程序,所述计算机程序用于实现如权利要求1-16中任一项所述的程序的升级方法。
PCT/CN2018/118666 2018-11-30 2018-11-30 程序的升级方法和嵌入式设备 WO2020107436A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201880068994.7A CN111433739A (zh) 2018-11-30 2018-11-30 程序的升级方法和嵌入式设备
PCT/CN2018/118666 WO2020107436A1 (zh) 2018-11-30 2018-11-30 程序的升级方法和嵌入式设备

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2018/118666 WO2020107436A1 (zh) 2018-11-30 2018-11-30 程序的升级方法和嵌入式设备

Publications (1)

Publication Number Publication Date
WO2020107436A1 true WO2020107436A1 (zh) 2020-06-04

Family

ID=70854476

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/118666 WO2020107436A1 (zh) 2018-11-30 2018-11-30 程序的升级方法和嵌入式设备

Country Status (2)

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

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111984298A (zh) * 2020-07-17 2020-11-24 歌尔光学科技有限公司 一种闪存中的程序升级区、程序升级方法及系统

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112905218B (zh) * 2021-02-07 2023-05-26 杭州海康威视数字技术股份有限公司 一种固件升级方法、装置及设备
CN113094067A (zh) * 2021-03-30 2021-07-09 国核自仪系统工程有限公司 Io模块的固件更新方法及io模块
CN114880008A (zh) * 2022-05-17 2022-08-09 联陆智能交通科技(上海)有限公司 软件升级方法及系统

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104346187A (zh) * 2013-08-07 2015-02-11 西安诺瓦电子科技有限公司 显示屏用视频控制卡的软件升级方法
CN104699500A (zh) * 2015-01-06 2015-06-10 上海华测导航技术股份有限公司 智能设备中实现引导程序自动升级的方法
CN106406955A (zh) * 2016-09-22 2017-02-15 深圳市金溢科技股份有限公司 RSU设备bootloader程序升级的方法、装置
CN107608721A (zh) * 2017-09-13 2018-01-19 北京小鸟看看科技有限公司 头戴虚拟现实设备及其引导加载程序的升级方法
CN107861745A (zh) * 2017-11-30 2018-03-30 厦门科华恒盛股份有限公司 一种应用程序在线升级方法、装置、设备及存储介质

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104090796B (zh) * 2014-07-08 2017-06-09 成都万维图新信息技术有限公司 一种嵌入式设备程序更新方法和系统
CN105573797B (zh) * 2015-12-18 2019-10-18 广州市中海达测绘仪器有限公司 嵌入式系统的可逆离线升级方法及装置

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104346187A (zh) * 2013-08-07 2015-02-11 西安诺瓦电子科技有限公司 显示屏用视频控制卡的软件升级方法
CN104699500A (zh) * 2015-01-06 2015-06-10 上海华测导航技术股份有限公司 智能设备中实现引导程序自动升级的方法
CN106406955A (zh) * 2016-09-22 2017-02-15 深圳市金溢科技股份有限公司 RSU设备bootloader程序升级的方法、装置
CN107608721A (zh) * 2017-09-13 2018-01-19 北京小鸟看看科技有限公司 头戴虚拟现实设备及其引导加载程序的升级方法
CN107861745A (zh) * 2017-11-30 2018-03-30 厦门科华恒盛股份有限公司 一种应用程序在线升级方法、装置、设备及存储介质

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111984298A (zh) * 2020-07-17 2020-11-24 歌尔光学科技有限公司 一种闪存中的程序升级区、程序升级方法及系统
CN111984298B (zh) * 2020-07-17 2023-07-25 歌尔科技有限公司 一种闪存中的程序升级区、程序升级方法及系统

Also Published As

Publication number Publication date
CN111433739A (zh) 2020-07-17

Similar Documents

Publication Publication Date Title
WO2020107436A1 (zh) 程序的升级方法和嵌入式设备
CN109460245B (zh) 一种嵌入式系统的远程升级方法
US11513789B2 (en) Application deployment method, apparatus, and system
WO2017067448A1 (zh) 一种无线固件升级方法、系统及计算机存储介质
CN107066300B (zh) 一种存储设备的固件升级方法和存储设备
JP5838527B2 (ja) ファームウェアを更新するための方法、装置、および通信デバイス
WO2017161947A1 (zh) 多系统ota升级方法和多系统设备
CN112947977B (zh) 一种软件在线升级方法及系统
WO2019062703A1 (zh) 升级方法、嵌入式系统
CN110730104A (zh) 一种mesh网络设备的多设备批量固件升级的方法
CN104579719A (zh) 一种固件的升级方法和系统、上位机和光模块
KR20120052406A (ko) 펌웨어 이미지 갱신 및 관리
CN102541596A (zh) 一种操作系统升级方法及装置
CN106843933A (zh) 一种应用程序的漏洞修复方法、移动终端及补丁服务器
US20210119858A1 (en) Network node firmware update
CN106815049B (zh) 特征库升级的方法及装置
CN108509215B (zh) 一种系统软件的更换方法、装置、终端设备及存储介质
CN103488501A (zh) 光网络终端设备及其系统软件升级方法
CN106775919B (zh) 状态信息控制方法及装置
US20220279035A1 (en) Model file issuing method, platform, system, terminal and readable storage medium
CN110580167A (zh) 一种系统升级方法、智能设备及服务器
CN104699499A (zh) 一种异构终端软件升级方法
CN112416411B (zh) 升级方法及装置、设备端、服务器、计算机可读介质
CN113626059B (zh) 系统升级方法、摄像机及计算机可读存储介质
CN107239303B (zh) 应用程序更新包生成及应用程序更新的方法、装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18941293

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18941293

Country of ref document: EP

Kind code of ref document: A1