Embedded device firmware updating method, device and system based on P2P (Peer-to-Peer) network
By adopting a P2P network-based firmware update method in embedded devices and using the BT protocol to transmit firmware update files, the problems of batch firmware updates in the prior art are solved, and an efficient and reliable firmware update process is achieved.
Patent Information
- Application Number
- CN202411678027.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-22
- Publication Date
- 2025-03-14
AI Technical Summary
The existing batch firmware update method for embedded devices occupies a high level of computing resources and is prone to packet loss during update data, affecting the normal operation of the device.
The embedded device firmware update method based on P2P network is adopted, instruction interaction is performed through multicast, and firmware update files are transmitted through BT protocol to form a P2P network between the upper computer and the embedded device.
It realizes rapid and reliable batch firmware updates of embedded devices without occupying a large amount of computing resources, improving update efficiency and data transmission accuracy.
Smart Images

Figure CN119621099A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the technical field of device upgrade, and more specifically, to a method, device and system for updating firmware of an embedded device based on a P2P network. Background Art
[0002] Embedded devices have many application scenarios and are widely used in security monitoring, smart home, industrial control, automotive electronics and other fields. Currently, in order to facilitate equipment updates and maintenance, most embedded devices have the function of updating firmware over the network.
[0003] At present, there are two main methods for network update of embedded devices: unicast update and multicast update. The unicast update method is suitable for firmware update of a single embedded device, and the accuracy of firmware file transmission can be effectively guaranteed. However, if unicast update is used for firmware update of large batches of embedded devices, it will take a long time and be inefficient. The multicast update method is only suitable for firmware update of small batches of embedded devices. Due to the limited computing resources of embedded devices, if firmware is updated for a large number of embedded devices through multicast, a large amount of data will be generated in the network. Data processing seriously occupies the computing resources of embedded devices, affecting the normal operation of embedded devices. At the same time, multicast update data is prone to packet loss, and it is difficult to ensure the accuracy of firmware data transmission. Summary of the invention
[0004] In response to the above defects or improvement needs of the prior art, the present application provides a method, device and system for updating firmware of an embedded device based on a P2P network, which aims to solve the technical problems that the existing embedded device batch firmware update method occupies a high amount of computing resources of the embedded device and the update data is easily lost.
[0005] To achieve the above objectives, in a first aspect, the present application provides a method for updating firmware of an embedded device based on a P2P network, which is applied to a host computer, and the method comprises:
[0006] Send multicast status query instructions to other devices in the multicast group;
[0007] Receive multicast information, parse the information to obtain status information of embedded devices, and select embedded devices that need firmware update based on the status information;
[0008] Multicast the firmware update command to other devices in the multicast group. The firmware update command includes the device number that needs the firmware update.
[0009] Upload the firmware update file to the embedded device that needs the firmware update through the BT protocol.
[0010] Preferably, the composition structure of the status query instruction and the firmware update instruction includes: a packet header, a packet length, a device number of the data object, a packet sequence number, a command word, a command attribute data length, a command attribute data, a check code and a packet tail; wherein, the status query instruction and the firmware update instruction are distinguished by the command word; and other multicast information is distinguished by the packet header and the packet tail.
[0011] Preferably, the host computer and all embedded devices in the multicast group form a P2P network.
[0012] In a second aspect, the present application provides a method for updating firmware of an embedded device based on a P2P network, which is applied to an embedded device, and the method comprises:
[0013] Receive multicast information and parse status query instructions or firmware update instructions from it;
[0014] If the status query command is parsed, the device will multicast its status information to other devices in the multicast group;
[0015] If the firmware update instruction containing the device number is parsed, the firmware update file is downloaded from the host computer and other embedded devices through the BT protocol;
[0016] Upload the firmware update file to other embedded devices that need firmware update via BT protocol.
[0017] Preferably, the composition structure of the self-status information includes: a packet header, a packet length, a device number of a data object, a packet sequence number, a command word, a command execution status, other status data length, other status data, a check code and a packet tail; wherein the self-status is described by the other status data; and other multicast information is distinguished by the packet header and the packet tail.
[0018] Preferably, the host computer and all embedded devices in the multicast group form a P2P network.
[0019] In a third aspect, the present application provides a P2P network-based embedded device firmware update device, which is applied to a host computer, and the device includes:
[0020] The first multicast module is used to multicast status query instructions to other devices in the multicast group; receive multicast information, and parse the status information of the embedded device therefrom, and select the embedded device that needs firmware update according to the status information; multicast firmware update instructions to other devices in the multicast group, wherein the firmware update instructions include the device number that needs firmware update;
[0021] The first BT protocol module is used to upload the firmware update file to the embedded device that needs firmware update through the BT protocol.
[0022] In a fourth aspect, the present application provides an embedded device firmware update device based on a P2P network, which is applied to an embedded device, and the device includes:
[0023] The second multicast module is used to receive multicast information and parse the status query instruction or firmware update instruction from it; multicast its own status information to other devices in the multicast group;
[0024] The second BT protocol module is used to download the firmware update file from the host computer and other embedded devices through the BT protocol; and upload the firmware update file to other embedded devices that need firmware update through the BT protocol.
[0025] In a fifth aspect, the present application provides an embedded device firmware update system based on a P2P network, characterized in that the system includes a host computer and multiple embedded devices;
[0026] The host computer is used to multicast status query instructions to other devices in the multicast group; receive multicast information, and parse the status information of the embedded device therefrom, and select the embedded device that needs firmware update according to the status information; multicast firmware update instructions to other devices in the multicast group, the firmware update instructions containing the device number that needs firmware update; upload the firmware update file to the embedded device that needs firmware update through the BT protocol;
[0027] The embedded device is used to receive multicast information and parse out status query instructions or firmware update instructions therefrom; if the status query instruction is parsed out, the device multicasts its own status information to other devices in the multicast group; if the firmware update instruction containing its own device number is parsed out, the device downloads the firmware update file from the host computer and other embedded devices via the BT protocol; and uploads the firmware update file to other embedded devices that require firmware update via the BT protocol.
[0028] In a sixth aspect, the present application provides an electronic device, comprising: a memory for storing programs; a processor for executing the programs stored in the memory, when the program stored in the memory is executed, the processor is used to execute a P2P network-based embedded device firmware update method described in any implementation of the first aspect or any implementation of the second aspect.
[0029] In general, the above technical solutions conceived by this application have the following beneficial effects compared with the prior art:
[0030] At present, the firmware update of embedded devices is mostly carried out by unicast and multicast. Unicast has high reliability, but low efficiency, and is not suitable for embedded devices to perform batch firmware updates. Multicast has high efficiency, but low reliability. At the same time, when large-scale embedded devices use multicast to perform batch firmware updates, a large amount of invalid data will be generated in the network. Processing these invalid data will greatly occupy the computing resources of the embedded devices. Since the computing resources of embedded devices are limited, the normal business of embedded devices will be affected when performing batch firmware updates. In this application, the host computer and other embedded devices are located in the same multicast group, and instructions are interacted through multicast. At the same time, the host computer and each embedded device form a P2P network, and the firmware update file is transmitted through the BT protocol; thus, the instruction interaction through multicast can ensure the real-time nature of the instruction interaction, and will not generate too much invalid information in the network; at the same time, the transmission of the firmware update file through the BT protocol ensures the reliability of the update data, and is not affected by the size of the network. The more embedded devices there are in the network, the faster the transmission of the firmware update file. Therefore, the batch update of embedded devices using the present application scheme can not only transmit control instructions in a timely manner, but also ensure reliable and accurate firmware updates. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 It is a schematic diagram of the composition of a P2P network-based embedded device firmware update system provided in an embodiment of the present application.
[0032] Figure 2 This is a flowchart of a method for updating firmware of an embedded device based on a P2P network provided in an embodiment of the present application.
[0033] Figure 3 It is a structural diagram of a P2P network-based embedded device firmware update device provided in an embodiment of the present application.
[0034] Figure 4 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0035] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0036] The terms "first" and "second" in the specification and claims herein are used to distinguish different objects rather than to describe a specific order of the objects. For example, a first response message and a second response message are used to distinguish different response messages rather than to describe a specific order of the response messages.
[0037] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0038] In the description of the embodiments of the present application, unless otherwise specified, "multiple" means two or more than two. For example, multiple processing units refer to two or more processing units, etc.; multiple elements refer to two or more elements, etc.
[0039] like Figure 1 As shown, a P2P network-based embedded device firmware update system provided by an embodiment of the present application includes a host computer and N embedded devices.
[0040] The host computer and the N embedded devices are located in the same multicast group, and the host computer and the N embedded devices form a P2P network.
[0041] When the system is working, the host computer multicasts the control command packet to all devices in the multicast group.
[0042] After receiving the control command packet, the N embedded devices in the multicast group parse the control command packet and find out that the host computer sends a status query instruction. Then the N embedded devices multicast the status reply packet to all devices in the multicast group. The status reply packet includes the device number of the host computer of the data object and the device code of the embedded device of the data source. After receiving the status reply packet in the network, other embedded devices parse out the device number of the data object. If it is not their own device number, they will discard it.
[0043] After receiving the status reply packet, the host computer parses the status of each embedded device, selects the embedded device that needs to be updated with firmware, and then edits a new control command packet, which includes the firmware update command and the device number of the data object, where the device number of the data object is the device number of the embedded device that needs to be updated with firmware. After the new control command packet is edited, the control command packet is multicast to all devices in the multicast group.
[0044] After receiving the control command packet, the embedded device parses it and gets the device number of the data object. If it is not its own device number, it will be discarded. If it is its own device number and it is parsed that the host computer sends a firmware update instruction, it will download the firmware update file from the host computer and other embedded devices through the BT protocol.
[0045] At the same time, the host computer and embedded devices will upload the firmware update file to other embedded devices that need firmware update through the BT protocol. The more embedded devices involved in the firmware update, the faster the firmware update will be.
[0046] like Figure 2 FIG. 1 is a flowchart of a method for updating firmware of an embedded device based on a P2P network provided in an embodiment of the present application, comprising the following steps:
[0047] Step S101: The host computer and the embedded device join the multicast group.
[0048] Step S102: The host computer obtains device information of all embedded devices in the multicast group.
[0049] The host computer sends control command packets to all embedded devices to the multicast group. All embedded devices receive the control command packets from the multicast group and send status reply packets back to the multicast group. The host computer thus obtains the device information of all embedded devices in the multicast group.
[0050] The structure of the control command packet includes: packet header, packet length, device number of the data object, packet sequence number, command word, command attribute data length, command attribute data, check code and packet tail.
[0051] The device number of the data object is defined as an identifier for all devices, for example, it can be defined as 0XFFFF;
[0052] The command words include device information acquisition, device information modification, firmware update upload and firmware download.
[0053] The format of the control command packet is shown in Table 1:
[0054] Table 1
[0055]
[0056]
[0057] The status reply packet includes: packet header, packet length, device number of the data object, packet sequence number, command word, command execution status, other status data length, other status data, checksum and packet tail. Among them, other status data contains different status data according to the command word. The format of the status reply packet is shown in Table 2:
[0058] Table 2
[0059]
[0060] Step S103: the host computer selects an embedded device that needs to perform firmware update.
[0061] The host computer displays the device information of all embedded devices in the multicast group, and provides updateable device selection, which can be single or multiple selections, and then sends firmware update instructions to the corresponding embedded devices through multicast.
[0062] Step S104: The host computer and the embedded device perform a firmware update process of the P2P node through the BT protocol.
[0063] The embedded device that receives the firmware update instruction downloads the firmware update file from the host computer, and uploads the received firmware update file to other adjacent embedded device nodes that need to be updated until all embedded device nodes that need to be updated are updated.
[0064] Step S105: the host computer reacquires the device information of all embedded devices in the multicast group.
[0065] The host computer re-acquires the device information of all embedded devices in the multicast group to ensure that all embedded devices that need to update their firmware have completed the update.
[0066] like Figure 3 The figure is a schematic diagram of the structure of a P2P network-based embedded device firmware update device provided in an embodiment of the present application.
[0067] The embedded device firmware update device is applied to the embedded device and the host computer, and the embedded device firmware update device includes a multicast module and a BT protocol module.
[0068] When the embedded device firmware update device is applied to a host computer, wherein:
[0069] The multicast module is used to multicast status query instructions to other devices in the multicast group; receive multicast information and parse the status information of the embedded device therefrom, and select the embedded device that needs firmware update according to the status information; multicast firmware update instructions to other devices in the multicast group, wherein the firmware update instructions include the device number that needs firmware update;
[0070] The BT protocol module is used to upload the firmware update file to the embedded device that needs the firmware update through the BT protocol.
[0071] When the embedded device firmware update device is applied to an embedded device, wherein:
[0072] The multicast module is used to receive multicast information and parse out status query instructions or firmware update instructions from it; if the status query instruction is parsed out, it multicasts its own status information to other devices in the multicast group; if the firmware update instruction containing its own device number is parsed out, it notifies the BT protocol module to download the firmware update file;
[0073] The BT protocol module is used to download firmware update files from the host computer and other embedded devices through the BT protocol; and upload firmware update files to other embedded devices that require firmware update through the BT protocol.
[0074] It should be understood that the above-mentioned device is used to execute the method in the above-mentioned embodiment. The implementation principle and technical effect of the corresponding program module in the device are similar to those described in the above-mentioned method. The working process of the device can refer to the corresponding process in the above-mentioned method, which will not be repeated here.
[0075] Based on the method in the above embodiment, the embodiment of the present application provides an electronic device, such as Figure 4 As shown, the electronic device may include: a processor 810, a communication interface 820, a memory 830 and a communication bus 840, wherein the processor 810, the communication interface 820 and the memory 830 communicate with each other through the communication bus 840. The processor 810 may call the logic instructions in the memory 830 to execute the method in the above embodiment.
[0076] In addition, the logic instructions in the above-mentioned memory 830 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application.
[0077] Based on the method in the above embodiment, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program runs on a processor, the processor executes the method in the above embodiment.
[0078] Based on the method in the above embodiment, an embodiment of the present application provides a computer program product. When the computer program product runs on a processor, the processor executes the method in the above embodiment.
[0079] It is understood that the processor in the embodiments of the present application may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. The general-purpose processor may be a microprocessor or any conventional processor.
[0080] The method steps in the embodiments of the present application can be implemented by hardware or by a processor executing software instructions. The software instructions can be composed of corresponding software modules, and the software modules can be stored in random access memory (RAM), flash memory, read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), registers, hard disks, mobile hard disks, CD-ROMs, or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an ASIC.
[0081] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a storage medium or transmitted through the storage medium. The computer instructions may be transmitted from a website site, a computer, a server or a data center to another website site, a computer, a server or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The storage medium may be any available medium that a computer can access or a data storage device such as a server or a data center that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid state disk (SSD)), etc.
[0082] It should be understood that the various numerical numbers involved in the embodiments of the present application are only used for the convenience of description and are not used to limit the scope of the embodiments of the present application.
[0083] The above content is easily understood by those skilled in the art. The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present application should be included in the protection scope of the present application.
Claims
1. A method for updating firmware of an embedded device based on a P2P network, characterized in that: Applied to a host computer, the method includes: Send multicast status query instructions to other devices in the multicast group; Receive multicast information, parse the information to obtain status information of embedded devices, and select embedded devices that need firmware update based on the status information; Multicast the firmware update command to other devices in the multicast group. The firmware update command includes the device number that needs the firmware update. Upload the firmware update file to the embedded device that needs the firmware update through the BT protocol.
2. The method for updating firmware of an embedded device according to claim 1, characterized in that: The composition structure of the status query instruction and the firmware update instruction includes: a packet header, a packet length, a device number of a data object, a packet sequence number, a command word, a command attribute data length, a command attribute data, a check code and a packet tail; wherein the status query instruction and the firmware update instruction are distinguished by the command word; and other multicast information is distinguished by the packet header and the packet tail.
3. The method for updating firmware of an embedded device according to claim 1, characterized in that: The host computer and all embedded devices in the multicast group form a P2P network.
4. A method for updating firmware of an embedded device based on a P2P network, characterized in that: Applied to an embedded device, the method comprises: Receive multicast information and parse status query instructions or firmware update instructions from it; If the status query command is parsed, the device will multicast its status information to other devices in the multicast group; If the firmware update instruction containing the device number is parsed, the firmware update file is downloaded from the host computer and other embedded devices through the BT protocol; Upload the firmware update file to other embedded devices that need firmware update via BT protocol.
5. The method for updating firmware of an embedded device according to claim 4, characterized in that: The composition structure of the self-status information includes: a packet header, a packet length, a device number of a data object, a packet sequence number, a command word, a command execution status, other status data length, other status data, a check code and a packet tail; wherein the self-status is described by the other status data; and other multicast information is distinguished by the packet header and the packet tail.
6. The method for updating firmware of an embedded device according to claim 4, characterized in that: The host computer and all embedded devices in the multicast group form a P2P network.
7. A firmware update device for embedded devices based on a P2P network, characterized in that: Applied to a host computer, the device comprises: The first multicast module is used to multicast status query instructions to other devices in the multicast group; receive multicast information, and parse the status information of the embedded device therefrom, and select the embedded device that needs firmware update according to the status information; multicast firmware update instructions to other devices in the multicast group, wherein the firmware update instructions include the device number that needs firmware update; The first BT protocol module is used to upload the firmware update file to the embedded device that needs firmware update through the BT protocol.
8. A firmware update device for embedded devices based on a P2P network, characterized in that: Applied to embedded devices, the device comprises: The second multicast module is used to receive multicast information and parse the status query instruction or firmware update instruction from it; multicast its own status information to other devices in the multicast group; The second BT protocol module is used to download the firmware update file from the host computer and other embedded devices through the BT protocol; and upload the firmware update file to other embedded devices that need firmware update through the BT protocol.
9. An embedded device firmware update system based on a P2P network, characterized in that: The system includes a host computer and multiple embedded devices; The host computer is used to multicast status query instructions to other devices in the multicast group; receive multicast information, and parse the status information of the embedded device therefrom, and select the embedded device that needs firmware update according to the status information; multicast firmware update instructions to other devices in the multicast group, the firmware update instructions containing the device number that needs firmware update; upload the firmware update file to the embedded device that needs firmware update through the BT protocol; The embedded device is used to receive multicast information and parse out status query instructions or firmware update instructions therefrom; if the status query instruction is parsed out, the device multicasts its own status information to other devices in the multicast group; if the firmware update instruction containing its own device number is parsed out, the device downloads the firmware update file from the host computer and other embedded devices via the BT protocol; and uploads the firmware update file to other embedded devices that require firmware update via the BT protocol.
10. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, used to execute the program stored in the memory. When the program stored in the memory is executed, the processor is used to execute the method according to any one of claims 1 to 3 or claims 4 to 6.