JP3145937B2 - Runaway detection method for microcomputer - Google Patents

Runaway detection method for microcomputer

Info

Publication number
JP3145937B2
JP3145937B2 JP31577596A JP31577596A JP3145937B2 JP 3145937 B2 JP3145937 B2 JP 3145937B2 JP 31577596 A JP31577596 A JP 31577596A JP 31577596 A JP31577596 A JP 31577596A JP 3145937 B2 JP3145937 B2 JP 3145937B2
Authority
JP
Japan
Prior art keywords
detection signal
counting
contents
saving
timer
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.)
Expired - Fee Related
Application number
JP31577596A
Other languages
Japanese (ja)
Other versions
JPH10161908A (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.)
Sharp Corp
Original Assignee
Sharp Corp
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 Sharp Corp filed Critical Sharp Corp
Priority to JP31577596A priority Critical patent/JP3145937B2/en
Publication of JPH10161908A publication Critical patent/JPH10161908A/en
Application granted granted Critical
Publication of JP3145937B2 publication Critical patent/JP3145937B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Landscapes

  • Debugging And Monitoring (AREA)

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【発明の属する技術分野】本発明は、プログラムにより
制御されるマイクロコンピュータに於いて、プログラム
が暴走したときに、それを検出し、正常な動作に復帰さ
せるための暴走検出方法に係るものであり、特に、プロ
グラムの任意の箇所で無限ループに入ったときに、それ
を検出して、正常な動作に復帰させるための暴走検出方
法に関するものである。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a runaway detection method for detecting a runaway of a program and returning the program to a normal operation in a microcomputer controlled by the program. More particularly, the present invention relates to a runaway detection method for detecting when an infinite loop is entered at an arbitrary point in a program and returning to a normal operation.

【0002】[0002]

【従来の技術】現在、マイクロコンピュータの暴走検出
方法としては、ウォッチドッグと呼ばれる方式が一般化
している。この方式は、常に時間カウントを行うタイマ
(インターバルタイマ)をプログラムの中で頻繁にリセ
ット(クリア)することにより、通常のプログラム動作
ではタイマオーバーフローが発生せず、一方、暴走状態
になると、タイマリセットのルーチンが働かないので、
タイマオーバーフローが発生して、暴走が検出され、プ
ログラムを正常な処理に戻すという方式である。図4
に、一般的なウォッチドッグタイマの構成例を示す。
2. Description of the Related Art At present, as a method of detecting runaway of a microcomputer, a system called a watchdog has been generalized. In this method, a timer that always counts time (interval timer) is frequently reset (cleared) in a program, so that a timer overflow does not occur in normal program operation. Because the routine does not work,
In this method, when a timer overflow occurs, runaway is detected, and the program is returned to normal processing. FIG.
FIG. 1 shows a configuration example of a general watchdog timer.

【0003】[0003]

【発明が解決しようとする課題】通常マイクロコンピュ
ータが暴走しているときは、プログラムの同じ箇所を繰
り返し実行している場合が多い。その繰り返し実行の中
に、タイマリセットのルーチンが含まれていなければ、
上述の方式(ウォッチドッグタイマ方式)は有効であ
る。しかしながら、上述の方式では、マイクロコンピュ
ータが暴走しているとき、タイマリセットのルーチンを
含む処理を実行する状態であれば、タイマオーバーフロ
ーが発生せず、すなわち、ウォッチドッグタイマが働か
ずに、プログラムを正常な処理に戻せないという問題点
がある。
Usually, when a microcomputer runs away, the same part of a program is often executed repeatedly. If the repetitive execution does not include the timer reset routine,
The above method (watchdog timer method) is effective. However, in the above-described method, when the microcomputer is running out of control, if a process including a timer reset routine is executed, a timer overflow does not occur, that is, the program is executed without the watchdog timer operating. There is a problem that normal processing cannot be returned.

