Embedded device upgrading system and method

By splitting the upgrade file into multiple data fragments and sending it based on the link-layer network protocol, the problem that embedded devices cannot achieve batch upgrades before leaving the factory are solved, and efficient embedded device software upgrades are achieved.

CN120075236APending Publication Date: 2025-05-30HISENSE BROADBAND MULTIMEDIA TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311602748.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-11-28
Publication Date
2025-05-30

AI Technical Summary

Technical Problem

The existing embedded product software upgrade solution cannot be batch upgraded before the product leaves the factory, resulting in serious limitations in work efficiency.

Method used

The upgrade file is split into multiple data fragments through the server, and these fragments are filled into the skb data structure based on the preset link layer network protocol to form a message data frame, which is sent to the switch in a loop. The switch then sends the message data frame to the embedded device, and the device parses and reorganizes the upgrade file according to the sequence number.

Benefits of technology

It realizes batch upgrade of embedded devices without the need for both IP addresses, improves the upgrade efficiency, and allows upgraded devices to be replaced at any time without waiting for all devices to be upgraded.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120075236A_ABST
    Figure CN120075236A_ABST
Patent Text Reader

Abstract

The invention discloses an embedded device upgrading system and method, and the method comprises the steps that in response to an upgrading instruction, a server splits an upgrading file into a plurality of data segments, and records the data segments and the number of the segments; the server fills the data fragments into the skb data structure based on a preset link layer network protocol to form message data frames, and circularly sends the message data frames in sequence; the switch sends the current message data frame to the embedded device; and in response to the message data frame, analyzing the message data frame by the embedded device, extracting effective data carried by the message data frame, recombining the effective data according to the sequence number, and then starting to upgrade. In the application, the server and the embedded device communicate through the preset network protocol of the link layer, and IP addresses of the server and the embedded device are not needed, so that the problem of batch upgrading of embedded products in a factory state can be effectively solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of software technology, and particularly to an embedded device upgrade system and method. Background Art

[0002] Currently, embedded devices are widely used in fields such as industrial control, smart home, mobile Internet, and medical devices. They have high integration and high reliability, can develop related products for specific fields, and can upgrade product functions by updating the device's program without modifying the product's hardware.

[0003] In the existing software upgrade solutions for embedded products, the server side and the device side interact, and IP addresses need to be assigned to both of them so that they can interact through the network layer. If, after the product is burned with a chip in the factory, it is found that there is a problem with the product software version, at this time the product is in the factory state, the MACs of different products are the same and the IPs of different products are the same, and the existing solutions will not be able to complete the batch upgrade function and can only be upgraded one by one, which will seriously affect the work efficiency. Summary of the Invention

[0004] This application provides an embedded device remote upgrade system and method to improve the software upgrade efficiency of embedded products.

[0005] To solve the above technical problems, the embodiments of this application disclose the following technical solutions:

[0006] On the one hand, the embodiments of this application disclose an embedded device upgrade method, including: in response to an upgrade instruction, the server splits the upgrade file into several data segments, and records the data segments and the number of segments;

[0007] Based on a preset link layer network protocol, the server fills the data segments into the skb data structure to form a packet data frame, and sequentially and cyclically sends out the packet data frame;

[0008] The switch sends the current packet data frame to the embedded device;

[0009] In response to the packet data frame, the embedded device parses the packet data frame, extracts the valid data carried by the packet data frame, and starts the upgrade after reorganizing the valid data according to the sequence number.

[0010] On the other hand, the embodiments of this application disclose an embedded device upgrade system, including: a server, a switch, and at least one embedded device; wherein:

[0011] The server is configured to:

[0012] In response to an upgrade instruction, the server splits the upgrade file into several data segments, and records the data segments and the number of segments;

[0013] Based on a preset link layer network protocol, fill the data fragments into the skb data structure to form a packet data frame, and send the packet data frames out in sequence and circularly.

[0014] The embedded device is configured to: in response to the packet data frame, parse the packet data frame, extract the valid data carried by the packet data frame, and start the upgrade after reorganizing the valid data according to the sequence number.

[0015] Compared with the prior art, the beneficial effects of this application are:

