CN107480007B - Program redundancy check and error correction method - Google Patents

Program redundancy check and error correction method Download PDF

Info

Publication number
CN107480007B
CN107480007B CN201710694884.9A CN201710694884A CN107480007B CN 107480007 B CN107480007 B CN 107480007B CN 201710694884 A CN201710694884 A CN 201710694884A CN 107480007 B CN107480007 B CN 107480007B
Authority
CN
China
Prior art keywords
program
area
application program
verification
main 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.)
Active
Application number
CN201710694884.9A
Other languages
Chinese (zh)
Other versions
CN107480007A (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.)
NR Electric Co Ltd
NR Engineering Co Ltd
Original Assignee
NR Electric Co Ltd
NR Engineering Co Ltd
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 NR Electric Co Ltd, NR Engineering Co Ltd filed Critical NR Electric Co Ltd
Priority to CN201710694884.9A priority Critical patent/CN107480007B/en
Publication of CN107480007A publication Critical patent/CN107480007A/en
Application granted granted Critical
Publication of CN107480007B publication Critical patent/CN107480007B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1448Management of the data involved in backup or backup restore
    • 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/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1458Management of the backup or restore process
    • G06F11/1469Backup restoration techniques

Abstract

The invention discloses a program redundancy check and error correction method, which comprises the following contents: packaging the bootstrap program and the application program into a specific format file according to a partition structure; downloading the file with the specific format into equipment and restarting the equipment, and carrying out program verification by the bootstrap program according to the partition structure and a redundancy rule; and the bootstrap program carries out corresponding recovery work according to the damage degree of the program data. The method adopts a redundancy check rule to carry out double check on the program area and adopts recovery measures to ensure the correct program space and the normal operation of equipment.

Description