【0004】更に、タイマリセットのルーチンを含む処
理を実行する状態で暴走した場合を考慮して、タイマリ
セットの命令実行をカウントするカウンタを別に設け、
このカウンタが所定カウント数に達したときに、プログ
ラムを正常な処理に戻すという方式も考えられている
(特開平5−73361)。この方式によると、ウォッ
チドッグタイマ方式の欠点は概ね解消できるが、タイマ
リセットのルーチンや、カウンタのリセット処理を、ど
こに置くかを、プログラム設計において工夫する必要が
あり、プログラマに負担が強いられるという新たな問題
点が生じる。また、この方式においても、プログラムの
暴走により、カウンタのリセットルーチンと、インター
バルタイマのリセットルーチンを含む無限ループに入っ
た場合には、暴走を検出できないという問題点がある。
Further, in consideration of a runaway in a state where a process including a timer reset routine is executed, a counter for counting execution of a timer reset instruction is separately provided.
A method has also been proposed in which the program is returned to normal processing when the counter reaches a predetermined count (Japanese Patent Laid-Open No. 5-73361). According to this method, the disadvantages of the watchdog timer method can be largely eliminated, but it is necessary to devise a program design to determine where to place the timer reset routine and the counter reset processing, which places a burden on the programmer. A new problem arises. Also in this method, there is a problem that runaway cannot be detected when the program goes into an infinite loop including a counter reset routine and an interval timer reset routine due to runaway of the program.

【0005】本発明は、上記従来の問題点を解決すべく
為されたものである。
The present invention has been made to solve the above-mentioned conventional problems.

【0006】[0006]

【課題を解決するための手段】本発明のマイクロコンピ
ュータの暴走検出方法は、プログラムにより制御される
マイクロコンピュータに於いて、上記プログラムの同一
アドレスを、同一時間間隔で所定回数繰り返し実行した
ことを検出して、暴走検出を行う構成としたことを特徴
とするものである。
A runaway detection method for a microcomputer according to the present invention detects that a microcomputer controlled by a program has repeatedly executed the same address of the program a predetermined number of times at the same time interval. Then, runaway detection is performed.

【0007】また、本発明のマイクロコンピュータの暴
走検出方法は、プログラムカウンタ内容の待避手段、上
記プログラムカウンタの内容と上記プログラムカウンタ
内容待避手段の内容の一致・不一致を検出して一致検出
信号を出力する第1の比較手段、該第1の比較手段より
出力される任意の一致検出信号から次の一致検出信号ま
での経過時間を計測するタイマ手段、該タイマ手段の計
時内容の待避手段、上記第1の比較手段よりの一致検出
信号に基づいて、上記タイマ手段の計時内容と上記タイ
マ計時内容待避手段の内容との一致・不一致を検出し、
一致検出信号または不一致検出信号を出力する第2の比
較手段、該第2の比較手段よりの一致検出信号を計数す
る計数手段、上記第2の比較手段よりの一致検出信号に
応じて上記タイマ手段をリセットする手段、上記第2の
比較手段よりの不一致検出信号に応じて、上記タイマ手
段の計時内容の上記タイマ計時内容待避手段への待避及
び上記タイマ手段のリセットを実行すると共に、上記計
数手段のプリセットを実行する初期化手段を備え、上記
計数手段よりのオーバーフロー信号を暴走検出信号とす
ることを特徴とするものである。
Further, the runaway detection method for a microcomputer according to the present invention includes a program counter contents saving means, and detects a match / mismatch between the contents of the program counter and the contents of the program counter contents saving means and outputs a match detection signal. First comparing means, timer means for measuring an elapsed time from an arbitrary coincidence detection signal output from the first comparing means to the next coincidence detection signal, means for saving the contents of time counted by the timer means, Detecting, based on the coincidence detection signal from the first comparing means, a match / mismatch between the clock content of the timer means and the content of the timer clock saving means;
Second comparing means for outputting a coincidence detection signal or a non-coincidence detection signal, counting means for counting the coincidence detection signal from the second comparison means, and timer means in response to the coincidence detection signal from the second comparison means Means for resetting the count value, executing the saving of the time count of the timer means to the timer count content saving means and resetting the timer means in response to the mismatch detection signal from the second comparing means, And an initialization means for executing the preset, wherein the overflow signal from the counting means is used as a runaway detection signal.

