Asymmetric firmware over-the-air upgrading method

By storing firmware air upgrade differential packages in nonvolatile memory and generating new system images in volatile memory, asymmetric firmware air upgrade is achieved, solving the waste of storage space and applicability of traditional AB symmetric upgrade solutions. Problem, improving the reliability and efficiency of upgrades.

CN119396445APending Publication Date: 2025-02-07BEIMI TECHNOLOGY (ZHUHAI) CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411454227.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-17
Publication Date
2025-02-07

AI Technical Summary

Technical Problem

The traditional AB symmetric firmware aerial upgrade solution has problems such as wasted storage space, not suitable for devices with limited storage space, and increased data transmission needs.

Method used

Using the asymmetric firmware air upgrade method, the upgrade differential package is stored in non-volatile memory and new system images are generated and stored in volatile memory, overwriting the original system files in non-volatile memory, and completing System upgrade.

Benefits of technology

It greatly saves storage space, improves the reliability of upgrades, is suitable for devices with limited storage space, and reduces data transmission requirements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119396445A_ABST
    Figure CN119396445A_ABST
Patent Text Reader

Abstract

The invention relates to the field of embedded systems, and discloses an asymmetric firmware over-the-air upgrading method. The method comprises two firmware over-the-air upgrading stages: firstly, in main system upgrading, after a main system upgrading differential package is downloaded to an upgrading partition of a nonvolatile memory, the equipment is restarted, and a main system area in the nonvolatile memory is emptied at the same time; and the new main system mirror image is synthesized by the main system upgrading differential package and the original file in the nonvolatile memory, is temporarily stored in the volatile memory, and is used for overwriting the original main system file. And if the upgrading fails, the guarding system obtains and installs a complete main system mirror image from the upper computer. In the daemon system upgrading process, the daemon system upgrading differential package is downloaded as well, and the daemon system area is emptied after the equipment is restarted. The new daemon system mirror image is generated by the daemon system upgrade differential package and the original file, is stored in the volatile memory, and overwrites the original daemon system file in the nonvolatile memory. And when the upgrading is unsuccessful, the main system is responsible for acquiring and installing the complete guarding system mirror image from the upper computer. By means of the method, the storage space needed by FOTA upgrading can be greatly saved, when one system goes wrong in upgrading, the other system can obtain the complete upgrading package to complete upgrading, and the upgrading reliability is enhanced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of wireless communications, and in particular to an asymmetric firmware over-the-air upgrade method. Background Art

[0002] This section is intended to provide a background or context for the embodiments of the present application as stated in the claims. The contents in this section are for reference only and do not constitute an admission or confirmation that they are prior art that has been disclosed.

[0003] Firmware Over-The-Air (FOTA) is a technology that allows remote updating of device firmware over the air without manual user intervention. This enables devices to receive software fixes, security patches, and feature upgrades, improving the functionality and security of devices. It is widely used in smartphones, IoT devices, etc.

[0004] Traditional FOTA solutions usually use the AB symmetric upgrade solution (Symmetric FOTA), which requires the device to have enough storage space to store two firmware images: one is the currently running firmware (A area), and the other is the newly downloaded upgrade firmware (B area). The advantage of this method is that it improves the reliability of the upgrade process. Even if an accident occurs during the upgrade process (such as power outage or system crash), the device can be restored to the original firmware and continue to run, thus avoiding bricking.

[0005] However, the AB symmetric upgrade solution has the following major problems:

[0006] 1. Large storage space requirements: Since two complete firmware images need to be stored, more than half of the device's storage space is often idle most of the time, which is a waste of storage resources.

[0007] 2. Not suitable for devices with limited storage space: For cost-sensitive IoT devices with limited storage capacity, the AB symmetric upgrade scheme may not be implemented due to insufficient space, which limits the ability of these devices to use remote firmware updates.

[0008] 3. Increased data transmission requirements: Large storage space requirements mean that more data needs to be transmitted when performing firmware updates, which not only increases communication costs but may also lead to longer upgrade times and higher energy consumption. Summary of the invention

[0009] The purpose of this application is to provide an asymmetric firmware over-the-air upgrade method, which can greatly save the storage space required for FOTA upgrades, and when a problem occurs in the upgrade of one system, the complete upgrade package can be obtained through another system to complete the upgrade, thereby enhancing the reliability of the upgrade.

[0010] The present application discloses an asymmetric firmware over-the-air upgrade method, wherein the system to be upgraded includes a non-volatile memory and a volatile memory, and the method includes:

[0011] When the main system needs to be upgraded, the main system upgrade differential package is downloaded to the designated upgrade partition of the non-volatile memory;

[0012] After the download is completed, the main system in the non-volatile memory triggers a restart operation, and the main system area in the volatile memory is cleared;

[0013] Generate a new main system image using the main system upgrade differential package and the original main system file in the main system area of ​​the non-volatile memory, wherein the new guard system image is temporarily stored in the main system area of ​​the volatile memory;

[0014] Using the new main system image stored in the volatile memory to overwrite the original main system file in the main system area of ​​the non-volatile memory, thereby completing the upgrade of the main system;

[0015] After the main system upgrade is completed, the main system area of ​​the non-volatile memory is checked to determine whether the new main system image is successfully installed. If it is not successfully installed, the guardian system communicates with the host computer to obtain the complete main system image. The complete main system image is downloaded and written into the main system area of ​​the non-volatile memory to replace the main system file that was not successfully installed.

[0016] Since the guardian system is less likely to be modified, and the main system involves a large amount of code, multiple functions, and frequent changes in human-computer interaction requirements, the general asymmetric over-the-air upgrade case mainly upgrades the main system. However, in some special cases, it may be necessary to upgrade the guardian system. Therefore, asymmetric over-the-air upgrades also include:

[0017] Download the guard system upgrade differential package to the designated upgrade partition of the non-volatile memory;

[0018] Generate a new guard system image using the guard system upgrade differential package and the original guard system file in the guard system area of ​​the non-volatile memory, wherein the new guard system image is temporarily stored in the guard system area of ​​the volatile memory;

[0019] Using the new guard system image stored in the volatile memory to overwrite the original guard system file in the guard system area of ​​the non-volatile memory, thereby completing the upgrade of the guard system;

[0020] After the guardian system upgrade is completed, the guardian system area of ​​the non-volatile memory is checked to determine whether the new guardian system image is successfully installed. If it is not successfully installed, the main system communicates with the host computer to obtain the complete guardian system image. The complete guardian system image is downloaded and written into the guardian system area of ​​the non-volatile memory to replace the guardian system file that was not successfully installed.

[0021] In a preferred example, when the main system is upgraded, the guard system processes the firmware over-the-air upgrade process and manages exceptions;

[0022] When the guard system is upgraded, the main system processes the firmware over-the-air upgrade process and performs exception management.

[0023] In a preferred example, downloading the main system upgrade differential package or the guard system upgrade differential package to a designated upgrade partition of the non-volatile memory further includes:

[0024] Configure the parameters for firmware over-the-air upgrade download;

[0025] Updating the parameters downloaded by the firmware over-the-air upgrade to the non-volatile memory;

[0026] Verifying the main system upgrade differential package or the guard system upgrade differential package;

[0027] The verified main system upgrade differential package or the guard system upgrade differential package is written into the designated upgrade partition of the non-volatile memory together with the parameters downloaded by the firmware over-the-air upgrade.

[0028] In a preferred example, before downloading the main system upgrade differential package or the guard system upgrade differential package to the upgrade partition of the non-volatile memory, the process further includes:

[0029] Check the download stage to determine whether the download stage is the main system upgrade differential package download stage or the guardian system upgrade differential package download stage. If the download stage is the main system upgrade differential package download stage, the main system upgrade differential package is downloaded to the designated upgrade partition of the non-volatile memory; otherwise, if the download stage is the guardian system upgrade differential package download stage, the guardian system upgrade differential package is downloaded to the designated upgrade partition of the non-volatile memory.

[0030] In a preferred embodiment, after downloading the differential package of the main system or the guard system, the method further includes:

[0031] Update the main system upgrade differential package downloading stage to the main system update stage, or update the guardian system upgrade differential package downloading stage to the guardian system update stage;

[0032] After the status is updated, reboot the system.

[0033] In a preferred embodiment, it also includes:

[0034] Start the firmware over-the-air upgrade and check the first stage. If the first stage is the upgrade completion stage, the firmware over-the-air upgrade is completed. If the first stage is the guardian system upgrade stage or the main system upgrade stage, start checking the download status.

[0035] If the download status is not the download completion status, the firmware over-the-air upgrade is completed. If the download status is the download completion status, the data packet is parsed and verified to determine whether the parsing and verification pass. If they pass, the second stage is checked:

[0036] If the second stage is a main system upgrade stage, the main system is upgraded, and after the main system upgrade is completed, the main system is restored and it is determined whether the main system is successfully restored. The corresponding second stage is updated according to whether the main system is successfully restored, and then the initialization firmware over-the-air download process is entered;

[0037] If the second stage is the guardian system upgrade stage, the guardian system is upgraded. After the guardian system upgrade is completed, the guardian system is restored and it is determined whether the guardian system is restored successfully. The corresponding second stage is updated based on whether the guardian system is restored successfully, and then the initialization firmware over-the-air download process is entered.

[0038] In a preferred embodiment, the guard system is a small system that is not fully functional and only includes the following functions:

[0039] Communicate with the upgrade server;

[0040] Or communicate with the host computer;

[0041] When differential update is not feasible, a complete upgrade package is received from the upgrade server or host computer to perform a full upgrade of the system.

[0042] In a preferred example, when a new system image is generated using the main system or guard system upgrade differential package and the original system files in the main system area or guard system area of ​​the non-volatile memory, the new system image is temporarily stored in the corresponding system area of ​​the volatile memory; if the storage space of the corresponding system area of ​​the volatile memory is insufficient to store the entire system image, the new system image is generated segment by segment, and the new system image segments stored in the volatile memory are used segment by segment to overwrite the original system segments in the system area of ​​the non-volatile memory, and finally the upgrade of the entire system is completed, where the segment size is defined according to the size of the corresponding system area of ​​the volatile memory, and the minimum segment size is limited by the differential algorithm used.

[0043] The present application also discloses a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, the steps in the method described above are implemented.

[0044] The present application also discloses a computer program product, comprising computer executable instructions, which can implement the steps in the method described above when executed by a processor.

[0045] In the implementation of the present application, the independent guard system is extremely streamlined. Although the main system continues to occupy the main ROM space, the miniaturization and non-full-function design of the guard system significantly reduce the overall storage requirements. The minimum ROM storage space occupied by the present application is the size of the guard system area, the size of the main system area, and the size of the upgrade area for storing differential packages. The minimum RAM storage space occupied by the present application is the larger value of the main system operation area and the new system image. Traditional firmware over-the-air upgrade (FOTA) technology usually adopts an AB symmetric upgrade scheme, requiring two roughly equal areas to be reserved in the ROM of the device, each area stores a complete system image, and this method significantly increases the occupancy of the ROM. In contrast, the asymmetric upgrade method used in the present application can store only a complete system image in the main system area. The principle is to use a relatively small upgrade area in the ROM to store the differential package required for the upgrade, and then use the differential package to combine the original system file in the ROM to generate a new system image stored in the volatile storage space (RAM). Once the new image is ready, the old system in the ROM is overwritten, avoiding the need to reserve persistent storage space for two complete system images. This guard system strategy greatly reduces the demand for non-volatile memory, because the size of the guard system is much smaller than the size of the complete system image. In the ROM structure design, the present application achieves higher storage efficiency by separating the guard system from the main system running area and accurately controlling the space utilization of the upgrade area.

[0046] Furthermore, if the standard differential update fails for any reason, the guard system or the main system also has the ability to request and receive a complete firmware image from the upgrade server or host computer to assist the other system in performing a comprehensive system update. The existence of this full backup solution greatly improves the robustness of the overall upgrade framework, ensuring that the device can be restored to a stable working state even in the most unfavorable circumstances, and ensuring the continuous availability of user devices and the security of data.

[0047] Furthermore, the system assists in managing the upgrade process through a streamlined guardian system, which is updated separately from the main system, and each system has its own independent update differential package, ensuring the flexibility of the upgrade process and reducing the risk caused by update failure.

[0048] Each technical feature disclosed in the above invention content, each technical feature disclosed in each implementation mode and example below, and each technical feature disclosed in the accompanying drawings can be freely combined with each other to form various new technical solutions (these technical solutions should be deemed to have been recorded in this specification), unless such combination of technical features is technically infeasible. For example, in one example, feature A+B+C is disclosed, and in another example, feature A+B+D+E is disclosed, and features C and D are equivalent technical means that play the same role. Technically, only one of them can be used, and it is impossible to use them at the same time. Feature E can be combined with feature C technically. Then, the solution of A+B+C+D should not be deemed to have been recorded because it is technically infeasible, while the solution of A+B+C+E should be deemed to have been recorded. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] Figure 1 is a flow chart of an asymmetric firmware over-the-air upgrade method according to the first embodiment of the present application;

[0050] Figure 2 is a flow chart of an asymmetric firmware over-the-air upgrade method according to the first embodiment of the present application;

[0051] Figure 3 is a flow chart of an asymmetric firmware over-the-air upgrade method according to the first embodiment of the present application;

[0052] Figure 4 is a flow chart of an asymmetric firmware over-the-air upgrade method according to the first embodiment of the present application;

[0053] Figure 5 is a flow chart of an asymmetric firmware over-the-air upgrade method according to the first embodiment of the present application;

