A firmware upgrade method, device, system, electronic device and storage medium

Through the firmware upgrade method between the host computer and the target slave computer, the firmware upgrade transmission protocol is used to realize automated firmware upgrade, which solves the failure problems caused by the inconvenience of the traditional upgrade method and unstable network, and improves the convenience and reliability of the upgrade. .

CN113900693BActive Publication Date: 2024-10-15SHENZHEN YIBANG SUNSHINE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111258422.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-27
Publication Date
2024-10-15
Estimated Expiration
2041-10-27

AI Technical Summary

Technical Problem

Traditional firmware upgrade methods are inconvenient, especially in environments where the network is unstable or easily disconnected, leading to problems such as upgrade failure or hardware damage.

Method used

Through the firmware upgrade method between the host computer and the target slave computer, the preset firmware upgrade transmission protocol is used to send the firmware upgrade file package and upgrade instructions to ensure that the file package is successfully written and integrity verified, and the automated firmware upgrade process is realized.

Benefits of technology

It improves the convenience and reliability of firmware upgrade, ensuring that the upgrade can be successfully completed even in an unstable network environment to avoid hardware damage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113900693B_ABST
    Figure CN113900693B_ABST
Patent Text Reader

Abstract

The present application provides a firmware upgrade method, system, device, electronic device and storage medium, including: when the host computer receives the firmware upgrade file package, it determines the target lower computer that needs to be upgraded; the host computer sends the firmware upgrade file package and the upgrade instruction to the target lower computer according to the preset firmware upgrade transmission protocol; when the firmware upgrade file package is successfully written to the external storage area of ​​the target lower computer, the firmware upgrade file package is terminated according to the firmware upgrade transmission protocol, and the integrity of the firmware upgrade file package is checked; the target lower computer is used to call the firmware upgrade file package according to the upgrade instruction and execute the upgrade program. It solves the problem that the traditional method is inconvenient for firmware upgrade, and the existing network upgrade firmware is very likely to cause upgrade failure or even damage to the hardware in an environment where the network is unstable and easy to disconnect, making it more convenient, faster and more reliable to upgrade firmware through the network.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of device firmware upgrade, and in particular to a firmware upgrade method and apparatus, system, device and storage medium. Background Art

[0002] Firmware is generally stored in the EEPROM (Electrically Erasable Programmable ROM) or FLASH chip in the device, and can generally be upgraded by the user through a specific refresh program. Generally speaking, the software that performs the most basic and lowest-level work of a digital product can be called firmware, such as the Basic Input / Output System (BIOS) on the computer motherboard. In the past, more professionals actually called it firmware.

[0003] Upgrading firmware is mainly to solve some bugs and compatibility issues. With the advent of the information age, it is difficult for manufacturers to fully meet customer needs, and more manufacturers provide users with more updated functions by upgrading firmware as added value.

[0004] Currently, firmware upgrades are mainly done through local manual upgrades, which requires manual connection. If there are too many devices to be upgraded, the upgrade efficiency will be greatly reduced. Some Internet products that are upgraded through the network only upgrade the firmware to a specific location and then upgrade through manual operations. Fast upgrades cannot be achieved. When the network is disconnected or unstable, the upgrade cannot be performed well or even cannot be completed. Summary of the invention

[0005] In view of the above problems, the present application is proposed to provide a firmware upgrade method and device, system, equipment and storage medium that overcome the above problems or at least partially solve the above problems. The present application solves the problems that the traditional method is inconvenient for firmware upgrades, and the existing network firmware upgrades are very likely to cause upgrade failures and even damage to the hardware in an environment where the network is unstable and prone to disconnection, making firmware upgrades over the network more convenient, faster and more reliable.

[0006] The embodiment of the present application discloses a firmware upgrade method, which involves an upper computer and a target lower computer; the upper computer stores a firmware upgrade file package for upgrading the lower computer;

[0007] The host computer performs the following steps:

[0008] When the host computer receives the firmware upgrade file package, it determines the target slave computer that needs to be upgraded;

[0009] The host computer sends the firmware upgrade request to the target slave computer according to a preset firmware upgrade transmission protocol; the firmware upgrade request includes a firmware upgrade file package and an upgrade instruction;

[0010] When the firmware upgrade file package is successfully written into the external memory area of ​​the target slave computer, the sending of the firmware upgrade file package is terminated according to the firmware upgrade transmission protocol, and the integrity of the firmware upgrade file package is checked; the target slave computer is used to call the firmware upgrade file package according to the upgrade instruction and execute the upgrade program.

[0011] Furthermore, it also includes:

[0012] When the host computer receives the firmware upgrade file package, it queries the firmware version numbers of the collector and the terminal device according to the upgrade information description table in the firmware upgrade file package, and determines whether the firmware of the collector needs to be upgraded;

[0013] If yes, verify the integrity of the first patch used to upgrade the collector firmware according to the first MD5 data in the firmware upgrade file package corresponding to the collector;

[0014] If not, it is determined that the terminal device is upgraded, and the integrity of the second patch used to upgrade the terminal device firmware is verified based on the second MD5 data in the firmware upgrade file package corresponding to the terminal device.

[0015] Further, the step of sending the firmware upgrade request to the target slave computer according to a preset firmware upgrade transmission protocol comprises:

[0016] The host computer generates an upgrade instruction according to the firmware upgrade file package;

[0017] The host computer determines the function code of the firmware upgrade transmission protocol according to the upgrade instruction and the firmware upgrade file package;

[0018] The host computer sends the firmware upgrade file package and the upgrade instruction to the target slave computer according to the first function code in the firmware upgrade transmission protocol.

[0019] Further, the step of sending the firmware upgrade file package and the upgrade instruction to the target slave computer according to the first function code in the firmware upgrade transmission protocol by the host computer includes:

[0020] The host computer sends an upgrade instruction, and determines whether the firmware upgrade file package needs to be transmitted based on the 0x25 function code in the firmware upgrade transmission protocol; if so,

[0021] Then, according to the 0x21 function code in the firmware upgrade transmission protocol, an upgrade instruction is sent to the collector; or, according to the 0x22 function code in the firmware upgrade transmission protocol, an upgrade instruction is sent to the terminal device;

[0022] According to the 0x26 function code in the firmware upgrade transmission protocol, the firmware upgrade file package is decomposed into a plurality of data blocks, and the data blocks are numbered and sent to the collector according to the numbers, and written into the external storage area of ​​the collector;

[0023] According to the 0x27 function code in the firmware upgrade transmission protocol, it is determined whether all data blocks are written into the external memory area.

[0024] Further, the target lower computer includes a collector and a terminal device connected to the collector via a communication bus; when the firmware upgrade file package is successfully written into the external storage area of ​​the target lower computer, the step of terminating the sending of the firmware upgrade file package according to the firmware upgrade transmission protocol and verifying the integrity of the firmware upgrade file package includes:

[0025] According to the 0x28 function code in the firmware upgrade transmission protocol, check whether the firmware upgrade file package corresponding to the collector in the external storage area is complete, and if it is complete, end the sending;

[0026] or,

[0027] According to the 0x28 function code in the firmware upgrade transmission protocol, verify whether the firmware upgrade file package corresponding to the terminal device in the external memory area is complete, and then execute the next step;

[0028] Starting the Xmodem-1K protocol preset in the collector, and sending the corresponding firmware upgrade package to the terminal device according to the Xmodem-1K protocol;

[0029] When all bytes of the firmware upgrade package are transmitted, an end instruction for ending the transmission of the firmware upgrade file package is sent.

[0030] The embodiment of the present application discloses a firmware upgrade method, which involves an upper computer and a target lower computer; the upper computer stores a firmware upgrade file package for upgrading the target lower computer; when the upper computer inquires that the firmware version of the lower computer needs to be upgraded, the upper computer is used to send the firmware upgrade request to the target lower computer according to a preset firmware upgrade transmission protocol,

[0031] The target slave computer performs the following steps:

[0032] When the target lower computer receives the firmware upgrade request, the target lower computer writes the firmware upgrade file package into the external storage area according to a preset firmware upgrade transmission protocol;

[0033] When the firmware upgrade file package is successfully written into the external storage area, the target lower computer calls the firmware upgrade file package according to the upgrade instruction and executes the upgrade program.

[0034] Furthermore, the target lower computer includes a collector and a terminal device connected to the collector via a communication bus; the collector is provided with an internal storage area, a BOOT area and a functional area; when the firmware upgrade file package is transmitted and successfully written into the external storage area, the target lower computer calls the firmware upgrade file package according to the upgrade instruction and executes the upgrade program, including:

[0035] Determining the validity of the upgrade instruction according to the first function code, and parsing the firmware upgrade file package to obtain a patch file in a binary format; wherein the patch file is the first patch or the second patch;

[0036] When the patch file is the first patch, download the first patch to the internal storage area, and call the boot instruction preset in the BOOT area according to the upgrade instruction to erase the original data of the functional area;

[0037] Importing the first patch into the functional area and merging it with the original version of the firmware to generate a new version of the firmware corresponding to the collector;

[0038] or,

[0039] When the patch file is the second patch, the second patch is transmitted to the terminal device according to the preset Xmodem-1K protocol, and the upgrade progress is monitored according to the 0x23 function code in the firmware upgrade transmission protocol.

[0040] The embodiment of the present application discloses a firmware upgrade device, which involves an upper computer and a target lower computer; the upper computer stores a firmware upgrade file package for upgrading the lower computer;

[0041] The device comprises:

[0042] A target determination module, used to determine a target slave computer that needs to be upgraded after the upper computer receives the firmware upgrade file package;

[0043] A data sending module, used for the host computer to send the firmware upgrade request to the target slave computer according to a preset firmware upgrade transmission protocol; the firmware upgrade request includes a firmware upgrade file package and an upgrade instruction;

[0044] The file verification module is used to stop sending the firmware upgrade file package according to the firmware upgrade transmission protocol and verify the integrity of the firmware upgrade file package when the firmware upgrade file package is successfully written into the external storage area of ​​the target lower computer; the target lower computer is used to call the firmware upgrade file package according to the upgrade instruction and execute the upgrade program.

[0045] The embodiment of the present application discloses a firmware upgrade device, which involves an upper computer and a target lower computer; the upper computer stores a firmware upgrade file package for upgrading the target lower computer;

[0046] The device comprises:

[0047] A data receiving module, used for when the target lower computer receives a firmware upgrade request, the target lower computer writes the firmware upgrade file package into an external storage area according to a preset firmware upgrade transmission protocol;

[0048] The upgrade execution module is used for, when the firmware upgrade file package is successfully written into the external storage area, the target lower computer calls the firmware upgrade file package according to the upgrade instruction and executes the upgrade program.

[0049] The embodiment of the present application discloses a firmware upgrade system, which involves an upper computer and a target lower computer; the upper computer stores a firmware upgrade file package for upgrading the lower computer;

[0050] The host computer performs the following steps:

[0051] When the host computer receives the firmware upgrade file package, it determines the target slave computer that needs to be upgraded;

[0052] The host computer sends the firmware upgrade request to the target slave computer according to a preset firmware upgrade transmission protocol; the firmware upgrade request includes a firmware upgrade file package and an upgrade instruction;

[0053] When the firmware upgrade file package is successfully written into the external storage area of ​​the target lower computer, the sending of the firmware upgrade file package is terminated according to the firmware upgrade transmission protocol, and the integrity of the firmware upgrade file package is checked; the target lower computer is used to call the firmware upgrade file package according to the upgrade instruction and execute the upgrade program;

[0054] The target slave computer performs the following steps:

[0055] When the target lower computer receives the firmware upgrade request, the target lower computer writes the firmware upgrade file package into the external storage area according to a preset firmware upgrade transmission protocol;

[0056] When the firmware upgrade file package is successfully written into the external storage area, the target lower computer calls the firmware upgrade file package according to the upgrade instruction and executes the upgrade program.

[0057] An electronic device comprises a processor, a memory and a computer program stored in the memory and capable of running on the processor, wherein the computer program implements the steps of the firmware upgrade method as described above when executed by the processor.

[0058] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the firmware upgrade method described above are implemented.

[0059] This application has the following advantages:

[0060] In an embodiment of the present application, after the upper computer receives the firmware upgrade file package, it determines the target lower computer that needs to be upgraded; the upper computer sends the firmware upgrade file package to the target lower computer and the upgrade instruction according to the preset firmware upgrade transmission protocol; when the firmware upgrade file package is successfully written to the external storage area of ​​the target lower computer, the firmware upgrade file package is terminated according to the firmware upgrade transmission protocol, and the integrity of the firmware upgrade file package is checked; the target lower computer is used to call the firmware upgrade file package according to the upgrade instruction and execute the upgrade program. This application solves the problem that the traditional method is inconvenient for firmware upgrade, and the existing network upgrade firmware is very likely to cause upgrade failure or even damage to the hardware in an environment where the network is unstable and easy to disconnect, making it more convenient, faster and more reliable to upgrade firmware through the network. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] In order to more clearly illustrate the technical solution of the present application, the drawings required for use in the description of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0062] Figure 1 It is a flowchart of the steps of a host computer of a firmware upgrade method in one embodiment of the present application;

[0063] Figure 2 It is a flowchart of the steps of a lower computer of a firmware upgrade method in one embodiment of the present application;

[0064] Figure 3 It is a structural diagram of the upper computer and the target lower computer in one embodiment of the present application;

[0065] Figure 4is a schematic diagram of a firmware upgrade in an embodiment of the present application;

[0066] Figure 5 is a schematic diagram of a firmware upgrade in an embodiment of the present application;

[0067] Figure 6 It is a structural diagram of a computer device provided in one embodiment of the present application. DETAILED DESCRIPTION

[0068] In order to make the objects, features and advantages of the present application more obvious and understandable, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. Obviously, the described embodiments are part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.

[0069] It should be noted that, in any embodiment of the present application, the upper computer (including but not limited to the server) is a firmware upgrade scheme for the lower computer (including the data collector (referred to as the collector) and its subordinate terminal devices); the lower computer includes the collector, and the terminal device connected to the collector through the communication bus;

[0070] The so-called firmware upgrade refers to the process of burning the program to the MCU or DSP. There are many ways to burn, mainly (1) high-voltage burning: generally use high voltage (12V, 5V), according to the operation method in the data manual, enable the programming pin, send the corresponding instructions through the IIC or SPI bus protocol, enter the programming mode, and write the program to the MCU program memory. This method is to burn the bare chip MCU on a dedicated burner, which is generally used in the mass production stage. (2) ICP: In Circuit Programming, the program is updated without disassembling the chip. The chip only needs to be powered on, and it does not need to be in the executable program state, nor does it need to pre-set the boot program. It is purely the behavior of ICP hardware and requires the support of other hardware devices (such as NU-LINK, etc.) and cannot update itself. (3) ISP: In System Programming, which means that programming can be performed on the board level without removing the chip and placing it in the burner, that is, without leaving the system, so it is called "in system programming". It erases and writes the entire program, and programs the Flash memory inside the microcontroller through the serial programming interface dedicated to the microcontroller. Even if the chip is soldered on the circuit board, it can be burned as long as the serial port for the host computer interface is reserved. This programming method requires the ISP boot code to be written to the ISP program area of ​​the MCU in advance (this operation is generally completed by the MCU manufacturer) and is triggered by hardware. After power-on, the target MCU starts from the ISP program area and executes the ISP code to detect whether ISP operation is required. If necessary, the target MCU will receive data from the programmer or host computer, and use the corresponding functions and instructions in the ISP program area to write the data to the application program area. After the ISP process is completed, the MCU will reboot from the application program area to run the new application code. The ISP burning method does not require the chip to be disassembled, but it must be burned on site. (4) IAP: In application programming, also programming at the board level, the MCU obtains new code and reprograms a part of the program, that is, the program can be changed by the program, and part of the program can be modified to achieve the purpose of upgrading and eliminating bugs without affecting other parts of the system. The program can continue to run during the burning process. In addition, the interface program is written by oneself, so that remote upgrades can be performed without affecting the application. (5) JTAG: JTAG is the abbreviation of Joint Test Action Group, which is an international standard test protocol (IEEE 1149.1 compatible), mainly used for internal chip testing.The standard JTAG interface has four lines: TMS, TCK, TDI, and TDO, which are mode selection, clock, data input, and data output lines, respectively. Firmware can be burned and updated using a dedicated IDE (such as MDK, IAR) in conjunction with a corresponding emulator (such as J-Link, U-Link, ST-Link, etc.). It is also a board-level burning method that does not require a preset program. (6) SWD: SWD is a more reliable firmware burning and updating method than JTAG at high speeds and with large amounts of data. More importantly, it occupies fewer MCU pins - only two signal lines, SWDIO and SWDCLK, plus Vcc (not unnecessary) and GND, are needed. Generally, four lines can complete most of the functions of JTAG. It is also a board-level burning method that does not require a preset program. Only a commonly used IDE and an emulator that supports SWD are required. The firmware upgrade described in this application refers to the implementation solution of IAP.

[0071] Reference Figure 1 , showing a flowchart of the steps of a host computer of a firmware upgrade method provided by an embodiment of the present application; wherein the method involves a host computer and a target slave computer; the host computer stores a firmware upgrade file package for upgrading a terminal device in the slave computer; the host computer and the slave computer communicate through a preset firmware upgrade transmission protocol;

[0072] The host computer performs the following steps:

[0073] S110, after the upper computer receives the firmware upgrade file package, it determines the target lower computer that needs to be upgraded;

[0074] S120, the host computer sends the firmware upgrade request to the target slave computer according to a preset firmware upgrade transmission protocol; the firmware upgrade request includes a firmware upgrade file package and an upgrade instruction;

[0075] S130. When the firmware upgrade file package is successfully written into the external memory area of ​​the target lower computer, the sending of the firmware upgrade file package is terminated according to the firmware upgrade transmission protocol, and the integrity of the firmware upgrade file package is checked; the target lower computer is used to call the firmware upgrade file package according to the upgrade instruction and execute the upgrade program.

[0076] When the firmware upgrade file package is successfully written into the external storage area of ​​the target lower computer, the sending of the firmware upgrade file package is terminated according to the firmware upgrade transmission protocol, and the integrity of the firmware upgrade file package is checked; the target lower computer is used to call the firmware upgrade file package according to the upgrade instruction and execute the upgrade program; otherwise, when the writing is not successful, the firmware upgrade file package transmission fails, and the firmware version in the lower computer is re-queried whether it needs to be upgraded; the lower computer is used to call the firmware upgrade file package according to the upgrade instruction and execute the upgrade program when the firmware upgrade file package transmission is completed and successfully written into the external storage area.

[0077] In an embodiment of the present application, after the upper computer receives the firmware upgrade file package, it determines the target lower computer that needs to be upgraded; the upper computer sends the firmware upgrade file package to the target lower computer and the upgrade instruction according to the preset firmware upgrade transmission protocol; when the firmware upgrade file package is successfully written to the external storage area of ​​the target lower computer, the firmware upgrade file package is terminated according to the firmware upgrade transmission protocol, and the integrity of the firmware upgrade file package is checked; the target lower computer is used to call the firmware upgrade file package according to the upgrade instruction and execute the upgrade program. This application solves the problem that the traditional method is inconvenient for firmware upgrade, and the existing network upgrade firmware is very likely to cause upgrade failure and even damage to the hardware in an environment where the network is unstable and easy to disconnect, making it more convenient, faster and more reliable to upgrade firmware through the network; because the firmware burning needs to be stable and reliable, it can achieve power-off reburning, interruption reburning, and ensure the high validity of the burned data.

[0078] Next, the method for implementing the input device indication icon in this exemplary embodiment will be further described.

[0079] As described in step S110, after the upper computer receives the firmware upgrade file package, it determines the target lower computer that needs to be upgraded.

[0080] In an embodiment of the present application, the specific process of "when the upper computer receives the firmware upgrade file package, determining the target lower computer that needs to be upgraded" in step S110 can be further explained in combination with the following description.

[0081] As described in the following steps, after the host computer receives the firmware upgrade file package, it queries the firmware version numbers of the collector and the terminal device according to the upgrade information description table in the firmware upgrade file package, and determines whether the firmware of the collector needs to be upgraded; if so, it verifies the integrity of the first patch used to upgrade the collector firmware according to the first MD5 data in the firmware upgrade file package corresponding to the collector; if not, it is determined to be an upgrade of the terminal device, and verifies the integrity of the second patch used to upgrade the terminal device firmware according to the second MD5 data in the firmware upgrade file package corresponding to the terminal device.

[0082] As an example, for firmware upgrade, the first thing to do is to transfer the firmware - from the server to the collector, and from the collector to the device, which involves the issue of communication interface. Currently, common communication interfaces in embedded products include UART, USB, SD, TCP, etc. The cloud server must support the TCP communication interface (Ethernet remote upgrade), the host computer must support the UART communication interface (RS232, RS485 to achieve local upgrade), and the collector product must support the firmware upgrade method of both UART and TCP communication interfaces. Conditional collectors can support the firmware upgrade method of USB communication interface (U disk) and SD communication interface (SD card). For the collector and the terminal device, UART is uniformly used as the communication interface for firmware upgrade.

[0083] As an example, the firmware can also be transmitted through the UART interface protocol. UART is the most commonly used interface in embedded environments. It is generally expressed in the form of RS232 and RS485. The former is used for point-to-point burning, and the latter can achieve batch burning (not simultaneous burning). This interface can be used to transfer files between the host computer and the collector, and between the collector and the device;

[0084] UART interface between host computer and collector; host computer matched with collector ensures reliability and high speed. In terms of upgrade baud rate: for fast file transmission, a baud rate higher than that of monitoring communication is adopted, and 115200bps is uniformly adopted. In terms of upgrade command: in order to maintain the unity with TCP channel and minimize the amount of code of data collector, the description of function codes 0x21 to 0x25 in the upgrade command is just to add two bytes of data check at the end of these function code requests and responses - Modbus RTU CRC check method; in terms of file transmission, follow the collector firmware transmission protocol.

[0085] In step S120, the host computer sends the firmware upgrade request to the target slave computer according to the preset firmware upgrade transmission protocol.

[0086] In one embodiment of the present application, the specific process of "the upper computer sends the firmware upgrade file package to the target lower computer and the upgrade instruction according to the preset firmware upgrade transmission protocol" in step S120 can be further explained in combination with the following description.

[0087] In one embodiment of the present application, the upper computer sends an upgrade instruction, and sends the firmware upgrade file package to the target lower computer according to the first function code in the firmware upgrade transmission protocol, and determines whether the firmware upgrade file package is successfully written to the external memory area of ​​the target lower computer.

[0088] In a specific embodiment, the target lower computer includes a collector and a terminal device connected to the collector via a communication bus; the upper computer sends an upgrade instruction, and sends the firmware upgrade file package to the target lower computer according to the first function code in the firmware upgrade transmission protocol, and determines whether the firmware upgrade file package is successfully written into the external storage area of ​​the target lower computer, including:

