CN113238789A - Electronic equipment, firmware upgrading method and device thereof and computer readable storage medium - Google Patents

Electronic equipment, firmware upgrading method and device thereof and computer readable storage medium Download PDF

Info

Publication number
CN113238789A
CN113238789A CN202110584739.1A CN202110584739A CN113238789A CN 113238789 A CN113238789 A CN 113238789A CN 202110584739 A CN202110584739 A CN 202110584739A CN 113238789 A CN113238789 A CN 113238789A
Authority
CN
China
Prior art keywords
firmware
data
upgraded
sub
electronic device
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202110584739.1A
Other languages
Chinese (zh)
Other versions
CN113238789B (en
Inventor
徐超
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wingtech Communication Co Ltd
Original Assignee
Wingtech Communication Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Wingtech Communication Co Ltd filed Critical Wingtech Communication Co Ltd
Priority to CN202110584739.1A priority Critical patent/CN113238789B/en
Publication of CN113238789A publication Critical patent/CN113238789A/en
Application granted granted Critical
Publication of CN113238789B publication Critical patent/CN113238789B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • G06F8/654Updates using techniques specially adapted for alterable solid state memories, e.g. for EEPROM or flash memories
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1448Management of the data involved in backup or backup restore
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The application relates to the field of firmware upgrading, and provides electronic equipment, a firmware upgrading method and device thereof, and a computer readable storage medium. The method comprises the following steps: receiving sub-packet data of firmware to be upgraded; embedding the sub-package data of the firmware to be upgraded into a boot program; and after receiving all the subcontract data of the firmware to be upgraded, executing a boot program to upgrade the firmware. By adopting the method, hardware resources can be saved, and equipment cost can be reduced.

Description

Electronic equipment, firmware upgrading method and device thereof and computer readable storage medium
Technical Field
The present disclosure relates to the field of firmware upgrade technologies, and in particular, to an electronic device, a firmware upgrade method and apparatus thereof, and a computer-readable storage medium.
Background
Along with the development of the internet of things technology, more and more embedded devices have wireless communication functions, such as a smart watch, a smart lamp, an electronic tag and the like, and the user has higher and higher experience requirements on the electronic device, so that the requirement for wireless firmware upgrading becomes more and more urgent.
At present, when an embedded device is upgraded wirelessly, in order to ensure that a system can be recovered when abnormal conditions such as upgrade failure, power failure in midway and the like occur, a switching area is generally allocated in Flash to perform caching and backup of firmware, so as to prevent the upgrade failure from returning to a previous version due to an unexpected condition. However, this solution requires a large hardware resource to cache and backup the firmware, which is costly.
Disclosure of Invention
In view of the above, it is desirable to provide an electronic device, a firmware upgrading method and apparatus thereof, and a computer-readable storage medium, which can reduce costs and reduce overhead.
The embodiment of the application provides a firmware upgrading method, which is applied to an electronic device, wherein the electronic device comprises a memory, the memory stores a boot program, and the method comprises the following steps:
receiving sub-packet data of firmware to be upgraded;
embedding the sub-package data of the firmware to be upgraded into the boot program;
and after receiving all the sub-packet data of the firmware to be upgraded, executing the boot program to upgrade the firmware.
The firmware upgrading method provided by the embodiment of the application comprises the steps of receiving sub-packet data of upgraded firmware, embedding the sub-packet data of the to-be-upgraded firmware into a bootstrap program, executing the bootstrap program after receiving all sub-packet data of the to-be-upgraded firmware, upgrading the firmware, compared with the prior art that a switching area is opened up in a memory to cache and backup the firmware, and upgrading is carried out based on an application layer.
In one embodiment, the data format of the packetized data comprises a protocol data unit and a data length of the protocol data unit.
In one embodiment, the data format of the protocol data unit includes a transmission maximum hop count, a packet sequence number, a source address, a destination address, firmware fragment data, and a check value.
In one embodiment, the target address comprises a group address.
In one embodiment, embedding the packetized data of the firmware to be upgraded into the boot program comprises:
analyzing the sub-packet data to judge whether the check value is legal or not;
when the verification value is determined to be legal, judging whether the source address and the target address are legal or not;
embedding the firmware fragment data into the bootstrap when it is determined that the source address and the destination address are legitimate.
In one embodiment, the method further comprises:
and packaging the received firmware fragments, and sending the packaged firmware fragments to the next-level electronic equipment so that the next-level electronic equipment can upgrade the firmware according to the received firmware fragment data.
In one embodiment, encapsulating the received firmware segment includes:
setting a transmission maximum hop number, a data packet sequence number, a source address and a target address according to the data format of the protocol data unit;
carrying out data encryption and integrity filling on the protocol data unit to obtain the protocol data unit;
and according to the format of the subpackage data, packaging the protocol data unit into the subpackage data.
An embodiment of the present application provides an apparatus for upgrading firmware of an electronic device, where the electronic device includes a memory, where a boot program is stored in the memory, and the apparatus includes:
the receiving module is used for receiving the sub-packet data of the firmware to be upgraded;
and the upgrading module is used for embedding the sub-packet data of the firmware to be upgraded into the boot program, and executing the boot program after receiving all the sub-packet data of the firmware to be upgraded so as to upgrade the firmware.
The firmware upgrading device of electronic equipment that this application embodiment provided, receive the subcontract data of upgrading firmware through receiving module, the subcontract data embedding of waiting to upgrade the firmware to the bootstrap program through the upgrading module, and after receiving the subcontract data of whole firmware of waiting to upgrade, carry out the bootstrap program, in order to upgrade the firmware, compare and open up the switching zone in the memory and carry out the buffer memory and the backup of firmware in traditional art, and upgrade based on the application layer, this application upgrades based on the bootstrap program with subcontract data embedding in the bootstrap program, need not to open up the switching zone, can save hardware resources, and then reduce equipment cost.
An embodiment of the present application provides an electronic device, which includes a memory and a processor, where the memory stores a computer program, and the processor implements the steps of the foregoing firmware upgrading method provided in any embodiment of the present application when executing the computer program.
The electronic equipment that this application embodiment provided, through receiving the subcontracting data of upgrading the firmware, the subcontracting data embedding of the firmware of waiting to upgrade to the bootstrap, and after receiving the subcontracting data of whole firmware of waiting to upgrade, carry out the bootstrap, in order to upgrade the firmware, compare and open up the switching zone in the memory and carry out the buffer memory and the backup of firmware in traditional art, and upgrade based on the application layer, this application upgrades based on the bootstrap with subcontracting data embedding in the bootstrap, need not to open up the switching zone, hardware resources can be saved, and then reduce equipment cost.
Embodiments of the present application provide a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of the foregoing firmware upgrading method provided in any embodiment of the present application.
The computer-readable storage medium provided by the embodiment of the application, by receiving the subcontract data of the upgraded firmware, the subcontract data of the firmware to be upgraded is embedded into the bootstrap program, and after receiving all the subcontract data of the firmware to be upgraded, the bootstrap program is executed to upgrade the firmware.
Drawings
FIG. 1 is a diagram illustrating an exemplary implementation of a firmware upgrade method;
FIG. 2 is a flowchart illustrating a firmware upgrade method according to an embodiment;
FIG. 3 is a diagram illustrating a scenario of firmware fragments received by various electronic devices at a certain time in one embodiment;
FIG. 4 is a diagram illustrating a data structure of packetized data in one embodiment;
FIG. 5 is a diagram illustrating a data structure of a protocol data unit in one embodiment;
FIG. 6 is a flow diagram illustrating embedding of package data into a boot program in one embodiment;
FIG. 7 is a block diagram showing the structure of a firmware upgrading apparatus according to one embodiment;
FIG. 8 is a diagram illustrating the internal architecture of an electronic device in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The firmware upgrading method provided by the application can be applied to the application environment shown in fig. 1. As shown in fig. 1, an intelligent terminal 102 communicates with a plurality of embedded electronic devices 104 to be upgraded via a network. The electronic device 104 includes a memory, which may be a Flash (Flash memory), in which a boot program, i.e., a bootLoader, is stored, where the bootLoader is a section of program that runs before an operating system kernel runs, and may initialize a hardware device and establish a memory space map, so as to bring the software and hardware environment of the system to an appropriate state, so as to prepare a correct environment for finally calling the operating system kernel. The intelligent terminal 102 is configured to divide the firmware to be upgraded into firmware segments, package the firmware segments into sub-package data, and send the sub-package data to the plurality of electronic devices 104. The electronic devices 104 receive the sub-package data of the firmware to be upgraded sent by the intelligent terminal 102, embed the sub-package data of the firmware to be upgraded into the boot program, and execute the boot program after receiving all the sub-package data of the firmware to be upgraded so as to upgrade the firmware. The intelligent terminal 102 may be, but not limited to, various personal computers, notebook computers, smart phones, and tablet computers, and the electronic device 104 may be an electronic device with a wireless communication function or an electronic device without a wireless communication function. When the electronic device 104 is an electronic device without a wireless communication function, firmware upgrade can be performed on a wireless module with a wireless communication function that is externally attached to the electronic device. In this application, wireless communication module can be bluetooth module, WIFI module, 2.4G private wireless communication module etc..
In one embodiment, as shown in FIG. 2, a firmware upgrade method is provided. The embodiment is mainly illustrated by applying the method to the electronic device 104 in fig. 1.
Step 202, receiving the packet data of the firmware to be upgraded.
In this embodiment, the sub-packet data of the firmware to be upgraded is propagated in a network flooding manner. Taking an electronic device as an intelligent lamp as an example, as shown in fig. 1, the intelligent terminal sends the sub-package data of the firmware to be upgraded to the first-stage electronic device, that is, the door lamp and the lamp in the living room, the first-stage electronic device sends the sub-package data to the next-stage electronic device, that is, the door lamp can send the sub-package data to the lamp in the bedroom and the lamp in the bathroom, the lamp in the living room can send the sub-package data to the lamp in the second floor of the bathroom, and the next-stage electronic device transmits the sub-package data downwards. Therefore, the current electronic equipment can receive the sub-package data of the firmware to be upgraded, which is sent by the intelligent terminal, and can also receive the sub-package data sent by the upper-level electronic equipment.
When the intelligent terminal sends the firmware to be upgraded, the firmware to be upgraded is segmented, so that the firmware to be upgraded is divided into a plurality of segments and is transmitted in a segmented mode. And the electronic equipment receives the sub-package data of the firmware to be upgraded, which is sent by the intelligent terminal, through the receiving module. As shown in fig. 3, fig. 3 is a schematic diagram of firmware fragment distribution at the same time. At the same time, the device nodes with different hop counts acquire the data of different firmware fragments at the same time. The hop count is the number of routers from the source end to the destination end. In this embodiment, the source end is an intelligent terminal, and the destination end is each electronic device. When packaging the subpackage data, the intelligent terminal stores the addresses of the electronic equipment in the subpackage data and then distributes the subpackage data. Electronic equipment in the same network with the intelligent terminal can receive the subpackage data sent by the intelligent terminal, and the equipment is an equipment node under the first hop count. Taking the system shown in fig. 3 as an example, the door lamp and the lamp in the living room may be in communication connection with the intelligent terminal, so that the door lamp and the lamp in the living room are device nodes under a first hop count; the bedroom lamp and the bathroom lamp can be communicated with the door lamp, the second floor lamp and the bathroom lamp can be communicated with the living room lamp, so that the bedroom lamp, the bathroom lamp and the second floor lamp are equipment nodes under the second hop number, the equipment nodes under the first hop number and the equipment nodes under the second hop number are in the same communication network, and therefore the equipment nodes under the second hop number can receive the subpackage data sent by the equipment nodes under the first hop number. The device node under the third hop count and the device node under the fourth hop count, and so on. After the intelligent terminal divides the firmware into a plurality of fragments, the fragments are sequentially transmitted according to the sequence of the firmware fragments. For example, the intelligent terminal sequentially transmits segment 1, segment 2, segment 3, segment 4 and segment 5, and the device nodes at each hop number sequentially receive segment 1, segment 2, segment 3, segment 4 and segment 5. At the same time, the device nodes with different hop counts acquire the data of different firmware fragments at the same time. For example, as shown in fig. 3, when transmitting the segment 4, at a first time, the intelligent terminal transmits the segment 4 to the device node of the first hop. At the next moment, the device node of the first hop transmits the segment 4 to the device node of the second hop, and at the same time, the intelligent terminal transmits the segment 5 to the device node of the first hop, that is, at the current moment, the device node of the first hop and the device node of the second hop acquire different firmware segment data. By segmenting the firmware segments, when a certain segment of data packet in the firmware has an error, the data packet with the error can be retransmitted only, and the whole segment of data packet does not need to be retransmitted completely, so that the firmware transmission efficiency can be improved.
And step 204, embedding the sub-package data of the firmware to be upgraded into the boot program.
In this embodiment, after receiving the sub-packet data of the firmware to be upgraded based on the preset communication protocol, the electronic device embeds the sub-packet data of the firmware to be upgraded into the boot program.
Specifically, when the electronic device is an electronic device having a communication function, the boot program includes a receiving module and an upgrading module. The receiving module is used for receiving the sub-packet data of the firmware to be upgraded based on a preset communication protocol and sending the sub-packet data of the firmware to be upgraded to the upgrading module. The upgrading module analyzes and verifies the received sub-packet data, and adds the analyzed sub-packet data into a cache pool when the sub-packet data is legal so as to carry out firmware upgrading based on the sub-packet data subsequently.
In this embodiment, the receiving module may receive the packetized data by implementing a bluetooth communication protocol, a WIFI communication protocol, or the like. Because the program code of the receiving module is embedded in the bootstrap program, in order to improve the data processing efficiency, the receiving module can only complete the sending and receiving of the data message without implementing a complete communication protocol. Similarly, since the program code of the upgrade module is also embedded in the boot program, the upgrade module can only complete the related functions of the upgrade, thereby improving the data processing efficiency and saving the space of the memory.
And step 206, after receiving all the subcontract data of the firmware to be upgraded, executing a boot program to upgrade the firmware.
Specifically, the upgrade module performs firmware upgrade after performing integrity check on the received plurality of pieces of packet data. When upgrading, the upgrading module erases the current application firmware and burns the current application to the firmware application area of the memory to update the firmware.
According to the firmware upgrading method of the electronic equipment, the sub-packet data of the firmware to be upgraded is embedded into the bootstrap program after the sub-packet data of the firmware to be upgraded is received, compared with the prior art that a switching area is opened up in a memory to cache and backup the firmware, and upgrading is carried out based on an application layer, the sub-packet data is embedded into the bootstrap program to be upgraded based on the bootstrap program, the switching area does not need to be opened up, hardware resources can be saved, and equipment cost is reduced.
In one embodiment, as shown in fig. 4, the data format of the packetized data comprises a protocol data unit and a data length of the protocol data unit.
Specifically, the data format of the packetized data received by the receiving module is a protocol data unit (PDU data) and the length (length) of the PDU, so that the receiving module can be compatible with various wireless data packet formats. Wherein the length of the protocol data unit of each packet data is different. The length of the subpackage data is read by a receiving module of the upper-level electronic equipment, and the read specific numerical value is filled in a corresponding position according to the format of the subpackage data.
In this embodiment, after receiving the packetized data, the receiving module may transmit the packetized data to the upgrading module in a manner of sharing an address, for example, the receiving module may transmit the packetized data to the upgrading module in a manner of sharing a RAM (random access Memory). When the electronic device is an electronic device without a communication function, the receiving module is located in the plug-in communication module, and the receiving module can transmit the sub-packet data to the upgrading module through an actual physical bus, wherein the physical bus can be a serial port bus. Furthermore, the method provided by the embodiment can be used for electronic equipment with a communication function and also can be used for electronic equipment without the communication function, and the method has high adaptability.
Further, as shown in fig. 5, the format of the protocol data unit includes a maximum transmission hop count (TTL), a packet Sequence number (Sequence number), a Source address (Source address), a Destination address (Destination address), firmware fragment data (otapodu), and a check value (otapodu mic).
For example, if the maximum transmission hop count is 3, after the intelligent terminal transmits the packetized data to the electronic device node under the first hop count, the maximum transmission hop count is decreased by one, that is, the maximum transmission hop count becomes 2. After the electronic device node under the first hop count transmits the packetized data to the electronic device node under the second hop count, the maximum transmission hop count is reduced by one again, that is, the maximum transmission hop count becomes 1. After the electronic device node under the second hop count transmits the packetized data to the electronic device node under the third hop count, the maximum transmission hop count is reduced by one again, that is, the maximum transmission hop count becomes 0, and at this time, the electronic device node under the third hop count does not continue to transmit the packetized data. The packet sequence number is used to identify the packetized data, and each packetized data has a unique packet sequence number, so that the packetized data can be checked by the packet sequence number. The source address is the address of the transmitting device of the packetized data, and the destination address is the address of the receiving device of the packetized data. The firmware fragment data is the specific content of the currently transmitted firmware fragment. The check value is a check value filled after the whole data packet is encrypted. In this embodiment, the AES-CCM encryption algorithm may be used to encrypt the data packet, and the encryption algorithm may also be customized for devices that do not support the AES encryption algorithm.
Further, in this embodiment, the destination address may be a group address, that is, the destination address includes at least two addresses, so that the packetized data may be transmitted in a multicast manner, that is, one packetized data may be simultaneously sent to a plurality of electronic devices to be upgraded, thereby enabling batch upgrading of the firmware.
As shown in fig. 6, in one embodiment, embedding packetized data of the firmware to be upgraded into the boot program includes:
step 601, analyzing the packet data to judge whether the check value is legal.
Specifically, after receiving the packetized data, the upgrade module analyzes the packetized data to obtain a protocol data unit. And the upgrading module detects whether the check value is legal or not through the upgraded secret key, judges that the check value is legal when the check value passes the check, judges that the check value is illegal when the check value does not pass the check, and discards the current packet data.
Step 603, when the check value is determined to be legal, judging whether the source address and the target address are legal.
Specifically, after decryption is successful, the upgrade module reads a source address and a target address of the packetized data and judges whether the source address and the target address are legal or not. If not, discarding the packetized data.
At step 605, when it is determined that the source address and the destination address are legitimate, firmware fragment data is embedded into the boot program.
And reading firmware fragment data of the packetized data when the source address is judged to be legal and the target address comprises the address of the current equipment. After the firmware fragment data is acquired, judging whether the current firmware judgment data exists in the cache pool or not, if so, discarding the data, and if not, adding the firmware fragment data into a cache queue to wait for subsequent upgrading.
In one embodiment, the upgrading module further determines whether the target address is a group address according to the target address after receiving the firmware fragment data, and if the target address is the group address, the upgrading module further encapsulates the received firmware fragment and sends the data to the next-stage electronic device corresponding to the other address in the group address after the encapsulation, so that the next-stage electronic device upgrades the firmware according to the received firmware fragment data.
Specifically, the upgrade module may set a maximum transmission hop count, a packet sequence number, a source address, and a destination address according to a data format of a preset protocol data unit. And writing the firmware fragment data into the corresponding position of the protocol data unit. And then the upgrading module encrypts the protocol data unit, wherein the encryption algorithm can adopt an AES-CCM encryption algorithm to obtain the protocol data unit. And sending the protocol data unit to a receiving module, reading the length of the protocol data unit by the receiving module, and filling the length of the protocol data unit in a corresponding position according to the format of the subpackage data so as to manufacture the subpackage data. And then the receiving module sends out the manufactured sub-packet data so that the next-stage electronic equipment can upgrade the firmware after receiving the sub-packet data.
According to the firmware upgrading method of the electronic equipment, after the sub-packet data of the firmware to be upgraded is received, the sub-packet data of the firmware to be upgraded is embedded into the bootstrap program, compared with the prior art that a switching area is opened up in a memory to cache and backup the firmware, and upgrading is carried out based on an application layer, the sub-packet data is embedded into the bootstrap program to be upgraded based on the bootstrap program, the switching area does not need to be opened up, hardware resources can be saved, and equipment cost is reduced. In addition, by setting the data format of the protocol data unit, the method and the device can send the sub-packet data to a plurality of target electronic devices, realize multicast sending of the sub-packet data, and further realize batch upgrading of the firmware. In addition, the method can be suitable for equipment with a wireless communication function and equipment without the wireless communication function, and is high in adaptability.
It should be understood that although the steps in the flowcharts of fig. 2 and 6 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 2 and 6 may include multiple sub-steps or multiple stages that are not necessarily performed at the same time, but may be performed at different times, and the order of performing the sub-steps or stages is not necessarily sequential, but may be performed alternately or alternately with other steps or at least some of the sub-steps or stages of other steps.
In one embodiment, as shown in fig. 7, there is provided a firmware upgrade apparatus for an electronic device, including: a receiving module 701 and an upgrading module 701, wherein:
a receiving module 701, configured to receive packetized data of a firmware to be upgraded;
the upgrade module 702 is configured to embed the packetized data of the firmware to be upgraded into the boot program, and execute the boot program after receiving all the packetized data of the firmware to be upgraded, so as to upgrade the firmware.
In one embodiment, the data format of the packetized data includes a protocol data unit and a data length of the protocol data unit.
In one embodiment, the data format of the protocol data unit includes a transmission maximum hop count, a packet sequence number, a source address, a destination address, firmware fragment data, and a check value.
In one embodiment, the target address comprises a group address.
In one embodiment, the upgrade module 702 is specifically configured to parse the packetized data to determine whether the check value is legal; when the verification value is determined to be legal, judging whether the source address and the target address are legal or not; upon determining that the source and destination addresses are legitimate, firmware fragment data is embedded into the boot program.
In one embodiment, the upgrade module 702 is further configured to encapsulate the received firmware fragments and send the encapsulated firmware fragments to the next-stage electronic device, so that the next-stage electronic device performs firmware upgrade according to the received firmware fragment data.
In one embodiment, the upgrade module 702 is specifically configured to set a maximum number of hops for transmission, a sequence number of a packet, a source address, and a destination address according to a data format of a protocol data unit; carrying out data encryption and integrity filling on the protocol data unit to obtain the protocol data unit; and according to the format of the subpackage data, packaging the protocol data unit into the subpackage data.
Above-mentioned firmware upgrading device of electronic equipment receives the subcontract data of upgrading firmware through receiving module, the subcontract data embedding of waiting to upgrade the firmware to the bootstrap through the upgrading module, and after receiving the subcontract data of whole firmware of waiting to upgrade, carry out the bootstrap, in order to upgrade the firmware, compare and open up the switching zone in the memory and carry out the buffer memory and the backup of firmware in traditional art, and upgrade based on the application layer, this application upgrades based on the bootstrap with subcontract data embedding in the bootstrap, need not to open up the switching zone, can save hardware resources, and then reduce equipment cost.
For specific definition of the firmware upgrading apparatus of the electronic device, reference may be made to the above definition of the firmware upgrading method of the electronic device, and details are not described here. The modules in the firmware upgrading device can be wholly or partially realized by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent of a processor in the electronic device, or can be stored in a memory in the electronic device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, an electronic device is provided, which may be an intelligent terminal, and the internal structure thereof may be as shown in fig. 8. The electronic device includes a processor, a memory, and a communication interface connected by a system bus. Wherein the processor of the electronic device is configured to provide computing and control capabilities. The memory of the electronic equipment comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The communication interface of the electronic device is used for carrying out wired or wireless communication with an external terminal, and the wireless communication can be realized through WIFI, an operator network, Near Field Communication (NFC) or other technologies. The computer program is executed by a processor to implement a firmware upgrade method.
Those skilled in the art will appreciate that the structure shown in fig. 8 is a block diagram of only a portion of the structure relevant to the present disclosure, and does not constitute a limitation on the electronic device to which the present disclosure may be applied, and that a particular electronic device may include more or less components than those shown, or combine certain components, or have a different arrangement of components.
In one embodiment, the firmware upgrading apparatus provided in the present application may be implemented in a form of a computer program, and the computer program may be run on an electronic device as shown in fig. 8. The memory of the electronic device may store various program modules constituting the firmware upgrading apparatus, such as the receiving module and the upgrading module shown in fig. 7. The computer program constituted by the respective program modules causes the processor to execute the steps in the firmware upgrade method of the embodiments of the present application described in the present specification.
For example, the electronic device shown in fig. 8 may receive packetized data of firmware to be upgraded through a receiving module in the firmware upgrading apparatus shown in fig. 7. The electronic equipment can embed the sub-packet data of the firmware to be upgraded into the boot program through the upgrading module, and execute the boot program after receiving all the sub-packet data of the firmware to be upgraded so as to upgrade the firmware.
In one embodiment, an electronic device is provided, comprising a memory storing a computer program and a processor implementing the following steps when the processor executes the computer program: receiving sub-packet data of firmware to be upgraded; embedding the sub-package data of the firmware to be upgraded into a boot program; and after receiving all the subcontract data of the firmware to be upgraded, executing a boot program to upgrade the firmware.
In one embodiment, the processor, when executing the computer program, further performs the steps of: analyzing the sub-packet data to judge whether the check value is legal or not; when the verification value is determined to be legal, judging whether the source address and the target address are legal or not; upon determining that the source and destination addresses are legitimate, firmware fragment data is embedded into the boot program.
In one embodiment, the processor, when executing the computer program, further performs the steps of: and packaging the received firmware fragments, and sending the packaged firmware fragments to the next-level electronic equipment so that the next-level electronic equipment can upgrade the firmware according to the received firmware fragment data.
In one embodiment, the processor, when executing the computer program, further performs the steps of: setting a transmission maximum hop number, a data packet sequence number, a source address and a target address according to the data format of the protocol data unit; carrying out data encryption and integrity filling on the protocol data unit to obtain the protocol data unit; and according to the format of the subpackage data, packaging the protocol data unit into the subpackage data.
The electronic equipment receives the sub-packet data of the upgraded firmware, embeds the sub-packet data of the upgraded firmware into the bootstrap program, executes the bootstrap program after receiving all the sub-packet data of the upgraded firmware, upgrades the firmware, and compared with the prior art that a switching area is opened up in a memory to cache and backup the firmware and upgrades the firmware based on an application layer, the electronic equipment embeds the sub-packet data into the bootstrap program to upgrade based on the bootstrap program without opening up the switching area, can save hardware resources, and further reduces equipment cost.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of: receiving sub-packet data of firmware to be upgraded; embedding the sub-package data of the firmware to be upgraded into a boot program; and after receiving all the subcontract data of the firmware to be upgraded, executing a boot program to upgrade the firmware.
In one embodiment, the computer program when executed by the processor further performs the steps of: analyzing the sub-packet data to judge whether the check value is legal or not; when the verification value is determined to be legal, judging whether the source address and the target address are legal or not; upon determining that the source and destination addresses are legitimate, firmware fragment data is embedded into the boot program.
In one embodiment, the computer program when executed by the processor further performs the steps of: and packaging the received firmware fragments, and sending the packaged firmware fragments to the next-level electronic equipment so that the next-level electronic equipment can upgrade the firmware according to the received firmware fragment data.
In one embodiment, the computer program when executed by the processor further performs the steps of: setting a transmission maximum hop number, a data packet sequence number, a source address and a target address according to the data format of the protocol data unit; carrying out data encryption and integrity filling on the protocol data unit to obtain the protocol data unit; and according to the format of the subpackage data, packaging the protocol data unit into the subpackage data.
According to the computer readable storage medium, the subcontract data of the firmware to be upgraded is received, the subcontract data of the firmware to be upgraded is embedded into the bootstrap program, and the bootstrap program is executed after all the subcontract data of the firmware to be upgraded are received, so that the firmware is upgraded.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, database, or other medium used in the embodiments provided herein may include at least one of non-volatile and volatile memory. Non-volatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical storage, or the like. Volatile Memory can include Random Access Memory (RAM) or external cache Memory. By way of illustration and not limitation, RAM is available in many forms, such as Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), and the like.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. A method for upgrading firmware of an electronic device, the method being applied to the electronic device, wherein the electronic device includes a memory storing a boot program, and the method comprises:
receiving sub-packet data of firmware to be upgraded;
embedding the sub-package data of the firmware to be upgraded into the boot program;
and after receiving all the sub-packet data of the firmware to be upgraded, executing the boot program to upgrade the firmware.
2. The method of claim 1, wherein the data format of the packetized data comprises a protocol data unit and a data length of the protocol data unit.
3. The method of claim 2, wherein the data format of the pdu comprises a maximum number of hops for transmission, a packet sequence number, a source address, a destination address, firmware fragment data, and a check value.
4. The method of claim 3, wherein the target address comprises a group address.
5. The method of claim 3, wherein embedding packetized data of the firmware to be upgraded into the boot loader comprises:
analyzing the sub-packet data to judge whether the check value is legal or not;
when the verification value is determined to be legal, judging whether the source address and the target address are legal or not;
embedding the firmware fragment data into the bootstrap when it is determined that the source address and the destination address are legitimate.
6. The method of claim 5, further comprising:
and packaging the received firmware fragments, and sending the packaged firmware fragments to the next-level electronic equipment so that the next-level electronic equipment can upgrade the firmware according to the received firmware fragment data.
7. The method of claim 6, wherein encapsulating the received firmware segment comprises:
setting a transmission maximum hop number, a data packet sequence number, a source address and a target address according to the data format of the protocol data unit;
carrying out data encryption and integrity filling on the protocol data unit to obtain the protocol data unit;
and according to the format of the subpackage data, packaging the protocol data unit into the subpackage data.
8. An apparatus for upgrading firmware of an electronic device, the electronic device including a memory storing a boot program, the apparatus comprising:
the receiving module is used for receiving the sub-packet data of the firmware to be upgraded;
and the upgrading module is used for embedding the sub-packet data of the firmware to be upgraded into the boot program, and executing the boot program after receiving all the sub-packet data of the firmware to be upgraded so as to upgrade the firmware.
9. An electronic device comprising a memory and a processor, the memory storing a computer program, wherein the processor implements the steps of the method of any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 7.
CN202110584739.1A 2021-05-27 2021-05-27 Electronic device, firmware upgrading method and device thereof and computer readable storage medium Active CN113238789B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110584739.1A CN113238789B (en) 2021-05-27 2021-05-27 Electronic device, firmware upgrading method and device thereof and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110584739.1A CN113238789B (en) 2021-05-27 2021-05-27 Electronic device, firmware upgrading method and device thereof and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN113238789A true CN113238789A (en) 2021-08-10
CN113238789B CN113238789B (en) 2023-06-27