[0054] Figure 6 is a flow chart of an asymmetric firmware over-the-air upgrade method according to the first embodiment of the present application;

[0055] Figure 7 is a flow chart of an asymmetric firmware over-the-air upgrade method according to the first embodiment of the present application;

[0056] Figure 8 is a flow chart of an asymmetric firmware over-the-air upgrade method according to the first embodiment of the present application;

[0057] Fig. 9 is a flow chart of an asymmetric firmware over-the-air upgrade method according to the first embodiment of the present application;

[0058] Fig.10 It is a flowchart of an asymmetric firmware over-the-air upgrade method according to the first embodiment of the present application. DETAILED DESCRIPTION

[0059] In the following description, many technical details are provided to help readers better understand the present application. However, those skilled in the art can understand that the technical solution claimed in the present application can be implemented even without these technical details and various changes and modifications based on the following embodiments.

[0060] Description of some concepts:

[0061] ROM: Read-Only Memory, ROM is a non-volatile memory used to store data permanently. It is mainly used to store firmware for computers or other electronic devices, that is, programs and data that do not need to be changed frequently. Once data is written to ROM, it cannot or is difficult to modify, ensuring that the device can keep these basic data unchanged even after power failure.

[0062] RAM: Random Access Memory, RAM is a volatile memory used to temporarily store running programs and data currently being processed. It allows data to be read and written quickly, thereby increasing the processing speed and efficiency of the device. The contents of RAM are lost after power is removed, so it is mainly used to store information that needs to be frequently accessed and changed during device startup or operation.

[0063] FOTA: Firmware Over-The-Air, firmware over the air download, allows the firmware of the device to be updated remotely wirelessly without manual operation by the user. This enables the device to receive software repairs, security patches and function upgrades, improves the functionality and security of the device, and is widely used in smartphones, IoT devices, etc.

[0064] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below in conjunction with the accompanying drawings.

[0065] The first embodiment of the present application relates to an asymmetric firmware over-the-air upgrade method, the process of which is as follows: Figure 1-10 As shown, the method comprises the following steps:

[0066] In step 101, the main system upgrade differential package is downloaded to a designated upgrade partition of a non-volatile memory;

[0067] In step 102, after the download is completed, the main system in the non-volatile memory triggers a restart operation, and the main system area in the volatile memory is cleared.

[0068] In step 103, a new main system image is generated using the main system upgrade differential package and the original main system file in the main system area of ​​the non-volatile memory, and the new main system image is temporarily stored in the main system area of ​​the volatile memory.

[0069] In step 104, the new main system image stored in the volatile memory is used to overwrite the original main system file in the main system area of ​​the non-volatile memory, thereby completing the upgrade of the main system.

[0070] In step 105, after the main system upgrade is completed, the main system area of ​​the non-volatile memory is checked to determine whether the new main system image is successfully installed. If it is not successfully installed, the guardian system communicates with the host computer to obtain the complete main system image. The complete main system image is downloaded and written to the main system area of ​​the non-volatile memory to replace the main system files that were not successfully installed.

[0071] In an optional embodiment, if Figure 2 As shown, after step 101, the following steps may also be included:

[0072] In step 201, the guard system upgrade differential package is downloaded to a designated upgrade partition of a non-volatile memory.

[0073] In step 202, a new guard system image is generated using the guard system upgrade differential package and the original guard system file in the guard system area of ​​the non-volatile memory, and the new guard system image is temporarily stored in the guard system area of ​​the volatile memory.

[0074] In step 203, the new guard system image stored in the volatile memory is used to overwrite the original guard system file in the guard system area of ​​the non-volatile memory, thereby completing the upgrade of the guard system.

[0075] In step 204, after the guardian system upgrade is completed, the guardian system area of ​​the non-volatile memory is checked to determine whether the new guardian system image is successfully installed. If it is not successfully installed, the main system communicates with the host computer to obtain the complete guardian system image. The complete guardian system image is downloaded and written into the guardian system area of ​​the non-volatile memory to replace the guardian system file that was not successfully installed.

[0076] In an optional embodiment, when the main system is upgraded, the guard system handles the firmware over-the-air upgrade process and manages exceptions. When the guard system is upgraded, the main system handles the firmware over-the-air upgrade process and manages exceptions.

[0077] In an optional embodiment, if Figure 3 As shown, step 101 or step 201 may further include:

[0078] In step 301, configure the parameters for firmware over-the-air upgrade download;

[0079] In step 302, the parameters downloaded by the firmware over-the-air upgrade are updated to the non-volatile memory;

