CN112527365A - Application program updating method, nonvolatile memory, storage medium and household appliance - Google Patents

Application program updating method, nonvolatile memory, storage medium and household appliance Download PDF

Info

Publication number
CN112527365A
CN112527365A CN202011211667.8A CN202011211667A CN112527365A CN 112527365 A CN112527365 A CN 112527365A CN 202011211667 A CN202011211667 A CN 202011211667A CN 112527365 A CN112527365 A CN 112527365A
Authority
CN
China
Prior art keywords
program
area
application program
user
backup area
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.)
Granted
Application number
CN202011211667.8A
Other languages
Chinese (zh)
Other versions
CN112527365B (en
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 CN202011211667.8A priority Critical patent/CN112527365B/en
Publication of CN112527365A publication Critical patent/CN112527365A/en
Application granted granted Critical
Publication of CN112527365B publication Critical patent/CN112527365B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management
    • 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • G06F8/654Updates using techniques specially adapted for alterable solid state memories, e.g. for EEPROM or flash memories
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping
    • G06F9/4406Loading of operating system
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/12Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Quality & Reliability (AREA)
  • Health & Medical Sciences (AREA)
  • Computing Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Stored Programmes (AREA)

Abstract

The invention belongs to the technical field of household appliances, and discloses an application program updating method, a nonvolatile memory, a storage medium and a household appliance. Compared with the application program backup, the invention consumes less storage space. Dynamically creating a program backup area to use storage resources in a more efficient manner; the invention upgrades the function program and the application program to run and use the same address, guides the program to realize fixed position jump, and is convenient for development and management. The invention adopts two-step updating, firstly the upgrading method is obtained, and then the latest application program is upgraded by the upgrading method. The application program of the invention firstly takes the new upgrading method program and then executes the method to realize the acquisition of the program file.

Description

Application program updating method, nonvolatile memory, storage medium and household appliance
Technical Field
The invention belongs to the technical field of household appliances, and particularly relates to an application program updating method, a nonvolatile memory, a storage medium and a household appliance.
Background
At present, the traditional household electrical appliance relates to the maintenance of a controller program, and after-sales personnel need to be arranged to get on and off the machine set and replace the controller, so that the operation is troublesome. Based on this background, many MCU program upgrading schemes, such as CN104090796A, CN104156237A, etc., have appeared, and these schemes can all realize the update of the application program of the electronic device, thereby facilitating the subsequent maintenance.
Over time, the upgrade scheme for the product may also change. For example, the original product adopts the change of the transmission protocol; or the target address of the downloaded program needs to be adjusted; or the initial upgrade method is incomplete. Based on these situations, the upgrade function needs to be updated subsequently.
Patents CN106569847A and CN103257880A, etc., integrate the upgrade function into the application program, so that the application program can be updated and the update of the upgrade method can be completed at the same time. The related scheme adopts two application program partitions, and MCU storage resources are consumed comparatively.
The CN102541585A solution illustrates a solution where the functionality is split into a number of separate modules. Avoiding the duplication of functions for different memory regions creates additional overhead.
Further, many upgrade schemes fix and define the space of each partition in advance, and different partitions store different programs. And the same functional program is required to set the interrupt vector table to start running from a different address.
Through the above analysis, the problems and defects of the prior art are as follows:
(1) in the existing upgrading scheme, the upgrading scheme of the burning-in MCU is fixed, and cannot be changed subsequently.
(2) The method is used for storing each part of program partition to be fixed, and the original partition has the condition that the upgrading requirement cannot be met along with continuous iteration of application. As originally allocated 200k application area; 20k IAP program area. When the file size exceeds the range, the data in other spaces can be covered, and further an exception is generated. (IAP realizes updating of program by modifying flash based on application program in application program).
(3) The program sets different interrupt vector tables according to different addresses stored in the MCU storage area. The more partitions that need to be jumped, the more interrupt vector tables that need to be changed are involved.
The significance of solving the problems and the defects is as follows:
(1) as for the backup replacement scheme, a conventional scheme is to download an application program to a backup area and then replace the program of the backup area with a running program by a boot program. A controller program typically includes communication functions, display functions, sensing functions, control functions, and the like. Assuming that the size of the currently running application is 200k, the size of the program to which the modified partial content corresponds should also be around 200 k. In view of this, at least 400k of memory area of the program is required at the beginning of the design.
The invention adopts the technical scheme that firstly, an upgrading function program (the program is only responsible for acquiring the function of an application program to be updated from a specified source) is downloaded, the size of the upgrading function program is dozens of k (for example, the sizes of files of different upgrading methods are different and certainly smaller than that of the whole application program), and when the programs of 200k are downloaded by the programs of dozens of k, the consumption of the whole storage space is less than 300 k. It should be noted here that the chip memory resources of the MCU are very limited (extra cost overhead is added by adding a memory chip or selecting a large memory MCU). CN102541585A mentions the idea of extracting the upgrade module, and this scheme only proposes one upgrade module, and jumps to the past during upgrade, where the program of the upgrade module is fixed and cannot be updated, and the upgrade module and the program loading module are located in different areas, and are started by selecting bootrom.
(2) In the case of dynamic file backups, many schemes fix the size of the running program and the backup partition. Also by way of example: the total of 0x 80000-0 x80200 in one MCU is 0x200 used for an upgrading method, 0x 80200-0 x81200 is used for an application program, if a file to be upgraded exceeds 0x200 (such as 0x260 bytes), coverage on another valid interval is caused, if the update is terminated in the midway, another program is covered and no valid file exists, and the whole program cannot run.
The backup of the invention is based on the used space of the current execution program to automatically select the idle area, thereby always ensuring the reliability of the current operation program and saving the chip storage resource before the program is downloaded.
(3) Multiple partition saving routines, executed by jumping to different partitions are also mentioned in many patents, which also claim to set interrupt vectors, as is known in the industry. Generally speaking, when programs are placed at 0x20000 and 0x22000, the storage locations of the programs are known during execution, so that many internal operations based on addresses can be guaranteed to be reliable, even if the functions of the users are the same, the users can get their interrupt vector addresses in various ways during actual completion, the management cost is increased under the condition that a plurality of running modules have addresses, and the storage addresses of the functional modules need to be remembered so as to be handled during development.
The invention processes the bootstrap program, and the upgrading function program and the application program are all put at the same initial address for execution through copy/move operation, thereby reducing the management cost.
Disclosure of Invention
The invention provides an application program updating method, a nonvolatile memory, a storage medium and a household appliance, and particularly relates to a method for updating an MCU application program of a household appliance.
The invention is realized in this way, a method for updating application program of household electrical appliance, which is applied to nonvolatile memory, the method for updating application program of household electrical appliance includes:
and acquiring and updating the household appliance application program upgrading method, and updating the household appliance application program based on the acquired upgrading method.
Further, the method for acquiring the application program update of the household electrical appliance comprises the following steps:
step one, executing an application program of the household appliance; judging whether application program updating information is received or not;
step two, if receiving the updating information of the application program, judging whether the application program is reasonably upgraded; if not, returning error information and returning to the first step; if the judgment is reasonable, the third step is executed;
step three, planning a backup area based on the used space of the current user application program, and downloading a corresponding upgrading method program by using a well-agreed communication protocol through a specific serial port, a USB interface or an SPI interface; writing the downloaded upgrading method program into a backup area of the user program area;
restarting the MCU, reading the address of the related backup area stored in the backup area, the size parameter of the program stored in the backup area and the content of the mark to be adjusted by the program; judging whether the read mark to be adjusted of the program is effective or not, and if not, returning to the step one; if yes, executing the step five;
and step five, replacing the running program, namely the application program, of the current user program area with the program of the backup area upgrading method based on reading the address of the backup area and the size parameter of the storage program of the backup area.
After the power-down/power-up operation occurs, the MCU replaces the program in the backup area to the running address according to the mark information; and after the replacement is finished, after the mark is cleared, electrifying again, and if the MCU does not detect the mark, directly skipping to execute the upgrading method program.
Further, in the first step, the method for determining whether the application update information is received includes:
a) judging whether the version of the program to be upgraded is higher than the current running version;
b) judging whether the upgrading method corresponds to the program using the memory space CodeSpaceupdateWhether it is less than the user program area residual Space at the momentfree
c) Judging upgrading method corresponding to program using space CodeSpaceupdateAnd the updated user application uses the space CodeSpacenewappWhether the sum exceeds the total Space size Space of the user program areatotal
In the step b), the user program area residual SpacefreeThe size is as follows:
Spacefree=Spacetotal-CodeSpaceapp
CodeSpaceappthe storage space size is used for the application currently running in the user area.
Further, in the second step, the starting address BackAddr of the backup areastartComprises the following steps:
BackAddrstart=UserAddrstart+CodeSpaceapp
wherein UserAddrstartIndicating the starting address of the user program area; codesspaceappIndicating the amount of storage space used by the application.
Further, in step three, the downloading of the corresponding upgrade method program includes: if the download process is abnormal, the downloaded backup is cleared.
Further, in the fifth step, the replacing the running program, i.e., the application program, of the current user program area with the program of the backup area upgrading method includes:
(5.1) reading the relevant parameters of the backup area to acquire user program information of the equipment; judging whether the user program needs to be adjusted or not; if the adjustment is not needed, jumping to the user program to execute the user program; if the adjustment is needed, executing the step (5.2);
(5.2) determining the size of the backup file based on the acquired parameters, and subpackaging the backup area data;
(5.3) copying or moving the data from the backup area to the area to be executed packet by packet; and updating the parameters to copy or move the packet number;
(5.4) judging whether the copying or the moving is finished; if not, returning to the step (5.3); if the program is finished, the user program adjustment mark is clear; and jumps to the user program to execute the user program.
Further, the updating the application program of the home appliance based on the acquired upgrading method includes:
1) based on the obtained upgrading method, downloading the new version application program by using a well agreed communication protocol through a specific serial port, a USB interface or an SPI interface, and writing the new version application program into a backup area of a user program area;
2) after downloading and writing, saving the initial address of the backup area related to the backup area, the size parameter of the backup program file, and setting the mark to be adjusted of the current program to be effective in the parameter area;
3) restarting the MCU, guiding the program to read the parameter area, and acquiring the address of the backup area related to the backup area, the size parameter of the stored program of the backup area and the content of the mark to be adjusted of the program;
3) judging whether the obtained mark to be adjusted of the program is effective or not, if not, jumping to a user program area to execute the running program; if the program is valid, replacing the running program, namely the upgrading method program, of the current user program area with the latest application program of the backup area on the basis of the address of the backup area, the size of the storage program of the backup area and related information;
4) and clearing the mark to be adjusted of the program, and jumping to the initial address of the user program area to execute the current latest user program, namely the new version application program.
Further, the backup area starting address BackAddrstart_newComprises the following steps:
BackAddrstart_new=UserAddrstart+CodeSpaceupdate
wherein UserAddrstartIndicating the starting address of the user program area; codesspaceupdateIndicating the size of the space used by the upgrade function.
Further, the downloading the new version application program comprises: if the application program is abnormal in the downloading and writing process, clearing the backup area, uploading corresponding error information in the downloading and writing process and suspending the upgrading program.
Another object of the present invention is to provide a nonvolatile memory, including:
the boot program area is used for copying/moving the backup program in the user program area to the running address to finish the replacement of the execution program;
the device parameter area is used for storing program size, verification information, a backup program starting address, a copying/moving progress and a program adjusting mark;
and a user program area for executing the user application program or upgrading the function program.
Furthermore, the bootstrap program area is also used for realizing the copying/moving of the program according to the mark information, and finally, skipping to a specific address to execute the user program;
the device parameter area is also used for storing some device data by a user to avoid power failure loss, and the program read-write related parameters in different areas realize the control of an upgrading process;
the user program area is also used for storing the currently running program and backing up the program to be updated; large space is allocated in advance.
It is a further object of the invention to provide a computer program product stored on a computer readable medium, comprising a computer readable program for providing a user input interface for implementing said method when executed on an electronic device.
It is a further object of the invention to provide a computer device comprising a memory and a processor, the memory storing a computer program which, when executed by the processor, causes the processor to perform the steps of:
acquiring an application program through a specific interface, and writing the application program into a backup area of a user program area; setting the relevant parameters of the backup area and setting a mark to be adjusted of the application program; receiving the application program upgrading command, judging the application program upgrading condition, uploading the corresponding error reason if the application program upgrading condition does not pass the application program upgrading command, and continuing to execute the application program;
executing a bootstrap program, and replacing the application program by the bootstrap program to an execution program;
and jumping to a user program area to execute the latest program, and updating the application program in the user area of the nonvolatile memory.
It is another object of the present invention to provide a computer-readable storage medium storing a computer program which, when executed by a processor, causes the processor to perform the steps of:
acquiring an application program through a specific interface, and writing the application program into a backup area of a user program area; setting the relevant parameters of the backup area and setting a mark to be adjusted of the application program; receiving the application program upgrading command, judging the application program upgrading condition, uploading the corresponding error reason if the application program upgrading condition does not pass the application program upgrading command, and continuing to execute the application program;
executing a bootstrap program, and replacing the application program by the bootstrap program to an execution program;
and jumping to a user program area to execute the latest program, and updating the application program in the user area of the nonvolatile memory.
Another object of the present invention is to provide a home appliance implementing the application program update method.
By combining all the technical schemes, the invention has the advantages and positive effects that:
the invention realizes the updating of the MCU application program, and simultaneously, the corresponding upgrading method can also be updated, and the updating of the MCU application program can be finished even if the upgrading method is changed.
Compared with the application program backup, the invention consumes less storage space. Program backup areas are created dynamically to use storage resources in a more efficient manner.
The invention upgrades the function program and the application program to run and use the same address, guides the program to realize fixed position jump, and is convenient for development and management.
The invention adopts two-step updating, and the upgrading method is firstly obtained and then used for upgrading the latest application program.
The original upgrading method is to obtain the application program from the serial port, and the application program is required to be obtained from the network port at present, wherein the application program is taken to a new upgrading method program through a specific interface, and then the method is executed to obtain the program file from the network port.
According to the method, the backup space of 120k can be obtained based on the size of the current running program, and the backup requirement of the program is completely met.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed to be used in the embodiments of the present application will be briefly described below, and it is obvious that the drawings described below are only some embodiments of the present application, and it is obvious for those skilled in the art that other drawings can be obtained from the drawings without creative efforts.
Fig. 1 is a schematic diagram illustrating division of a non-volatile memory area on an MCU according to an embodiment of the present invention.
Fig. 2 is a flowchart of application program upgrade provided in an embodiment of the present invention.
Fig. 3 is a diagram illustrating a process of changing a user program area of a nonvolatile memory according to an embodiment of the present invention.
Fig. 4 is a flowchart of the guiding procedure provided by the embodiment of the present invention.
FIG. 5 is a diagram illustrating a variation of the user program area of the non-volatile memory of the boot program 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 is further described in detail with reference to the following embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
In view of the problems in the prior art, the present invention provides an application program updating method, a non-volatile memory, a storage medium and a home appliance, and the present invention is described in detail below with reference to the accompanying drawings.
The invention provides a method for updating an application program of household electrical appliance, which is applied to a nonvolatile memory and comprises the following steps:
executing the home appliance application; judging whether application program updating information is received or not;
if receiving the updating information of the application program, judging whether the application program is reasonably upgraded; if the current time is not reasonable, returning error information and returning to the step of executing the application program of the household appliance;
if the updating method is reasonable, planning a backup area based on the used space of the current user application program, and downloading a corresponding updating method program by using a well-agreed communication protocol through a specific serial port, a USB interface or an SPI interface; writing the downloaded upgrading method program into a backup area of the user program area;
restarting the MCU, reading the address of the related backup area stored in the backup area, the size parameter of the program stored in the backup area and the content of the mark to be adjusted by the program; judging whether the read mark to be adjusted of the program is effective or not, and if not, returning to the step of executing the application program of the household appliance;
if the program is valid, replacing the running program, namely the application program, of the current user program area with the program of the backup area upgrading method based on reading the address of the backup area and the size parameter of the storage program of the backup area;
based on the acquired backup area upgrading method program, downloading a new version application program by using a well-agreed communication protocol through a specific serial port, a USB interface or an SPI interface, and writing the new version application program into a backup area of a user program area;
after downloading and writing, saving the initial address of the backup area related to the backup area, the size parameter of the backup program file, and setting the mark to be adjusted of the current program to be effective in the parameter area;
restarting the MCU, guiding the program to read the parameter area, and acquiring the address of the backup area related to the backup area, the size parameter of the stored program of the backup area and the content of the mark to be adjusted of the program;
judging whether the obtained mark to be adjusted of the program is effective or not, if not, jumping to a user program area to execute the running program; if the program is valid, replacing the running program, namely the upgrading method program, of the current user program area with the latest application program of the backup area on the basis of the address of the backup area, the size of the storage program of the backup area and related information;
and clearing the mark to be adjusted of the program, and jumping to the initial address of the user program area to execute the current latest user program, namely the new version application program.
In this embodiment of the present invention, the determining whether the application update information is received includes:
a) judging whether the version of the program to be upgraded is higher than the current running version;
b) judging whether the upgrading method corresponds to the program using the memory space CodeSpaceupdateWhether it is less than the user program area residual Space at the momentfree(ii) a User program area residual SpacefreeThe size is as follows:
Spacefree=Spacetotal-CodeSpaceapp
CodeSpaceappto useThe size of the storage space used by the application program currently running in the user area;
c) judging upgrading method corresponding to program using space CodeSpaceupdateAnd the updated user application uses the space CodeSpacenewappWhether the sum exceeds the total Space size Space of the user program areatotal
In the embodiment of the invention, the starting address BackAddr of the backup areastartComprises the following steps:
BackAddrstart=UserAddrstart+CodeSpaceapp
wherein UserAddrstartIndicating the starting address of the user program area; codesspaceappIndicating the amount of storage space used by the application.
In this embodiment of the present invention, the downloading of the corresponding upgrade method program includes: if the download process is abnormal, the downloaded backup is cleared;
the step of replacing the running program, i.e. the application program, of the current user program area with the backup area upgrading method program comprises the following steps:
(1) reading related parameters of the backup area and acquiring user program information of the equipment; judging whether the user program needs to be adjusted or not; if the adjustment is not needed, jumping to the user program to execute the user program; if the adjustment is needed, executing the step (2);
(2) determining the size of a backup file based on the acquired parameters, and subpackaging the backup area data;
(3) copying or moving the data from the backup area to an area to be executed packet by packet; and updating the parameters to copy or move the packet number;
(4) judging whether the copying or moving is finished; if not, returning to the step (3); if the program is finished, the user program adjustment mark is clear; and jumps to the user program to execute the user program.
In the embodiment of the invention, the backup area starting address BackAddrstart_newComprises the following steps:
BackAddrstart_new=UserAddrstart+CodeSpaceupdate
wherein UserAddrstartIndicating the starting address of the user program area; codesspaceupdateIndicating the size of the space used by the upgrade function.
The invention is further described with reference to specific examples.
Example 1
In the invention, three spaces are divided on the MCU nonvolatile memory, as shown in FIG. 1. The program partition of the MCU nonvolatile memory provided by the invention comprises:
the boot program area is used for copying/moving the backup program in the user program area to the running address to finish the replacement of the execution program; specifically, the program is copied/moved according to the mark information, and finally, the user program is executed by jumping to a specific address, so that the used storage space is small.
And a device parameter area for storing a program size, check information, a backup program start address, a copy/move progress (packet number), a program adjustment flag, and the like.
Specifically, a user stores some device data to avoid losing power failure (or resetting), program read-write related parameters in different areas realize control of an upgrading process, and the required storage space is small.
And a user program area for executing the user application program or upgrading the function program.
Specifically, a currently running program is stored, and a program to be updated is backed up. Larger space is allocated in advance.
In the present invention, the specific implementation flow of upgrading (the method for implementing the user program update by the MCU) is shown in fig. 2.
Determining a program usage space (CodeSpace) based on the program size (CodeSize) in the following relationship:
CodeSpace=CodeSize+Padding
wherein Padding is supplementary according to actual needs. If the program size is 0x123456 bytes and the supplementary 2 bytes are 0x123458 bytes, the size is an integral multiple of 4, so that the efficiency of accessing the address by the 32-bit MCU is faster; or the complement is 0x123600, so that the integral multiple of 512 bytes is met, and the subsequent bootstrap program can be just divided into 2331 packet data for copying/moving according to 512 bytes in each packet; in addition, the files can be ensured not to be stored on the same sector through the completion.
In fig. 2, the flow in the left dashed box is that the application executes the flow after receiving the upgrade request; the right dashed box flow is the upgrade function program execution flow.
Specifically, as shown in fig. 2, in the process of upgrading the application program of the running user, the upgrade program needs to be judged first after receiving the upgrade command.
a) Judging whether the version of the program to be upgraded is higher than the current running version;
b) judging whether the upgrading method corresponds to the program using the memory space CodeSpaceupdateWhether it is less than the user program area residual Space at the momentfree
c) Judging upgrading method corresponding to program using space CodeSpaceupdateAnd the updated user application uses the space CodeSpacenewappWhether the sum exceeds the total Space size Space of the user program areatotal
Wherein the user program area residual Space at this timefreeThe size is as follows:
Spacefree=Spacetotal-CodeSpaceapp
note: codesspaceappThe storage space size is used for the application currently running in the user area.
And finishing the judgment of the program information of the upgrade file, uploading the corresponding error reason if the program information of the upgrade file does not pass the judgment, and continuously executing the application program.
Calculating to obtain the starting address (BackAddr) of the backup areastart) Determined by the following formula:
BackAddrstart=UserAddrstart+CodeSpaceapp
UserAddrstarta starting address for a user program area;
and downloading the program corresponding to the upgrading method to the backup area, clearing the content of the backup space when abnormality occurs in the process of downloading and writing the program into the backup area, uploading corresponding error information, and executing the user application program. Fig. 3 is a diagram illustrating a process of changing a user program area of a nonvolatile memory according to an embodiment of the present invention.
After the program corresponding to the correct upgrading method is written into the backup area, corresponding parameters, the initial address of the backup area and the size of the space are saved, and a mark for adjusting the running program of the user area is set.
And then the MCU is restarted, the bootstrap program reads the content of the parameter area of the nonvolatile memory to obtain the address of the backup area, and the content of the backup area is replaced by the running program of the current user program area packet by packet. The working flow is as shown in fig. 4, and each time the copy/move of a packet of data is completed, the corresponding data packet number is updated in the parameter area, so as to ensure that the copy/move of the content in the backup space can be continuously completed even after the power is turned on again after the sudden power failure. After the copy/move operation is completed, jump to the initial address of the user program area to execute the current latest user program (the program corresponding to the upgrade method).
The boot program non-volatile memory user program area changes are shown in figure 5. The non-volatile memory user program area changes during the boot program execution segment copy/move, where 200k is the backup program size, for example.
In the invention, MCU downloads new version application program through specific interface (such as serial port, USB, SPI) by using predetermined communication protocol according to the latest upgrading method, and writes the new version application program into new backup area of user program area (S3), the initial address (BackAddr) of the new backup areastart_new) Comprises the following steps:
BackAddrstart_new=UserAddrstart+CodeSpaceupdate
and if the new version application program is abnormal in the downloading and writing process, emptying the new backup area, uploading corresponding error information in the downloading and writing process and suspending the program.
And the new version application program finishes downloading to the backup area, sets relevant parameters (such as the initial address of the backup area, the size of the backup area and the like) of the backup area in the parameter area of the nonvolatile memory, and sets a mark to be adjusted of the program. And restarting the MCU to execute the bootstrap program, and replacing the new application program with the execution program by the bootstrap program.
And jumping to a user program area to execute the latest program, and finishing the updating of the application program of the user area of the MCU nonvolatile memory.
There are two procedures in the present invention: compared with the traditional upgrading backup, the application program and the program corresponding to the upgrading method adopt two application programs, and the application program is larger than the program of the upgrading method; in an embodiment, space for programs to be backed up is planned in the user program area based on the size of the currently running program.
In the present invention, examples of the fixed partition size include: two 100k spaces are allocated and fixed on a 200k program storage space for application programs and program backup, if the size of a currently running program is 80k, the number of upgraded programs to be backed up is 120k, and therefore the situation of exceeding partitions occurs, and the upgrading process is abnormal.
The method can obtain 120k backup space based on the size of the current running program, and completely meets the backup requirement of the program.
In the invention, for example, the execution program is stored in an address a, a vector address based on a needs to be set in advance in the program to ensure the normal execution of the program, a plurality of execution addresses can cause a plurality of interrupt vector addresses to need to be set, the jump position of the bootstrap program also needs to be changed, and the program file to be executed can be copied to a designated bit.
Example 2:
the method for updating the application program of the household appliance comprises the following steps:
and after receiving the upgrading information, judging whether the application program is reasonably upgraded.
If the program is unreasonable, returning error information to continue executing the application program; and after the process is reasonable, performing subsequent application program updating processes.
The whole updating process is divided into two stages: the first stage, updating the upgrading method; and the second stage, updating the application program.
In the first stage, the application program is run, and a well-agreed communication protocol is used through a specific serial port, a USB interface or an SPI interface to download a corresponding upgrading method program (the program has simple functions, mainly realizes downloading of the application program of the MCU, and has small required space). Write it toBackup area of user program area, starting address BackAddr of backup areastartComprises the following steps:
BackAddrstart=UserAddrstart+CodeSpaceapp
UserAddrstarta starting address for a user program area;
CodeSpaceappthe storage size is used for the application.
After the downloading and writing are successfully completed, saving relevant parameters (initial address of the backup area, file size of the backup program and the like) of the backup area and setting a mark to be adjusted of the current program to be effective in the parameter area. And meanwhile, if the downloaded backup is abnormal in the downloading process, the downloaded backup is cleared.
And restarting the MCU, and guiding the program to read the parameter area to obtain the relevant parameters (backup area address, backup area storage program size and the like) of the backup area and the mark content to be adjusted of the program. Judging a mark to be adjusted of the program, wherein the mark effectively executes the replacement of the program, and replacing the running program (application program) of the current user program area with the backup area upgrading method program based on the backup area address, the backup area storage program size and other information; the mark is invalid, and the user program area is directly jumped to execute the running program.
The working flow of replacing the program file is shown in fig. 4, because the program file is larger and is difficult to realize one-time copying/moving for the MCU, the backup program is divided into a plurality of data packets, the backup area program is copied/moved packet by packet, and the corresponding data packet number is saved and updated in the parameter area when the copying/moving of one packet of data is completed, so that the copying/moving in the user program area can be continuously completed after the sudden power failure is ensured and the power is turned on again.
And after the copying/moving operation is finished, clearing the mark to be adjusted by the program. And jumping to the initial address of the user program area to execute the current latest user program (the program corresponding to the upgrading method).
And in the second stage, running an upgrading method program, downloading a new version application program by using a well-agreed communication protocol through a specific serial port, a USB interface or an SPI interface, and writing the new version application program into a backup area of a user program area, wherein the initial address BackAddr of the backup area isstart_newComprises the following steps:
BackAddrstart_new=UserAddrstart+CodeSpaceupdate
UserAddrstarta starting address for a user program area;
CodeSpaceupdateusing the size of the space for upgrading the functional program.
If the application program is abnormal in the downloading and writing process, clearing the backup area, uploading corresponding error information in the downloading and writing process and suspending the upgrading program.
After the downloading and writing are successfully completed, saving relevant parameters (initial address of the backup area, file size of the backup program and the like) of the backup area and setting a mark to be adjusted of the current program to be effective in the parameter area.
And restarting the MCU, and guiding the program to read the parameter area to obtain the relevant parameters (backup area address, backup area storage program size and the like) of the backup area and the mark content to be adjusted of the program. Judging a mark to be adjusted of a program, wherein the mark effectively executes the replacement of the program, and replacing the running program (upgrading method program) of the current user program area with the latest application program of the backup area based on the information such as the address of the backup area, the size of the backup area storage program and the like; the mark is invalid, and the user program area is directly jumped to execute the running program.
The working flow of replacing the program file is shown in fig. 4, because the program file is larger and is difficult to realize one-time copying/moving for the MCU, the backup program is divided into a plurality of data packets, the backup area program is copied/moved packet by packet, and the corresponding data packet number is saved and updated in the parameter area when the copying/moving of one packet of data is completed, so that the copying/moving in the user program area can be continuously completed after the sudden power failure is ensured and the power is turned on again.
And after the copying/moving operation is finished, clearing the mark to be adjusted by the program. And jumping to the initial address of the user program area to execute the current latest user program (new version application program) to finish the whole application program upgrading.
It should be noted that the embodiments of the present invention can be realized by hardware, software, or a combination of software and hardware. The hardware portion may be implemented using dedicated logic; the software portions may be stored in a memory and executed by a suitable instruction execution system, such as a microprocessor or specially designed hardware. Those skilled in the art will appreciate that the apparatus and methods described above may be implemented using computer executable instructions and/or embodied in processor control code, such code being provided on a carrier medium such as a disk, CD-or DVD-ROM, programmable memory such as read only memory (firmware), or a data carrier such as an optical or electronic signal carrier, for example. The apparatus and its modules of the present invention may be implemented by hardware circuits such as very large scale integrated circuits or gate arrays, semiconductors such as logic chips, transistors, or programmable hardware devices such as field programmable gate arrays, programmable logic devices, etc., or by software executed by various types of processors, or by a combination of hardware circuits and software, e.g., firmware.
The above description is only for the purpose of illustrating the present invention and the appended claims are not to be construed as limiting the scope of the invention, which is intended to cover all modifications, equivalents and improvements that are within the spirit and scope of the invention as defined by the appended claims.