[0089] The host computer sends an upgrade instruction, and determines whether the firmware upgrade file package needs to be transmitted according to the 0x25 function code in the firmware upgrade transmission protocol; if so, sends an upgrade instruction to the collector according to the 0x21 function code in the firmware upgrade transmission protocol; or, sends an upgrade instruction to the terminal device according to the 0x22 function code in the firmware upgrade transmission protocol;

[0090] According to the 0x26 function code in the firmware upgrade transmission protocol, the firmware upgrade file package is decomposed into a plurality of data blocks, and the data blocks are numbered and sent to the collector according to the numbers, and written into the external storage area of ​​the collector;

[0091] According to the 0x27 function code in the firmware upgrade transmission protocol, it is determined whether all data blocks are written into the external memory area.

[0092] As described in step S130, when the firmware upgrade file package is successfully written into the external memory area of ​​the target slave computer, the sending of the firmware upgrade file package is terminated according to the firmware upgrade transmission protocol, and the integrity of the firmware upgrade file package is verified; the target slave computer is used to call the firmware upgrade file package according to the upgrade instruction and execute the upgrade program.

[0093] In one embodiment of the present application, the specific process of step S130 described in "When the firmware upgrade file package is successfully written into the external memory area of ​​the target lower computer, the sending of the firmware upgrade file package is terminated according to the firmware upgrade transmission protocol, and the integrity of the firmware upgrade file package is verified; the target lower computer is used to call the firmware upgrade file package according to the upgrade instruction and execute the upgrade program" can be further explained in combination with the following description.

[0094] If the firmware upgrade file package is successfully written, the firmware upgrade file package is checked according to the second function code in the firmware upgrade transmission protocol, and the sending of the firmware upgrade file package is completed; otherwise, the transmission of the firmware upgrade file package fails, and the firmware version in the lower computer is re-queried whether it needs to be upgraded; the lower computer is used to call the firmware upgrade file package and execute the upgrade program according to the upgrade instruction when the transmission of the firmware upgrade file package is completed and successfully written into the external memory area.

[0095] As described in the following steps, according to the 0x28 function code in the firmware upgrade transmission protocol, check whether the firmware upgrade file package corresponding to the collector in the external storage area is complete, and if it is complete, end the sending;

[0096] As described in step S130, when the firmware upgrade file package is successfully written into the external memory area of ​​the target slave computer, the sending of the firmware upgrade file package is terminated according to the firmware upgrade transmission protocol, and the integrity of the firmware upgrade file package is verified; the target slave computer is used to call the firmware upgrade file package according to the upgrade instruction and execute the upgrade program.

[0097] In one embodiment of the present application, as described in the following steps, the target lower computer includes a collector and a terminal device connected to the collector via a communication bus; when the firmware upgrade file package is successfully written into the external storage area of ​​the target lower computer, the step of terminating the sending of the firmware upgrade file package according to the firmware upgrade transmission protocol and verifying the integrity of the firmware upgrade file package includes:

[0098] According to the 0x28 function code in the firmware upgrade transmission protocol, check whether the firmware upgrade file package corresponding to the collector in the external storage area is complete, and if it is complete, end the sending;

[0099] In one embodiment of the present application, as described in the following steps, the target lower computer includes a collector and a terminal device connected to the collector via a communication bus; when the firmware upgrade file package is successfully written into the external storage area of ​​the target lower computer, the step of terminating the sending of the firmware upgrade file package according to the firmware upgrade transmission protocol and verifying the integrity of the firmware upgrade file package includes:

[0100] According to the 0x28 function code in the firmware upgrade transmission protocol, verify whether the firmware upgrade file package corresponding to the terminal device in the external memory area is complete, and then execute the next step;

[0101] Starting the Xmodem-1K protocol preset in the collector, and sending the corresponding firmware upgrade package to the terminal device according to the Xmodem-1K protocol;

[0102] When all bytes of the firmware upgrade package are transmitted, an end instruction for ending the transmission of the firmware upgrade file package is sent.

[0103] In one embodiment of the present application, refer to Figure 2 , showing a flowchart of the steps of a lower computer of a firmware upgrade method provided by an embodiment of the present application; the method involves an upper computer and a target lower computer; the upper computer stores a firmware upgrade file package for upgrading a terminal device in the lower computer; the upper computer and the lower computer communicate through a preset firmware upgrade transmission protocol;

[0104] The lower computer performs the following steps:

[0105] S210, when the target lower computer receives a firmware upgrade request, the target lower computer writes the firmware upgrade file package into the external storage area according to a preset firmware upgrade transmission protocol; specifically, when the upper computer inquires that the firmware version of the target lower computer needs to be upgraded, the target lower computer receives the upgrade instruction, sends the firmware upgrade file package according to the preset firmware upgrade transmission protocol, and writes the firmware upgrade file package into the external storage area;

[0106] S220. When the firmware upgrade file package is successfully written into the external memory area, the target lower computer calls the firmware upgrade file package according to the upgrade instruction and executes the upgrade program; when the firmware upgrade file package is transmitted and successfully written into the external memory area, the target lower computer calls the firmware upgrade file package according to the upgrade instruction and executes the upgrade program. Specifically, when the firmware upgrade file package is transmitted and successfully written into the external memory area, the corresponding target device in the target lower computer calls the firmware upgrade file package according to the upgrade instruction and executes the upgrade program.

[0107] In one embodiment of the present application, when the upper computer inquires that the firmware version of the target lower computer needs to be upgraded, the target lower computer receives the upgrade instruction, sends the firmware upgrade file package according to a preset firmware upgrade transmission protocol, and writes the firmware upgrade file package to the external storage area, including:

[0108] When the host computer inquires that the firmware version needs to be upgraded and completes the firmware integrity verification, the target slave computer receives the firmware upgrade file package sent by the host computer according to the first function code in the firmware upgrade transmission protocol, and writes the firmware upgrade file package into the external memory area.

[0109] In one embodiment of the present application, the lower computer includes a collector and a terminal device connected to the collector via a communication bus; the collector is provided with an internal storage area, a BOOT area and a functional area; when the firmware upgrade file package is transmitted and successfully written into the external storage area, the target lower computer calls the firmware upgrade file package according to the upgrade instruction and executes the upgrade process, including:

[0110] The validity of the upgrade instruction is judged according to the first function code, and the firmware upgrade file package is parsed to obtain a patch file in binary format; wherein the patch file is the first patch or the second patch; when the patch file is the first patch, the first patch is downloaded to the internal storage area, and the boot instruction preset in the BOOT area is called according to the upgrade instruction to erase the original data of the functional area; the first patch is transferred to the functional area and merged with the original version of the firmware to generate a new version of the firmware corresponding to the collector.

[0111] In one embodiment of the present application, the lower computer includes a collector, and a terminal device connected to the collector through a communication bus; the collector is provided with an internal storage area, a BOOT area and a functional area; the corresponding target device in the lower computer calls a firmware upgrade file package and executes the upgrade program according to an upgrade instruction, including: judging the validity of the upgrade instruction according to a first function code, parsing the firmware upgrade file package, and obtaining a patch file in binary format; wherein the patch file is a first patch or a second patch; when the patch file is a second patch, transmitting the second patch to the terminal device according to a preset Xmodem-1K protocol, and monitoring the upgrade progress according to the 0x23 function code in the firmware upgrade transmission protocol.

