CN111026417A - Embedded equipment upgrading method and embedded equipment - Google Patents

Embedded equipment upgrading method and embedded equipment Download PDF

Info

Publication number
CN111026417A
CN111026417A CN201911017178.6A CN201911017178A CN111026417A CN 111026417 A CN111026417 A CN 111026417A CN 201911017178 A CN201911017178 A CN 201911017178A CN 111026417 A CN111026417 A CN 111026417A
Authority
CN
China
Prior art keywords
space
address
storage
storage space
file
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
CN201911017178.6A
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.)
Deep Blue Technology Shanghai Co Ltd
Original Assignee
Deep Blue Technology Shanghai 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 Deep Blue Technology Shanghai Co Ltd filed Critical Deep Blue Technology Shanghai Co Ltd
Priority to CN201911017178.6A priority Critical patent/CN111026417A/en
Publication of CN111026417A publication Critical patent/CN111026417A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0629Configuration or reconfiguration of storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/0643Management of files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Landscapes

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

Abstract

The invention discloses an upgrading method of embedded equipment and the embedded equipment, which are used for shortening the time required by upgrading and improving the upgrading efficiency. The upgrading method of the embedded equipment comprises the following steps: determining a target storage space for storing the system upgrading file in the two storage spaces, wherein the version serial number of the system upgrading file stored in the target storage space is higher than that of the system file stored in the other storage space; mapping the storage addresses of the two storage spaces to a first address space and a second address space of the central processing unit, wherein the storage address of a target storage space is mapped to the first address space, the storage address of the other storage space is mapped to the second address space, the first address space and the second address space are continuous, and the head address of the first address space is smaller than the head address of the second address space; and loading the file corresponding to the first address space so as to upgrade the embedded equipment.

Description

