CN103226507A - Method for preventing system crash in embedded system - Google Patents
Method for preventing system crash in embedded system Download PDFInfo
- Publication number
- CN103226507A CN103226507A CN2013101532792A CN201310153279A CN103226507A CN 103226507 A CN103226507 A CN 103226507A CN 2013101532792 A CN2013101532792 A CN 2013101532792A CN 201310153279 A CN201310153279 A CN 201310153279A CN 103226507 A CN103226507 A CN 103226507A
- Authority
- CN
- China
- Prior art keywords
- timer
- system program
- task
- variables
- program
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Landscapes
- Debugging And Monitoring (AREA)
Abstract
The invention relates to a method for preventing a system crash in an embedded system. A timer T1 is arranged to monitor a system program, a variable A is arranged to monitor the thread, and a timer T0 is arranged to monitor T1 and to assign A; when the timer T0 is in a timing interruption, the variable A is assigned, the working state of the timer T1 is monitored, and the system program is reset once the timer T1 is abnormal; and a step for judging the value of the variable A is set at the thread tail of the system program, and whether the variable A is subject to expectant change is detected, if not, the system program is reset. According to the invention, mutual monitoring of execution of the system program and a watchdog timer is realized to form a closed-loop mistake-proof mechanism, and the unidirectional monitoring is compared; and in case of interference, the mistake-proof mechanism is triggered when any part in the closed loop becomes abnormal, so that the system anti-interference ability and stability are enhanced.
Description
Technical field
The present invention relates to the real-time monitoring field of multiprocess system, be specifically related to prevent in a kind of embedded system the method for system crash.
Background technology
In embedded system (automobile audio navigation/communication facilities); the interference to the host power supply pulse of the interference of electromagnetic radiation or system's power pack usually can be subjected to coming from the outside; cause system program to carry out entanglement; might make MCU be absorbed in endless loop; thereby total system has entered dead state, has had a strong impact on the response of system to user's operation.So make up a reliable and stable supervisory system program, prevent that the method for system crash is extremely important.Usually embedded system all can be considered to come the monitoring facilities running status with the watchdog timer, with watchdog inquiry with start timer to be placed on priority ratio higher, in the less thread of task amount, each thread of other low priority then carries out the setting of signal after task is handled, handle when the task of certain thread and to be absorbed in endless loop, then the watchdog thread can't be carried out the action of restarting timer, and timer carries out automatically reseting of system then.
But, because common watchdog mechanism is not carried out the real-time monitoring of system program and MCU peripheral hardware simultaneously, when system under disturbed condition, certain thread program is carried out to run and is flown, perhaps rely in the automatically reset watchdog timer of system and lost efficacy, can't carry out timer and interrupt, system still can stay cool so, can't finish to restart.
Summary of the invention
For overcoming the problems referred to above, the present invention proposes to prevent in a kind of embedded system the method for system crash.
The technical solution used in the present invention is: prevent the method for system crash in the embedded system,
At first measure the maximum time T_task that the system program task is carried out;
Timer T1 is set to be monitored system program, certain timing is set for timer T1, the timing value is greater than time T _ task that system program is carried out, system program is provided with the step of restarting timer T1 at the place, end, if system program fails the T1 timer is restarted in a period of time, the timing of timer T1 is interrupted realizing system program is resetted;
System program is provided with variables A and timer T0 in addition, the timing value of T0 timer is less than the time T _ task of system program operation, when timer T0 regularly interrupts, give the variables A assignment, simultaneously, timer T1 duty is monitored, if timer T1 unusually then system program is resetted;
System program is provided with the step that the value of variables A is judged at place, thread end, checks that whether variables A the variation of expection has taken place, if the variation of expection does not take place, then resets to system program.
Preferably, timer T0 monitors timer T1 by the mode of supervision timer T1 status register.
The execution of system program of the present invention and watchdog timer are monitored mutually, form the mistake proofing mechanism of closed loop, contrast unidirectional monitoring, when disturbed condition takes place, arbitrary part in the closed loop occurs unusually promptly triggering mistake proofing mechanism, has strengthened the antijamming capability and the stability of system.
Description of drawings
Fig. 1 is the method for the invention workflow synoptic diagram.
Embodiment
For making things convenient for those skilled in the art to understand technology contents of the present invention, the present invention is described in further detail below in conjunction with drawings and Examples.
Mentality of designing of the present invention is: time T _ task ms of carrying out of measuring system program task at first, the T1 timer is set carries out the monitoring that system program is carried out, to T1 certain timing is set, timing value will leave surplus, (T_task) consuming time greater than the system program execution, system program can carry out restarting of T1 timer at afterbody like this, if system program fails the T1 timer is restarted in a period of time, just the timing of T1 is interrupted system program is resetted.If but the fault of T1 timer own, then normal supervisory system program. so, the T0 timer is set again, when the T0 timer interrupts, carries out the T1 timer and whether monitor normally, if the T1 timer is unusually then also need reset to system program.
In addition, be monitoring thread ruuning situation, a variables A is set again, when the T0 timer regularly interrupts, give the variables A assignment, the timing value of T0 timer is less than the time (T_task) of system thread operation, and system program can be judged variables A at the thread afterbody like this, check whether this variable the variation of expection has taken place, illustrate that then the operation of T0 timer is normal if the variation of expection has taken place; Otherwise the operation of expression system is undesired, then needs system program is resetted.
As Fig. 1, workflow of the present invention is: system initialization timer T0, T1, and give the A assignment, then timer T0, T1 start, simultaneously, system program normally moves, at system program the step of restarting timer T1 was set in the cycle, and in the thread program that system program comprised, be provided with judgment variable A step (simultaneously timer T0 then interrupts, in the interrupt routine to the variables A assignment, and supervision timer T1, undesired then system restarts).Running to determining step, if the value that the value of variables A equals to set, then system's normal circulation is carried out, otherwise restarts system.In case timer T1 interrupts in this process, then system restarts.Whether operate as normal detects (whether changing by the design of expecting by variables A) by system program to the TO timer; Whether system program is absorbed in endless loop and detects (if there is not to carry out the step restart timer T1, the interruption of T1 timer can carry out system restart) by the T1 timer; Whether the T1 timer normally moves by the T0 timer is detected (by inquiry T1 status register).Thus, in the system, mistake proofing mechanism appears unusually promptly triggering in arbitrary part.
The foregoing description only is a specific implementation of the present invention, and it describes comparatively concrete and detailed, can not therefore be interpreted as the restriction to claim of the present invention.Should be pointed out that for the person of ordinary skill of the art, without departing from the inventive concept of the premise, can also make some distortion and improvement, these conspicuous replacement forms all belong to protection scope of the present invention.
Claims (2)
1. prevent the method for system crash in the embedded system, it is characterized in that,
At first measure the maximum time T_task that the system program task is carried out;
Timer T1 is set to be monitored system program, certain timing is set for timer T1, the timing value is greater than time T _ task that system program is carried out, system program is provided with the step of restarting timer T1 at the place, end, if system program fails the T1 timer is restarted in a period of time, the timing of timer T1 is interrupted realizing system program is resetted;
System program is provided with variables A and timer T0 in addition, the timing value of T0 timer is less than the time T _ task of system program operation, when timer T0 regularly interrupts, give the variables A assignment, simultaneously, timer T1 duty is monitored, if timer T1 unusually then system program is resetted;
System program is provided with the step that the value of variables A is judged at place, thread end, checks that whether variables A the variation of expection has taken place, if the variation of expection does not take place, then resets to system program.
2. prevent the method for system crash in the embedded system according to claim 1, it is characterized in that: timer T0 monitors timer T1 by the mode of supervision timer T1 status register.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2013101532792A CN103226507A (en) | 2013-04-28 | 2013-04-28 | Method for preventing system crash in embedded system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2013101532792A CN103226507A (en) | 2013-04-28 | 2013-04-28 | Method for preventing system crash in embedded system |
Publications (1)
Publication Number | Publication Date |
---|---|
CN103226507A true CN103226507A (en) | 2013-07-31 |
Family
ID=48836966
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN2013101532792A Pending CN103226507A (en) | 2013-04-28 | 2013-04-28 | Method for preventing system crash in embedded system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103226507A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105718375A (en) * | 2016-01-27 | 2016-06-29 | 惠州市德赛西威汽车电子股份有限公司 | Restorability testing method of embedded system |
CN109766273A (en) * | 2018-12-27 | 2019-05-17 | 百富计算机技术(深圳)有限公司 | Localization method, device, computer equipment and the storage medium of endless loop |
CN110297724A (en) * | 2019-06-27 | 2019-10-01 | 厦门四信通信科技有限公司 | Embedded software house dog design method, device, equipment and storage medium |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101950268A (en) * | 2010-05-04 | 2011-01-19 | 工业和信息化部电子第五研究所 | Real-time monitoring scheme for clock frequency of controller |
CN101957790A (en) * | 2009-11-26 | 2011-01-26 | 上海大学 | Implementation method of multi-source watchdog of microcontroller |
-
2013
- 2013-04-28 CN CN2013101532792A patent/CN103226507A/en active Pending
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101957790A (en) * | 2009-11-26 | 2011-01-26 | 上海大学 | Implementation method of multi-source watchdog of microcontroller |
CN101950268A (en) * | 2010-05-04 | 2011-01-19 | 工业和信息化部电子第五研究所 | Real-time monitoring scheme for clock frequency of controller |
Non-Patent Citations (1)
Title |
---|
王璐,王楠: "软硬件结合实现的"看门狗"技术", 《现代电子技术》 * |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105718375A (en) * | 2016-01-27 | 2016-06-29 | 惠州市德赛西威汽车电子股份有限公司 | Restorability testing method of embedded system |
CN105718375B (en) * | 2016-01-27 | 2018-09-25 | 惠州市德赛西威汽车电子股份有限公司 | The restorability measure of embedded system |
CN109766273A (en) * | 2018-12-27 | 2019-05-17 | 百富计算机技术(深圳)有限公司 | Localization method, device, computer equipment and the storage medium of endless loop |
CN110297724A (en) * | 2019-06-27 | 2019-10-01 | 厦门四信通信科技有限公司 | Embedded software house dog design method, device, equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN100541438C (en) | A kind ofly control the method and apparatus that watchdog circuit resets | |
JP6590664B2 (en) | On-chip sensor hub, mobile device, and multi-sensor management method for mobile device | |
US9612893B2 (en) | Peripheral watchdog timer | |
CN104683573B (en) | The implementation method of shutdown alarm clock and mobile terminal | |
CN109976501A (en) | A kind of Low-power-consumptiocontrol control method, device, system and storage medium | |
CN106407032A (en) | Multi-core system-based hardware watchdog control method and system | |
EP2490125A1 (en) | Microcomputer and operation method thereof | |
CN105373207A (en) | Standby method of wireless communication terminal | |
CN104407958A (en) | High-reliability system monitoring method and system | |
CN103226507A (en) | Method for preventing system crash in embedded system | |
CN104049702A (en) | Single chip microcomputer-based CPU (Central Processing Unit) reset control system, method and device | |
CN104503859A (en) | Method for monitoring computer operating system in starting process | |
US20140229956A1 (en) | Method and System for Deterministic Multicore Execution | |
CN103473087A (en) | Startup control method for software-operated startup and shutdown in multitask systems | |
CN102999412A (en) | Method for monitoring process under Linux | |
CN109960599B (en) | Chip system, watchdog self-checking method thereof and electrical equipment | |
CN107861840B (en) | Method for enhancing on-orbit reliability of small satellite | |
CN104679601A (en) | Watchdog starting method of interference preventing system | |
CN102169451B (en) | The method and apparatus that a kind of monitoring CPU is run | |
CN103376877B (en) | A kind of multi-core processor clock control device and control method | |
US20100332874A1 (en) | Microcomputer and microcomputer system | |
CN106445668A (en) | Timing method and device of timer | |
CN112631872A (en) | Exception handling method and device of multi-core system | |
CN102915258A (en) | Control method of watchdog circuit | |
US20150227400A1 (en) | Converting apparatus, conversion method, and information processing system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
CB02 | Change of applicant information |
Address after: 516006 Guangdong city of Huizhou province and Zhongkai hi tech Industrial Development Zone Five West Road No. 103 Applicant after: HUIZHOU DESAY SV AUTOMOTIVE CO., LTD. Address before: 516006 Guangdong city of Huizhou province and Zhongkai hi tech Industrial Development Zone Five West Road No. 103 Applicant before: Huizhou Desay SV Auto. Electronics Co., Ltd. |
|
COR | Change of bibliographic data | ||
C12 | Rejection of a patent application after its publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20130731 |