CN113900693A - Firmware upgrading method, device and system, electronic equipment and storage medium - Google Patents

Firmware upgrading method, device and system, electronic equipment and storage medium Download PDF

Info

Publication number
CN113900693A
CN113900693A CN202111258422.5A CN202111258422A CN113900693A CN 113900693 A CN113900693 A CN 113900693A CN 202111258422 A CN202111258422 A CN 202111258422A CN 113900693 A CN113900693 A CN 113900693A
Authority
CN
China
Prior art keywords
firmware
upgrading
firmware upgrading
lower computer
target lower
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111258422.5A
Other languages
Chinese (zh)
Inventor
孟祥梯
万留美
伍权乐
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Eybond Co ltd
Original Assignee
Shenzhen Eybond Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Eybond Co ltd filed Critical Shenzhen Eybond Co ltd
Priority to CN202111258422.5A priority Critical patent/CN113900693A/en
Publication of CN113900693A publication Critical patent/CN113900693A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates

Abstract

The application provides a firmware upgrading method, a system, a device, electronic equipment and a storage medium, which comprises the steps that after an upper computer receives a firmware upgrading file package, a target lower computer needing to be upgraded is determined; the upper computer sends a firmware upgrading file package to a target lower computer and an upgrading instruction according to a preset firmware upgrading transmission protocol; when the firmware upgrading file packet is successfully written into the external memory area of the target lower computer, the firmware upgrading file packet is sent according to the firmware upgrading transmission protocol, and the integrity of the firmware upgrading file packet is checked; the target lower computer is used for calling the firmware upgrading file package according to the upgrading instruction and executing the upgrading program. The problems that the firmware is inconvenient to upgrade by a traditional mode, the existing network upgrading firmware is easy to fail to upgrade if the existing network upgrading firmware is in an unstable and network-disconnected environment, and even hardware is damaged are solved, so that the firmware is upgraded by the network more conveniently and quickly, and the reliability is high.

Description

Firmware upgrading method, device and system, electronic equipment and storage medium
Technical Field
The present application relates to the field of device firmware upgrading technologies, and in particular, to a firmware upgrading method, apparatus, system, device, and storage medium.
Background
Firmware (firmware) is typically stored in an electrically Erasable read-only memory eeprom (electrically Erasable Programmable rom) or FLASH chip in the device, and is typically a program that can be upgraded by the user by a specific refresh procedure. Generally, software that serves as the most Basic and bottom layer of a digital product can be called firmware, such as Basic Input/output System (BIOS) on a computer motherboard, which is called by more professionals before.
Firmware is upgraded mainly to solve some Bug and compatibility problems. With the coming of the information age, manufacturers are difficult to design to meet the requirements of customers comprehensively, and more manufacturers provide more updated functions for upgrading firmware as additional values to users.
At present, upgrading firmware is mainly upgraded locally and manually, so that manual connection is needed, and if too many devices to be upgraded are needed, the upgrading efficiency is greatly reduced; some internet products upgraded by a network mode only upgrade firmware to a specific position, then upgrade by manual operation, and fast upgrade is not realized, and when the network is disconnected or the network is unstable, upgrade cannot be well performed or even cannot be completed.
Disclosure of Invention
In view of the problems described above, the present application has been made to provide a firmware upgrade method and apparatus, a system, a device, and a storage medium that overcome the problems or at least partially solve the problems. Through the method and the device, the problems that the traditional mode is inconvenient for firmware upgrading, the existing network upgrading firmware is easy to cause upgrading failure and even damage to hardware in the environment with unstable and easily-disconnected network of the network are solved, the firmware is upgraded more conveniently and quickly through the network, and the reliability is high.
The embodiment of the application discloses a firmware upgrading method, which relates to an upper computer and a target lower computer; a firmware upgrading file packet for upgrading the lower computer is stored in the upper computer;
the upper computer executes the following steps:
after the upper computer receives the firmware upgrading file package, determining a target lower computer needing to be upgraded;
the upper computer sends the firmware upgrading request to the target lower computer according to a preset firmware upgrading transmission protocol; the firmware upgrading request comprises a firmware upgrading file package and an upgrading instruction;
when the firmware upgrading file packet is successfully written into the external memory area of the target lower computer, stopping sending the firmware upgrading file packet according to the firmware upgrading transmission protocol, and checking the integrity of the firmware upgrading file packet; the target lower computer is used for calling the firmware upgrading file package according to the upgrading instruction and executing the upgrading program.
Further, the method also comprises the following steps:
after the upper computer receives the firmware upgrading file package, inquiring firmware version numbers of the collector and the terminal equipment according to an upgrading information description table in the firmware upgrading file package, and judging whether the firmware of the collector needs to be upgraded or not;
if yes, verifying the integrity of a first patch for upgrading the firmware of the collector according to the first MD5 data in the firmware upgrading file package corresponding to the collector;
and if not, determining that the terminal equipment is upgraded, and verifying the integrity of a second patch for upgrading the firmware of the terminal equipment according to the second MD5 data in the firmware upgrading file package corresponding to the terminal equipment.
Further, the step of sending the firmware upgrading request to the target lower computer by the upper computer according to a preset firmware upgrading transmission protocol includes:
the upper computer generates an upgrading instruction according to the firmware upgrading file packet;
the upper computer determines a function code of the firmware upgrading transmission protocol according to the upgrading instruction and the firmware upgrading file packet;
and the upper computer sends the firmware upgrading file packet and the upgrading instruction to the target lower computer according to the first function code in the firmware upgrading transmission protocol.
Further, the step that the upper computer sends the firmware upgrading file package and the upgrading instruction to the target lower computer according to the first function code in the firmware upgrading transmission protocol comprises the following steps:
the upper computer sends an upgrading instruction and judges whether a firmware upgrading file package needs to be transmitted or not according to a 0x25 function code in the firmware upgrading transmission protocol; if so,
sending an upgrade instruction to the collector according to the 0x21 function code in the firmware upgrade transmission protocol; or sending an upgrade instruction to the terminal device according to the 0x22 function code in the firmware upgrade transmission protocol;
according to the 0x26 function code in the firmware upgrading transmission protocol, decomposing the firmware upgrading file packet into a plurality of data blocks, numbering the data blocks, sending the data blocks to the collector according to the numbers, and writing the data blocks into the external memory area of the collector;
and judging whether all data blocks are written into the external memory area according to the 0x27 function code in the firmware upgrading transmission protocol.
Further, the target lower computer comprises a collector and a terminal device connected with the collector through a communication bus; when the firmware upgrading file packet is successfully written into the external memory area of the target lower computer, the steps of stopping sending the firmware upgrading file packet according to the firmware upgrading transmission protocol and checking the integrity of the firmware upgrading file packet comprise;
according to the 0x28 function code in the firmware upgrading transmission protocol, checking whether the firmware upgrading file packet corresponding to the collector in the external memory area is complete, and if so, ending the transmission;
or the like, or, alternatively,
according to the 0x28 function code in the firmware upgrading transmission protocol, checking whether the firmware upgrading file packet corresponding to the terminal equipment in the external memory area is complete or not, and executing the next step;
starting an Xmodem-1K protocol preset in the collector, and sending the corresponding firmware upgrade package to the terminal equipment according to the Xmodem-1K protocol;
and when all bytes of the firmware upgrade package are completely transmitted, sending an ending instruction for ending sending the firmware upgrade file package.
The embodiment of the application discloses a firmware upgrading method, which relates to an upper computer and a target lower computer; the upper computer stores a firmware upgrading 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 for sending the firmware upgrading request to the target lower computer according to a preset firmware upgrading transmission protocol,
the target lower computer executes the following steps:
when the target lower computer receives a firmware upgrading request, the target lower computer writes the firmware upgrading file packet into an external memory area according to a preset firmware upgrading transmission protocol;
and when the firmware upgrading file packet is successfully written into the external memory area, the target lower computer calls the firmware upgrading file packet according to the upgrading instruction and executes an upgrading program.
Further, the target lower computer comprises a collector and a terminal device connected with the collector through a communication bus; the collector is provided with an internal storage area, a BOOT area and a functional area; when the transmission of the firmware upgrading file package is finished and the firmware upgrading file package is successfully written into the external memory area, the target lower computer calls the firmware upgrading file package according to an upgrading instruction and executes an upgrading program, and the method comprises the following steps:
judging the validity of the upgrading instruction according to the first function code, and analyzing the firmware upgrading file packet to obtain a patch file in a binary format; the patch file is a first patch or a second patch;
when the patch file is a first patch, downloading the first patch to the internal storage area, calling a preset guide instruction in the BOOT area according to the upgrading instruction, and erasing original data of the functional area;
calling the first patch into the functional area, and merging the first patch with the original version firmware to generate a new version firmware corresponding to the collector;
or the like, or, alternatively,
and when the patch file is a second patch, transmitting the second patch to the terminal equipment according to a preset Xmodem-1K protocol, and monitoring the upgrading progress according to a 0x23 function code in the firmware upgrading transmission protocol.
The embodiment of the application discloses a firmware upgrading device, which relates to an upper computer and a target lower computer; a firmware upgrading file packet for upgrading the lower computer is stored in the upper computer;
the device comprises:
the target determining module is used for determining a target lower computer needing to be upgraded after the upper computer receives the firmware upgrading file packet;
the data sending module is used for sending the firmware upgrading request to the target lower computer by the upper computer according to a preset firmware upgrading transmission protocol; the firmware upgrading request comprises a firmware upgrading file package and an upgrading instruction;
the file verification module is used for terminating sending the firmware upgrading file packet according to the firmware upgrading transmission protocol and checking the integrity of the firmware upgrading file packet when the firmware upgrading file packet is successfully written into the external memory area of the target lower computer; the target lower computer is used for calling the firmware upgrading file package according to the upgrading instruction and executing the upgrading program.
The embodiment of the application discloses a firmware upgrading device, which relates to an upper computer and a target lower computer; the upper computer stores a firmware upgrading file package for upgrading the target lower computer;
the device comprises:
the data receiving module is used for writing the firmware upgrading file packet into an external memory area by the target lower computer according to a preset firmware upgrading transmission protocol when the target lower computer receives a firmware upgrading request;
and the upgrading execution module is used for calling the firmware upgrading file packet and executing an upgrading program by the target lower computer according to the upgrading instruction when the firmware upgrading file packet is successfully written into the external memory area.
The embodiment of the application discloses a firmware upgrading system, which relates to an upper computer and a target lower computer; a firmware upgrading file packet for upgrading the lower computer is stored in the upper computer;
the upper computer executes the following steps:
after the upper computer receives the firmware upgrading file package, determining a target lower computer needing to be upgraded;
the upper computer sends the firmware upgrading request to the target lower computer according to a preset firmware upgrading transmission protocol; the firmware upgrading request comprises a firmware upgrading file package and an upgrading instruction;
when the firmware upgrading file packet is successfully written into the external memory area of the target lower computer, stopping sending the firmware upgrading file packet according to the firmware upgrading transmission protocol, and checking the integrity of the firmware upgrading file packet; the target lower computer is used for calling the firmware upgrading file package according to the upgrading instruction and executing an upgrading program;
the target lower computer executes the following steps:
when the target lower computer receives a firmware upgrading request, the target lower computer writes the firmware upgrading file packet into an external memory area according to a preset firmware upgrading transmission protocol;
and when the firmware upgrading file packet is successfully written into the external memory area, the target lower computer calls the firmware upgrading file packet according to the upgrading instruction and executes an upgrading program.
An electronic device comprising a processor, a memory and a computer program stored on the memory and capable of running on the processor, the computer program, when executed by the processor, implementing the steps of the firmware upgrade method as described above.
A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of the firmware upgrade method as described above.
The application has the following advantages:
in the embodiment of the application, after the upper computer receives the firmware upgrading file packet, a target lower computer needing to be upgraded is determined; the upper computer sends the firmware upgrading file packet to the target lower computer and an upgrading instruction according to a preset firmware upgrading transmission protocol; when the firmware upgrading file packet is successfully written into the external memory area of the target lower computer, stopping sending the firmware upgrading file packet according to the firmware upgrading transmission protocol, and checking the integrity of the firmware upgrading file packet; the target lower computer is used for calling the firmware upgrading file package according to the upgrading instruction and executing the upgrading program. Through the method and the device, the problems that the traditional mode is inconvenient for firmware upgrading, the existing network upgrading firmware is easy to cause upgrading failure and even damage to hardware in the environment with unstable and easily-disconnected network of the network are solved, the firmware is upgraded more conveniently and quickly through the network, and the reliability is high.
Drawings
In order to more clearly illustrate the technical solutions of the present application, the drawings needed to be used in the description of the present application will be briefly introduced below, and it is apparent that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive labor.
Fig. 1 is a flowchart illustrating steps of an upper computer of a firmware upgrading method according to an embodiment of the present application;
fig. 2 is a flowchart illustrating steps of a lower computer of a firmware upgrading method according to an embodiment of the present application;
FIG. 3 is a schematic structural diagram of an upper computer and a target lower computer in an embodiment of the present application;
FIG. 4 is a schematic diagram of a firmware upgrade in an embodiment of the present application;
FIG. 5 is a schematic diagram of a firmware upgrade in an embodiment of the present application;
fig. 6 is a schematic structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
In order to make the aforementioned objects, features and advantages of the present application more comprehensible, the present application is described in further detail with reference to the accompanying drawings and the detailed description. It is to be understood that the embodiments described are only a few embodiments of the present application and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that, in any embodiment of the present application, the upper computer (including but not limited to a server) performs a firmware upgrade on the lower computer (including a data collector (for short, a collector) and various subordinate terminal devices thereof); the lower computer comprises a collector and terminal equipment connected with the collector through a communication bus;
the firmware upgrade refers to a process of programming the MCU or the DSP. The programming method has various modes, mainly including (1) high-voltage programming: generally, high voltage (12V, 5V) is used, according to an operation mode on a data manual, a programming pin is enabled, a corresponding instruction is sent through an IIC or SPI bus protocol, a programming mode is entered, and a program is written into an MCU program memory. The method is to burn the bare chip MCU on a special burner, and is generally used in the mass production stage. (2) ICP: in Circuit programming, a program is updated without disassembling a chip, the chip is powered on only, the chip does not need to be In an executable program state, a bootstrap program does not need to be preset, the ICP hardware behavior is pure, other hardware equipment (such as NU-LINK and the like) is required to support, and the chip cannot update itself. (3) ISP: in System programming refers to programming on board level without detaching the chip and putting it In the burner, i.e. without leaving the System, so it is called "In System programming", which is erasing and writing the whole program, programming the Flash memory In the singlechip through the serial programming interface special for singlechip. Even if the chip is welded on the circuit board, the programming can be carried out by only reserving a serial port for connecting with an upper computer. This programming method needs to write ISP boot code to ISP program area of MCU in advance (this operation is usually done by MCU manufacturer), and is triggered by hardware method. After power-on, the target MCU starts from the ISP program area and executes the ISP code to detect whether ISP operation is needed. If necessary, the target MCU will receive data from the programmer or upper computer and write the data to the application program area by using the corresponding function and instruction of the ISP program area. After the ISP process is complete, the MCU will reboot from the application area to run the new application code. The ISP burning mode can be realized without detaching the chip, but the burning is required to be carried out on site. (4) IAP: in application programming, programming is also performed on a board level, the MCU acquires a new code and reprograms a certain part of a program, namely the program can be changed by using the program, one part of the program is modified to achieve the purposes of upgrading and removing bugs without influencing other parts of the system, the program can continue to run In the burning process, and In addition, an interface program is written by itself, so that remote upgrading can be performed without influencing application. (5) JTAG: JTAG is an abbreviation of Joint Test Action Group, is an international standard Test protocol (IEEE 1149.1 compatible) and is mainly used for chip internal Test. The standard JTAG interface is 4-wire: TMS, TCK, TDI, TDO, which are mode selection, clock, data input and data output lines, respectively, can be firmware burned and updated by using special IDE (such as MDK, IAR) to match with corresponding simulator (such as J-Link, U-Link, ST-Link, etc.). It is also a board-level burn-in without presetting program. (6) SWD: SWD is a more reliable firmware burning and updating mode than JTAG under the conditions of high speed and large data volume, and more importantly, the method occupies fewer MCU pins, namely only two signal lines of SWDIO and SWDCLK are needed, and then Vcc (not needed), GND and general four lines can complete most functions of JTAG. The method is also a board-level burn, does not need to preset programs, and only needs a commonly used IDE and an simulator supporting SWD. The firmware upgrade described in the present application refers to an implementation scheme of IAP.
Referring to fig. 1, a flowchart of steps of an upper computer of a firmware upgrading method according to an embodiment of the present application is shown; wherein the method involves an upper computer and a target lower computer; the upper computer stores a firmware upgrading file package used for upgrading the terminal equipment in the lower computer; the upper computer and the lower computer communicate through a preset firmware upgrading transmission protocol;
the upper computer executes the following steps:
s110, after the upper computer receives the firmware upgrading file packet, determining a target lower computer needing to be upgraded;
s120, the upper computer sends the firmware upgrading request to the target lower computer according to a preset firmware upgrading transmission protocol; the firmware upgrading request comprises a firmware upgrading file package and an upgrading instruction;
s130, when the firmware upgrading file packet is successfully written into the external memory area of the target lower computer, stopping sending the firmware upgrading file packet according to the firmware upgrading transmission protocol, and checking the integrity of the firmware upgrading file packet; the target lower computer is used for calling the firmware upgrading file package according to the upgrading instruction and executing the upgrading program.
When the firmware upgrading file packet is successfully written into the external memory area of the target lower computer, stopping sending the firmware upgrading file packet according to the firmware upgrading transmission protocol, and checking the integrity of the firmware upgrading file packet; the target lower computer is used for calling the firmware upgrading file package according to the upgrading instruction and executing an upgrading program; otherwise, when the writing is not successful, the transmission of the firmware upgrading file package fails, and whether the firmware version in the lower computer needs to be upgraded is inquired again; and the lower computer is used for calling the firmware upgrading file package and executing an upgrading program according to an upgrading instruction by corresponding target equipment in the lower computer when the transmission of the firmware upgrading file package is finished and the firmware upgrading file package is successfully written into the external memory area.
In the embodiment of the application, after the upper computer receives the firmware upgrading file packet, a target lower computer needing to be upgraded is determined; the upper computer sends the firmware upgrading file packet to the target lower computer and an upgrading instruction according to a preset firmware upgrading transmission protocol; when the firmware upgrading file packet is successfully written into the external memory area of the target lower computer, stopping sending the firmware upgrading file packet according to the firmware upgrading transmission protocol, and checking the integrity of the firmware upgrading file packet; the target lower computer is used for calling the firmware upgrading file package according to the upgrading instruction and executing the upgrading program. The method and the device solve the problems that the firmware is inconvenient to upgrade by a traditional mode, and the existing network upgrading firmware is easy to cause upgrading failure and even damage to hardware if the upgrading is easy to cause in an unstable and network-disconnected environment, so that the firmware is upgraded more conveniently and quickly by the network, and the reliability is high; because the firmware burning needs to be stable and reliable, the power-off re-burning, the interruption re-burning and the high validity of burning data are ensured.
Next, a method of implementing the input device indication icon in the present exemplary embodiment will be further described.
And step S110, after the upper computer receives the firmware upgrade file package, determining a target lower computer to be upgraded.
In an embodiment of the present application, a specific process of "determining a target lower computer that needs to be upgraded after the upper computer receives the firmware upgrade file package" in step S110 may be further described with reference to the following description.
After receiving the firmware upgrade file package, the upper computer inquires the firmware version numbers of the collector and the terminal equipment according to an upgrade information description table in the firmware upgrade file package and judges whether the firmware of the collector needs to be upgraded or not; if yes, verifying the integrity of a first patch for upgrading the firmware of the collector according to the first MD5 data in the firmware upgrading file package corresponding to the collector; and if not, determining that the terminal equipment is upgraded, and verifying the integrity of a second patch for upgrading the firmware of the terminal equipment according to the second MD5 data in the firmware upgrading file package corresponding to the terminal equipment.
As an example, for a firmware upgrade to be performed, the firmware is first transferred — from the server to the collector and from the collector to the device, which involves a problem with the communication interface. At present, UART, USB, SD, TCP and the like are common communication interfaces in embedded products. A cloud server needs to support a TCP communication interface (Ethernet remote upgrade), an upper computer needs to support a UART communication interface (RS232 and RS485 modes for realizing local upgrade), a collector product needs to simultaneously support firmware upgrade modes of a UART communication interface and a TCP communication interface, and a conditional collector can support firmware upgrade modes of a USB communication interface (a U disk) and an SD communication interface (an SD card). And for the collector and the terminal equipment, UART is uniformly adopted as a communication interface to carry out firmware upgrade.
As an example, the transmission of the firmware may further be through a UART interface protocol, the UART is the most common interface in the embedded environment, and the external representation generally includes RS232 and RS485, the former is used for performing point-to-point burning, and the latter can implement batch burning (not simultaneous burning). The interface can be used for transmitting files between the upper computer and the collector and between the collector and the equipment;
a UART interface between the upper computer and the collector; the upper computer matched with the collector ensures reliability and high speed. And in the aspect of upgrading the baud rate: for the rapid transmission of files, a baud rate higher than that of monitoring communication is adopted, and 115200bps is uniformly adopted. And in the aspect of upgrading commands: in order to keep the consistency with a TCP channel and reduce the code quantity of a data collector as much as possible, the description of several function codes from 0x21 to 0x25 in an upgrading command is only added with two bytes of data check, namely a CRC check mode of a Modbus RTU, at the tail of the requests and responses of the several function codes; and in the aspect of file transmission, a collector firmware transmission protocol is followed.
And if the upper computer in the step S120 sends the firmware upgrading request to the target lower computer according to a preset firmware upgrading transmission protocol.
In an embodiment of the present application, a specific process of the upper computer sending the firmware upgrade file package to the target lower computer and the upgrade instruction according to a preset firmware upgrade transmission protocol in step S120 may be further described with reference to the following description.
In an embodiment of the application, the upper computer sends an upgrade instruction, sends the firmware upgrade file package to the target lower computer according to a first function code in the firmware upgrade transmission protocol, and judges whether the firmware upgrade file package is successfully written into an external memory area of the target lower computer.
In a specific embodiment, the target lower computer comprises a collector and a terminal device connected with the collector through a communication bus; the method comprises the steps that the upper computer sends an upgrading instruction, sends a firmware upgrading file packet to the target lower computer according to a first function code in the firmware upgrading transmission protocol, and judges whether the firmware upgrading file packet is successfully written into an external memory area of the target lower computer or not, and comprises the following steps:
the upper computer sends an upgrading instruction and judges whether a firmware upgrading file package needs to be transmitted or not according to a 0x25 function code in the firmware upgrading transmission protocol; if yes, sending an upgrading instruction to the collector according to the 0x21 function code in the firmware upgrading transmission protocol; or sending an upgrade instruction to the terminal device according to the 0x22 function code in the firmware upgrade transmission protocol;
according to the 0x26 function code in the firmware upgrading transmission protocol, decomposing the firmware upgrading file packet into a plurality of data blocks, numbering the data blocks, sending the data blocks to the collector according to the numbers, and writing the data blocks into the external memory area of the collector;
and judging whether all data blocks are written into the external memory area according to the 0x27 function code in the firmware upgrading transmission protocol.
If the firmware upgrade file package is successfully written into the external memory area of the target lower computer in the step S130, terminating sending the firmware upgrade file package according to the firmware upgrade transmission protocol, and checking the integrity of the firmware upgrade file package; the target lower computer is used for calling the firmware upgrading file package according to the upgrading instruction and executing the upgrading program.
In an embodiment of the present application, the following description may be further applied to explain that, in step 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 for calling the firmware upgrading file package according to the upgrading instruction and executing the specific process of upgrading the program.
If the firmware upgrading file packet is successfully written, checking the firmware upgrading file packet according to a second function code in the firmware upgrading transmission protocol, and finishing sending the firmware upgrading file packet; if not, the firmware upgrading file package fails to be transmitted, and whether the firmware version in the lower computer needs to be upgraded or not is inquired again; and the lower computer is used for calling the firmware upgrading file package and executing an upgrading program according to an upgrading instruction by corresponding target equipment in the lower computer when the transmission of the firmware upgrading file package is finished and the firmware upgrading file package is successfully written into the external memory area.
Checking whether the firmware upgrading file packet corresponding to the collector in the external memory area is complete or not according to the 0x28 function code in the firmware upgrading transmission protocol, and finishing sending if the firmware upgrading file packet is complete;
if the firmware upgrade file package is successfully written into the external memory area of the target lower computer in the step S130, terminating sending the firmware upgrade file package according to the firmware upgrade transmission protocol, and checking the integrity of the firmware upgrade file package; the target lower computer is used for calling the firmware upgrading file package according to the upgrading instruction and executing the upgrading program.
In an 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 through a communication bus; when the firmware upgrading file packet is successfully written into the external memory area of the target lower computer, the steps of stopping sending the firmware upgrading file packet according to the firmware upgrading transmission protocol and checking the integrity of the firmware upgrading file packet comprise;
according to the 0x28 function code in the firmware upgrading transmission protocol, checking whether the firmware upgrading file packet corresponding to the collector in the external memory area is complete, and if so, ending the transmission;
in an 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 through a communication bus; when the firmware upgrading file packet is successfully written into the external memory area of the target lower computer, the steps of stopping sending the firmware upgrading file packet according to the firmware upgrading transmission protocol and checking the integrity of the firmware upgrading file packet comprise;
according to the 0x28 function code in the firmware upgrading transmission protocol, checking whether the firmware upgrading file packet corresponding to the terminal equipment in the external memory area is complete or not, and executing the next step;
starting an Xmodem-1K protocol preset in the collector, and sending the corresponding firmware upgrade package to the terminal equipment according to the Xmodem-1K protocol;
and when all bytes of the firmware upgrade package are completely transmitted, sending an ending instruction for ending sending the firmware upgrade file package.
In an embodiment of the present application, referring to fig. 2, a flowchart illustrating steps of a lower computer of a firmware upgrade method according to an embodiment of the present application is shown; the method involves an upper computer and a target lower computer; the upper computer stores a firmware upgrading file package used for upgrading the terminal equipment in the lower computer; the upper computer and the lower computer communicate through a preset firmware upgrading transmission protocol;
the lower computer executes the following steps:
s210, when the target lower computer receives a firmware upgrading request, the target lower computer writes the firmware upgrading file packet into an external memory area according to a preset firmware upgrading 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 an upgrade instruction, sends the firmware upgrade file packet according to a preset firmware upgrade transmission protocol, and writes the firmware upgrade file packet into an external memory area;
s220, when the firmware upgrading file package is successfully written into the external memory area, the target lower computer calls the firmware upgrading file package according to an upgrading instruction and executes an upgrading program; and when the transmission of the firmware upgrading file package is finished and the firmware upgrading file package is successfully written into the external memory area, the target lower computer calls the firmware upgrading file package and executes an upgrading program according to an upgrading instruction, and specifically, when the transmission of the firmware upgrading file package is finished and the firmware upgrading file package is successfully written into the external memory area, the corresponding target equipment in the target lower computer calls the firmware upgrading file package and executes the upgrading program according to the upgrading instruction.
In an embodiment of the present application, when the upper computer queries that the firmware version of the target lower computer needs to be upgraded, the target lower computer receives an upgrade instruction, sends the firmware upgrade file package according to a preset firmware upgrade transmission protocol, and writes the firmware upgrade file package into the external memory area, including:
when the upper computer inquires that the firmware version needs to be upgraded and the firmware integrity verification is completed, the target lower computer receives the firmware upgrading file packet sent by the upper computer according to the first function code in the firmware upgrading transmission protocol and writes the firmware upgrading file packet into an external memory area.
In an embodiment of the 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; when the transmission of the firmware upgrading file package is finished and the firmware upgrading file package is successfully written into the external memory area, the target lower computer calls the firmware upgrading file package according to an upgrading instruction and executes an upgrading process, and the method comprises the following steps:
judging the validity of the upgrading instruction according to the first function code, and analyzing the firmware upgrading file packet to obtain a patch file in a binary format; the patch file is a first patch or a second patch; when the patch file is a first patch, downloading the first patch to the internal storage area, calling a preset guide instruction in the BOOT area according to the upgrading instruction, and erasing original data of the functional area; and calling the first patch into the functional area, and merging the first patch with the original version firmware to generate a new version firmware corresponding to the collector.
In an embodiment of the application, the lower computer includes a collector and a terminal device connected with 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 equipment in the lower computer calls the firmware upgrading file package according to the upgrading instruction and executes the upgrading program, and the method comprises the following steps: judging the validity of the upgrading instruction according to the first function code, and analyzing the firmware upgrading file packet to obtain a patch file in a binary format; the patch file is a first patch or a second patch; and when the patch file is a second patch, transmitting the second patch to the terminal equipment according to a preset Xmodem-1K protocol, and monitoring the upgrading progress according to a 0x23 function code in the firmware upgrading transmission protocol.
As an example, firmware upgrading is performed on the terminal equipment, and in order to guarantee upgrading reliability, the protocol is simple and universal; and in the aspect of upgrading the baud rate: the baud rate that can be supported by the device is followed, and the baud rate of the device monitoring communication is kept consistent under the general condition. If the baud rate is inconsistent, the user gives the appointed baud rate on the cloud server or the upper computer. And in the aspect of upgrading commands, a Modbus RTU protocol is adopted. The file transfer protocol adopts a serial port file transfer protocol-Xmodem-1K which is known in the industry, is simple and universal, is convenient to keep compatible with most devices, and is convenient for client transplantation.
In a specific implementation, since firmware burning needs to be stable and reliable, power-off re-burning, interruption re-burning and high validity of burning data are realized, and an IAP burning scheme generally divides an MCU into three areas: a Boot area (usually called Boot Loader, hereinafter referred to as Boot area), a functional area (usually called Application, hereinafter referred to as APP area), and an internal storage area (hereinafter referred to as STORE area).
When the program runs, the MCU downloads the firmware to be updated to the STORE area through various communication pipelines, the system resets to the BOOT area after the downloading is finished and the verification is passed, the bootstrap program copies the content of the STORE area to the APP area, and then the MCU jumps to the APP area to execute new firmware, thereby completing the whole IAP process.
In the application, the collectors are all provided with external Flash with 8M bytes and can be used as the STORE area. Flash of the MCU can be divided into a BOOT area and an APP area. The BOOT only does one thing, namely, whether new firmware needs to be updated in the STORE area is judged, if yes, the content of the APP area is completely erased, then the new firmware in the STORE area is read batch by batch and written into the APP area, and the BOOT jumps to the APP area after the completion; and the APP area is internally provided with real function codes, runs a user program and checks whether a firmware upgrading instruction arrives in real time or at regular time.
The code of the BOOT area needs to be burnt in through a high-voltage burning or SWD mode, the code of the APP area can be burnt together with the code of the BOOT area, and then the program needs to be updated through a BOOT program of the BOOT.
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 in the BOOT area is arranged in the start area of Flash, and immediately after the code in the APP area begins to execute, it is first necessary to map the interrupt vector table of the CPU to its own vector table, and then perform other operations. In addition, the STM32 automatically sets write protection for the first 4 pages of the user Flash area while performing read protection for the Flash area, so that the BOOT code can be effectively prevented from being accidentally damaged.
In the application, the STORE area is planned in advance and is well backwards compatible; the BOOT area is as simple as possible, has single function and occupies the least code space; the APP area is used for downloading the firmware, and the conventional bottom layer driver is provided on the service function, so that the conventional bottom layer driver is used as common as possible, various drivers are not placed in the BOOT area, and the code amount is reduced.
As an example, the external storage area is external 8 mbyte Flash, which is planned as follows (the unit of capacity allocated to each area is "byte");
Figure BDA0003324695030000151
Figure BDA0003324695030000161
for the device embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.
3-4, a firmware upgrade device provided by an embodiment of the present application is shown; the device relates to an upper computer 2 and a target lower computer 1; the upper computer 2 stores a firmware upgrading file package for upgrading the terminal equipment 11 in the lower computer 1; the upper computer 2 and the lower computer 1 communicate through a preset firmware upgrading transmission protocol; the lower computer 1 comprises a collector 10 and a terminal device 11 connected with 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; the method specifically comprises the following steps:
the query and verification module 110 is used for querying 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 verifying the integrity of the firmware upgrade file package;
the firmware transmission module 120 is configured to send the firmware upgrade file packet to a lower computer according to a first function code in the firmware upgrade transmission protocol if the firmware upgrade is required and the verification passes, and determine whether the firmware upgrade file packet is successfully written into an external memory area of the lower computer;
a first upgrade execution module 130, configured to check the firmware upgrade file package according to the second function code in the firmware upgrade transmission protocol if the write is successful, and end sending the firmware upgrade file package; if not, the firmware upgrading file package fails to be transmitted, and whether the firmware version in the lower computer needs to be upgraded or not is inquired again; and the lower computer is used for calling the firmware upgrading file package and executing an upgrading program according to an upgrading instruction by corresponding target equipment in the lower computer when the transmission of the firmware upgrading file package is finished and the firmware upgrading file package is successfully written into the external memory area.
In an embodiment of the present application, the data receiving unit 110 includes: the verification submodule is used for inquiring the firmware version numbers of the collector 10 and the terminal equipment 11 according to the upgrading information description table in the firmware upgrading file packet and judging whether the firmware of the collector 10 needs to be upgraded or not; if yes, verifying the integrity of a first patch for upgrading the firmware of the collector 10 according to the first MD5 data in the firmware upgrading file package corresponding to the collector 10; if not, determining that the terminal device 11 is upgraded, and verifying the integrity of a second patch for upgrading 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.
In an embodiment of the present application, the firmware transmission module 120 includes: the transmission submodule is used for judging whether a firmware upgrading file package needs to be transmitted or not according to the 0x25 function code in the firmware upgrading transmission protocol; if yes, sending an upgrade instruction to the collector 10 according to the 0x21 function code in the firmware upgrade transmission protocol; or, sending an upgrade instruction to the terminal device 11 according to the 0x22 function code in the firmware upgrade transmission protocol;
the analysis submodule is used for decomposing the firmware upgrade file packet into a plurality of data blocks according to the 0x26 function code in the firmware upgrade transmission protocol, numbering the data blocks, sending the data blocks to the collector 10 according to the numbers, and writing the data blocks into an external memory area of the collector 10;
and the judging submodule is used for judging whether all the data blocks are written into the external memory area according to the 0x27 function code in the firmware upgrading transmission protocol.
In an embodiment of the present application, the first upgrade execution module 130 includes a first checking submodule, configured to check whether the firmware upgrade file package corresponding to the collector 10 in the external memory area is complete according to a 0x28 function code in the firmware upgrade transmission protocol, and if so, end sending;
in an embodiment of the present application, the first upgrade execution module 130 further includes a second check sub-module, configured to check whether the firmware upgrade file package corresponding to the terminal device 11 in the external memory area is complete according to a 0x28 function code in the firmware upgrade transmission protocol, and then execute the next step; starting an Xmodem-1K protocol preset in the collector 10, and sending the corresponding firmware upgrade package to the terminal device 11 according to the Xmodem-1K protocol; and when all bytes of the firmware upgrade package are completely transmitted, sending an ending instruction for ending sending the firmware upgrade file package.
In an embodiment of the present application, for the external memory area of the collector 10, a memory with a USB interface may also be used, and the recording and upgrading may be performed through the USB interface; the general process of firmware burning through the USB interface is as follows: (1) the collector 10 identifies whether a USB flash disk is inserted, and if so, the next step is carried out; (2) detecting whether a folder named by the corresponding collector 10 or equipment exists under the U packing directory, such as SmartBox, Inverter and the like, and if so, entering the next step; (3) detecting whether corresponding firmware exists under the directory, judging the file name of the firmware by referring to the firmware name regulation, and if so, entering the next step; (4) detecting the integrity of the firmware, copying the firmware to a corresponding area of an external Flash if the firmware is suitable for upgrading, and then entering the next step; (5) and updating the information area of the external Flash, restarting the system to enter a BOOT program, and starting the firmware updating operation of the collector 10 or the equipment firmware updating operation.
In an embodiment of the present application, the external memory area of the collector 10 may also be a memory with an SD interface, where the difference between the SD interface and the USB interface is different from the file system, and identification and reading of files follow the relevant interface specifications, and a general process of firmware burning is performed through an SD card, which is similar to the USB interface and is not described again.
The upper computer judges the upgrading target and the firmware validity check according to the operation of the user interface, and then performs the firmware transmission operation according to the function codes between 0x21 and 0x 29. In the present application, in the firmware transmission phase, the collector 10 should not stop polling the monitoring data of the subordinate devices, and simultaneously needs to receive the query and setting of various parameters from the upper computer.
In an embodiment of the present application, the internal storage area is an internal Flash, the internal Flash is divided into a BOOT area and an APP area, although MCU models of the respective collectors 10 are different, functions of the BOOT area are completely the same, codes can be basically shared, and program size can be measured, so that the size of the BOOT area is planned here — limited to 16 kbytes. In addition, the BOOT area is executed from the first address of the user Flash area.
Referring to fig. 3 and 5, a firmware upgrade apparatus provided by an embodiment of the present application is illustrated; the device relates to an upper computer and a target lower computer; the upper computer stores a firmware upgrading file package used for upgrading the terminal equipment 11 in the lower computer; the upper computer and the lower computer communicate through a preset firmware upgrading transmission protocol; the device comprises:
the firmware receiving module 210 is configured to, when the upper computer queries whether the firmware version needs to be upgraded and completes firmware integrity verification, receive the firmware upgrade file packet sent by the upper computer according to the first function code in the firmware upgrade transmission protocol, and write the firmware upgrade file packet into an external memory area;
and the second upgrade execution module 220 is configured to, when the transmission of the firmware upgrade file package is finished and the firmware upgrade file package is successfully written into the external memory area, invoke the firmware upgrade file package and execute an upgrade program according to an upgrade instruction by using a corresponding target device in the lower computer.
In an embodiment of the present application, the second upgrade execution module 220 includes a first parsing submodule, configured to determine validity of the upgrade instruction according to a first function code, and parse the firmware upgrade file package to obtain a patch file in a binary format; the patch file is a first patch or a second patch;
the first upgrading sub-module is used for downloading the first patch to the internal storage area when the patch file is the first patch, calling a preset guide instruction in the BOOT area according to the upgrading instruction, and erasing original data of the functional area; and calling the first patch into the functional area, and merging the first patch with the original version firmware to generate a new version firmware corresponding to the collector 10.
In an embodiment, the basic upgrade process of the firmware of the collector 10 (including the firmware of the subordinate terminal device 11 connected thereto) is as follows: (1) the collector 10 works in a functional area (APP area), and receives a firmware upgrading starting instruction of an upper computer through a communication pipeline; (2) the collector 10 judges the effectiveness of the upgrading instruction, analyzes whether to upgrade the collector 10 or upgrade subordinate equipment, marks the upgrading instruction and gives corresponding response to an upper computer; (3) if the firmware of the external Flash is upgraded, the firmware transmitted from the upper computer is received according to a firmware transmission protocol of the collector, the firmware is stored in a collector firmware area of the external Flash (namely an external storage area), the system is restarted after the upgrade information area of the external Flash is verified and updated, the system is switched to a BOOT program area (BOOT area), the collector firmware in the external Flash is verified again firstly (the verification is carried out according to an MD5 value to prevent the firmware from being damaged in the power-off process), then the APP area is erased, and finally the collector firmware after the encryption area is removed is copied to the APP area to complete the upgrade.
In an embodiment of the present application, the second upgrade execution module 220 further includes a second upgrade submodule, configured to, when the patch file is a second patch, transmit the second patch to the terminal device 11 according to a preset Xmodem-1K protocol, and monitor an upgrade progress according to a 0x23 function code in the firmware upgrade transmission protocol.
In an embodiment, the basic upgrade flow of the firmware (necessarily a binary file with a suffix of ". bin") of the subordinate device (terminal device 11) of the collector 10 is as follows: (1) the collector 10 works in a functional area (APP area) and receives a firmware upgrading starting instruction of an upper computer through a communication channel; (2) the collector 10 judges the effectiveness of the upgrading instruction, analyzes whether to upgrade the collector 10 or the subordinate terminal equipment 11, marks the upgrading instruction and gives corresponding response to the upper computer; if the firmware of the terminal equipment 11 is upgraded, the firmware transmitted from the upper computer is received according to the collector firmware transmission protocol, the firmware is stored in an equipment firmware area of the external Flash (external memory area), and after the verification is completed and the upgrade information area of the external Flash is updated, an upgrade instruction is sent to the corresponding subordinate equipment and the firmware is transmitted.
In an embodiment of the present application, a firmware upgrading system is disclosed, referring to fig. 3, the system relates to an upper computer 2 and a target lower computer 1; the upper computer 2 stores a firmware upgrading file package for upgrading the terminal equipment 11 in the lower computer 1; the upper computer 2 and the lower computer 1 communicate through a preset firmware upgrading transmission protocol; the target lower computer 1 comprises a collector 10 and a terminal device 11 connected with the collector 1 through a communication bus 18; the system comprises:
the upper computer 2 executes the following steps:
after the upper computer 2 receives the firmware upgrading file package, determining a target lower computer 1 needing to be upgraded;
the upper computer 2 sends the firmware upgrading file package to the target lower computer 1 and an upgrading instruction according to a preset firmware upgrading transmission protocol;
when the firmware upgrading file packet is successfully written into the external memory area of the target lower computer 1, stopping sending the firmware upgrading file packet according to the firmware upgrading transmission protocol, and checking the integrity of the firmware upgrading file packet; the target lower computer 1 is used for calling the firmware upgrading file package according to an upgrading instruction and executing an upgrading program;
the target lower computer 1 executes the following steps:
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 an upgrading instruction, sends the firmware upgrading file packet according to a preset firmware upgrading transmission protocol, and writes the firmware upgrading file packet into an external memory area;
and when the transmission of the firmware upgrading file package is finished and the firmware upgrading file package is successfully written into the external memory area, the target lower computer 1 calls the firmware upgrading file package according to an upgrading instruction and executes an upgrading program.
It should be noted that, in any embodiment of the present application, the upgrade information description table is shown as the following table:
Figure BDA0003324695030000211
Figure BDA0003324695030000221
referring to fig. 6, a computer device for implementing an input device indication icon according to the present application is shown, which may specifically include the following:
the computer device 12 described above is embodied 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 that couples various system components including the memory 28 and the processing unit 16.
Bus 18 represents one or more of any of several types of bus 18 structures, including a memory bus 18 or memory controller, a peripheral bus 18, an accelerated graphics port, and a processor or local bus 18 using any of a variety of bus 18 architectures. By way of example, such architectures include, but are not limited to, Industry Standard Architecture (ISA) bus 18, micro-channel architecture (MAC) bus 18, enhanced ISA bus 18, audio Video Electronics Standards Association (VESA) local bus 18, and Peripheral Component Interconnect (PCI) bus 18.
Computer device 12 typically includes a variety of computer system readable media. Such media may be any available media that is accessible by computer device 12 and includes both volatile and nonvolatile media, removable and non-removable media.
The 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/nonvolatile computer system storage media. By way of example only, storage system 34 may be used to read from and write to non-removable, nonvolatile magnetic media (commonly referred to as "hard drives"). Although not shown in FIG. 3, a magnetic disk drive for reading from and writing to a removable, nonvolatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, nonvolatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 18 by one or more data media interfaces. The memory may include at least one program product having a set (e.g., at least one) of program modules 42, with the program modules 42 configured to carry out the functions of embodiments of the application.
A program/utility 40 having a set (at least one) of program modules 42 may be stored, for example, in 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 examples or some combination thereof may comprise an implementation of a network environment. Program modules 42 generally perform the functions and/or methodologies of the embodiments described herein.
Computer device 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, camera, etc.), with one or more devices that enable an operator to interact with computer device 12, and/or with any devices (e.g., network card, modem, etc.) that enable computer device 12 to communicate with one or more other computing devices. Such communication may be through the I/O interface 22. Also, computer device 12 may communicate with one or more networks (e.g., a Local Area Network (LAN)), a Wide Area Network (WAN), and/or a public network (e.g., the Internet) via network adapter 20. As shown in FIG. 3, the network adapter 20 communicates with the other modules of the computer device 12 via the bus 18. It should be appreciated that although not shown in FIG. 3, other hardware and/or software modules may be used in conjunction with 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.
The processing unit 16 executes various functional applications and data processing by executing programs stored in the memory 28, for example, implementing a firmware upgrading method provided by the embodiment of the present application.
That is, the processing unit 16 implements, when executing the program,: after the upper computer receives the firmware upgrading file package, determining a target lower computer needing to be upgraded; the upper computer sends the firmware upgrading file packet to the target lower computer and an upgrading instruction according to a preset firmware upgrading transmission protocol; when the firmware upgrading file packet is successfully written into the external memory area of the target lower computer, stopping sending the firmware upgrading file packet according to the firmware upgrading transmission protocol, and checking the integrity of the firmware upgrading file packet; the target lower computer is used for calling the firmware upgrading file package according to the upgrading instruction and executing the upgrading program.
The processing unit 16 implements, when executing the program: when the upper computer inquires that the firmware version of the target lower computer needs to be upgraded, the target lower computer receives an upgrading instruction, sends the firmware upgrading file packet according to a preset firmware upgrading transmission protocol, and writes the firmware upgrading file packet into an external memory area; and when the transmission of the firmware upgrading file package is finished and the firmware upgrading file package is successfully written into the external memory area, the target lower computer calls the firmware upgrading file package according to an upgrading instruction and executes an upgrading program.
In an embodiment of the present application, there is also provided a computer-readable storage medium, on which a computer program is stored, which when executed by a processor, implements a firmware upgrade method as provided in all embodiments of the present application.
That is, the program when executed by the processor implements: after the upper computer receives the firmware upgrading file package, determining a target lower computer needing to be upgraded; the upper computer sends the firmware upgrading file packet to the target lower computer and an upgrading instruction according to a preset firmware upgrading transmission protocol; when the firmware upgrading file packet is successfully written into the external memory area of the target lower computer, stopping sending the firmware upgrading file packet according to the firmware upgrading transmission protocol, and checking the integrity of the firmware upgrading file packet; the target lower computer is used for calling the firmware upgrading file package according to the upgrading instruction and executing the upgrading program.
The processing unit 16 implements, when executing the program: when the upper computer inquires that the firmware version of the target lower computer needs to be upgraded, the target lower computer receives an upgrading instruction, sends the firmware upgrading file packet according to a preset firmware upgrading transmission protocol, and writes the firmware upgrading file packet into an external memory area; and when the transmission of the firmware upgrading file package is finished and the firmware upgrading file package is successfully written into the external memory area, the target lower computer calls the firmware upgrading file package according to an upgrading instruction and executes an upgrading program.
Any combination of one or more computer-readable media may be employed. The 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 electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an input execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an input execution system, apparatus, or device.
Computer program code for carrying out operations for aspects of the present application may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the operator's computer, partly on the operator's computer, as a stand-alone software package, partly on the operator's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may 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 the connection may be made to an external computer (for example, through the Internet using an Internet service provider). The embodiments in the present specification are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
While preferred embodiments of the present application have been described, additional variations and modifications of these embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including the preferred embodiment and all such alterations and modifications as fall within the true scope of the embodiments of the application.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or terminal. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or terminal that comprises the element.
The method, the apparatus, the device and the storage medium for implementing the indication icon of the input device provided by the present application are introduced in detail, and a specific example is applied in the present application to explain the principle and the implementation of the present application, and the description of the above embodiment is only used to help understanding the method and the core idea of the present application; meanwhile, for a person skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (10)

