CN106354635B - A kind of the program code segments self checking method and device of embedded device - Google Patents

A kind of the program code segments self checking method and device of embedded device Download PDF

Info

Publication number
CN106354635B
CN106354635B CN201610727513.1A CN201610727513A CN106354635B CN 106354635 B CN106354635 B CN 106354635B CN 201610727513 A CN201610727513 A CN 201610727513A CN 106354635 B CN106354635 B CN 106354635B
Authority
CN
China
Prior art keywords
program code
self
data
code segments
threshold value
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
CN201610727513.1A
Other languages
Chinese (zh)
Other versions
CN106354635A (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.)
State Grid Corp of China SGCC
Xuji Group Co Ltd
State Grid Zhejiang Electric Power Co Ltd
XJ Electric Co Ltd
Xuchang XJ Software Technology Co Ltd
Jiaxing Power Supply Co of State Grid Zhejiang Electric Power Co Ltd
Original Assignee
State Grid Corp of China SGCC
Xuji Group Co Ltd
State Grid Zhejiang Electric Power Co Ltd
XJ Electric Co Ltd
Xuchang XJ Software Technology Co Ltd
Jiaxing Power Supply Co of State Grid Zhejiang Electric Power 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 State Grid Corp of China SGCC, Xuji Group Co Ltd, State Grid Zhejiang Electric Power Co Ltd, XJ Electric Co Ltd, Xuchang XJ Software Technology Co Ltd, Jiaxing Power Supply Co of State Grid Zhejiang Electric Power Co Ltd filed Critical State Grid Corp of China SGCC
Priority to CN201610727513.1A priority Critical patent/CN106354635B/en
Publication of CN106354635A publication Critical patent/CN106354635A/en
Application granted granted Critical
Publication of CN106354635B publication Critical patent/CN106354635B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3604Software analysis for verifying properties of programs
    • G06F11/3612Software analysis for verifying properties of programs by runtime analysis

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses the program code segments self checking methods and device of a kind of embedded device, belong to embedded system applied technical field, and method includes the following steps:File destination is parsed, memory location information, the code section length of logging program code area are obtained, and the backup area of entire program code in memory is backed up;When program is run, program Operational Zone and backup area data are relatively detected in real time;Comparison result is handled, if unanimously, data are normal;If inconsistent, data exception, and alert.It is added after program code segments self-checking function, it enables a device to detect program code segments in real time in the process of running, and it found the abnormal situation in time, once there is abnormal conditions, abnormal conditions can be recorded and alarmed by equipment, it helps field personnel that can position and solve the problems, such as soon as possible, avoids the expansion of problem and cause irremediable loss.

Description