Claims (10)

1. A method for updating an application program of a home appliance, which is applied to a nonvolatile memory, the method comprising:
and acquiring and updating the household appliance application program upgrading method, and updating the household appliance application program based on the acquired upgrading method.
2. The method for updating an application program of a home device as claimed in claim 1, wherein the method for obtaining and updating an upgrade of an application program of a home device comprises:
executing the home appliance application; judging whether application program updating information is received or not;
if receiving the updating information of the application program, judging whether the application program is reasonably upgraded; if the current time is not reasonable, returning error information and returning to the step of executing the application program of the household appliance;
if the updating method is reasonable, planning a backup area based on the used space of the current user application program, and downloading a corresponding updating method program by using a well-agreed communication protocol through a specific serial port, a USB interface or an SPI interface; writing the downloaded upgrading method program into a backup area of the user program area;
restarting the MCU, reading the address of the related backup area stored in the backup area, the size parameter of the program stored in the backup area and the content of the mark to be adjusted by the program; judging whether the read mark to be adjusted of the program is effective or not, and if not, returning to the step of executing the application program of the household appliance;
if the program is valid, replacing the running program, namely the application program, of the current user program area with the program of the backup area upgrading method based on reading the address of the backup area and the size parameter of the storage program of the backup area;
after the power-down/power-up operation occurs, the MCU replaces the program in the backup area to the running address according to the mark information; after the replacement is finished, after the mark is cleared, the MCU is electrified again, and if the MCU does not detect the mark, the MCU directly skips to execute the program of the upgrading method;
the updating of the application program of the household appliance based on the obtained upgrading method comprises the following steps:
based on the acquired backup area upgrading method program, downloading a new version application program by using a well-agreed communication protocol through a specific serial port, a USB interface or an SPI interface, and writing the new version application program into a backup area of a user program area;
after downloading and writing, saving the initial address of the backup area related to the backup area, the size parameter of the backup program file, and setting the mark to be adjusted of the current program to be effective in the parameter area;
restarting the MCU, guiding the program to read the parameter area, and acquiring the address of the backup area related to the backup area, the size parameter of the stored program of the backup area and the content of the mark to be adjusted of the program;
judging whether the obtained mark to be adjusted of the program is effective or not, if not, jumping to a user program area to execute the running program; if the program is valid, replacing the running program, namely the upgrading method program, of the current user program area with the latest application program of the backup area on the basis of the address of the backup area, the size of the storage program of the backup area and related information;
and clearing the mark to be adjusted of the program, and jumping to the initial address of the user program area to execute the current latest user program, namely the new version application program.
3. The method for updating an application program of a home appliance according to claim 1,
the determining whether the application update information is received includes:
a) judging whether the version of the program to be upgraded is higher than the current running version;
b) judging whether the upgrading method corresponds to the program using the memory space CodeSpaceupdateWhether it is less than the user program area residual Space at the momentfree(ii) a User program area residual SpacefreeThe size is as follows:
5pacefree=Spacetotal-CodeSpaceapp
CodeSpaceappthe size of a storage space used by an application program currently running in a user area;
c) judging upgrading method corresponding to program using space CodeSpaceupdateAnd the updated user application uses the space CodeSpacenewappWhether the sum exceeds the total Space size Space of the user program areatotal
Starting address BackAddr of the backup areastartComprises the following steps:
BackAddrstart=UserAddrstart+CodeSpaceapp
wherein UserAddrstartIndicating the starting address of the user program area; codesspaceappIndicating the amount of storage space used by the application.
4. The updating method for application program of home appliance according to claim 2, wherein said downloading corresponding upgrading method program comprises: if the download process is abnormal, the downloaded backup is cleared;
the step of replacing the running program, i.e. the application program, of the current user program area with the backup area upgrading method program comprises the following steps:
(1) reading related parameters of the backup area and acquiring user program information of the equipment; judging whether the user program needs to be adjusted or not; if the adjustment is not needed, jumping to the user program to execute the user program; if the adjustment is needed, executing the step (2);
(2) determining the size of a backup file based on the acquired parameters, and subpackaging the backup area data;
(3) copying or moving the data from the backup area to an area to be executed packet by packet; and updating the parameters to copy or move the packet number;
(4) judging whether the copying or moving is finished; if not, returning to the step (3); if the program is finished, the user program adjustment mark is clear; and jumps to the user program to execute the user program.
5. The method for updating an application program of a home appliance according to claim 2, wherein the backup area start address BackAddr is based on the backup area start address BackAddrstar_newComprises the following steps:
BackAddrstart_new=UserAddrstart+CodeSpaceupdate
wherein UserAddrstartIndicating the starting address of the user program area; codesspaceupdateIndicating the size of the space used by the upgrade function.
6. The method for updating an application program of a home device as claimed in claim 2, wherein the downloading of the new version application program comprises: if the application program is abnormal in the downloading and writing process, clearing the backup area, uploading corresponding error information in the downloading and writing process and suspending the upgrading program.
7. A non-volatile memory, comprising:
the boot program area is used for copying/moving the backup program in the user program area to the running address to finish the replacement of the execution program;
the device parameter area is used for storing program size, verification information, a backup program starting address, a copying/moving progress and a program adjusting mark;
a user program area for executing a user application program or upgrading a function program;
the bootstrap program area is also used for realizing the copying/moving of the program according to the mark information and finally jumping to a specific address to execute the user program;
the device parameter area is also used for storing some device data by a user to avoid power failure loss, and the program read-write related parameters in different areas realize the control of an upgrading process;
the user program area is also used for storing the currently running program and backing up the program to be updated; large space is allocated in advance.
8. A computer device, characterized in that the computer device comprises a memory and a processor, the memory storing a computer program which, when executed by the processor, causes the processor to carry out the steps of:
acquiring an application program through a specific interface, and writing the application program into a backup area of a user program area; setting the relevant parameters of the backup area and setting a mark to be adjusted of the application program; receiving the application program upgrading command, judging the application program upgrading condition, uploading the corresponding error reason if the application program upgrading condition does not pass the application program upgrading command, and continuing to execute the application program;
executing a bootstrap program, and replacing the application program by the bootstrap program to an execution program;
and jumping to a user program area to execute the latest program, and updating the application program in the user area of the nonvolatile memory.
9. A computer-readable storage medium storing a computer program which, when executed by a processor, causes the processor to perform the steps of:
acquiring an application program through a specific interface, and writing the application program into a backup area of a user program area; setting the relevant parameters of the backup area and setting a mark to be adjusted of the application program; receiving the application program upgrading command, judging the application program upgrading condition, uploading the corresponding error reason if the application program upgrading condition does not pass the application program upgrading command, and continuing to execute the application program;
executing a bootstrap program, and replacing the application program by the bootstrap program to an execution program;
and jumping to a user program area to execute the latest program, and updating the application program in the user area of the nonvolatile memory.
10. A household appliance implementing the application program updating method according to any one of claims 1 to 6.
CN202011211667.8A 2020-11-03 2020-11-03 Application program updating method, nonvolatile memory, storage medium and household appliance Active CN112527365B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011211667.8A CN112527365B (en) 2020-11-03 2020-11-03 Application program updating method, nonvolatile memory, storage medium and household appliance

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011211667.8A CN112527365B (en) 2020-11-03 2020-11-03 Application program updating method, nonvolatile memory, storage medium and household appliance