Program redundancy check and error correction method
Technical Field
The invention belongs to the field of electric power automation, and particularly relates to a program redundancy check and error correction method.
Background
In recent years, the growth of the scale of power grids has driven the rapid development of secondary devices in power systems. The secondary equipment is gradually moved from the conventional control cubicle to outdoor operation, thereby bringing about a series of problems. The control cabinet is provided with air conditioners and other equipment, so that the temperature and humidity can be effectively controlled, the temperature difference is large and the humidity is unstable in day and night in outdoor operation, and great challenges are brought to the operation stability of secondary equipment. The conventional smart device program has the following problems: 1. the bootstrap program directly loads the application program without validity check; 2. even if some boot programs verify the application programs, the application programs cannot be effectively recovered after the application programs are in error. In order to solve the problem, it is necessary to provide a new technology and a new method for program redundancy check and error correction according to the characteristics of secondary equipment and by combining engineering practice.
The invention discloses a method and a system for recovering single chip microcomputer software errors, which are patent applications with application number CN201410357317.0, and relates to the technical field of single chip microcomputers. The technical scheme of the invention is different from CN201410357317.0 in the following points:
1) the backup program contents are different: CN201410357317.0 backups code segments such as main functions, sub-functions, interrupt functions and the like, the names of the functions are different, and the functions are required to be stored in a continuous single-chip microcomputer program storage space; the backup of the invention comprises but is not limited to a code segment, a data segment and a bss segment, the names of the functions are the same, the main area and the standby area are completely the same binary system, and no requirement is made on the storage position of the function;
2) the backup data format is different: the CN201410357317.0 patent backup completely adopts binary codes generated by a compiler; the backup of the invention can adopt binary codes of a compiler or compressed data codes;
3) the data recovery mechanism: the CN201410357317.0 patent does not restore the damaged program area, but jumps the program to the corresponding intact backup area for execution; the method carries out corresponding repair work on the damaged area, and jumps the program to a specific area (main area) for execution;
4) the application range is as follows: CN201410357317.0 relates to the field of single chip microcomputers; the invention can be applied to various fields such as CPU, DSP and MCU.
Disclosure of Invention
Aiming at the defects and shortcomings in the prior art, the invention aims to provide a program redundancy check and error correction method which can effectively improve the running stability of secondary equipment.
To achieve the above object, the solution of the present invention is as follows:
a method of program redundancy check and error correction, comprising the steps of:
step 1: packaging the bootstrap program and the application program into a specific format file according to a partition structure;
step 2: downloading the file with the specific format into the equipment and restarting the equipment, and leading the program to carry out program verification according to the partition structure and the redundancy rule;
and step 3: and the bootstrap program carries out corresponding recovery work according to the damage degree of the program data.
Furthermore, the partition structure comprises a boot area, a public area, an application main area and an application standby area.
Furthermore, the guide area, the public area, the application program main area and the application program standby area are connected.
Further, the common area contains the following information: checksum, boot zone length, application zone length, program generation time, version number.
Further, the specific format file: 1) when the program storage space is large enough, the files are spliced in a flat space mode; 2) when the storage space of the program is insufficient, the file adopts a data compression mode, and the compression format comprises zip, 7z and rar.
Further, the redundancy rule in step 2 includes the following contents: the bootstrap program firstly reads the verification of the public area, then reads the main area of the application program and the spare area of the application program, and verifies the two latter areas, and the situations are as follows: case 1: the common area verification, the application program main area verification and the application program standby area verification are consistent; case 2: the public area check is only the same as the main area check of the application program; case 3: the public area check is only the same as the application program spare area check; case 4: the primary area of the application program and the standby area of the application program are verified to be the same, but different from the public area; case 5: and the rest of the situation.
Further, the corresponding recovery task in step 3 includes the following steps: 1) when the verification result is that the situation is 1, the bootstrap program jumps to the main area of the application program for execution; 2) when the verification result is the situation 2, copying the main area of the application program to the standby area, and jumping the bootstrap program to the main area of the application program for execution; 3) when the verification result is the situation 3, copying the application program spare area to the main area, and jumping the bootstrap program to the application program main area for execution; 4) when the verification result is the situation 4, verifying and writing the main area of the application program into the public area, and jumping the bootstrap program to the main area of the application program for execution; 5) and if the verification result is that the main area and the standby area of the application program are abnormal in the case 5, the boot program enters a downloading mode, the application program is waited to be updated, and the main area of the application program is jumped to be executed after the update is finished.
Furthermore, the download mode comprises a serial port, an Ethernet and a field bus, and the communication mode comprises an unbalanced protocol and a balanced protocol.
The invention has the beneficial effects that: by the method for program redundancy check and error correction, double check is carried out on the program area and recovery measures are taken, so that correct program space and normal operation of equipment are ensured, and the stability of secondary equipment operation can be effectively improved.
Drawings
FIG. 1 is a file structure of the program redundancy check and error correction method adopted in the patent;
fig. 2 is a flowchart of a process of program redundancy check and error correction adopted in the patent.
Detailed Description
The invention provides a method for program redundancy check and error correction, which comprises the following steps:
packaging the bootstrap program and the application program into a specific format file according to a partition structure; downloading the file with the specific format into equipment and restarting the equipment, and carrying out program verification by the bootstrap program according to the partition structure and a redundancy rule; and the bootstrap program carries out corresponding recovery work according to the data damage degree. The method adopts a redundancy check rule to carry out double check on the program area and adopts recovery measures to ensure the correct program space and the normal operation of equipment.
Wherein, the bootstrap program function includes: the device comprises an initialization register, an interrupt vector, a serial port/USB/Ethernet and other devices, and also comprises the functions of reading the public area check, calculating the main area/standby area check of the application program and the like.
Wherein, the partition structure includes: the system comprises a boot program, a public area and an application program main area/standby area, wherein the public area stores information such as application program verification, application program length, boot program length, program generation time, version number and the like, and a partition structure can be stored by adopting a nonvolatile storage medium.
Wherein, the specific format file comprises: 1) when the program storage space is large enough, the files can be spliced in a flat space mode; 2) when program storage space is insufficient, the file may be in a data compression format, including but not limited to zip/7z/rar, etc.
The specific format file can be specifically merged in the following way: 1) opening a target file targetFp in a binary writing mode, and opening a source file sourceFp in a binary reading mode, wherein the source file can be a bootstrap program or an application program; 2) reading and writing sourceFp into the targetFp, and writing information such as verification, length, generation date, version number and the like of the bootstrap program and the application program when the targetFp reaches the public area, wherein the verification can adopt a CRC32 mode. If the effective information length is insufficient, 0xff filling can be adopted; 3) when the targetFp reaches the main/spare area of the application program, the sourceFp binary system is written, and if the effective information length is insufficient, 0xff padding can be adopted.
Wherein the redundancy rules handle the following situations: 1) when the common area verification, the application program main area verification and the standby area verification are consistent; 2) when the common area check is only the same as the main area check of the application program; 3) when the common area check is only the same as the application program spare area check; 4) when the primary area and the standby area of the application program are verified to be the same, but the primary area and the standby area are different from the public area; 5) and the rest of the situation.
Wherein the recovery work comprises: 1) when the common area verification, the application program main area verification and the standby area verification are consistent, the boot program jumps to the application program main area to execute; 2) when the verification of the public area is only the same as that of the main area of the application program, copying the main area of the application program to the standby area, and jumping the boot program to the main area of the application program for execution; 3) when the verification of the public area is only the same as that of the application program spare area, copying the application program spare area to the main area, and jumping the boot program to the application program main area for execution; 4) when the primary area and the standby area of the application program are verified to be the same but different from the public area, writing the primary area verification of the application program into the public area, and leading the program to jump to the primary area of the application program for execution; 5) and the other situations are that the main area and the standby area of the application program are abnormal, the boot program enters a downloading mode, the application program is waited to be updated, and the main area of the application program is jumped to be executed after the update is finished. The download mode includes but is not limited to serial port, ethernet, field bus, etc., and the communication mode includes but is not limited to protocols such as unbalanced type and balanced type.
The method comprises a boot area, a public area, an application program main area and an application program spare area, wherein the storage content comprises a boot program, a checksum, an application program length, a boot program length, a program generation time, a version number, an application program and the like. The guide area, the public area, the application program main area and the application program standby area are connected.
The following describes a specific implementation of the present invention in terms of a specific program redundancy and error correction method. The file format is shown in figure 1, the program flow chart is shown in figure 2, and the specific implementation method comprises the following steps:
1. the new file format is as follows:
(1) when the program storage space is large enough, the files can be spliced in a flat space mode;
(2) when the program storage space is insufficient, the file can adopt a data compression format, and the compression format comprises but is not limited to zip/7z/rar and the like;
(3) generating a file format in a binary mode;
2. and (3) a bootstrap program:
(1) the processor loads a new file from the fixed address, the head of the new file is a bootstrap program, and the bootstrap program starts to execute;
(2) the bootstrap program reads the verification of the public area first, then reads the main area and the standby area of the application program, and verifies the two latter areas, which is divided into the following 5 situations:
a) when the common area verification, the application program main area verification and the standby area verification are consistent, the boot program jumps to the application program main area to execute;
b) when the verification of the public area is only the same as that of the main area of the application program, copying the main area of the application program to the standby area, and jumping the boot program to the main area of the application program for execution;
c) when the verification of the public area is only the same as that of the application program spare area, copying the application program spare area to the main area, and jumping the boot program to the application program main area for execution;
d) when the primary area and the standby area of the application program are verified to be the same but different from the public area, writing the primary area verification of the application program into the public area, and leading the program to jump to the primary area of the application program for execution;
e) the rest of the cases are as follows: and entering a downloading mode and waiting for updating the application program. After the updating of the main area/the standby area of the application program is finished, jumping to the main area of the application program for execution;
3. and (3) downloading mode:
including but not limited to serial ports, ethernet, fieldbus, etc., and the communication means includes but not limited to protocols such as unbalanced and balanced. Under the mode of serial ports and the like, a downloading mechanism comprises modes of message verification, retransmission and the like, and effective downloading of a program is ensured; in modes such as Ethernet, the download mechanism comprises modes such as message boundary, multi-frame confirmation and the like;
the invention provides a program redundancy check and error correction method, which comprises a boot area, a public area, an application program main area and an application program spare area, wherein the storage content comprises a boot program, a checksum, an application program length, a boot program length, a program generation time, a version number, an application program and the like. The guide area, the public area, the application program main area and the application program standby area are connected.
The invention provides a program redundancy check and error correction method, which packages a bootstrap program and an application program into a file with a specific format according to a partition structure; downloading the file with the specific format into equipment and restarting the equipment, and carrying out program verification by the bootstrap program according to the partition structure and a redundancy rule; and the bootstrap program carries out corresponding recovery work according to the data damage degree. The method adopts a redundancy check rule to carry out double check on the program area and adopts recovery measures to ensure the correct program space and the normal operation of equipment.
The processor in the invention can be a DSP, a singlechip, a CPU and other types of processors.
The above embodiments are only for illustrating the technical idea of the present invention, and the protection scope of the present invention is not limited thereby, and any modifications made on the basis of the technical scheme according to the technical idea of the present invention fall within the protection scope of the present invention.