【0008】更に、本発明のマイクロコンピュータの暴
走検出方法は、プログラムカウンタ内容の待避手段、上
記プログラムカウンタの内容と上記プログラムカウンタ
内容待避手段の内容の一致・不一致を検出して一致検出
信号を出力する第1の比較手段、該第1の比較手段より
出力される任意の一致検出信号から次の一致検出信号ま
での命令実行ステップ数を計数する第1の計数手段、該
第1の計数手段の計数内容の待避手段、上記第1の比較
手段よりの一致検出信号に基づいて、上記第1の計数手
段の計数内容と上記計数内容待避手段の内容との一致・
不一致を検出し、一致検出信号または不一致検出信号を
出力する第2の比較手段、該第2の比較手段よりの一致
検出信号を計数する第2の計数手段、上記第2の比較手
段よりの一致検出信号に応じて上記第1の計数手段をリ
セットする手段、上記第2の比較手段よりの不一致検出
信号に応じて、上記第1の計数手段の計数内容の上記計
数内容待避手段への待避及び上記第1の計数手段のリセ
ットを実行すると共に、上記第2の計数手段のプリセッ
トを実行する初期化手段を備え、上記第2の計数手段よ
りのオーバーフロー信号を暴走検出信号とすることを特
徴とするものである。
Further, the runaway detection method for a microcomputer according to the present invention is characterized in that the program counter saving means detects a match / mismatch between the contents of the program counter and the contents of the program counter contents saving means and outputs a match detection signal. First comparing means, a first counting means for counting the number of command execution steps from an arbitrary coincidence detection signal output from the first comparing means to the next coincidence detection signal, Based on the coincidence detection signal from the first comparing means, the coincidence between the counted content of the first counting means and the content of the counted content saving means is performed.
Second comparing means for detecting a mismatch and outputting a match detection signal or a mismatch detection signal, a second counting means for counting the match detection signal from the second comparison means, and a match from the second comparison means Means for resetting the first counting means in response to the detection signal, saving of the contents of the first counting means to the counting contents saving means in response to the mismatch detection signal from the second comparing means, Initialization means for resetting the first counting means and presetting the second counting means, wherein an overflow signal from the second counting means is used as a runaway detection signal. Is what you do.

【0009】かかる本発明のマイクロコンピュータの暴
走検出方法によれば、プログラムの暴走により無限ルー
プに入ると、同一アドレスが同一時間間隔で所定回数繰
り返し実行された時点で、暴走が検出され、これに基づ
き、リセット信号或は割り込み信号を発生させて、プロ
グラムを正常な処理に戻すことができるものである。
According to the microcomputer runaway detection method of the present invention, when an infinite loop is entered due to runaway of a program, runaway is detected when the same address is repeatedly executed a predetermined number of times at the same time interval. Based on this, a reset signal or an interrupt signal can be generated to return the program to normal processing.

【0010】[0010]

【発明の実施の形態】以下、本発明の実施形態につい
て、図面に基づき詳細に説明する。
Embodiments of the present invention will be described below in detail with reference to the drawings.

【0011】図1は、本発明の第一の実施形態のブロッ
ク構成図である。
FIG. 1 is a block diagram of a first embodiment of the present invention.

