Firmware upgrading method and device for embedded system, equipment and medium

By storing firmware upgrade information in a reserved block device of the storage device and processing it according to the firmware upgrade status, the failure problem of download and deployment in the firmware upgrade process of embedded system is solved, thereby saving network resources and improving upgrade efficiency.

CN120803489APending Publication Date: 2025-10-17ZHONGKE FANGDE SOFTWARE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510818626.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-18
Publication Date
2025-10-17

AI Technical Summary

Technical Problem

During firmware upgrades for embedded systems, the download and deployment phases are prone to failure, leading to wasted network resources and low upgrade efficiency.

Method used

Firmware upgrade information, including firmware upgrade status, download progress, and downloaded data, is stored in the reserved block device of the storage device. The firmware upgrade is processed according to the firmware upgrade status to avoid duplicate downloads or deployment failures.

Benefits of technology

Save network overhead, improve firmware upgrade efficiency, and ensure the integrity and accuracy of upgrade information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120803489A_ABST
    Figure CN120803489A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a firmware upgrading method and device of an embedded system, equipment and a medium. The method comprises the steps that firmware upgrading information is stored in reserved block equipment of storage equipment; the firmware upgrading information comprises a firmware upgrading state, a firmware downloading progress and downloaded data of a firmware upgrading package; in response to a starting instruction or a restarting instruction of the embedded system, reading a firmware upgrading state from the reserved block device; if the firmware upgrading state is a to-be-upgraded state, the length of downloaded data is read from the reserved block device, and processing of a downloading link is continued according to the length of the downloaded data; or, if the firmware upgrade state is a to-be-deployed state, the downloaded data of the firmware upgrade package is read from the reserved block device, and the deployment link is processed according to the downloaded data of the firmware upgrade package. According to the embodiment of the invention, the network overhead of firmware upgrading can be saved, and the firmware upgrading efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] Embodiments of the present application relate to the technical field of computer, in particular, to a firmware upgrading method, device and equipment of embedded system and a medium. BACKGROUND

[0002] An embedded system is a special-purpose computer system embedded in other devices or systems for performing specific functions. As the core software of an embedded system, firmware is responsible for controlling hardware, for example, controlling an image sensor to perform image acquisition. With the continuous progress of technology and the increasing demand for security, the firmware of an embedded system needs to be upgraded regularly to fix vulnerabilities, enhance functions, or improve performance.

[0003] Currently, the firmware upgrading process of an embedded system usually includes the following links: a downloading link for downloading a firmware upgrade package from a server, and a deployment link for deploying the downloaded firmware upgrade package to the embedded system.

[0004] In actual application, both the downloading link and the deployment link may fail. For example, the downloading link may be interrupted due to unstable network signal, power failure, etc.; the deployment link may fail due to power failure, storage medium failure, etc. In the above cases, the firmware upgrading process usually needs to be re-executed. However, downloading the firmware upgrade package from the server requires certain network resources, and if it is frequently re-downloaded, it not only increases network overhead, but also may prolong the upgrading time, affecting the firmware upgrading efficiency. SUMMARY

[0005] Embodiments of the present application provide a firmware upgrading method of an embedded system, which can save network overhead of firmware upgrading and improve firmware upgrading efficiency.

[0006] Correspondingly, embodiments of the present application also provide a firmware upgrading device of an embedded system, an electronic device and a machine readable medium, to ensure the implementation and application of the above method.

[0007] In a first aspect, embodiments of the present application disclose a firmware upgrading method of an embedded system, comprising:

[0008] storing firmware upgrading information in a reserved block device of a storage device; the firmware upgrading information comprises: firmware upgrading state, firmware download progress and downloaded data of a firmware upgrade package; the firmware upgrading state comprises: any one of a to-be-upgraded state, a to-be-deployed state and an upgrading completed state; the firmware download progress comprises: downloaded data length; the to-be-upgraded state represents that the downloading of the firmware upgrade package has not been completed; the to-be-deployed state represents that the downloading of the firmware upgrade package has been completed and the deployment of the downloaded data has not been completed;

[0009] read the firmware upgrade state from the reserved block device in response to a start instruction or a restart instruction of the embedded system;

[0010] perform firmware upgrade processing according to the firmware upgrade state;

[0011] The firmware upgrade processing according to the firmware upgrade state comprises:

[0012] If the firmware upgrade state is the to-be-upgraded state, the firmware upgrade processing module reads the downloaded data length from the reserved block device and continues the processing of a download link according to the downloaded data length; the download link is used to download the firmware upgrade package from a server; or,

[0013] If the firmware upgrade state is the to-be-deployed state, the firmware upgrade processing module reads the downloaded data of the firmware upgrade package from the reserved block device and performs the processing of a deployment link according to the downloaded data of the firmware upgrade package; the deployment link is used to deploy the downloaded data of the firmware upgrade package to the embedded system.

[0014] In a second aspect, the embodiments of the present application disclose a firmware upgrade device of an embedded system, which comprises:

[0015] The storage module is configured to store firmware upgrade information in a reserved block device of a storage device; the firmware upgrade information comprises a firmware upgrade state, a firmware download progress, and downloaded data of a firmware upgrade package; the firmware upgrade state comprises any one of a to-be-upgraded state, a to-be-deployed state, and an upgrade completed state; the firmware download progress comprises a downloaded data length; the to-be-upgraded state indicates that the download of the firmware upgrade package has not been completed; and the to-be-deployed state indicates that the download of the firmware upgrade package has been completed and the deployment of the downloaded data has not been completed.

[0016] The state reading module is configured to read the firmware upgrade state from the reserved block device in response to a start instruction or a restart instruction of the embedded system.

[0017] The firmware upgrade processing module is configured to perform firmware upgrade processing according to the firmware upgrade state.

[0018] The firmware upgrade processing module comprises:

[0019] The first firmware upgrade processing module is configured to read the downloaded data length from the reserved block device if the firmware upgrade state is the to-be-upgraded state, and continue the processing of a download link according to the downloaded data length; the download link is used to download the firmware upgrade package from a server; or,

[0020] The second firmware upgrade processing module is configured to read the downloaded data of the firmware upgrade package from the reserved block device if the firmware upgrade state is the to-be-deployed state, and perform processing of a deployment link according to the downloaded data of the firmware upgrade package; the deployment link is configured to deploy the downloaded data of the firmware upgrade package to the embedded system.

[0021] Optionally, the firmware upgrade information further comprises: a first version number.

[0022] The apparatus further comprises:

[0023] The version number comparison module is configured to compare the first version number stored in the reserved block device with a second version number sent by the server.

[0024] The first state updating module is configured to set the firmware upgrade state to the to-be-upgraded state if the first version number is different from the second version number.

[0025] Optionally, the apparatus further comprises:

[0026] The post-download processing module is configured to update the first version number stored in the reserved block device to the second version number, set the firmware upgrade state to the to-be-deployed state, and trigger a restart instruction of the embedded system after completing the downloading of the firmware upgrade package.

[0027] Optionally, the firmware upgrade package comprises a plurality of data blocks; and the downloaded data length represents a data amount of the data blocks completed to be downloaded.

[0028] The apparatus further comprises:

[0029] The power-off processing module is configured to supply power to the embedded system by using the energy storage element if a set power supply of the embedded system is interrupted within a set time length after completing the downloading of the data blocks, and update the downloaded data length in response to a downloading completion operation of the data blocks.

[0030] Optionally, the firmware upgrade information further comprises: a total data length of the firmware upgrade package; the firmware upgrade package comprises a plurality of data blocks; and the downloaded data length represents a data amount of the data blocks completed to be downloaded.

[0031] The first firmware upgrade processing module comprises:

[0032] The length comparison module is configured to compare the total data length of the firmware upgrade package with the downloaded data length.

