Method and device for online upgrading and updating of embedded device software

By dividing the startup backup area and the underlying backup area in the flash memory of the IoT device, and using partial backup technology to perform OTA upgrades, the problems of high equipment cost and low flash memory occupancy are solved, and a more efficient online upgrade process is achieved.

CN115098145BActive Publication Date: 2024-09-27BEIJING ZHANYUE XINZHI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210778575.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-04
Publication Date
2024-09-27
Estimated Expiration
2042-07-04

AI Technical Summary

Technical Problem

When existing IoT devices are upgraded online, a large flash memory capacity is required to store two sets of software, resulting in high equipment costs and low flash memory occupancy during the upgrade process.

Method used

Partial backup technology is used to divide the startup backup area and the bottom backup area in the flash memory. Select and perform upgrade operations based on the update content. Backup and restore are only performed when needed to reduce the occupancy rate of the flash memory.

Benefits of technology

It effectively reduces the occupancy rate of flash memory and equipment costs, ensures the normal operation of equipment during the upgrade process, and achieves more efficient OTA software upgrades.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115098145B
    Figure CN115098145B
Patent Text Reader

Abstract

This solution provides a method and device for online software upgrade of embedded devices. The method sequentially performs the following steps: according to the content of the startup flag, determine the location of the startup code and the underlying code; according to the content of the status flag, select the code of the recovery configuration area and / or the user area; start the code execution, load and start running other codes; receive the upgrade request, select to perform the upgrade operation according to the updated content; after the update is completed, restart the entire system, and the upgrade takes effect. Among them, the upgrade operation is performed by storing the code with the help of at least one of the underlying backup area or the startup backup area. The code is updated through the local backup area, which reduces the required flash memory capacity.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of online upgrade, and in particular to a method, device, electronic device and storage medium for online upgrade of embedded device software. Background Art

[0002] The Internet of Things (IoT), or "Internet of Everything Connected", is an extension and expansion of the Internet. It combines various information sensing devices with the Internet to form a huge network, realizing the interconnection of people, machines and things at any time and any place. IoT devices are non-standard computing devices that can be wirelessly connected to the network and have the ability to transmit data. IoT involves extending the scope of Internet connectivity from standard devices such as desktops, laptops, smartphones and tablets to any range of traditional "dumb" or non-Internet-enabled physical devices and everyday items. These devices are embedded with technology that can communicate and interact over the Internet for embedded devices. They can also be remotely monitored and controlled. According to the type of device, it can be divided into three categories: first, consumer connected devices include smart TVs, smart speakers, toys, wearable devices and smart appliances; second, enterprise IoT devices are edge devices designed for enterprise use, such as smart locks, smart lighting, etc.; third, industrial IoT devices are designed for use in factories or other industrial environments.

[0003] Over the Air (OTA) technology is also called Over the Air (OTA) technology. It is the ability to push data updates within the terminal by connecting to the terminal through the server and mobile communication network.

[0004] Most IoT devices on the market today have an over-the-air upgrade feature. This feature means that the device software can be updated using a mobile phone without the need for external wired cables. However, within the device, the currently commonly used solution is a full backup solution, such as Figure 1 As shown, two areas of the same size are opened in the flash memory: Area 101 and Area 2 102, both of which are used to store the software of the device. During the upgrade process, Area 1 or Area 2 stores the old software that is running, and the corresponding Area 2 or Area 1 is used to receive the updated software and store the new software. When the upgrade is completed, the new software will replace the old software and be executed. This solution is mainly to ensure that the device can still operate normally after the upgrade process fails. To this end, a larger flash memory is used to store two sets of software. The larger the flash memory capacity, the higher the cost of the device. In order to reduce the size of the flash memory used by IOT devices and reduce the cost of the device, it is necessary to provide an OTA method with less flash memory capacity. Summary of the invention

[0005] This solution provides a method, device, electronic device and storage medium for online software update of embedded devices. By using local backup technology according to different update contents when requesting OTA software upgrade, the above technical problems existing in the prior art can be at least solved.

[0006] According to a first aspect of the present solution, a method for online upgrading and updating software of an embedded device is provided, the method comprising the following operations performed in sequence:

[0007] Step 1) Determine the location of the startup code and the underlying code according to the content of the startup flag;

[0008] Step 2) Selecting the code for restoring the configuration area and / or the user area according to the content of the status flag;

[0009] Step 3) Start code execution, load and start running other code;

[0010] Step 4) receiving an upgrade request, and selecting to perform an upgrade operation according to the updated content;

[0011] Step 5) After the update is complete, restart the entire system for the upgrade to take effect;

[0012] The updated content in step 4 is the code of at least one of the configuration area, the user area, the underlying area and the backup area; and the upgrade operation is performed by storing the code with the help of at least one of the underlying backup area or the startup backup area.

