CN109739675A - A method of program exception is captured using hardware watchdog - Google Patents
A method of program exception is captured using hardware watchdog Download PDFInfo
- Publication number
- CN109739675A CN109739675A CN201811588327.XA CN201811588327A CN109739675A CN 109739675 A CN109739675 A CN 109739675A CN 201811588327 A CN201811588327 A CN 201811588327A CN 109739675 A CN109739675 A CN 109739675A
- Authority
- CN
- China
- Prior art keywords
- stack
- register
- interrupt
- abnormal
- method described
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 26
- 230000002159 abnormal effect Effects 0.000 claims abstract description 24
- 230000006870 function Effects 0.000 claims description 21
- 230000008569 process Effects 0.000 claims description 3
- 238000000151 deposition Methods 0.000 claims 1
- 230000005856 abnormality Effects 0.000 abstract description 4
- 230000001960 triggered effect Effects 0.000 abstract description 2
- 230000006872 improvement Effects 0.000 description 6
- 238000010586 diagram Methods 0.000 description 4
- 230000007246 mechanism Effects 0.000 description 2
- 238000012544 monitoring process Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000001186 cumulative effect Effects 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 239000000047 product Substances 0.000 description 1
- 230000009467 reduction Effects 0.000 description 1
- 238000005316 response function Methods 0.000 description 1
- 239000013589 supplement Substances 0.000 description 1
- 239000000725 suspension Substances 0.000 description 1
Landscapes
- Debugging And Monitoring (AREA)
Abstract
The present invention provides a kind of methods for capturing program exception using hardware watchdog, spaceborne machine program exception is carried out using improved hardware watchdog to monitor, enter misoperation time-out in software, cause hardware watchdog that spaceborne machine is resetted before T arrives the t0 moment, abnormality processing is triggered to interrupt, exception information is recorded, carries out analyzing and positioning afterwards.Method of the invention is improved simply with respect to common hardware house dog, is realized and is saved by operating status before external reset, so that technical staff analyzes abnormal occurrence cause.
Description
Technical field
The present invention relates to the in-orbit method for detecting abnormality of spacecraft software more particularly to a kind of utilization hardware watchdog to capture journey
The method of sequence exception.
Background technique
Reply spacecraft software and hardware mainly has the abnormal interrupt of hardware watchdog monitoring and arm processor to handle extremely at present
Two kinds of means.
Hardware watchdog is a kind of system exception treatment mechanism provided by computer hardware, generally includes a house dog
Counter, its count value can be constantly cumulative with the time upon initialization for the counter counts, once reach default most
Big value will lead to computer hardware and reset (referred to as " dog stings "), and application software code can be periodically to the counting when operating normally
Device resets and (referred to as " feeds dog " to operate), to prevent dog to sting generation.Once because certain software and hardwares cause software not feed extremely on time
Dog, computer, which will reset, restarts, thus to enable whole system restore normal.
Arm processor supports 7 kinds of Exception Types, and wherein undefined instruction is abnormal, instruction prefetch suspension is abnormal, data abort
Abnormal three kinds are applied to processing and lead to CPU exceptional reset.Arm processor includes: stack pointer r13 (SP), connection register r14
(LR), program counter r15 (PC).
In addition, ground consumer electronic product carries out Mission Monitor using a kind of software watchdog of task level, that is, use one
A house dog task, is monitored another main task, and time-out does not feed dog and then thinks that exception occurs in task, and task is carried out
It resets.
The effect of house dog is only that pre- protection computer deadlock or task execution time-out calculate after watchdog reset
Machine restores normal, but the status information before abnormal reason and reset is caused but to disappear with external reset, thus nothing
Method carries out in-orbit trouble-shoots positioning and solution.
Simultaneously as being not triggered the reset of processor Exception Type by external reset, cannot be introduced into abort branch
Processing routine will record extremely.And a kind of in-orbit common exception is that program enters and internally deposits into row large area after endless loop
It rewrites, or even including stack area, leads to not carry out the abnormal positioning of stack analysis realization in abnormality processing.
For task level software watchdog in space industry there are blind area of monitoring, i.e. there is a possibility that being abnormal in operating system
And it is unable to monitor.
Summary of the invention
In order to solve the problems in the prior art, a kind of different using hardware watchdog capture program the present invention provides providing
Normal method.The present invention is realized especially by following technical solution:
A method of program exception being captured using hardware watchdog, the method carries out conventional external hardware watchdog
It improves, the described method comprises the following steps: S1, at the time of t0, exporting one to spaceborne machine before the house dog cycle T time reaches
A I/O interrupt signal, for triggering I/O interrupt, wherein t0 time span is greater than interrupt routine and executes time span;S2, in IO
Abnormal scene is obtained in disconnected responder;S3, successively backtracking obtain the PC register that each calling process saves and LR is posted
Storage content obtains function call chain by the amendment of compiling rule.
As a further improvement of the present invention, in the step S2, reading LR-4 from the position for interrupting stack top -4 can be obtained
Take abnormal scene.
As a further improvement of the present invention, the step S2 further includes sequentially saving into interrupt stack according to turning left from the right side
LR register, r12~r0 register.
As a further improvement of the present invention, the step S2 further includes that the value of abnormal scene is stored in thermal starting not
Lose in memory or outside FRAM, pass by left in carrying out biography can be obtained program after abnormal generation run where.
As a further improvement of the present invention, from interrupt stack top SP-12 position read r11 (FP), can be obtained into
Enter the initial position for the user stack that function uses before interrupting;PC register in every layer of stack frame saves the starting point of called function
Location, LR register save the return address for calling function, and FP register saves the initial address of function call stack.
As a further improvement of the present invention, the step S3 further includes that the call chain is stored in thermal starting not lose
In memory or outside FRAM, the function call situation left and passed when can be obtained abnormal occur in carrying out of passing by.
The beneficial effects of the present invention are: method of the invention is improved simply with respect to common hardware house dog, realize outer
Operating status saves before portion resets, so that technical staff analyzes abnormal occurrence cause.The present invention, which supplements, passes through ARM abnormality processing
It will not trigger ARM by external hardware house dog direct reduction due to entering deadlock into the blind area of stack back trace technique and enter extremely
Abort branch also just lacks the trigger condition of stack backtracking.
Detailed description of the invention
Fig. 1 is common hardware house dog working principle diagram;
Fig. 2 is that house dog captures program exception schematic diagram;
Fig. 3 is the schematic diagram that hardware watchdog of the invention captures program exception;
Fig. 4 is the institutional framework of arm processor stack frame;
Fig. 5 is the function call chain schematic diagram that stack is recalled.
Specific embodiment
The present invention is further described for explanation and specific embodiment with reference to the accompanying drawing.
The method for capturing program exception using hardware watchdog of the invention, need to improve conventional external house dog,
Then software function is realized under hardware condition, the specific steps are as follows:
Step 1:
Conventional hardware dog starts timing after feeding dog, can drag down realization to spaceborne machine reset pin when counting full setting value T
Spaceborne machine resets, such as Fig. 1.
House dog mechanism such as Fig. 2 after improvement, the t0 before the cycle T time reaches realize that an I/O interrupt is defeated to spaceborne machine
Enter, an I/O signal is exported to spaceborne machine, for triggering I/O interrupt.It is long that t0 time span may be slightly larger than the interrupt routine execution time
Degree.
The time span of t0 needs be only greater than interrupt routine and executes time span, can be in the hardware watchdog period
The triggering of other time point is interrupted, and is such as carried out significantly more than the time point that software operates normally, the program that multi collect was at that time
Position preserves the subsequent positioning of auxiliary.
Step 2:
Abnormal scene is obtained in I/O interrupt responder, enters triggering shown in Locale Holding code as table 1 interrupts
After interruption, into interrupt response function, LR-4 (because of ARM assembly line LR=current PC+8, is not held due to PC+4 sections first
Row, so LR=(current PC+8) -4), it obtains interrupting the code position for restarting to execute when returning, i.e., abnormal scene
The latter location of instruction.Then LR register, r12~r0 register are sequentially saved into interrupt stack according to turning left from the right side, SP
Location subtracts 4 every time, so * (SP-4)=LR, * (SP-8)=r12 ... * (SP-56)=r0.
Abnormal scene can be obtained by reading LR-4 from the position for interrupting stack top -4, and value deposit thermal starting is not lost
In memory or outside FRAM, pass by left in carrying out biography can be obtained program after abnormal occur run where.
Table 1, which interrupts, enters Locale Holding example code
Step 3:
It interrupts from table 1 into Locale Holding code and finds out, other than saving 1r register, also save r0~r12.Such as figure
4, in the stack frame institutional framework of arm processor, r11 (FP) indicates the initial position of each function call stack as pointer
(value of SP register).
R11 (FP) is read from the position for interrupting stack top SP-12, can be obtained the user stack that function uses into before interrupting
Initial position.And the initial address of called function is saved in every layer of stack frame in PC, the return address for calling function is saved in LR,
The initial address of function call stack is saved in FP (r11).Successively recall the PC register that available each calling process saves
With LR content of registers, by the amendment of compiling rule, the function call chain of available such as Fig. 5.
It the above call chain is stored in thermal starting does not lose to pass by down in memory or outside FRAM and pass, i.e., further can get
Function call situation when abnormal generation.
The above description is only a preferred embodiment of the present invention, is not intended to limit the scope of the invention, all utilizations
Equivalent structure or equivalent flow shift made by description of the invention and accompanying drawing content is applied directly or indirectly in other correlations
Technical field, be included within the scope of the present invention.
For those of ordinary skill in the art, without departing from the inventive concept of the premise, if can also make
Simple deduction or replace are done, all shall be regarded as belonging to protection scope of the present invention.
Claims (6)
1. a kind of method for capturing program exception using hardware watchdog, it is characterised in that: the method is to conventional external hardware
House dog improves, and the described method comprises the following steps: S1, the house dog cycle T time reach before t0 at the time of, Xiang Xing
Carrier aircraft exports an I/O interrupt signal, for triggering I/O interrupt, wherein it is long that t0 time span is greater than the interrupt routine execution time
Degree;S2, abnormal scene is obtained in I/O interrupt responder;S3, successively backtracking obtain the PC that each calling process saves
Register and LR content of registers obtain function call chain by the amendment of compiling rule.
2. according to the method described in claim 1, it is characterized by: being read in the step S2 from the position for interrupting stack top -4
LR-4 can obtain abnormal scene.
3. according to the method described in claim 1, it is characterized by: the step S2 further includes turning left sequence into according to from the right side
LR register, r12~r0 register are saved in disconnected stack.
4. according to the method described in claim 1, it is characterized by: the step S2 further includes depositing the value of abnormal scene
Enter thermal starting not losing in memory or outside FRAM, program after leaving biography in carrying out and can be obtained abnormal occur of passing by is run at what
Position.
5. according to the method described in claim 1, it is characterized by: from interrupt stack top SP-12 position read r11 (FP),
It can be obtained the initial position for the user stack that function uses into before interrupting;PC register in every layer of stack frame saves called function
Initial address, LR register save call function return address, FP register save function call stack initial address.
6. according to the method described in claim 1, it is characterized by: the step S3 further includes that the call chain is stored in heat
Starting is not lost in memory or outside FRAM, the function call situation left and passed when can be obtained abnormal occur in carrying out of passing by.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811588327.XA CN109739675A (en) | 2018-12-24 | 2018-12-24 | A method of program exception is captured using hardware watchdog |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811588327.XA CN109739675A (en) | 2018-12-24 | 2018-12-24 | A method of program exception is captured using hardware watchdog |
Publications (1)
Publication Number | Publication Date |
---|---|
CN109739675A true CN109739675A (en) | 2019-05-10 |
Family
ID=66359746
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811588327.XA Pending CN109739675A (en) | 2018-12-24 | 2018-12-24 | A method of program exception is captured using hardware watchdog |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109739675A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114490276A (en) * | 2022-04-13 | 2022-05-13 | 飞腾信息技术有限公司 | Peripheral equipment abnormity monitoring method, device and system and storage medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR20040085974A (en) * | 2003-04-02 | 2004-10-08 | 엘지전자 주식회사 | System management method using the software watchdog |
CN1632760A (en) * | 2003-12-24 | 2005-06-29 | 华为技术有限公司 | Method for preserving abnormal state information of control system |
JP2006252388A (en) * | 2005-03-14 | 2006-09-21 | Hitachi Kokusai Electric Inc | Software abnormality detection method |
CN109032822A (en) * | 2017-06-09 | 2018-12-18 | 中兴通讯股份有限公司 | A kind of store method and device of computer crash information |
-
2018
- 2018-12-24 CN CN201811588327.XA patent/CN109739675A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR20040085974A (en) * | 2003-04-02 | 2004-10-08 | 엘지전자 주식회사 | System management method using the software watchdog |
CN1632760A (en) * | 2003-12-24 | 2005-06-29 | 华为技术有限公司 | Method for preserving abnormal state information of control system |
JP2006252388A (en) * | 2005-03-14 | 2006-09-21 | Hitachi Kokusai Electric Inc | Software abnormality detection method |
CN109032822A (en) * | 2017-06-09 | 2018-12-18 | 中兴通讯股份有限公司 | A kind of store method and device of computer crash information |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114490276A (en) * | 2022-04-13 | 2022-05-13 | 飞腾信息技术有限公司 | Peripheral equipment abnormity monitoring method, device and system and storage medium |
CN114490276B (en) * | 2022-04-13 | 2022-07-19 | 飞腾信息技术有限公司 | Peripheral anomaly monitoring method, device and system and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10474471B2 (en) | Methods and systems for performing a replay execution | |
US10203996B2 (en) | Filtering system noises in parallel computer system during thread synchronization | |
US8978017B2 (en) | Profiling operating context | |
US6944796B2 (en) | Method and system to implement a system event log for system manageability | |
JP5478531B2 (en) | Method, apparatus and trace module for generating a time stamp | |
US5758168A (en) | Interrupt vectoring for optionally architected facilities in computer systems | |
US8943248B2 (en) | Method and system for handling discarded and merged events when monitoring a system bus | |
US20090193298A1 (en) | System and method of fault detection, diagnosis and prevention for complex computing systems | |
US20120226839A1 (en) | Method and System for Monitoring and Debugging Access to a Bus Slave Using One or More Throughput Counters | |
US20170147422A1 (en) | External software fault detection system for distributed multi-cpu architecture | |
CN101859268A (en) | Context switch sampling | |
CN101216792B (en) | Real-time operating system tasks management process and device of real-time operating system | |
US20110145829A1 (en) | Performance counter inheritance | |
CN100395722C (en) | Method for preserving abnormal state information of control system | |
CN109739675A (en) | A method of program exception is captured using hardware watchdog | |
CN1400529A (en) | Fault location method of real-time embedding system | |
US9195524B1 (en) | Hardware support for performance analysis | |
US9563494B2 (en) | Systems and methods for managing task watchdog status register entries | |
Gardner et al. | MAGNET: A tool for debugging, analyzing and adapting computing systems | |
CN111143127B (en) | Method, device, storage medium and equipment for supervising network equipment | |
US5649088A (en) | System and method for recording sufficient data from parallel execution stages in a central processing unit for complete fault recovery | |
Qin | System Support for Improving Software Dependability During Production Runs | |
Liu et al. | A message logging protocol based on user level failure mitigation | |
Maeng et al. | Rt-replayer: a record-replay architecture for embedded real-time software debugging | |
CN112540900B (en) | Real-time monitoring and analyzing method for large-scale parallel program |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20190510 |