Claims (5)

1. A method for program redundancy check and error correction, the method comprising the steps of:
step 1: packaging the bootstrap program and the application program into a specific format file according to a partition structure; the partition structure comprises a guide area, a public area, an application program main area and an application program standby area;
step 2: downloading the file with the specific format into the equipment and restarting the equipment, and leading the program to carry out program verification according to the partition structure and the redundancy rule;
the method specifically comprises the following steps that the bootstrap program firstly reads the verification of the public area, then reads the main area and the standby area of the application program, and verifies the two latter areas, and the situations are as follows: case 1: the common area verification, the application program main area verification and the application program standby area verification are consistent; case 2: the public area check is only the same as the main area check of the application program; case 3: the public area check is only the same as the application program spare area check; case 4: the primary area of the application program and the standby area of the application program are verified to be the same, but different from the public area; case 5: (ii) the remaining cases;
and step 3: the bootstrap program carries out corresponding recovery work according to the damage degree of the program data;
the corresponding recovery work includes the following: 1) when the verification result is that the situation is 1, the bootstrap program jumps to the main area of the application program for execution; 2) when the verification result is the situation 2, copying the main area of the application program to the standby area, and jumping the bootstrap program to the main area of the application program for execution; 3) when the verification result is the situation 3, copying the application program spare area to the main area, and jumping the bootstrap program to the application program main area for execution; 4) when the verification result is the situation 4, verifying and writing the main area of the application program into the public area, and jumping the bootstrap program to the main area of the application program for execution; 5) and if the verification result is that the main area and the standby area of the application program are abnormal in the case 5, the boot program enters a downloading mode, the application program is waited to be updated, and the main area of the application program is jumped to be executed after the update is finished.
2. The method of claim 1, wherein the boot area, the common area, the application main area, and the application spare area are connected.
3. The method of program redundancy check and error correction of claim 1, wherein the common area contains the following information: checksum, boot zone length, application zone length, program generation time, version number.
4. The method of claim 1, wherein the specific format file: 1) when the program storage space is large enough, the files are spliced in a flat space mode; 2) when the storage space of the program is insufficient, the file adopts a data compression mode, and the compression format comprises zip, 7z and rar.
5. The method of claim 1, wherein the download mode comprises serial port, ethernet, and fieldbus, and the communication mode comprises non-balanced protocol and balanced protocol.
CN201710694884.9A 2017-08-15 2017-08-15 Program redundancy check and error correction method Active CN107480007B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710694884.9A CN107480007B (en) 2017-08-15 2017-08-15 Program redundancy check and error correction method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710694884.9A CN107480007B (en) 2017-08-15 2017-08-15 Program redundancy check and error correction method