[0080] In step 303, the main system upgrade differential package or the guard system upgrade differential package is verified;

[0081] In step 304, the verified main system upgrade differential package or guard system upgrade differential package is written into the designated upgrade partition of the non-volatile memory together with the parameters downloaded by the firmware over-the-air upgrade.

[0082] In an optional embodiment, before step 101 or step 201, the following steps may also be included:

[0083] In step 100, the downloading stage is checked to determine whether the downloading stage is the main system upgrade differential package downloading stage or the guardian system upgrade differential package downloading stage. If the downloading stage is the main system upgrade differential package downloading stage, the main system upgrade differential package is downloaded to the designated upgrade partition of the non-volatile memory; otherwise, if the downloading stage is the guardian system upgrade differential package downloading stage, the guardian system upgrade differential package is downloaded to the designated upgrade partition of the non-volatile memory.

[0084] In an optional embodiment, if Figure 4 As shown in the figure, after completing the upgrade of the main system or the guardian system, the following may also be included:

[0085] In step 401, the main system upgrade differential package downloading stage is updated to the main system update stage, or the guardian system upgrade differential package downloading stage is updated to the guardian system update stage;

[0086] In step 402, after the status is updated, the system is restarted.

[0087] In an optional embodiment, if Figure 5 As shown, it may also include:

[0088] In step 501, the firmware over-the-air upgrade is started, and the first stage is checked. If the first stage is the upgrade completion stage, the firmware over-the-air upgrade is completed. If the first stage is the guard system upgrade stage or the main system upgrade stage, the download status is checked;

[0089] In step 502, if the download status is not the download completion status, the firmware over-the-air upgrade is completed. If the download status is the download completion status, the data packet is parsed and verified to determine whether the parsing and verification pass. If so, the second stage is checked:

[0090] In step 5021, if the second stage is a main system upgrade stage, the main system is upgraded, and after the main system upgrade is completed, the main system is restored and it is determined whether the main system is restored successfully. The corresponding second stage is updated according to whether the main system is restored successfully, and then the step of initializing the firmware over-the-air download process is entered;

[0091] In step 5022, if the second stage is the guardian system upgrade stage, the guardian system is upgraded. After the guardian system upgrade is completed, the guardian system is restored and it is determined whether the guardian system has been restored successfully. The corresponding second stage is updated based on whether the guardian system has been restored successfully, and then the step of initializing the firmware over-the-air download process is entered.

[0092] In an optional embodiment, when a new system image is generated using the main system or guard system upgrade differential package and the original system files in the main system area or guard system area of ​​the non-volatile memory, the new system image is temporarily stored in the corresponding system area of ​​the volatile memory; if the storage space of the corresponding system area of ​​the volatile memory is insufficient to store the entire system image, the new system image is generated segment by segment, and the new system image segments stored in the volatile memory are used segment by segment to overwrite the original system segments in the system area of ​​the non-volatile memory, and finally the upgrade of the entire system is completed, where the segment size is defined according to the size of the corresponding system area of ​​the volatile memory, and the minimum segment size is limited by the differential algorithm used.

[0093] In an optional embodiment, the guard system is a small system without full functions, and may only include the following functions:

[0094] 1. The guard system can connect to the host computer or cloud server (upgrade server) through a secure communication protocol to receive firmware update instructions and download firmware packages. This includes receiving differential update packages and monitoring data transmission during the upgrade process.

[0095] 2. When differential update is not feasible, receive the complete upgrade package from the host computer or upgrade server to perform a full system update.

[0096] In order to better understand the technical solution of the present application, a specific example is provided below for illustration. The details listed in the example are mainly for ease of understanding and are not intended to limit the scope of protection of the present application.

[0097] The present application provides an asymmetric firmware over-the-air (FOTA) method, which aims to optimize the use of storage resources and improve the security and reliability of the upgrade process, and is particularly suitable for electronic devices with limited storage space. Figure 6-10 The figure shows a complete specific implementation of the present application, in which the purple arrow is used to connect the previous process and the next process:

[0098] The device in this application includes two main systems: the main system (Main System) and the daemon system (DaemonSystem). As an auxiliary to the main system, the daemon system is designed to be very streamlined. It basically only includes the communication function with the host computer and the use of the complete upgrade package obtained through communication with the host computer to guide the full upgrade of the main system when the main system upgrade fails. Its size is much smaller than the main system and can be compressed to the extreme, about 16kbite. During the process of guiding the main system upgrade, the daemon system can focus on the management of the upgrade process and exception handling, including monitoring the upgrade status and handling abnormal situations during the upgrade process.