[0033] The download connection module is configured to send the downloaded data length to the server if the total data length is different from the downloaded data length, so that the server sends the undownloaded data block according to the downloaded data length; or the download connection module is configured to update the first version number stored in the reserved block device to the second version number, set the firmware upgrade state to the to-be-deployed state, and trigger the restart instruction of the embedded system if the total data length is the same as the downloaded data length.

[0034] Optionally, the firmware upgrade package comprises a plurality of data blocks; and the reserved block device comprises a data area for storing the downloaded data.

[0035] The apparatus further comprises:

[0036] The first data writing module is configured to receive the data of the data block from the server and write the data of the data block at the first address of the data area.

[0037] The overwrite writing module is configured to receive the retransmission data of the data block from the server and write the retransmission data of the data block at the first address of the data area if the data of the data block is incomplete.

[0038] Optionally, the firmware upgrade information further comprises a first check code sent by the server.

[0039] The second firmware upgrade processing module comprises:

[0040] The second data writing module is configured to write the downloaded data to a set address of the firmware program.

[0041] The check code determining module is configured to determine a second check code for the written data corresponding to the set address.

[0042] The check module is configured to check the written data according to a comparison result between the first check code and the second check code.

[0043] The start module is configured to start the firmware program if the check is successful.

[0044] Optionally, the second firmware upgrade processing module further comprises:

[0045] The failure processing module is configured to send an upgrade failure notification to the server, set the firmware upgrade state to the to-be-upgraded state, and update the downloaded data length to zero if the number of check failures exceeds a first threshold value or the number of startup failures of the firmware program exceeds a second threshold value.

[0046] In a third aspect, the embodiments of the present application disclose an electronic device, comprising a memory, a processor, and a computer program stored in the memory and capable of running on the processor, and the processor implements the foregoing method when executing the computer program.

[0047] In a fourth aspect, the embodiments of the present application disclose a machine readable medium, which stores executable codes, and the executable codes, when executed, cause a processor to execute the foregoing method.

[0048] Compared with the prior art, the embodiments of the present application have the following advantages:

[0049] In the technical scheme of the embodiments of the present application, the firmware upgrade information is stored in the reserved block device of the storage device; the firmware upgrade state is read from the reserved block device in response to a start instruction or a restart instruction of the embedded system; and the firmware upgrade processing is performed according to the firmware upgrade state in the firmware upgrade information.

[0050] Firstly, if a failure occurs in the downloading link, the embodiments of the present application read the downloaded data length from the reserved block device according to the to-be-upgraded state corresponding to the firmware upgrade state, and continue the processing of the downloading link according to the downloaded data length; in this case, the embodiments of the present application can avoid repeatedly downloading the data corresponding to the downloaded data length. If a failure occurs in the deployment link, the embodiments of the present application read the downloaded data of the firmware upgrade package from the reserved block device according to the to-be-deployed state corresponding to the firmware upgrade state, and perform the processing of the deployment link according to the downloaded data of the firmware upgrade package. In this case, the embodiments of the present application can save the network overhead and time overhead consumed in the entire downloading link. Therefore, whether a failure occurs in the downloading link or a failure occurs in the deployment link, the embodiments of the present application can avoid starting the firmware upgrade process from the beginning in some cases, and thus the embodiments of the present application can save the network overhead of the firmware upgrade and improve the firmware upgrade efficiency.

[0051] Moreover, the embodiments of the present application store the firmware upgrade information in the reserved block device of the storage device, which can utilize the isolation characteristic of the reserved block device from the conventional storage area, so that the read-write error, data conflict and other problems of the conventional storage area can be effectively avoided, thereby improving the integrity and accuracy of the firmware upgrade information. BRIEF DESCRIPTION OF DRAWINGS

[0052] Figure 1 is a step flowchart of a firmware upgrade method of an embedded system of an embodiment of the present application;

[0053] Figure 2 is a step flowchart of a firmware upgrade method of an embedded system of an embodiment of the present application;

[0054] Figure 3is a step flow diagram of a firmware upgrade method of an embedded system according to an embodiment of the present application;

[0055] Figure 4 is a step flow diagram of a firmware upgrade method of an embedded system according to an embodiment of the present application;

[0056] Figure 5 is a step flow diagram of a firmware upgrade method of an embedded system according to an embodiment of the present application;

[0057] Figure 6 is a structural diagram of a firmware upgrade device of an embedded system according to an embodiment of the present application;

[0058] Figure 7 is a structural diagram of an electronic device 1100 according to an embodiment of the present application. DETAILED DESCRIPTION

[0059] In order to make the above objectives, features and advantages of the present application more apparent, more comprehensible and more understandable, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0060] In the embodiments of the present application, the embedded system is an application-centered and computer technology-based special-purpose computer system with customizable software and hardware, which meets the strict requirements of application systems on functions, reliability, cost, size and power consumption. The embedded device is a physical hardware product containing the embedded system.

[0061] Smart home devices, industrial robot controllers and car recorders are all embedded devices, which are the specific embodiment of the embedded system in practical applications.

[0062] The firmware is a microcode or program module that solidifies the running logic in the embedded device, and its essence is a solidified program stored in a non-volatile memory (such as a flash memory). The hardware in the embedded device usually relies on the firmware to realize the underlying communication, data processing and driving control.

[0063] Taking the image sensor in the car recorder as an example, the firmware thereof usually needs to complete the initialization of the image sensor (such as configuring the pixel format and exposure parameters), the solidification of the data acquisition protocol analysis and preprocessing algorithm (such as denoising and white balance correction). After the car recorder is started, the firmware program will be loaded first and take control of the core hardware such as the image sensor, drive the image sensor to work according to the preset parameters through the solidified logic instructions, and at the same time, transmit the collected raw image data to the main control chip through the built-in compression algorithm of the firmware, thereby realizing the stability of the entire shooting process.

[0064] The firmware program is a specific implementation code of the firmware in a specific application scenario. The firmware program can be developed based on the functional requirements of the firmware, and is developed according to the hardware and system environment. The firmware program specifically includes specific instructions and algorithms for controlling hardware functions.

[0065] At present, the firmware upgrade process of the embedded system usually includes a download link and a deployment link. However, in actual application, the download link and the deployment link can both fail. For example, the download link can be interrupted due to unstable network signal, power failure, etc.; the deployment link can fail due to power failure, storage medium failure, etc. In the above cases, it is usually necessary to start the firmware upgrade process from the beginning. However, downloading the firmware upgrade package from the server requires a certain amount of network resources, and if it is frequently re-downloaded, it not only increases the network overhead, but also can prolong the upgrade time, affecting the firmware upgrade efficiency.

[0066] In view of the technical problems of the current firmware upgrade method that the network overhead is large and the firmware upgrade efficiency is low, the embodiments of the present application provide a firmware upgrade method of an embedded system, which specifically includes: storing firmware upgrade information in a reserved block device of a storage device; the firmware upgrade information specifically includes: firmware upgrade state, firmware download progress and downloaded data of a firmware upgrade package; the firmware upgrade state specifically includes: any one of a to-be-upgraded state, a to-be-deployed state and an upgrade completion state; the firmware download progress includes: downloaded data length; in response to a start instruction or a restart instruction of the embedded system, reading the firmware upgrade state from the reserved block device; and performing firmware upgrade processing according to the firmware upgrade state.

[0067] The firmware upgrade processing according to the firmware upgrade state specifically includes:

[0068] If the firmware upgrade state is the to-be-upgraded state, the downloaded data length is read from the reserved block device, and the processing of the download link is continued according to the downloaded data length; the download link is used to download the firmware upgrade package from the server; or, if the firmware upgrade state is the to-be-deployed state, the downloaded data of the firmware upgrade package is read from the reserved block device, and the processing of the deployment link is performed according to the downloaded data of the firmware upgrade package; the deployment link is used to deploy the downloaded data of the firmware upgrade package to the embedded system.