[0016] This application discloses an embedded device upgrade system and method. The method includes: in response to an upgrade instruction, the server splits the upgrade file into several data fragments, and records the data fragments and the number of fragments; the server based on a preset link layer network protocol, fills the data fragments into the skb data structure to form a packet data frame, and sends the packet data frames out in sequence and circularly; the switch sends the current packet data frame to the embedded device; in response to the packet data frame, the embedded device parses the packet data frame, extracts the valid data carried by the packet data frame, and starts the upgrade after reorganizing the valid data according to the sequence number. In this application, the server and the embedded device communicate through a preset network protocol at the link layer, directly process the sending and receiving of the upgrade file in the kernel, and the processing speed is faster; the IP addresses of both parties are not required, which can effectively solve the problem of batch upgrade of embedded products in the factory state. The server sends the upgrade packets circularly, and the embedded devices that have completed the upgrade can be replaced at any time, without waiting for all the embedded devices to complete the upgrade before replacing the next batch of devices. Description of the Drawings

[0017] In order to more clearly illustrate the technical solutions in this disclosure, the following will briefly introduce the drawings required for use in some embodiments of this disclosure. Obviously, the drawings in the following description are only the drawings of some embodiments of this disclosure, and those of ordinary skill in the art can also obtain other drawings based on these drawings. In addition, the drawings in the following description can be regarded as schematic diagrams, and are not limitations on the actual sizes of the products, the actual processes of the methods, the actual timings of the signals, etc. involved in the embodiments of this disclosure.

[0018] Figure 1 It is an application scenario diagram of an upgrade method for an embedded device provided according to an embodiment;

[0019] Figure 2 It is a schematic diagram of the TCP / IP five-layer model communication between a server and an embedded device in the prior art;

[0020] Figure 3 It is a schematic flowchart of an upgrade method for an embedded device provided according to some embodiments of this application;

[0021] Figure 4 A schematic diagram of a network protocol frame format provided according to some embodiments of the present application;

[0022] Figure 5 A schematic illustration of an S400 process provided according to some embodiments of the present application Figure 1 ;

[0023] Figure 6 A schematic illustration of an S400 process provided according to some embodiments of the present application Figure 2 ;

[0024] Figure 7 A schematic illustration of an S400 process provided according to some embodiments of the present application Figure 3 ;

[0025] Figure 8 A schematic diagram of an embedded device upgrade system provided according to an embodiment;

[0026] Figure 9 A schematic diagram of a server structure provided according to some embodiments of the present application;

[0027] Figure 10 A schematic diagram of an embedded device structure provided according to some embodiments of the present application. Detailed implementation manners

[0028] Next, some embodiments of the present disclosure will be clearly and detailedly described in conjunction with the accompanying drawings. However, the described embodiments are only a part of the embodiments of the present disclosure, rather than all of the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments provided by the present disclosure fall within the scope of protection of the present disclosure.

[0029] Unless otherwise required by the context, throughout the specification and claims, the term "comprising" is construed in an open, inclusive sense, i.e., "including, but not limited to"; the terms "first" and "second" should not be construed as indicating or implying relative importance or an upper limit on quantity; the term "plurality" means two or more; the term "connected" should be understood in a broad sense. For example, "connected" can be a fixed connection, a detachable connection, or integrated, can be directly connected, or indirectly connected through an intermediate medium; the use of the term "adapted to" or "configured to" implies open and inclusive language, which does not exclude a device adapted to or configured to perform additional tasks or steps; descriptions such as "parallel", "perpendicular", "identical", "consistent", "flush", etc. are not limited to absolute mathematical relationships, but also include an acceptable error range in practice, and also include differences formed due to manufacturing reasons based on the same design concept. Without further limitation, an element defined by the statement "comprising one..." does not exclude the existence of additional identical elements in the circuit structure, article, or device including the said element.

[0030] An embodiment of the present application provides an embedded device upgrade method, which is used to upgrade the target object of the embedded device. In this case, the target object refers to various software programs or files installed in the embedded device, such as the bootloader (e.g., bootloader) running on the embedded device, operating systems (such as Linux, VxWorks, and Windows CE), library files (lib), and application programs (app), etc. That is, the target object in this case is not limited to application programs only.