[0099] The storage structure of the present application includes a non-volatile memory and a volatile memory, wherein the non-volatile memory is used to permanently store the differential package and the complete firmware package of the guard system and the main system, and the volatile memory is used to temporarily store the generated new system image. The non-volatile memory area includes the running area, the FOTA area and others, and the running area includes the guard system area and the main system area. The running area of ​​the volatile memory area includes the guard system data area and the main system data area.

[0100] The following is a brief description of the upgrade process:

[0101] First, check the download phase. If the download phase is the main system upgrade differential package download phase (may be displayed as FOTA_MAIN_DIFF_DL in the log file) or the guardian system upgrade differential package download phase (may be displayed as FOTA_DAEMON_DIFF_DL in the log file), then download the main system upgrade differential package or the guardian system upgrade differential package to the specific upgrade partition of the non-volatile memory. Configure the FOTA parameters during the download process. In this download phase, the upgrade differential packages of the guardian system and the main system can be downloaded from the air simultaneously or separately. After the download is completed, if the main system needs to be upgraded, the main system upgrade differential package and the original main system file in the non-volatile memory are used to generate a new main system image. This image is temporarily stored in the volatile memory. At this time, the download phase in the log file becomes the update phase, and the new state FOTA_MAIN_UPDATE is recorded in the log file. After that, the device restarts, the main system enters the update process, and the new main system image is used to overwrite the original file in the main system area in the non-volatile memory to complete the main system upgrade. If the guardian system needs to be upgraded, the stage is further updated to the guardian system upgrade differential package download stage (which may be displayed as FOTA_DAEMON_DIFF_DL in the log file), or the stage is further updated to the system image download stage (which may be displayed as IMG_DL in the log file). Subsequently, the firmware over-the-air download process is initialized and the status of the download check stage is returned.

[0102] When performing a FOTA upgrade, first check the first stage. If the first stage is the upgrade completion stage (may be displayed as FOTA_UPDATE_DONE in the log file), it means that the firmware air upgrade is completed. If the first stage is the main system update stage (may be displayed as FOTA_MAIN_UPDATE in the log file) or the guardian system update stage (may be displayed as FOTA_DAEMON_UPDATE in the log file), start checking the download status. If the download status is not the download completion status (not FOTA_STATE_DONE), the firmware air upgrade is completed. If the download status is the download completion status (FOTA_STATE_DONE), parse the data packet and verify it to determine whether the parsing and verification pass. If so, start the firmware air upgrade and check the second stage:

[0103] If the second stage is the main system update stage (FOTA_MAIN_UPDATE), then the main system is upgraded. After the main system upgrade is completed, the main system is restored from the pseudo-static random access memory and it is determined whether the main system is successfully restored. The corresponding second stage is updated according to whether the main system is successfully restored: If it is not successfully restored, the stage is updated to the main system image download stage (FOTA_MAIN_IMG_DL), which means that a complete data package needs to be obtained for a full upgrade. Regardless of whether the main system is successfully restored, the download status should also be updated to the inactive state (FOTA_STATE_NONE). After the recovery is successful, the step of initializing the firmware over-the-air download process is then entered.

[0104] If the second stage is the guardian system update stage (FOTA_DAEMON_UPDATE), the guardian system is upgraded. After the guardian system upgrade is completed, the guardian system is restored from the pseudo-static random access memory and it is determined whether the guardian system is successfully restored. The corresponding second stage is updated according to whether the guardian system is successfully restored: If it is not successfully restored, the stage is updated to the guardian system image download stage (FOTA_DAEMON_IMG_DL), which means that a complete data package needs to be obtained for a full upgrade. Regardless of whether the guardian system is successfully restored, the download status should also be updated to the inactive state (FOTA_STATE_NONE). After the recovery is successful, the step of initializing the firmware over-the-air download process is then entered.

[0105] After completion, the stage is updated to the upgrade completion stage (FOTA_UPDATE_DONE), and then the FOTA status is updated and reset to normal mode to complete the entire FOTA download and upgrade process.

[0106] During the upgrade process, if Figure 8 and Fig. 9As shown, if one of the guardian system or the main system encounters an abnormal situation such as power outage or system crash, resulting in update failure, in this case, the original main system (or guardian system) file has been damaged, and the new main system (or guardian system) image may not be generated effectively, or may have been damaged. The other system can communicate with the FOTA cloud server or the host computer to obtain the complete system image (not the differential package) pre-stored on the FOTA cloud server or the host computer to restore the abnormal system, ensuring that the system can quickly recover to a stable state when encountering an unforeseen interruption, thereby successfully completing the FOTA upgrade of the system.