A kind of the program code segments self checking method and device of embedded device
Technical field
The invention belongs to embedded system applied technical fields, and in particular to a kind of program code segments of embedded device from Detecting method and device.
Background technology
The generally requirement of the reliability and real-time of embedded device is all very high, will ensure the reliable of equipment in any case Action, improve equipment reliability and real-time be embedded product design major tasks.Due to some it is uncertain because The potential danger that element is not found either causes program code segments abnormal, and equipment may be caused to generate unpredictable danger, In this case it is difficult to ensure that the reliability of device action, or even serious consequence can be caused to system.
Invention content
The object of the present invention is to provide a kind of program code segments self checking methods of embedded device, to solve embedded set The problem of standby program code segments runtimeerror.
In order to solve the above technical problems, the present invention provides a kind of program code segments self checking method of embedded device, step Including:
1) file destination is parsed, obtains memory location information, the code section length of logging program code area, and by entire journey The backup area of sequence code in memory is backed up;
2) when program is run, program Operational Zone and backup area data are relatively detected in real time;
3) comparison result is handled, if unanimously, data are normal;If inconsistent, data exception, and alert.
Further, further include detecting and judging cpu load situation in real time, be used for setting program code segment self-test task gate The step of threshold value, the threshold value include monitoring time interval and data self-test granularity;When cpu load increases, reduce data certainly It examines granularity and/or increases monitoring time interval;When cpu load reduces, increase between data self-test granularity and/or reduction monitoring time Every.
Further, when setting threshold value, the change of cpu load is divided into several ranges, each range corresponds to one Threshold value.
Further, when further including data exception, the step of reporting is written into abnormal conditions.
The present invention also provides a kind of program code segments self-checking units of embedded device, including following module:For parsing File destination obtains memory location information, the code section length of logging program code area, and in memory by entire program code The module that is backed up of backup area;When being run for program, the mould of program Operational Zone and backup area data is relatively detected in real time Block;For handling comparison result, if unanimously, data are normal;If inconsistent, data exception, and the module alerted.
Further, further include appointing for setting program code segment self-test for detecting and judging cpu load situation in real time The module of business threshold value, the threshold value includes monitoring time interval and data self-test granularity;When cpu load increases, reduce number According to self-test granularity and/or increase detection time interval;When cpu load reduces, when increasing data self-test granularity and/or reducing monitoring Between be spaced.
Further, when setting threshold value, cpu load change is divided into several ranges, each range corresponds to a door Threshold value.
Further, further include when being used for data exception, by the module of abnormal conditions write-in report.
The beneficial effects of the invention are as follows:Memory when parsing file destination by program code area in formulation backups, Equipment compares detection program Operational Zone and Backup Data in real time when running.The program code segments self-checking function of addition, causes the device to It is enough to detect program code segments in real time in the process of running, and found the abnormal situation in time, once noting abnormalities, equipment can be by exception Situation is recorded and is alerted;Help field personnel position and solve the problems, such as soon as possible, ensure that equipment operation safety and Reliability avoids the expansion of problem and causes irremediable loss.
Description of the drawings
Fig. 1 is program code segments self-test mission flow diagram;
Fig. 2 is CPU usage Detection task flow chart.
Specific implementation mode
Illustrate below in conjunction with the accompanying drawings, the present invention will be described in further detail.
The present invention provides a kind of program code segments self checking method of embedded device, and specific implementation step is as shown in Figure 1.
First, initialization needs the default value of the file destination and self-test task threshold that parse.Parsing file destination obtains The address of program code segments and size, and the data of program code segments are copied into a specified core position, as backup Code area.The default value of self-defined self-test task threshold, including monitoring time interval and data self-test granularity.In this embodiment In, monitoring time interval default value is set as 10ms, and data self-test granularity default value is set as 128 bytes.
Then, program code segments Detection task is carried out.When equipment is run, real-time comparison program Operational Zone code segment and backup The binary data of 128 bytes of area code section realizes the detection to code segment.It is not abnormal just to detect next 128 byte Data make Field Force note abnormalities in time, and facilitate technology if it find that abnormal then alert and report is written in abnormal conditions Personnel are accurately positioned exception and right a wrong.
Wherein, when equipment is run, code segment self-test task can set code segment self-test according to the load condition of CPU Threshold value, threshold value include monitoring time interval and data self-test granularity, accomplish to ensure in the case where not influencing equipment performance The safety and reliability of equipment operation.Specific CPU usage Detection task method is as shown in Figure 2.
In initial phase, the time interval of one section of constant time lag is recorded, other tasks all do not start to run at this time, can Obtain a more accurate standard reference time interval.During the task run, the time interval of one section of constant time lag is recorded (as the interval when task initialization), during equipment is run, the priority of the task is minimum, as long as there is other tasks fortune Row, which, which will be interrupted, executes other tasks, is finished and in suspended state, the task until other tasks are carried out It can just continue to execute.CPU tasks are more, and execution is more frequent, and the time interval of actual count is longer.By standard reference time Interval and the time interval compare the occupation rate that can obtain CPU, it is known that the payload of CPU.
When cpu load is bigger, current CPU tasks burdensome calls change program code segments self-test task threshold Interface, the data self-test granularity of program code segments self-test task is reduced into either monitoring time interval and increases or subtracts simultaneously Small data self-test granularity and increase monitoring time interval, reduce self-test speed so that program code segments task by the method Consumption of the reduction small as possible to CPU.
When cpu load is smaller, current CPU tasks are lighter, call change program code segments self-test task threshold Interface, the data self-test granularity of program code segments self-test task is increased into either monitoring time interval and reduces or increases simultaneously Big data self-test granularity and reduction monitoring time interval, self-test speed is improved by the method.
It can be specifically configured to:When CPU occupation rates are less than 30%, CPU self-test task calls change program code segments certainly The monitoring time interval of program code segments self-test task is changed to 2ms by the interface of inspection task threshold, data self-test granularity is changed to 256 bytes;When CPU occupation rates are when between 30%~60%, threshold is all restored into default value;When CPU occupation rates are more than When 60%, the interface of program code segments self-test task threshold is changed in CPU self-test task calls, by program code segments self-test task Monitoring time interval is changed to 20ms, data self-test granularity is changed to 64 bytes.
In the above-described embodiments, cpu load situation is divided into three ranges, i.e., between 30% or less, 30%~60%, 60% or more, each range corresponds to a threshold value, i.e., 30% using lower threshold value as monitoring time interval 2ms, data self-test 256 byte of granularity;Threshold value is monitoring time interval 10ms, 128 byte of data self-test granularity between 30%~60%;60% with Upper is monitoring time interval 20ms, 64 byte of data self-test granularity.It, can be according to actual conditions, by CPU as other embodiment Load condition is further subdivided into more ranges, corresponding more threshold values, and even each cpu load value corresponds to a door Threshold value can determine threshold value by directly calculating or tabling look-up at this time.
The present invention also provides a kind of program code segments self-checking units of embedded device, including following module:For parsing File destination obtains memory location information, the code section length of logging program code area, and in memory by entire program code The module that is backed up of backup area;When being run for program, the mould of program Operational Zone and backup area data is relatively detected in real time Block;For handling comparison result, if unanimously, data are normal;If inconsistent, data exception, and the module alerted.
The program code segments self-checking unit of above-mentioned embedded device is actually based on a kind of meter of the method for the present invention flow Calculation machine solution, i.e., a kind of software architecture, above-mentioned various modules are each treatment progress corresponding with method flow or journey Sequence.Since sufficiently clear is complete for the introduction to the above method, therefore the device is no longer described in detail.