[0013] In the above scheme, the update content of step 4 is the configuration area or user area code, and the following steps are performed in sequence:

[0014] Step 41) receiving new code and storing it in RAM successively until the new code fills up the size of one block of the flash memory;

[0015] Step 42) back up a block of the old code, store the old code in the bottom backup area, and set the status flag to st=1 after storage;

[0016] Step 43) Write the new code to the location of the backed-up old code. After completion, clear the status flag st=0;

[0017] Step 44) Repeat steps 41 to 43 until the entire code update is completed.

[0018] In the above scheme, the update content of step 4 is the boot area or bottom area code, and the following steps are performed in sequence:

[0019] Step 41') receiving new code and storing it in RAM until the new code fills up the size of one block of the flash memory;

[0020] Step 42') storing the new code in the corresponding startup backup area or bottom backup area;

[0021] Step 43') Repeat steps 41' to 42' until the entire code is stored in the startup backup area or the bottom backup area;

[0022] Step 44 ′) Update the start flag to bt=1 or 2 or 3.

[0023] Based on step 1 of the above scheme, when bt=0, it means that the boot area and the underlying area are the code execution locations; when bt=1, it means that the boot area and the underlying backup area are the code execution locations; when bt=2, it means that the boot backup area and the underlying area are the code execution locations; when bt=3, it means that the boot backup area and the underlying backup area are the code execution locations.

[0024] Based on step 2 of the above solution, when the status flag st=0, step 3 is directly executed; when the status flag st=1, the content stored in the bottom backup area is restored to its original position.

[0025] According to the second aspect of the present solution, an embedded device based on a software online upgrade and update method is provided, wherein the embedded device is an IOT device and has at least a storage unit, a processing unit and an online upgrade functional unit; the online upgrade functional unit executes the method described in the present solution.

[0026] The storage unit of the above device is a flash memory, which is divided into a startup area, a configuration area, a user area, a bottom area, a startup backup area and a bottom backup area.

[0027] Based on the zoning of the above device, the size of the startup area is the same as the size of the startup backup area, and the two can be switched relative to each other; the size of the underlying area is the same as the size of the underlying backup area, and the two can also be switched relative to each other.

[0028] According to a third aspect of the present solution, there is provided an electronic device, comprising:

[0029] at least one processor; and

[0030] a memory communicatively connected to the at least one processor; wherein,

[0031] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can perform the method described in this solution.

[0032] According to a fourth aspect of the present solution, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute the method described in the present solution.

[0033] The method, device, electronic device and storage medium for online software update of embedded devices of the present solution save the occupancy rate of the flash memory by establishing a startup backup area and a bottom-level backup area in the flash memory. When an OTA software upgrade is requested, a local backup area technical software upgrade is implemented according to different update contents. Since only two backup areas, the startup backup area and the bottom-level backup area, are opened in the flash memory, compared with the full backup solution, the present solution reduces the required flash memory capacity.

[0034] In addition, this solution distinguishes between the boot area and the boot backup area, as well as the bottom area and the bottom backup area, ensuring that the product can still start normally even if an accident occurs during the upgrade process; only the bottom backup area is used to back up the contents of the user area and the configuration area, effectively reducing the required flash memory capacity. Since the cost of flash memory accounts for a large proportion in embedded devices, this solution effectively reduces the overall cost of the product.

[0035] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of this solution, nor is it intended to limit the scope of this solution. Other features of this solution will become easy to understand through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] By reading the detailed description below with reference to the accompanying drawings, the above and other objects, features and advantages of the exemplary embodiments of the present invention will become readily understood. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary and non-limiting manner, wherein:

[0037] In the drawings, the same or corresponding reference numerals represent the same or corresponding parts.

[0038] Figure 1 A schematic diagram of flash memory partition in a full backup solution in the related art is shown;

[0039] Figure 2 A schematic diagram of flash memory partition in the local backup solution of this solution is shown;

[0040] Figure 3 A schematic diagram of the steps of the method for online software update of embedded devices in this solution is shown;

[0041] Figure 4 A schematic diagram of an online software update process for an embedded device provided by an embodiment of the present invention is shown;

[0042] Figure 5 A schematic diagram of the structure of an electronic device according to an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0043] In order to make the purpose, features and advantages of this solution more obvious and easy to understand, the technical solution in the embodiment of this solution will be clearly and completely described below in conjunction with the drawings in the embodiment of this solution. Obviously, the described embodiment is only a part of the embodiment of this solution, not all the embodiments. Based on the embodiments in this solution, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of this solution.