[0069] The embodiments of the present application store firmware upgrade information in a reserved block device of a storage device; the firmware upgrade information specifically includes: firmware upgrade state, firmware download progress and downloaded data of a firmware upgrade package.

[0070] The reserved block device refers to a storage space for firmware upgrade pre-divided in the storage device. The reserved block device is usually isolated from a general storage area for data storage in the storage device, and is usually not directly accessible by an operating system or a user, but is managed by firmware programs or underlying control systems.

[0071] The embodiment of the present application stores firmware upgrade information in the reserved block device of the storage device, and effectively avoids read / write errors, data conflicts and other problems of the general storage area by using the isolation characteristics of the reserved block device and the general storage area, thereby improving the integrity and accuracy of the firmware upgrade information.

[0072] The firmware upgrade state specifically includes any one of a to-be-upgraded state, a to-be-deployed state, and an upgrade completion state. The to-be-upgraded state can represent that the downloading of the firmware upgrade package has not been completed. The to-be-deployed state can represent that the downloading of the firmware upgrade package has been completed, and the deployment of the downloaded data has not been completed. The upgrade completion state represents the completion of the firmware upgrade.

[0073] The embodiment of the present application can also read the firmware upgrade state from the reserved block device in response to a start instruction or a restart instruction of the embedded system, and perform firmware upgrade processing according to the firmware upgrade state.

[0074] In the case where the firmware upgrade state is the to-be-upgraded state, the firmware upgrade processing reads the downloaded data length from the reserved block device, and continues the processing of the downloading link according to the downloaded data length. In this case, since the repeated downloading of the data corresponding to the downloaded data length can be avoided, the embodiment of the present application can not only greatly save network resources and reduce the network overhead of firmware upgrade, but also greatly reduce the time consumption of firmware upgrade, thereby improving the efficiency of firmware upgrade.

[0075] In the case where the firmware upgrade state is the to-be-deployed state, the firmware upgrade processing reads the downloaded data of the firmware upgrade package from the reserved block device, and performs the processing of the deployment link according to the downloaded data of the firmware upgrade package. In this case, the embodiment of the present application can save the network overhead and time overhead consumed by the entire downloading link, thereby saving the network overhead of firmware upgrade and improving the efficiency of firmware upgrade.

[0076] In summary, if a failure occurs in the downloading link, the embodiment of the present application reads the downloaded data length from the reserved block device according to the to-be-upgraded state corresponding to the firmware upgrading state, and continues the processing of the downloading link according to the downloaded data length. In this case, the embodiment of the present application can avoid repeatedly downloading the data corresponding to the downloaded data length. If a failure occurs in the deployment link, the embodiment of the present application reads the downloaded data of the firmware upgrading package from the reserved block device according to the to-be-deployed state corresponding to the firmware upgrading state, and performs the processing of the deployment link according to the downloaded data of the firmware upgrading package. In this case, the embodiment of the present application can save the network overhead and time overhead consumed in the entire downloading link.

[0077] Therefore, whether a failure occurs in the downloading link or a failure occurs in the deployment link, the embodiment of the present application can avoid starting the firmware upgrading process from the beginning in some cases, and thus the embodiment of the present application can save the network overhead of the firmware upgrading and improve the firmware upgrading efficiency.

[0078] The firmware upgrading method of the embedded system of the embodiment of the present application can be performed by an electronic device. The electronic device can specifically include smart home devices, industrial robot controllers, various types of embedded devices such as a driving recorder, and the like.

[0079] The firmware upgrading method of the embedded system of the embodiment of the present application will be described below through specific embodiments.

[0080] Method Embodiment One

[0081] Reference Figure 1 which shows a step flow diagram of the firmware upgrading method of the embedded system of one embodiment of the present application. The method can specifically include the following steps:

[0082] Step 101, storing firmware upgrading information in a reserved block device of a storage device; the firmware upgrading information specifically includes a firmware upgrading state, a firmware downloading progress, and downloaded data of a firmware upgrading package; the firmware upgrading state specifically includes any one of a to-be-upgraded state, a to-be-deployed state, and an upgrading completion state; the firmware downloading progress specifically includes a downloaded data length; the to-be-upgraded state represents that the downloading of the firmware upgrading package has not been completed; and the to-be-deployed state represents that the downloading of the firmware upgrading package has been completed and the deployment of the downloaded data has not been completed;

[0083] Step 102, reading a firmware upgrading state from the reserved block device in response to a start instruction or a restart instruction of the embedded system;

[0084] Step 103, performing firmware upgrading processing according to the firmware upgrading state;

[0085] In step 103, the firmware upgrade process is performed according to the firmware upgrade state, and specifically includes:

[0086] In step 131, if the firmware upgrade state is the to-be-upgraded state, the downloaded data length is read from the reserved block device, and the process of the downloading link is continued according to the downloaded data length. The downloading link is used to download the firmware upgrade package from the server. Alternatively,

[0087] In step 132, if the firmware upgrade state is the to-be-deployed state, the downloaded data of the firmware upgrade package is read from the reserved block device, and the process of the deployment link is performed according to the downloaded data of the firmware upgrade package. The deployment link is used to deploy the downloaded data of the firmware upgrade package to the embedded system.

[0088] In step 101, the storage device can refer to the storage device of the embedded system. The type of the storage device can include a non-volatile memory such as a flash memory, an EEPROM (Electrically Erasable Programmable Read-Only Memory), and the like. It can be understood that the embodiments of the present application are not limited to a specific storage device.

[0089] In a specific implementation, the process of reserving the reserved block device in the storage device can specifically include: first, determining a reservation mode; second, determining a target capacity; and third, creating a partition of the reserved block device in the storage device according to the storage management interface or storage management instruction provided by the embedded system, and according to the reservation mode and the target capacity.

[0090] The reservation mode is used to represent the position of the reserved block device in the storage device. Common reservation modes include a head reservation, a tail reservation, and a middle set position reservation, etc. The head reservation refers to dividing a part of space at the starting position of the storage device as the reserved block device. The tail reservation refers to dividing at the end position of the storage device. The middle set position reservation refers to dividing at a position determined according to specific rules or requirements in the middle of the storage device.

[0091] In actual application, the target capacity required by the reserved block device can be determined according to the storage space occupied by the firmware upgrade information such as the firmware upgrade package. The embodiments of the present application are not limited to a specific target capacity.

[0092] The storage management interface or storage management instruction can be used to perform partitioning, formatting, and the like of the storage device. Partitioning is a necessary prerequisite for the reserved block device. Formatting is an optional operation after partitioning. If the reserved block device needs to store data immediately subsequently, the partitioning can be formatted, so that the embedded system can recognize and read and write the data of the reserved block device.

[0093] The embodiment of the present application can further divide the reserved block device into multiple areas with different sizes. Different areas are used to store different kinds of firmware upgrade information.

[0094] Referring to Figure 2 which shows a schematic diagram of a reserved block device according to an embodiment of the present application, and specifically includes the following areas:

[0095] a state area, used to store a firmware upgrade state;

[0096] a progress area, used to store a firmware download progress;

[0097] a data area, used to store downloaded data of a firmware upgrade package;

[0098] a version number area, used to store a version number of a firmware program;

[0099] a total length area, used to store a total data length of the firmware upgrade package;

[0100] a check code area, used to store a check code of the firmware upgrade package, which is usually a check code sent by a server.

[0101] The version number area in the reserved block device can be used to store a version number of a firmware program. Before performing firmware upgrade, the version number in the version number area can be a first version number, which can represent the version number of the firmware program before firmware upgrade.