[0112] As an example, for the firmware upgrade of terminal devices, in order to ensure the reliability of the upgrade, the protocol is simple and universal; in terms of the upgrade baud rate: follow the baud rate supported by the device, which is generally consistent with the baud rate of the device monitoring communication. If inconsistent, the user gives a specified baud rate on the cloud server or host computer. For the upgrade command, the Modbus RTU protocol is used. For file transfer, the protocol uses the industry-renowned serial port file transfer protocol - Xmodem-1K, which is simple and universal, easy to maintain compatibility with most devices, and convenient for customers to transplant.

[0113] In a specific implementation, since the firmware burning needs to be stable and reliable, and can realize power-off re-burning, interrupt re-burning, and ensure the high validity of the burned data, the IAP burning solution generally divides the MCU into three areas: the boot area (built-in boot program, usually called Boot Loader, hereinafter referred to as BOOT area), the function area (built-in real function code, usually called Application, hereinafter referred to as APP area), and the internal storage area (hereinafter referred to as STORE area).

[0114] When the MCU program is running, the firmware to be updated is downloaded to the STORE area through various communication channels. After the download is completed and verified, the system is reset to the BOOT area. The boot program copies the contents of the STORE area to the APP area, and then jumps to the APP area to execute the new firmware, completing the entire IAP process.

[0115] In this application, the collectors are equipped with 8M bytes of external Flash, which can be used as the STORE area. The built-in Flash of the MCU can be divided into the BOOT area and the APP area. The BOOT only does one thing, which is to determine whether there is a new firmware in the STORE area that needs to be updated. If so, it will erase all the contents of the APP area, and then read the new firmware in the STORE area batch by batch, and write it to the APP area, and jump to the APP area after completion; the real functional code is stationed in the APP area, running the user program, and checking in real time or regularly whether there is a firmware upgrade instruction.

[0116] The code in the BOOT area needs to be burned in through high-voltage burning or SWD. The code in the APP area can be merged with the code in the BOOT area and burned in together. When the program needs to be updated in the future, it can be updated through the BOOT boot program.

[0117] For the STM32 used in this application, because its interrupt vector table is located in the lowest address area of ​​the program memory, the code of the BOOT area is arranged in the beginning area of ​​the Flash, and the code of the APP area follows closely. When the code of the APP area starts to execute, it first needs to map the interrupt vector table of the CPU to its own vector table, and then perform other operations. In addition, while the STM32 implements read protection on the Flash area, it automatically sets the first 4 pages of the user Flash area to write protection, which can effectively ensure that the BOOT code will not be accidentally destroyed.

[0118] In this application, the STORE area is planned in advance to ensure backward compatibility; the BOOT area is kept as simple as possible, with a single function and taking up the least code space; the APP area is used for firmware downloads. Since the conventional underlying drivers already have business functions, they are shared as much as possible, and various drivers are not placed in the BOOT area to reduce the amount of code.

[0119] As an example, the external memory area is an external 8M-byte Flash, which is planned as follows (the capacity unit allocated to each area is "byte");

[0120]

[0121]

[0122] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0123] Reference Figure 3-4 , shows a firmware upgrade device provided by an embodiment of the present application; the device involves an upper computer 2 and a target lower computer 1; the upper computer 2 stores a firmware upgrade file package for upgrading a terminal device 11 in the lower computer 1; the upper computer 2 and the lower computer 1 communicate through a preset firmware upgrade transmission protocol; the lower computer 1 includes a collector 10, and a terminal device 11 connected to the collector 10 through a communication bus 18; the collector 10 is provided with an internal storage area, a BOOT area and a functional area; specifically includes:

[0124] The query verification module 110 is used to query whether the firmware version in the lower computer needs to be upgraded according to the upgrade information description table in the firmware upgrade file package, and to verify the integrity of the firmware upgrade file package;

[0125] The firmware transmission module 120 is used to send the firmware upgrade file package to the lower computer according to the first function code in the firmware upgrade transmission protocol if an upgrade is required and the verification is passed, and determine whether the firmware upgrade file package is successfully written into the external storage area of ​​the lower computer;

[0126] The first upgrade execution module 130 is used to check the firmware upgrade file package according to the second function code in the firmware upgrade transmission protocol if the writing is successful, and end the sending of the firmware upgrade file package; otherwise, the transmission of the firmware upgrade file package fails, and re-query whether the firmware version in the lower computer needs to be upgraded; the lower computer is used to call the firmware upgrade file package and execute the upgrade program according to the upgrade instruction when the transmission of the firmware upgrade file package is completed and successfully written into the external memory area.

[0127] In one embodiment of the present application, the data receiving unit 110 includes: a verification submodule, which is used to query the firmware version numbers of the collector 10 and the terminal device 11 according to the upgrade information description table in the firmware upgrade file package, and determine whether the firmware of the collector 10 needs to be upgraded; if so, verify the integrity of the first patch used to upgrade the firmware of the collector 10 according to the first MD5 data in the firmware upgrade file package corresponding to the collector 10; if not, determine that the terminal device 11 is upgraded, and verify the integrity of the second patch used to upgrade the firmware of the terminal device 11 according to the second MD5 data in the firmware upgrade file package corresponding to the terminal device 11.

[0128] In an embodiment of the present application, the firmware transmission module 120 includes: a transmission submodule, which is used to determine whether the firmware upgrade file package needs to be transmitted according to the 0x25 function code in the firmware upgrade transmission protocol; if so, send an upgrade instruction to the collector 10 according to the 0x21 function code in the firmware upgrade transmission protocol; or, send an upgrade instruction to the terminal device 11 according to the 0x22 function code in the firmware upgrade transmission protocol;

[0129] A parsing submodule, for decomposing the firmware upgrade file package into a plurality of data blocks according to the 0x26 function code in the firmware upgrade transmission protocol, and for numbering the data blocks and sending the data blocks to the collector 10 according to the numbers, and writing the data blocks into the external storage area of ​​the collector 10;

[0130] The judgment submodule is used to judge whether all data blocks are written into the external storage area according to the 0x27 function code in the firmware upgrade transmission protocol.

[0131] In an embodiment of the present application, the first upgrade execution module 130 includes a first check submodule, which is used to check whether the firmware upgrade file package corresponding to the collector 10 in the external storage area is complete according to the 0x28 function code in the firmware upgrade transmission protocol, and terminate the sending if it is complete;

[0132] In one embodiment of the present application, the first upgrade execution module 130 also includes a second check submodule, which is used to check whether the firmware upgrade file package corresponding to the terminal device 11 in the external memory area is complete according to the 0x28 function code in the firmware upgrade transmission protocol, and then execute the next step; start the Xmodem-1K protocol preset in the collector 10, and send the corresponding firmware upgrade package to the terminal device 11 according to the Xmodem-1K protocol; when all bytes of the firmware upgrade package are transmitted, send an end instruction for ending the sending of the firmware upgrade file package.

[0133] In one embodiment of the present application, the external storage area of ​​the collector 10 can also be a storage device with a USB interface, which can be burned and upgraded through the USB interface; the general process of burning firmware through the USB interface is: (1) The collector 10 identifies whether a USB flash drive is inserted, and if so, proceeds to the next step; (2) Check whether there is a folder named with the corresponding collector 10 or device in the root directory of the USB flash drive, such as SmartBox, Inverter, etc., and if so, proceeds to the next step; (3) Check whether there is a corresponding firmware in the directory, and refer to the firmware name regulations for firmware file name judgment, and if so, proceed to the next step; (4) Check the integrity of the firmware, if it is suitable for upgrading, copy it to the corresponding area of ​​the external Flash, and then proceed to the next step; (5) Update the information area of ​​the external Flash, restart the system to enter the BOOT program, and start the collector 10 firmware update or device firmware update operation.

[0134] In one embodiment of the present application, the external storage area of ​​the collector 10 can also be a storage device with an SD interface. The difference between the SD interface and the USB interface lies in the difference in file systems. The identification and reading of files follow the relevant interface specifications. The general process of firmware burning through the SD card is similar to that of the USB interface and will not be repeated here.