[0031] Figure 1 FIG. is an application scenario diagram of an embedded device upgrade method provided according to an embodiment. As Figure 1 shown, the embedded device upgrade system includes: a server and an embedded device. In some embodiments, the server is communicatively connected to the embedded device through a network protocol. After receiving the application information from the embedded device, the server sends the upgrade file to the embedded device.

[0032] Figure 2 FIG. is a schematic diagram of the TCP / IP five-layer model communication between a server and an embedded device in the prior art. As Figure 2 shown, the network protocol includes: the application layer, the transport layer, the network layer, the data link layer, and the physical layer. The rule for the nth layer on one device to communicate with the nth layer on another device is the nth layer protocol. There are many protocols in each layer of the network. The protocols of the receiving and sending parties in the same layer must be consistent, otherwise one party will not be able to recognize the information sent by the other party.

[0033] In the prior art, the server communicates with the embedded device through the IP protocol at the network layer. When communicating, both parties need to allocate IP addresses so that they can interact through the network layer. However, after the factory burns the chips, different products have the same IP, which makes it impossible for the server to communicate with multiple embedded devices simultaneously, that is, it is impossible to upgrade multiple embedded devices simultaneously.

[0034] To solve the above problems, Figure 3 As a schematic flow diagram of a method for upgrading an embedded device provided by some embodiments of the present application, as Figure 3 shown, the present application provides a method for upgrading an embedded device, including:

[0035] S100: In response to an upgrade instruction, the server splits the upgrade file into several data segments and records the data segments and the number of segments.

[0036] In some embodiments, if the data length of the upgrade file is too large to be completed through a single message, the upgrade file needs to be split into several data segments.

[0037] Exemplarily, the upgrade file is split into several data segments according to a preset data length, and the preset data length can be 1400 bytes, 1000 bytes, or 1200 bytes. In some embodiments, the server splits the upgrade file into at least one data segment, including: a first data segment and a second data segment.

[0038] During the splitting process, if the length of the current data segment is less than the preset data length, 0 is added after the data segment to make the length of the current data segment the preset data length.

[0039] Exemplarily, if the total length of the upgrade file is 3800 bytes and the preset data length is 1400 bytes, the upgrade file is split into a first data segment, a second data segment, and a third data segment. The length of the last data segment, that is, the third data segment, is 1000 bytes, so 400 bytes of 0 are added after this data segment.

[0040] S200: Based on a preset link layer network protocol, fill the data segments into the skb data structure to form a message data frame, and sequentially and circularly send out the message data frames.

[0041] The type of the preset link layer network protocol is: 0xFFAB. The message data frame contains: the total number of data segments corresponding to the upgrade file, the serial number, the valid data length, and the version number of the upgrade file.

[0042] Figure 4 As a schematic diagram of a network protocol frame format provided by some embodiments of the present application. The network protocol frame format is defined as Figure 4, the specific meanings of the respective fields corresponding to this protocol are shown in Table 1.

[0043] Fill each upgrade file segment into the skb data structure, and sequentially and cyclically call the packet sending interface to send out the data frame. The specific content of the skb data structure is as follows:

[0044] The source Mac is the Mac of the server, the destination Mac is the broadcast Mac FF:FF:FF:FF:FF:FF, and the protocol is 0xFFAB;

[0045] Data.Magic, fill with 0x48584B44;

[0046] Data.CType, select the corresponding value according to the specific type of the device to be upgraded this time. For example, if upgrading an HGU device, the CType value is 1;

[0047] Data.Vlan ID, the server does not need to fill this value, and the default value is 0;

[0048] Data.Length, fill in the valid length of the upgrade file segment to be transmitted;

[0049] Data.Seq num, fill in the number of the current segment of the upgrade file being transmitted;

[0050] Data.Total num, fill in the total number of segments into which the upgrade file is split;

[0051] Data.Version, fill in the version name of the current upgrade file;

[0052] Data.Data, fill in the content of the Seq num-th segment to be transmitted.

[0053]

[0054] S300: The switch sends the current message data frame to the embedded device.

[0055] The switch can send the message data frame sent by the server to multiple embedded devices. For example, the port of the switch connected to the server is configured in trunk mode, and the allowed VLAN list is 100; the port of the switch connected to the embedded device is configured for VLAN conversion. For example, if the switch is connected to port 8 of the embedded device, then configure VLAN 100 to VLAN1008 and VLAN 1008 to VLAN 100, so that communication between the server and the embedded device connected to port 8 can be achieved.