[0102] The embodiment of the present application can determine whether to perform firmware upgrade according to the first version number in the reserved block device, and if yes, update the firmware upgrade state.

[0103] Correspondingly, the method of the embodiment of the present application can further include: comparing the first version number stored in the reserved block device with a second version number sent by a server; and if the first version number is different from the second version number, setting the firmware upgrade state to a to-be-upgraded state.

[0104] In actual application, the server can send the second version number to the client in the case of firmware upgrade demand. The client can compare the first version number stored in the reserved block device with the second version number sent by the server; and if the first version number is different from the second version number, it can be considered that firmware upgrade is needed, and the firmware upgrade state is set to a to-be-upgraded state. It should be noted that before firmware upgrade, the firmware upgrade state can be an upgraded state or an initial state. The initial state can represent that firmware upgrade has not been performed. The upgraded state can represent that firmware upgrade corresponding to the first version number has been completed.

[0105] In an example, in an initial case, the firmware program in the embedded system is a program deployed before factory shipment, and thus the first version number stored in the reserved block device can be version number 001, and the firmware upgrade state stored in the reserved block device can be an initial state. Then, the server can send the second version number (version number 001) to the client in the case that there is a firmware upgrade demand. The client can compare the version number 001 stored in the reserved block device with the version number 002 sent by the server, and thus the firmware upgrade state can be set to a to-be-upgraded state, and the processing of the downloading link is triggered.

[0106] It should be noted that, if the first version number is different from the second version number, the client can send upgrade confirmation information to the server, the upgrade confirmation information being used to represent that the version numbers are inconsistent and firmware upgrade is needed. Or, if the first version number is the same as the second version number, the client can send upgrade cancellation information to the server, the upgrade cancellation information being used to represent that the version numbers are consistent and firmware upgrade is not needed, and in this case, the firmware upgrade process can be ended.

[0107] The server can send the total data length of the firmware upgrade package and the first check code of the firmware upgrade package to the client after receiving the upgrade confirmation information. The client can store the total data length of the firmware upgrade package to the total length area of the reserved block device, and can also store the first check code of the firmware upgrade package to the first check code area of the reserved block device.

[0108] In the embodiment of the application, the first check code is used to check the integrity of the firmware upgrade package. In a specific implementation, the first check code of the firmware upgrade package can include: a first check code corresponding to the entire firmware upgrade package, or a first check code corresponding to a data block in the firmware upgrade package. The type of the first check code of the firmware upgrade package can include: a hash type or a CRC (Cyclic Redundancy Check) type, etc.

[0109] The CRC check is a data transmission error detection function, which generates a check value by polynomial division operation on data.

[0110] The check code of the hash type is used to convert input data of any length into a fixed-length hash value through a specific hash algorithm, and the hash value has uniqueness and irreversibility, and is used to verify data integrity. If the data is tampered with, the hash value will change.

[0111] The firmware upgrade package specifically refers to a software package used to update the firmware program, which usually includes the updated firmware program file and related auxiliary files (such as configuration files, etc.).

[0112] The total data length of the firmware upgrade package specifically refers to the data amount size contained in the entire firmware upgrade package, and the unit is usually byte (Byte).

[0113] Assuming that the firmware upgrade package includes a plurality of data blocks, in the downloading link, the client of the firmware program can receive the data blocks from the server in ascending order of the numbers of the data blocks. After receiving the current data block, integrity check of the current data block can be performed, if the check passes, the next data block can be received. If the check does not pass, retransmission data of the current data block can be received from the server.

[0114] It should be noted that the embodiment of the present application can receive data of the data block from the server and write the data of the data block at the first address of the data area. The first address can have a corresponding relationship with the number of the data block, in other words, the numbers of different data blocks can correspond to different first addresses. Specifically, the embodiment of the present application can write the address of the data block in the data area in ascending order of the numbers of the data blocks, thereby different data blocks have different first addresses in the data area.

[0115] It should be noted that in the case that the data of the data block is incomplete, retransmission data of the data block can be received from the server and written at the first address of the data area. In this case, the retransmission data of the data block can play a covering role on the original data of the data block.

[0116] Through the above technical means of receiving the data block from the server in ascending order of the numbers of the data blocks and writing the retransmission data of the data block at the first address of the data area, the downloaded data of the firmware upgrade package can be stored in the data area. Moreover, the downloaded data of the data area has real-time, that is, the downloaded data of the data area can be updated with the update of the downloading progress.

[0117] The firmware downloading progress can include the downloaded data length. The downloaded data length can represent the data amount occupied by the data block completed downloading. The data block completed downloading can refer to the data block passed the integrity check. In the firmware upgrade process of one version number, the initial value of the downloaded data length can be zero, and in the case that the data block completed downloading is detected, the data length of the data block completed downloading can be added to the initial value of the downloaded data length to obtain the downloaded data length with real-time. In actual application, the data length of the data block can be provided by the server. Usually, the data lengths of different data blocks can be the same. Of course, the embodiment of the present application does not limit the specific data length of the data block.

[0118] The firmware download progress can further include a target address corresponding to the downloaded data of the firmware upgrade package, and the target address is specifically an address of a first data block in the downloaded data of the firmware upgrade package. In this way, in the deployment link, the downloaded data of the firmware upgrade package can be read from the reserved block device according to the target address.

[0119] After the downloading of the firmware upgrade package is completed, the first version number stored in the reserved block device can be updated to the second version number, the firmware upgrade state is set to the to-be-deployed state, and a restart instruction of the embedded system is triggered. In the deployment link, the downloaded data of the firmware upgrade package is written into the set address of the firmware program, and the firmware program is started after the writing is completed.

[0120] In actual application, the downloading link and the deployment link can both fail. For example, the downloading link can be interrupted due to unstable network signal, power failure, and the like; and the deployment link can fail due to power failure, storage medium failure, and the like. In the case that the downloading link or the deployment link fails, a start instruction or a restart instruction of the embedded system can be triggered, and therefore, step 102 can be performed.

[0121] In specific implementation, the firmware upgrade package specifically includes a plurality of data blocks, and the downloaded data length represents a data amount occupied by the completed data block. It should be noted that within a set time length after the downloading of the data block is completed, if the set power supply of the embedded system is interrupted, the energy storage element is used to supply power to the embedded system, and the downloaded data length is updated in response to the downloading completion operation of the data block.

[0122] Within the set time length after the downloading of the data block is completed, if the set power supply of the embedded system is interrupted, the energy storage element will play a role to supply power to the embedded system. In this case, the embedded system will update the downloaded data length in response to the downloading completion operation of the data block. Therefore, the embodiment of the present application can update the downloaded data length in the case of sudden power failure.

[0123] The energy storage element can include a super capacitor, or a farad capacitor, or a backup battery, and the like. The super capacitor or the farad capacitor can release electric energy for power supply at the moment of power failure by using the characteristic of storing electric charge. The backup battery can continuously supply power by converting internal chemical energy into electric energy. The above-mentioned energy storage element can automatically switch and provide electric energy to maintain the operation of the embedded system in the case that the main power supply of the embedded system is interrupted.

[0124] The set time length can be determined by a person skilled in the art according to actual application requirements. For example, the set time length can be M seconds, and M is a positive integer.

[0125] The start instruction can be used to start the embedded system from a stop state, initialize system resources, load necessary programs, and the like, so as to enable the embedded system to enter a working state. The restart instruction can first stop the current running of the embedded system, and then perform the start process of the embedded system, which is equivalent to enabling the embedded system to start again, and is generally used to solve problems occurring in running. It can be understood that the specific process of triggering the start instruction or the restart instruction of the embedded system in the case of failure in the downloading link or the deployment link is not limited in the embodiments of the present application.