Family

ID=77139407

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110584739.1A Active CN113238789B (en) 2021-05-27 2021-05-27 Electronic device, firmware upgrading method and device thereof and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN113238789B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114679383A (en) * 2022-03-09 2022-06-28 深圳市洲明科技股份有限公司 Firmware upgrading method, device, equipment, cascade system and storage medium
CN115437674A (en) * 2022-09-28 2022-12-06 杭州华塑科技股份有限公司 Firmware upgrading method, device, medium and electronic equipment
CN115437674B (en) * 2022-09-28 2024-04-30 杭州华塑科技股份有限公司 Firmware upgrading method, device, medium and electronic equipment

Citations (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102412924A (en) * 2010-09-21 2012-04-11 中国电信股份有限公司 Method and device for detecting path maximum transmission unit
US20130117740A1 (en) * 2011-11-07 2013-05-09 Lsis Co., Ltd. Apparatus, system and method for upgrading firmware of energy metering device
CN103514020A (en) * 2013-10-16 2014-01-15 深圳市共进电子股份有限公司 Embedded device batch upgrading method and system
US20160266894A1 (en) * 2015-03-11 2016-09-15 Cavium, Inc. Systems and methods for live upgrade and update of firmware on an embedded networking device
US20160299753A1 (en) * 2015-04-09 2016-10-13 Rex Poway Tseng Firmware upgrading method for bluetooth electronic scales
CN106452928A (en) * 2016-12-14 2017-02-22 邯郸美的制冷设备有限公司 Firmware upgrading method and firmware upgrading apparatus of router, and router
CN106909352A (en) * 2015-12-22 2017-06-30 北京谊安医疗系统股份有限公司 A kind of firmware upgrade method of embedded device
CN107402776A (en) * 2016-05-20 2017-11-28 南京阿波罗机器人科技有限公司 A kind of mobile phone wireless upgrading stm32 singlechip controller firmware methods based on bluetooth 4
CN107579863A (en) * 2017-10-17 2018-01-12 锐捷网络股份有限公司 Terminal OTA upgrade methods, apparatus and system
CN108170457A (en) * 2017-12-27 2018-06-15 上海闻泰电子科技有限公司 Firmware upgrade method, device and VR head-mounted displays
CN109117168A (en) * 2018-08-29 2019-01-01 拓攻(南京)机器人有限公司 Unmanned plane firmware update, device, unmanned plane and storage medium
CN109491688A (en) * 2018-11-16 2019-03-19 珠海云洲智能科技有限公司 The method, apparatus and system of firmware upgrade are carried out to the control equipment of unmanned boat
CN109526030A (en) * 2017-09-18 2019-03-26 华为技术有限公司 Processing method, device and the equipment of message
CN110780909A (en) * 2019-10-14 2020-02-11 武汉虹识技术有限公司 Distributed embedded system upgrading method and device
CN111356982A (en) * 2018-11-30 2020-06-30 深圳市大疆创新科技有限公司 Program processing method, program processing apparatus, and storage medium
CN111510323A (en) * 2020-03-24 2020-08-07 中国科学院上海微系统与信息技术研究所 Firmware upgrading method, device and system for Internet of things equipment and storage medium
US20200257518A1 (en) * 2020-04-24 2020-08-13 Intel Corporation Device firmware update techniques
CN112416408A (en) * 2020-12-08 2021-02-26 金卡智能集团股份有限公司 Firmware upgrading method, device, equipment and computer readable storage medium
CN112631634A (en) * 2021-01-08 2021-04-09 福建众益太阳能科技股份公司 Firmware upgrading method, device, system, equipment and medium for intelligent lamp pole
CN112732310A (en) * 2021-01-22 2021-04-30 深圳市信义科技有限公司 Firmware upgrading method, system, equipment and medium based on embedded boot partition

Patent Citations (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102412924A (en) * 2010-09-21 2012-04-11 中国电信股份有限公司 Method and device for detecting path maximum transmission unit
US20130117740A1 (en) * 2011-11-07 2013-05-09 Lsis Co., Ltd. Apparatus, system and method for upgrading firmware of energy metering device
CN103514020A (en) * 2013-10-16 2014-01-15 深圳市共进电子股份有限公司 Embedded device batch upgrading method and system
US20160266894A1 (en) * 2015-03-11 2016-09-15 Cavium, Inc. Systems and methods for live upgrade and update of firmware on an embedded networking device
US20160299753A1 (en) * 2015-04-09 2016-10-13 Rex Poway Tseng Firmware upgrading method for bluetooth electronic scales
CN106909352A (en) * 2015-12-22 2017-06-30 北京谊安医疗系统股份有限公司 A kind of firmware upgrade method of embedded device
CN107402776A (en) * 2016-05-20 2017-11-28 南京阿波罗机器人科技有限公司 A kind of mobile phone wireless upgrading stm32 singlechip controller firmware methods based on bluetooth 4
CN106452928A (en) * 2016-12-14 2017-02-22 邯郸美的制冷设备有限公司 Firmware upgrading method and firmware upgrading apparatus of router, and router
CN109526030A (en) * 2017-09-18 2019-03-26 华为技术有限公司 Processing method, device and the equipment of message
CN107579863A (en) * 2017-10-17 2018-01-12 锐捷网络股份有限公司 Terminal OTA upgrade methods, apparatus and system
CN108170457A (en) * 2017-12-27 2018-06-15 上海闻泰电子科技有限公司 Firmware upgrade method, device and VR head-mounted displays
CN109117168A (en) * 2018-08-29 2019-01-01 拓攻(南京)机器人有限公司 Unmanned plane firmware update, device, unmanned plane and storage medium
CN109491688A (en) * 2018-11-16 2019-03-19 珠海云洲智能科技有限公司 The method, apparatus and system of firmware upgrade are carried out to the control equipment of unmanned boat
CN111356982A (en) * 2018-11-30 2020-06-30 深圳市大疆创新科技有限公司 Program processing method, program processing apparatus, and storage medium
CN110780909A (en) * 2019-10-14 2020-02-11 武汉虹识技术有限公司 Distributed embedded system upgrading method and device
CN111510323A (en) * 2020-03-24 2020-08-07 中国科学院上海微系统与信息技术研究所 Firmware upgrading method, device and system for Internet of things equipment and storage medium
US20200257518A1 (en) * 2020-04-24 2020-08-13 Intel Corporation Device firmware update techniques
CN112416408A (en) * 2020-12-08 2021-02-26 金卡智能集团股份有限公司 Firmware upgrading method, device, equipment and computer readable storage medium
CN112631634A (en) * 2021-01-08 2021-04-09 福建众益太阳能科技股份公司 Firmware upgrading method, device, system, equipment and medium for intelligent lamp pole
CN112732310A (en) * 2021-01-22 2021-04-30 深圳市信义科技有限公司 Firmware upgrading method, system, equipment and medium based on embedded boot partition

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
许金宇;曹子涛;王冠男;: "IR46智能电能表固件在线升级方案设计", 电测与仪表, no. 1 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114679383A (en) * 2022-03-09 2022-06-28 深圳市洲明科技股份有限公司 Firmware upgrading method, device, equipment, cascade system and storage medium
CN115437674A (en) * 2022-09-28 2022-12-06 杭州华塑科技股份有限公司 Firmware upgrading method, device, medium and electronic equipment
CN115437674B (en) * 2022-09-28 2024-04-30 杭州华塑科技股份有限公司 Firmware upgrading method, device, medium and electronic equipment

Also Published As

Publication number Publication date
CN113238789B (en) 2023-06-27

Similar Documents

Publication Publication Date Title
CN111263352B (en) OTA upgrading method and system of vehicle-mounted equipment, storage medium and vehicle-mounted equipment
JP7371103B2 (en) In-vehicle device upgrade method and related equipment
US20180054693A1 (en) Method for discriminating between unicast device to device(d2d) communication and groupcast d2d communication
CN110471692B (en) Over-the-air upgrading method, device, equipment and storage medium of terminal program
CN111201553B (en) Safety element and related equipment
CN114157649A (en) Reliable data transmission method and device, computer equipment and storage medium
CN110620762A (en) RDMA (remote direct memory Access) -based data transmission method, network card, server and medium
CN112468407A (en) Data subpackage transmission method and device, computer equipment and storage medium
CN113238789B (en) Electronic device, firmware upgrading method and device thereof and computer readable storage medium
CN114363055B (en) Data transmission method and device, computer equipment and storage medium
KR102270143B1 (en) Method and apparatus for controlling communicationfor isolating network
EP3328014A1 (en) Data packet transmission method, apparatus, node device, and system
US20090240925A1 (en) Device, method, and computer program product that process message
CN114915555B (en) Gateway drive communication method, device, equipment and storage medium
CN109905285B (en) Network management method and network equipment
Novak et al. Efficient partial firmware update for IoT devices with lua scripting interface
CN111262837B (en) Data encryption method, data decryption method, system, equipment and medium
CN108365973A (en) Method and apparatus for being transmitted on virtual channel
CN111800773B (en) Bluetooth Mesh node message repetition identification method, system and storage medium
CN111669356B (en) Method for processing network isolation space in batch in IPsec VPN server and IPsec VPN server
CN112448921A (en) Method and device for detecting rear door
EP2584755A1 (en) Method of sending a command to a secure element
US9495548B2 (en) Method for routing a message
CN109450901A (en) The close tunnel establishing method of state, device and equipment
US9767286B2 (en) Electronic module for making a message accessible to a targeted operating system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant