CN112148526A - Application program updating method, device, system, equipment and storage medium - Google Patents

Application program updating method, device, system, equipment and storage medium Download PDF

Info

Publication number
CN112148526A
CN112148526A CN202010921657.7A CN202010921657A CN112148526A CN 112148526 A CN112148526 A CN 112148526A CN 202010921657 A CN202010921657 A CN 202010921657A CN 112148526 A CN112148526 A CN 112148526A
Authority
CN
China
Prior art keywords
program
update
data
updating
application program
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010921657.7A
Other languages
Chinese (zh)
Inventor
陈岳明
刘亚祥
夏培培
江远
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Gree Electric Appliances Inc of Zhuhai
Original Assignee
Gree Electric Appliances Inc of Zhuhai
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 Gree Electric Appliances Inc of Zhuhai filed Critical Gree Electric Appliances Inc of Zhuhai
Priority to CN202010921657.7A priority Critical patent/CN112148526A/en
Publication of CN112148526A publication Critical patent/CN112148526A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1415Saving, restoring, recovering or retrying at system level
    • G06F11/1433Saving, restoring, recovering or retrying at system level during software upgrading

Abstract

The invention discloses an application program updating method, device, system, equipment and storage medium. The method comprises the following steps executed by the slave device: after the application program is reset, inquiring an updating operation result when the application program is updated at the previous time; when the updating operation result is updating failure, acquiring program updating data; wherein, the program updating data is program data which is received from the main device in advance in a wireless mode; and executing updating operation on the application program according to the program updating data. In the embodiment of the invention, after the application program is reset, the slave device inquires the updating operation result when the application program is updated last time, and automatically initiates the updating of the application program again when the updating operation result is updating failure, so that the problem that the slave device is unavailable due to the updating failure of the application program is prevented.

Description