[0126] Step 102 can be performed by a boot program. The boot program is the first piece of code running when the embedded device starts, and its functions include: initializing hardware, loading an operating system or subsequent programs, and the like. In the embodiments of the present application, the boot program can be used to load the firmware program. Before loading the firmware program, the boot program can read the firmware upgrade state from the reserved block device in response to the start instruction or the restart instruction of the embedded system.

[0127] In step 103, the boot program can perform firmware upgrade processing according to the firmware upgrade state. Step 103 specifically includes step 131 or step 132.

[0128] In the case where the firmware upgrade state is the to-be-upgraded state, the firmware upgrade processing of step 131 reads the downloaded data length from the reserved block device, and continues the processing of the downloading link according to the downloaded data length. In this case, since the repeated downloading of the data corresponding to the downloaded data length can be avoided, the embodiments of the present application not only can greatly save network resources and reduce the network cost of firmware upgrade, but also can greatly reduce the time consumption of firmware upgrade, and thus can improve the efficiency of firmware upgrade.

[0129] In a specific implementation, the process of continuing the processing of the downloading link according to the downloaded data length specifically includes: comparing the total data length of the firmware upgrade package with the downloaded data length; if the total data length is different from the downloaded data length, sending the downloaded data length to the server, so that the server sends the undownloaded data block according to the downloaded data length; or if the total data length is the same as the downloaded data length, updating the first version number stored in the reserved block device to the second version number, setting the firmware upgrade state to the to-be-deployed state, and triggering the restart instruction of the embedded system.

[0130] If the total data length is different from the downloaded data length, it indicates that the downloading of the firmware upgrade package has not been completed, and in this case, the downloaded data length can be sent to the server, so that the server sends the undownloaded data block according to the downloaded data length.

[0131] Suppose the firmware upgrade package specifically contains N data blocks, N is a positive integer, and the data lengths of different data blocks are the same, all of which are unit lengths, then the server can first determine the ratio A of the downloaded data length and the unit length, the ratio A can indicate that the download of the first A data blocks of the N data blocks is completed. In this case, the server can sequentially send the (N-A) data blocks that have not been downloaded.

[0132] If the total data length is the same as the downloaded data length, it means that the download of the firmware upgrade package is completed, in this case, the first version number stored in the reserved block device can be updated to the second version number, the firmware upgrade state is set to the to-be-deployed state, and the restart instruction of the embedded system is triggered to trigger the processing of the deployment link.

[0133] In the case that the firmware upgrade state is the to-be-deployed state, step 132 can read the downloaded data of the firmware upgrade package from the reserved block device, and perform the processing of the deployment link according to the downloaded data of the firmware upgrade package; the deployment link is used to deploy the downloaded data of the firmware upgrade package to the embedded system.

[0134] According to the downloaded data of the firmware upgrade package, the processing of the deployment link is performed, specifically including: writing the downloaded data of the firmware upgrade package into a set address of the firmware program, and starting the firmware program after the writing is completed.

[0135] The set address can refer to a specific storage location allocated for the firmware program in the storage device. The downloaded data of the firmware upgrade package can cover the old version program data stored in the set address, realizing the version iteration of the firmware program. In this way, starting the firmware program after the writing is completed specifically includes: the bootloader reads the downloaded data of the firmware upgrade package from the set address, and loads the downloaded data of the firmware upgrade package into the memory for execution, thereby starting the new version of the firmware program.

[0136] In an optional implementation manner of the present application, the firmware upgrade information can further include: a first check code sent by the server;

[0137] Then, the process that step 132 performs the processing of the deployment link according to the downloaded data of the firmware upgrade package specifically includes: writing the downloaded data into a set address of the firmware program; determining a second check code for the write data corresponding to the set address; verifying the write data according to the comparison result between the first check code and the second check code; if the verification is successful, starting the firmware program. If the start result of the firmware program is start success, the firmware upgrade state is set to the upgrade completion state. In this case, the firmware program can normally run and provide support for the running of the embedded system.

[0138] In a specific implementation, the server can generate a first check code for the complete firmware upgrade package by using a check code generation algorithm, and transmit the first check code and the firmware upgrade package to the client. The bootloader can also generate a second check code for the write data corresponding to the set address by using the check code generation algorithm.

[0139] By comparing the consistency of the first check code and the second check code, it can be determined whether the write data is lost, tampered or transmitted incorrectly due to network fluctuations, storage medium failures, hardware interference and other factors during the download transmission and storage writing process. If the check is successful, the data integrity is guaranteed, and the firmware program can be started.

[0140] It should be noted that the above processing of the deployment link according to the downloaded data of the firmware upgrade package can also include: if the number of check failures exceeds a first threshold value, or the number of startup failures of the firmware program exceeds a second threshold value, sending an upgrade failure notification to the server, setting the firmware upgrade state to a to-be-upgraded state, and updating the downloaded data length to zero. The first threshold value or the second threshold value can be determined by a person skilled in the art according to actual application requirements, for example, the first threshold value or the second threshold value can be a value such as 3.

[0141] The embodiment of the present application quantitatively monitors the number of exceptions in the upgrade process through the threshold value. When the number of failures exceeds the corresponding threshold value, it is determined that there is a persistent fault and the notification mechanism is triggered, which facilitates the server to remotely obtain firmware upgrade failure data to locate the problem (such as firmware upgrade package vulnerability, hardware failure, etc.), and reduces the user's repeated operation cost.

[0142] It should be noted that if the number of check failures does not exceed the first threshold value, the following check process can be re-executed: write the downloaded data to the set address of the firmware program; determine a second check code for the write data corresponding to the set address; and check the write data according to the comparison result between the first check code and the second check code. And again determine whether the check result is a check failure, if so, update the number of check failures.

[0143] If the number of startup failures of the firmware program does not exceed the second threshold value, the firmware program can be restarted. And again determine whether the startup result is a startup failure, if so, update the number of startup failures.

[0144] It should be noted that the embodiment of the present application can carry retry times and error codes and other information in the upgrade failure notification. The error code can be a code set by the server for check failure or startup failure.

[0145] In a case that the number of check failures exceeds the first threshold value or the number of startup failures of the firmware program exceeds the second threshold value, the firmware upgrade state is set as a to-be-upgraded state, and the downloaded data length is updated as zero, which can provide a condition for re-execution of the firmware upgrade process.

[0146] In summary, the firmware upgrade method of the embedded system in the embodiment of the application can avoid starting the firmware upgrade process from the beginning in some cases whether the failure occurs in the downloading link or the deployment link, and thus the embodiment of the application can save the network overhead of the firmware upgrade and improve the firmware upgrade efficiency.

[0147] In addition, the firmware upgrade information is stored in the reserved block device of the storage device, and the isolation characteristic of the reserved block device from the conventional storage area can be utilized, so that the read-write error, data conflict and other problems of the conventional storage area can be effectively avoided, thereby improving the integrity and accuracy of the firmware upgrade information.

[0148] Method embodiment two

[0149] Reference Figure 3 which shows a step flow diagram of a firmware upgrade method of an embedded system according to an embodiment of the application, the method is applied to a client of a firmware program, wherein the client can have read-write permission of a reserved block device, and the method can specifically include the following steps:

[0150] Step 301, receiving an upgrade instruction sent by a server; the upgrade instruction contains a second version number;

[0151] The client can establish a connection with the server based on a wired network or a wireless network.

[0152] Step 302, comparing the first version number stored in the reserved block device with the second version number sent by the server, and if the first version number is different from the second version number, setting the firmware upgrade state as a to-be-upgraded state;

[0153] The first version number can be a version number before firmware upgrade. The firmware upgrade state before update can be an upgrade completion state or an initial state.

[0154] Step 303, receiving a total data length of a firmware upgrade package and a first check code of the firmware upgrade package from the server, and storing the total data length and the first check code to the reserved block device;