1. A firmware upgrading method is characterized in that the method relates to an upper computer and a target lower computer; a firmware upgrading file packet for upgrading the lower computer is stored in the upper computer;
the upper computer executes the following steps:
after the upper computer receives the firmware upgrading file package, determining a target lower computer needing to be upgraded;
the upper computer sends the firmware upgrading request to the target lower computer according to a preset firmware upgrading transmission protocol; the firmware upgrading request comprises a firmware upgrading file package and an upgrading instruction;
when the firmware upgrading file packet is successfully written into the external memory area of the target lower computer, stopping sending the firmware upgrading file packet according to the firmware upgrading transmission protocol, and checking the integrity of the firmware upgrading file packet; the target lower computer is used for calling the firmware upgrading file package according to the upgrading instruction and executing the upgrading program.
2. The method of claim 1, further comprising:
after the upper computer receives the firmware upgrading file package, inquiring firmware version numbers of the collector and the terminal equipment according to an upgrading information description table in the firmware upgrading file package, and judging whether the firmware of the collector needs to be upgraded or not;
if yes, verifying the integrity of a first patch for upgrading the firmware of the collector according to the first MD5 data in the firmware upgrading file package corresponding to the collector;
and if not, determining that the terminal equipment is upgraded, and verifying the integrity of a second patch for upgrading the firmware of the terminal equipment according to the second MD5 data in the firmware upgrading file package corresponding to the terminal equipment.
3. The method according to claim 1, wherein the step of sending the firmware upgrade request to the target lower computer by the upper computer according to a preset firmware upgrade transmission protocol comprises:
the upper computer generates an upgrading instruction according to the firmware upgrading file packet;
the upper computer determines a function code of the firmware upgrading transmission protocol according to the upgrading instruction and the firmware upgrading file packet;
the upper computer sends an upgrading instruction and judges whether a firmware upgrading file package needs to be transmitted or not according to a 0x25 function code in the firmware upgrading transmission protocol; if so,
sending an upgrade instruction to the collector according to the 0x21 function code in the firmware upgrade transmission protocol; or sending an upgrade instruction to the terminal device according to the 0x22 function code in the firmware upgrade transmission protocol;
according to the 0x26 function code in the firmware upgrading transmission protocol, decomposing the firmware upgrading file packet into a plurality of data blocks, numbering the data blocks, sending the data blocks to the collector according to the numbers, and writing the data blocks into the external memory area of the collector;
and judging whether all data blocks are written into the external memory area according to the 0x27 function code in the firmware upgrading transmission protocol.
4. The method of claim 1, wherein the target lower computer comprises a collector and a terminal device connected with the collector through a communication bus; when the firmware upgrading file packet is successfully written into the external memory area of the target lower computer, the steps of stopping sending the firmware upgrading file packet according to the firmware upgrading transmission protocol and checking the integrity of the firmware upgrading file packet comprise;
according to the 0x28 function code in the firmware upgrading transmission protocol, checking whether the firmware upgrading file packet corresponding to the collector in the external memory area is complete, and if so, ending the transmission;
or the like, or, alternatively,
according to the 0x28 function code in the firmware upgrading transmission protocol, checking whether the firmware upgrading file packet corresponding to the terminal equipment in the external memory area is complete or not, and executing the next step;
starting an Xmodem-1K protocol preset in the collector, and sending the corresponding firmware upgrade package to the terminal equipment according to the Xmodem-1K protocol;
and when all bytes of the firmware upgrade package are completely transmitted, sending an ending instruction for ending sending the firmware upgrade file package.
5. A firmware upgrading method is characterized in that the method relates to an upper computer and a target lower computer; the upper computer stores a firmware upgrading file package for upgrading the target lower computer;
the target lower computer executes the following steps:
when the target lower computer receives a firmware upgrading request, the target lower computer writes the firmware upgrading file packet into an external memory area according to a preset firmware upgrading transmission protocol;
and when the firmware upgrading file packet is successfully written into the external memory area, the target lower computer calls the firmware upgrading file packet according to the upgrading instruction and executes an upgrading program.
6. The method of claim 5, wherein the target lower computer comprises a collector and a terminal device connected with the collector through a communication bus; the collector is provided with an internal storage area, a BOOT area and a functional area; when the transmission of the firmware upgrading file package is finished and the firmware upgrading file package is successfully written into the external memory area, the target lower computer calls the firmware upgrading file package according to an upgrading instruction and executes an upgrading program, and the method comprises the following steps:
judging the validity of the upgrading instruction according to the first function code, and analyzing the firmware upgrading file packet to obtain a patch file in a binary format; the patch file is a first patch or a second patch;
when the patch file is a first patch, downloading the first patch to the internal storage area, calling a preset guide instruction in the BOOT area according to the upgrading instruction, and erasing original data of the functional area;
calling the first patch into the functional area, and merging the first patch with the original version firmware to generate a new version firmware corresponding to the collector;
or the like, or, alternatively,
and when the patch file is a second patch, transmitting the second patch to the terminal equipment according to a preset Xmodem-1K protocol, and monitoring the upgrading progress according to a 0x23 function code in the firmware upgrading transmission protocol.
7. A firmware upgrading device is characterized in that the device relates to an upper computer and a target lower computer; a firmware upgrading file packet for upgrading the lower computer is stored in the upper computer;
the device comprises:
the target determining module is used for determining a target lower computer needing to be upgraded after the upper computer receives the firmware upgrading file packet;
the data sending module is used for sending the firmware upgrading request to the target lower computer by the upper computer according to a preset firmware upgrading transmission protocol; the firmware upgrading request comprises a firmware upgrading file package and an upgrading instruction;
the file verification module is used for terminating sending the firmware upgrading file packet according to the firmware upgrading transmission protocol and checking the integrity of the firmware upgrading file packet when the firmware upgrading file packet is successfully written into the external memory area of the target lower computer; the target lower computer is used for calling the firmware upgrading file package according to the upgrading instruction and executing the upgrading program.
8. A firmware upgrading device is characterized in that the device relates to an upper computer and a target lower computer; the upper computer stores a firmware upgrading file package for upgrading the target lower computer;
the device comprises:
the data receiving module is used for writing the firmware upgrading file packet into an external memory area by the target lower computer according to a preset firmware upgrading transmission protocol when the target lower computer receives a firmware upgrading request;
and the upgrading execution module is used for calling the firmware upgrading file packet and executing an upgrading program by the target lower computer according to the upgrading instruction when the firmware upgrading file packet is successfully written into the external memory area.
9. A firmware upgrading system is characterized in that the system relates to an upper computer and a target lower computer; a firmware upgrading file packet for upgrading the lower computer is stored in the upper computer;
the upper computer executes the following steps:
after the upper computer receives the firmware upgrading file package, determining a target lower computer needing to be upgraded;
the upper computer sends the firmware upgrading request to the target lower computer according to a preset firmware upgrading transmission protocol; the firmware upgrading request comprises a firmware upgrading file package and an upgrading instruction;
when the firmware upgrading file packet is successfully written into the external memory area of the target lower computer, stopping sending the firmware upgrading file packet according to the firmware upgrading transmission protocol, and checking the integrity of the firmware upgrading file packet; the target lower computer is used for calling the firmware upgrading file package according to the upgrading instruction and executing an upgrading program;
the target lower computer executes the following steps:
when the target lower computer receives a firmware upgrading request, the target lower computer writes the firmware upgrading file packet into an external memory area according to a preset firmware upgrading transmission protocol;
and when the firmware upgrading file packet is successfully written into the external memory area, the target lower computer calls the firmware upgrading file packet according to the upgrading instruction and executes an upgrading program.
10. An electronic device and computer-readable storage medium, comprising a processor, a computer-readable storage medium, and a computer program stored on the storage medium and executable on the processor, the computer program, when executed by the processor, implementing the method of any one of claims 1 to 6.
CN202111258422.5A 2021-10-27 2021-10-27 Firmware upgrading method, device and system, electronic equipment and storage medium Pending CN113900693A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111258422.5A CN113900693A (en) 2021-10-27 2021-10-27 Firmware upgrading method, device and system, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111258422.5A CN113900693A (en) 2021-10-27 2021-10-27 Firmware upgrading method, device and system, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN113900693A true CN113900693A (en) 2022-01-07

