MCU firmware remote upgrading method, medium and computer equipment
Through the remote upgrade method of MCU firmware, the server pushes upgrade messages and instructions, the fast, low-cost, one-to-many upgrade of repeater firmware is achieved, and the cumbersome and management complexity of traditional upgrade methods is solved, ensuring the stability of the system and Reduced maintenance costs.
Patent Information
- Application Number
- CN202411173752.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-23
- Publication Date
- 2024-12-10
AI Technical Summary
The traditional repeater firmware upgrade method is cumbersome and difficult to operate, and it is complex to manage during large-scale equipment deployment, which is prone to inability to operate normally due to emergencies, and lacks fast, low-cost and one-to-many upgrade methods.
The MCU firmware remote upgrade method is adopted, and the upgrade messages and instructions are pushed through the server. The device automatically judges and firmware upgrades are carried out. It supports rollback function and upgrades using wireless networks, reducing physical contact and operation complexity.
It realizes fast, low-cost and remote upgrades of device firmware, ensures stable system operation, supports large-scale equipment management, reduces maintenance costs, and automatically rolls back to the previous version in emergencies.
Smart Images

Figure CN119109914A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a method, medium and computer equipment for remotely upgrading MCU firmware, and belongs to the technical field of electronic information. Background Art
[0002] A repeater is a wireless signal relay product. The main indicators for measuring the quality of a repeater include the degree of intelligence, low IP3, low noise factor, overall reliability, and good technical services.
[0003] The use of repeaters is one of the necessary means to achieve the goal of "small capacity, large coverage", mainly because the use of repeaters can ensure network coverage without increasing the number of base stations, and secondly, its cost is much lower than the micro-cellular system with the same effect. Repeaters are a preferred solution to solve the problem of extending the coverage of communication networks. Compared with base stations, they have the advantages of simple structure, less investment and easy installation. They can be widely used in blind spots and weak areas that are difficult to cover, such as shopping malls, hotels, airports, docks, stations, stadiums, entertainment halls, subways, tunnels, highways, islands and other places to improve communication quality and solve problems such as dropped calls.
[0004] At present, the repeater equipment is generally composed of a main board and a monitoring module. The main board is responsible for the realization of the radio frequency function, while the monitoring module is responsible for the display of important data of the main board and the upgrade of the main board program. In order to continuously improve the user experience or if there are fatal defects in the equipment, it is necessary to upgrade the firmware for the user.
[0005] The traditional upgrade method requires access to a specific burning device to upgrade the motherboard firmware. For ordinary users, the upgrade process is cumbersome and difficult to operate. Moreover, for large quantities of devices to be upgraded, this burning method becomes unrealistic. Various emergencies may occur during the upgrade process. If the communication is interrupted or an error occurs during the upgrade process, the device may become bricked or fail to operate normally. Especially when large-scale equipment is deployed, it becomes more complicated to manage and monitor the upgrade process of each device.
[0006] When the device cannot be used or the use effect does not meet customer requirements due to firmware problems in certain specific environments, a firmware upgrade is required. Traditional firmware upgrades require a specific burner, which makes the operation cumbersome and requires users to have certain professional knowledge.
[0007] At the same time, with the general trend of wide signal coverage, high signal strength and low radiation, the number of repeater deployments will become larger and larger, which puts higher requirements on the management and upgrade of repeater stations. Remote management, autonomous upgrade judgment and operation have become urgent needs.
[0008] Therefore, in the firmware upgrade of the repeater, a method is needed that is easy and fast to deploy, low in cost, has a large range, and can be upgraded one-to-many. Summary of the invention
[0009] In view of the above-mentioned deficiencies in the prior art, the object of the present invention is to provide a method, medium and computer device for remotely upgrading MCU firmware.
[0010] According to an embodiment of the present invention, a first solution is provided:
[0011] A method for remotely upgrading MCU firmware, used on a device, comprises the following steps:
[0012] The device receives the upgrade message and determines whether it is in a state where an upgrade is required;
[0013] When it is determined that an upgrade is required, the device sends a message to the second server for confirmation, and the upgrade message is pushed by the second server;
[0014] Whether the device is in a state where an upgrade is required is determined by whether an upgrade instruction sent by the terminal is obtained;
[0015] The upgrade instruction is issued by the terminal, and the condition for issuing the upgrade instruction is that the version number of the first firmware running on the device is lower than the version number of the second firmware included in the upgrade message pushed by the second server, or the version number of the second firmware included in the upgrade message pushed by the second server is lower than the version number of the third firmware on the terminal;
[0016] The second firmware is stored on the first server and is the latest version of all firmware stored on the first server;
[0017] The firmware version number included in the upgrade message is the version number of the second firmware;
[0018] Before the terminal sends an upgrade instruction, it needs to register to bind the device and the terminal;
[0019] The device end requests the first server to obtain the upgraded firmware according to the upgrade message pushed by the second server, and the device end receives the second firmware sent by the first server in response;
[0020] The second firmware sent by the first server in response is determined by the firmware version information included in the request information sent by the device end;
[0021] The device uses the received second firmware to perform firmware upgrade;
[0022] When the upgrade is completed, compare the currently running firmware version number with the second firmware version number contained in the upgrade message pushed by the second server;
[0023] If they are consistent, a successful upgrade message is published to the second server;
[0024] The upgrade success message arrives at the second server, the device end upgrade success information is recorded on the second server, and the device end receives confirmation information from the second server recording the device end upgrade success information.
[0025] Further, when the version number of the second firmware included in the upgrade message pushed by the second server is lower than the version number of the third firmware on the terminal, the terminal uploads the third firmware to the first server;
[0026] After the first server receives the complete third firmware, the third firmware becomes the latest version of the firmware stored on the first server, that is, the second firmware;
[0027] The first server publishes an upgrade message to the second server. After receiving the upgrade message, the second server records the second firmware version number included in the upgrade message. After the recording is completed, the second server sends a confirmation message to the first server.
[0028] Furthermore, the upgrade instruction includes a return instruction, and the return instruction is sent by the terminal to the device end when the first firmware running on the device end is abnormal or unstable or a specific firmware version needs to be used;
[0029] The return instruction contains the firmware version number to be returned.
[0030] Further, the device sends a request message to the first server to obtain the firmware according to the firmware version number to be returned contained in the return instruction, and receives the firmware version sent by the first server in response;
[0031] The request information includes the firmware version number information to be obtained;
[0032] The firmware version sent by the first server in response is determined by the firmware version number information included in the request information sent by the device;
[0033] The device uses the received firmware to perform the upgrade steps. When the upgrade is completed, a return success message is sent to the second server. The second server records the current firmware information status of the device and sends a confirmation message of the received information to the device.
[0034] Furthermore, the device end includes a monitoring device and a mainboard, and the receiving firmware is completed by the monitoring device;
[0035] Step 301, after the monitoring device obtains the upgrade firmware, it sends an upgrade request to the mainboard, including the firmware type, firmware size, and firmware name;
[0036] Step 302, after receiving the upgrade request, the mainboard responds to the monitoring device; after receiving the upgrade response, the monitoring device transmits the firmware to the mainboard, and the mainboard receives the firmware. The receiving step is completed by the MCU of the mainboard;
[0037] During the MCU receiving firmware, a disabled timer interrupt is set to prevent the receiving of updated firmware from being interrupted or interrupted;
[0038] Each frame of the receiving firmware is checked to ensure that each frame received is correct;
[0039] The MCU stores the received firmware in the second storage location of the external flash, and stores the time, firmware size, and firmware type in front of the address where the firmware is stored, so as to guide the program to match the new firmware.
[0040] Two storage locations are set in the external flash, namely a first storage location and a second storage location, the storage location for storing the current APROM is the first storage location, and the storage location for storing the updated firmware is the second storage location;
[0041] After the firmware is received, the flag status of the firmware update flag is set to upgrade;
[0042] Step 303, the MCU is restarted, and the boot program in the LDROM is started to determine the status of the firmware update flag.
[0043] If it is an upgrade, the firmware file information in the second storage location is read out, the firmware of the APROM is replaced with the firmware in the second storage location, and the file information of the APROM is updated to prepare for the next update. After the update, the flag state of the update firmware flag is set to maintain;
[0044] Step 304, after the APROM is updated, the system is restarted and the boot program in the LDROM is run. The boot program finds that the flag state of the update flag is maintained, and directly runs the main program in the APROM, and the update is completed.
[0045] Furthermore, before replacing the APROM firmware, a file verification step is performed, including:
[0046] Read out the firmware file information in the second storage location, including the firmware storage address, firmware size, firmware type, and firmware storage time;
[0047] Read the firmware suffix to determine whether it contains the executable file suffix. If not, it means that the received file type is incorrect. Do not modify the APROM program and directly run the APROM main program.
[0048] If it contains an executable file, compare the time of the new firmware with the firmware time of the main program in the current APROM to determine whether they are the same. If they are the same firmware, directly run the main program of APROM;
[0049] If the firmware is different, a secondary check is performed to determine whether the checksum of the new firmware read from the storage is consistent with the checksum of the new firmware recalculated.
[0050] If the verification is inconsistent, run the main program of APROM directly;
[0051] If the verification is consistent, the APROM firmware is replaced with the new firmware, and the APROM file information, time, size and verification are updated.
[0052] Further, in step 305, the monitoring device sends a rollback instruction, and the main program in the APROM finds that there is a rollback instruction, then sets the flag state of the update flag bit to rollback, and then restarts;
[0053] Step 306, after restarting, running from the boot program, finding that the flag state of the update flag is rollback, erasing the APROM program, copying the firmware stored in the second storage location to the APROM location, and updating the current APROM storage location, and setting the flag state of the update flag to maintain;
[0054] Step 307, after restarting, roll back to the previous version.
[0055] According to an embodiment of the present invention, using the MCU firmware remote upgrade method in the first solution provided by the present invention, a second solution is provided:
[0056] A MCU firmware remote upgrade device, comprising:
[0057] The device end 100 is a device terminal including an MCU module and a monitoring module or a device terminal in which the MCU module has a monitoring function; the MCU module implements device functions and device control for users, and the monitoring module or monitoring function is used to monitor important data of the device and MCU and upgrade the firmware of the MCU;
[0058] The terminal 110 is installed with a client, which is a client having an information acquisition function, or a client having both an information acquisition function and an upgrade instruction sending function, or a client having both an information acquisition function and an upgrade firmware file sending and receiving function, or a client having both an upgrade instruction function and an upgrade firmware file sending and receiving function;
[0059] The obtaining of information includes obtaining firmware information of the device, obtaining firmware information stored on the server, and obtaining firmware information released by the server;
[0060] Before the client obtains information from the device or server, sends upgrade instructions, or sends and receives upgrade firmware files, it needs to register through the APP or system so that the client and the device are bound or associated with each other;
[0061] The first server 130 is used to store and send firmware for upgrading and publish upgrading messages;
[0062] The second server 140 is used to receive and record the running firmware information of the device, the firmware information for upgrading stored in the first server, and push the upgrading message;
[0063] The terminal 110 is connected to the device end 100, the first server 130, and the second server 140 via a wireless network or a wired network; the device end 100 is connected to the first server 130 and the second server 140 via a wireless network or a wired network; the first server 130 and the second server 140 are connected via a wireless network or a wired network.
[0064] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the following steps:
[0065] The device receives the upgrade message and determines whether it is in a state where an upgrade is required. If it is determined that the device is in a state where an upgrade is required, the device sends a message confirmation to the second server, and the upgrade message is pushed by the second server;
[0066] Whether the device is in a state where an upgrade is required is determined by whether an upgrade instruction sent by the terminal is obtained;
[0067] The upgrade instruction is issued by the terminal, and the condition for issuing the upgrade instruction is that the version number of the first firmware running on the device is lower than the version number of the second firmware included in the upgrade message pushed by the second server, or the version number of the second firmware included in the upgrade message pushed by the second server is lower than the version number of the third firmware on the terminal;
[0068] The second firmware is stored on the first server and is the latest version of all firmware stored on the first server;
[0069] The firmware version number included in the upgrade message is the version number of the second firmware;
[0070] Before the terminal sends an upgrade instruction, it needs to register to bind the device and the terminal;
[0071] The device end requests the first server to obtain the upgraded firmware according to the upgrade message pushed by the second server, and the device end receives the second firmware sent by the first server in response;
[0072] The second firmware sent by the first server in response is determined by the firmware version information included in the request information sent by the device end;
[0073] The device uses the received second firmware to perform an upgrade step;
[0074] When the upgrade is completed, compare the currently running firmware version number with the second firmware version number contained in the upgrade message pushed by the second server;
[0075] If they are consistent, a successful upgrade message is published to the second server;
[0076] The upgrade success message arrives at the second server, the device end upgrade success information is recorded on the second server, and the device end receives confirmation information from the second server recording the device end upgrade success information.
[0077] A computer-readable storage medium stores a computer program, which, when executed by a processor, causes the processor to perform the following steps:
[0078] The device receives the upgrade message and determines whether it is in a state where an upgrade is required. If it is determined that the device is in a state where an upgrade is required, the device sends a message confirmation to the second server, and the upgrade message is pushed by the second server;
[0079] Whether the device is in a state where an upgrade is required is determined by whether an upgrade instruction sent by the terminal is obtained;
[0080] The upgrade instruction is issued by the terminal, and the condition for issuing the upgrade instruction is that the version number of the first firmware running on the device is lower than the version number of the second firmware included in the upgrade message pushed by the second server, or the version number of the second firmware included in the upgrade message pushed by the second server is lower than the version number of the third firmware on the terminal;
[0081] The second firmware is stored on the first server and is the latest version of all firmware stored on the first server;
[0082] The firmware version number included in the upgrade message is the version number of the second firmware;
[0083] Before the terminal sends an upgrade instruction, it needs to register to bind the device and the terminal;
[0084] The device end requests the first server to obtain the upgraded firmware according to the upgrade message pushed by the second server, and the device end receives the second firmware sent by the first server in response;
[0085] The second firmware sent by the first server in response is determined by the firmware version information included in the request information sent by the device end;
[0086] The device uses the received second firmware to perform an upgrade step;
[0087] When the upgrade is completed, compare the currently running firmware version number with the second firmware version number contained in the upgrade message pushed by the second server;
[0088] If they are consistent, a successful upgrade message is published to the second server;
[0089] The upgrade success message arrives at the second server, the device end upgrade success information is recorded on the second server, and the device end receives confirmation information from the second server recording the device end upgrade success information.
[0090] Compared with the prior art, the technical solution provided by this application has unique beneficial effects.
[0091] The MCU firmware can be upgraded remotely by connecting to the server and uploading the upgraded firmware to the server. The user can decide whether to upgrade or not. Customized firmware upgrades can also be performed for a single user, solving the problem of fast and low-cost deployment of upgrades for a large number of devices.
[0092] At the same time, it solves the problem of various emergencies during the upgrade process that may cause upgrade interruption or even device inability to run. The firmware automatically rolls back and continues to run the firmware before the upgrade without affecting the next firmware update.
[0093] 1. Device software can be updated remotely via the Internet without physical contact with the device, saving time and cost.
[0094] 2. Solve the problem that unexpected situations occur during firmware update, resulting in network or power outages, which in turn causes the device to be unable to operate and the firmware can no longer be updated.
[0095] 3. Manage different software versions on different devices and roll back to the previous version when needed.
[0096] 4. Automatic rollback function: If an emergency occurs during the upgrade process (such as network or power outage), the device can automatically run the current version to ensure continuous and stable operation of the system.
[0097] 5. Batch management: Supports remote firmware upgrade and management of large-scale equipment, improving operational efficiency and reducing maintenance costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0098] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0099] Figure 1 It is a structural schematic diagram of an implementation environment involved in the present invention;
[0100] Figure 2 It is a flowchart of firmware acquisition and upgrade in a method for remotely upgrading MCU firmware provided by an embodiment of the present invention;
[0101] Figure 3 It is a logic judgment and execution flow chart of MCU firmware upgrade or rollback in the MCU firmware remote upgrade method provided by an embodiment of the present invention;
[0102] Figure 4 is a connection and data transmission flow diagram of a MCU firmware remote upgrade device in one embodiment of the present invention;
[0103] Figure 5 It is a structural block diagram of a computer device in one embodiment of the present invention. DETAILED DESCRIPTION
[0104] In order to enable those skilled in the art to better understand the technical solutions in the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of this application.
[0105] The problem solved by the present invention is that the MCU firmware of the device can be remotely upgraded by connecting to the server to obtain upgrade information and upgrade firmware. The user uploads the upgrade firmware to the APP or system, and the user terminal decides whether to upgrade and which device to upgrade. Customized firmware upgrades can also be performed for a single user or device.
[0106] The present invention also solves various emergencies during the upgrade process, resulting in upgrade interruption or upgrade errors. The firmware automatically rolls back and continues to run the executable firmware before the upgrade without affecting the next firmware update.
[0107] First of all, it should be noted that in various embodiments of the present invention, the terms involved are:
[0108] A repeater is a wireless signal relay product. Repeater equipment is generally composed of a main board and a monitoring module; the main board mainly includes an MCU module.
[0109] HTTP servers can process requests from clients such as browsers or servers and return corresponding responses. They can also place data files for clients and devices to browse and download.
[0110] HTTP is mainly used for communication between clients and servers and is used to send request messages.
[0111] HTTP is a stateless protocol, which means that the server does not retain any state when transacting with the client. This greatly reduces the server's memory burden, thereby maintaining a faster response speed. HTTP is an object-oriented protocol. It allows the transmission of any type of data object.
[0112] MQTT is a lightweight IoT communication protocol based on the publish / subscribe model, which is suitable for data transmission in low-bandwidth and unstable network environments.
[0113] MCU:Micro Controller Unit, micro control unit.
[0114] LDROM: ISP Loader ROM, used to store BOOTLOADER firmware program.
[0115] APROM: Application Program ROM, FLASH used to store application programs.
[0116] Embodiment 1
[0117] A MCU firmware remote upgrade device, comprising:
[0118] The device end 100 may be a device terminal including an MCU module and a monitoring module, or a device terminal in which the MCU module has a monitoring function. The MCU module is mainly used for users to realize device functions and device control, and the monitoring module or monitoring function is used to monitor important data of the device and MCU and upgrade the firmware of the MCU.
[0119] The MCU module with monitoring function can complete its monitoring function using program instructions stored in ROM and will not be destroyed during the MCU upgrade process.
[0120] The device end can be a repeater. A repeater is a wireless signal relay product. The repeater device is generally composed of a mainboard and a monitoring module; the mainboard mainly includes an MCU module.
[0121] The terminal 110 may be a mobile phone, a tablet computer, a laptop computer, a desktop computer, etc.
[0122] The terminal 110 may be installed with an application client, or with a browser, and access the web client of the application through the browser. In the embodiment of the present invention, the application client and the web client are collectively referred to as clients, and no special statement is made below.
[0123] The client may be a client having the function of obtaining information, or a client having both the function of obtaining information and the function of sending upgrade instructions, or a client having both the function of obtaining information and the function of sending and receiving upgrade firmware files, or a client having both the function of sending and receiving upgrade instructions and the function of sending and receiving upgrade firmware files.
[0124] The information acquisition includes acquiring firmware information of a device, acquiring firmware information stored in a server, and acquiring firmware information released by a server.
[0125] Before the client obtains information from the device or server, sends upgrade instructions, or receives and sends upgrade firmware files, it needs to register through the APP or system so that the terminal and the device terminal are bound or associated with each other.
[0126] The first server 130 may be a single server, or a server cluster consisting of a plurality of servers, or a cloud service center.
[0127] The first server is an HTTP server. The first server 130 is used to store and send firmware for upgrading and publish upgrading messages.
[0128] The second server 140 may be a single server, or a server cluster consisting of a plurality of servers, or a cloud service center.
[0129] The type of the second service is an MQTT server. The second server 140 is used to receive and record the running firmware information of the device, the firmware information for upgrading stored by the first server, and push upgrade messages.
[0130] The terminal 110 can be connected to the device end 100, the first server 130, and the second server 140 via a wireless network or a wired network; the device end 100 can be connected to the first server 130 and the second server 140 via a wireless network or a wired network; the first server 130 and the second server 140 can be connected to each other via a wireless network or a wired network.
[0131] It should be noted that the first server and the second server are set up instead of using a single server to implement both functions at the same time in order to give full play to the respective advantages of the two servers. The first server is used to store firmware alone, which is suitable for a large number of accesses and device-side firmware acquisition; the second server performs recording and publishing operations, with a small amount of data interaction, which is easy to deploy. The separate setting of servers with two functions reduces deployment costs.
[0132] Embodiment 2
[0133] The present invention provides a method for remotely upgrading MCU firmware, comprising:
[0134] Step 201: Before performing an upgrade operation, the terminal registers through the client to bind the terminal to the device.
[0135] Step 202: the terminal determines whether the device is in a state requiring updating, and if so, sends an upgrade instruction to the device.
[0136] The method for determining whether the device is in a state requiring updating is to obtain the version number of the firmware (second firmware) pushed by the MQTT server and the version number of the firmware (first firmware) currently running on the device. When the current firmware version number of the device is lower than the firmware version number pushed by the MQTT server or the current firmware version number of the device is lower than the latest firmware (third firmware) version number of the terminal, the terminal sends an upgrade instruction to the device, and the device adjusts the firmware update flag to the upgrade status flag after receiving the upgrade instruction.
[0137] If the firmware version number pushed by the MQTT server is lower than the latest firmware version number of the terminal, the terminal uploads the latest firmware to the HTTP server.
[0138] The HTTP server stores all firmware versions uploaded by terminals. When the versions stored on the HTTP server need to be cleaned up, you can operate the HTTP server through the terminal to delete expired versions or specified versions of firmware.
[0139] Step 203, the HTTP server publishes an upgrade message to the MQTT server. After receiving the upgrade message, the MQTT server records the firmware version number to be upgraded contained in the upgrade message. After recording is completed, the MQTT server sends a confirmation message to the HTTP server.
[0140] In step 204, the MQTT server pushes an upgrade message to the device. After receiving the upgrade message pushed by the MQTT server, the device determines whether it is in a state where an upgrade is required. If it is determined that an upgrade is required, the device sends a message confirmation to the MQTT server.
[0141] The firmware version number contained in the upgrade message pushed by the MQTT server to the device is the latest firmware version information in the current HTTP server.
[0142] Step 205, the device side requests the HTTP server to obtain the upgraded firmware according to the firmware version number to be upgraded contained in the upgrade message pushed by the MTTQ server. The HTTP server obtains the request information for upgrading the firmware according to the request sent by the device side, makes a response and sends the firmware to the device side.
[0143] Step 206, the device uses the received upgrade firmware to perform the upgrade steps. When the upgrade is completed, the current firmware information is compared with the firmware version number to be upgraded contained in the upgrade message pushed by the MTTQ server. If they are consistent, an upgrade success message is published to the MTTQ server. The MTTQ server records the current upgrade status of the device and sends a confirmation message to the device that the server has received the information.
[0144] In step 202, the device receives the upgrade instruction sent by the terminal, identifies the upgrade operation content in the instruction, and performs the upgrade operation according to the upgrade operation content.
[0145] The upgrade instruction is sent by the terminal, and the upgrade instruction is obtained by comparing the firmware version number pushed by the server, the firmware version number of the current device, and the latest firmware version number of the terminal.
[0146] The upgrade instruction includes a return instruction, which is sent by the terminal to the device when the first firmware running on the device is abnormal or unstable or a specific firmware version needs to be used; the device uses the received firmware to perform the upgrade steps and completes the operation of returning to the specified version.
[0147] The return instruction contains the firmware version number to be returned.
[0148] If the return instruction is to return to the previous version, since there is a firmware backup of the previous version on the device side, the rollback operation can also be performed directly.
[0149] In step 211, the device side requests the HTTP server to obtain the upgraded firmware according to the firmware version number to be returned contained in the return instruction. The HTTP server obtains the request information of the firmware to be returned according to the request sent by the device side, makes a response and sends the corresponding version of the firmware to the device side.
[0150] Step 212, the device uses the received firmware to perform an upgrade step. When the upgrade is completed, an upgrade success message is sent to the MTTQ server. The MTTQ server records the current upgrade status of the device and sends a confirmation message of the received information to the device.
[0151] Embodiment 3
[0152] The device side includes monitoring equipment and mainboard, and the monitoring equipment receives the upgraded firmware.
[0153] Step 301, after the monitoring device obtains the upgrade firmware, it sends an upgrade request to the mainboard. The upgrade request frame sent mainly includes the firmware type, firmware size, firmware name, etc.
[0154] Step 302: After receiving the upgrade request, the mainboard responds to the monitoring device. After receiving the upgrade response, the monitoring device transmits the firmware upgrade package to the mainboard, and the mainboard receives the upgraded firmware. The receiving step is completed by the MCU of the mainboard.
[0155] In order to prevent the reception of the firmware update from being interrupted or interrupted when the MCU receives the firmware upgrade package, a disabled timer interrupt is set during the firmware reception process; each frame of the received firmware is subjected to a CRC check. If an error occurs in the check, the MCU will receive the corresponding frame again until the CRC check passes.
[0156] This ensures that every frame received is correct, stores the received firmware in the second storage location of the external flash, and stores the time, firmware size, and firmware type in front of the address where the firmware is stored, to facilitate the boot program to match the new firmware.
[0157] The external flash is divided into two blocks of addresses for storage when updating the program, which are defined as a first storage location and a second storage location. The location storing the current APROM storage is the first storage location, and the storage location storing the updated firmware is the second storage location.
[0158] When the update is completed, the storage location storing the updated firmware is marked as the first storage location, the firmware stored in the original first storage location is retained, and the original first storage location is marked as the second storage location, waiting for the next upgrade to store the upgraded firmware or calling the previous version of the firmware when performing a rollback.
[0159] After the firmware is received, the firmware update flag is set to 1.
[0160] The flag states of the firmware update flag include: 0-Maintain: no need to load, maintain the original firmware operation; 1-Upgrade: load the latest program and perform firmware upgrade and update; 2-Rollback: load the previous version of the program and roll back the firmware version.
[0161] Step 303, the MCU is restarted, and the boot program in the LDROM is started to determine whether the firmware update flag is required.
[0162] If it is 1, the file information of the new firmware is read out, including the firmware storage address, firmware size, firmware type, and firmware storage time.
[0163] First, read out the firmware suffix to determine whether it contains the executable file suffix ".bin". If not, it means that the received file type is incorrect. Do not make any changes to the APROM program and directly run the original APROM main program.
[0164] If it contains an executable file, the time of the new firmware is compared with the main program in the current APROM to determine whether they are the same firmware. If they are the same firmware, the original APROM main program is directly run.
[0165] If they are not the same firmware, a secondary check is performed, which is to read the checksum of the stored new firmware and recalculate whether the checksum of the new firmware is consistent. If they are inconsistent, it means that the firmware stored in FLASH is damaged, and the main program of the existing APROM is directly run.
[0166] If the firmware verification is consistent, the APROM firmware will be replaced with the new firmware, and the APROM file information, time, size, verification, etc. will be updated to prepare for the next update. After the update, the firmware update flag will be set to 0.
[0167] Step 304, after updating APROM, restart and run the boot program in LDEOM first. If the boot program finds that the update flag is 0, it will directly run the main program in APROM. So far, the update is completed.
[0168] Since MCU is configured with FLASH externally, there is enough space to store two versions of firmware. If the user needs to roll back to the original version, the backend server opens relevant permissions and the terminal sends a rollback command to roll back to the original version.
[0169] Step 305, the monitoring device sends a rollback instruction, and the main program in the APROM parses the data in the serial port in real time. If a rollback instruction is found, the firmware update flag is set to 2, and then the system restarts.
[0170] Step 306, after restarting, run from the boot program, find the firmware update flag, the status mark is 2, then erase the APROM program, copy the firmware different from the current APROM storage location to the APROM location, and update the current APROM storage location, update the firmware flag, and set it to 0.
[0171] When the rollback is completed, the second storage location is marked as the first storage location.
[0172] Step 307, after restarting, roll back to the previous version.
[0173] Embodiment 4
[0174] Figure 5FIG. 1 shows an internal structure diagram of a computer device in an embodiment. The computer device may be a terminal or a server. Figure 5 As shown, the computer device includes a processor, a memory and a network interface connected via a system bus. Among them, the memory includes a non-volatile storage medium and an internal memory. The non-volatile storage medium of the computer device stores an operating system and may also store a computer program. When the computer program is executed by the processor, the processor can implement the MCU firmware remote upgrade method. The internal memory may also store a computer program. When the computer program is executed by the processor, the processor can execute the MCU firmware remote upgrade method. Those skilled in the art can understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0175] In one embodiment, a computer device is provided, comprising a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the following steps:
[0176] The device receives the upgrade message and determines whether it is in a state where an upgrade is required. If it is determined that the device is in a state where an upgrade is required, the device sends a message confirmation to the second server, and the upgrade message is pushed by the second server;
[0177] Whether the device is in a state where an upgrade is required is determined by whether an upgrade instruction sent by the terminal is obtained;
[0178] The upgrade instruction is issued by the terminal, and the condition for issuing the upgrade instruction is that the version number of the first firmware running on the device is lower than the version number of the second firmware included in the upgrade message pushed by the second server, or the version number of the second firmware included in the upgrade message pushed by the second server is lower than the version number of the third firmware on the terminal;
[0179] The second firmware is stored on the first server and is the latest version of all firmware stored on the first server;
[0180] The firmware version number included in the upgrade message is the version number of the second firmware;
[0181] Before the terminal sends an upgrade instruction, it needs to register to bind the device and the terminal;
[0182] The device end requests the first server to obtain the upgraded firmware according to the upgrade message pushed by the second server, and the device end receives the second firmware sent by the first server in response;
[0183] The second firmware sent by the first server in response is determined by the firmware version information included in the request information sent by the device end;
[0184] The device uses the received second firmware to perform an upgrade step;
[0185] When the upgrade is completed, compare the currently running firmware version number with the second firmware version number contained in the upgrade message pushed by the second server;
[0186] If they are consistent, a successful upgrade message is published to the second server;
[0187] The upgrade success message arrives at the second server, the device end upgrade success information is recorded on the second server, and the device end receives confirmation information from the second server recording the device end upgrade success information.
[0188] In one embodiment, a computer-readable storage medium is provided, storing a computer program, wherein when the computer program is executed by a processor, the processor performs the following steps:
[0189] The device receives the upgrade message and determines whether it is in a state where an upgrade is required. If it is determined that the device is in a state where an upgrade is required, the device sends a message confirmation to the second server, and the upgrade message is pushed by the second server;
[0190] Whether the device is in a state where an upgrade is required is determined by whether an upgrade instruction sent by the terminal is obtained;
[0191] The upgrade instruction is issued by the terminal, and the condition for issuing the upgrade instruction is that the version number of the first firmware running on the device is lower than the version number of the second firmware included in the upgrade message pushed by the second server, or the version number of the second firmware included in the upgrade message pushed by the second server is lower than the version number of the third firmware on the terminal;
[0192] The second firmware is stored on the first server and is the latest version of all firmware stored on the first server;
[0193] The firmware version number included in the upgrade message is the version number of the second firmware;
[0194] Before the terminal sends an upgrade instruction, it needs to register to bind the device and the terminal;
[0195] The device end requests the first server to obtain the upgraded firmware according to the upgrade message pushed by the second server, and the device end receives the second firmware sent by the first server in response;
[0196] The second firmware sent by the first server in response is determined by the firmware version information included in the request information sent by the device end;
[0197] The device uses the received second firmware to perform an upgrade step;
[0198] When the upgrade is completed, compare the currently running firmware version number with the second firmware version number contained in the upgrade message pushed by the second server;
[0199] If they are consistent, a successful upgrade message is published to the second server;
[0200] The upgrade success message arrives at the second server, the device end upgrade success information is recorded on the second server, and the device end receives confirmation information from the second server recording the device end upgrade success information.
[0201] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the program can be stored in a non-volatile computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0202] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0203] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A method for remotely upgrading MCU firmware, characterized in that: For the device side, it includes the following steps: The device receives the upgrade message and determines whether it is in a state where an upgrade is required; When it is determined that an upgrade is required, the device sends a message to the second server for confirmation, and the upgrade message is pushed by the second server; Whether the device is in a state where an upgrade is required is determined by whether an upgrade instruction sent by the terminal is obtained; The upgrade instruction is issued by the terminal, and the condition for issuing the upgrade instruction is that the version number of the first firmware running on the device is lower than the version number of the second firmware included in the upgrade message pushed by the second server, or the version number of the second firmware included in the upgrade message pushed by the second server is lower than the version number of the third firmware on the terminal; The second firmware is stored on the first server and is the latest version of all firmware stored on the first server; The firmware version number included in the upgrade message is the version number of the second firmware; Before the terminal sends an upgrade instruction, it needs to register to bind the device and the terminal; The device end requests the first server to obtain the upgraded firmware according to the upgrade message pushed by the second server, and the device end receives the second firmware sent by the first server in response; The second firmware sent by the first server in response is determined by the firmware version information included in the request information sent by the device end; The device uses the received second firmware to perform firmware upgrade; When the upgrade is completed, compare the currently running firmware version number with the second firmware version number contained in the upgrade message pushed by the second server; If they are consistent, a successful upgrade message is published to the second server; The upgrade success message arrives at the second server, the device end upgrade success information is recorded on the second server, and the device end receives confirmation information from the second server recording the device end upgrade success information.
2. The MCU firmware remote upgrade method according to claim 1, characterized in that: include: When the version number of the second firmware included in the upgrade message pushed by the second server is lower than the version number of the third firmware on the terminal, the terminal uploads the third firmware to the first server; After the first server receives the complete third firmware, the third firmware becomes the latest version of the firmware stored on the first server, that is, the second firmware; The first server publishes an upgrade message to the second server. After receiving the upgrade message, the second server records the second firmware version number included in the upgrade message. After the recording is completed, the second server sends a confirmation message to the first server.
3. The MCU firmware remote upgrade method according to claim 2, characterized in that: include: The upgrade instruction includes a return instruction, which is sent by the terminal to the device end when the first firmware running on the device end is abnormal or unstable or a specific firmware version needs to be used; The return instruction contains the firmware version number to be returned.
4. The MCU firmware remote upgrade method according to claim 3, characterized in that: include: The device sends a request message to the first server to obtain the firmware according to the firmware version number to be returned contained in the return instruction, and receives the firmware version sent by the first server in response; The request information includes the firmware version number information to be obtained; The firmware version sent by the first server in response is determined by the firmware version number information included in the request information sent by the device; The device uses the received firmware to perform the upgrade steps. When the upgrade is completed, a return success message is sent to the second server. The second server records the current firmware information status of the device and sends a confirmation message of the received information to the device.
5. The MCU firmware remote upgrade method according to claim 1, characterized in that: include: The device side includes a monitoring device and a mainboard, and the receiving firmware is completed by the monitoring device; Step 301, after the monitoring device obtains the upgrade firmware, it sends an upgrade request to the mainboard, including the firmware type, firmware size, and firmware name; Step 302, after receiving the upgrade request, the mainboard responds to the monitoring device; After receiving the upgrade response, the monitoring device transmits the firmware to the mainboard, and the mainboard receives the firmware. The receiving step is completed by the MCU of the mainboard; During the MCU receiving firmware, a disabled timer interrupt is set to prevent the receiving of updated firmware from being interrupted or interrupted; Each frame of the receiving firmware is checked to ensure that each frame received is correct; The MCU stores the received firmware in the second storage location of the external flash, and stores the time, firmware size, and firmware type in front of the address where the firmware is stored, so as to guide the program to match the new firmware. Two storage locations are set in the external flash, namely a first storage location and a second storage location, the storage location for storing the current APROM is the first storage location, and the storage location for storing the updated firmware is the second storage location; After the firmware is received, the flag status of the firmware update flag is set to upgrade; Step 303, the MCU is restarted, and the boot program in the LDROM is started to determine the status of the firmware update flag. If it is an upgrade, the firmware file information in the second storage location is read out, the firmware of the APROM is replaced with the firmware in the second storage location, and the file information of the APROM is updated to prepare for the next update. After the update, the flag state of the update firmware flag is set to maintain; Step 304, after the APROM is updated, the system is restarted and the boot program in the LDROM is run. The boot program finds that the flag state of the update flag is maintained, and directly runs the main program in the APROM, and the update is completed.
6. The MCU firmware remote upgrade method according to claim 5, characterized in that: Before replacing the APROM firmware, perform the following file verification steps: Read out the firmware file information in the second storage location, including the firmware storage address, firmware size, firmware type, and firmware storage time; Read the firmware suffix to determine whether it contains the executable file suffix. If not, it means that the received file type is incorrect. Do not modify the APROM program and directly run the APROM main program. If it contains an executable file, compare the time of the new firmware with the firmware time of the main program in the current APROM to determine whether they are the same. If they are the same firmware, directly run the main program of APROM; If the firmware is different, a secondary check is performed to determine whether the checksum of the new firmware read from the storage is consistent with the checksum of the new firmware recalculated. If the verification is inconsistent, run the main program of APROM directly; If the verification is consistent, the APROM firmware is replaced with the new firmware, and the APROM file information, time, size and verification are updated.
7. The MCU firmware remote upgrade method according to claim 6, characterized in that: include: Step 305, the monitoring device sends a rollback instruction, and the main program in the APROM finds that there is a rollback instruction, then sets the flag state of the update flag bit to rollback, and then restarts; Step 306, after restarting, running from the boot program, finding that the flag state of the update flag is rollback, erasing the APROM program, copying the firmware stored in the second storage location to the APROM location, and updating the current APROM storage location, and setting the flag state of the update flag to maintain; Step 307, after restarting, roll back to the previous version.
8. A MCU firmware remote upgrade device, characterized in that: include: The device end 100 is a device terminal including an MCU module and a monitoring module or a device terminal in which the MCU module has a monitoring function; the MCU module implements device functions and device control for users, and the monitoring module or monitoring function is used to monitor important data of the device and MCU and upgrade the firmware of the MCU; The terminal 110 is installed with a client, which is a client having an information acquisition function, or a client having both an information acquisition function and an upgrade instruction sending function, or a client having both an information acquisition function and an upgrade firmware file sending and receiving function, or a client having both an upgrade instruction function and an upgrade firmware file sending and receiving function; The obtaining of information includes obtaining firmware information of the device, obtaining firmware information stored on the server, and obtaining firmware information released by the server; Before the client obtains information from the device or server, sends upgrade instructions, or sends and receives upgrade firmware files, it needs to register through the APP or system so that the client and the device are bound or associated with each other; The first server 130 is used to store and send firmware for upgrading and publish upgrading messages; The second server 140 is used to receive and record the running firmware information of the device, the firmware information for upgrading stored in the first server, and push the upgrading message; The terminal 110 is connected to the device end 100, the first server 130, and the second server 140 via a wireless network or a wired network; the device end 100 is connected to the first server 130 and the second server 140 via a wireless network or a wired network; the first server 130 and the second server 140 are connected via a wireless network or a wired network.
9. A computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, the processor is caused to perform the steps of the method according to any one of claims 1 to 7.
10. A computer device comprising a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the method according to any one of claims 1 to 7.
Citation Information
Cited By
Remote upgrading method and device for firmware program and computer equipment
CN119557145A