Claims (6)

1. a kind of program code segments self checking method of embedded device, which is characterized in that include the following steps:
1) file destination is parsed, obtains memory location information, the code section length of logging program code area, and by entire program generation The backup area of code in memory is backed up;
2) when program is run, program Operational Zone and backup area data are relatively detected in real time;
3) comparison result is handled, if unanimously, data are normal;If inconsistent, data exception, and alert;
The step of further including detecting and judging cpu load situation in real time, being used for setting program code segment self-test task threshold value, institute It includes monitoring time interval and data self-test granularity to state threshold value;When cpu load increases, reduce data self-test granularity and/or increasing Big monitoring time interval;When cpu load reduces, increases data self-test granularity and/or reduce monitoring time interval.
2. the program code segments self checking method of embedded device according to claim 1, which is characterized in that setting threshold value When, the change of cpu load is divided into several ranges, each range corresponds to a threshold value.
3. the program code segments self checking method of embedded device according to claim 1, which is characterized in that further include data When abnormal, the step of reporting is written into abnormal conditions.
4. a kind of program code segments self-checking unit of embedded device, which is characterized in that including following module:
1) it is used to parse file destination, obtains memory location information, the code section length of logging program code area, and by entire journey The module that the backup area of sequence code in memory is backed up;
2) when being used for program operation, the module of program Operational Zone and backup area data is relatively detected in real time;
3) it is used to handle comparison result, if unanimously, data are normal;If inconsistent, data exception, and the module alerted;
Further include for detecting and judging cpu load situation in real time, be used for the mould of setting program code segment self-test task threshold value Block, the threshold value include monitoring time interval and data self-test granularity;Cpu load increase when, reduce data self-test granularity and/ Or increase detection time interval;When cpu load reduces, increases data self-test granularity and/or reduce monitoring time interval.
5. the program code segments self-checking unit of embedded device according to claim 4, which is characterized in that setting threshold value When, cpu load change is divided into several ranges, each range corresponds to a threshold value.
6. the program code segments self-checking unit of embedded device according to claim 4, which is characterized in that further include being used for When data exception, by the module of abnormal conditions write-in report.
CN201610727513.1A 2016-08-25 2016-08-25 A kind of the program code segments self checking method and device of embedded device Active CN106354635B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610727513.1A CN106354635B (en) 2016-08-25 2016-08-25 A kind of the program code segments self checking method and device of embedded device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610727513.1A CN106354635B (en) 2016-08-25 2016-08-25 A kind of the program code segments self checking method and device of embedded device

Publications (2)

Publication Number Publication Date
CN106354635A CN106354635A (en) 2017-01-25
CN106354635B true CN106354635B (en) 2018-11-09

