Disclosure of Invention
Therefore, the invention aims to provide a firmware upgrading method, device, equipment and medium applied to a multi-singlechip control system, so as to reduce the difficulty in upgrading the firmware of the singlechip and facilitate the upgrading and maintenance of the multi-singlechip control system by staff. The specific scheme is as follows:
a firmware upgrading method applied to a multi-singlechip control system, wherein the multi-singlechip control system comprises the following steps: the system comprises a main singlechip and a plurality of sub singlechips connected with the main singlechip; each singlechip is provided with a firmware starting module for guiding the singlechip to start, an application program module for storing an application program, an information storage module for storing attribute information of the application program module and a backup module for backing up and storing the application program; comprising the following steps:
When the main singlechip receives a firmware upgrading instruction of an upper computer, searching a target singlechip corresponding to the firmware upgrading instruction, setting an upgrading mark for an information storage module of the target singlechip, and resetting and restarting the target singlechip;
when the target singlechip runs a firmware starting module of the target singlechip and detects that the target singlechip is provided with the upgrading mark, backing up the current application program of the target singlechip to a backup module of the target singlechip, and acquiring a target upgrading program from the upper computer;
when the target singlechip acquires the target upgrading program, storing the target upgrading program into an application program module of the target singlechip, clearing the upgrading mark, and resetting and restarting the target singlechip;
When the target singlechip runs a firmware starting module of the target singlechip and the upgrading mark is detected to be cleared, verifying the target upgrading program;
And if the target upgrading program passes the verification, the target upgrading program is operated.
Preferably, the target single-chip microcomputer comprises the main single-chip microcomputer and the sub single-chip microcomputer.
Preferably, after the process of verifying the target upgrade program, the method further includes:
If the target upgrading program does not pass the verification, the current application program of the target singlechip is read from the backup module of the target singlechip, and is stored into the information storage module of the target singlechip, and reset and restarted.
Preferably, after the process of running the target upgrade program, the method further includes:
if the target singlechip receives a new firmware upgrading instruction, setting the upgrading mark for an information storage module of the target singlechip, and resetting and restarting the target singlechip.
Preferably, the method further comprises;
when the upper computer needs to upgrade the firmware of the target singlechip, downloading the target upgrade program and checking the target upgrade program;
And if the target upgrading program passes the verification, the target upgrading program is sent to the main singlechip.
Preferably, the process of downloading the target upgrade program includes:
And downloading the target upgrading program by using a YModem protocol.
Correspondingly, the invention also discloses a firmware upgrading device applied to the multi-singlechip control system, wherein the multi-singlechip control system comprises: the system comprises a main singlechip and a plurality of sub singlechips connected with the main singlechip; each singlechip is provided with a firmware starting module for guiding the singlechip to start, an application program module for storing an application program, an information storage module for storing attribute information of the application program module and a backup module for backing up and storing the application program; comprising the following steps:
the mark setting module is used for searching a target singlechip corresponding to the firmware upgrading instruction when the main singlechip receives the firmware upgrading instruction of the upper computer, setting an upgrading mark for the information storage module of the target singlechip, and resetting and restarting the target singlechip;
the program acquisition module is used for backing up the current application program of the target singlechip to the backup module of the target singlechip when the target singlechip runs the firmware starting module of the target singlechip and the target singlechip is detected to be set with the upgrading mark, and acquiring the target upgrading program from the upper computer;
the mark clearing module is used for storing the target upgrading program into an application program module of the target singlechip when the target singlechip acquires the target upgrading program, clearing the upgrading mark and resetting and restarting the target singlechip;
The program verification module is used for verifying the target upgrading program when the target singlechip runs a firmware starting module of the target singlechip and the upgrading mark is detected to be cleared;
and the program running module is used for running the target upgrading program if the target upgrading program passes the verification.
Correspondingly, the invention also discloses firmware upgrading equipment applied to the multi-singlechip control system, which comprises:
a memory for storing a computer program;
and the processor is used for realizing the steps of a firmware upgrading method applied to the multi-singlechip control system when executing the computer program.
Correspondingly, the invention also discloses a computer readable storage medium, wherein the computer readable storage medium is stored with a computer program, and the computer program realizes the steps of the firmware upgrading method applied to the multi-singlechip control system when being executed by a processor.
Therefore, in the firmware upgrading method provided by the invention, a firmware starting module for guiding the starting of each single chip microcomputer in the multi-single chip microcomputer control system, an application program module for storing an application program, an information storage module for storing attribute information of the application program module and a backup module for backing up and storing the application program are preset; when a main singlechip in the multi-singlechip control system receives a firmware upgrading instruction of an upper computer, the main singlechip searches a target singlechip corresponding to the firmware upgrading instruction, and sets an upgrading mark for an information storage module of the target singlechip; when the target singlechip runs the firmware starting module of the target singlechip and detects that the target singlechip is provided with the upgrading mark, the current application program of the target singlechip is backed up to the backup module of the target singlechip, and the target upgrading program is acquired from the upper computer through the main singlechip; when the target singlechip acquires the target upgrading program, the target upgrading program is stored in an application program module of the target singlechip, and meanwhile, an upgrading mark in the information storage module is cleared, and the target singlechip resets and restarts the target singlechip; after the target singlechip is reset and restarted, if the upgrading mark in the information storage module is detected to be cleared, the target upgrading program is read from the application program module, the target upgrading program is checked, and if the target upgrading program passes the check, the target upgrading program is operated. Compared with the prior art, the method can upgrade any single-chip microcomputer in the multi-single-chip microcomputer control system, and is not limited by the type and the set attribute of the single-chip microcomputer, so that the difficulty in upgrading the firmware of the single-chip microcomputer can be remarkably reduced, and meanwhile, the upgrading and maintenance of the multi-single-chip microcomputer control system by workers are facilitated. Correspondingly, the firmware upgrading device, the firmware upgrading equipment and the firmware upgrading medium applied to the multi-singlechip control system have the same beneficial effects.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Referring to fig. 1, fig. 1 is a flowchart of a firmware upgrading method applied to a multi-singlechip control system according to an embodiment of the present invention, where the multi-singlechip control system includes: a main singlechip and a plurality of sub-singlechips connected with the main singlechip; each singlechip is provided with a firmware starting module for guiding the singlechip to start, an application program module for storing an application program, an information storage module for storing attribute information of the application program module and a backup module for backing up and storing the application program; the method comprises the following steps:
Step S11: when the main singlechip receives a firmware upgrading instruction of the upper computer, searching a target singlechip corresponding to the firmware upgrading instruction, setting an upgrading mark for an information storage module of the target singlechip, and resetting and restarting the target singlechip;
Step S12: when the target singlechip runs the firmware starting module of the target singlechip and detects that the target singlechip is provided with the upgrading mark, the current application program of the target singlechip is backed up to the backup module of the target singlechip, and the target upgrading program is obtained from the upper computer;
Step S13: when the target singlechip acquires the target upgrading program, the target upgrading program is stored in an application program module of the target singlechip, an upgrading mark is cleared, and the target singlechip resets and restarts the target singlechip;
Step S14: when the target singlechip runs a firmware starting module of the target singlechip and detects that the upgrading mark is cleared, verifying the target upgrading program;
Step S15: and if the target upgrading program passes the verification, the target upgrading program is operated.
In the embodiment, the firmware upgrading method applied to the multi-singlechip control system is provided, and not only can the difficulty in upgrading the firmware of the singlechip be reduced, but also the upgrading maintenance of the multi-singlechip control system by workers is facilitated.
Referring to fig. 2, fig. 2 is a block diagram of a multi-singlechip control system in the prior art, in the multi-singlechip control system, the multi-singlechip control system mainly includes: the system comprises a data acquisition processing module, a sub-singlechip, a main singlechip, a communication interface module, a power module and an upper computer. The data acquisition processing module is used for converting measured information detected by the sensor into an electric signal or other required information formats according to a certain rule and outputting the electric signal or other required information formats; the sub-single-chip microcomputer is used for respectively connecting data acquisition and processing of the data acquisition and processing module and communicating with the main single-chip microcomputer, wherein the mode of communicating the sub-single-chip microcomputer with the main single-chip microcomputer comprises serial ports, SPI (SERIAL PERIPHERAL INTERFACE ), IIC (INTER INTEGRATED Circuit, integrated Circuit bus) and the like. The main singlechip is used for controlling data acquisition and processing of the input and output modules such as the sub-singlechip, the control keys, the display module and the like; the communication interface module is used for communicating with the upper computer, and the communication mode comprises the following steps: communication modes such as USB (Universal Serial Bus ), 2G (Generation wireless telephone technology, mobile phone communication specification)/3G/4G/5G, WIFI (wireless communication technology), bluetooth and the like; the power supply module is used for supplying power to each device in the multi-singlechip control system; the upper computer is used for carrying out instruction communication with each singlechip and issuing and reading firmware programs.
Compared with the prior art, in the multi-singlechip control system provided by the embodiment, the main singlechip and the plurality of sub-singlechips connected with the main singlechip are arranged, and each singlechip is provided with a firmware starting module for guiding the singlechip to start, an application program module for storing an application program, an information storage module for storing attribute information of the application program module and a backup module for backing up and storing the application program.
Specifically, in the actual operation process, different addresses in the flash memory inside each singlechip can be allocated to different program modules. Referring to fig. 3, fig. 3 is a schematic diagram of allocating flash memory in a single chip microcomputer. In fig. 3, the firmware start module is used for guiding the singlechip to start, including jumping to the application program operation, updating the application program, backing up the application program, reading and writing the program information, and the like; the application program module is used for storing application programs of the system; the information storage module is used for storing the version information, upgrading state and other marks of the application program, checking information and other contents; the backup module is used for backing up the application program, and before the new application program is upgraded, the original application program is backed up to the area by the firmware starting module, so that the system can be operated normally after the application program is damaged.
In this embodiment, when a main singlechip in the multi-singlechip control system receives a firmware upgrade instruction of an upper computer, the main singlechip searches a target singlechip corresponding to the firmware upgrade instruction, where the target singlechip includes both the main singlechip and a sub-singlechip. That is, the firmware upgrade instruction sent by the upper computer can upgrade the firmware of the main singlechip or upgrade the firmware of the sub singlechip. In other words, the firmware upgrading methods of all singlechips in the multi-singlechip control system are consistent.
When the main singlechip finds a target singlechip corresponding to the firmware upgrading instruction, an upgrading mark is set in an information storage module of the target singlechip, and the target singlechip is reset and restarted. When the target singlechip is reset and restarted, and the self firmware starting module is operated, if the upgrade mark is detected to be arranged in the self information storage module, the target singlechip firstly backs up the current application program of the target singlechip to the backup module of the target singlechip, and acquires the target upgrade program from the upper computer; when the target singlechip acquires the target upgrading program sent by the upper computer, the target singlechip stores the target upgrading program into the application program module of the target singlechip, and meanwhile, clears the upgrading mark in the information storage module of the target singlechip and resets and restarts the target singlechip.
When the target singlechip is reset and restarted, corresponding program jump is carried out under the guidance of the firmware starting module of the target singlechip, and if the target singlechip detects that the upgrading mark in the information storage module of the target singlechip is cleared, the latest upgrading program of the application program, namely the target upgrading program, is stored in the application program module of the target singlechip. Under the condition, the target singlechip checks the target upgrading program, if the target upgrading program passes the check, the target upgrading program is not tampered, the stored information is not lost, and the target singlechip runs the target upgrading program.
It can be understood that, because the method can upgrade any single-chip microcomputer in the multi-single-chip microcomputer control system, and is not limited by the type and the set attribute of the single-chip microcomputer, the difficulty in upgrading the firmware of the single-chip microcomputer can be obviously reduced by the method, and meanwhile, the upgrading and maintenance of the multi-single-chip microcomputer control system by workers are facilitated.
It can be seen that, in the firmware upgrading method provided in this embodiment, a firmware starting module for guiding to start itself, an application program module for storing an application program, an information storage module for storing attribute information of the application program module, and a backup module for backing up and storing the application program are set in advance for each single-chip microcomputer in the multi-single-chip microcomputer control system; when a main singlechip in the multi-singlechip control system receives a firmware upgrading instruction of an upper computer, the main singlechip searches a target singlechip corresponding to the firmware upgrading instruction, and sets an upgrading mark for an information storage module of the target singlechip; when the target singlechip runs the firmware starting module of the target singlechip and detects that the target singlechip is provided with the upgrading mark, the current application program of the target singlechip is backed up to the backup module of the target singlechip, and the target upgrading program is acquired from the upper computer through the main singlechip; when the target singlechip acquires the target upgrading program, the target upgrading program is stored in an application program module of the target singlechip, and meanwhile, an upgrading mark in the information storage module is cleared, and the target singlechip resets and restarts the target singlechip; after the target singlechip is reset and restarted, if the upgrading mark in the information storage module is detected to be cleared, the target upgrading program is read from the application program module, the target upgrading program is checked, and if the target upgrading program passes the check, the target upgrading program is operated. Compared with the prior art, the method can upgrade any single-chip microcomputer in the multi-single-chip microcomputer control system, and is not limited by the type and the set attribute of the single-chip microcomputer, so that the difficulty in upgrading the firmware of the single-chip microcomputer can be remarkably reduced, and meanwhile, the upgrading and maintenance of the multi-single-chip microcomputer control system by workers are facilitated.
Based on the above embodiment, this embodiment further describes and optimizes the technical solution, as a preferred implementation manner, the steps are as follows: after the process of verifying the target upgrade program, the method further comprises the following steps:
If the target upgrading program does not pass the verification, the current application program of the target singlechip is read from the backup module of the target singlechip, the current application program of the target singlechip is stored in the information storage module of the target singlechip, and the target singlechip is reset and restarted.
It can be understood that if the target upgrade program is not checked in the process of checking the target upgrade program by the target single-chip microcomputer, it indicates that the target upgrade program is tampered or has other problems, and at this time, in order to ensure safe and stable operation of the multi-single-chip microcomputer control system, the target single-chip microcomputer will read the current application program of the target single-chip microcomputer from its own backup module, store the current application program of the target single-chip microcomputer into its own information storage module, and reset and restart itself.
Therefore, through the technical scheme provided by the embodiment, the overall reliability of the multi-singlechip control system in the operation process can be further ensured.
Based on the above embodiment, this embodiment further describes and optimizes the technical solution, as a preferred implementation manner, the steps are as follows: after the process of running the target upgrade program, the method further comprises:
If the target singlechip receives a new firmware upgrading instruction, an upgrading mark is set for an information storage module of the target singlechip, and the target singlechip resets and restarts the target singlechip.
If the target singlechip receives a new firmware upgrading instruction sent by the upper computer in the process of running the target upgrading program, the upper computer is required to continuously upgrade the target upgrading program, and at the moment, the target singlechip sets an upgrading mark in an information storage module of the target singlechip and resets and restarts the target singlechip.
It can be thought that when the target singlechip sets an upgrade flag in the own information storage module, the target singlechip reenters the step S12 after reset and restart, so that the target singlechip can be ensured to upgrade the target singlechip accurately and reliably and upgrade the firmware of the target singlechip to the latest version.
Based on the above embodiment, this embodiment further describes and optimizes a technical solution, and as a preferred implementation manner, the firmware upgrading method further includes:
when the upper computer needs to upgrade the firmware of the target singlechip, downloading a target upgrade program and checking the target upgrade program;
and if the target upgrading program passes the verification, the target upgrading program is sent to the main singlechip.
In practical application, if a user needs to upgrade the firmware of a target singlechip in a multi-singlechip control system, firstly, downloading a target upgrade program for upgrading the firmware of the target singlechip into an upper computer; then, in order to ensure the safety and reliability of the target upgrading program, the upper computer checks the target upgrading program; if the target upgrading program passes the verification of the upper computer, the target upgrading program is not tampered, and no deletion occurs. Under the condition, the upper computer sends the target upgrading program to the main singlechip, and the main singlechip sends the target upgrading program to the target singlechip.
As a preferred embodiment, the steps are as follows: the process of downloading the target upgrade program comprises the following steps:
and downloading the target upgrading program by using the YModem protocol.
It can be appreciated that, compared with other transmission protocols, the yomodem protocol not only has the advantage of stable and reliable data transmission, but also has faster data transmission, so that when the host computer utilizes the yomodem protocol to download the target upgrade program, the downloading experience of the user can be relatively improved. Or in practical application, the upper computer may also utilize other transmission protocols to download the target upgrade program of the target singlechip, which is not described in detail herein.
In order to enable those skilled in the art to better understand the implementation principle of the firmware upgrading method of the multi-singlechip control system provided by the invention, the foregoing disclosure is specifically described by an application scenario embodiment.
Referring to fig. 4 and 5, fig. 4 is a flowchart of firmware upgrade of the multi-singlechip control system; FIG. 5 is a flow chart of firmware upgrade performed by the target SCM. When a user wants to upgrade the firmware of a target single-chip microcomputer in the multi-single-chip microcomputer control system, the multi-single-chip microcomputer control system is connected with an upper computer through a communication interface, and after the upper computer is in communication connection with the multi-single-chip microcomputer control system, the upper computer can detect the communication connection state between the upper computer and a main single-chip microcomputer in the multi-single-chip microcomputer control system; if the upper computer does not establish communication connection with the main singlechip, the upper computer always detects the connection state of the upper computer and the main singlechip; if the upper computer and the main singlechip are successfully connected, the upper computer selects a target singlechip to be upgraded according to a user instruction, and then reads the current application program of the target singlechip and judges whether the target singlechip needs to be upgraded; when the upper computer judges that the target singlechip is to be upgraded, the Ymodem protocol is used for downloading a target upgrading program of the target singlechip and checking the target upgrading program. If the target upgrading program passes the verification of the upper computer, the upper computer sends the target upgrading program to the main singlechip.
When the main singlechip receives a firmware upgrading instruction sent by the upper computer, judging whether the main singlechip is to be upgraded according to the target upgrading instruction, if the upper computer is judged to be used for upgrading the firmware of the main singlechip according to the firmware upgrading instruction, setting an upgrading mark in an information storage module of the main singlechip, and resetting and restarting the main singlechip; if the upper computer is judged to upgrade the sub-single-chip microcomputer according to the firmware upgrade instruction, an upgrade mark is set for the information storage module of the corresponding sub-single-chip microcomputer, and reset and restart are carried out on the information storage module.
After the target singlechip is reset and restarted, the target singlechip can judge whether an information storage module in the target singlechip is provided with an upgrade mark under the guidance of a firmware starting module of the target singlechip; if the upgrading mark is set, the current application program of the target singlechip is backed up to a backup module of the current application program; and then, the target singlechip acquires the target upgrading program from the upper computer, when the target singlechip acquires the target upgrading program, the upgrading mark in the information storage module is cleared, the related information of the target upgrading program is stored in the information storage module, and the target singlechip resets and restarts the target singlechip to upgrade the firmware in the next starting process.
If the target singlechip finds that the target singlechip is not provided with the upgrade mark, the latest version of the application program stored in the target singlechip is checked, and if the latest version of the application program passes the check, the latest version of the application program is operated. If the target singlechip also receives a new firmware upgrading instruction sent by the upper computer in the process of running the latest version application program, an upgrading mark is set in an information storage module of the target singlechip, and the target singlechip is reset and restarted; if the application program does not pass the verification, the target singlechip reads the backup application program of the target singlechip from the backup module, stores the backup application program into the application program module, and resets and restarts the target singlechip.
According to the method, any single-chip microcomputer in the multi-single-chip microcomputer control system can be upgraded, and the single-chip microcomputer type and the set attribute are not limited, so that difficulty in upgrading firmware of the single-chip microcomputer can be remarkably reduced, and meanwhile upgrading and maintenance of the multi-single-chip microcomputer control system by workers are facilitated.
Referring to fig. 6, fig. 6 is a block diagram of a firmware upgrading apparatus applied to a multi-singlechip control system according to an embodiment of the present invention. Wherein, many singlechip control system includes: a main singlechip and a plurality of sub-singlechips connected with the main singlechip; each singlechip is provided with a firmware starting module for guiding the singlechip to start, an application program module for storing an application program, an information storage module for storing attribute information of the application program module and a backup module for backing up and storing the application program; the device comprises:
The mark setting module 21 is used for searching a target singlechip corresponding to the firmware upgrading instruction when the main singlechip receives the firmware upgrading instruction of the upper computer, setting an upgrading mark for an information storage module of the target singlechip, and resetting and restarting the target singlechip;
the program acquisition module 22 is configured to backup a current application program of the target singlechip to a backup module of the target singlechip and acquire a target upgrade program from the upper computer when the target singlechip runs a firmware starting module of the target singlechip and detects that the target singlechip is provided with an upgrade mark;
The mark removing module 23 is configured to store the target upgrade program to an application program module of the target singlechip when the target singlechip acquires the target upgrade program, remove the upgrade mark, and reset the target singlechip;
the program verification module 24 is configured to verify the target upgrade program when the target singlechip runs its firmware start module and it is detected that the upgrade flag is cleared;
and a program running module 25, configured to run the target upgrade program if the target upgrade program passes the verification.
The firmware upgrading device applied to the multi-singlechip control system has the beneficial effects of the firmware upgrading method applied to the multi-singlechip control system.
Referring to fig. 7, fig. 7 is a block diagram of a firmware upgrade apparatus applied to a multi-singlechip control system according to an embodiment of the present invention, where the apparatus includes:
A memory 31 for storing a computer program;
The processor 32 is configured to execute the computer program to implement the steps of a firmware upgrade method for a multi-singlechip control system as disclosed above.
The firmware upgrading equipment applied to the multi-singlechip control system has the beneficial effects of the firmware upgrading method applied to the multi-singlechip control system.
Correspondingly, the embodiment of the invention also discloses a computer readable storage medium, wherein the computer readable storage medium is stored with a computer program, and the steps of the firmware upgrading method applied to the multi-singlechip control system are realized when the computer program is executed by a processor.
The computer readable storage medium provided by the embodiment of the invention has the beneficial effects of the firmware upgrading method applied to the multi-singlechip control system.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described in a different point from other embodiments, so that the same or similar parts between the embodiments are referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant points refer to the description of the method section.
Finally, it is further noted that relational terms such as first and second, and the like are 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. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus 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 apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The firmware upgrading method, device, equipment and medium applied to the multi-singlechip control system provided by the invention are described in detail, and specific examples are applied to illustrate the principle and implementation of the invention, and the description of the above examples is only used for helping to understand the method and core ideas of the invention; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in accordance with the ideas of the present invention, the present description should not be construed as limiting the present invention in view of the above.