【0012】図において、1は、プログラムの実行アド
レスを指すプログラムカウンタ(PC1)、2は、同プ
ログラムカウンタ1の内容の待避領域(PC2)、3
は、プログラムカウンタ1の内容とプログラムカウンタ
内容待避領域2の内容の一致・不一致を検出して、一致
検出信号を出力する第1比較器、4は、第1比較器3よ
りの任意の一致検出信号出力から次の一致検出信号出力
までの経過時間を計測する第1カウンタ(タイマ)であ
る。該第1カウンタ4よりのオーバーフロー信号に基づ
いて、上記プログラムカウンタ1から、プログラムカウ
ンタ内容待避領域2へのアドレス転送動作が実行され
る。5は、第1カウンタ4の時間基準となるクロックを
発生する発振器(OSC)、6は、発振器5より出力さ
れるクロックを分周して第1カウンタ4のカウント信号
を作成・出力する分周器(Divider)である。7
は、上記第1カウンタ4の内容の待避用レジスタ、8
は、上記第1比較器3より一致検出信号が出力された時
点に於ける、第1カウンタ4の内容と、第1カウンタ内
容待避用レジスタ7の内容の一致・不一致を検出を検出
し、一致検出信号又は不一致検出信号を出力する第2比
較器、9は該第2比較器8よりの一致検出信号を計数す
る第2カウンタである。第2比較器8よりの一致検出信
号に基づいて上記第2カウンタ9のカウントアップと共
に上記第1カウンタ4のリセットが実行される。一方、
第2比較器8よりの不一致検出信号に基づいて、上記第
2カウンタ9のプリセット(初期値設定)が実行される
と共に、上記第1カウンタ4から第1カウンタ内容待避
用レジスタ7への転送動作と、第1カウンタ4のリセッ
トが実行される。また、上記第1カウンタ4よりのオー
バーフロー信号に基づいて、上述の、プログラムカウン
タ1からプログラムカウンタ内容待避領域2への転送動
作と共に、上記第2カウンタ9のプリセットが実行され
る。上記第2カウンタ9からのオーバーフロー信号が暴
走検出信号となる。
In the figure, 1 is a program counter (PC1) indicating the execution address of a program, 2 is a save area (PC2) of the contents of the program counter 1, (3)
Is a first comparator that detects a match / mismatch between the contents of the program counter 1 and the contents of the program counter contents save area 2 and outputs a match detection signal. It is a first counter (timer) that measures the elapsed time from the signal output to the next match detection signal output. Based on the overflow signal from the first counter 4, an address transfer operation from the program counter 1 to the program counter contents saving area 2 is executed. Reference numeral 5 denotes an oscillator (OSC) that generates a clock serving as a time reference of the first counter 4, and reference numeral 6 denotes a frequency divider that generates and outputs a count signal of the first counter 4 by dividing the clock output from the oscillator 5. (Divider). 7
Is a register for saving the contents of the first counter 4;
Is a detection of a match / mismatch between the contents of the first counter 4 and the contents of the first counter contents saving register 7 at the time when the match detection signal is output from the first comparator 3. A second comparator 9 that outputs a detection signal or a mismatch detection signal is a second counter that counts the match detection signal from the second comparator 8. Based on the coincidence detection signal from the second comparator 8, the second counter 9 counts up and the first counter 4 is reset. on the other hand,
Based on the mismatch detection signal from the second comparator 8, presetting (initial value setting) of the second counter 9 is executed, and transfer operation from the first counter 4 to the first counter contents saving register 7 is performed. Then, the first counter 4 is reset. In addition, based on the overflow signal from the first counter 4, the presetting of the second counter 9 is executed together with the above-described transfer operation from the program counter 1 to the program counter contents saving area 2. The overflow signal from the second counter 9 becomes a runaway detection signal.

【0013】以上の構成により、プログラムの同一アド
レスを、同一時間間隔で所定回数実行すると、第2カウ
ンタ9のオーバーフローが生じて、プログラムの暴走を
検出することができるものである。
With the above configuration, when the same address of a program is executed a predetermined number of times at the same time interval, an overflow of the second counter 9 occurs and a runaway of the program can be detected.

【0014】上記第2カウンタ9のオーバーフロー信号
に基づいて、所定の割り込み信号を発生させて、プログ
ラムを正常処理に戻す。或は、上記第2カウンタのオー
バーフロー信号に基づいてリセット信号を発生させて、
マイクロコンピュータを初期化する。
Based on the overflow signal of the second counter 9, a predetermined interrupt signal is generated, and the program returns to normal processing. Alternatively, a reset signal is generated based on the overflow signal of the second counter,
Initialize the microcomputer.

【0015】図2は、上に説明した処理の流れを示す流
れ図である。ただし、本図では、処理の流れを分かり易
くするために、処理を直列的に図示しているが、実際に
は、図1に示すようにハードウェア的に並列的に処理さ
れるため、例えば、プログラムカウンタ1(PC1)と
プログラムカウンタ内容待避領域2(PC2)の比較処
理と、第1カウンタ4(カウンタ1)のオーバーフロー
処理が同時並行的に発生することも許されるものとす
る。
FIG. 2 is a flowchart showing the flow of the processing described above. However, in this drawing, the processing is illustrated serially in order to make the flow of the processing easy to understand, but in actuality, as illustrated in FIG. The comparison process between the program counter 1 (PC1) and the program counter content saving area 2 (PC2) and the overflow process of the first counter 4 (counter 1) are allowed to occur simultaneously and in parallel.

