WO2018120213A1 - 一种固件更新方法及控制器 - Google Patents

一种固件更新方法及控制器 Download PDF

Info

Publication number
WO2018120213A1
WO2018120213A1 PCT/CN2016/113920 CN2016113920W WO2018120213A1 WO 2018120213 A1 WO2018120213 A1 WO 2018120213A1 CN 2016113920 W CN2016113920 W CN 2016113920W WO 2018120213 A1 WO2018120213 A1 WO 2018120213A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
controller
firmware
update
data packet
Prior art date
Application number
PCT/CN2016/113920
Other languages
English (en)
French (fr)
Inventor
唐恒悦
Original Assignee
深圳配天智能技术研究院有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳配天智能技术研究院有限公司 filed Critical 深圳配天智能技术研究院有限公司
Priority to CN201680037941.XA priority Critical patent/CN107820603A/zh
Priority to PCT/CN2016/113920 priority patent/WO2018120213A1/zh
Publication of WO2018120213A1 publication Critical patent/WO2018120213A1/zh

Links

Images

Classifications

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

Definitions

  • the present invention relates to the field of computer technologies, and in particular, to a firmware update method and a controller.
  • the prior art directly writes the memory integrated in the processing chip through a specific data interface.
  • the FLASH can be directly written through the JTAG interface.
  • the first step is to use the hardware logic to inform the system whether to update the program (firmware). If the program needs to be updated, the data is directly programmed through the corresponding data interface. Complete the update to the corresponding storage location in FLASH.
  • the inventors have found that the prior art has the following problem: since the update data is directly written to the storage location of the original program of the FLASH. In the case of a programming error, the original program code will be damaged, making the processor (such as the programmable logic controller) not working properly.
  • the embodiment of the invention provides a firmware update method and a controller, which are designed to solve the problem that the original program code is broken and the processor cannot work during the firmware update process.
  • a first aspect of the embodiments of the present invention provides a firmware update method, including:
  • the controller determines whether it is necessary to update the firmware
  • the controller copies the firmware update data in the backup storage area to a storage location of the original firmware data.
  • the controller determining whether the firmware needs to be updated includes:
  • the controller sets an update flag register for determining whether the firmware needs to be updated in the program
  • the controller determines whether the firmware needs to be updated according to whether the update flag register is set.
  • the method further includes:
  • the controller acquires a reset instruction
  • the controller determines whether the update flag register is set
  • the obtaining firmware update data and programming the firmware update data into the backup storage area includes:
  • the controller receives the firmware update data frame by frame, and saves the received firmware update data forming data packet of the current frame in a random access memory RAM;
  • the controller programs the data packet into the backup storage area
  • the controller verifies whether the data packet is programmed correctly
  • the method further includes:
  • the controller determines whether the number of repeated programming of the data packet reaches a predetermined threshold
  • the method further includes:
  • the controller determines whether the data packet that is programmed to the backup storage area is the last frame of data
  • the controller determining whether the data packet that is programmed to the backup storage area is the last frame data includes:
  • the controller acquires an ordinal number of the current data packet
  • the controller determines whether the data packet of the backup storage area is the last frame data according to whether the ordinal number of the current data packet is equal to the total number of frames included in the firmware update data.
  • the controller performs firmware update using modbus communication.
  • a second aspect of the embodiments of the present invention provides a controller, including:
  • An update judging unit configured to determine whether it is necessary to update the firmware
  • a programming unit configured to: when it is determined that the firmware needs to be updated, obtain firmware update data, and program the firmware update data into the backup storage area;
  • a copying unit configured to copy the firmware update data in the backup storage area to a storage location of the original firmware data.
  • the update determining unit is configured to determine whether the firmware needs to be updated, including:
  • the update determining unit is configured to set, in the program, an update flag register for determining whether the firmware needs to be updated;
  • the update determining unit is further configured to determine whether the firmware needs to be updated according to whether the update flag register is set.
  • the controller further includes: a reset unit;
  • the reset unit is configured to acquire a reset instruction
  • the reset unit is further configured to determine whether the update flag register is set
  • the programming unit is further configured to:
  • the controller further includes a first programming state determining unit
  • the first programming state determining unit is configured to determine whether the number of repeated programming of the data packet reaches a predetermined threshold
  • the controller further includes a second programming state determining unit
  • a second programming state determining unit configured to determine whether a data packet that is programmed to the backup storage area is the last frame data
  • the second programming state determining unit is configured to determine whether a data packet that is programmed to the backup storage area is included in a last frame of data
  • the second programming state determining unit is configured to acquire an ordinal number of the current data packet
  • the second programming state determining unit is configured to determine whether the data packet of the backup storage area is the last frame data according to whether the ordinal number of the current data packet is equal to the total number of frames included in the firmware update data.
  • the controller performs firmware update using modbus communication.
  • a third aspect of the embodiments of the present invention provides a controller, including: a processor, a memory, an interface, and a bus, wherein the processor, the memory, and the interface are connected by using the bus, and the interface is used for input/ The data is output, the memory is for storing program code, and the processor is configured to invoke the program code to execute the firmware update method according to any one of the above.
  • the update data is programmed in the backup storage area.
  • the original program code is not destroyed, and the controller can continue to use without affecting the normal operation of the system.
  • the update data is burned, it is moved to the storage location of the original program to replace the original program to complete the firmware update.
  • FIG. 1 is a flowchart of an embodiment of a firmware update method according to an embodiment of the present invention
  • step 101 in FIG. 1 is a specific flowchart of step 101 in FIG. 1;
  • FIG. 3 is a flowchart of another embodiment of a firmware update method according to an embodiment of the present invention.
  • step 207 in FIG. 3 is a specific flowchart of step 207 in FIG. 3;
  • FIG. 5 is a flowchart of another embodiment of a firmware update method according to an embodiment of the present invention.
  • FIG. 6 is a block diagram of a module of an embodiment of a controller according to an embodiment of the present invention.
  • FIG. 7 is a block diagram of a module of another embodiment of a controller according to an embodiment of the present invention.
  • FIG. 8 is a hardware block diagram of an embodiment of a controller in an embodiment of the present invention.
  • the firmware update method of the present invention can be applied to a plurality of different types of processors or controllers having different processing cores, and can be widely used in applications such as microcontroller systems, vehicle body control systems, industrial control systems, and the like.
  • the existing processor or controller can provide a corresponding data interface (such as a JTAG interface or a serial interface, etc.), allowing programming and updating of the program during use.
  • a corresponding data interface such as a JTAG interface or a serial interface, etc.
  • the STM32 series of processors can provide JTAG interface and serial interface.
  • the built-in FLASH also allows circuit programming and programming in the application.
  • the firmware update of the processor can be realized by serial cable or suitable data communication. , adding new features.
  • the existing firmware update method is to pass the serial connection cable, accept the binary update data and directly burn it to the location of the function program corresponding to FLASH.
  • the code has been corrupted and the entire processor will not work properly.
  • the firmware update method of the present invention when updating, the data is first placed in an additional backup storage area, and until the completion of all, the original function program is overwritten to ensure that the original function program is abnormally programmed. , still able to maintain the normal operation of the processor.
  • FIG. 1 is a flowchart of a method for updating a firmware in an embodiment of the present invention, the method includes:
  • the controller determines whether it is necessary to update the firmware. If yes, go to step 102; if no, go to step 103.
  • the controller can employ any suitable processor or controller of the prior art having a control core and memory for storing executable programs.
  • an external command can be received by means of hardware logic such as an external button to inform the system that the firmware update is required.
  • Obtaining firmware update data refers to receiving firmware update data sent by a primary station (such as a control background, a personal computer, etc.) through a data port built in the controller in a specific data transmission manner.
  • a primary station such as a control background, a personal computer, etc.
  • the firmware update data can be transmitted in a form corresponding to the data transfer protocol according to the specific data transfer protocol used.
  • the firmware update data is a new function program written by the relevant technicians in the application process of the system according to the actual application requirements or the application environment changes, the original firmware program is improved, and some functions are added or reduced.
  • These programs can be APP, operating system, embedded system or other types of programs.
  • the backup storage area may be in the memory of the controller, other than the storage area of the original function program. In the actual operation, it can be represented by the program's storage address.
  • the backup storage area can be set at the initial programming of the controller, and a separate executable program can be set to control the firmware update data to be programmed at the specified storage address (ie, the storage area) without overwriting the original function program.
  • the controller copies the firmware update data in the backup storage area to a storage location of the original firmware data. After the firmware update data is programmed in the backup storage area, it has become a complete functional program that can be executed by the processor to perform the corresponding functions. The firmware update data after the programming is copied to the storage location of the original program, and the original function program is overwritten to complete the firmware update operation.
  • the controller may be a PLC (Programmable Logic Controller), and its memory may be FLASH (flash) accordingly. Since the update data is not directly programmed in the original program location, the update data can be fully verified and confirmed, and then copied and transferred to the original program location without affecting the normal operation of the controller.
  • PLC Programmable Logic Controller
  • FLASH flash
  • the system can be notified of whether a firmware update is required in a number of different ways.
  • step 101 may specifically include:
  • An update flag register for determining whether firmware is required to be updated is set in the program.
  • the update status register is an identification flag for determining whether firmware needs to be updated, and is related to the flag of the software.
  • the flag bit is a flag used in the software to judge the execution status of the instruction. In the programming, a plurality of different types of flag bits can be used to complete the corresponding state judgment. Based on the perfect logic, an appropriate flag bit can be added to the software, so that the system can determine whether the firmware needs to be updated by identifying the flag bit (ie, the corresponding status register).
  • step 1012. The controller determines whether the update flag register is set to determine whether the firmware needs to be updated. If the update flag register is set, step 1013 is performed. If the update flag register is not set, step 1015 is performed.
  • the update status register includes two states, set and clear, corresponding to 1 and 0 (or high level, low level), which can be used as the basis for status identification. After the appropriate flag is added to the software, the update status register can be used to indicate that the current system needs to update the firmware. When cleared, it indicates that the current system does not need to update the firmware. The system can read the status of the current update flag register to see if a firmware update is required.
  • the update status register is cleared.
  • the update status register is cleared to indicate that the firmware does not need to be updated.
  • the flag bit transition causes the update status register to be set again, telling the system that a firmware update is required.
  • this embodiment has the following advantages: using the judging method described in the embodiment of the present invention, adding a flag bit from the software does not need to additionally increase the hardware structure, thereby reducing the hardware workload and cost.
  • the firmware update method of the present invention can accomplish the transfer of firmware update data using a plurality of different types of data transfer protocols.
  • another embodiment of the present invention will be described in detail by taking a firmware online update in the manner of modbus bus communication.
  • the program code for performing firmware update (hereinafter referred to as a read program) and the program code of the firmware itself need to be separately written in the memory.
  • the program code for firmware update is based on the need to initially burn through a data interface (such as the JTAG interface), and the initial firmware code can also be burned through this interface.
  • the modbus communication method is used to complete the firmware update during the running of the reading program.
  • the modbus bus communication includes both the primary station and the secondary station, wherein the controller is a secondary station that receives firmware update data.
  • the primary station can be any suitable device for providing corresponding firmware update data to the secondary station.
  • the method includes two separate portions, the first portion being an in-controller execution portion of the controller that determines whether firmware needs to be updated and copies of firmware update data within the controller. The second part is the data transmission part between the controller and the master station.
  • the first part may be specifically implemented by using the technical solutions in the foregoing embodiments of the present invention, and the description is simple and will not be described herein.
  • step 102 may include:
  • the controller receives firmware update data frame by frame, and forms a data packet to be saved in the RAM.
  • the controller can receive the firmware update data through the serial port after receiving the firmware update command from the master station.
  • the complete firmware update data is sent from the primary station into multiple data frames.
  • the controller Through the modbus protocol communication, the controller (slave) can be informed of the update request by the protocol command mode, and the main station is in the process of communication with other modbus communication command modes, and there is no need to add other methods to judge the online update requirement.
  • the controller receives data in a basic unit, receiving one packet at a time until all packets are received.
  • the received binary data is preferably saved in RAM and then burned.
  • the controller programs the data packet into the backup storage area.
  • the above firmware update data is transmitted in units of data packets, and each data packet is stored in the backup storage area of the memory after being stored in the RAM.
  • each data packet has its own corresponding, different burning address to avoid overlapping between different data packets. Therefore, after each packet is programmed, the burn address needs to be updated to facilitate the next programming.
  • step 203 The controller verifies whether the data packet is correctly programmed. If the verification programming is correct, the next data packet may be programmed, and step 206 is performed. If the verification programming is incorrect, step 204 is performed. Data burning may result in improper programming or programming failure for a variety of different reasons. After each packet is programmed, it needs to be verified whether it is programmed correctly to ensure normal firmware update.
  • the controller determines whether the number of repeated programming of the data packet reaches a predetermined threshold. If yes, go to step 205. If no, execute 202 to repeatedly program the data packet.
  • the predetermined threshold can be set according to actual usage or experience, for example, set to 5 times, or more.
  • this embodiment has the following advantages: by the threshold setting of the above-mentioned repeated programming, it is possible to avoid the problem that the data can be repeatedly repeated and the firmware update time is wasted due to the error that cannot be eliminated. It also helps to prompt the occurrence of error conditions, eliminate errors as soon as possible, and complete the firmware update faster.
  • the firmware update data is divided into a plurality of data packets, and the binary files are transmitted in a plurality of cyclic transmissions. Further, it is also necessary to confirm whether the data packet of the firmware update data is transmitted.
  • step 206 Determine whether the data packet that is programmed to the backup storage area is the last frame data. If yes, go to step 207. If no, go to step 201 to receive the next frame of firmware update data. If it is not the last frame of data, it indicates that the updated firmware data has not been sent yet, and the primary station needs to continue to transmit and continue to receive and burn one frame of data. The corresponding command is in response to the primary station, and the data packet is successfully programmed to continue receiving and writing data of the next frame.
  • the reception and programming of data for each frame are the same process, and will not be described herein.
  • step 207 Set an update flag register to feed back firmware update completion information. After confirming that the data packet is the last frame data, it indicates that the firmware update data has been programmed and can be used, and then step 104 is performed. By setting the update flag register, the software flag bit continues to be used to determine if the next firmware update is required.
  • the controller can respond to the primary station, program the information that has been completely completed, and make information to the primary station that the update has been completed, and does not need to continue to transmit.
  • step 207 may specifically include:
  • the master station transmits data
  • the number of the data packets of the firmware update data that is, the data packet of the first few frames at this time
  • the total number of frames of the firmware update data (the total number of data packets included) may be recorded in each frame.
  • the ordinal number of the packet is recorded on the fourth byte
  • the total number of frames of the packet is recorded in the third byte.
  • an independent packet counter can also be set in the controller to return the count result of the received packet counter to the primary station, for the primary station to verify whether the sequence number of the data packet is correct.
  • this embodiment has the following advantages: since the communication between the controller and the primary station is based on the modbus communication protocol, the settings can be customized in the transmitted data frame, including various necessary information.
  • the inclusion of the data packet sequence number information in the data frame enables the controller to clearly understand the data transmission situation when receiving and parsing the instruction, determine the reliability of the data transmission, and quickly find the problem when the data transmission error occurs.
  • firmware program After the firmware program is updated, it is generally necessary to perform a system restart and reset to allow the controller to continue working according to the updated firmware program.
  • the method may include:
  • the controller acquires a reset instruction.
  • the slave station can use the primary station to issue a reset command to initiate a system soft reset.
  • the controller determines whether the update flag register is set. If yes, go to step 303; if no, go to step 304. As described in the above embodiment, after the firmware update data is programmed, the update flag register will be set to indicate that the firmware has been updated. Therefore, the system can determine whether a soft reset operation needs to be performed according to whether the update flag register is set.
  • the reset operation is not performed.
  • the update flag register is not set, it is opposite to the above case, indicating that the firmware update is still in the process of transmission and cannot be reset.
  • this embodiment has the following advantages: In the above manner, the controller can implement the firmware program update under the condition of constant power restart, and continue to work according to the updated firmware program. This can avoid unnecessary troubles and effects on the system when the controller is powered on/off.
  • FIG. 6 is a block diagram of an embodiment of a controller according to an embodiment of the present invention.
  • the controller includes:
  • An update determining unit 401 configured to determine whether it is necessary to update the firmware
  • the programming unit 402 is configured to: when it is determined that the firmware needs to be updated, acquire firmware update data, and program the firmware update data into the backup storage area;
  • the copying unit 403 is configured to copy the firmware update data in the backup storage area to the storage location of the original firmware data.
  • the update determining unit 401 is specifically configured to:
  • FIG. 7 is a block diagram of another embodiment of the controller in the present invention.
  • the controller also includes a reset unit 404.
  • the reset unit 404 is configured to acquire a reset instruction and determine whether the update flag register is set; if yes, perform a reset operation; if not, perform a reset operation.
  • the programming unit 402 is specifically configured to:
  • the controller further includes a first programming state determining unit 405.
  • the first programming state determining unit 405 is configured to determine whether the number of repeated programming of the data packet reaches a predetermined threshold
  • the controller further includes a second programming state determination unit 406.
  • the second programming state determining unit 406 is configured to determine whether the data packet that is programmed to the backup storage area is the last frame data
  • the second programming state determining unit 406 is specifically configured to:
  • Whether the data packet of the backup storage area is the last frame data according to whether the ordinal number of the current data packet is equal to the total number of frames included in the firmware update data.
  • the controller adopts a modbus bus communication manner, and receives an instruction sent by the primary station and firmware update data to complete the firmware update.
  • FIG. 8 is a hardware block diagram of an embodiment of a controller according to an embodiment of the present invention.
  • the controller may be a programmable logic controller.
  • the controller 500 includes a processor 501 , a memory 502 , an interface 503 , and a bus 504 .
  • the processor 501 is connected to the memory 502 via a bus 503, and the data interface 503 (such as a JATG port) is used to burn data.
  • the memory 502 is for storing program code
  • the processor 501 is for calling the program code to execute the data processing method according to any of the above.
  • the disclosed system, apparatus, and method may be implemented in other manners.
  • the device embodiments described above are merely illustrative.
  • the division of the unit is only a logical function division.
  • there may be another division manner for example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored or not executed.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be indirect coupling through some interface, device or unit.
  • a communication connection which may be in electrical, mechanical or other form.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
  • each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
  • the above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
  • the integrated unit if implemented in the form of a software functional unit and sold or used as a standalone product, may be stored in a computer readable storage medium.
  • the technical solution of the present invention which is essential or contributes to the prior art, or all or part of the technical solution, may be embodied in the form of a software product stored in a storage medium.
  • a number of instructions are included to cause a computer device (which may be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention.
  • the foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like. .

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

一种固件更新方法及控制器,旨在解决系统固件升级过程中,发生烧写异常情况时,原有固件程序受损,系统无法正常工作的问题。该方法包括:控制器判断是否需要更新固件(101);若是,则获取固件更新数据,并将所述固件更新数据烧写至备份存储区域中(102);所述控制器将所述备份存储区域中的所述固件更新数据拷贝到原固件数据的存储位置(104)。

Description

一种固件更新方法及控制器 技术领域
本发明涉及计算机技术领域,尤其涉及一种固件更新方法及控制器。
背景技术
在软件系统开发完毕后,在应用过程中,由于使用要求等情况的变化,需要对系统增加一部分的功能。对于系统中的核心处理器而言,即需要更新其固件。
为了便于固件的更新,现有技术通过特定的数据接口,直接对处理芯片内整合的存储器进行烧写,例如对于stm32的固件更新,可以直接通过JTAG接口对其FLASH进行烧写。
在现有的固件更新过程中,首先是通过外部按键等利用硬件逻辑的方式来告知系统是否需要更新程序(固件),若需要对程序进行更新,则通过对应的数据接口,将数据直接烧写到FLASH中对应的存储位置中,完成更新。
在实现本发明的过程中,发明人发现现有技术存在以下问题:由于更新数据直接烧写到FLASH的原有程序的存储位置上。在出现烧写错误的情况下,将导致原有程序代码破损,使得处理器(如:可编程逻辑控制器)无法正常工作。
发明内容
本发明实施例提供了一种固件更新方法及控制器,旨在解决固件更新过程中,烧写错误导致原有程序代码破损,处理器无法工作的问题。
本发明实施例的第一方面提供一种固件更新方法,包括:
控制器判断是否需要更新固件;
若是,则获取固件更新数据,并将所述固件更新数据烧写至备份存储区域中;
所述控制器将所述备份存储区域中的所述固件更新数据拷贝到原固件数据的存储位置。
相应地,所述控制器判断是否需要更新固件包括:
所述控制器在程序内设置用于判断是否需要更新固件的更新标志寄存器;
所述控制器根据所述更新标志寄存器是否置位,以判断是否需要更新固件。
相应地,所述控制器将所述备份存储区域中的所述固件更新数据拷贝到原固件数据的存储位置之后,所述方法还包括:
所述控制器获取复位指令,
所述控制器判断更新标志寄存器是否置位;
若是,执行复位操作;
若否,不执行复位操作。
相应地,所述获取固件更新数据,并将所述固件更新数据烧写至备份存储区域中包括:
所述控制器逐帧地接收所述固件更新数据,并将接收到的当前帧的固件更新数据形成数据包保存在随机存取存储器RAM中;
所述控制器将所述数据包烧写至所述备份存储区域中;
所述控制器校验所述数据包是否烧写正确;
若否,则返回执行所述控制器将所述数据包烧写至所述备份存储区域中。
相应地,所述控制器校验所述数据包是否烧写正确之后,所述方法还包括:
所述控制器判断所述数据包的重复烧写次数是否达到预定的阈值;
若是,反馈固件更新数据烧写失败信息。
相应地,如果所述控制器校验所述数据包烧写正确,所述方法还包括:
所述控制器判断烧写至所述备份存储区域的数据包是否为最后一帧数据;
若是,反馈固件更新完成信息。
相应地,所述控制器判断烧写至所述备份存储区域的数据包是否为最后一帧数据包括:
所述控制器获取当前数据包的序数;
所述控制器根据所述当前数据包的序数是否与固件更新数据包含的总帧数相等,以判断所述备份存储区域的数据包是否为最后一帧数据。
相应地,所述控制器采用modbus总线通信方式完成固件更新。
本发明实施例的第二方面提供一种控制器,包括:
更新判断单元,用于判断是否需要更新固件;
烧写单元,用于当判断为需要更新固件时,获取固件更新数据,并将所述固件更新数据烧写至备份存储区域中;
复制单元,用于将所述备份存储区域中的所述固件更新数据拷贝到原固件数据的存储位置。
相应地,所述更新判断单元用于判断是否需要更新固件包括:
所述更新判断单元用于在程序内设置用于判断是否需要更新固件的更新标志寄存器;
所述更新判断单元还用于根据所述更新标志寄存器是否置位,以判断是否需要更新固件。
相应地,所述控制器还包括:复位单元;
所述复位单元用于获取复位指令;
所述复位单元还用于判断更新标志寄存器是否置位;
若是,执行复位操作;
若否,不执行复位操作。
相应地,所述烧写单元还用于:
逐帧地接收所述固件更新数据,并将接收到的当前帧的固件更新数据形成数据包保存在随机存取存储器RAM中;
将所述数据包烧写至所述备份存储区域中;
校验所述数据包是否烧写正确;
若否,则返回执行所述控制器将所述数据包烧写至所述备份存储区域中。
相应地,所述控制器还包括第一烧写状态判断单元;
所述第一烧写状态判断单元用于判断所述数据包的重复烧写次数是否达到预定的阈值;
若是,反馈固件更新数据烧写失败信息。
相应地,所述控制器还包括第二烧写状态判断单元;
第二烧写状态判断单元,用于判断烧写至所述备份存储区域的数据包是否为最后一帧数据;
还用于在烧写至所述备份存储区域的数据包是为最后一帧数据时,反馈固件更新完成信息;
还用于在烧写至所述备份存储区域的数据包不为最后一帧数据时,接收下一帧固件更新数据。
相应地,所述第二烧写状态判断单元用于判断烧写至所述备份存储区域的数据包是否为最后一帧数据包括;
所述第二烧写状态判断单元用于获取当前数据包的序数;
所述第二烧写状态判断单元用于根据所述当前数据包的序数是否与固件更新数据包含的总帧数相等,以判断所述备份存储区域的数据包是否为最后一帧数据。
相应地,所述控制器采用modbus总线通信方式完成固件更新。
本发明实施例的第三方面提供一种控制器,包括:处理器、存储器、接口和总线,所述处理器、所述存储器和所述接口通过所述总线连接,所述接口用于输入/输出数据,所述存储器用于存储程序代码,所述处理器用于调用所述程序代码执行如上述任一项所述的固件更新方法。
本发明实施例提供的技术方案中,控制器在进行固件更新时,更新数据被烧写在备份存储区域中。在发生烧写错误或者中断的情况时,原有的程序代码并未被破坏,控制器仍然可以继续使用,不影响系统的正常工作。在更新数据烧写完毕后,再将其搬运至原有程序的存储位置,替代原有程序以完成固件的更新。
附图说明
图1为本发明实施例中固件更新方法一个实施例的流程图;
图2为图1中步骤101的具体流程图;
图3为本发明实施例中固件更新方法另一个实施例的流程图;
图4为图3中步骤207的具体流程图;
图5为本发明实施例中固件更新方法另一个实施例的流程图;
图6为本发明实施例中控制器一个实施例的模块框图;
图7为本发明实施例中控制器另一个实施例的模块框图;
图8为本发明实施例中控制器一个实施例的硬件框图。
具体实施方式
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
本发明的说明书和权利要求书及上述附图中的术语“第一”、“第二”、“第三”和“第四”等(如果存在)是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的实施例能够以除了在这里图示或描述的内容以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。
本发明所述的固件更新方法可以应用于多种不同类型的处理器或者具有不同处理内核的控制器中,可以广泛在例如微控制器系统、车身控制系统、工业控制系统等应用领域中。
一般的,现有的处理器或者控制器中均能够提供对应的数据接口(例如JTAG接口或者串行接口等),允许在使用过程中,进行编程,更新程序。例如,STM32系列的处理器,可以提供JTAG接口和串行接口,其内置的FLASH也允许实现电路编程和在应用中编程,利用串口线或者合适的数据通信方式,即可实现处理器的固件更新,增加新的功能。
现有的固件更新方式为通过串口连接线,接受二进制更新数据后将其直接烧写至FLASH对应的功能程序的位置。在烧写过程出现错误时,由于原有的 代码已经被破坏覆盖,因此,整个处理器将无法正常工作。本发明所述的固件更新方法,在更新时,首先将数据放置在一个额外的备份存储区域中,直到全部完成后,才搬运覆盖原有功能程序,从而保证原有功能程序在烧写异常时,仍能够维持处理器的正常工作。
请参阅图1,其为本发明实施例中固件更新方法的一个实施例的方法流程图,该方法包括:
101、控制器判断是否需要更新固件。若是,执行步骤102;若否,执行步骤103。
控制器可以采用现有技术中任何合适的,具有控制核心及存储可执行程序的存储器所组成的处理器或者控制器。
如上所述,系统(控制器)判断是否需要更新固件时,可以采用现有技术中,通过外部按键等硬件逻辑的方式,接收外部指令从而告知系统需要进行固件更新。
102、获取固件更新数据,并将固件更新数据烧写至备份存储区域中,并执行步骤104。
获取固件更新数据是指通过控制器内设的数据端口,以特定的数据传输方式,接收由主站(例如控制后台、个人电脑等)发出的固件更新数据。
固件更新数据可以根据具体使用的数据传输协议,采用与数据传输协议相对应的形式进行传输。固件更新数据是在系统的应用过程中,相关的技术人员根据实际应用的需求或者应用环境的改变,对于原有固件程序作出改进,增加或者减省一些功能后编写的新的功能程序。这些程序可以是APP,操作系统、嵌入式系统或者其他类型的程序。
备份存储区域可以是控制器的存储器中,除原有功能程序的存储区域外的其他存储区域。实际操作过程中,可以由程序的存储地址表示。备份存储区域可以在控制器的初始烧录时设置,设置独立的可执行程序,控制固件更新数据烧写在指定的存储地址(即存储区域)而不覆盖原有的功能程序。
103、执行原有功能程序。在判断不需要对固件进行更新时,系统可以跳过固件更新的程序,直接读取存储器内存储的原有功能程序并执行。
104、控制器将备份存储区域中的固件更新数据拷贝到原固件数据的存储位置。在固件更新数据在备份存储区域烧写完毕以后,其已经成为一个完整的功能程序,能够供处理器调用执行,发挥相应的功能。将烧写完毕后的固件更新数据拷贝到原程序的存储位置,覆盖原有的功能程序,即可完成固件更新操作。
在上述固件更新实施例中,控制器可以为PLC(可编程逻辑控制器),其存储器相应地,可以为FLASH(闪存)。由于更新数据并不直接烧写在原有程序的位置,因此,可以对更新数据进行充分的校验和确认后,在拷贝搬运到原有的程序位置,不对控制器的正常工作造成影响。
在实际使用过程中,如上所述,可以采用多种不同的方式告知系统是否需要进行固件更新。
请参阅图2,其为图1中步骤101的具体流程图,该步骤101具体可以包括:
1011、在程序内设置用于判断是否需要更新固件的更新标志寄存器。更新状态寄存器是用于判断是否需要更新固件的识别标志,与软件的标志位相关。标志位是软件内一些用于判断指令执行状态的标志,编程中可以使用多种不同类型的标志位,完成对应的状态判断。基于完善的逻辑,可以在软件上增设合适的标志位,从而令系统通过识别标志位(即对应的状态寄存器)来判断是否需要更新固件。
1012、控制器判断更新标志寄存器是否置位,从而确定是否需要更新固件。若更新标志寄存器置位,执行步骤1013。若更新标志寄存器非置位,执行步骤1015。
更新状态寄存器包括了置位和清零两种状态,分别与1和0(或者高电平、低电平)相对应,可以作为状态识别的依据。在软件上增设合适的标志位后,更新状态寄存器可以用置位状态来表示当前系统需要更新固件,清零时则表示当前系统不需要更新固件。系统可以读取当前更新标志寄存器的状态,从而获知是否需要进行固件更新。
1013、将备份存储区域中的固件更新数据拷贝到原固件数据的存储位置。 在判断需要进行固件更新操作后,可以执行与图1所示固件更新方法相同的步骤,对固件进行更新。
1014、固件更新完毕后,更新状态寄存器清零。在固件更新完毕后,对更新状态寄存器进行清零,表示不需要更新固件。在使用过程中,标志位的变换可以使更新状态寄存器再次置位,告知系统需要再次进行固件更新。
1015、跳转至存储器中固件程序存储位置,执行程序。在不需要更新固件时,可以直接执行原有的固件程序。在需要更新固件时,完成固件更新并清零更新状态寄存器后,跳转至固件程序存储位置时,将执行已经覆盖原有程序的新的程序(两者的在存储器中的存储地址相同)。
在现有技术中,使用的是外部按键等硬件逻辑的方式来告知系统是否需要进行固件更新,增加新的功能。这样需要增加控制器硬件上的设计,增加硬件工作量和成本。
本实施例相对于现有技术,具有以下优点:使用本发明实施例所述的判断方法,从软件上增加标志位,无需额外增加硬件结构,减少了硬件工作量和成本。
如上所述,本发明的固件更新方法可以使用多种不同的类型的数据传输协议完成固件更新数据的传输。以下以采用modbus总线通信的方式,实现固件在线更新为例,对本发明的另一实施例进行详细阐述。
在具体的实现过程中,显然的,需要分别在存储器内烧录用于进行固件更新的程序代码(以下简称为读取程序)和固件自身的程序代码。用于固件更新的程序代码为基础,需要在初始时,通过数据接口(例如JTAG接口)进行烧录,初始的固件代码也可以通过这一接口一同烧录。在后续程序中,则通过modbus通信方式,在读取程序的运行过程中,完成固件的更新。
在本实施例中,modbus总线通信包括有主站和从站两端,其中控制器为从站,接收固件更新数据。主站可以为任何合适的设备,用于向从站提供对应的固件更新数据。由此,所述方法包括有两个独立的部分,第一部分为控制器判断是否需要更新固件以及在控制器内拷贝固件更新数据的控制器内执行部分。第二部分为控制器与主站之间的数据传输部分。
其中,第一部分具体可以采用本发明上述实施例的阐述的技术方案予以实现,为陈述简便,在此不作赘述。
请参阅图3,上述步骤102可以包括:
201、控制器逐帧接收固件更新数据,形成数据包保存在RAM中。控制器可以在接收到主站发出的固件更新指令后,通过串口接收固件更新数据。完整的固件更新数据从主站分为多个数据帧发出。
通过modbus协议通讯,可以由协议指令方式令控制器(从站)获知更新需求,与主站在通信过程中和其他modbus通讯指令模式一致,不用额外加入其他方式判断在线更新需求。
控制器对于数据的接收是以一个数据包为基本单位,每次接收一个数据包,直至全部数据包接收完成。接收到的二进制数据首选保存在RAM中,然后再进行烧写。
202、控制器将数据包烧写至备份存储区域中。
上述固件更新数据的传输是以数据包为单位的形式进行,每个数据包接收保存到RAM中之后,烧写到存储器的备份存储区域中。
当然,每个数据包都有自己对应的,不相同的烧写地址,以避免不同的数据包之间相互覆盖。因此,每个数据包烧写完成后,均需要对烧写地址进行更新,以便于进行下一次的烧写。
203、控制器校验数据包是否烧写正确;若校验烧写正确,则可以进行下一数据包的烧写,执行步骤206,若检验烧写不正确,则执行步骤204。数据烧写可能因多种不同的原因导致烧写不正常或烧写失败。每个数据包烧写完成后,均需要校验是否烧写正确,以保证固件的正常更新。
204、控制器判断数据包的重复烧写次数是否达到预定的阈值。若是,执行步骤205,若否,执行202,重复烧写该数据包。预定的阈值可以根据实际的使用情况或者使用经验进行设定,例如设置为5次,或者更多。
205、反馈固件更新数据烧写失败信息,并结束流程。在超出预定的阈值后,控制器可以向主站响应,反馈烧写失败的情况,提示进行错误检查,及时排除异常情况。
本实施例相对于现有技术,具有以下优点:通过上述重复烧写的阈值设置,能够避免因无法排除的错误,导致数据不断的重复烧写,浪费固件更新时间的问题。而且有利于及时的提示错误情况的发生,尽快的排除错误,更快的完成固件更新。
在本实施例中,固件更新数据分为了多个数据包,以多次循环发送的形式发送二进制文件。进一步的,还需要确认固件更新数据的数据包是否发送完毕。
如图3所示,具体包括如下步骤:
206、判断烧写至备份存储区域的数据包是否为最后一帧数据。若是,执行步骤207,若否,则执行步骤201,接收下一帧固件更新数据。若不是最后一帧数据,表明更新固件数据尚未发送完毕,需要主站继续发送并继续接收、烧写下一帧数据。对应的指令为响应主站,该数据包烧写成功,继续进行下一帧数据的接收和烧写。当然,每一帧的数据的接收和烧写均为相同的过程,在此不作赘述。
207、置位更新标志寄存器,反馈固件更新完成信息。确认数据包为最后一帧数据后,表示固件更新数据已经烧写完毕,可以使用,接下来执行步骤104。通过置位更新标志寄存器,使软件标志位继续使用,判断是否需要进行下一次固件更新。可以由控制器向主站响应,烧写已经全部完成的信息,向主站作出更新已经完成的信息,不需要继续发送。
请参阅图4,其为图3中步骤207的具体流程图,该步骤207具体可以包括:
2071、获取当前数据包的序数。主站在发送数据时,可以将固件更新数据的数据包的序数(即此时为第几帧数据包)以及固件更新数据的总帧数(总共包含的数据包个数)记录在每一帧发送数据的特定字节上,例如,在第四个字节上记录数据包的序数,在第三个字节记录数据包的总帧数。
2072、根据数据包的序数是否与固件更新数据包含的总帧数相等,以判断备份存储区域的数据包是否为最后一帧数据。控制器可以通过判断当前数据包的序数与更新数据包含的总帧数是否相等,来确认数据是否发送完毕。显然地,在序数与总帧数相等时,表示此次为最后一次传输,并向主站响应接收完毕, 烧写结束。当然,还包括控制器将烧写地址重置,恢复初始化设置,准备进行下一次的固件更新。
较佳的是,还可以在控制器内设置一个独立的数据包计数器,将接收到的数据包计数器的计数结果返回给主站,供主站校验数据包的序数是否正确。
本实施例相对于现有技术,具有以下优点:由于控制器与主站之间的通信基于modbus通信协议,可以在发送的数据帧中自定义设置,包含多种必要信息。在数据帧中包含数据包序数信息,可以使控制器在接收,解析指令时清晰的了解数据的传输情况,判断数据传输的可靠性,便于在数据传输发生错误时迅速的寻找到问题。
固件程序更新后,一般需要进行系统重启、复位从而令控制器按照更新后的固件程序继续工作。
请参阅图5,其为本发明实施例中固件更新方法另一个实施例的流程图,对于系统软复位,该方法可以包括:
301、控制器获取复位指令。如上所述,在基于modbus通信协议的基础上,从站可以利用主站,发出复位指令,启动系统软复位。
302、控制器判断更新标志寄存器是否置位。若是,执行步骤303;若否,则执行步骤304。如上述实施例所述,在固件更新数据烧写完毕后,更新标志寄存器将会置位,表示固件已经更新完毕。因此,系统可以根据更新标志寄存器是否置位来判断是否需要执行软复位操作。
303、执行复位操作。在更新标志寄存器置位的情况下,表明固件更新完成,需要进行软复位从而使控制器按照新的固件程序继续工作。因此,系统执行复位操作。
304、不执行复位操作。更新标志寄存器非置位时,则与上述情况相反,表明固件更新还在传输过程中,不能进行复位操作。
本实施例相对于现有技术,具有以下优点:通过上述方式,能够在不断电重启的情况下,使控制器实现固件程序更新,并按照更新后的固件程序继续工作。这样可以避免控制器重新上电/下电给系统带来不必要的麻烦和影响。
可以理解的是,为陈述简便,在上述具体实施例中均采用了基于modbus 通信协议的方法进行描述。本领域技术人员根据本发明所述的具体实施例,也可以在现有技术的基础上,根据实际的情况选择使用其他各种不同的通信协议完成固件更新数据的传输,并编写相对应的实现代码。
以上对于本发明实施例的固件更新方法进行了描述。以下对于本发明实施例的控制器进行描述。
请参阅图6,其为本发明实施例中控制器一个实施例的模块框图,该控制器包括:
更新判断单元401,用于判断是否需要更新固件;
烧写单元402,用于当判断为需要更新固件时,获取固件更新数据,并将固件更新数据烧写至备份存储区域中;
复制单元403,用于将备份存储区域中的固件更新数据拷贝到原固件数据的存储位置。
可选地,更新判断单元401具体用于:
在程序内设置用于判断是否需要更新固件的更新标志寄存器;
根据更新标志寄存器是否置位,以判断是否需要更新固件。
可选地,请参阅图7,其为本发明中控制器另一个实施例的模块框图。控制器还包括:复位单元404。
复位单元404用于获取复位指令,以及判断更新标志寄存器是否置位;若是,执行复位操作;若否,不执行复位操作。
可选地,烧写单元402具体用于,
逐帧地接收固件更新数据,并将接收到的当前帧的固件更新数据形成数据包保存在随机存取存储器RAM中;
将数据包烧写至备份存储区域中;
校验数据包是否烧写正确;
若否,则返回执行控制器将数据包烧写至备份存储区域中。
可选地,如图7所示,控制器还包括第一烧写状态判断单元405。
第一烧写状态判断单元405用于,判断数据包的重复烧写次数是否达到预定的阈值;
若是,反馈固件更新数据烧写失败信息。
进一步地,如图7所示,控制器还包括第二烧写状态判断单元406。
第二烧写状态判断单元406用于,判断烧写至备份存储区域的数据包是否为最后一帧数据;
还用于在烧写至所述备份存储区域的数据包是为最后一帧数据时,反馈固件更新完成信息;
还用于在烧写至所述备份存储区域的数据包不为最后一帧数据时,接收下一帧固件更新数据。
可选地,第二烧写状态判断单元406具体用于,
获取当前数据包的序数;
根据当前数据包的序数是否与固件更新数据包含的总帧数相等,以判断备份存储区域的数据包是否为最后一帧数据。
可选地,控制器采用modbus总线通信方式,接收主站发送的指令及固件更新数据,完成固件更新。
请参阅图8,其为本发明实施例中控制器一个实施例的硬件框图,该控制器可以是可编程逻辑控制器,该控制器500包括:处理器501、存储器502、接口503和总线504,处理器501与存储器502通过总线503连接,数据接口503(如:JATG口)用于烧录数据。存储器502用于存储程序代码,处理器501用于调用程序代码执行如上述任一项的数据处理方法。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在本申请所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合 或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。
以上所述,以上实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的精神和范围。

Claims (17)

  1. 一种固件更新方法,其特征在于,包括:
    控制器判断是否需要更新固件;
    若是,则获取固件更新数据,并将所述固件更新数据烧写至备份存储区域中;
    所述控制器将所述备份存储区域中的所述固件更新数据拷贝到原固件数据的存储位置。
  2. 根据权利要求1所述的方法,其特征在于,所述控制器判断是否需要更新固件包括:
    所述控制器在程序内设置用于判断是否需要更新固件的更新标志寄存器;
    所述控制器根据所述更新标志寄存器是否置位,以判断是否需要更新固件。
  3. 根据权利要求2所述的方法,其特征在于,所述控制器将所述备份存储区域中的所述固件更新数据拷贝到原固件数据的存储位置之后,所述方法还包括:
    所述控制器获取复位指令,
    所述控制器判断更新标志寄存器是否置位;
    若是,执行复位操作;
    若否,不执行复位操作。
  4. 根据权利要求1所述的方法,其特征在于,所述获取固件更新数据,并将所述固件更新数据烧写至备份存储区域中包括:
    所述控制器逐帧地接收所述固件更新数据,并将接收到的当前帧的固件更新数据形成数据包保存在随机存取存储器RAM中;
    所述控制器将所述数据包烧写至所述备份存储区域中;
    所述控制器校验所述数据包是否烧写正确;
    若否,则返回执行所述控制器将所述数据包烧写至所述备份存储区域中。
  5. 根据权利要求4所述的方法,其特征在于,所述控制器校验所述数据包是否烧写正确之后,所述方法还包括:
    所述控制器判断所述数据包的重复烧写次数是否达到预定的阈值;
    若是,反馈固件更新数据烧写失败信息。
  6. 根据权利要求4所述的方法,其特征在于,如果所述控制器校验所述数据包烧写正确,所述方法还包括:
    所述控制器判断烧写至所述备份存储区域的数据包是否为最后一帧数据;
    若是,反馈固件更新完成信息。
  7. 根据权利要求6所述的方法,其特征在于,所述控制器判断烧写至所述备份存储区域的数据包是否为最后一帧数据包括:
    所述控制器获取当前数据包的序数;
    所述控制器根据所述当前数据包的序数是否与固件更新数据包含的总帧数相等,以判断所述备份存储区域的数据包是否为最后一帧数据。
  8. 根据权利要求1-7任一项所述的方法,其特征在于,所述控制器采用modbus总线通信方式完成固件更新。
  9. 一种控制器,其特征在于,包括:
    更新判断单元,用于判断是否需要更新固件;
    烧写单元,用于当判断为需要更新固件时,获取固件更新数据,并将所述固件更新数据烧写至备份存储区域中;
    复制单元,用于将所述备份存储区域中的所述固件更新数据拷贝到原固件数据的存储位置。
  10. 根据权利要求9所述的控制器,其特征在于,所述更新判断单元用于判断是否需要更新固件包括:
    所述更新判断单元用于在程序内设置用于判断是否需要更新固件的更新标志寄存器;
    所述更新判断单元还用于根据所述更新标志寄存器是否置位,以判断是否需要更新固件。
  11. 根据权利要求10所述的控制器,其特征在于,所述控制器还包括:复位单元;
    所述复位单元用于获取复位指令;
    所述复位单元还用于判断更新标志寄存器是否置位;
    所述复位单元还用于判断更新标志寄存器置位时,执行复位操作;
    所述复位单元还用于更新标志寄存器不置位时,不执行复位操作。
  12. 根据权利要求9所述的控制器,其特征在于,所述烧写单元还用于:
    逐帧地接收所述固件更新数据,并将接收到的当前帧的固件更新数据形成数据包保存在随机存取存储器RAM中;
    将所述数据包烧写至所述备份存储区域中;
    校验所述数据包是否烧写正确;
    若否,则返回执行所述控制器将所述数据包烧写至所述备份存储区域中。
  13. 根据权利要求12所述的控制器,其特征在于,所述控制器还包括:
    第一烧写状态判断单元,用于判断所述数据包的重复烧写次数是否达到预定的阈值;
    第一烧写状态判断单元还用于在所述数据包的重复烧写次数达到预定的阈值时,反馈固件更新数据烧写失败信息。
  14. 根据权利要求12所述的控制器,其特征在于,所述控制器还包括:
    所述第二烧写状态判断单元,用于判断烧写至所述备份存储区域的数据包是否为最后一帧数据;
    所述第二烧写状态判断单元还用于在烧写至所述备份存储区域的数据包是为最后一帧数据时,反馈固件更新完成信息;
    所述第二烧写状态判断单元还用于在烧写至所述备份存储区域的数据包不为最后一帧数据时,接收下一帧固件更新数据。
  15. 根据权利要求14所述的控制器,其特征在于,所述第二烧写状态判断单元具体用于;
    获取当前数据包的序数;
    根据所述当前数据包的序数是否与固件更新数据包含的总帧数相等,以判断所述备份存储区域的数据包是否为最后一帧数据。
  16. 根据权利要求9-15任一项所述的控制器,其特征在于,所述控制器采用modbus总线通信方式完成固件更新。
  17. 一种控制器,其特征在于,包括:处理器、存储器、接口和总线,所述处理器、所述存储器和所述接口通过所述总线连接,所述接口用于输入/输出数据,所述存储器用于存储程序代码,所述处理器用于调用所述程序代码执行如权利要求1至8任一项所述的固件更新方法。
PCT/CN2016/113920 2016-12-30 2016-12-30 一种固件更新方法及控制器 WO2018120213A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201680037941.XA CN107820603A (zh) 2016-12-30 2016-12-30 一种固件更新方法及控制器
PCT/CN2016/113920 WO2018120213A1 (zh) 2016-12-30 2016-12-30 一种固件更新方法及控制器

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2016/113920 WO2018120213A1 (zh) 2016-12-30 2016-12-30 一种固件更新方法及控制器

Publications (1)

Publication Number Publication Date
WO2018120213A1 true WO2018120213A1 (zh) 2018-07-05

Family

ID=61600522

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/113920 WO2018120213A1 (zh) 2016-12-30 2016-12-30 一种固件更新方法及控制器

Country Status (2)

Country Link
CN (1) CN107820603A (zh)
WO (1) WO2018120213A1 (zh)

Cited By (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109343870A (zh) * 2018-12-06 2019-02-15 中电智能科技有限公司 程序烧写设备和程序烧写系统
CN110618825A (zh) * 2019-08-02 2019-12-27 惠州市德赛西威汽车电子股份有限公司 一种车机Boot Loader的自更新方法
CN110825405A (zh) * 2019-10-24 2020-02-21 苏州海鹏科技有限公司 一种逆变器程序更新方法
CN111158710A (zh) * 2019-12-30 2020-05-15 杭州迪普科技股份有限公司 程序烧写方法、装置及网络设备
CN111459508A (zh) * 2020-03-27 2020-07-28 北京经纬恒润科技有限公司 一种BootLoader自升级的方法及系统
CN111625266A (zh) * 2020-05-28 2020-09-04 北京天海微电子信息技术有限公司 一种固件烧录装置
CN111949449A (zh) * 2020-08-12 2020-11-17 曙光信息产业(北京)有限公司 固件恢复方法、装置、系统、计算机设备和存储介质
CN112015447A (zh) * 2020-08-10 2020-12-01 上海高仙自动化科技发展有限公司 电子设备的系统更新方法及装置、电子设备及存储介质
CN112015452A (zh) * 2020-09-10 2020-12-01 深圳市嘉昱机电有限公司 一种闸机系统的固件升级方法、装置及闸机系统
CN112181455A (zh) * 2020-09-24 2021-01-05 深圳数联天下智能科技有限公司 微控制器的在线升级方法、微控制器及存储介质
CN112181466A (zh) * 2020-09-08 2021-01-05 上海深聪半导体有限责任公司 一种语音空调固件云端升级方法及系统
CN113032200A (zh) * 2021-04-27 2021-06-25 深圳芯邦科技股份有限公司 一种微控制单元处理方法及相关设备
CN113138777A (zh) * 2021-04-09 2021-07-20 长芯盛(武汉)科技有限公司 适用多种烧写协议的低成本通用多路烧写器和烧写方法
CN113190259A (zh) * 2021-05-18 2021-07-30 宁波奥克斯电气股份有限公司 数据烧写方法、装置、互联网模组及存储介质
CN113377389A (zh) * 2021-06-30 2021-09-10 西安诺瓦星云科技股份有限公司 数据的处理方法、装置、计算机可读存储介质及处理器
CN113656061A (zh) * 2021-08-20 2021-11-16 成都亨通光通信有限公司 5g通信电源固件更新方法及更新装置
CN113709141A (zh) * 2021-08-26 2021-11-26 深圳小佳科技有限公司 应用于物联网固件的通信方法、装置及智能终端
WO2022148185A1 (zh) * 2021-01-07 2022-07-14 苏州浪潮智能科技有限公司 一种数据包更新方法、装置、电子设备及可读存储介质

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108762774A (zh) * 2018-05-22 2018-11-06 深圳市先河系统技术有限公司 一种固件烧录的方法及固件烧录的设备
CN109117168A (zh) * 2018-08-29 2019-01-01 拓攻(南京)机器人有限公司 无人机固件更新方法、装置、无人机及存储介质
CN109144551A (zh) * 2018-09-05 2019-01-04 杭州和利时自动化有限公司 一种多层级组网方式下设备固件更新方法及系统
CN109445817A (zh) * 2018-10-19 2019-03-08 郑州云海信息技术有限公司 一种固件升级方法
CN112527322A (zh) * 2019-08-28 2021-03-19 阿里巴巴集团控股有限公司 物联网设备中的系统升级方法、装置、设备及存储介质
CN111780342B (zh) * 2020-06-08 2022-12-20 海信空调有限公司 一种空调器
CN111813597A (zh) * 2020-06-08 2020-10-23 海信(山东)空调有限公司 一种空调器
CN112181446A (zh) * 2020-09-04 2021-01-05 中国船舶重工集团公司第七0七研究所 一种基于stm32的软件在线升级方法
CN112269585B (zh) * 2020-11-04 2022-11-25 配天机器人技术有限公司 一种关节驱动器固件在线更新方法、装置及关节驱动器
CN114780119B (zh) * 2022-05-07 2023-03-24 深圳星云智联科技有限公司 固件更新方法及相关设备
WO2024001601A1 (zh) * 2022-06-27 2024-01-04 青岛海信宽带多媒体技术有限公司 光模块
CN117687662A (zh) * 2024-02-04 2024-03-12 成都态坦测试科技有限公司 单片机程序升级方法、装置、可读存储介质及电子设备

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101004691A (zh) * 2007-01-23 2007-07-25 北京映翰通网络技术有限公司 一种固件程序升级的方法与装置
CN103246536A (zh) * 2013-04-28 2013-08-14 常州南京大学高新技术研究院 物联定位系统的固件无线升级方法
CN103853565A (zh) * 2012-11-28 2014-06-11 京信通信系统(中国)有限公司 基于arm的固件升级方法和装置
CN104182256A (zh) * 2014-08-21 2014-12-03 四川九成信息技术有限公司 一种嵌入式设备程序更新方法

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005004608A (ja) * 2003-06-13 2005-01-06 Matsushita Electric Ind Co Ltd ファームウェア更新方法およびファームウェア搭載装置
CN1779640A (zh) * 2004-11-26 2006-05-31 联发科技股份有限公司 光存取装置固件更新的方法及控制芯片
CN103729218A (zh) * 2013-12-23 2014-04-16 四川九洲电器集团有限责任公司 一种id烧写方法

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101004691A (zh) * 2007-01-23 2007-07-25 北京映翰通网络技术有限公司 一种固件程序升级的方法与装置
CN103853565A (zh) * 2012-11-28 2014-06-11 京信通信系统(中国)有限公司 基于arm的固件升级方法和装置
CN103246536A (zh) * 2013-04-28 2013-08-14 常州南京大学高新技术研究院 物联定位系统的固件无线升级方法
CN104182256A (zh) * 2014-08-21 2014-12-03 四川九成信息技术有限公司 一种嵌入式设备程序更新方法

Cited By (30)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109343870B (zh) * 2018-12-06 2024-04-16 中电智能科技有限公司 程序烧写设备和程序烧写系统
CN109343870A (zh) * 2018-12-06 2019-02-15 中电智能科技有限公司 程序烧写设备和程序烧写系统
CN110618825B (zh) * 2019-08-02 2023-06-13 惠州市德赛西威汽车电子股份有限公司 一种车机Boot Loader的自更新方法
CN110618825A (zh) * 2019-08-02 2019-12-27 惠州市德赛西威汽车电子股份有限公司 一种车机Boot Loader的自更新方法
CN110825405A (zh) * 2019-10-24 2020-02-21 苏州海鹏科技有限公司 一种逆变器程序更新方法
CN111158710A (zh) * 2019-12-30 2020-05-15 杭州迪普科技股份有限公司 程序烧写方法、装置及网络设备
CN111158710B (zh) * 2019-12-30 2023-08-25 杭州迪普科技股份有限公司 程序烧写方法、装置及网络设备
CN111459508A (zh) * 2020-03-27 2020-07-28 北京经纬恒润科技有限公司 一种BootLoader自升级的方法及系统
CN111459508B (zh) * 2020-03-27 2023-12-01 北京经纬恒润科技股份有限公司 一种BootLoader自升级的方法及系统
CN111625266A (zh) * 2020-05-28 2020-09-04 北京天海微电子信息技术有限公司 一种固件烧录装置
CN112015447A (zh) * 2020-08-10 2020-12-01 上海高仙自动化科技发展有限公司 电子设备的系统更新方法及装置、电子设备及存储介质
CN112015447B (zh) * 2020-08-10 2024-03-22 上海高仙自动化科技发展有限公司 电子设备的系统更新方法及装置、电子设备及存储介质
CN111949449A (zh) * 2020-08-12 2020-11-17 曙光信息产业(北京)有限公司 固件恢复方法、装置、系统、计算机设备和存储介质
CN112181466A (zh) * 2020-09-08 2021-01-05 上海深聪半导体有限责任公司 一种语音空调固件云端升级方法及系统
CN112181466B (zh) * 2020-09-08 2024-04-16 深聪半导体(江苏)有限公司 一种语音空调固件云端升级方法及系统
CN112015452B (zh) * 2020-09-10 2024-04-12 深圳市嘉昱机电有限公司 一种闸机系统的固件升级方法、装置及闸机系统
CN112015452A (zh) * 2020-09-10 2020-12-01 深圳市嘉昱机电有限公司 一种闸机系统的固件升级方法、装置及闸机系统
CN112181455B (zh) * 2020-09-24 2024-04-26 深圳数联天下智能科技有限公司 微控制器的在线升级方法、微控制器及存储介质
CN112181455A (zh) * 2020-09-24 2021-01-05 深圳数联天下智能科技有限公司 微控制器的在线升级方法、微控制器及存储介质
WO2022148185A1 (zh) * 2021-01-07 2022-07-14 苏州浪潮智能科技有限公司 一种数据包更新方法、装置、电子设备及可读存储介质
CN113138777A (zh) * 2021-04-09 2021-07-20 长芯盛(武汉)科技有限公司 适用多种烧写协议的低成本通用多路烧写器和烧写方法
CN113138777B (zh) * 2021-04-09 2022-02-01 长芯盛(武汉)科技有限公司 适用多种烧写协议的低成本通用多路烧写器和烧写方法
CN113032200A (zh) * 2021-04-27 2021-06-25 深圳芯邦科技股份有限公司 一种微控制单元处理方法及相关设备
CN113190259B (zh) * 2021-05-18 2024-04-16 宁波奥克斯电气股份有限公司 数据烧写方法、装置、互联网模组及存储介质
CN113190259A (zh) * 2021-05-18 2021-07-30 宁波奥克斯电气股份有限公司 数据烧写方法、装置、互联网模组及存储介质
CN113377389A (zh) * 2021-06-30 2021-09-10 西安诺瓦星云科技股份有限公司 数据的处理方法、装置、计算机可读存储介质及处理器
CN113656061A (zh) * 2021-08-20 2021-11-16 成都亨通光通信有限公司 5g通信电源固件更新方法及更新装置
CN113656061B (zh) * 2021-08-20 2023-12-15 成都亨通光通信有限公司 5g通信电源固件更新方法及更新装置
CN113709141B (zh) * 2021-08-26 2023-07-28 深圳小佳科技有限公司 应用于物联网固件的通信方法、装置及智能终端
CN113709141A (zh) * 2021-08-26 2021-11-26 深圳小佳科技有限公司 应用于物联网固件的通信方法、装置及智能终端

Also Published As

Publication number Publication date
CN107820603A (zh) 2018-03-20

Similar Documents

Publication Publication Date Title
WO2018120213A1 (zh) 一种固件更新方法及控制器
CN112947977B (zh) 一种软件在线升级方法及系统
TW201525858A (zh) 基板管理控制器與其韌體載入方法
CN107066300B (zh) 一种存储设备的固件升级方法和存储设备
WO2020114431A1 (zh) 基于PCIe接口的FPGA升级方法
CN111786820B (zh) 固件更新方法、装置及网络设备
CN102945173A (zh) 用户程序在线升级系统和升级方法
US11467563B2 (en) Electronic tool and method for copying a plurality of settings from a mechanical tool to another mechanical tool
JP2018116648A (ja) 情報処理装置、その制御方法、及びプログラム
US20180357193A1 (en) Computing device and operation method
US20160050335A1 (en) Information processing apparatus, and control method of information processing apparatus
TW201331883A (zh) 執行第三人工廠試驗系統及方法
JP2006190257A (ja) データ転送装置およびデータ転送方法
CN113326057A (zh) 主控程序升级方法、装置、系统和电子设备
JP5034979B2 (ja) 起動装置、起動方法、及び、起動プログラム
EP2750030A1 (en) Method, apparatus and processor for reading BIOS
TWI590012B (zh) 分散型控制系統用控制機器及分散型控制基本單元
EP2733612B1 (en) Information processing device, method, and program
CN111610995B (zh) 一种设备固件升级方法、装置、电子设备和存储介质
TW201523260A (zh) 電子裝置與其載入程式碼之方法
JP2007293802A (ja) ディスクアレイ装置、ディスクアレイ装置の制御方法及びディスクアレイ装置の制御プログラム。
JP2012212415A (ja) 無線基地局装置
TWI417888B (zh) An embedded chip system, a method for burning a wafer, and a computer program product
EP2730993A1 (en) Reset method and network device
TWI556171B (zh) 主機板及開機的方法

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16925067

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16925067

Country of ref document: EP

Kind code of ref document: A1