Publications (2)

Publication Number Publication Date
CN107480007A CN107480007A (en) 2017-12-15
CN107480007B true CN107480007B (en) 2020-09-08

Family

ID=60599544

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710694884.9A Active CN107480007B (en) 2017-08-15 2017-08-15 Program redundancy check and error correction method

Country Status (1)

Country Link
CN (1) CN107480007B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108958819B (en) * 2018-06-29 2021-12-31 大陆汽车车身电子系统(芜湖)有限公司 Starting method of multi-partition system and multi-partition system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101650662A (en) * 2009-08-26 2010-02-17 中兴通讯股份有限公司 Memory device of embedded system and staring method and upgrading of firmware
CN102402470A (en) * 2011-12-19 2012-04-04 青岛海信网络科技股份有限公司 Method and device for automatically correcting error of program of flash memory and repairing program of flash memory
CN102684841A (en) * 2012-05-31 2012-09-19 无锡众志和达存储技术有限公司 Coding computation unit and decoding data verification method
CN105279043A (en) * 2014-07-24 2016-01-27 清华大学 Method and system for recovering single-chip microcomputer software error

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101543245B1 (en) * 2009-03-18 2015-08-11 삼성전자주식회사 Error correcting device memory device and data processing system including the same

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101650662A (en) * 2009-08-26 2010-02-17 中兴通讯股份有限公司 Memory device of embedded system and staring method and upgrading of firmware
CN102402470A (en) * 2011-12-19 2012-04-04 青岛海信网络科技股份有限公司 Method and device for automatically correcting error of program of flash memory and repairing program of flash memory
CN102684841A (en) * 2012-05-31 2012-09-19 无锡众志和达存储技术有限公司 Coding computation unit and decoding data verification method
CN105279043A (en) * 2014-07-24 2016-01-27 清华大学 Method and system for recovering single-chip microcomputer software error