Family

ID=57854227

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610727513.1A Active CN106354635B (en) 2016-08-25 2016-08-25 A kind of the program code segments self checking method and device of embedded device

Country Status (1)

Country Link
CN (1) CN106354635B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109766267A (en) * 2018-12-15 2019-05-17 中国平安人寿保险股份有限公司 CPU high consumes Code location method, apparatus, electronic equipment and storage medium
CN111027072B (en) * 2019-12-20 2024-02-27 北京安天网络安全技术有限公司 Kernel Rootkit detection method and device based on elf binary standard analysis under Linux

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1908909A (en) * 2006-08-24 2007-02-07 无敌科技(西安)有限公司 Supported system of startup program and method thereof
US7191445B2 (en) * 2001-08-31 2007-03-13 Texas Instruments Incorporated Method using embedded real-time analysis components with corresponding real-time operating system software objects
CN102520974A (en) * 2011-10-26 2012-06-27 京信通信系统(中国)有限公司 Method and device for automatic recovery of repeater station radio frequency data table
CN104298599A (en) * 2014-10-21 2015-01-21 卡斯柯信号有限公司 Online embedded-software runtime fault self-checking and slice recovering method and device
CN104572414A (en) * 2014-12-23 2015-04-29 深圳市邦彦信息技术有限公司 Method and system for detecting CPU (Central Processing Unit) occupancy rate of vxWorks

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7191445B2 (en) * 2001-08-31 2007-03-13 Texas Instruments Incorporated Method using embedded real-time analysis components with corresponding real-time operating system software objects
CN1908909A (en) * 2006-08-24 2007-02-07 无敌科技(西安)有限公司 Supported system of startup program and method thereof
CN102520974A (en) * 2011-10-26 2012-06-27 京信通信系统(中国)有限公司 Method and device for automatic recovery of repeater station radio frequency data table
CN104298599A (en) * 2014-10-21 2015-01-21 卡斯柯信号有限公司 Online embedded-software runtime fault self-checking and slice recovering method and device
CN104572414A (en) * 2014-12-23 2015-04-29 深圳市邦彦信息技术有限公司 Method and system for detecting CPU (Central Processing Unit) occupancy rate of vxWorks

Also Published As

Publication number Publication date
CN106354635A (en) 2017-01-25

Similar Documents

Publication Publication Date Title
US10558545B2 (en) Multiple modeling paradigm for predictive analytics
CN113658414B (en) Mine equipment fault early warning method and device, terminal equipment and storage medium
WO2020134032A1 (en) Method for detecting abnormality of service system, and apparatus therefor
EP2624140A1 (en) Method and system for detecting anomaly of network processor
CN104426696B (en) A kind of method of troubleshooting, server and system
CN110611531B (en) Optical module fault diagnosis and early warning method, device and system
CN109343853B (en) Abnormality identification method and device for application program
US20030084376A1 (en) Software crash event analysis method and system
CN106354635B (en) A kind of the program code segments self checking method and device of embedded device
CN108170581A (en) A kind of fault early warning method, device and electronic equipment
WO2012122672A1 (en) Detection on resource leakage
CN110674149B (en) Service data processing method and device, computer equipment and storage medium
CN111124818B (en) Monitoring method, device and equipment for Expander
KR102213676B1 (en) Terminal apparatus for autosar system with arithmetic operation supervision function and arithmetic operation supervision method of autosar system
CN112634973A (en) Data rereading method and system of storage medium, terminal device and storage medium
CN105224426A (en) Physical host fault detection method, device and empty machine management method, system
CN114721862B (en) Watchdog circuit with signal checking function and working method thereof
CN116302755A (en) PSU fault injection test method, system, device and readable storage medium
CN106502929B (en) A kind of target device, a kind of processing method and processing device of internal storage data
CN103678095A (en) Warning detection method
US11914703B2 (en) Method and data processing system for detecting a malicious component on an integrated circuit
US10684908B2 (en) Method for fault detection in an operating system
US11030028B2 (en) Failure detection apparatus, failure detection method, and non-transitory computer readable recording medium
CN113836035B (en) Battery management system testing method and device and electronic equipment
US11422876B2 (en) Systems and methods for monitoring and responding to bus bit error ratio events

Legal Events

Date Code Title Description
C06 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