[0056] S400: In response to the message data frame, the embedded device parses the message data frame, extracts the valid data carried by the message data frame, and starts the upgrade after reorganizing the valid data according to the sequence numbers.

[0057] In this application, the server and the embedded device communicate through a preset network protocol at the link layer, and directly process the sending and receiving of the upgrade file in the kernel, with faster processing speed; no IP addresses of both parties are required, which can effectively solve the problem of batch upgrade of embedded products in the factory state. The server sends upgrade messages in a loop, and the embedded devices that have completed the upgrade can be replaced at any time, without waiting for all the embedded devices to complete the upgrade before replacing the next batch of devices. The embedded product devices can start receiving the upgrade file at any time, and reorganize the received messages according to the sequence numbers of the data to form a complete upgrade file.

[0058] Figure 5 A schematic diagram of an S400 process provided according to some embodiments of the present application Figure 1 As Figure 5 shown, the embedded device parses the message data frame, extracts the valid data carried by the message data frame, and starts the upgrade after reorganizing the valid data according to the sequence numbers, including: S401: The embedded device parses the message data frame to obtain the total quantity, sequence number, valid data length, and version number of the upgrade file carried by the message data frame.

[0059] S402: Determine whether the version number of the upgrade file is the same as the local version number. If the version number of the upgrade file is the same as the local version number, go to S403. If the version number of the upgrade file is different from the local version number, go to S404.

[0060] The local version number is the software version number currently used stored in the embedded device. The same version number of the upgrade file and the local version number indicates that the local version number stored in the embedded device is consistent with the target version, that is, the embedded device has completed the current upgrade process.

[0061] S403: Send an upgrade completion message, and the upgrade completion message includes the location information of the current embedded device. The same version number of the upgrade file and the local version number indicates that the local version number stored in the embedded device is consistent with the target version, that is, the embedded device has completed the current upgrade process. Therefore, when the version number of the upgrade file is the same as the local version number, send an upgrade completion message, and the upgrade completion message includes the location information of the current embedded device. After receiving the upgrade completion message, the server can parse and obtain the location information of the current embedded device and display the completed embedded devices.

[0062] S404: Determine whether the local file quantity is the same as the total quantity. If the local file quantity is the same as the total quantity, go to S405. If the local file quantity is different from the total quantity, go to S401.

[0063] The number of local files is the same as the total number, indicating that all data segments for this upgrade are already included in the current embedded device.

[0064] S405: Recombine the received valid data according to the sequence numbers to form a complete upgrade file, start the upgrade, and enter S401.

[0065] After all data segments for this upgrade are already included in the current embedded device, recombine the received data segments according to the sequence numbers to form a complete upgrade file, and enter the upgrade mode to start the upgrade.

[0066] In the embodiments of the present application, the server sends upgrade messages in a loop. Embedded devices that have completed the upgrade can be replaced at any time, without waiting for all embedded devices to complete the upgrade before replacing the next batch of devices, improving work efficiency.

[0067] Figure 6 A schematic diagram of the S400 process provided according to some embodiments of the present application Figure 2 . As Figure 6 shown, in order to ensure data correctness, before S402, it may further include: S4001: Check whether the data is correct according to Magic and CRC in the message data frame. If the data is incorrect, enter S4002. If the data is correct, enter S402.

[0068] S4002: Discard the current message data frame and enter S401. Discard the non-conforming message data frames to avoid upgrade errors.

[0069] Or, discard the current message data frame and close the receiving function of the embedded device to avoid upgrade errors.

[0070] Figure 7 A schematic diagram of the S400 process provided according to some embodiments of the present application Figure 3 . As Figure 7 shown, in some embodiments, the embedded device parses the message data frame, extracts the valid data carried by the message data frame, and starts the upgrade after recombining the valid data according to the sequence numbers, including:

[0071] S401: The embedded device parses the message data frame to obtain the total number, sequence number, valid data length, and version number of the upgrade file carried by the message data frame.