【0016】上記第一の実施形態に於いては、第1比較
器3よりの任意の一致検出信号出力から次の一致検出信
号出力までの経過時間を計測するためのタイマ手段を設
ける構成としていたが、これに代えて、第1比較器より
の任意の一致検出信号出力から次の一致検出信号出力ま
での命令実行ステップ数を計数する計数手段を設ける構
成としてもよい。
In the first embodiment, timer means for measuring the elapsed time from the output of an arbitrary coincidence detection signal from the first comparator 3 to the output of the next coincidence detection signal is provided. However, instead of this, a configuration may be provided in which a counting means for counting the number of instruction execution steps from the output of an arbitrary match detection signal from the first comparator to the output of the next match detection signal is provided.

【0017】図3は、そのように構成した、本発明の第
二の実施形態のブロック構成図である。
FIG. 3 is a block diagram of a second embodiment of the present invention configured as described above.

【0018】図において、1は、プログラムの実行アド
レスを指すプログラムカウンタ(PC1)、2は、同プ
ログラムカウンタ1の内容の待避領域(PC2)、3
は、プログラムカウンタ1の内容とプログラムカウンタ
内容待避領域2の内容の一致・不一致を検出して、一致
検出信号を出力する第1比較器、4は、第1比較器3よ
りの任意の一致検出信号出力から次の一致検出信号出力
までの命令実行ステップ数を計数する第1カウンタであ
る。該第1カウンタ4よりのオーバーフロー信号に基づ
いて、上記プログラムカウンタ1からプログラムカウン
タ内容待避領域2へのアドレス転送動作が実行される。
5は、マイクロコンピュータの時間基準となるクロック
を発生する発振器(OSC)、6は、発振器5より出力
されるクロックを分周してシステムクロックを作成・出
力する分周器である。該分周器6よりのシステムクロッ
クに基づいて、上記プログラムカウンタ1のカウントア
ップが行われると共に、上記第1カウンタ4のカウント
アップが実行される。7は、上記第1カウンタ4の内容
の待避用レジスタ、8は、上記第1比較器3より一致検
出信号が出力された時点に於ける、第1カウンタ4の内
容と、第1カウンタ内容待避用レジスタ7の内容の一致
・不一致を検出を検出し、一致検出信号又は不一致検出
信号を出力する第2比較器、9は、該第2比較器8より
の一致検出信号を計数する第2カウンタである。第2比
較器8よりの一致検出信号に基づいて上記第2カウンタ
9のカウントアップと共に上記第1カウンタ4のリセッ
トが実行される。一方、第2比較器8よりの不一致検出
信号に基づいて、上記第2カウンタ9のプリセット(初
期値設定)が実行されると共に、上記第1カウンタ4か
ら第1カウンタ内容待避用レジスタ7への転送動作と第
1カウンタ4のリセットが実行される。また、上記第1
カウンタ4よりのオーバーフロー信号に基づいて、上述
の、プログラムカウンタ1からプログラムカウンタ内容
待避領域2への転送動作と共に、上記第2カウンタ9の
プリセットが実行される。上記第2カウンタ9からのオ
ーバーフロー信号が暴走検出信号となる。
In the figure, 1 is a program counter (PC1) indicating the execution address of a program, 2 is a save area (PC2) for the contents of the program counter 1, 3
Is a first comparator that detects a match / mismatch between the contents of the program counter 1 and the contents of the program counter contents save area 2 and outputs a match detection signal. This is a first counter that counts the number of instruction execution steps from the signal output to the next match detection signal output. Based on the overflow signal from the first counter 4, an address transfer operation from the program counter 1 to the program counter contents saving area 2 is performed.
Reference numeral 5 denotes an oscillator (OSC) that generates a clock serving as a time reference of the microcomputer. Reference numeral 6 denotes a frequency divider that divides a clock output from the oscillator 5 to generate and output a system clock. Based on the system clock from the frequency divider 6, the program counter 1 counts up and the first counter 4 counts up. 7 is a register for saving the contents of the first counter 4, and 8 is a register for saving the contents of the first counter 4 and the contents of the first counter when the match detection signal is output from the first comparator 3. A second comparator 9 for detecting a match / mismatch of the contents of the register 7 and outputting a match detection signal or a mismatch detection signal; a second counter 9 for counting the match detection signal from the second comparator 8 It is. Based on the coincidence detection signal from the second comparator 8, the second counter 9 counts up and the first counter 4 is reset. On the other hand, based on the non-coincidence detection signal from the second comparator 8, the presetting (initial value setting) of the second counter 9 is executed, and at the same time, the first counter 4 transfers the first counter content saving register 7 The transfer operation and the reset of the first counter 4 are executed. In addition, the first
Based on the overflow signal from the counter 4, the above-described transfer operation from the program counter 1 to the program counter content saving area 2 is performed, and the second counter 9 is preset. The overflow signal from the second counter 9 becomes a runaway detection signal.