[0135] The host computer determines the upgrade target and the legality check of the firmware according to the operation of the user interface, and then performs the firmware transmission operation according to the function code between 0x21 and 0x29. In this application, during the firmware transmission stage, the collector 10 should not stop polling the monitoring data of the subordinate devices, and at the same time, it should accept the query and setting of various parameters from the host computer.

[0136] In one embodiment of the present application, the internal storage area is built-in Flash, which is divided into BOOT area and APP area. Although the MCU models of each collector 10 are different, the functions of the BOOT area are exactly the same, the codes can be basically shared, and the program size can be measured, so the size of the BOOT area is planned here - limited to 16K bytes. In addition, the BOOT area is uniformly executed from the first address of the user Flash area.

[0137] Reference Figure 3 and Figure 5 , shows a firmware upgrade device provided by an embodiment of the present application; the device involves an upper computer and a target lower computer; the upper computer stores a firmware upgrade file package for upgrading a terminal device 11 in the lower computer; the upper computer and the lower computer communicate through a preset firmware upgrade transmission protocol; the device includes:

[0138] The firmware receiving module 210 is used for receiving the firmware upgrade file package sent by the host computer according to the first function code in the firmware upgrade transmission protocol when the host computer inquires whether the firmware version needs to be upgraded and completes the firmware integrity verification, and writes the firmware upgrade file package into the external storage area;

[0139] The second upgrade execution module 220 is used for, when the transmission of the firmware upgrade file package is completed and successfully written into the external storage area, the corresponding target device in the lower computer calls the firmware upgrade file package according to the upgrade instruction and executes the upgrade program.

[0140] In an embodiment of the present application, the second upgrade execution module 220 includes a first parsing submodule, which is used to determine the validity of the upgrade instruction according to the first function code, and parse the firmware upgrade file package to obtain a patch file in binary format; wherein the patch file is the first patch or the second patch;

[0141] The first upgrade submodule is used to download the first patch to the internal storage area when the patch file is the first patch, and call the preset boot instruction in the BOOT area according to the upgrade instruction to erase the original data in the functional area; call the first patch into the functional area and merge it with the original version of the firmware to generate a new version of the firmware corresponding to the collector 10.

[0142] In a specific embodiment, the basic upgrade process of the collector 10 firmware (including the firmware of the subordinate terminal device 11 connected thereto) is as follows: (1) The collector 10 works in the functional area (APP area) and receives the firmware upgrade start instruction from the host computer through the communication channel; (2) The collector 10 determines the validity of the upgrade instruction, analyzes whether it is to upgrade the collector 10 itself or the subordinate device, makes a mark, and gives a corresponding response to the host computer; (3) If it is to upgrade its own firmware, according to the collector firmware transmission protocol, it receives the firmware transmitted from the host computer and stores it in the collector firmware area of ​​the external Flash (i.e., the external storage area). After the verification is completed and the upgrade information area of ​​the external Flash is updated, the system is restarted and switched to the boot program area (BOOT area). First, the collector firmware in the external Flash is verified again (verified according to the MD5 value to prevent firmware damage during power failure), then the APP area is erased, and finally the collector firmware after removing the encryption area is copied to the APP area to complete the upgrade.

[0143] In one embodiment of the present application, the second upgrade execution module 220 also includes a second upgrade sub-module, which, when the patch file is a second patch, transmits the second patch to the terminal device 11 according to a preset Xmodem-1K protocol, and monitors the upgrade progress according to the 0x23 function code in the firmware upgrade transmission protocol.

[0144] In a specific embodiment, the basic upgrade process of the firmware of the subordinate device (terminal device 11) of the collector 10 (must be a binary file with the suffix ".bin") is as follows: (1) The collector 10 works in the function area (APP area) and receives the firmware upgrade start instruction from the host computer through the communication channel; (2) The collector 10 determines the validity of the upgrade instruction, analyzes whether it is to upgrade the collector 10 itself or the subordinate terminal device 11, marks it, and gives a corresponding response to the host computer; if it is a firmware upgrade of the terminal device 11, according to the collector firmware transmission protocol, the firmware transmitted from the host computer is received and stored in the device firmware area of ​​the external Flash (external storage area). After the verification is completed and the upgrade information area of ​​the external Flash is updated, the upgrade instruction is sent to the corresponding subordinate device and the firmware is transmitted.

[0145] In one embodiment of the present application, a firmware upgrade system is disclosed. Figure 3 The system involves a host computer 2 and a target slave computer 1; the host computer 2 stores a firmware upgrade file package for upgrading a terminal device 11 in the slave computer 1; the host computer 2 and the slave computer 1 communicate through a preset firmware upgrade transmission protocol; the target slave computer 1 includes a collector 10, and a terminal device 11 connected to the collector through a communication bus 18; the system includes:

[0146] The host computer 2 performs the following steps:

[0147] When the upper computer 2 receives the firmware upgrade file package, it determines the target lower computer 1 that needs to be upgraded;

[0148] The host computer 2 sends the firmware upgrade file package and the upgrade instruction to the target slave computer 1 according to the preset firmware upgrade transmission protocol;

[0149] When the firmware upgrade file package is successfully written into the external storage area of ​​the target lower computer 1, the sending of the firmware upgrade file package is terminated according to the firmware upgrade transmission protocol, and the integrity of the firmware upgrade file package is checked; the target lower computer 1 is used to call the firmware upgrade file package according to the upgrade instruction and execute the upgrade program;

[0150] The target slave computer 1 performs the following steps:

[0151] When the upper computer 1 inquires that the firmware version of the target lower computer 2 needs to be upgraded, the target lower computer 1 receives the upgrade instruction, sends the firmware upgrade file package according to the preset firmware upgrade transmission protocol, and writes the firmware upgrade file package into the external storage area;

[0152] When the firmware upgrade file package is transmitted and successfully written into the external storage area, the target lower computer 1 calls the firmware upgrade file package according to the upgrade instruction and executes the upgrade program.

[0153] It should be noted that in any embodiment of the present application, the upgrade information description table is as shown in the following table:

[0154]

[0155]

[0156] Reference Figure 6 , showing a computer device for implementing a method for an input device indication icon of the present application, which may specifically include the following:

[0157] The computer device 12 is in the form of a general-purpose computing device, and the components of the computer device 12 may include but are not limited to: one or more processors or processing units 16, a memory 28, and a bus 18 connecting different system components (including the memory 28 and the processing unit 16).

[0158] The bus 18 represents one or more of several types of bus 18 structures, including a memory bus 18 or memory controller, a peripheral bus 18, an accelerated graphics port, a processor or a local bus 18 using any of a variety of bus 18 architectures. These architectures include, by way of example, but are not limited to, an Industry Standard Architecture (ISA) bus 18, a Micro Channel Architecture (MAC) bus 18, an Enhanced ISA bus 18, an Audio Video Electronics Standards Association (VESA) local bus 18, and a Peripheral Component Interconnect (PCI) bus 18.

[0159] The computer device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the computer device 12, including volatile and non-volatile media, removable and non-removable media.