[0072] S4001: Parse the message data frame and check whether the data is correct according to Magic and CRC in the message data frame. If the data is incorrect, enter S4002. If the data is correct, enter S402.

[0073] S4002: Discard the current message data frame and enter S401. Discard the non-conforming message data frame to avoid upgrade errors.

[0074] S402: Determine whether the version number of the upgrade file is the same as the local version number. If the version number of the upgrade file is the same as the local version number, enter S403. If the version number of the upgrade file is different from the local version number, enter S404.

[0075] S403: Send an upgrade completion message, which includes the location information of the current embedded device.

[0076] S404: Determine whether the number of local files is the same as the total number. If the number of local files is the same as the total number, enter S405. If the number of local files is different from the total number, enter S406.

[0077] S405: Recombine the received valid data according to the sequence number to form a complete upgrade file, start the upgrade, and enter S401.

[0078] S406: According to the sequence number of the current data segment, determine whether the current data segment has been received. If the sequence number of the current data segment has been received, enter S4002. If the sequence number of the current data segment has not been received, then S407: Save the current data segment.

[0079] In some embodiments of the present application, an embedded device upgrade method further includes: S408: In response to the upgrade completion message, display the result according to the VLAN ID value of the embedded device that has completed the upgrade.

[0080] The upgrade completion message includes the port of the switch corresponding to the current embedded device to facilitate the upper computer to mark the corresponding location of the current embedded device. The server lights the corresponding indicator light according to the VLAN ID value, and the upgrade operator or the tooling system can replace the corresponding embedded device with the embedded device to be upgraded. Or according to the VLAN ID value, perform corresponding voice broadcast to display the embedded device that has completed the upgrade.

[0081] In some embodiments, before verifying whether the data is correct according to Magic and CRC in the message data frame, it further includes: obtaining the device type value in the message data frame and determining whether the device type value matches the type of the current embedded device. If the device type value matches the type of the current embedded device, proceed to the next step. If the device type value does not match the type of the current embedded device, proceed to the next step.

[0082] Figure 8 For the schematic diagram of an embedded device upgrade system provided according to the embodiment, in some embodiments, as Figure 8As shown in the figure, the embedded device upgrade system provided by this application includes: a server, a switch, and at least one embedded device.

[0083] A link layer network protocol is preset in the server and the embedded device, so that the server and the embedded device can communicate through the link layer, avoiding the situation where embedded devices with the same IP cannot communicate with the server simultaneously.

[0084] In some embodiments, the protocol type of the preset link layer network protocol is 0xFFAB.

[0085] Figure 9 It is a schematic diagram of the server structure provided according to some embodiments of this application. As Figure 9 shown, the server includes:

[0086] A file splitting module, a file storage module, and a first message sending module. The file splitting module is connected to the file storage module, and the first message sending module is connected to the file storage module.

[0087] Among them, the file splitting module is configured to read the upgrade file, split the upgrade file into several data segments, and write the data segments and segment numbers into the file storage module.

[0088] Exemplarily, the file splitting module splits the upgrade file into several data segments according to a preset data length, so that the first message sending module can send a complete data segment at a time.

[0089] The preset data length can be 1400 bytes, 1000 bytes, or 1200 bytes. In some embodiments, the file splitting module splits the upgrade file into at least one data segment, including: a first data segment and a second data segment.

[0090] During the splitting process, if the length of the current data segment is less than the preset data length, 0 is added after the data segment to make the length of the current data segment the preset data length.

[0091] Exemplarily, if the total length of the upgrade file is 3800 bytes and the preset data length is 1400 bytes, the file splitting module splits the upgrade file into a first data segment, a second data segment, and a third data segment. The length of the last data segment, that is, the third data segment, is 1000 bytes, so 400 bytes of 0 are added after this data segment.

[0092] After the upgrade file is split, only the length of the last segment may be less than 1400 bytes, because the size of the upgrade file may not be divisible by 1400. Therefore, in the loop-sent messages, only the message containing the last segment of the upgrade file needs to add 0 for supplementation in this field.

[0093] Therefore, the effective data length is mostly 1400. Only for the packet containing the last upgrade segment, the effective data length may be less than 1400.

[0094] The file splitting module is also configured to record the total number of data segments in a file and write the total number of files to the file storage module.