【0019】以上の構成により、プログラムの同一アド
レスを、同一時間間隔で所定回数実行すると、第2カウ
ンタ9のオーバーフローが生じて、プログラムの暴走を
検出することができるものである。
With the above configuration, when the same address of a program is executed a predetermined number of times at the same time interval, an overflow of the second counter 9 occurs and a runaway of the program can be detected.

【0020】本実施形態によれば、マイクロコンピュー
タのシステムクロックに基づいて、第1カウンタ4のカ
ウント動作が制御されるため、上記第一の実施形態と比
較して、より正確な時間間隔の測定が可能となるもので
ある。
According to this embodiment, the counting operation of the first counter 4 is controlled based on the system clock of the microcomputer, so that more accurate measurement of the time interval can be performed as compared with the first embodiment. Is possible.

【0021】[0021]

【発明の効果】以上詳細に説明したように、本発明によ
れば、比較的小規模な回路により、マイクロコンピュー
タのプログラムが同じ箇所を繰り返し実行している暴走
状態となった場合に、その実行箇所にかかわらず、暴走
状態を認識し、プログラムを正常な処理に戻すことがで
きる極めて有用な暴走検出方式を提供することが可能と
なるものである。また、従来技術であるウォッチドッグ
と併用することにより、暴走検出の確実性を増すことも
可能であり、より安全性の高いマイコンシステムを実現
することができる。
As described above in detail, according to the present invention, when a runaway state occurs in which a microcomputer program repeatedly executes the same part by a relatively small-scale circuit, the execution is performed. Regardless of the location, it is possible to provide a very useful runaway detection method that can recognize a runaway state and return a program to normal processing. Also, by using the watchdog in combination with the conventional technique, the reliability of runaway detection can be increased, and a more secure microcomputer system can be realized.

【0022】なお、特開平3−292545号公報に於
いて、プログラム実行中に上位アドレスが規定時間以上
変わらない場合に無限ループと判断する方式が開示され
ている。しかし、この方式では、例えば、次のような条
件で無限ループが発生したときに、その検出ができない
(例として、プログラムカウンタが12ビットで、上位
4ビットを暴走検出用として、比較するとする)。
Japanese Patent Application Laid-Open No. 3-292545 discloses a method of determining an infinite loop when the upper address does not change for a predetermined time during execution of a program. However, in this method, for example, when an infinite loop occurs under the following conditions, it cannot be detected (for example, the program counter is 12 bits, and the upper 4 bits are compared for runaway detection). .

【0023】(例1)アドレスが、5F0Hと610H
の間で暴走した場合、すなわち、上位アドレスが変わる
境目を挟んで無限ループとなった場合。
(Example 1) Addresses 5F0H and 610H
Runaway, that is, when an infinite loop is formed across the boundary where the upper address changes.

【0024】(例2)アドレスが7xxHで暴走した
が、その中で、アドレスが3xxHにあるサブルーチン
を呼んでいる場合。
(Example 2) When a runaway occurs at an address of 7xxH, and a subroutine having an address of 3xxH is called.

【0025】このような事例は、よく起こることであ
り、したがって、該公開公報の検出方式は不十分である
といえる。
Such a case occurs frequently, and therefore, the detection method disclosed in the publication is insufficient.

【0026】これに対して、本発明に於いては、プログ
ラムのあるアドレスが等時間間隔で繰り返し実行された
ときに無限ループと判断するため、上記の例1、例2の
場合でも暴走を検出でき、またプログラムに負担をかけ
ない方式となっているものである。
On the other hand, in the present invention, when an address of a program is repeatedly executed at equal time intervals, it is determined that the loop is an infinite loop. It is a system that does not burden the program.

【図面の簡単な説明】[Brief description of the drawings]

【図1】本発明の第一の実施形態のブロック構成図であ
る。
FIG. 1 is a block diagram of a first embodiment of the present invention.

【図2】同実施形態における処理の流れを示す流れ図で
ある。
FIG. 2 is a flowchart showing a processing flow in the embodiment.