Embedded equipment upgrading method and embedded equipment
Technical Field
The present invention relates to the field of system upgrading technologies, and in particular, to an upgrading method for an embedded device and an embedded device.
Background
When the functional requirements of the embedded device change or the software and hardware of the embedded device have problems during the operation process, the current system file of the embedded device can be upgraded to maintain the embedded device.
In an embedded device, a currently running system file is usually stored in a FLASH memory (FLASH), so that when a latest system upgrade file exists, the latest system upgrade file can be downloaded to a local Random Access Memory (RAM) for temporary storage. When the upgrade operation needs to be executed, the central processing unit needs to erase the original system file in the FLASH, write the latest system upgrade file into the FLASH, and then restart the embedded device to perform the upgrade. However, it takes a certain time to erase or write the FLASH, and once an error occurs in any one of the processes, the upgrade of the embedded device fails. Even if the system can be upgraded again by restarting it, this will extend the time required for the system upgrade.
Therefore, the upgrading of the existing embedded device needs to be performed with operations of erasing or writing the FLASH, the upgrading is time-consuming, and once errors occur in the process of erasing or writing the FLASH, the upgrading can fail.
Disclosure of Invention
The embodiment of the invention provides an upgrading method of embedded equipment and the embedded equipment, which are used for shortening the time required by upgrading and improving the upgrading efficiency.
In a first aspect, an embodiment of the present invention provides an upgrade method for an embedded device, where the method includes:
determining a target storage space for storing a system upgrading file in two storage spaces, wherein the version serial number of the system upgrading file stored in the target storage space is higher than that of the system file stored in the other storage space;
mapping the storage addresses of the two storage spaces to a first address space and a second address space of a central processing unit, wherein the storage address of the target storage space is mapped to the first address space, the storage address of the other storage space is mapped to the second address space, the first address space and the second address space are continuous, and the first address of the first address space is smaller than the first address of the second address space;
and loading the file corresponding to the first address space so as to upgrade the embedded equipment.
In the embodiment of the invention, the central processing unit can select one of the two storage spaces as a target storage space for storing the system upgrade file. The system upgrade file may be considered as a latest version file in the system files, that is, a version serial number of the system upgrade file is higher than a version serial number of existing system files in the storage space. When software upgrading is needed to be carried out on the equipment, the central processing unit can map a target storage space to a first address space and map another storage space to a second address space of the central processing unit. Because the first address space and the second address space are continuous and the first address space is positioned in front of the second address space, the central processing unit can preferentially run the first address space, namely, the system upgrade file stored in the target storage space is loaded, thereby realizing the upgrade of the embedded equipment. The operation of erasing and writing FLASH is not involved in the upgrading process, so that the whole upgrading process is short in time consumption and high in upgrading efficiency.
Optionally, the two storage spaces include a first storage space and a second storage space, and determining a destination storage space for storing the system upgrade file in the two storage spaces includes:
acquiring a first version serial number of a first system file and a second version serial number of a second system file, wherein the first system file is stored in the first storage space, and the second system file is stored in the second storage space;
if the first version serial number is lower than the second version serial number, determining the first storage space as the target storage space; or,
and if the first version serial number is higher than the second version serial number, determining the second storage space as the destination storage space.
In the embodiment of the present invention, existing system files, for example, a first system file and a second system file, are stored in the first storage space and the second storage space, respectively. The central processing unit may compare the version serial number of the first system file in the first storage space with the version serial number of the second system file in the second storage space, so as to determine the storage space corresponding to the lower version serial number as the destination storage space. And then, storing the system upgrading file in the target storage space. This process can ensure that two newer system files remain in both storage spaces at all times.
Optionally, mapping the storage addresses of the two storage spaces to a first address space and a second address space of the central processing unit, including:
if the first storage space is determined to be the target storage space, mapping the storage address of the first storage space to the first address space, and mapping the storage address of the second storage space to the second address space; or,
if the second storage space is determined to be the target storage space, mapping the storage address of the second storage space to the first address space, and mapping the storage address of the first storage space to the second address space.
In the embodiment of the present invention, since the system upgrade file is stored in the destination storage space, the first address space and the second address space are consecutive, and the first address space is located before the second address space, the central processing unit maps the destination storage space to the first address space, and maps the other storage space to the second address space. Therefore, the central processing unit preferentially operates the first address space, and the system upgrading file stored in the target storage space mapped with the first address is always loaded.
Optionally, the method further includes: the central processing unit is stored with a starting program, and the starting program is used for loading the file corresponding to the first address space; loading the file corresponding to the first address space, including:
and running the starting program.
In the embodiment of the present invention, before the central processing unit runs the system upgrade file corresponding to the first address space, the central processing unit may first run a start program to create an initial running environment for the embedded device, so as to implement loading of the file corresponding to the first address space.
Optionally, the address space of the boot program, the first address space, and the second address space are consecutive in sequence.
In the embodiment of the invention, the storage address of the starting program, the first address space and the second address space are sequentially continuous, so that when the embedded equipment is started, the central processing unit can preferentially run the starting program to create an initial running environment for the embedded equipment. And then, the central processing unit operates the system upgrading file in the storage space corresponding to the first address space so as to realize the upgrading of the embedded equipment. If an error occurs in the upgrading process, the central processing unit can also operate a newer system file in the storage space corresponding to the second address space, so that the embedded equipment can work normally.
In a second aspect, an embodiment of the present invention provides an embedded device, where the embedded device includes:
the system comprises a determining module, a judging module and a judging module, wherein the determining module is used for determining a target storage space for storing a system upgrading file in two storage spaces, and the version serial number of the system upgrading file stored in the target storage space is higher than that of the system file stored in the other storage space;
a mapping module, configured to map storage addresses of the two storage spaces to a first address space and a second address space of a central processing unit, where a storage address of the destination storage space is mapped to the first address space, a storage address of the other storage space is mapped to the second address space, the first address space and the second address space are consecutive, and a head address of the first address space is smaller than a head address of the second address space;
and the upgrading module is used for loading the file corresponding to the first address so as to upgrade the embedded equipment.
Optionally, the determining module is specifically configured to:
acquiring a first version serial number of a first system file and a second version serial number of a second system file, wherein the first system file is stored in the first storage space, and the second system file is stored in the second storage space;
if the first version serial number is lower than the second version serial number, determining the first storage space as the target storage space; or,
and if the first version serial number is higher than the second version serial number, determining the second storage space as the destination storage space.
Optionally, the mapping module is specifically configured to:
when the first storage space is determined to be the target storage space, mapping the storage address of the first storage space to the first address space, and mapping the storage address of the second storage space to the second address space; or,
when the second storage space is determined to be the target storage space, mapping the storage address of the second storage space to the first address space, and mapping the storage address of the first storage space to the second address space.
Optionally, the central processing unit stores a start program, and the start program is used for loading a file corresponding to the first address space; the upgrade module is specifically configured to:
and running the starting program.
Optionally, the address space of the boot program, the first address space, and the second address space are consecutive in sequence.
For technical effects of the second aspect or any embodiment of the second aspect, reference may be made to technical effects of any embodiment of the first aspect, which are not described herein again.
In a third aspect, an embodiment of the present invention provides an embedded device, where the embedded device includes a processor and a memory, and the execution of the computer program stored in the memory by the processor is a step of implementing the method according to the embodiment of the first aspect.
In a fourth aspect, embodiments of the present invention provide a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of the method as described in the embodiments of the first aspect.
Drawings
Fig. 1 is an architecture diagram of an embedded system provided in an embodiment of the present invention;
FIG. 2 is an architecture diagram of an embedded system provided in an embodiment of the present invention;
FIG. 3 is an architecture diagram of an embedded system provided in an embodiment of the present invention;
fig. 4 is a schematic flowchart of an upgrading method for an embedded device provided in an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an embedded device according to an embodiment of the present invention;
fig. 6 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 disclosure more clear, the technical solutions of the embodiments of the present disclosure will be described below in detail and completely with reference to the accompanying drawings of the embodiments of the present disclosure.
The system upgrade file is a software program that can be used for upgrading, and two common upgrading modes of the current embedded device are specifically as follows.
The first upgrading mode is as follows: please refer to fig. 1, which is an architecture diagram of an embedded system. Fig. 1 includes an embedded device and a server 102, where the embedded device includes: a Central Processing Unit (CPU) 101, a RAM103, and a FLASH 104. The embedded device may periodically send a first message to the server 102 through the CPU101, where the first message carries an Identity (ID) of the embedded device and a first version serial number of a currently running system file. After receiving the first message, the server 102 queries whether a second version serial number corresponding to the ID exists in the server 102. If the server 102 determines that the second version serial number exists and the second version serial number is higher than the first version serial number, the server 102 may send an update instruction to the CPU101 in the embedded device. The embedded device, after receiving the update instruction through the CPU101, may send a request message to the server 102, where the request message is used to acquire the system upgrade file corresponding to the ID. After receiving the request message, the server 102 determines a system upgrade file corresponding to the ID, and sends the system upgrade file to the CPU101 in the embedded device. The embedded device receives the system upgrade file through the CPU101, and temporarily saves it in the RAM 103. When upgrading is needed, the CPU101 in the embedded device sends an erasing instruction to the FLASH104, the FLASH104 stores the current system file, and the FLASH104 performs an erasing operation after receiving the erasing instruction, so as to erase the stored system file. During the erasing process, the CPU101 in the embedded device may periodically send a query instruction to the status register of the FLASH104 to determine whether the FLASH104 has completely erased the system file. When the current busy flag bit indicated by the status register of FLASH104 changes from 1 to 0, it indicates that the erasing process is finished, i.e. the system file is erased. After determining that the FLASH104 erases the system file, the CPU101 in the embedded device may send a read instruction to the RAM103, where the read instruction is used to acquire the system upgrade file in the RAM 103. The RAM103 transmits the saved system upgrade file to the CPU101 in the embedded device in response to the read instruction. Then, the CPU101 in the embedded device writes the received system upgrade file into the FLASH104, and the embedded device is restarted to complete the upgrade.
In the first upgrading mode, the FLASH104 performs the erasing operation, and partial failure may occur due to the long-term operation of the FLASH104, which results in incomplete erasing of the system file. Or, if the FLASH104 fails, the CPU101 may generate a write error when writing the system upgrade file into the FLASH104, for example, a part of the system upgrade file is written. In both cases, upgrade failure may be caused, and the embedded device may not operate normally.
The second upgrading mode is as follows: referring to fig. 2, the difference from the first upgrading method is that the FLASH is divided into BOOTLOADER204, working FLASH205 and backup FLASH 206. The working FLASH205 and the backup FLASH206 both store system files. Typically, the embedded device runs the system files in the working FLASH 205. If the embedded device needs to be upgraded, the embedded device can obtain the system upgrade file through the CPU201 and store the system upgrade file in the RAM 203. Thereafter, the CPU201 in the embedded device may send an erase instruction to the backup FLASH206 to request the backup FLASH206 to erase the stored system files. The backup FLASH206 begins to erase system files in response to the erase command. In the process of erasing the system file by the FLASH206, the CPU201 in the embedded device may periodically send a query instruction to the status register of the backup FLASH206 to determine whether the backup FLASH206 has erased the system file. When the current busy flag bit indicated by the status register of backup FLASH206 changes from 1 to 0, it indicates that the erase process is finished, i.e., the system file is erased. When the CPU201 in the embedded device determines that the system file in the backup FLASH206 is erased, a read instruction may be sent to the RAM203, where the read instruction is used to acquire the system upgrade file in the RAM 203. The RAM203 transmits the saved system upgrade file to the CPU201 in the embedded device in response to the read instruction. Then, the embedded device writes the received system upgrade file into the backup FLASH206 through the CPU 201. When the embedded device needs to be upgraded, the embedded device is restarted, the BOOTLOADER204 starts to operate, and an operating environment is created for the embedded device. Then, the embedded device sends a query instruction to the working FLASH205 and the backup FLASH206 through the CPU201, where the query instruction is used to obtain version serial numbers of system files in the working FLASH205 and the backup FLASH 206. After receiving the query instruction, the working FLASH205 and the backup FLASH206 send version serial numbers of the system files stored in them to the CPU201 in the embedded device. After the embedded device receives the two version serial numbers through the CPU201, if it is determined that the version serial number of the system upgrade file in the backup FLASH206 is higher than the version serial number of the system file in the working FLASH105, the CPU201 in the embedded device sends an erase instruction to the working FLASH 205. The operating FLASH205 performs an operation of erasing the stored system file in response to the erase instruction. Specifically, the process of erasing the system file by the working FLASH205 is similar to the process of erasing the system file by the backup FLASH206, and details are not described here. After determining that the system file in the working FLASH205 is erased, the CPU201 in the embedded device may send a read instruction to the backup FLASH206 to obtain the system upgrade file in the backup FLASH 206. The embedded device can acquire the system upgrade file from the backup FLASH206 through the CPU201, write the system upgrade file into the working FLASH205, and the working FLASH205 runs the system upgrade file to complete the upgrade of the embedded device.
Compared with the first upgrading method, the second upgrading method downloads the system upgrading file to the backup FLASH206, and even if the upgrading cannot be successfully completed due to errors in erasing and writing of the working FLASH205 in the upgrading process, the system upgrading file can still be acquired through the backup FLASH206, and then the upgrading can be performed again through restarting, and the situation that the embedded equipment cannot normally operate in the first method cannot occur. However, in the upgrading process of the method, the erasing and writing of the working FLASH205 take a certain time, the upgrading time is long, and the method cannot be applied to scenes with strict time requirements. For example, in a scenario where the embedded device is used for data exchange, the embedded device needs to be kept in an operating state for 24 hours, and even if the embedded device is upgraded for a short time, part of data may be missing, which affects user experience.
In view of this, embodiments of the present invention provide an upgrade method and apparatus for an embedded device, in which erasing and writing of FLASH are not required in the upgrade process, thereby shortening the time required for upgrade and improving the upgrade efficiency.
For ease of understanding, an application scenario in which the present invention is implemented is first described. Fig. 3 is a diagram illustrating an architecture of an embedded system according to an embodiment of the present invention. Included in fig. 3 are embedded devices and a server 302. Wherein, embedded equipment includes: CPU301, RAM303, memory, and address translation module 307. The CPU301 may be configured to receive and send related control instructions, so that various portions of the embedded device can be executed in order. Server 302 may store system upgrade files. The CPU301 and the server 302 can communicate. For example, the CPU301 communicates with the server 302 via a wireless fidelity (WIFI) module. The RAM303 may be a random access memory for temporarily saving the system upgrade file acquired by the CPU301 from the server 302. The memory may be divided into a plurality of memory spaces, for example into three memory spaces of equal size. These three storage spaces are boot program storage space 304, first storage space 305, and second storage space 306, respectively. For example, the size of the memory is 64 Kilobytes (KB), then the space occupied by the initiator memory space 304 may be 0X00000-0X0FFFF, the space occupied by the first memory space 305 may be 0X10000-0X1FFFF, and the space occupied by the second memory space 306 may be 0X20000-0X2 FFFF. The boot program storage space 304 is used for storing a boot loader, and the boot loader can be used for initializing the embedded device and creating a running environment of system files. The first storage space 305 and the second storage space 306 respectively store two different versions of system files.
The address translation module 307 may be used for address mapping between the CPU301 and the boot program memory space 304, between the CPU301 and the first memory space 305, and between the CPU301 and the second memory space 306. For example, the address translation module 307 may have two mapping modes, which may also be understood as two translation modes. For example, the first conversion mode is a direct mapping mode, i.e. mapping the first memory space 305 to a first address space in the CPU301 and mapping the second memory space 306 to a second address space of the CPU 301. For example, the second conversion mode is cross mapping, i.e. mapping the first memory space 305 to the second address space of the CPU and mapping the second memory space 306 to the first address space of the CPU. In the embodiment of the present invention, the first conversion mode and the second conversion mode may be distinguished by a value of a certain bit register of the address translation module 307. For example, when the value of the register is 1, the first conversion mode is indicated, and when the value of the register is 0, the second conversion mode is indicated. Or, when the value of the register is 0, the first conversion mode is indicated, and, on the contrary, when the value of the register is 1, the second conversion mode is indicated, which is not limited in the present application.
It should be noted that the address translation module 307 may use a direct mapping mode to map the boot program storage space 304 to the boot program address space of the CPU 301. I.e., embedded device reboot, the address translation module 307 maps the boot program memory space 304 to the boot program address space of the CPU301 by default.
The CPU301 in the embedded device may determine the conversion mode of the address conversion module 307 based on the version serial numbers of the system files in the first memory space 305 and the second memory space 306. For example, if the version serial number of the system file in the first storage space 305 is higher than the version serial number of the system file in the second storage space 306, it is determined that the conversion mode of the address conversion module 307 is the direct mapping mode; if the version serial number of the system file in the first storage space 305 is lower than the version serial number of the system file in the second storage space 306, it is determined that the conversion mode of the address conversion module 307 is the cross-mapping mode.
Based on the architecture shown in fig. 3, the following describes a technical solution provided by an embodiment of the present invention with reference to the accompanying drawings. Referring to fig. 4, an embodiment of the present invention provides a method for upgrading an embedded device, where a flow of the method is described as follows.
Step 401: the embedded device determines a destination storage space for storing the system upgrade file in the two storage spaces.
The version serial number of the system upgrade file stored in the target storage space is higher than that of the system file stored in the other storage space.
The first storage space 305 and the second storage space 306 store system files, respectively. In this embodiment of the present invention, the CPU301 in the embedded device may obtain version serial numbers of system files already stored in the first storage space 305 and the second storage space 306, so as to determine a destination storage space, that is, a storage space for storing a system upgrade file, from the first storage space 305 and the second storage space 306.
For example, the version serial number of the system file in the first storage space 305 is V1.0.1, and the version serial number of the system file in the second storage space is V1.0.2. After acquiring the two version serial numbers, the CPU301 in the embedded device determines that the version serial number of the system file in the second storage space 306 is higher than the version serial number of the system file in the first storage space 305, and then determines the first storage space as a destination storage space, and takes the system file in the second storage space 306 as an operating file of the current embedded device. Alternatively, if the version serial number of the system file in the first storage space 305 is V1.0.1, the version serial number of the system file in the second storage space 306 is V1.0.0. After acquiring the two version serial numbers, the CPU301 in the embedded device determines that the version serial number of the system file in the first storage space 305 is higher than the version serial number of the system file in the second storage space 306, and then determines the second storage space 306 as a destination storage space, and takes the system file in the first storage space 305 as the system file currently running in the embedded device.
When the embedded device needs to be upgraded in the running process, the CPU301 in the embedded device may request the server 302 to obtain a system upgrade file. For example, the CPU301 in the embedded device may send a first message to the server 302, where the first message carries an Identity (ID) of the embedded device and a version serial number of a currently running system file. The server 302 accepts the first message and determines whether to send a system upgrade file to the embedded device.
For example, if the version serial number of the system file in the first storage space 305 acquired by the embedded device through the CPU301 is V1.0.0, and the version serial number of the system file in the second storage space 306 is V1.0.1, if the CPU301 in the embedded device determines that the version serial number of the system file in the second storage space 306 is higher than the version serial number of the system file in the first storage space 305, the version serial number of the system file in the second storage space 306, that is, V1.0.1, and the corresponding embedded device ID may be sent to the server 302. For example, CPU301 may send V1.0.1 and a corresponding ID to server 302 through a WIFI module. After the server 302 receives the version serial number V1.0.1 and the corresponding ID, it is checked whether the version serial number corresponding to the ID exists in the server 302. If a version serial number corresponding to the ID exists in the server 302, such as V1.0.2, and the server 302 confirms V1.0.2 that it is higher than the version serial number V1.0.1 of the system file currently running by the embedded device, the server 302 can send an update instruction to the CPU 301. The CPU301 receives and responds to the update instruction, and transmits a request instruction to the server 302. The request instruction is used for acquiring a system upgrade file corresponding to the ID of the embedded device. In response to the request instruction, the server 302 sends the system upgrade file with version serial number V1.0.2 to the CPU 301.
Considering that an error may occur in the process of sending the first message to the server 302 by the CPU301, so that the server 302 fails to receive the first message, the embodiment of the present invention may periodically send the first message to the server 302 by the CPU301, so as to ensure that the embedded device can be updated in time. Or, the server 302 does not currently have the system upgrade file corresponding to the ID carried in the first message, and in the embodiment of the present invention, the CPU301 may also periodically send the first message to the server 302, so that once the server 302 has the system upgrade file corresponding to the ID carried in the first message, the system upgrade file can be timely sent to the CPU301, so as to ensure that the embedded device can be updated in time.
After the embedded device obtains the system upgrade file, the system upgrade file may be cached in the RAM 303. Since the data stored in the RAM303 is lost upon power-off, the RAM303 can only be used to temporarily save the system upgrade file. Therefore, in order to be able to save the system upgrade file for a long time, the embedded device may store the system upgrade file into the destination storage space.
Specifically, taking the first storage space as the target storage space as an example, the CPU301 in the embedded device may send an erase instruction to the first storage space 305. The first storage space 305 receives and responds to the erasing instruction, and executes an erasing operation to erase the stored system file. During the erasing process, the embedded device may periodically send a query instruction to the status register of the first storage space 305 to determine that the system file in the first storage space 305 is erased. After determining that the system file in the first storage space 305 is erased, the embedded device may send a read instruction to the RAM303, where the read instruction is used to obtain the system upgrade file in the RAM 303. In response to the read instruction, the RAM103 transmits the saved system upgrade file to the embedded device, for example, to the CPU 301. Then, the CPU301 in the embedded device writes the received system upgrade file into the first storage space 305, i.e., stores the system upgrade file in the destination storage space.
It should be noted that, in the embodiment of the present invention, after the embedded device may determine the target storage space through the CPU301, the CPU301 obtains the system upgrade file in the server 302, and stores the system upgrade file in the target storage space; or, the embedded device may obtain the system upgrade file in the server 302 through the CPU301, determine the destination storage space, and store the system upgrade file in the destination storage space. The order of these two processes is not particularly limited in the present invention.
Step 402: the embedded device maps the memory addresses of the two memory spaces to a first address space and a second address space of the CPU 301.
The first address space and the second address space are continuous, and the first address of the first address space is smaller than that of the second address space. The memory address of the destination memory space is mapped to the first address space, and the memory address of the other memory space is mapped to the second address space.
After the CPU301 in the embedded device stores the system upgrade file in the destination storage space, the embedded device may be restarted. After the embedded device is restarted, the address translation module 307 maps the boot program memory space 304 to the boot program address space of the CPU 301. At this time, the CPU301 may load the BootLoader stored in the boot program storage space 304, initialize the embedded device, and then the CPU301 in the embedded device sequentially executes the first address space corresponding file. In order to upgrade the embedded device, the file corresponding to the first address space may be regarded as a system upgrade file, and the system upgrade file is stored in the destination storage space, so that the destination storage space may be mapped to the first address space of the CPU301 and another storage space may be mapped to the second address space of the CPU301 during initialization.
In the embodiment of the present invention, after the embedded device is restarted, the CPU301 in the embedded device may obtain the version serial numbers of the system files in the first storage space 305 and the second storage space 306 again, so as to determine the mapping relationship between the storage spaces of the two system files and the two addresses of the CPU301 in the embedded device according to the two version serial numbers, which may also be understood as the mapping mode of the address conversion module 307.
Specifically, for example, the version serial number of the system file in the first storage space 305 may be V1.0.2, and the version serial number of the system file in the second storage space may be V1.0.1, that is, the latest system upgrade file is stored in the first storage space 305. When the CPU301 in the embedded device acquires the version serial numbers of the system files in the first storage space 305 and the second storage space 306, and it can be determined that the version serial number of the system file in the first storage space 305 is higher than the version serial number of the system file in the second storage space 306, the first storage space 305 may be mapped to a first address space of the CPU301 in the embedded device, and the second storage space 306 is mapped to a second address space of the CPU301 in the embedded device, that is, it is determined that the mapping mode of the address translation module is direct mapping. At this time, the CPU301 in the embedded device may send a first control instruction to the address conversion module 307, the first control instruction being used to instruct the address conversion module 307 in the embedded device to set the value of the own register to 0. After receiving the second control instruction, the address translation module 307 in the embedded device sets the value of the register to 0, that is, the mapping mode of the address translation module 307 in the embedded device is set to direct mapping. The first memory space 305 maps to a first address space of the CPU301 in the embedded device and the second memory space 306 maps to a second address space of the CPU301 in the embedded device.
For example, the version serial number of the system file in the first storage space 305 may be V1.0.2, and the version serial number of the system file in the second storage space 306 may be V1.0.3, that is, the latest system upgrade file is stored in the second storage space 306. When the CPU301 in the embedded device obtains the version serial numbers of the system files in the first storage space 305 and the second storage space 306, and it can be determined that the version serial number of the system file in the second storage space 306 is higher than the version serial number of the system file in the first storage space 305, the second storage space 306 can be mapped to the first address space of the CPU301 in the embedded device, and the first storage space 305 is mapped to the second address space of the CPU301 in the embedded device, that is, it is determined that the mapping mode of the address conversion module is cross mapping. At this time, the CPU301 in the embedded device may send a second control instruction to the address conversion module 307, the second control instruction being used to instruct the address conversion module 307 in the embedded device to set the value of the own register to 1. After receiving the second control instruction, the address translation module 307 in the embedded device sets the value of the register to 1, that is, the mapping mode of the address translation module 307 in the embedded device is set to be cross mapping. Then the second memory space 306 is mapped to a first address of the CPU301 in the embedded device and the first memory space 305 is mapped to a second address of the CPU301 in the embedded device.
Step 403: and loading the file corresponding to the first address space so as to upgrade the embedded equipment.
Because the first address space and the second address space in the CPU301 in the embedded device are consecutive, and the first address of the first address space is smaller than the first address of the second address space, the CPU301 in the embedded device preferentially loads the system upgrade file stored in the first storage space 305 corresponding to the first address space. In the process of executing the system upgrade file corresponding to the first address space by the CPU301 in the embedded device, if the CPU301 in the embedded device determines that the system upgrade file has an error, the upgrade process may be interrupted. At this time, the CPU301 in the embedded device may jump to the second address space and execute the system file stored in the second storage space 306 corresponding to the second address space, so that even if an error occurs in system upgrade, the normal operation of the embedded device is still not affected.
The following describes the apparatus provided by the embodiment of the present invention with reference to the drawings.
Referring to fig. 5, based on the same inventive concept, an embodiment of the present invention provides an embedded device, including: a determination module 501, a mapping module 502, and an upgrade module 503.
A determining module 501, configured to determine a destination storage space for storing a system upgrade file in two storage spaces, where a version serial number of the system upgrade file stored in the destination storage space is higher than a version serial number of the system file stored in another storage space;
a mapping module 502, configured to map storage addresses of two storage spaces to a first address space and a second address space of the central processing unit 301, where a storage address of a destination storage space is mapped to the first address space, a storage address of another storage space is mapped to the second address space, the first address space and the second address space are consecutive, and a head address of the first address space is smaller than a head address of the second address space;
the upgrading module 503 is configured to load a file corresponding to the first address space, so as to upgrade the embedded device.
Optionally, the determining module 501 is specifically configured to:
acquiring a first version serial number of a first system file and a second version serial number of a second system file, wherein the first system file is stored in a first storage space 305, and the second system file is stored in a second storage space 306;
if the first version serial number is lower than the second version serial number, determining the first storage space 305 as a destination storage space; or,
if the first version serial number is higher than the second version serial number, the second storage space 306 is determined as the destination storage space.
Optionally, the mapping module 502 is specifically configured to:
if the first storage space 305 is determined to be the destination storage space, mapping the storage address of the first storage space 305 to a first address space, and mapping the storage address of the second storage space 306 to a second address space; or,
if the second memory space 306 is determined to be the destination memory space, then the memory addresses of the second memory space 306 are mapped to the first address space, and the memory addresses of the first memory space 305 are mapped to the second address space.
Optionally, the central processing unit 301 stores a start program, and the start program is used for loading a file corresponding to the first address space; the upgrade module 503 is specifically configured to:
and running a starting program.
Optionally, the address space of the boot program, the address of the first address space, and the address space of the second address space are consecutive in sequence.
Referring to fig. 6, based on the same inventive concept, an embodiment of the present invention provides an embedded device, including: at least one processor 601, where the processor 601 is configured to execute a computer program stored in a memory to implement the steps of the upgrade method for an embedded device as shown in fig. 4 according to an embodiment of the present invention.
Alternatively, the processor 601 may be specifically a central processing unit, an Application Specific Integrated Circuit (ASIC), and may be one or more integrated circuits for controlling program execution.
Optionally, the embedded device further includes a memory 602 connected to the at least one processor 601, and the memory 602 may include a Read Only Memory (ROM), a Random Access Memory (RAM), and a disk memory. The memory 602 is used for storing data required by the processor 601 during operation, that is, storing instructions executable by the at least one processor 601, and the at least one processor 601 executes the instructions stored in the memory 602 to perform the method shown in fig. 4. The number of the memories 602 is one or more. The memory 602 is also shown in fig. 6, but it should be understood that the memory 602 is not an optional functional module, and is therefore shown in fig. 6 by a dotted line.
The entity devices corresponding to the determining module 501, the mapping module 502 and the upgrading module 503 may be the aforementioned processor 601. The embedded device may be used to perform the method provided by the embodiment shown in fig. 4. Therefore, regarding the functions that can be realized by the functional modules in the apparatus, reference may be made to the corresponding description in the embodiment shown in fig. 4, which is not repeated herein.
Embodiments of the present invention also provide a computer storage medium, where the computer storage medium stores computer instructions, and when the computer instructions are executed on a computer, the computer is caused to execute the method as described in fig. 4.
It will be clear to those skilled in the art that, for convenience and simplicity of description, the foregoing division of the functional modules is merely used as an example, and in practical applications, the above function distribution may be performed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to perform all or part of the above described functions. For the specific working processes of the system, the apparatus and the unit described above, reference may be made to the corresponding processes in the foregoing method embodiments, and details are not described here again.