[0095] The file storage module includes: a quantity storage area, a first storage area, and a second storage area. Among them, the quantity storage area is used to store the total number of data segments in a file. The first storage area stores the first data segment, the second storage area stores the second data segment, and so on. For example, the third storage area stores the third data segment.

[0096] The first packet sending module is configured to: read the data stored in the file storage module, fill the data segment and the total number of files into the skb data structure to form a packet data frame, and sequentially and cyclically call the packet sending interface to send out the packet data frame.

[0097] In the packet data frame, the source Mac is the Mac of the server, the destination Mac is the broadcast Mac FF:FF:FF:FF:FF:FF, and the protocol is 0xFFAB;

[0098] Data.Magic, fill in 0x48584B44;

[0099] Data.CType, select the corresponding value according to the specific type of the device to be upgraded this time. For example, if upgrading an HGU device, the CType value is 1;

[0100] Data.Vlan ID, the server does not need to fill in this value, and the default value of 0 is fine;

[0101] Data.Length, fill in the effective length of the upgrade file segment to be transmitted;

[0102] Data.Seq num, represents the sequence number of the current data segment, and fill in the number corresponding to the position of the current transmitted segment of the upgrade file;

[0103] Data.Total num, fill in the total number of segments after splitting the upgrade file;

[0104] Data.Version, represents the upgrade version name, and fill in the version name of the current upgrade file;

[0105] Data.Data, fill in the content of the Seq num-th segment to be transmitted.

[0106] The switch is communicatively connected to the server, and the switch is used to forward the packet data frame to the embedded device. The switch is connected to the first packet sending module of the server, receives the packet data frame and forwards the packet data frame to the embedded device.

[0107] Figure 10 It is a schematic diagram of the structure of the embedded device provided according to some embodiments of the present application. As Figure 10 shown, the embedded device includes: a second packet receiving module, a pre-storage module, and an upgrade module. The second packet receiving module is connected to the pre-storage module, and the pre-storage module is also connected to the upgrade module. The second packet receiving module is also connected to the upgrade module.

[0108] The second packet receiving module is connected to the switch and receives the packet data frame. The second packet receiving module is also used to parse the packet data frame, record the number of local files, and obtain from the packet data frame: the current data segment number, the total number of files, and the upgrade version name.

[0109] The second packet receiving module is configured to: when the upgrade version name is the same as the local version name, send a trigger message to the second packet sending module, so that the second packet sending module sends an upgrade completion message to the switch. That the upgrade version name is the same as the local version name means that the current device has completed this upgrade, and the upgrade completion message can be sent to the switch through the second packet sending module and reported to the server.

[0110] When the upgrade version name is different from the local version name and the total number of files is the same as the number of local files, the data stored in the pre-storage module is retrieved, reorganized into a complete upgrade file in sequence, and the upgrade file is sent to the upgrade module, so that the upgrade module calls the upgrade file for upgrading. When the upgrade version name is different from the local version name and the total number of files is the same as the number of local files, it means that the reception of the upgrade file has been completed this time. The data stored in the pre-storage module is retrieved, reorganized into a complete upgrade file in sequence, and the upgrade file is sent to the upgrade module, so that the upgrade module calls the upgrade file for upgrading.

[0111] When the upgrade version name is different from the local version name and the total number of files is different from the number of local files, the data in the current file data frame is written into the pre-storage module. When the upgrade version name is different from the local version name and the total number of files is different from the number of local files, it means that not all the data segments required for this upgrade have been received, and data segments need to be continuously received.

[0112] In some embodiments, to avoid receiving data repeatedly, when the upgrade version name is different from the local version name and the total number of files is different from the number of local files, the following steps are also required: Determine whether the current data segment sequence number has been received. If the current data segment sequence number has been received, discard the current message data frame; if the current data segment sequence number has not been received, save the data in the current data segment to the pre-storage module. To determine whether the current data segment sequence number has been received, it can be done by comparing the current data segment sequence number with the sequence numbers of the local data segments stored in the pre-storage module. If there is a local data segment sequence number in the pre-storage module that is the same as the current data segment sequence number, then the current data segment sequence number has been received; if there is no local data segment sequence number in the pre-storage module that is the same as the current data segment sequence number, then the current data segment sequence number has not been received.