Publications (2)

Publication Number Publication Date
CN112527365A true CN112527365A (en) 2021-03-19
CN112527365B CN112527365B (en) 2024-05-10

Family

ID=74979436

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011211667.8A Active CN112527365B (en) 2020-11-03 2020-11-03 Application program updating method, nonvolatile memory, storage medium and household appliance

Country Status (1)

Country Link
CN (1) CN112527365B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114327573A (en) * 2021-12-24 2022-04-12 博为科技有限公司 Flash partitioning method and related equipment in system upgrading process
EP4216054A1 (en) * 2022-01-21 2023-07-26 LG Electronics Inc. Upgradable electronic device and method for upgrading electronic device
CN117785248A (en) * 2024-02-28 2024-03-29 上海励驰半导体有限公司 Registration method and device of key variables in program upgrading, storage medium and chip
CN117931247A (en) * 2024-03-25 2024-04-26 青岛国创智能家电研究院有限公司 Intelligent household appliance interaction method based on universal terminal OS

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100180108A1 (en) * 2009-01-14 2010-07-15 Fengche Liu Electronic device and method for secure operating system update in embedded system
CN106325929A (en) * 2016-08-22 2017-01-11 合肥华凌股份有限公司 Firmware upgrading method, firmware upgrading device, refrigerator and server side
WO2018209788A1 (en) * 2017-05-18 2018-11-22 宁德时代新能源科技股份有限公司 Program updating method and device
CN109683941A (en) * 2018-12-27 2019-04-26 四川九洲空管科技有限责任公司 A kind of answering machine method for upgrading software based on single-chip on-line loaded

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100180108A1 (en) * 2009-01-14 2010-07-15 Fengche Liu Electronic device and method for secure operating system update in embedded system
CN106325929A (en) * 2016-08-22 2017-01-11 合肥华凌股份有限公司 Firmware upgrading method, firmware upgrading device, refrigerator and server side
WO2018209788A1 (en) * 2017-05-18 2018-11-22 宁德时代新能源科技股份有限公司 Program updating method and device
CN109683941A (en) * 2018-12-27 2019-04-26 四川九洲空管科技有限责任公司 A kind of answering machine method for upgrading software based on single-chip on-line loaded

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114327573A (en) * 2021-12-24 2022-04-12 博为科技有限公司 Flash partitioning method and related equipment in system upgrading process
EP4216054A1 (en) * 2022-01-21 2023-07-26 LG Electronics Inc. Upgradable electronic device and method for upgrading electronic device
CN117785248A (en) * 2024-02-28 2024-03-29 上海励驰半导体有限公司 Registration method and device of key variables in program upgrading, storage medium and chip
CN117785248B (en) * 2024-02-28 2024-05-24 上海励驰半导体有限公司 Registration method and device of key variables in program upgrading, storage medium and chip
CN117931247A (en) * 2024-03-25 2024-04-26 青岛国创智能家电研究院有限公司 Intelligent household appliance interaction method based on universal terminal OS