[0160] Memory 28 may include computer system readable media in the form of volatile memory, such as random access memory 30 and / or cache memory 32. Computer device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 34 may be used to read and write to non-removable, non-volatile magnetic media (commonly referred to as a "hard drive"). Although Figure 3Not shown, a disk drive for reading and writing to a removable non-volatile disk (such as a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (such as a CD-ROM, DVD-ROM or other optical medium) may be provided. In these cases, each drive may be connected to the bus 18 via one or more data medium interfaces. The memory may include at least one program product having a set (e.g., at least one) of program modules 42, which are configured to perform the functions of the various embodiments of the present application.

[0161] A program / utility 40 having a set (at least one) of program modules 42 may be stored in, for example, a memory, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules 42, and program data, each of which or some combination may include an implementation of a network environment. The program modules 42 generally perform the functions and / or methods of the embodiments described herein.

[0162] The computer device 12 may also communicate with one or more external devices 14 (e.g., keyboards, pointing devices, displays 24, cameras, etc.), one or more devices that enable an operator to interact with the computer device 12, and / or any device that enables the computer device 12 to communicate with one or more other computing devices (e.g., network cards, modems, etc.). Such communication may be performed through the I / O interface 22. Furthermore, the computer device 12 may also communicate with one or more networks (e.g., local area networks (LANs)), wide area networks (WANs), and / or public networks (e.g., the Internet) through a network adapter 20. Figure 3 As shown, the network adapter 20 communicates with other modules of the computer device 12 via the bus 18. It should be understood that although Figure 3 Not shown, other hardware and / or software modules may be used in conjunction with the computer device 12, including but not limited to: microcode, device drivers, redundant processing units 16, external disk drive arrays, RAID systems, tape drives, and data backup storage systems 34, etc.

[0163] The processing unit 16 executes various functional applications and data processing by running the programs stored in the memory 28, such as implementing a firmware upgrade method provided in an embodiment of the present application.

[0164] That is, when the processing unit 16 executes the program, the following is achieved: after the upper computer receives the firmware upgrade file package, it determines the target lower computer that needs to be upgraded; the upper computer sends the firmware upgrade file package and the upgrade instruction to the target lower computer according to the preset firmware upgrade transmission protocol; when the firmware upgrade file package is successfully written into the external memory area of ​​the target lower computer, the sending of the firmware upgrade file package is terminated according to the firmware upgrade transmission protocol, and the integrity of the firmware upgrade file package is checked; the target lower computer is used to call the firmware upgrade file package according to the upgrade instruction and execute the upgrade program.

[0165] When the processing unit 16 executes the program, the following is achieved: when the upper computer inquires that the firmware version of the target lower computer needs to be upgraded, the target lower computer receives the upgrade instruction, and sends the firmware upgrade file package according to the preset firmware upgrade transmission protocol, and writes the firmware upgrade file package to the external memory area; when the firmware upgrade file package transmission is completed and successfully written to the external memory area, the target lower computer calls the firmware upgrade file package according to the upgrade instruction and executes the upgrade program.

[0166] In one embodiment of the present application, a computer-readable storage medium is further provided, on which a computer program is stored. When the program is executed by a processor, a firmware upgrade method provided in all embodiments of the present application is implemented.

[0167] That is, when the program is executed by the processor, it is implemented as follows: when the upper computer receives the firmware upgrade file package, it determines the target lower computer that needs to be upgraded; the upper computer sends the firmware upgrade file package to the target lower computer and the upgrade instruction according to the preset firmware upgrade transmission protocol; when the firmware upgrade file package is successfully written to the external memory area of ​​the target lower computer, the sending of the firmware upgrade file package is terminated according to the firmware upgrade transmission protocol, and the integrity of the firmware upgrade file package is checked; the target lower computer is used to call the firmware upgrade file package according to the upgrade instruction and execute the upgrade program.

[0168] When the processing unit 16 executes the program, the following is achieved: when the upper computer inquires that the firmware version of the target lower computer needs to be upgraded, the target lower computer receives the upgrade instruction, and sends the firmware upgrade file package according to the preset firmware upgrade transmission protocol, and writes the firmware upgrade file package to the external memory area; when the firmware upgrade file package transmission is completed and successfully written to the external memory area, the target lower computer calls the firmware upgrade file package according to the upgrade instruction and executes the upgrade program.

[0169] Any combination of one or more computer-readable media may be used. A computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any combination thereof. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium may be any tangible medium containing or storing a program that may be input into an execution system, device, or device for use or in conjunction with it.

[0170] Computer-readable signal media may include a data signal propagated in baseband or as part of a carrier wave, in which a computer-readable program code is carried. Such propagated data signals may take a variety of forms, including, but not limited to, electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an input execution system, apparatus, or device.

[0171] The computer program code for performing the operation of the present application can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" language or similar programming languages. The program code can be executed entirely on the operator's computer, partially on the operator's computer, as an independent software package, partially on the operator's computer, partially on the remote computer, or entirely on the remote computer or server. In the case of a remote computer, the remote computer can be connected to the operator's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (for example, using an Internet service provider to connect through the Internet). The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the various embodiments can be referred to each other.

[0172] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present application.

[0173] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.

[0174] The above is a detailed introduction to the input device indication icon implementation method and apparatus, equipment and storage medium provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, according to the idea of ​​the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A firmware upgrade method, characterized in that: The method involves a host computer and a target slave computer; the host computer stores a firmware upgrade file package for upgrading the slave computer; the target slave computer includes a collector and a terminal device connected to the collector via a communication bus; the host computer performs the following steps: When the host computer receives the firmware upgrade file package, it determines the target slave computer that needs to be upgraded; The upper computer sends the firmware upgrade request to the target lower computer according to a preset firmware upgrade transmission protocol; the firmware upgrade request includes a firmware upgrade file package and an upgrade instruction; specifically, the upper computer sends the upgrade instruction, and sends the firmware upgrade file package to the target lower computer according to the first function code in the firmware upgrade transmission protocol, and determines whether the firmware upgrade file package is successfully written into the external storage area of ​​the target lower computer; the first function code includes a function code for determining whether the firmware upgrade package needs to be transmitted, a function code for sending the upgrade instruction to the collector or the terminal device, a function code for decomposing the firmware upgrade package, and a function code for determining whether the firmware upgrade package is successfully written into the external storage area; When the firmware upgrade file package is successfully written into the external storage area of ​​the target lower computer, the sending of the firmware upgrade file package is terminated according to the firmware upgrade transmission protocol, and the integrity of the firmware upgrade file package is checked; The target lower computer is used to call the firmware upgrade file package according to the upgrade instruction and execute the upgrade program.

2. The method according to claim 1, characterized in that Also includes: When the host computer receives the firmware upgrade file package, it queries the firmware version numbers of the collector and the terminal device according to the upgrade information description table in the firmware upgrade file package, and determines whether the firmware of the collector needs to be upgraded; If yes, verify the integrity of the first patch used to upgrade the collector firmware according to the first MD5 data in the firmware upgrade file package corresponding to the collector; If not, it is determined that the terminal device is upgraded, and the integrity of the second patch used to upgrade the terminal device firmware is verified based on the second MD5 data in the firmware upgrade file package corresponding to the terminal device.

3. The method according to claim 1, characterized in that The step of sending the firmware upgrade request to the target slave computer according to a preset firmware upgrade transmission protocol comprises: The host computer generates an upgrade instruction according to the firmware upgrade file package; The host computer determines the function code of the firmware upgrade transmission protocol according to the upgrade instruction and the firmware upgrade file package; The host computer sends an upgrade instruction, and determines whether the firmware upgrade file package needs to be transmitted based on the 0x25 function code in the firmware upgrade transmission protocol; if so, Then, according to the 0x21 function code in the firmware upgrade transmission protocol, an upgrade instruction is sent to the collector; or, according to the 0x22 function code in the firmware upgrade transmission protocol, an upgrade instruction is sent to the terminal device; According to the 0x26 function code in the firmware upgrade transmission protocol, the firmware upgrade file package is decomposed into a plurality of data blocks, and the data blocks are numbered and sent to the collector according to the numbers, and written into the external storage area of ​​the collector; According to the 0x27 function code in the firmware upgrade transmission protocol, it is determined whether all data blocks are written into the external memory area.

4. The method according to claim 1, characterized in that When the firmware upgrade file package is successfully written into the external storage area of ​​the target lower computer, the step of terminating the sending of the firmware upgrade file package according to the firmware upgrade transmission protocol and verifying the integrity of the firmware upgrade file package includes: According to the 0x28 function code in the firmware upgrade transmission protocol, check whether the firmware upgrade file package corresponding to the collector in the external storage area is complete, and if it is complete, end the sending; or, According to the 0x28 function code in the firmware upgrade transmission protocol, verify whether the firmware upgrade file package corresponding to the terminal device in the external memory area is complete, and then execute the next step; Starting the Xmodem-1K protocol preset in the collector, and sending the corresponding firmware upgrade package to the terminal device according to the Xmodem-1K protocol; When all bytes of the firmware upgrade package are transmitted, an end instruction for ending the transmission of the firmware upgrade file package is sent.

5. A firmware upgrade method, characterized in that: The method involves a host computer and a target slave computer; the host computer stores a firmware upgrade file package for upgrading the target slave computer; the target slave computer includes a collector and a terminal device connected to the collector via a communication bus; The target slave computer performs the following steps: When the target lower computer receives a firmware upgrade request, the target lower computer writes the firmware upgrade file package into the external storage area according to a preset firmware upgrade transmission protocol; the firmware upgrade request includes a firmware upgrade file package and an upgrade instruction; specifically, when the upper computer inquires that the firmware version needs to be upgraded and completes the firmware integrity verification, the target lower computer receives the firmware upgrade file package sent by the upper computer according to the first function code in the firmware upgrade transmission protocol, and writes the firmware upgrade file package into the external storage area; The first function code includes a function code for determining whether the firmware upgrade package needs to be transmitted, a function code for sending the upgrade instruction to the collector or the terminal device, a function code for decomposing the firmware upgrade package, and a function code for determining whether the firmware upgrade package is successfully written into the external storage area; When the firmware upgrade file package is successfully written into the external storage area, the target lower computer calls the firmware upgrade file package according to the upgrade instruction and executes the upgrade program.

6. The method according to claim 5, characterized in that The collector is provided with an internal storage area, a BOOT area and a functional area; when the firmware upgrade file package is transmitted and successfully written into the external storage area, the target lower computer calls the firmware upgrade file package according to the upgrade instruction and executes the upgrade program, including: Determining the validity of the upgrade instruction according to the first function code, and parsing the firmware upgrade file package to obtain a patch file in a binary format; wherein the patch file is the first patch or the second patch; When the patch file is the first patch, download the first patch to the internal storage area, and call the boot instruction preset in the BOOT area according to the upgrade instruction to erase the original data of the functional area; Importing the first patch into the functional area and merging it with the original version of the firmware to generate a new version of the firmware corresponding to the collector; or, When the patch file is the second patch, the second patch is transmitted to the terminal device according to the preset Xmodem-1K protocol, and the upgrade progress is monitored according to the 0x23 function code in the firmware upgrade transmission protocol.

7. A firmware upgrade device, characterized in that: The device involves an upper computer and a target lower computer; the upper computer stores a firmware upgrade file package for upgrading the lower computer; The target lower computer includes a collector and a terminal device connected to the collector via a communication bus; the device includes: A target determination module, used to determine a target slave computer that needs to be upgraded after the upper computer receives the firmware upgrade file package; A data sending module, used for the host computer to send the firmware upgrade request to the target lower computer according to a preset firmware upgrade transmission protocol; the firmware upgrade request includes a firmware upgrade file package and an upgrade instruction; specifically, the host computer sends the upgrade instruction, and sends the firmware upgrade file package to the target lower computer according to the first function code in the firmware upgrade transmission protocol, and determines whether the firmware upgrade file package is successfully written into the external storage area of ​​the target lower computer; the first function code includes a function code for determining whether the firmware upgrade package needs to be transmitted, a function code for sending the upgrade instruction to the collector or the terminal device, a function code for decomposing the firmware upgrade package, and a function code for determining whether the firmware upgrade package is successfully written into the external storage area; a file verification module, used for terminating the sending of the firmware upgrade file package according to the firmware upgrade transmission protocol when the firmware upgrade file package is successfully written into the external storage area of ​​the target lower computer, and verifying the integrity of the firmware upgrade file package; the target lower computer is used to call the firmware upgrade file package according to the upgrade instruction and execute the upgrade program.

8. A firmware upgrade device, characterized in that: The device involves an upper computer and a target lower computer; the upper computer stores a firmware upgrade file package for upgrading the target lower computer; The target lower computer includes a collector and a terminal device connected to the collector via a communication bus; The device comprises: A data receiving module, used for when the target lower computer receives a firmware upgrade request, the target lower computer writes the firmware upgrade file package into the external storage area according to a preset firmware upgrade transmission protocol; the firmware upgrade request includes a firmware upgrade file package and an upgrade instruction; specifically, when the upper computer inquires that the firmware version needs to be upgraded and completes the firmware integrity verification, the target lower computer receives the firmware upgrade file package sent by the upper computer according to the first function code in the firmware upgrade transmission protocol, and writes the firmware upgrade file package into the external storage area; the first function code includes a function code for determining whether the firmware upgrade package needs to be transmitted, a function code for sending the upgrade instruction to the collector or the terminal device, a function code for decomposing the firmware upgrade package, and a function code for determining whether the firmware upgrade package is successfully written into the external storage area; The upgrade execution module is used for, when the firmware upgrade file package is successfully written into the external storage area, the target lower computer calls the firmware upgrade file package according to the upgrade instruction and executes the upgrade program.

9. A firmware upgrade system, characterized in that: The system involves a host computer and a target slave computer; the host computer stores a firmware upgrade file package for upgrading the slave computer; the target slave computer includes a collector and a terminal device connected to the collector via a communication bus; the host computer performs the following steps: When the host computer receives the firmware upgrade file package, it determines the target slave computer that needs to be upgraded; The upper computer sends the firmware upgrade request to the target lower computer according to a preset firmware upgrade transmission protocol; the firmware upgrade request includes a firmware upgrade file package and an upgrade instruction; specifically, the upper computer sends the upgrade instruction, and sends the firmware upgrade file package to the target lower computer according to the first function code in the firmware upgrade transmission protocol, and determines whether the firmware upgrade file package is successfully written into the external storage area of ​​the target lower computer; the first function code includes a function code for determining whether the firmware upgrade package needs to be transmitted, a function code for sending the upgrade instruction to the collector or the terminal device, a function code for decomposing the firmware upgrade package, and a function code for determining whether the firmware upgrade package is successfully written into the external storage area; When the firmware upgrade file package is successfully written into the external storage area of ​​the target lower computer, the sending of the firmware upgrade file package is terminated according to the firmware upgrade transmission protocol, and the integrity of the firmware upgrade file package is checked; The target lower computer is used to call the firmware upgrade file package according to the upgrade instruction and execute the upgrade program; The target slave computer performs the following steps: When the target lower computer receives a firmware upgrade request, the target lower computer writes the firmware upgrade file package into the external storage area according to a preset firmware upgrade transmission protocol; specifically, when the upper computer inquires that the firmware version needs to be upgraded and completes the firmware integrity verification, the target lower computer receives the firmware upgrade file package sent by the upper computer according to the first function code in the firmware upgrade transmission protocol, and writes the firmware upgrade file package into the external storage area; When the firmware upgrade file package is successfully written into the external storage area, the target lower computer calls the firmware upgrade file package according to the upgrade instruction and executes the upgrade program.

10. An electronic device and a computer-readable storage medium, characterized in that: The method comprises a processor, a computer-readable storage medium, and a computer program stored on the storage medium and capable of running on the processor, wherein the computer program implements the method according to any one of claims 1 to 6 when executed by the processor.