[0113] In some embodiments, to avoid data errors, the second message receiving module is configured to: parse the message data frame and check whether the data is correct according to the Magic and CRC in the message data frame. If the data is incorrect, discard the current message data frame.

[0114] In some embodiments, the embedded device is also provided with a second message sending module, which is used to send an upgrade completion message to the server when the upgrade version name is the same as the local version name. The upgrade completion message includes the port of the switch corresponding to the current embedded device, so as to facilitate the upper computer to mark the corresponding position of the current embedded device.

[0115] In some embodiments, the server also includes: a first message receiving module, which is connected to the switch. The second message receiving module is used to receive the upgrade completion message, parse the Data.Vlan ID value in the upgrade completion message, and complete the reporting.

[0116] After the server receives the instruction to start the upgrade, it triggers the file splitting module to read the upgrade file from the specified directory. This module splits the upgrade file into file segments, each segment being 1400 bytes in size. If the last segment is less than 1400 bytes, it is padded with 0s at the end. Each split file segment is stored in the memory dynamically allocated by the kernel in sequence, and the total number of file segments is recorded. Then, the message sending module sends the upgrade file segments to the switch in a cyclic manner from the front to the back until it receives the instruction to stop the upgrade.

[0117] When the message sending module starts to work, the first message receiving module of the server starts to listen for data frames with a protocol type of 0xFFAB. When the first message receiving module receives a data frame of the preset type, it parses the data frame, extracts the VLAN ID value in Data (the VLAN ID value corresponds one-to-one with the port number of the switch), and notifies the upgrade result processing module of the VLAN ID value. The upgrade result processing module lights the corresponding indicator light according to the VLAN ID value, and the upgrade operator or the tooling system can replace the corresponding embedded device with the embedded device to be upgraded.

[0118] Or the upgrade result processing module performs corresponding voice announcements according to the VLAN ID value.

[0119] After the embedded device is powered on and starts up, the second message receiving module receives a data frame with a protocol type of 0xFFAB. First, the second message receiving module parses the data frame and performs security checks, device type and version number comparison according to the parsed data content. If the security check passes, the device types are the same, and the version number is the same as the local version number, it directly notifies the message sending module, and the message sending module sends the current VLAN ID and Version information to the server.

[0120] If the security check passes, the device types are the same, but the version number is different from the local version number, check whether the Seq num of the currently received upgrade file segment already exists. If it already exists, discard the data frame and continue to wait for receiving messages; if the Seq num of the upgrade file segment does not exist, store the upgrade file segment in the local data area and increment the number of received upgrade file segments by 1.

[0121] Judge whether the local file quantity is the same as the total quantity. If the local file quantity is the same as the total quantity, it means that all upgrade file segments have been received, stop receiving messages, and notify the upgrade module to recombine the upgrade file segments into an upgrade file and call the upgrade function to perform an upgrade restart. If the local file quantity is different from the total quantity, continue to wait for receiving messages. When there is a problem with the security check or the device types are different, stop receiving data frames, and the embedded device no longer runs this upgrade function.

[0122] Those skilled in the art can understand that the structure shown in the figure is only a block diagram of some structures related to the solution of this application, and does not constitute a limitation on the server to which the solution of this application is applied. The specific server may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements. Since the above embodiments are all described by reference and combination on other bases, there are the same parts between different embodiments. The same and similar parts between the various embodiments in this specification can be referred to each other. Details are not elaborated here again.

Claims

1. An embedded device upgrade method, characterized in that, it includes: In response to an upgrade instruction, the server splits the upgrade file into several data segments and records the data segments and the number of segments; Based on a preset link layer network protocol, the server fills the data segments and the number of segments into an skb data structure to form a packet data frame, and sequentially and cyclically sends out the packet data frame; The switch sends the current packet data frame to the embedded device; In response to the packet data frame, the embedded device parses the packet data frame, extracts the valid data carried by the packet data frame, and starts the upgrade after reorganizing the valid data according to the sequence number.