Claims (10)

1. A method for upgrading an embedded device, the method comprising:
determining a target storage space for storing a system upgrading file in two storage spaces, wherein the version serial number of the system upgrading file stored in the target storage space is higher than that of the system file stored in the other storage space;
mapping the storage addresses of the two storage spaces to a first address space and a second address space of a central processing unit, wherein the storage address of the target storage space is mapped to the first address space, the storage address of the other storage space is mapped to the second address space, the first address space and the second address are continuous, and the first address of the first address space is smaller than the first address of the second address space;
and loading the file corresponding to the first address space so as to upgrade the embedded equipment.
2. The method of claim 1, wherein the two storage spaces comprise a first storage space and a second storage space, and wherein determining a destination storage space for storing the system upgrade file in the two storage spaces comprises:
acquiring a first version serial number of a first system file and a second version serial number of a second system file, wherein the first system file is stored in the first storage space, and the second system file is stored in the second storage space;
if the first version serial number is lower than the second version serial number, determining the first storage space as the target storage space; or,
and if the first version serial number is higher than the second version serial number, determining the second storage space as the destination storage space.
3. The method of claim 2, wherein mapping memory addresses of the two memory spaces to a first address space and a second address space of a central processor comprises:
if the first storage space is determined to be the target storage space, mapping the storage address of the first storage space to the first address space, and mapping the storage address of the second storage space to the second address space; or,
if the second storage space is determined to be the target storage space, mapping the storage address of the second storage space to the first address space, and mapping the storage address of the first storage space to the second address space.
4. The method according to any one of claims 1 to 3, wherein the central processing unit stores a boot program, and the boot program is used for loading a file corresponding to the first address space; loading the file corresponding to the first address space, including:
and running the starting program.
5. The method of claim 4, wherein the initiator address space, the first address space, and the second address space are consecutive in order.
6. An embedded device, comprising:
the system comprises a determining module, a judging module and a judging module, wherein the determining module is used for determining a target storage space for storing a system upgrading file in two storage spaces, and the version serial number of the system upgrading file stored in the target storage space is higher than that of the system file stored in the other storage space;
a mapping module, configured to map storage addresses of the two storage spaces to a first address space and a second address space of a central processing unit, where a storage address of the destination storage space is mapped to the first address space, a storage address of the other storage space is mapped to the second address space, the first address space and the second address space are consecutive, and a head address of the first address space is smaller than a head address of the second address space;
and the upgrading module is used for loading the file corresponding to the first address space so as to upgrade the embedded equipment.
7. The embedded device of claim 6, wherein the determination module is specifically configured to:
acquiring a first version serial number of a first system file and a second version serial number of a second system file, wherein the first system file is stored in the first storage space, and the second system file is stored in the second storage space;
if the first version serial number is lower than the second version serial number, determining the first storage space as the target storage space; or,
and if the first version serial number is higher than the second version serial number, determining the second storage space as the destination storage space.
8. The embedded device of claim 7, wherein the mapping module is specifically configured to:
when the first storage space is determined to be the target storage space, mapping the storage address of the first storage space to the first address space, and mapping the storage address of the second storage space to the second address space; or,
when the second storage space is determined to be the target storage space, mapping the storage address of the second storage space to the first address space, and mapping the storage address of the first storage space to the second address space.
9. The embedded device according to any one of claims 6-8, wherein the central processing unit stores a boot program, and the boot program is configured to load a file corresponding to the first address space; the upgrade module is specifically configured to:
and running the starting program.
10. An embedded device, characterized in that the embedded device comprises at least one processor and a memory connected to the at least one processor, the at least one processor being adapted to carry out the steps of the method according to any one of claims 1-5 when executing a computer program stored in the memory.
CN201911017178.6A 2019-10-24 2019-10-24 Embedded equipment upgrading method and embedded equipment Pending CN111026417A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911017178.6A CN111026417A (en) 2019-10-24 2019-10-24 Embedded equipment upgrading method and embedded equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911017178.6A CN111026417A (en) 2019-10-24 2019-10-24 Embedded equipment upgrading method and embedded equipment