Application program updating method, device, system, equipment and storage medium
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a method, an apparatus, a system, a device, and a storage medium for updating an application.
Background
Currently, servo equipment is also exposed to the problem of application program update after shipping. The traditional application program updating mode is as follows: the servo equipment is detached from the control cabinet, then the servo equipment is returned to the factory for updating, in the process of returning to the factory for updating, a cover shell of the servo equipment needs to be detached, a JTAG (Joint Test Action Group) burning port in the servo equipment is exposed, and a special burning device is utilized to update the application program of the servo equipment. However, such a conventional application program updating method is too troublesome and the updating cost is high. In order to solve the problems brought by the conventional method, a method of connecting a PC (Personal Computer) to a server device by an RS232 (asynchronous transfer standard interface) serial cable and updating an application program of the server device by using the PC has been developed, so that the trouble of detaching the server device and detaching a cover of the server device can be eliminated, but in industrial production, the field environment is messy and complicated, and the stability of the field environment is poor, such as: the situation of sudden power failure is easy to occur in the field, and the instability of the field can cause risk interference to the updating process of the application program. Therefore, when the RS232 serial port cable is used to update the software of the server device, the risk of update failure is high, and when the server device updates the application program, the program data of the application program is erased from the sector and new program data is programmed, so that once the application program is updated in failure, the problem that the original program data of the application program cannot be run because the new program data of the application program is not programmed completely occurs, and the server device does not have a mechanism for jumping back to the update start point of the application program, so that the server device cannot be used, and must be returned to the factory and updated again by using a special burner, thereby affecting the production efficiency.
Disclosure of Invention
Embodiments of the present invention mainly aim to provide an application program updating method, apparatus, system, device and storage medium, so as to solve the problem that a server device cannot be used due to an application program update failure in the prior art.
In view of the above technical problems, the embodiments of the present invention are solved by the following technical solutions:
the embodiment of the invention provides an application program updating method, which is executed in slave equipment and comprises the following steps: after the application program is reset, inquiring an updating operation result when the application program is updated at the previous time; when the updating operation result is updating failure, acquiring program updating data; wherein, the program updating data is program data which is received from the main device in advance in a wireless mode; and executing updating operation on the application program according to the program updating data.
Before the resetting the application program, the method further comprises the following steps: after the slave device is powered on, the wireless connection is established with the master device through a communication chip in the slave device, program updating data from the master device is received, and the program updating data is stored.
Wherein, before the receiving the program update data from the master device, further comprising: receiving, by the communication chip, an update notification data frame from the master device; wherein update version data is included in the update notification data frame; comparing the original version data corresponding to the application program with the updated version data through the communication chip; the original version data is version data of program data being used by the application program; the receiving program update data from the host device includes: receiving, by the communication chip, software update data from the host device in a case where the original version data is different from the updated version data.
Wherein the program update data comprises: a plurality of update data blocks; the receiving program update data from the master device and storing the program update data includes: sequentially receiving each update data block from the master device through the communication chip, and sequentially storing each received update data block into a preset first peripheral memory; the acquiring program update data includes: and sending a program updating identifier to a micro control unit in the slave device through the communication chip, so that the micro control unit acquires the plurality of updating data blocks from the first peripheral memory according to the program updating identifier.
Wherein the executing the update operation on the application program comprises: and erasing the original program data corresponding to the application program from a target sector through the micro control unit, and sequentially writing the obtained plurality of updated data blocks into the target sector.
Wherein, in the process of sequentially writing the obtained plurality of update data blocks into the target sector, the method further comprises: under the condition that writing of one of the update data blocks into the target sector fails, sending an update failure signal to the communication chip through the micro control unit, so that the communication chip records the current update operation result of the application program in a preset second external memory as update failure; powering on the slave device again or resetting the application program again through the micro control unit; and under the condition that the last update data block is successfully written into the target sector, sending an update success signal to the communication chip through the micro control unit, so that the communication chip records the current update operation result of the application program in the second external memory as the update success.
Wherein the method further comprises: recording the continuous updating failure times of the updating operation result through the micro control unit; and when the times are larger than a preset time threshold value, acquiring original program data of the application program from the third peripheral memory through the micro control unit, and writing the original program data into the target sector.
Wherein, after the writing the obtained plurality of update data blocks into the target sector sequentially, further comprises: sending an update success signal to the communication chip through the micro control unit, so that the communication chip stores the plurality of update data blocks into a preset third peripheral memory; wherein the plurality of update data blocks overwrite the original program data in the third peripheral memory; the original program data is stored in the third peripheral memory after a previous successful update of the application program.
Wherein, the communication chip is a Bluetooth chip.
The embodiment of the present invention further provides an application updating apparatus, which is arranged on the slave device execution side, and includes: the query module is used for querying an update operation result when the application program is updated at the previous time after the application program is reset; the acquisition module is used for acquiring program updating data when the updating operation result is updating failure; wherein, the program updating data is program data which is received from the main device in advance in a wireless mode; and the updating module is used for executing updating operation on the application program according to the program updating data.
An embodiment of the present invention further provides an application program updating system, including: a communication unit and a micro control unit; wherein the communication unit comprises a communication chip; the communication chip is connected with the micro control unit and used for inquiring an updating operation result when the application program is updated at the previous time after the application program is reset, and informing the micro control unit when the updating operation result is updating failure; the micro control unit is used for acquiring program updating data; according to the program updating data, updating operation is executed on the application program; wherein the program update data is program data from a host device received in advance by the communication chip.
An embodiment of the present invention further provides an application program update apparatus, where the application program update apparatus includes: a memory, a processor and a computer program stored on the memory and executable on the processor, the computer program, when executed by the processor, implementing the steps of the application update method of any of the above.
An embodiment of the present invention further provides a computer-readable storage medium, where an application program update program is stored on the computer-readable storage medium, and when being executed by a processor, the application program update program implements the steps of any of the application program update methods described above.
The embodiment of the invention has the following beneficial effects:
in the embodiment of the invention, after the application program is reset, the slave device inquires the updating operation result when the application program is updated last time, and automatically initiates the updating of the application program again when the updating operation result is updating failure, so that the problem that the slave device is unavailable due to the updating failure of the application program is prevented.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
FIG. 1 is a flow diagram of an application update method according to an embodiment of the invention;
FIG. 2 is a flow diagram of an application update method according to an embodiment of the invention;
FIG. 3 is a detailed flowchart of an application update method according to an embodiment of the invention;
FIG. 4 is a schematic diagram of a master-slave device system according to an embodiment of the present invention;
FIG. 5 is a flowchart of the step of programming an updated data block according to one embodiment of the invention;
FIG. 6 is a schematic diagram of a step of programming an updated data block according to an embodiment of the present invention;
FIG. 7 is a block diagram of an application update system according to one embodiment of the invention;
FIG. 8 is a block diagram of an application update apparatus according to an embodiment of the present invention;
fig. 9 is a block diagram of an application update apparatus according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in further detail below with reference to the accompanying drawings and specific embodiments.
According to an embodiment of the present invention, there is provided an application update method. The embodiment of the invention is executed on the slave device side. The slave device may be a servo device. The servo device may be a single axis servo device or a multi-axis servo device.
Fig. 1 is a flowchart illustrating an application update method according to an embodiment of the invention.
Step S110, the slave device establishes a wireless connection with the master device during the application program running process.
And the application program is an application program running in the slave equipment.
The master device is a source device for updating data for the program. The master devices include, but are not limited to: PC, mobile terminal. The categories of mobile terminals include, but are not limited to: mobile phone, panel computer.
Specifically, during the running process of the application program, the slave device establishes wireless connection with the master device through a preset communication chip. The communication chip includes but is not limited to: bluetooth chip. That is, the slave device establishes a bluetooth connection with the master device through the bluetooth chip.
Further, when the application program in the slave device needs to be updated, the master device searches the bluetooth signal of the slave device, performs bluetooth pairing with the slave device, and further establishes bluetooth connection between the master device and the slave device. Of course, when the application program in the slave device needs to be updated, the slave device may also search the bluetooth information of the master device, perform bluetooth pairing with the master device, and further establish bluetooth connection between the master device and the slave device.
In this embodiment, through the wireless communication mode, the problem that it is inconvenient to connect the master device and the slave device through the RS232 serial cable can be avoided, and the wireless communication device is not limited by the limitation of the field environment and is not influenced by the field environment. Furthermore, the embodiment of the invention can connect the master device and the slave device through the Bluetooth, so that the master device and the slave device can transmit data under the condition of not connecting with the Internet, and the transmission of program updating data is convenient and quick.
And step S120, the slave device receives and stores the program updating data from the master device.
The program update data is used to update an application in the slave device. Wherein the program update data is program data of the application program.
The communication chip in the slave device receives program update data from the master device and stores the received program update data in a preset first peripheral memory.
In this embodiment, the communication chip may be a bluetooth chip. The Bluetooth chip can be a Nordic nRF52832 chip set, and the core architecture can be Cortex-M4F. The Bluetooth chip of the Cortex-M4F core architecture is a programmable Bluetooth chip. Wherein, the Bluetooth chip can select BLE5.0 Bluetooth Low energy.
In this embodiment, the first peripheral memory may be a volatile memory. For example: the first peripheral memory is a single-port random access memory.
In particular, the program update data from the master device may include a plurality of update data blocks.
Before sending the program updating data to the slave equipment, the master equipment divides the program updating data into a plurality of updating data blocks according to the sequence from front to back; each update data block is sent to the slave device sequentially in a front-to-back order.
The communication chip in the slave device receives each update data block sent by the master device in sequence. In this way, multiple update data blocks can be spliced into complete program update data.
In the embodiment of the invention, the program updating data is divided into a plurality of updating data blocks, and the plurality of updating data blocks are sequentially transmitted to the slave equipment, so that the data volume of single transmission is reduced, and the overall transmission efficiency of the program updating data is accelerated on the premise of limited bandwidth resources.
In step S130, the slave device updates the application program using the program update data.
After the slave device receives the program update data, the communication chip in the slave device sends a program update identifier to an MCU (micro controller Unit) in the slave device, so that the MCU obtains the program update data from the first peripheral memory according to the program update identifier, stops running the application program, erases the original program data in the target sector, and writes (burns) the program update data into the target sector, thereby completing the update of the application program. Further, the original program data is program data that is currently being used by the application program. The target sector refers to a sector in which program data currently being used by an application program is programmed.
However, in some cases, during the process of writing program update data into the target sector, a case of update failure occurs, such as: in the case of sudden power failure, in the case of program update data check error, a situation of update failure occurs.
Further, in the process that the MCU writes the plurality of update data blocks into the target sector in sequence, if one of the update data blocks fails to be written into the target sector, the MCU stops writing the next update data block into the target sector, the MCU sends an update failure signal to the communication chip, the communication chip records the result of the current update operation of the application program in the second external memory as an update failure, and the MCU powers on the slave device again or resets the application program again; and if the last update data block is successfully written into the target sector, the MCU sends an update success signal to the communication chip, and the communication chip records the current update operation result of the application program in the second external memory as the update success.
After the MCU sends the update success signal to the communication chip, the communication chip may further store the program update data in the third peripheral memory according to the update success signal, and enable the program update data to overwrite the program data stored when the previous update was successful.
In this embodiment, the second peripheral memory and the third peripheral memory may be different peripheral memories, or different storage areas in the same peripheral memory. The second peripheral memory and the third peripheral memory may be non-volatile memories so that the updated state of the application program may be viewed later to obtain the stored program data.
After the program update data is written to the target sector and stored to the third peripheral memory, the stored program update data will be used as original program data of the application program.
To avoid the problem of the slave device being unavailable after an update failure, embodiments of the present invention provide a way to automatically redo the application update. The step of resuming the application update is described in detail below.
Fig. 2 is a flowchart illustrating an application update method according to an embodiment of the invention.
Step S210, after resetting the application program, querying an update operation result when the application program was updated last time.
Resetting an application means performing program data booting on the application. In the program data boot phase, the program data is not yet run, so the program data can be updated at this phase.
Automatically resetting the application after the slave device is powered on; or, the control application program is reset during the operation of the slave device.
After the application program is reset, the result of the update operation when the application program was updated last time is inquired in the second external memory. The types of the updating operation results comprise: update failure and update success.
And the updating fails, which indicates that the program updating data is not completely programmed successfully when the application program is updated last time.
And the updating is successful, which means that the program updating data is completely programmed successfully when the application program is updated last time.
If the result of the update operation is an update failure, the application update failure will be described in the previous update of the application, and the current reset application is an operation executed for the re-update.
And under the condition that the updating operation result is successful updating, the application program is updated successfully when the application program is updated for the previous time, the application program is reset normally, and the program data of the application program is directly operated.
Step S220, when the updating operation result is updating failure, program updating data is obtained; the program update data is program data received from the host device in advance by wireless.
The wireless method includes, but is not limited to: the bluetooth mode.
After the slave device is powered on, a wireless connection is established with the master device through a communication chip in the slave device, program update data from the master device is received and stored. Further, storing the program update data in the first peripheral memory; program update data is retrieved from the first peripheral memory.
In this embodiment, the first peripheral memory may be a power-down volatile memory. Program update data stored in the first peripheral memory will be deleted after power is removed from the device.
Further, after the slave device is powered on, establishing wireless connection (such as bluetooth connection) with the master device, receiving program update data sent by the master device and storing the program update data in the first peripheral memory; after each application program update failure, the application program is reset, and the program update data stored in the first peripheral memory is acquired. Or after the application program update fails every time, the slave device is powered on again, the slave device is enabled to establish wireless connection with the master device, program update data sent by the master device are received and stored in the first peripheral memory, and then the program update data are obtained from the first peripheral memory.
Step S230, according to the program update data, performing an update operation on the application program.
And erasing the original program data corresponding to the application program from a target sector, and writing the acquired program updating data into the target sector.
In this embodiment, in the process of writing the acquired program update data into the target sector, a problem of update failure may also occur, and if the update fails, the steps shown in fig. 2 may be executed again.
In the embodiment, after resetting the application program, the slave device queries the result of the update operation when the application program was updated last time, and automatically initiates the update of the application program again when the result of the update operation is update failure, so as to prevent the problem that the slave device is unavailable due to the update failure of the application program. Further, the master device and the slave device are wirelessly connected, and program update data is wirelessly transmitted, so that the problem of inconvenient cable connection is avoided.
A more specific embodiment is provided below to further describe the application program updating method of the present invention.
Fig. 3 is a detailed flowchart of an application program updating method according to an embodiment of the invention. Fig. 4 is a schematic structural diagram of a master-slave device system according to an embodiment of the present invention.
Step S310, after the slave device is powered on, establishing a wireless connection with the master device through a communication chip in the slave device, and sequentially receiving each update data block from the master device.
The program update data includes: a plurality of update data blocks; the plurality of update data blocks are sequentially transmitted to the slave device by the master device.
Receiving, by the communication chip, an update notification data frame from the master device; wherein update version data is included in the update notification data frame; comparing the original version data corresponding to the application program with the updated version data through the communication chip; receiving, by the communication chip, software update data from the host device in a case where the original version data is different from the updated version data. The original version data is version data of program data currently used by the application program. The update version data is a version number. The original version data is the version number.
Specifically, the upper computer software in the master device establishes a wireless connection with the communication chip in the slave device through the communication module in the master device. The host computer software in the master device sends an update notification data frame to the communication chip in the slave device before sending the update data block. And after sending the update notification data frame, the upper computer software in the master device sends the update data frame to the communication chip of the slave device. The update data frame carries an update data block or a part of program data in the update data block. And the upper computer software sequentially sends update data frames to the communication chip of the slave equipment according to the sequence of the update program data from front to back so that the slave equipment side can splice correct program update data according to the receiving sequence. And after the update data frame is sent, the upper computer software in the master equipment sends an end data frame to a communication chip in the slave equipment, wherein the end data frame carries an end identifier.
Receiving a data frame from a master device by a communication chip in the slave device; analyzing the data frame; judging whether the data frame contains update notification information or not; and if the data frame comprises the update notification information, the data frame is represented as an update notification data frame. And if the communication chip receives the update notification data frame, taking the next received frame as a first frame update data frame, and starting to receive each frame update data frame until receiving the end data frame.
Further, the master device and the slave device may negotiate the data size of each update data block in advance. For example: one update data block is 10 bytes. In this way, the host device can divide the program update data into a plurality of update data blocks from the beginning of the program update data according to the data size. If the data amount of the last part of program data divided by the program update data is smaller than the data amount of the update data block, zero padding may be performed after the last part of program data, or the last part of program data may be directly treated as an update data block. The slave device may splice the program data carried in the update data frame into an update data block according to the data size.
Step S320, sequentially storing each received update data block in a preset first peripheral memory through the communication chip.
Step S330, querying, by the communication chip, an update operation result when the application program was updated last time from the second external memory.
In this embodiment, the communication chip may inquire of the second external memory, before receiving the update data block, a result of the update operation at the time of updating the application program last time. The communication chip may inquire the result of the update operation when the application program was updated the previous time from the second external memory in the process of receiving the update data block. The communication chip may also query, after receiving the update data block, the second external memory for the result of the update operation performed when the application program was updated last time.
Further, the communication chip queries the result of the update operation before receiving the update data block, and may send an update failure message to the master device after querying that the result of the update operation is an update failure, so that the master device sends the update data block to the slave device according to the update failure message.
Further, the communication chip queries the result of the update operation during or after receiving the update data block, and may actively trigger the master device to send the update data block to the slave device in a manual manner after the slave device is powered on.
Step S340, judging whether the updating operation result is updating failure; if yes, go to step S350; if not, step S370 is performed.
Step S350, sending a program update identifier to a micro control unit in the slave device through the communication chip, so that the micro control unit obtains the plurality of update data blocks from the first peripheral memory according to the program update identifier.
And the program updating identifier is used for indicating that the micro control unit can update the application program.
In this embodiment, the micro control unit, the communication chip, the first peripheral memory, the second peripheral memory, and the third peripheral memory are connected by a peripheral bus. The types of peripheral buses include, but are not limited to: a SPI (Serial Peripheral Interface) bus and a UART (Universal Asynchronous Receiver/Transmitter) bus.
And after the communication chip determines that the update data block is completely received, the communication chip sends a program update identifier to the micro control unit through the peripheral bus.
The micro control unit acquires a plurality of update data blocks (program update data) from the first peripheral memory through the peripheral bus, and stores the acquired plurality of update data blocks into the first built-in memory of the micro control unit. The first built-in memory may be a volatile memory. In addition, the micro control unit also comprises a second built-in memory, and the second built-in memory is a nonvolatile memory.
Step S360, erasing, by the micro control unit, the original program data corresponding to the application program from a target sector, and sequentially writing the obtained plurality of updated data blocks into the target sector.
The micro control unit sequentially takes out a plurality of updating data blocks from the first built-in memory and burns and writes the updating data blocks into a target sector of the second built-in memory.
In this embodiment, the main control board chip of the slave device includes: a DSP (Digital Signal processing) chip and an FPGA (Field Programmable Gate Array) chip. The FPGA chip is not shown in the figure. The DSP chip is a micro control unit. The DSP chip has built-in RAM (Random access Memory) and FLASH Memory. The RAM memory is a first built-in memory of the DSP chip. The FLASH memory is a second built-in memory of the DSP chip. The capacity of the RAM memory and the FLASH memory can be sized according to requirements, for example: the capacity of the RAM memory is 256KB, and the capacity of the FLASH memory is 1 MB.
The FLASH has an ECC (Error Checking and Correcting) protection function, and the ECC protection function can perform ECC check on the burnt update data block.
The FLASH memory is solidified with bottom program codes of the DSP chip when the FLASH memory leaves a factory, factory program data of the application program are programmed in other sectors of the FLASH memory, and the factory program data of the application program can be erased and programmed again. Factory program data for the application program is also stored in the third peripheral memory and old program data may be overwritten with new program data after each successful update of the application program.
In this embodiment, in the process of sequentially writing a plurality of update data blocks into the target sector, it is determined whether each update data block is successfully written into the target sector.
Under the condition that writing of one of the update data blocks into the target sector fails, enabling the micro control unit to stop writing the next update data block into the target sector, and sending an update failure signal to the communication chip through the micro control unit, so that the communication chip records the current update operation result of the application program in a preset second external memory as update failure; and powering on the slave equipment again or resetting the application program again through the micro control unit.
For example: if the update data block has an ECC check error, it indicates that the write of the update data block into the target sector fails, and the result of the update operation is an update failure.
And under the condition that the last update data block is successfully written into the target sector, sending an update success signal to the communication chip through the micro control unit, so that the communication chip records the current update operation result of the application program in the second external memory as the update success.
Further, 0x01 can be used to indicate that the update is successful, and 0x00 can be used to indicate that the update is failed.
Further, after each update data block is successfully written into the target sector, the result of one update operation may be recorded in the second external memory as an update success, until after the last update data block is successfully written into the target sector, the update success recorded in the second external memory indicates that the application program is successfully updated.
After the micro control unit sends an updating success signal to the communication chip, the communication chip stores the plurality of updating data blocks into a preset third peripheral memory; wherein the plurality of update data blocks overwrite the original program data in the third peripheral memory; the original program data is stored in the third peripheral memory after a previous successful update of the application program.
Step S370, running the application program through the microcontroller.
The embodiment provides a method for updating an application program in a wireless mode, the problem that cable connection is inconvenient in an industrial production environment is solved, the problem that slave equipment cannot be used due to failure of updating in the updating process is solved, and convenience is brought to a user for controlling and using the slave equipment through upper computer software.
In the embodiment, in order to avoid influencing the normal operation of the slave device due to the fact that the application program is continuously updated and failed, the micro control unit records the number of times that the updating operation result is continuously updated and failed in the process of updating the application program; and when the times are larger than a preset time threshold value, acquiring original program data of the application program from the third peripheral memory through the micro control unit, and writing the original program data into the target sector. The number threshold may be an empirical value or a value obtained through experimentation.
Specifically, the burning process of updating the data block and the accumulation process of the update failure are described by the following steps. FIG. 5 is a flowchart illustrating the steps of programming a block of updated data according to an embodiment of the present invention.
In step S510, the mcu sequentially obtains an update data block from the plurality of update data blocks and writes the update data block to the target sector.
The mcu may fetch an update block from the first built-in memory and write it to a target sector of the second built-in memory.
Step S520, the micro control unit determines whether the updated data block is successfully programmed; if yes, executing step S530 to obtain the next update data block; if not, step S560 is performed.
And programming success, which means that the updating data block is successfully written into the target sector.
And programming failure, namely failure of writing the updated data block into the target sector and failure of updating the application program.
In step S530, the mcu records the result of the current update operation of the application program in the second external memory as a success update, and moves the pointer of the second external memory one address downward.
Step S540, the micro control unit judges whether the plurality of update data blocks are all obtained; if so, go to step S550; if not, step S510 is performed.
In step S550, the mcu stores a plurality of update data blocks in the third peripheral memory, so that the update data blocks overwrite the original program data already stored in the third peripheral memory.
In step S560, the mcu records the result of the current update operation of the application program in the second external memory as an update failure.
For example: FIG. 6 is a schematic diagram of a step of programming an updated data block according to an embodiment of the present invention. The micro control unit starts to write from the first updating data block, the first N-1 updating data blocks are written successfully, the communication chip records and updates successfully for each updating data block in the second external memory, when the micro control unit writes the Nth updating data block, the writing fails, the communication chip records and updates unsuccessfully for the Nth updating data block in the second external memory, and the micro control unit powers on the slave device again so as to restart to update the application program. Certainly, the micro control unit may not notify the communication chip whether the programming is successful or not, and after the programming of the last update data block is successful, notify the communication chip that all update data blocks are successfully programmed (the application program is successfully updated); or after an update data block programming failure occurs, the communication chip is informed of the update failure of the application program.
Step S570, the micro control unit accumulates the updating failure times and determines whether the accumulated value of the updating failure times is larger than a preset time threshold value; if so, go to step S580; if not, step S590 is performed.
In step S580, the mcu obtains the original program data of the application program from the third peripheral memory, and rewrites the original program data into the target sector.
After the original program data is re-written to the target sector, the slave device can operate normally. During the normal operation of the slave device, the reason causing the update failure of the application program can be checked. After the reason is released, the application program is updated again.
In step S590, the mcu powers on the slave device again or resets the application.
The embodiment of the invention provides a method for preventing update failure on the basis of a wireless communication technology, which can enable an old version and a new version of an application program to coexist, and reuse the old version after the new version fails to update for many times, so that slave equipment can normally operate without influencing the normal work of the slave equipment.
The embodiment of the invention also provides an application program updating system. The application update system is deployed in a slave device. FIG. 7 is a block diagram of an application update system according to one embodiment of the invention.
In the application program update system, the method includes: a communication unit 710 and a micro control unit 720. Wherein the communication unit 710 includes a communication chip 711.
The communication chip 711 is connected to the micro control unit 720, and configured to query, after resetting an application program, an update operation result obtained when the application program is updated last time, and notify the micro control unit 720 when the update operation result is an update failure.
The micro control unit 720 is configured to obtain program update data; according to the program updating data, updating operation is executed on the application program; the program update data is program data received by the communication chip 711 in advance from a host device.
The specific structure diagram of the system may refer to the structure diagram of the slave device node in fig. 4, and since the system of the present invention has been described in the foregoing method embodiment, details in the description of this embodiment are not described in detail, and refer to relevant descriptions in the foregoing embodiment, which are not described herein again.
The embodiment of the invention provides an application program updating device. The application updating device is arranged on the slave device side. Fig. 8 is a block diagram of an application update apparatus according to an embodiment of the present invention.
An application update apparatus comprising: a query module 810, an acquisition module 820, and an update module 830.
And the query module 810 is configured to query, after the application program is reset, an update operation result of the application program when the application program is updated last time.
An obtaining module 820, configured to obtain program update data when the update operation result is an update failure; wherein the program update data is program data received from a host device in advance in a wireless manner.
The update module 830 is configured to perform an update operation on the application program according to the program update data.
The functions of the apparatus according to the embodiments of the present invention have been described in the above method embodiments, so that reference may be made to the related descriptions in the foregoing embodiments for details which are not described in the present embodiment, and further details are not described herein.
The present embodiment provides an application updating apparatus. Fig. 9 is a block diagram of an application update apparatus according to an embodiment of the present invention.
In this embodiment, the application update device includes, but is not limited to: a processor 910, a memory 920.
The processor 910 is configured to execute the application program update program stored in the memory 920 to implement the application program update method described above.
Specifically, the processor 910 is configured to execute the application program update program stored in the memory 920 to implement the following steps: after the application program is reset, inquiring an updating operation result when the application program is updated at the previous time; when the updating operation result is updating failure, acquiring program updating data; wherein, the program updating data is program data which is received from the main device in advance in a wireless mode; and executing updating operation on the application program according to the program updating data.
Before the resetting the application program, the method further comprises the following steps: after the slave device is powered on, the wireless connection is established with the master device through a communication chip in the slave device, program updating data from the master device is received, and the program updating data is stored.
Wherein, before the receiving the program update data from the master device, further comprising: receiving, by the communication chip, an update notification data frame from the master device; wherein update version data is included in the update notification data frame; comparing the original version data corresponding to the application program with the updated version data through the communication chip; the original version data is version data of program data being used by the application program; the receiving program update data from the host device includes: receiving, by the communication chip, software update data from the host device in a case where the original version data is different from the updated version data.
Wherein the program update data comprises: a plurality of update data blocks; the receiving program update data from the master device and storing the program update data includes: sequentially receiving each update data block from the master device through the communication chip, and sequentially storing each received update data block into a preset first peripheral memory; the acquiring program update data includes: and sending a program updating identifier to a micro control unit in the slave device through the communication chip, so that the micro control unit acquires the plurality of updating data blocks from the first peripheral memory according to the program updating identifier.
Wherein the executing the update operation on the application program comprises: and erasing the original program data corresponding to the application program from a target sector through the micro control unit, and sequentially writing the obtained plurality of updated data blocks into the target sector.
Wherein, in the process of sequentially writing the obtained plurality of update data blocks into the target sector, the method further comprises: under the condition that writing of one of the update data blocks into the target sector fails, sending an update failure signal to the communication chip through the micro control unit, so that the communication chip records the current update operation result of the application program in a preset second external memory as update failure; powering on the slave device again or resetting the application program again through the micro control unit; and under the condition that the last update data block is successfully written into the target sector, sending an update success signal to the communication chip through the micro control unit, so that the communication chip records the current update operation result of the application program in the second external memory as the update success.
Wherein the method further comprises: recording the continuous updating failure times of the updating operation result through the micro control unit; and when the times are larger than a preset time threshold value, acquiring original program data of the application program from the third peripheral memory through the micro control unit, and writing the original program data into the target sector.
Wherein, after the writing the obtained plurality of update data blocks into the target sector sequentially, further comprises: sending an update success signal to the communication chip through the micro control unit, so that the communication chip stores the plurality of update data blocks into a preset third peripheral memory; wherein the plurality of update data blocks overwrite the original program data in the third peripheral memory; the original program data is stored in the third peripheral memory after a previous successful update of the application program.
Wherein, the communication chip is a Bluetooth chip.
The embodiment of the invention also provides a computer readable storage medium. The computer-readable storage medium herein stores one or more programs. Among other things, computer-readable storage media may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as read-only memory, flash memory, a hard disk, or a solid state disk; the memory may also comprise a combination of memories of the kind described above.
When the one or more programs in the computer readable storage medium are executable by the one or more processors to implement the application update method described above. Since the above-mentioned application updating method has been described in detail, it is not described herein again.
The above description is only an example of the present invention, and is not intended to limit the present invention, and it is obvious to those skilled in the art that various modifications and variations can be made in the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the scope of the claims of the present invention.