Also Published As

Publication number Publication date
CN107480007A (en) 2017-12-15

Similar Documents

Publication Publication Date Title
CN106569847B (en) Method for vehicle-mounted system to realize IAP remote upgrade based on mobile network
CN108052355B (en) Satellite-borne load unit software on-orbit weight composing method
CN109117168A (en) Unmanned plane firmware update, device, unmanned plane and storage medium
CN103176824B (en) A kind of method and device of system upgrade
CN102609326B (en) Data downloading processing method and data downloading processing device
CN104007996A (en) Reliable firmware upgrading realizing method for distributed control system
CN100507773C (en) Method and device implementing on-line upgrading of a fixed programme
CN103257880B (en) A kind of remote application online updating method based on DSP
CN103473067A (en) Embedded Linux partitioning and data recovery method, embedded Linux partitioning and data recovery system and system development method
CN103092647A (en) Online upgrade method of embedded system
CN101815988A (en) Firmware image update and management
TW200414042A (en) Firmware architecture supporting safe updates and multiple processor types
CN112040476B (en) Upgrading method and device for terminal of Internet of things
CN106569833B (en) DSP program online upgrading method with two-stage BOOT
CN103761112A (en) Vehicle-mounted multimedia device and control method thereof
CN103677869A (en) Wireless sensor network node remote code updating system and method
CN109683941A (en) A kind of answering machine method for upgrading software based on single-chip on-line loaded
CN102902530A (en) Procedure verifying device based on Linux embedded operating system
CN112650518A (en) DSP program on-line upgrading method
CN101963911B (en) Patch generates method and apparatus
WO2015184732A1 (en) Bootstrap storage method, bootstrap fault recovery method and device, and computer storage medium
CN107480007B (en) Program redundancy check and error correction method
CN110637521B (en) Data real-time storage method and system based on model simulation
JP2008198060A (en) Information processor, patch code mounting system, electronic equipment, and patch code mounting method
CN108255510B (en) IAP-based transmission verification design method for online upgrading of firmware to be upgraded

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