Publications (1)

Publication Number Publication Date
CN111026417A true CN111026417A (en) 2020-04-17

Family

ID=70201503

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911017178.6A Pending CN111026417A (en) 2019-10-24 2019-10-24 Embedded equipment upgrading method and embedded equipment

Country Status (1)

Country Link
CN (1) CN111026417A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111857791A (en) * 2020-07-06 2020-10-30 浙江鸿泉电子科技有限公司 Embedded product maintenance method and device, electronic equipment and storage medium
CN112506545A (en) * 2020-12-14 2021-03-16 珠海格力智能装备有限公司 System upgrading method and system upgrading device for industrial control equipment and electric control equipment
CN115878145A (en) * 2022-11-11 2023-03-31 深圳心派科技有限公司 Electronic device, system upgrading method thereof and computer readable storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101169749A (en) * 2007-11-20 2008-04-30 中兴通讯股份有限公司 Software edition upgrading management device and software edition upgrading management method
CN102722394A (en) * 2012-06-08 2012-10-10 深圳路迪网络有限公司 Start upgrading method of embedded equipment
CN103116502A (en) * 2011-11-17 2013-05-22 国家纳米技术与工程研究院 Method of achieving upgrading by using main and backup version backup
CN104090796A (en) * 2014-07-08 2014-10-08 成都万维图新信息技术有限公司 Embedded device program updating method and system
CN107678762A (en) * 2017-09-26 2018-02-09 杭州中天微系统有限公司 A kind of system version upgrade method and device
CN109032846A (en) * 2018-08-08 2018-12-18 京信通信系统(中国)有限公司 Equipment remote backup upgrade method, device, computer storage medium and equipment
CN110333890A (en) * 2019-06-28 2019-10-15 南京兆伏电力科技有限公司 The method that long-range programming solidifies FLASH data

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101169749A (en) * 2007-11-20 2008-04-30 中兴通讯股份有限公司 Software edition upgrading management device and software edition upgrading management method
CN103116502A (en) * 2011-11-17 2013-05-22 国家纳米技术与工程研究院 Method of achieving upgrading by using main and backup version backup
CN102722394A (en) * 2012-06-08 2012-10-10 深圳路迪网络有限公司 Start upgrading method of embedded equipment
CN104090796A (en) * 2014-07-08 2014-10-08 成都万维图新信息技术有限公司 Embedded device program updating method and system
CN107678762A (en) * 2017-09-26 2018-02-09 杭州中天微系统有限公司 A kind of system version upgrade method and device
CN109032846A (en) * 2018-08-08 2018-12-18 京信通信系统(中国)有限公司 Equipment remote backup upgrade method, device, computer storage medium and equipment
CN110333890A (en) * 2019-06-28 2019-10-15 南京兆伏电力科技有限公司 The method that long-range programming solidifies FLASH data

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111857791A (en) * 2020-07-06 2020-10-30 浙江鸿泉电子科技有限公司 Embedded product maintenance method and device, electronic equipment and storage medium
CN112506545A (en) * 2020-12-14 2021-03-16 珠海格力智能装备有限公司 System upgrading method and system upgrading device for industrial control equipment and electric control equipment
CN115878145A (en) * 2022-11-11 2023-03-31 深圳心派科技有限公司 Electronic device, system upgrading method thereof and computer readable storage medium
CN115878145B (en) * 2022-11-11 2023-09-26 深圳心派科技有限公司 Electronic device, system upgrading method thereof and computer readable storage medium