[0044] In this field, the software content stored in flash memory is usually divided into four parts according to its function: startup code, configuration items, user code and underlying code, and the corresponding storage space is divided into: startup area, configuration area, user area and underlying area. Figure 1 In order to solve the problem of low occupancy rate caused by the full backup flash memory partition shown in FIG. 1 , this embodiment adopts the flash memory partition method in the local backup solution, that is, in addition to the above four areas, two backup areas are also divided in the flash memory, such as Figure 2 As shown, in this embodiment, the flash memory is divided into a boot area 201, a boot backup area 202, a configuration area 203, a user area 204, a bottom area 205 and a bottom backup area 206. The size of the boot backup area 202 is the same as that of the boot area 201, and the boot backup area 202 and the boot area 201 can be switched with each other. In addition, the size of the bottom backup area 206 is also the same as that of the bottom area 205, and the bottom backup area 206 and the bottom area 205 can also be switched with each other.

[0045] In addition, in order to perform OTA upgrades of IOT devices through the above two backup areas, this solution also sets up two groups of identifiers. One is the startup flag bt, which is used to identify the valid startup area and underlying area. When bt = 0, it means that the startup area and the underlying area are the code execution locations; when bt = 1, it means that the startup area and the underlying backup area are the code execution locations; when bt = 2, it means that the startup backup area and the underlying area are the code execution locations; when bt = 3, it means that the startup backup area and the underlying backup area are the code execution locations.

[0046] The other is a status flag st, which is used to display the status of the backup process; when st=0, it means that there is no code that needs to be restored; st=1 means that there is code that needs to be restored, and the code / software of the corresponding partition is updated.

[0047] Figure 3 A schematic diagram of the method steps for online software update of embedded devices in this solution is shown, and each step will be explained.

[0048] The method comprises the following operations performed in order:

[0049] Step 301 determines the location of the startup code and the bottom layer code according to the content of the startup flag. The default startup flag bt=0 points to the startup layer and the bottom layer area, indicating that the startup layer and the bottom layer area are the code execution location; when bt=1, it indicates that the startup layer and the bottom layer backup area are the code execution location; when bt=2, it indicates that the startup backup area and the bottom layer area are the code execution location; when bt=3, it indicates that the startup backup area and the bottom layer backup area are the code execution location.

[0050] Step 302 selects the code for restoring the configuration area and / or the user area according to the content of the status flag.

[0051] In some embodiments, if it is not necessary to restore the configuration area / user area code, corresponding to the state flag st=0, step 3 is directly executed.

[0052] In some embodiments, if the configuration area / user area code needs to be restored, corresponding to the state flag st=1, the content stored in the bottom backup area is restored to its original position.

[0053] Step 303 starts code execution, loads and starts running other codes.

[0054] Step 304: receiving an upgrade request, and selecting to execute an upgrade operation according to the updated content.

[0055] In some embodiments, if the updated content is the configuration area or user area code, the old code is partially upgraded and updated with the help of the underlying backup area.

[0056] In some embodiments, the updated content is the boot code or the underlying area code, and the old code is partially upgraded and updated with the help of the boot backup area or the underlying backup area.

[0057] Step 305: The update is completed, and the entire system is restarted for the upgrade to take effect.

[0058] Example 1

[0059] This embodiment provides a method for online software update of an embedded device. The entire process is as follows: Figure 4 When updating the software code via over-the-air upgrade, follow the steps below:

[0060] Step 1) Determine the location of the startup code and underlying code based on the content of the startup flag.

[0061] Step 2) Determine whether the code in the configuration area or the user area needs to be restored according to the content of the status flag.

[0062] If necessary, restore the content stored in the underlying backup area to its original location based on the content of the status flag; if not necessary, execute step 3.

[0063] Step 3) After the startup code is executed, load and start running other codes

[0064] Step 4) After receiving the upgrade request, perform the update operation according to the updated content.

[0065] First determine whether the updated content is a configuration item or user code. If so, perform the following update operations in sequence:

[0066] Step 41) receiving new code and storing it in RAM successively until the new code fills up the size of one block of the flash memory;

[0067] Step 42) back up a block of the old code, store the old code in the bottom backup area, and set the status flag to st=1 after storage;

[0068] Step 43) Write the new code to the location of the backed-up old code. After completion, clear the status flag st=0;

[0069] Step 44) Repeat steps 41 to 43 until the entire code update is completed.

[0070] If the updated content is not a configuration item or user code, then determine whether the updated content is startup code or underlying code. If so, perform the following update steps in sequence:

[0071] Step 41') receiving new code and storing it in RAM until the new code fills up the size of one block of the flash memory;

[0072] Step 42') storing the new code in the corresponding startup backup area or bottom backup area;

[0073] Step 43') Repeat steps 41' to 42' until the entire code is stored in the startup backup area or the bottom backup area;

[0074] Step 44 ′) Update the start flag to bt=1 or 2 or 3.

[0075] Step 5) Once the update is complete, restart the entire system for the update to take effect.

[0076] According to an embodiment of the present solution, the present solution also provides an electronic device and a readable storage medium.