Also Published As

Publication number Publication date
CN112527365B (en) 2024-05-10

Similar Documents

Publication Publication Date Title
CN112527365A (en) Application program updating method, nonvolatile memory, storage medium and household appliance
CN109933348B (en) Method and device for updating Bootloader in electronic control unit
US5805882A (en) Computer system and method for replacing obsolete or corrupt boot code contained within reprogrammable memory with new boot code supplied from an external source through a data port
US5864698A (en) Disk based bios
US6317827B1 (en) Method and apparatus for fault tolerant flash upgrading
CN109240730B (en) Singlechip online upgrading method and system
US8595716B2 (en) Failsafe firmware updates
CN109358887B (en) On-line upgrading method, device and system for single chip microcomputer program
CN112988183A (en) Program upgrading method and device, electronic equipment and storage medium
CN105138382A (en) Method for upgrading Android system and terminal
CN104123153A (en) Apparatus and method for firmware upgrade using USB
CN102945173A (en) User program on-line upgrading system and method
CN110874237A (en) Software upgrading method, device, terminal and readable storage medium
CN111562934A (en) Software system upgrading method based on hot patch, terminal and storage medium
CN112130926B (en) Application program running method, device, terminal equipment and storage medium
EP3540598A1 (en) Method, device and server for checking a defective function
US20140025870A1 (en) Computer reprogramming method, data storage medium and motor vehicle computer
CN106933637A (en) The restorative procedure and device of a kind of system partitioning
CN110737455A (en) Firmware updating method and device and electronic equipment
CN114398087A (en) Method for improving running stability of single chip microcomputer after program updating and single chip microcomputer
CN114265608A (en) Method and device for upgrading TF card firmware, computer equipment and storage medium
CN109582370B (en) Starting method and device of NOR FLASH embedded equipment
KR20060015969A (en) Electronic apparatus and program update method of thereof
CN113157432B (en) Firmware replacement method based on RISC processor
CN113268266B (en) Multi-version coexistence management method, system and medium for applet rendering framework

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
GR01 Patent grant
GR01 Patent grant