【図3】本発明の第二の実施形態のブロック構成図であ
る。
FIG. 3 is a block diagram of a second embodiment of the present invention.

【図4】一般的なウォッチドッグタイマの構成例を示す
図である。
FIG. 4 is a diagram illustrating a configuration example of a general watchdog timer.

【符号の説明】[Explanation of symbols]

1 プログラムカウンタ 2 プログラムカウンタ内容待避領域 3 第1比較器 4 第1カウンタ 5 発振器 6 分周器 7 第1カウンタ内容待避用レジスタ 8 第2比較器 9 第2カウンタ 1 Program counter 2 Program counter contents saving area 3 First comparator 4 First counter 5 Oscillator 6 Divider 7 First counter contents saving register 8 Second comparator 9 Second counter

Claims (3)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】 プログラムにより制御されるマイクロコ
ンピュータに於いて、 上記プログラムの同一アドレスを、同一時間間隔で所定
回数繰り返し実行したことを検出して、暴走検出を行う
構成としたことを特徴とする、マイクロコンピュータの
暴走検出方法。
1. A microcomputer controlled by a program, wherein runaway detection is performed by detecting that the same address of the program is repeatedly executed a predetermined number of times at the same time interval. , Microcomputer runaway detection method.
【請求項2】 プログラムカウンタ内容の待避手段、上
記プログラムカウンタの内容と上記プログラムカウンタ
内容待避手段の内容の一致・不一致を検出して一致検出
信号を出力する第1の比較手段、該第1の比較手段より
出力される任意の一致検出信号から次の一致検出信号ま
での経過時間を計測するタイマ手段、該タイマ手段の計
時内容の待避手段、上記第1の比較手段よりの一致検出
信号に基づいて、上記タイマ手段の計時内容と上記タイ
マ計時内容待避手段の内容との一致・不一致を検出し、
一致検出信号または不一致検出信号を出力する第2の比
較手段、該第2の比較手段よりの一致検出信号を計数す
る計数手段、上記第2の比較手段よりの一致検出信号に
応じて上記タイマ手段をリセットする手段、上記第2の
比較手段よりの不一致検出信号に応じて、上記タイマ手
段の計時内容の上記タイマ計時内容待避手段への待避及
び上記タイマ手段のリセットを実行すると共に、上記計
数手段のプリセットを実行する初期化手段を備え、上記
計数手段よりのオーバーフロー信号を暴走検出信号とす
ることを特徴とする、請求項1に記載のマイクロコンピ
ュータの暴走検出方法。
Means for saving program counter contents, first comparing means for detecting a match / mismatch between the contents of the program counter and the contents of the program counter contents saving means, and outputting a match detection signal; Timer means for measuring an elapsed time from an arbitrary coincidence detection signal output from the comparison means to the next coincidence detection signal, means for evacuating the time content of the timer means, based on the coincidence detection signal from the first comparison means Detecting the coincidence / mismatch between the clock content of the timer means and the content of the timer clock content saving means,
Second comparing means for outputting a coincidence detection signal or a non-coincidence detection signal, counting means for counting the coincidence detection signal from the second comparison means, and timer means in response to the coincidence detection signal from the second comparison means Means for resetting the count value, executing the saving of the time count of the timer means to the timer count content saving means and resetting the timer means in response to the mismatch detection signal from the second comparing means, The runaway detection method for a microcomputer according to claim 1, further comprising initialization means for executing the preset of (1), wherein the overflow signal from the counting means is used as a runaway detection signal.
【請求項3】 プログラムカウンタ内容の待避手段、上
記プログラムカウンタの内容と上記プログラムカウンタ
内容待避手段の内容の一致・不一致を検出して一致検出
信号を出力する第1の比較手段、該第1の比較手段より
出力される任意の一致検出信号から次の一致検出信号ま
での命令実行ステップ数を計数する第1の計数手段、該
第1の計数手段の計数内容の待避手段、上記第1の比較
手段よりの一致検出信号に基づいて、上記第1の計数手
段の計数内容と上記計数内容待避手段の内容との一致・
不一致を検出し、一致検出信号または不一致検出信号を
出力する第2の比較手段、該第2の比較手段よりの一致
検出信号を計数する第2の計数手段、上記第2の比較手
段よりの一致検出信号に応じて上記第1の計数手段をリ
セットする手段、上記第2の比較手段よりの不一致検出
信号に応じて、上記第1の計数手段の計数内容の上記計
数内容待避手段への待避及び上記第1の計数手段のリセ
ットを実行すると共に、上記第2の計数手段のプリセッ
トを実行する初期化手段を備え、上記第2の計数手段よ
りのオーバーフロー信号を暴走検出信号とすることを特
徴とする、請求項1に記載のマイクロコンピュータの暴
走検出方法。
3. A program counter contents saving means, a first comparing means for detecting a match / mismatch between the contents of the program counter and the contents of the program counter contents saving means and outputting a match detection signal, First counting means for counting the number of instruction execution steps from an arbitrary match detection signal output from the comparison means to the next match detection signal, saving means for counting the contents of the first counting means, and the first comparison means Based on the coincidence detection signal from the means, the coincidence between the content of the first counting means and the content of the content saving means is determined.
Second comparing means for detecting a mismatch and outputting a match detection signal or a mismatch detection signal, a second counting means for counting the match detection signal from the second comparison means, and a match from the second comparison means Means for resetting the first counting means in response to the detection signal, saving of the contents of the first counting means to the counting contents saving means in response to the mismatch detection signal from the second comparing means, Initialization means for resetting the first counting means and presetting the second counting means, wherein an overflow signal from the second counting means is used as a runaway detection signal. The method for detecting runaway of a microcomputer according to claim 1.
JP31577596A 1996-11-27 1996-11-27 Runaway detection method for microcomputer Expired - Fee Related JP3145937B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP31577596A JP3145937B2 (en) 1996-11-27 1996-11-27 Runaway detection method for microcomputer

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP31577596A JP3145937B2 (en) 1996-11-27 1996-11-27 Runaway detection method for microcomputer