[0155] Step 304, receiving data blocks from the server in ascending order of the numbers of the data blocks, and writing data of the data blocks to a first address of the reserved block device;

[0156] Step 305, after receiving the data block, integrity check of the data block is performed, if the check fails, retransmission data of the data block is received from the server, and the retransmission data of the data block is written in the first address;

[0157] Step 306, in the case of detecting the completed downloaded data block, the downloaded data length is updated to obtain the downloaded data length with real-time performance;

[0158] Step 307, the target address corresponding to the downloaded data of the firmware upgrade package is stored in the reserved block device, and the target address is specifically the address of the first data block in the downloaded data of the firmware upgrade package;

[0159] Step 308, within a set time length after the completion of the data block download, if the set power supply of the embedded system is interrupted, the energy storage element is used to supply power to the embedded system, and the downloaded data length is updated in response to the download completion operation of the data block.

[0160] In the embodiment of the application, the client of the firmware program can obtain the total data length, the first check code, the downloaded data, the target address corresponding to the downloaded data, the downloaded data length and other firmware upgrade information of the firmware upgrade package based on the communication between the client and the server, and write the firmware upgrade information into the reserved block device.

[0161] Method embodiment three

[0162] Reference Figure 4 It shows the step flow diagram of the firmware upgrade method of the embedded system according to an embodiment of the application, and the method is applied to the boot program, wherein the boot program can have the read-write permission of the reserved block device, and the method can specifically include the following steps:

[0163] Step 401, in response to the start instruction or the restart instruction of the embedded system, the firmware upgrade state is read from the reserved block device;

[0164] If the firmware upgrade state is the to-be-upgraded state, step 402 is executed, and if the firmware upgrade state is the to-be-deployed state, step 404 is executed;

[0165] Step 402, the downloaded data length is read from the reserved block device, the firmware program is started, and the downloaded data length is sent to the firmware program, so that the client of the firmware program continues the processing of the download link according to the downloaded data length;

[0166] Step 403, after the completion of the download of the firmware upgrade package, the first version number stored in the reserved block device is updated to the second version number, the firmware upgrade state is set to the to-be-deployed state, and the restart instruction of the embedded system is triggered;

[0167] The step 403 can be performed by the client of the firmware program or by the boot program.

[0168] The step 404 comprises reading the downloaded data of the firmware upgrade package from the reserved block device and writing the downloaded data to the set address of the firmware program.

[0169] The step 405 comprises determining a second check code for the writing data corresponding to the set address.

[0170] The step 406 comprises checking the writing data according to the comparison result between the first check code and the second check code, and starting the firmware program if the checking is successful.

[0171] The step 407 comprises judging whether the starting result is successful, and performing the step 408 if the starting result is successful, or performing the step 409 if the starting result is not successful.

[0172] The step 408 comprises setting the firmware upgrade state to the upgrade completion state.

[0173] The step 409 comprises sending an upgrade failure notification to the server if the number of failures of starting the firmware program exceeds the second threshold, setting the firmware upgrade state to the to-be-upgraded state, and updating the length of the downloaded data to zero.

[0174] In summary, the embodiment of the application stores the state update paths corresponding to the to-be-upgraded state, the to-be-deployed state and the upgrade completion state in the reserved block device, and the boot program can identify the interrupt point of the firmware upgrade according to the firmware upgrade state in the reserved block device and automatically perform the corresponding recovery strategy (such as the continuous downloading strategy or the redeployment strategy), so that the automation and standardization of the abnormal processing in the firmware upgrade process can be realized.

[0175] Method embodiment four

[0176] Reference Figure 5 The figure shows the step flow diagram of the firmware upgrade method of the embedded system according to an embodiment of the application, and the method can specifically comprise the following steps:

[0177] The step 501 comprises receiving the upgrade instruction sent by the server by the client, and the upgrade instruction comprises the second version number.

[0178] The step 502 comprises comparing the first version number stored in the reserved block device with the second version number sent by the server by the client, and setting the firmware upgrade state to the to-be-upgraded state if the first version number is different from the second version number.

[0179] The step 503 comprises downloading the firmware upgrade package by the client and storing the firmware upgrade information, such as the total data length of the firmware upgrade package, the first check code, the downloaded data, the target address corresponding to the downloaded data, the length of the downloaded data, etc., to the reserved block device.

[0180] Step 504, the client determines whether an abnormal interruption of the downloading link occurs, if yes, step 505 is executed, otherwise, step 507 is executed;

[0181] Step 505, the client or the boot program triggers a restart instruction of the embedded system;

[0182] Step 506, the boot program reads a firmware upgrade state from the reserved block device in response to the restart instruction;

[0183] If the firmware upgrade state is a to-be-upgraded state, the downloaded data length is read from the reserved block device, the firmware program is started, and step 503 is executed; if the firmware upgrade state is a to-be-deployed state, step 508 is executed; it should be noted that if the firmware upgrade state is an upgrade completed state, the firmware upgrade process can be ended. The boot program can perform subsequent operations, such as starting the firmware program.

[0184] Step 507, after the client completes the downloading of the firmware upgrade package, the first version number stored in the reserved block device is updated to the second version number, the firmware upgrade state is set to the to-be-deployed state, and a restart instruction of the embedded system is triggered;

[0185] It should be noted that before the client updates the first version number stored in the reserved block device to the second version number after completing the downloading of the firmware upgrade package, the integrity of the firmware upgrade package can also be verified, and in the case that the firmware upgrade package is complete, the first version number stored in the reserved block device is updated to the second version number, the firmware upgrade state is set to the to-be-deployed state, and the restart instruction of the embedded system is triggered.

[0186] Step 508, the downloaded data of the firmware upgrade package is read from the reserved block device, and the downloaded data is written to a set address of the firmware program;

[0187] Step 509, a second check code is determined for the written data corresponding to the set address;

[0188] Step 510, the written data is verified according to a comparison result between the first check code and the second check code; if the verification is successful, the firmware program is started;

[0189] Step 511, it is determined whether the starting result is a starting success, if yes, step 512 is executed, otherwise, step 513 is executed;

[0190] Step 512, the firmware upgrade state is set to an upgrade completed state;

[0191] Step 513, if the number of times of the failed start of the firmware program exceeds the second threshold value, sending a failed upgrade notification to the server, setting the firmware upgrade state to a to-be-upgraded state, and updating the downloaded data length to zero.

[0192] In summary, the boot program according to the firmware upgrade state in the reserved block device, identifies the interrupt point of the firmware upgrade, and automatically executes the corresponding recovery strategy (such as the continuous download strategy, the redeployment strategy), so that the automation and standardization of the abnormal processing in the firmware upgrade process can be realized. The above-mentioned recovery strategy can avoid redundant operations in the firmware upgrade process, and improve the efficiency of the firmware upgrade process.

[0193] It should be noted that, for the foregoing method embodiments, in order to simply describe, they are all expressed as a series of action combinations, but those skilled in the art should know that the application is not limited by the action order described, because according to the application, certain steps can be performed in other order or simultaneously. Secondly, those skilled in the art should know that the embodiments described in the specification all belong to preferred embodiments, and the actions involved are not necessarily necessary for the application.

[0194] Based on the description of the above method embodiments, the application also provides corresponding firmware upgrade device embodiments of the embedded system to realize the content described in the above method embodiments.

[0195] Referring to Figure 6 which shows the structure schematic diagram of the firmware upgrade device of the embedded system according to an embodiment of the application, the device specifically includes the following modules:

