Firmware upgrade method, device and apparatus, and storage medium
By using blocking mode to read the first N-1 packet during firmware upgrade and switching to non-blocking mode to read the last packet, the lag problem during firmware upgrade is solved, the upgrade efficiency and accuracy are improved, and the user experience is improved.
Patent Information
- Application Number
- PCT/CN2024/140409
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-01-26
- Filing Date
- 2024-12-18
- Publication Date
- 2025-07-31
AI Technical Summary
There are lag problems during the existing firmware upgrade process, which affects the user experience.
Use blocking mode to read the first N-1 packet of the firmware upgrade file, and then switch to non-blocking mode to read the last packet to ensure data integrity and accuracy.
Improves the efficiency and accuracy of firmware upgrades and improves user experience.
Smart Images

Figure CN2024140409_31072025_PF_FP_ABST
Abstract
Description
Firmware upgrade method, device, storage medium and apparatus Technical Field
[0001] The present invention relates to the field of firmware upgrade technology, and in particular to a firmware upgrade method, device, storage medium and apparatus. Background Art
[0002] IoT technology has been widely used in the field of pet appliances and has led to technological innovation in this field. However, the increasing number of business scenarios has also brought new technical challenges. For example, when pet appliances need to add or optimize functions, the system software needs to be upgraded. During the firmware upgrade process, OTA (Over-The-Air) is a common method for transmitting firmware update data to the device via a wireless network. With existing OTA firmware upgrades, users often encounter issues with the accuracy and timeliness of OTA upgrades. The accuracy and timeliness of OTA upgrades are important factors affecting the user experience and urgently need to be studied and explored by R&D engineers. Summary of the Invention
[0003] The present invention aims to solve at least one of the technical problems existing in the prior art. To this end, the present invention proposes a firmware upgrade method that can effectively solve the problem of freezing during the firmware upgrade process.
[0004] The present invention further provides a firmware upgrading device.
[0005] The present invention also provides a firmware upgrading device.
[0006] The present invention further provides a storage medium.
[0007] A firmware upgrade method according to an embodiment of the first aspect of the present invention is used to upgrade the firmware of a socket-supported device, the method comprising:
[0008] Receive a firmware upgrade file, the firmware upgrade file including multiple upgrade file packages, and define the multiple upgrade file packages as a first upgrade file package, a second upgrade file package, ..., an N-1th upgrade file package, and an Nth upgrade file package in a chronological order of receipt, where N is a positive integer greater than 1;
[0009] Use blocking mode to read the first to N-1 upgrade file packages;
[0010] Determining that the upgrade file package to be received is the Nth upgrade file package;
[0011] Set the read state to non-blocking mode;
[0012] The Nth upgrade file package is read using the non-blocking mode.
[0013] According to the firmware upgrade method of an embodiment of the present invention, any one of the first upgrade file package to the N-1th upgrade file package is read through a blocking read mode, and the Nth upgrade file package is read through a non-blocking read mode, thereby overcoming the disadvantage that socket devices often freeze during firmware upgrades, optimizing the upgrade efficiency during the firmware upgrade process, and bringing a good product experience to users.
[0014] According to the firmware upgrade device of the second aspect embodiment of the present invention, the firmware upgrade device includes a memory, a processor, and a firmware upgrade program stored in the memory and executable on the processor, and the firmware upgrade program is configured to implement the steps of the firmware upgrade method described above.
[0015] According to the storage medium of the embodiment of the third aspect of the present invention, a firmware upgrade program is stored on the storage medium, and when the firmware upgrade program is executed by the processor, the steps of the firmware upgrade method described above are implemented.
[0016] According to a fourth aspect of the present invention, the firmware upgrade device includes:
[0017] A file receiving module, configured to receive a firmware upgrade file, the firmware upgrade file including a plurality of upgrade file packages, wherein the plurality of upgrade file packages are defined as a first upgrade file package, a second upgrade file package, ... an N-1th upgrade file package, and an Nth upgrade file package in a chronological order of receipt, where N is a positive integer greater than 1;
[0018] A blocking reading module, configured to read the first to N-1th upgrade file packages in a blocking mode;
[0019] A file package determining module, configured to determine that the upgrade file package to be received is the Nth upgrade file package;
[0020] Non-blocking setting module, used to set the reading state to non-blocking mode;
[0021] A non-blocking reading module is used to read the Nth upgrade file package using the non-blocking mode.
[0022] Additional aspects and advantages of the present invention will be set forth in part in the description which follows and, in part, will be obvious from the description which follows, or may be learned by practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] 1 is a schematic diagram of the structure of a firmware upgrade device in a hardware operating environment according to an embodiment of the present invention;
[0024] FIG2 is a flow chart of a first embodiment of a firmware upgrade method according to the present invention;
[0025] FIG3 is a flow chart of a second embodiment of a firmware upgrade method according to the present invention;
[0026] FIG4 is a structural block diagram of a first embodiment of a firmware upgrade device according to the present invention;
[0027] FIG5 is a diagram showing the effect evaluation of an embodiment of the firmware upgrade method according to the present invention and other embodiments.
[0028] The purpose, features and advantages of the present invention will be further described with reference to the accompanying drawings and in conjunction with the embodiments. DETAILED DESCRIPTION
[0029] It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0030] 1 , which is a schematic diagram illustrating the structure of a firmware upgrade device in a hardware operating environment according to an embodiment of the present invention.
[0031] As shown in Figure 1, the firmware upgrade device may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display). Optionally, the user interface 1003 may also include a standard wired interface or a wireless interface. The wired interface of the user interface 1003 may be a USB interface in the present invention. The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a wireless fidelity (WI-FI) interface). The memory 1005 may be a high-speed random access memory (RAM) memory or a stable memory (NVM), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0032] Those skilled in the art will appreciate that the structure shown in FIG. 1 does not limit the firmware upgrade device and may include more or fewer components than shown, or a combination of certain components, or a different arrangement of components.
[0033] As shown in FIG. 1 , the memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a firmware upgrade program.
[0034] In the firmware upgrade device shown in Figure 1, the network interface 1004 is mainly used to connect to the background server and communicate data with the background server; the user interface 1003 is mainly used to connect to peripheral devices; the firmware upgrade device calls the firmware upgrade program stored in the memory 1005 through the processor 1001, and executes the firmware upgrade method provided by the embodiment of the present invention.
[0035] Based on the above hardware structure, an embodiment of the firmware upgrade method of the present invention is proposed.
[0036] The technical solution of the present invention is produced as follows: R&D engineers often encounter the problem of jamming when upgrading the firmware of socket-supported devices; this problem particularly affects the user experience. In order to find the cause of the problem, the R&D engineers made various guesses and attempts. For example, it may be various environmental factors in the upgrade, or it may be factors of various technical means in the upgrade. In order to verify these guesses, the R&D engineers conducted various targeted experiments, but none of these experiments and guesses could solve the jamming problem encountered when upgrading the firmware of socket-supported devices. It was not until the R&D engineers tried to read some upgrade data in non-blocking mode that the problem was significantly improved. Therefore, the inventor conducted repeated experiments and solution revisions based on the guess, and obtained the method of this patent application, which can effectively solve the jamming problem encountered when upgrading the firmware of socket-supported devices.
[0037] To facilitate understanding for those skilled in the art, the inventor has summarized some of the technical solutions he tried and experimented with when solving the problem of upgrading the firmware of socket-supported devices, as shown in Figure 5. It should be noted that Figure 5 does not represent the entire invention process, but rather provides a schematic overview of the results to facilitate understanding for those skilled in the art. The inventor's actual research process was not as neat and orderly as that presented in Figure 5. As shown in Figure 5, the inventor experimented with at least 20 technical solutions, among which Technical Solution 1 is a common solution in the prior art. The inventor discovered that the technical solution used in Technical Solution 4 can improve the timeliness of the upgrade while ensuring accuracy. Technical Solution 4 even improves the timeliness of the upgrade by approximately 36.95% compared to Technical Solution 1. In the field of firmware upgrade technology, improving the timeliness of firmware upgrades by more than 30% is not easy. The firmware upgrade efficiency of Technical Solution 4 significantly enhances the user experience. In addition, in the experimental attempts at packet reading methods (such as Technical Solutions 1 to Technical Solutions 14), only Technical Solutions 1 and Technical Solutions 4 achieved one of the prerequisites for OTA upgrades (i.e., no data loss). Although the remaining technical solutions reduced the time required for the upgrade, they were definitely technical solutions that could not achieve OTA upgrades due to data loss.
[0038] It should be noted that the upgrade time conclusion in Figure 5 is the average numerical conclusion after multiple experiments on the corresponding technical solutions; while the data loss conclusion is the probabilistic conclusion after multiple experiments on the corresponding technical solutions. That is, Technical Solutions 1 and Technical Solutions 4 have an extremely low probability of data loss, while the other technical solutions have an extremely high probability of data loss.
[0039] 2 , which is a flow chart of a first embodiment of a firmware upgrade method according to the present invention, provides a first embodiment of a firmware upgrade method according to the present invention.
[0040] In a first embodiment, the firmware upgrade method includes the following steps:
[0041] Step S10: Receive a firmware upgrade file, which includes multiple upgrade file packages. The multiple upgrade file packages are defined as the first upgrade file package, the second upgrade file package...the N-1th upgrade file package, the Nth upgrade file package in the order of receipt, where N is a positive integer greater than 1.
[0042] It should be noted that the execution entity of this embodiment can be a computing service device with data processing, network communication and program running functions, such as pet appliances such as pet feeders, pet water dispensers, electric cat litter boxes, etc., or other electronic devices that can realize the above functions.
[0043] It should be understood that during an OTA firmware upgrade of an IoT device, the entire firmware file is often very large. To ensure stability and transmission efficiency during the upgrade process, the entire firmware file is usually split into many smaller upgrade file packages for transmission. Each upgrade file package may include firmware data, verification data, version information, etc.
[0044] Firmware is understood to be software in embedded systems or low-level programs in solid-state storage devices that primarily control the operation and functionality of hardware devices. It can be located in the non-volatile memory of computer systems, smartphones, network equipment, embedded devices, and other electronic devices.
[0045] It should be noted that, unlike operating systems and applications, firmware can be pre-programmed, meaning it is written during the device manufacturing phase and can usually only be updated through a specific update process.
[0046] Step S20: Read the first to N-1th upgrade file packages in blocking mode.
[0047] It is understandable that blocking mode means that the device will not perform other tasks while receiving and processing a file package. When receiving a firmware upgrade file package, using blocking mode can ensure the accuracy of file package reading.
[0048] It should be understood that in order to ensure the upgrade accuracy of the first to N-1th upgrade file packages, a preferred implementation is to use blocking mode to read the first to N-1th upgrade file packages.
[0049] In the solution of this embodiment, before obtaining the last package of upgrade data for firmware upgrade, the firmware upgrade is performed by transmitting all upgrade data packets before the last package in blocking mode. This ensures the secure transmission of all upgrade data packets before the last package and avoids the loss of upgrade data packets during transmission. It will be understood that in blocking mode, data transmission will be suspended until all necessary conditions are met to ensure the integrity of data transmission. Therefore, by using blocking mode to transmit all upgrade data packets before the last package, this embodiment can ensure the smooth progress of the firmware upgrade and avoid potential problems during data transmission, thereby improving the reliability and stability of the system.
[0050] Step S30: Determine whether the upgrade file package to be received is the Nth upgrade file package.
[0051] Step S40: Set the read state to non-blocking mode.
[0052] Step S50: Read the Nth upgrade file package using the non-blocking mode.
[0053] As you can understand, non-blocking mode means that when the device performs an input operation, if no data is available, the socket will immediately return an error or a specific status instead of waiting.
[0054] In an embodiment of the present invention, the first upgrade file package to the N-1th upgrade file package are read in a blocking read mode, and the Nth upgrade file package is read in a non-blocking read mode. This can ensure the accuracy of the upgrade while overcoming the disadvantage that socket devices often freeze during firmware upgrades, thereby bringing a good product experience to users.
[0055] As shown in Figure 5, in the firmware upgrade method that supports socket devices, the technical solution used for reading the first upgrade file package to the N-1 upgrade file package through a blocking read mode and reading the N upgrade file package through a non-blocking read mode not only ensures the accuracy of the upgrade, but also improves the timeliness of the upgrade. Technical Solution 4 even improves the timeliness by about 36.95% based on Technical Solution 1.
[0056] The inventor admits that until now, the reason why the jamming phenomenon occurs in the existing firmware upgrade method for upgrading socket-supported devices has not been found. To be more precise, through experiments and analysis, the inventor still has not found the reason why the last packet in the existing firmware upgrade method for upgrading socket-supported devices has a jamming phenomenon of more than 1 minute. After the inventor obtained the method of the embodiment of the present invention, he reversed the mechanism of the embodiment of the present invention and may get the following explanation: the socket reading mode has a blocking mode and a non-blocking mode. In the non-blocking mode, when performing an input operation (read operation), if no data is available, the socket will immediately return an error or a specific status instead of waiting; the socket in the non-blocking mode will not block the thread or process that calls them, but will return immediately, giving the application a chance to continue execution. The embodiment of the present invention utilizes the characteristics of the non-blocking mode, especially the use of the non-blocking mode in the last upgrade file package, so that when the firmware upgrade completes the last upgrade data packet, the firmware upgrade process will exit in the non-blocking mode, thereby solving the jamming problem during OTA upgrades.
[0057] As shown in Figure 5, if non-blocking mode is used in the upgrade file package before the last package, data loss problem will occur. In other words, the firmware upgrade method of the embodiment of the present invention can improve the timeliness of the upgrade while ensuring the accuracy of the upgrade.
[0058] Those skilled in the art will appreciate that because blocking-mode socket operations automatically block, eliminating the need for additional thread synchronization and locking mechanisms, this simplifies concurrent programming and reduces thread safety issues. When the socket's send buffer is full, the send operation automatically blocks, thereby controlling the send rate and preventing data loss or overflow. This is why conventional firmware upgrades typically use blocking-mode transmission.
[0059] In this way, the embodiment of the present invention first reads the first upgrade file package in blocking mode, then processes the data in the file package in the correct order, and then continues to read and process the second, third, and subsequent upgrade file packages in the same manner until the penultimate upgrade file package. After processing the penultimate upgrade file package, the read mode of the socket is set to non-blocking mode. When the last upgrade file package is read in non-blocking mode, since the device does not have to wait for the transmission of new data, it can complete the upgrade process faster and exit the firmware upgrade program.
[0060] The benefit of this implementation is that it ensures data integrity and correct order when reading and processing most upgrade file packages using blocking mode. It then uses non-blocking mode to minimize transmission and processing latency, improving the efficiency of firmware upgrades.
[0061] Among them, before obtaining the last package of upgrade data for firmware upgrade, the program code for setting the socket reading mode to non-blocking mode is as follows:
[0062] / *Set non-blocking mode* /
[0063] Int flags=fcntl(socket, F_GETFL, θ);
[0064] flags I = 0_NONBLOCK;
[0065] fcntl(socket, F_GETFL, flags);
[0066] The present embodiment discloses a firmware upgrade method, the method comprising: receiving a firmware upgrade file, the firmware upgrade file comprising a plurality of upgrade file packages, defining the plurality of upgrade file packages as a first upgrade file package, a second upgrade file package...the N-1th upgrade file package, the Nth upgrade file package in the order of time of receipt, where N is a positive integer greater than 1; using a blocking mode to read the first upgrade file package to the N-1th upgrade file package; determining that the upgrade file package to be received is the Nth upgrade file package; setting the read state to a non-blocking mode; and using a non-blocking mode to read the Nth upgrade file package. The firmware upgrade method according to an embodiment of the present invention reads the first upgrade file package to the N-1th upgrade file package in a blocking read mode, and reads the Nth upgrade file package in a non-blocking read mode, thereby overcoming the disadvantage that socket devices often freeze during firmware upgrades, optimizing the upgrade efficiency during the firmware upgrade process, and providing users with a good product experience.
[0067] 3 , which is a flow chart of a second embodiment of a firmware upgrade method according to the present invention, the second embodiment of the firmware upgrade method according to the present invention is proposed based on the first embodiment shown in FIG. 2 .
[0068] In the second embodiment, step S30 includes:
[0069] Step S301: Obtain the length of the unreceived upgrade file package.
[0070] Step S302: Determine that the length of the unreceived upgrade file package is less than or equal to a preset length, and then determine that the upgrade file package to be received is the Nth upgrade file package.
[0071] It should be noted that the device can obtain the data length of the unreceived upgrade file package by communicating with the server or obtaining it from the upgrade file package's metadata, such as by comparing the length of the unreceived upgrade file package with a preset length. The preset length is a fixed value determined according to the packet subpackaging strategy, such as the length of a single upgrade file package. If the length of the unreceived upgrade file package is less than or equal to the preset length, the upgrade file package to be received can be determined to be the Nth upgrade file package.
[0072] Furthermore, in this embodiment, step S301 specifically includes:
[0073] Get the total length of the received upgrade file package.
[0074] The length of the unreceived upgrade file package is obtained according to the length of the firmware upgrade file and the total length.
[0075] It's important to note that the device accumulates the length of each received update file package to obtain a total length. This total length represents the sum of the lengths of all update file packages successfully received and stored on the device to date. The total length of the firmware update file is known, representing the entire update package size. The total received length is calculated in the previous step. Subtracting the total received length from the total firmware update file length yields the length of the unreceived update file packages.
[0076] Determining that the upgrade file package to be received is the Nth upgrade file package, in this embodiment, step S30 may further include:
[0077] Obtaining the location tag of the upgrade file package;
[0078] According to the location tag, it is determined that the upgrade file package to be received is the Nth upgrade file package.
[0079] It should be noted that the location tag can be metadata within the update file package, providing information about the order of the package within all update data. This tag can take the form of a sequence number, segment number, offset, or other information. Once the location tag is obtained, the update process's control logic can interpret this information to identify the package number of this particular file package. For example, if the location tag is a sequence number, then the sequence number directly indicates its order; if it is an offset, then the sequence number can be determined through additional calculation.
[0080] Furthermore, before step S30, the method further includes:
[0081] Step S01: Obtain target firmware information.
[0082] Step S02: determining that the target firmware information is information for starting a firmware upgrade, and then executing the step of obtaining the firmware upgrade progress.
[0083] It should be noted that the target firmware information may include the firmware's size, version, manufacturer information, compatibility data, and more. The device can analyze the received firmware information to determine whether it triggers a firmware upgrade. For example, it can check whether the new firmware is newer than the existing firmware or whether an upgrade request has been made. If the firmware information indicates that the upgrade process needs to begin or continue, the device will obtain the current upgrade progress. This can be done in various ways, such as checking the record of received firmware packages and verifying the integrity and continuity of the firmware packages on the device.
[0084] Furthermore, before step S30, the method further includes:
[0085] Step S03: Obtain firmware upgrade progress.
[0086] Step S04: judging that the upgrade file package to be received is the Nth upgrade file package according to the firmware upgrade progress and the length of the unreceived upgrade file package.
[0087] In order to accurately execute the operation of reading the Nth upgrade file package through the non-blocking read mode, the firmware upgrade progress and the length of the unreceived upgrade file package can be comprehensively utilized to determine whether the upgrade file package to be received is the Nth upgrade file package. First, the firmware upgrade progress can be determined based on the number or percentage of upgrade file packages that have been received and processed; second, the length of the unreceived upgrade file package refers to the amount of upgrade data that has not yet been transmitted to the device or system during the firmware upgrade process. For example, when the firmware upgrade progress is 99% and the length of the unreceived upgrade file package is less than a preset length, the upgrade file package to be received is determined to be the Nth upgrade file package; if the firmware upgrade progress is less than 99%, or the length of the unreceived upgrade file package is greater than the preset length, the upgrade file package to be received is determined to be not the Nth upgrade file package. This embodiment comprehensively utilizes the firmware upgrade progress and the length of the unreceived upgrade file package to more accurately determine that the upgrade file package to be received is the Nth upgrade file package and perform corresponding actions in the non-blocking read mode.
[0088] At the same time, those skilled in the art will appreciate that in order to accurately execute the operation of reading the Nth upgrade file package through the non-blocking read mode, the location tag and the length of the unreceived upgrade file package may be comprehensively utilized to determine whether the upgrade file package to be received is the Nth upgrade file package; or, the location tag and the firmware upgrade progress may be comprehensively utilized to determine whether the upgrade file package to be received is the Nth upgrade file package.
[0089] In order to more accurately execute the operation of reading the Nth upgrade file package through the non-blocking read mode, the location tag, the firmware upgrade progress and the length of the unreceived upgrade file package can also be used to determine whether the upgrade file package to be received is the Nth upgrade file package.
[0090] In an embodiment of the present invention, the upgrade file package is a hex format file package; or, the upgrade file package is a bin format file package; or, the upgrade file package is an elf format file package.
[0091] In addition, an embodiment of the present invention further provides a storage medium, on which a firmware upgrade program is stored. When the firmware upgrade program is executed by a processor, the steps of the firmware upgrade method described above are implemented.
[0092] In addition, referring to FIG4 , an embodiment of the present invention further provides a firmware upgrade device for upgrading the firmware of a socket-supporting device, the firmware upgrade device comprising:
[0093] A file receiving module 10 is configured to receive a firmware upgrade file, wherein the firmware upgrade file includes multiple upgrade file packages, and the multiple upgrade file packages are defined as a first upgrade file package, a second upgrade file package, ... an N-1th upgrade file package, and an Nth upgrade file package in a chronological order of receipt, where N is a positive integer greater than 1;
[0094] A blocking reading module 20 is configured to read the first to N-1th upgrade file packages in a blocking mode;
[0095] A file package determining module 30, configured to determine that the upgrade file package to be received is the Nth upgrade file package;
[0096] A non-blocking setting module 40 is used to set the reading state to a non-blocking mode;
[0097] The non-blocking reading module 50 is configured to read the Nth upgrade file package using the non-blocking mode.
[0098] This embodiment discloses a firmware upgrade device, comprising: a file receiving module 10 for receiving a firmware upgrade file, wherein the firmware upgrade file includes multiple upgrade file packages, the multiple upgrade file packages being defined as a first upgrade file package, a second upgrade file package, ..., an N-1th upgrade file package, and an Nth upgrade file package in chronological order of receipt, where N is a positive integer greater than 1; a blocking reading module 20 for reading the first to N-1th upgrade file packages using a blocking mode; a file package determination module 30 for determining that the upgrade file package to be received is the Nth upgrade file package; a non-blocking setting module 40 for setting the reading state to a non-blocking mode; and a non-blocking reading module 50 for reading the Nth upgrade file package using the non-blocking mode. This embodiment overcomes the disadvantage of socket-supported devices often experiencing stalls during firmware upgrades by reading the first to N-1th upgrade file packages in a blocking read mode and reading the Nth upgrade file package in a non-blocking read mode, thereby optimizing the upgrade efficiency during the firmware upgrade process and providing users with a better product experience.
[0099] Other embodiments or specific implementations of the firmware upgrade device of the present invention can refer to the above-mentioned method embodiments and will not be repeated here.
[0100] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or system comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or system. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or system comprising the element.
[0101] The serial numbers of the embodiments of the present invention are for descriptive purposes only and do not represent superiority or inferiority of the embodiments. In a unit claim that enumerates several means, several of these means may be embodied by the same item of hardware. The use of the terms first, second, and third, etc., does not denote any order; these terms should be interpreted as designations.
[0102] Through the description of the above embodiments, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, or of course by hardware, but in many cases the former is a better embodiment. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product is stored in a storage medium (such as a read-only memory image (ROM) / random access memory (RAM), a magnetic disk, or an optical disk), and includes a number of instructions for enabling an end-user device (which can be a mobile phone, a computer, a server, an air conditioner, or a network user device, etc.) to execute the methods described in the various embodiments of the present invention.
[0103] The above are only preferred embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention description and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A firmware upgrade method, characterized in that, For upgrading the firmware of a socket - supported device, the method includes: Receiving a firmware upgrade file, where the firmware upgrade file includes multiple upgrade file packages. The multiple upgrade file packages are defined as the first upgrade file package, the second upgrade file package... the (N - 1)th upgrade file package, and the Nth upgrade file package in the order of reception time, where N is a positive integer greater than 1; Reading the first upgrade file package to the (N - 1)th upgrade file package in blocking mode; Determining that the upgrade file package to be received is the Nth upgrade file package; Setting the reading status to non - blocking mode; Reading the Nth upgrade file package in the non - blocking mode.
2. The firmware upgrade method according to claim 1, wherein The step of determining that the upgrade file package to be received is the Nth upgrade file package includes: Obtaining the length of the un - received upgrade file package; Determining that the length of the un - received upgrade file package is less than or equal to a preset length, and then determining that the upgrade file package to be received is the Nth upgrade file package.
3. The firmware upgrade method according to claim 2, wherein, The step of obtaining the length of the un - received upgrade file package includes: Obtaining the total length of the received upgrade file packages; Obtaining the length of the un - received upgrade file package according to the length of the firmware upgrade file and the total length.
4. The firmware upgrade method according to claim 2, wherein Before the step of determining that the upgrade file package to be received is the Nth upgrade file package, the method further includes: Obtaining the firmware upgrade progress; Determining that the upgrade file package to be received is the Nth upgrade file package according to the firmware upgrade progress and the length of the un - received upgrade file package.
5. The firmware upgrade method according to claim 4, wherein Before the step of obtaining the firmware upgrade progress, the method further includes: Obtaining the target firmware information; Determining that the target firmware information is the information for starting the firmware upgrade, and then executing the step of obtaining the firmware upgrade progress.
6. The firmware upgrade method according to any one of claims 1 to 5, characterized in that The step of determining that the upgrade file package to be received is the Nth upgrade file package includes: Obtaining the position label of the upgrade file package; Determining that the upgrade file package to be received is the Nth upgrade file package according to the position label.
7. The firmware upgrade method according to any one of claims 1 to 5, characterized in that The upgrade file package is a hex - format file package, or a bin - format file package, or an elf - format file package.
8. A firmware upgrade device, characterized in that, For upgrading the firmware of a socket - supported device, the device includes: A file receiving module, configured to receive a firmware upgrade file, where the firmware upgrade file includes multiple upgrade file packages. The multiple upgrade file packages are defined as the first upgrade file package, the second upgrade file package... the (N - 1)th upgrade file package, and the Nth upgrade file package in the order of reception time, where N is a positive integer greater than 1; A blocking reading module, configured to read the first upgrade file package to the (N - 1)th upgrade file package in blocking mode; A file package determining module, configured to determine that the upgrade file package to be received is the Nth upgrade file package; A non - blocking setting module, configured to set the reading status to non - blocking mode; A non - blocking reading module, configured to read the Nth upgrade file package in the non - blocking mode.
9. A firmware upgrade device, characterized in that, The device includes: a memory, a processor, and a firmware upgrade program stored on the memory and executable on the processor. The firmware upgrade program is configured to implement the steps of the firmware upgrade method as described in any one of claims 1 to 7.
10. A storage medium, characterized in that, A firmware upgrade program is stored on the storage medium, and when the firmware upgrade program is executed by a processor, the steps of the firmware upgrade method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Hypertext transfer security protocol proxy method, device and equipment and medium
CN110022332A
Message processing method, equipment, storage medium and device
CN116962512A
Vehicle ECU upgrading method, device and equipment based on OTA and medium
CN117376339A
Firmware upgrading method and device, equipment and storage medium
CN117632198A
System upgrading method and device for embedded device under small memory
CN118672635A