[0077] Figure 5A schematic block diagram of an example electronic device 500 that can be used to implement an embodiment of the present solution is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present solution described and / or required herein.

[0078] like Figure 5 As shown, the electronic device 500 includes a computing unit 501, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 502 or a computer program loaded from a storage unit 505 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the device 500 can also be stored. The computing unit 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0079] Multiple components in the electronic device 500 are connected to the I / O interface 505, including: an input unit 506, such as a keyboard, a mouse, etc.; an output unit 507, such as various types of displays, speakers, etc.; a storage unit 505, such as a disk, an optical disk, etc.; and a communication unit 509, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 509 allows the device 500 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0080] The computing unit 501 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 501 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 501 performs the various methods and processes described above, such as the method for online upgrade and update of embedded device software. For example, in some embodiments, the method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 505. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 500 via ROM 502 and / or communication unit 509. When the computer program is loaded into RAM 503 and executed by the computing unit 501, one or more steps of the method for online upgrade and update of embedded device software described above may be performed. Alternatively, in other embodiments, the computing unit 501 may be configured to perform an over-the-air upgrade method in any other appropriate manner (e.g., by means of firmware).

[0081] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0082] The program code for implementing the method of the present solution can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code can be executed entirely on the machine, partially on the machine, partially on the machine as a stand-alone software package and partially on a remote machine, or entirely on a remote machine or server.

[0083] In the context of this solution, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0084] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0085] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.

[0086] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.

[0087] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution disclosed in this solution can be achieved, and this document does not limit this.

[0088] The above is only a specific implementation of the scheme, but the protection scope of the scheme is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the scheme, which should be included in the protection scope of the scheme. Therefore, the protection scope of the scheme should be based on the protection scope of the claims.

Claims

1. A method for online upgrading and updating of embedded device software, It is characterized in that The flash memory of the embedded device is divided into a boot area, a configuration area, a user area, a bottom area, a boot backup area and a bottom backup area. The size of the boot area is the same as the size of the boot backup area, and the two can be switched relative to each other; the size of the bottom area is the same as the size of the bottom backup area, and the two can also be switched relative to each other; the method includes the following operations performed in sequence: Step 1) determining the location of the boot code and the underlying code according to the content of the boot flag; wherein the boot flag is used to identify the valid boot area and the underlying area; Step 2) Selecting a code for restoring the configuration area and / or the user area according to the content of the status mark; wherein the status mark is used to display the status of the backup process; Step 3) Start code execution, load and start running other code; Step 4) Upon receiving the upgrade request, choose to perform the upgrade operation based on the updated content; Step 5) After the update is complete, restart the entire system for the upgrade to take effect; Wherein, the updated content in step 4 is the code of at least one of the configuration area, the user area, the bottom area and the backup area; the execution of the upgrade operation stores the code by at least using one of the bottom backup area or the startup backup area; The update content of step 4 is the configuration area or user area code, and the following steps are performed in sequence: Step 41) receiving new codes and storing them in RAM successively until the new codes fill up the size of one block of the flash memory; Step 42) back up a block of the old code, store the old code in the bottom backup area, and set the status flag to st=1 after storage; Step 43) write the new code to the location of the backed-up old code. After completion, clear the status flag st = 0; Step 44) Repeat steps 41 to 43 until the entire code update is completed; The update content of step 4 is the boot area or bottom area code, and the following steps are performed in sequence: Step 41 ′) receiving new code and storing it in RAM until the new code fills up the size of one block of the flash memory; Step 42') storing the new code in the corresponding startup backup area or bottom backup area; Step 43') Repeat steps 41'-42' until the entire code is stored in the startup backup area or the bottom backup area; Step 44') Update the startup flag to bt=1 or 2 or 3.

2. The method for online upgrading and updating of embedded device software according to claim 1, It is characterized in that In step 1, when bt=0, it indicates that the boot area and the bottom area are the code execution locations; when bt=1, it indicates that the boot area and the bottom area are the code execution locations; when bt=2, it indicates that the boot backup area and the bottom area are the code execution locations; when bt=3, it indicates that the boot backup area and the bottom area are the code execution locations.

3. The method for online upgrading and updating of embedded device software according to claim 1, It is characterized in that In step 2, when the status flag st=0, step 3 is directly executed; when the status flag st=1, the content stored in the bottom backup area is restored to its original position.

4. An embedded device for online software upgrade and update, It is characterized in that The embedded device is an IOT device, which at least has a storage unit, a processing unit and an online upgrade functional unit; the online upgrade functional unit executes any one of the methods described in claims 1-3.

5. An electronic device, It is characterized in that include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 3.

6. A non-transitory computer-readable storage medium storing computer instructions, It is characterized in that The computer instructions are used to make the computer execute the method according to any one of claims 1-3.