Claims (13)

1. An application update method, characterized in that, the steps executed in the slave device include:
after the application program is reset, inquiring an updating operation result when the application program is updated at the previous time;
when the updating operation result is updating failure, acquiring program updating data; wherein, the program updating data is program data which is received from the main device in advance in a wireless mode;
and executing updating operation on the application program according to the program updating data.
2. The method of claim 1, prior to resetting the application, further comprising:
after the slave device is powered on, the wireless connection is established with the master device through a communication chip in the slave device, program updating data from the master device is received, and the program updating data is stored.
3. The method of claim 2,
before the receiving the program update data from the master device, further comprising:
receiving, by the communication chip, an update notification data frame from the master device; wherein update version data is included in the update notification data frame;
comparing the original version data corresponding to the application program with the updated version data through the communication chip; the original version data is version data of program data being used by the application program;
the receiving program update data from the host device includes:
receiving, by the communication chip, software update data from the host device in a case where the original version data is different from the updated version data.
4. The method of claim 2,
the program update data includes: a plurality of update data blocks;
the receiving program update data from the master device and storing the program update data includes:
sequentially receiving each update data block from the master device through the communication chip, and sequentially storing each received update data block into a preset first peripheral memory;
the acquiring program update data includes:
and sending a program updating identifier to a micro control unit in the slave device through the communication chip, so that the micro control unit acquires the plurality of updating data blocks from the first peripheral memory according to the program updating identifier.
5. The method of claim 4, wherein performing the update operation on the application comprises:
and erasing the original program data corresponding to the application program from a target sector through the micro control unit, and sequentially writing the obtained plurality of updated data blocks into the target sector.
6. The method according to claim 5, wherein during the step of sequentially writing the obtained plurality of update data blocks into the target sector, further comprising:
under the condition that writing of one of the update data blocks into the target sector fails, sending an update failure signal to the communication chip through the micro control unit, so that the communication chip records the current update operation result of the application program in a preset second external memory as update failure; powering on the slave device again or resetting the application program again through the micro control unit;
and under the condition that the last update data block is successfully written into the target sector, sending an update success signal to the communication chip through the micro control unit, so that the communication chip records the current update operation result of the application program in the second external memory as the update success.
7. The method of claim 6, further comprising:
recording the continuous updating failure times of the updating operation result through the micro control unit;
and when the times are larger than a preset time threshold value, acquiring original program data of the application program from the third peripheral memory through the micro control unit, and writing the original program data into the target sector.
8. The method according to claim 5, further comprising, after said writing the obtained plurality of update data blocks sequentially into the target sector:
sending an update success signal to the communication chip through the micro control unit, so that the communication chip stores the plurality of update data blocks into a preset third peripheral memory; wherein the plurality of update data blocks overwrite the original program data in the third peripheral memory; the original program data is stored in the third peripheral memory after a previous successful update of the application program.
9. The method according to any one of claims 2 to 8, wherein the communication chip is a Bluetooth chip.
10. An application program update apparatus provided on a slave device, comprising:
the query module is used for querying an update operation result when the application program is updated at the previous time after the application program is reset;
the acquisition module is used for acquiring program updating data when the updating operation result is updating failure; wherein, the program updating data is program data which is received from the main device in advance in a wireless mode;
and the updating module is used for executing updating operation on the application program according to the program updating data.
11. An application update system, comprising: a communication unit and a micro control unit; wherein the communication unit comprises a communication chip;
the communication chip is connected with the micro control unit and used for inquiring an updating operation result when the application program is updated at the previous time after the application program is reset, and informing the micro control unit when the updating operation result is updating failure;
the micro control unit is used for acquiring program updating data; according to the program updating data, updating operation is executed on the application program; wherein the program update data is program data from a host device received in advance by the communication chip.
12. An application updating apparatus, characterized in that the application updating apparatus comprises: memory, processor and computer program stored on the memory and executable on the processor, the computer program, when executed by the processor, implementing the steps of the application update method according to any one of claims 1 to 9.
13. A computer-readable storage medium, having an application update program stored thereon, which, when executed by a processor, implements the steps of the application update method according to any one of claims 1 to 9.
CN202010921657.7A 2020-09-04 2020-09-04 Application program updating method, device, system, equipment and storage medium Pending CN112148526A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010921657.7A CN112148526A (en) 2020-09-04 2020-09-04 Application program updating method, device, system, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010921657.7A CN112148526A (en) 2020-09-04 2020-09-04 Application program updating method, device, system, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN112148526A true CN112148526A (en) 2020-12-29