Family

ID=79026478

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111258422.5A Pending CN113900693A (en) 2021-10-27 2021-10-27 Firmware upgrading method, device and system, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113900693A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116149713A (en) * 2023-04-19 2023-05-23 广州擎天实业有限公司 Program upgrading method and device for all-level equipment under tree-type heterogeneous network

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116149713A (en) * 2023-04-19 2023-05-23 广州擎天实业有限公司 Program upgrading method and device for all-level equipment under tree-type heterogeneous network
CN116149713B (en) * 2023-04-19 2023-12-15 广州擎天实业有限公司 Program upgrading method and device for all-level equipment under tree-type heterogeneous network

Similar Documents

Publication Publication Date Title
CN108847950B (en) Electronic device, cloud system software automatic deployment method and storage medium
US9804832B2 (en) Method, apparatus, and communication device for updating firmware
US10002054B2 (en) Method and system for performing automatic system recovery
CN103559052B (en) The apparatus and method for that firmware updates
US8949205B2 (en) Information processing apparatus for processing application software and a patch file
CN101330399A (en) Method for upgrading built-in equipment
CN101807152B (en) Basic output and input system for self verification of selection read only memory and verification method thereof
US20150347153A1 (en) System management controller and method of configuration file backup and recovery
CN105760191A (en) Embedded system equipment programming mass production method
CN101620542B (en) Compatible updating method of ultrasonic imaging equipment software data
CN110597544A (en) Software system upgrading method and device
CN112152846B (en) Metering instrument remote upgrading method based on Internet of things
WO2007056343A2 (en) Networked linux machine and windows software development system
CN113900693A (en) Firmware upgrading method, device and system, electronic equipment and storage medium
CN104036193A (en) Local cross-domain vulnerability detection method and device for application program
CN114816491A (en) System upgrading method and device for multi-system mobile terminal and terminal
CN113064610A (en) Method, device and medium for updating BIOS
CN111782236A (en) System software upgrading method and device, storage medium and all-in-one machine equipment
CN110825421A (en) Firmware upgrading method and system and readable storage medium
CN113849269A (en) Method and device for adding GPU (graphics processing Unit) resources in virtual machine
CN114116027A (en) Method, system, terminal and storage medium for automatically installing drive for PCIE equipment
CN114527994A (en) Firmware programming method and system and vehicle control system
TWI760691B (en) Method, test device and system for automatically testing software compatibility
CN114185561A (en) Firmware burning method, device and system for split type 5G/V2X equipment
CN115774561A (en) Application program upgrading method, electronic equipment, chip and readable storage medium

Legal Events

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