Publications (2)

Publication Number Publication Date
JPH10161908A JPH10161908A (en) 1998-06-19
JP3145937B2 true JP3145937B2 (en) 2001-03-12

Family

ID=18069407

Family Applications (1)

Application Number Title Priority Date Filing Date
JP31577596A Expired - Fee Related JP3145937B2 (en) 1996-11-27 1996-11-27 Runaway detection method for microcomputer

Country Status (1)

Country Link
JP (1) JP3145937B2 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2010055562A1 (en) 2008-11-13 2010-05-20 富士通マイクロエレクトロニクス株式会社 Microcomputer
JP5537403B2 (en) * 2010-12-24 2014-07-02 株式会社東芝 Secondary battery device and vehicle

Also Published As

Publication number Publication date
JPH10161908A (en) 1998-06-19

Similar Documents

Publication Publication Date Title
JPH0528063A (en) Microcomputer
JPH02202642A (en) Device for supervising program action
JP3145937B2 (en) Runaway detection method for microcomputer
US6321289B1 (en) Apparatus for automatically notifying operating system level applications of the occurrence of system management events
JP2001318807A (en) Method and device for controlling task switching
US6463492B1 (en) Technique to automatically notify an operating system level application of a system management event
US5500809A (en) Microcomputer system provided with mechanism for controlling operation of program
JPH04266141A (en) Stack overflow detection system
JPH09237205A (en) Program runaway detection device
JP2516711B2 (en) Watchdog timer device
KR19980013834A (en) The program execution time detection circuit of the microprocessor
JPH09114541A (en) Interruption generation time confirming circuit and processor
JP3090069B2 (en) Control device
JPH01251142A (en) Program trace system
JPH09113556A (en) Pulse measuring circuit and measuring method thereof
JPH11102298A (en) Timer control method, and its circuit and program recording medium
JPH0498540A (en) Processor load monitoring system
JPH0365739A (en) Control device
JPH0251742A (en) Preventing system for program runaway
JPH04225432A (en) Interruption processing time control system for one-chip microcomputer
JPH05128281A (en) Microcomputer
JPH03158915A (en) Power supply voltage drop detector
JPH07260845A (en) Pulse period measuring circuit
JPH05164768A (en) Speed controller for dc motor
JPH0328938A (en) Microcomputer device

Legal Events

Date Code Title Description
FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20080105

Year of fee payment: 7

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20090105

Year of fee payment: 8

LAPS Cancellation because of no payment of annual fees