Family

ID=73890527

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010921657.7A Pending CN112148526A (en) 2020-09-04 2020-09-04 Application program updating method, device, system, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112148526A (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105740034A (en) * 2016-04-13 2016-07-06 深圳市高巨创新科技开发有限公司 System and method for upgrading firmware of MCU on line
CN106293857A (en) * 2016-08-31 2017-01-04 成都国蓉科技有限公司 A kind of wireless mode carries out the method for software upgrading

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105740034A (en) * 2016-04-13 2016-07-06 深圳市高巨创新科技开发有限公司 System and method for upgrading firmware of MCU on line
CN106293857A (en) * 2016-08-31 2017-01-04 成都国蓉科技有限公司 A kind of wireless mode carries out the method for software upgrading

Similar Documents

Publication Publication Date Title
JP5838527B2 (en) Method, apparatus and communication device for updating firmware
US10860425B2 (en) Method for recovering basic input/output system image file of a computer system and the computer system
CN107179909A (en) Method for upgrading software, device and computer-readable recording medium
CN107066300B (en) Firmware upgrading method of storage device and storage device
CN106020875B (en) Firmware update management method and device of embedded terminal
JPWO2003083647A1 (en) Software update method for communication terminal, communication terminal, and software update system
CN101984406A (en) Method and system for upgrading terminal through wireless local area network
CN110597542A (en) Automatic OTA (over the air) software upgrading method and device and electronic equipment
WO2011088701A1 (en) Method and device for online upgrading cross-platform version
CN110580167A (en) system upgrading method, intelligent device and server
CN112104477A (en) Online updating method and system for firmware of electric control end and WiFi module
CN111026417A (en) Embedded equipment upgrading method and embedded equipment
CN112416411A (en) Upgrading method and device, equipment terminal, server and computer readable medium
US20050010914A1 (en) Method for upgrading firmware
CN111367761B (en) Information management method, system and related components of universal server
CN112148526A (en) Application program updating method, device, system, equipment and storage medium
KR20090076712A (en) Firmware upgrade system
CN103714059A (en) Data updating method and device
CN110855462A (en) Bluetooth OTA firmware upgrading device
CN111610995B (en) Device firmware upgrading method and device, electronic device and storage medium
CN114594970A (en) DSP software remote upgrading system and method
KR100516551B1 (en) Remote software upgrade method and system in optical network
US20240111514A1 (en) Communication device and firmware update system
WO2017043026A1 (en) Control method and communication device employing same
CN114157995B (en) Bluetooth networking method, bluetooth networking device, electronic equipment and computer readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20201229

RJ01 Rejection of invention patent application after publication