[0196] The storage module 601 is configured to store firmware upgrade information in the reserved block device of the storage device; the firmware upgrade information includes: a firmware upgrade state, a firmware download progress, and downloaded data of a firmware upgrade package; the firmware upgrade state includes: any one of a to-be-upgraded state, a to-be-deployed state, and an upgrade completed state; the firmware download progress includes: a downloaded data length; the to-be-upgraded state represents that the download of the firmware upgrade package has not been completed; the to-be-deployed state represents that the download of the firmware upgrade package has been completed, and the deployment of the downloaded data has not been completed;

[0197] The state reading module 602 is configured to read the firmware upgrade state from the reserved block device in response to a start instruction or a restart instruction of the embedded system.

[0198] The firmware upgrade processing module 603 is configured to perform firmware upgrade processing according to the firmware upgrade state.

[0199] The firmware upgrade processing module 603 specifically includes:

[0200] The first firmware upgrade processing module 631 is configured to read the downloaded data length from the reserved block device if the firmware upgrade state is the to-be-upgraded state, and perform processing of a download link according to the downloaded data length; the download link is configured to download the firmware upgrade package from the server; or

[0201] The second firmware upgrade processing module 632 is configured to read the downloaded data of the firmware upgrade package from the reserved block device if the firmware upgrade state is the to-be-deployed state, and perform processing of a deployment link according to the downloaded data of the firmware upgrade package; the deployment link is configured to deploy the downloaded data of the firmware upgrade package to the embedded system.

[0202] Optionally, the firmware upgrade information further includes a first version number.

[0203] The apparatus can further include:

[0204] The version number comparison module is configured to compare the first version number stored in the reserved block device with a second version number sent by the server.

[0205] The first state updating module is configured to set the firmware upgrade state to the to-be-upgraded state if the first version number is different from the second version number.

[0206] Optionally, the apparatus can further include:

[0207] The post-download processing module is configured to update the first version number stored in the reserved block device to the second version number, set the firmware upgrade state to the to-be-deployed state, and trigger a restart instruction of the embedded system after completing the download of the firmware upgrade package.

[0208] Optionally, the firmware upgrade package specifically includes a plurality of data blocks; the downloaded data length represents a data amount occupied by a data block that has completed download.

[0209] The apparatus can further include:

[0210] The power-off processing module is configured to supply power to the embedded system by using an energy storage element if a set power supply of the embedded system is interrupted within a set time length after completing the download of the data block, and update the downloaded data length in response to a download completion operation of the data block.

[0211] Optionally, the firmware upgrade information further includes a total data length of the firmware upgrade package; the firmware upgrade package includes a plurality of data blocks; the downloaded data length represents a data amount occupied by a data block that has completed download.

[0212] The first firmware upgrade processing module 631 includes:

[0213] a length comparison module configured to compare a total data length of the firmware upgrade package with a downloaded data length;

[0214] a download continuation module configured to, if the total data length is different from the downloaded data length, send the downloaded data length to the server, so that the server sends the data blocks that have not been downloaded according to the downloaded data length; or, if the total data length is the same as the downloaded data length, update the first version number stored in the reserved block device to the second version number, set the firmware upgrade state to a to-be-deployed state, and trigger a restart instruction of the embedded system.

[0215] Optionally, the firmware upgrade package comprises a plurality of data blocks; and the reserved block device comprises a data area configured to store the downloaded data.

[0216] The apparatus can further comprise:

[0217] a first data writing module configured to receive data of a data block from the server and write the data of the data block at a first address of the data area;

[0218] a cover writing module configured to, if the data of the data block is incomplete, receive retransmission data of the data block from the server and write the retransmission data of the data block at the first address of the data area.

[0219] Optionally, the firmware upgrade information further comprises a first check code sent by the server.

[0220] The second firmware upgrade processing module 632 comprises:

[0221] a second data writing module configured to write the downloaded data to a set address of the firmware program;

[0222] a check code determining module configured to determine a second check code for the written data corresponding to the set address;

[0223] a check module configured to check the written data according to a comparison result between the first check code and the second check code;

[0224] a starting module configured to, if the check is successful, start the firmware program.

[0225] Optionally, the second firmware upgrade processing module further comprises:

[0226] a failure processing module configured to, if a number of times of the check failure exceeds a first threshold value or a number of times of the start failure of the firmware program exceeds a second threshold value, send an upgrade failure notification to the server, set the firmware upgrade state to a to-be-upgraded state, and update the downloaded data length to zero.

[0227] For the above device embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the part of the illustrated method embodiments.

[0228] The embodiments of the present application further provide an electronic device, comprising:

[0229] one or more processors; and

[0230] one or more machine-readable media having instructions stored thereon, that when executed by the one or more processors, cause the electronic device to perform the method described above.

[0231] Figure 7 A structural diagram of an electronic device 1100 is shown, which specifically comprises: one or more processors 1102, a control module (chipset) 1104 coupled to at least one of the processor(s) 1102, a memory 1106 coupled to the control module 1104, a non-volatile memory / storage device 1108 coupled to the control module 1104, one or more input / output devices 1110 coupled to the control module 1104, and a network interface 1112 coupled to the control module 1104.

[0232] The processor 1102 can include one or more single-core or multi-core processors, and the processor 1102 can include any combination of general-purpose processors or special-purpose processors (such as graphics processors, application processors, baseband processors, etc.). In some embodiments, the electronic device 1100 can function as a terminal device, a server (cluster), and the like described in the embodiments of the present application.

[0233] In some embodiments, the electronic device 1100 can include one or more computer-readable media (such as the memory 1106 or the non-volatile memory / storage device 1108) having instructions 1114 and one or more processors 1102 incorporated with the one or more computer-readable media and configured to execute the instructions 1114 to implement modules to perform the actions described in the present disclosure.

[0234] For an embodiment, the control module 1104 can include any appropriate interface controller to provide any appropriate interface to at least one of the processor(s) 1102 and / or any appropriate device or component in communication with the control module 1104.

[0235] The control module 1104 can include a memory controller module to provide an interface to the memory 1106. The memory controller module can be a hardware module, a software module, and / or a firmware module.

[0236] Memory 1106 can be used to load and store data and / or instructions 1114, for example, for electronic device 1100. For one embodiment, memory 1106 can include any suitable volatile memory, such as suitable DRAM (Dynamic Random Access Memory). In some embodiments, memory 1106 can include double data rate type four synchronous dynamic random access memory.

[0237] For one embodiment, control module 1104 can include one or more input / output controllers to provide an interface to non-volatile memory / storage device 1108 and input / output device(s) 1110.

[0238] For example, non-volatile memory / storage device 1108 can be used to store data and / or instructions 1114. Non-volatile memory / storage device 1108 can include any suitable non-volatile memory (e.g., flash memory) and / or can include any suitable non-volatile storage device(s) (e.g., one or more hard disk drives, one or more optical disk drives, and / or one or more digital versatile disk drives).

[0239] Non-volatile memory / storage device 1108 can include a storage resource physically part of a device on which electronic device 1100 is installed or it can be accessible by device 1100 via a network, for example, through input / output device(s) 1110. For example, non-volatile memory / storage device 1108 can be accessed remotely via input / output device(s) 1110.

[0240] The input / output device(s) 1110 can provide an interface between the electronic device 1100 and any other appropriate device, and can include communication components, audio components, sensor components, etc. The network interface 1112 can provide an interface between the electronic device 1100 and one or more networks, and the electronic device 1100 can communicate wirelessly with one or more components of a wireless network according to any of one or more wireless network standards and / or protocols, such as to access a wireless network based on a communication standard, such as WiFi (WIreless Fidelity), 2G (2-Generation wireless telephone technology), 3G (3-Generation wireless telephone technology), 4G (4-Generation wireless telephone technology), 5G (5-Generation wireless telephone technology), etc., or a combination thereof.