Similar Documents

Publication Publication Date Title
WO2022007656A1 (en) Bootloader software updating method and apparatus, embedded controller, and storage medium
CN104572229B (en) The firmware upgrade method and device for upgrading firmware of embedded system
CN111026417A (en) Embedded equipment upgrading method and embedded equipment
JP2007213571A (en) Method for starting system using direct memory access in novel memory architecture
JP7002358B2 (en) Information processing system, information processing device, BIOS update method of information processing device, and BIOS update program of information processing device
CN110874237A (en) Software upgrading method, device, terminal and readable storage medium
CN113157303A (en) Upgrading method, embedded system, terminal and computer storage medium
US9223697B2 (en) Computer reprogramming method, data storage medium and motor vehicle computer
JP2018160207A (en) On-vehicle controller and program update software
EP3923139B1 (en) Electronic control device and method for using non-volatile memory
CN109976958B (en) Method and device for improving firmware test efficiency and storage medium
CN112860291A (en) Firmware upgrading method and device
CN109697077B (en) Method, device and equipment for starting hard disk firmware
CN102298531B (en) Method for upgrading flash memory file system in embedded system
CN112199109A (en) Firmware upgrading method, device, equipment and medium
JP2005182812A (en) System and method for storing image file in computer system
CN116301973A (en) Firmware upgrading method, device, equipment and readable storage medium
US20220244946A1 (en) Ota master, update control method, non-transitory storage medium, and vehicle
CN113377425B (en) BMC firmware generation method and device, BMC starting method and device and storage medium
US11768669B2 (en) Installing application program code on a vehicle control system
CN112667444A (en) System upgrading method, storage medium and terminal equipment
JP2002175193A (en) Device and method for rewriting program
JP2018160208A (en) On-vehicle controller and program update software
JP7266216B2 (en) Information processing device and information processing method
US20230143921A1 (en) Electronic control system, storage medium storing data structure of software package, and storage medium storing computer program

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20200417