[0107] After the upgrade is complete, the system restarts and starts running from the new starting position at runtime.

[0108] Both the main system and the guardian system can assist each other in upgrading and handling exceptions, ensuring that one provides support from the other during the upgrade, maximizing the continuity of the upgrade process and the stability of the system.

[0109] Accordingly, the embodiments of the present application also provide a computer-readable storage medium, in which computer executable instructions are stored, and when the computer executable instructions are executed by the processor, the various method embodiments of the present application are implemented. Computer-readable storage media include permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information can be a computer-readable instruction, a data structure, a module of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable storage media does not include temporary computer-readable media (transitory media), such as modulated data signals and carriers.

[0110] In addition, an embodiment of the present application further provides a computer program product, which includes computer executable instructions, and when the computer executable instructions are executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0111] It should be noted that, in the present application, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is any such actual relationship or order between these entities or operations. Moreover, the term "include", "comprise" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, article or equipment including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or equipment. In the absence of more restrictions, the elements defined by the sentence "include one" do not exclude the existence of other identical elements in the process, method, article or equipment including the elements. In the present application, if it is mentioned that a certain action is performed according to a certain element, it means at least the meaning of performing the action according to the element, which includes two situations: performing the action only according to the element and performing the action according to the element and other elements. Multiple, multiple, multiple, etc. expressions include 2, 2 times, 2 kinds and more than 2, more than 2 times, more than 2 kinds.

[0112] The serial numbers used in describing the steps of the method do not themselves constitute any limitation on the order of these steps. For example, the step with a larger serial number does not necessarily have to be executed after the step with a smaller serial number. The step with a larger serial number may be executed first and then the step with a smaller serial number. They may also be executed in parallel, as long as this execution order is reasonable for those skilled in the art. For another example, multiple steps with consecutive serial numbers (e.g., step 101, step 102, step 103, etc.) do not limit other steps that can be executed in between. For example, there may be other steps between step 101 and step 102.

[0113] This specification includes combinations of the various embodiments described herein. Individual references to embodiments (e.g., "one embodiment" or "some embodiments" or "preferred embodiments"); however, these embodiments are not mutually exclusive unless indicated as mutually exclusive or it is clear to a person skilled in the art that they are mutually exclusive. It should be noted that the word "or" is used in this specification in a non-exclusive sense unless the context clearly indicates or requires otherwise.

[0114] All documents mentioned in this specification are considered to be included in the disclosure of this application as a whole, so that they can be used as a basis for modification when necessary. In addition, it should be understood that the above is only a preferred embodiment of this specification and is not intended to limit the scope of protection of this specification. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of one or more embodiments of this specification should be included in the scope of protection of one or more embodiments of this specification.

[0115] In some cases, the actions or steps described in the claims may be performed in a different order than in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or sequential order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

Claims

1. An asymmetric firmware over-the-air upgrade method, characterized in that: The system to be upgraded includes a non-volatile memory and a volatile memory, and the method includes: When the main system needs to be upgraded, the main system upgrade differential package is downloaded to the designated upgrade partition of the non-volatile memory; After the download is completed, the main system in the non-volatile memory triggers a restart operation, and the main system area in the volatile memory is cleared; Generate a new main system image using the main system upgrade differential package and the original main system file in the main system area of ​​the non-volatile memory, wherein the new main system image is temporarily stored in the main system area of ​​the volatile memory; Using the new main system image stored in the volatile memory to overwrite the original main system file in the main system area of ​​the non-volatile memory, thereby completing the upgrade of the main system; After the main system upgrade is completed, the main system area of ​​the non-volatile memory is checked to determine whether the new main system image is successfully installed. If it is not successfully installed, the guardian system communicates with the host computer to obtain the complete main system image. The complete main system image is downloaded and written into the main system area of ​​the non-volatile memory to replace the main system file that was not successfully installed.

2. The asymmetric firmware over-the-air upgrade method according to claim 1, characterized in that: After downloading the main system upgrade differential package to the designated upgrade partition of the non-volatile memory, the method further includes: When the guard system needs to be upgraded, the guard system upgrade differential package is downloaded to the designated upgrade partition of the non-volatile memory; Generate a new guard system image using the guard system upgrade differential package and the original guard system file in the guard system area of ​​the non-volatile memory, wherein the new guard system image is temporarily stored in the guard system area of ​​the volatile memory; Using the new guard system image stored in the volatile memory to overwrite the original guard system file in the main system area of ​​the non-volatile memory, thereby completing the upgrade of the guard system; After the guardian system upgrade is completed, the guardian system area of ​​the non-volatile memory is checked to determine whether the new guardian system image is successfully installed. If it is not successfully installed, the main system communicates with the host computer to obtain the complete guardian system image. The complete guardian system image is downloaded and written into the guardian system area of ​​the non-volatile memory to replace the guardian system file that was not successfully installed.