[0241] For one embodiment, at least one of the processor(s) 1102 can be packaged together with logic of one or more controllers of the control module 1104. For one embodiment, at least one of the processor(s) 1102 can be packaged together with logic of one or more controllers of the control module 1104 to form a system in a package. For one embodiment, at least one of the processor(s) 1102 can be integrated on the same die with logic of one or more controllers of the control module 1104. For one embodiment, at least one of the processor(s) 1102 can be integrated on the same die with logic of one or more controllers of the control module 1104 to form a system on a chip.

[0242] In various embodiments, the electronic device 1100 can be, but is not limited to, a server, a desktop computing device, or a mobile computing device (e.g., a laptop computing device, a handheld computing device, a touch screen device, a netbook, etc.) or an end device. In various embodiments, the electronic device 1100 can have more or less components, and / or different architectures. For example, in some embodiments, the electronic device 1100 includes one or more cameras, a keyboard, a liquid crystal display screen (including a touch screen display), a non- volatile memory port, multiple antennas, a graphics chip, an application specific integrated circuit, and a speaker.

[0243] The embodiment of the present application provides a machine readable medium, which stores instructions, when executed by one or more processors, causes an electronic device to perform the method described in one or more of the above embodiments.

[0244] Optionally, the machine readable medium can be a non-transitory computer readable storage medium, for example, the non-transitory computer readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk and an optical data storage device, etc.

[0245] Each embodiment in the specification is described in a progressive manner, and each embodiment focuses on the difference from other embodiments, and the same and similar parts of each embodiment can be referred to each other.

[0246] It is easy for those skilled in the art to think that any combination application of each of the above embodiments is feasible, so any combination of the above embodiments is an embodiment of the present application, but due to the limitation of the length, the specification will not be described in detail here. Although the preferred embodiments of the present application have been described, those skilled in the art can make other changes and modifications to the embodiments once they know the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.

[0247] The above provides a detailed introduction to the firmware upgrade method, device, equipment and medium of the embedded system provided by the present application, the principle and implementation mode of the present application are described in this paper, the above embodiment is only used to help understand the method and the core idea of the present application; at the same time, for those skilled in the art, according to the idea of the present application, the specific implementation mode and application range will be changed, and the above is not intended to limit the present application.

Claims

1. A firmware upgrade method for an embedded system, characterized in that: The method comprises: Firmware upgrade information is stored in a reserved block device of a storage device; the firmware upgrade information includes: a firmware upgrade status, a firmware download progress, and downloaded data of a firmware upgrade package; the firmware upgrade status includes: any one of a pending upgrade status, a pending deployment status, and an upgrade completed status; the firmware download progress includes: the length of downloaded data; the pending upgrade status indicates that the download of the firmware upgrade package has not been completed; the pending deployment status indicates that the download of the firmware upgrade package has been completed, but the deployment of the downloaded data has not been completed; In response to a startup instruction or a restart instruction of the embedded system, reading a firmware upgrade status from the reserved block device; Performing firmware upgrade processing according to the firmware upgrade status; The performing of the firmware upgrade process according to the firmware upgrade status includes: If the firmware upgrade state is the pending upgrade state, the downloaded data length is read from the reserved block device, and the download link is continued according to the downloaded data length; the download link is used to download the firmware upgrade package from the server; or, If the firmware upgrade status is the to-be-deployed status, the downloaded data of the firmware upgrade package is read from the reserved block device, and the deployment link is processed according to the downloaded data of the firmware upgrade package; the deployment link is used to deploy the downloaded data of the firmware upgrade package to the embedded system.

2. The method according to claim 1, characterized in that The firmware upgrade information also includes: a first version number; The method further comprises: Comparing the first version number stored in the reserved block device with the second version number sent by the server; If the first version number is different from the second version number, the firmware upgrade state is set to a pending upgrade state.

3. The method according to claim 2, characterized in that The method further comprises: After downloading of the firmware upgrade package is completed, the first version number stored in the reserved block device is updated to the second version number, the firmware upgrade state is set to a pending deployment state, and a restart instruction of the embedded system is triggered.

4. The method according to any one of claims 1 to 3, characterized in that The firmware upgrade package includes: a plurality of data blocks; the downloaded data length represents the amount of data occupied by the downloaded data blocks; The method further comprises: If the power supply of the embedded system is interrupted within a set time after the download of the data block is completed, the embedded system is powered by the energy storage element, and the downloaded data length is updated in response to the download completion operation of the data block.

5. The method according to any one of claims 1 to 3, characterized in that The firmware upgrade information also includes: the total data length of the firmware upgrade package; the firmware upgrade package includes: multiple data blocks; the downloaded data length represents the amount of data occupied by the downloaded data blocks; The processing of continuing the downloading link according to the length of the downloaded data includes: Compare the total data length of the firmware upgrade package with the length of the downloaded data; If the total data length is different from the downloaded data length, the downloaded data length is sent to the server so that the server sends the undownloaded data blocks according to the downloaded data length; or, if the total data length is the same as the downloaded data length, the first version number stored in the reserved block device is updated to the second version number, the firmware upgrade status is set to the pending deployment status, and a restart instruction of the embedded system is triggered.

6. The method according to any one of claims 1 to 3, characterized in that The firmware upgrade package includes: a plurality of data blocks; the reserved block device includes: a data area for storing the downloaded data; The method further comprises: receiving data of a data block from a server, and writing the data of the data block into a first address of the data area; In the case that the data of the data block is incomplete, retransmitted data of the data block is received from the service end, and the retransmitted data of the data block is written into the first address of the data area.

7. The method according to any one of claims 1 to 3, characterized in that The firmware upgrade information also includes: a first verification code sent by the server; The processing of the deployment link according to the downloaded data of the firmware upgrade package includes: Writing the downloaded data into a set address of the firmware program; Determine a second check code for the write data corresponding to the set address; Verifying the written data according to a comparison result between the first verification code and the second verification code; If the verification is successful, the firmware program is started.

8. The method according to claim 7, characterized in that The step of performing the deployment process according to the downloaded data of the firmware upgrade package further includes: If the number of verification failures exceeds a first threshold, or the number of firmware program startup failures exceeds a second threshold, an upgrade failure notification is sent to the server, the firmware upgrade state is set to a pending upgrade state, and the downloaded data length is updated to zero.

9. A firmware upgrade device for an embedded system, characterized in that: The device comprises: A storage module is configured to store firmware upgrade information in a reserved block device of a storage device; the firmware upgrade information includes: a firmware upgrade status, a firmware download progress, and downloaded data of a firmware upgrade package; the firmware upgrade status includes: any one of a pending upgrade status, a pending deployment status, and an upgrade completed status; the firmware download progress includes: a length of downloaded data; the pending upgrade status indicates that the download of the firmware upgrade package has not been completed; the pending deployment status indicates that the download of the firmware upgrade package has been completed, but the deployment of the downloaded data has not been completed; A status reading module, configured to read the firmware upgrade status from the reserved block device in response to a startup instruction or a restart instruction of the embedded system; A firmware upgrade processing module, configured to perform firmware upgrade processing according to the firmware upgrade status; The firmware upgrade processing module includes: The first firmware upgrade processing module is configured to read the downloaded data length from the reserved block device if the firmware upgrade state is a pending upgrade state, and continue processing the download link according to the downloaded data length; the download link is configured to download the firmware upgrade package from the server; or The second firmware upgrade processing module is used to read the downloaded data of the firmware upgrade package from the reserved block device if the firmware upgrade status is a to-be-deployed status, and perform a deployment process based on the downloaded data of the firmware upgrade package; the deployment process is used to deploy the downloaded data of the firmware upgrade package to the embedded system.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the method according to any one of claims 1 to 8 is implemented.

11. A machine-readable medium having executable codes stored thereon, which, when executed, causes a processor to perform the method according to any one of claims 1 to 8.