2. The embedded device upgrade method according to claim 1, characterized in that, The parsing of the packet data frame, extracting the valid data carried by the packet data frame, and starting the upgrade after reorganizing the valid data according to the sequence number includes: The embedded device parses the packet data frame to obtain the total number, sequence number, and version number of the upgrade file carried by the packet data frame; If the version number of the upgrade file is the same as the local version number, send an upgrade completion message; If the version number of the upgrade file is different from the local version number and the total number of files is the same as the local number of files, reorganize the files into a complete upgrade file according to the sequence number and start the upgrade; If the version number of the upgrade file is different from the local version number and the total number of files is different from the local number of files, write the data segments in the current file data frame into the pre-storage module.

3. The embedded device upgrade method according to claim 1, characterized in that, The parsing of the packet data frame, extracting the valid data carried by the packet data frame, and starting the upgrade after reorganizing the valid data according to the sequence number includes: The embedded device parses the packet data frame to obtain the valid data, total number, sequence number, and version number of the upgrade file carried by the packet data frame; If the version number of the upgrade file is the same as the local version number, send an upgrade completion message; If the version number of the upgrade file is different from the local version number and the total number of files is the same as the local number of files, reorganize the files into a complete upgrade file according to the sequence number and start the upgrade; If the version number of the upgrade file is different from the local version number, the total number of files is different from the local number of files, and the current data segment sequence number has been received, discard the current file data frame; If the version number of the upgrade file is different from the local version number, the total number of files is different from the local number of files, and the current data segment sequence number has not been received, write the data segments in the current file data frame into the pre-storage module.

4. The embedded device upgrade method according to claim 2 or 3, characterized in that, The parsing of the packet data frame, extracting the valid data carried by the packet data frame, and starting the upgrade after reorganizing the valid data according to the sequence number further includes: Check whether the data is correct according to the Magic and CRC in the packet data frame; If the data is incorrect, discard the current packet data frame; If the data is correct, extract the valid data carried by the packet data frame, and start the upgrade after reorganizing the valid data according to the sequence number.

5. The embedded device upgrade method according to claim 1, characterized in that, It further includes: In response to the upgrade completion information, the result is presented according to the VLAN ID value of the embedded device that has completed the upgrade.

6. An embedded device upgrade system Characterized in that It includes: A server, a switch, and at least one embedded device; where: The server is configured to: In response to an upgrade instruction, the server splits the upgrade file into several data segments and records the data segments and the number of segments; Based on a preset link layer network protocol, fill the data segments into the skb data structure to form a packet data frame, and sequentially and circularly send the packet data frames; The switch is connected to the server and the embedded device, and forwards the packet data frame to the embedded device; the embedded device is configured to: in response to the packet data frame, parse the packet data frame, extract the valid data carried by the packet data frame, and start the upgrade after reorganizing the valid data according to the sequence number.

7. The embedded device upgrade system according to claim 6 Characterized in that The server includes: A file splitting module, configured to: read the upgrade file, split the upgrade file into several data segments, and write the data segments, segment numbers, and total number of files into the file storage module; A file storage module for storing the data segments, segment numbers, and total number of files; The first packet sending module is configured to: read the data stored in the file storage module, fill the data segments and the total number of files into the skb data structure to form a packet data frame, and sequentially and circularly call the packet sending interface to send the packet data frame.

8. The embedded device upgrade system according to claim 7 Characterized in that The embedded device includes: A second packet receiving module for receiving the packet data frame, parsing the current packet data frame, and obtaining in the packet data frame: the current data segment number, the total number of files, and the upgrade version name; A pre-storage module for storing the local upgrade file; When the upgrade version name is the same as the local version name, the second packet receiving module sends a trigger message to the second packet sending module to cause the second packet sending module to send an upgrade completion message; When the upgrade version name is different from the local version name and the total number of files is the same as the local file number, the second packet receiving module retrieves the data stored in the pre-storage module, reorganizes it into a complete upgrade file in sequence, and sends the upgrade file to the upgrade module; An upgrade module that calls the upgrade file for upgrading.

9. The embedded device upgrade system according to claim 7 or 8 Characterized in that The server further includes: a first packet receiving module for receiving the upgrade completion information and obtaining the Data.Vlan ID value in the upgrade completion information.

10. The embedded device upgrade system according to claim 9 Characterized in that It further includes: An upgrade result processing module, configured to light up the indicator corresponding to the Data.Vlan ID value.