3. The asymmetric firmware over-the-air upgrade method according to any one of claims 1 to 2, characterized in that: When the main system is upgraded, the guard system processes the firmware over-the-air upgrade process and manages exceptions; When the guard system is upgraded, the main system processes the firmware over-the-air upgrade process and performs exception management.

4. The asymmetric firmware over-the-air upgrade method according to any one of claims 1 to 2, characterized in that: Downloading the main system upgrade differential package or the guard system upgrade differential package to the designated upgrade partition of the non-volatile memory further includes: Configure the parameters for firmware over-the-air upgrade download; Updating the parameters downloaded by the firmware over-the-air upgrade to the non-volatile memory; Verifying the main system upgrade differential package or the guard system upgrade differential package; The verified main system upgrade differential package or the guard system upgrade differential package is written into the designated upgrade partition of the non-volatile memory together with the parameters downloaded by the firmware over-the-air upgrade.

5. The asymmetric firmware over-the-air upgrade method according to any one of claims 1 to 2, characterized in that: Before downloading the main system upgrade differential package or the guardian system upgrade differential package to the upgrade partition of the non-volatile memory, the following steps are also included: Check the download stage to determine whether the download stage is the main system upgrade differential package download stage or the guardian system upgrade differential package download stage. If the download stage is the main system upgrade differential package download stage, the main system upgrade differential package is downloaded to the designated upgrade partition of the non-volatile memory; otherwise, if the download stage is the guardian system upgrade differential package download stage, the guardian system upgrade differential package is downloaded to the designated upgrade partition of the non-volatile memory.

6. The asymmetric firmware over-the-air upgrade method according to claim 5, characterized in that: After completing the download of the differential package of the main system or the guard system, the following steps are also included: Update the main system upgrade differential package downloading stage to the main system update stage, or update the guardian system upgrade differential package downloading stage to the guardian system update stage; After the status is updated, reboot the system.

7. The asymmetric firmware over-the-air upgrade method according to claim 6, characterized in that: Also includes: Start the firmware over-the-air upgrade and check the first stage. If the first stage is the upgrade completion stage, the firmware over-the-air upgrade is completed. If the first stage is the guardian system upgrade stage or the main system upgrade stage, start checking the download status. If the download status is not the download completion status, the firmware over-the-air upgrade is completed. If the download status is the download completion status, the data packet is parsed and verified to determine whether the parsing and verification pass. If they pass, the second stage is checked: If the second stage is a main system upgrade stage, the main system is upgraded, and after the main system upgrade is completed, the main system is restored and it is determined whether the main system is successfully restored. The corresponding second stage is updated according to whether the main system is successfully restored, and then the process of initializing the firmware over-the-air download is entered; If the second stage is the guardian system upgrade stage, the guardian system is upgraded. After the guardian system upgrade is completed, the guardian system is restored and it is determined whether the guardian system is restored successfully. The corresponding second stage is updated based on whether the guardian system is restored successfully, and then the initialization firmware over-the-air download process is entered.

8. The asymmetric firmware over-the-air upgrade method according to any one of claims 1 to 2, characterized in that: The guard system is a small system with no full functions and only includes the following functions: Communicate with the upgrade server; Or communicate with the host computer; When differential update is not feasible, a complete upgrade package is received from the upgrade server or host computer to perform a full system update.

9. The asymmetric firmware over-the-air upgrade method according to any one of claims 1 to 2, characterized in that: When a new system image is generated using the main system or guard system upgrade differential package and the original system file in the main system area or guard system area of ​​the non-volatile memory, the new system image is temporarily stored in the corresponding system area of ​​the volatile memory; If the storage space of the corresponding system area of ​​the volatile memory is insufficient to store the entire system image, a new system image is generated segment by segment, and the new system image segments stored in the volatile memory are used segment by segment to overwrite the original system segments in the system area of ​​the non-volatile memory, and finally the upgrade of the entire system is completed. The segment size here is defined according to the size of the corresponding system area of ​​the volatile memory, and the minimum segment size is limited by the differential algorithm used.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, the steps in the method according to any one of claims 1 to 9 are implemented.

Citation Information

Patent Citations

  • Differential upgrading method and system for embedded system, and computer readable storage medium

    CN111124464A

  • Firmware upgrading method, embedded device and storage medium

    CN112783535A

  • Encrypted differential upgrading method and device for embedded software, equipment and medium

    CN114253590A