JPH1124962A - Microcomputer device - Google Patents

Microcomputer device

Info

Publication number
JPH1124962A
JPH1124962A JP9172369A JP17236997A JPH1124962A JP H1124962 A JPH1124962 A JP H1124962A JP 9172369 A JP9172369 A JP 9172369A JP 17236997 A JP17236997 A JP 17236997A JP H1124962 A JPH1124962 A JP H1124962A
Authority
JP
Japan
Prior art keywords
cpu
runaway
program
reset
stack pointer
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.)
Granted
Application number
JP9172369A
Other languages
Japanese (ja)
Other versions
JP3182373B2 (en
Inventor
Hitoshi Inoue
仁志 井上
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.)
Denso Ten Ltd
Original Assignee
Denso Ten 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 Denso Ten Ltd filed Critical Denso Ten Ltd
Priority to JP17236997A priority Critical patent/JP3182373B2/en
Publication of JPH1124962A publication Critical patent/JPH1124962A/en
Application granted granted Critical
Publication of JP3182373B2 publication Critical patent/JP3182373B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Abstract

PROBLEM TO BE SOLVED: To ensure easy resetting, when a program runs away, of a microcomputer device which does not have a software reset function. SOLUTION: Runaway detection processing of a microcomputer device is executed (a10) as a part of a main routine processing (a1). When the runaway of the microcomputer device is detected (a11), a PUSH instruction being an instruction for changing the value of a stack pointer in one direction is repetitively executed in stack pointer operation instructions. When the value of the stack pointer becomes abnormal, CPU is reset and the runaway state of the program is dissolved.

Description

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

【0001】[0001]

【発明の属する技術分野】本発明は、各種制御などに広
く用いられるマイクロコンピュータ装置、特にプログラ
ム実行中の暴走を検出してリセットする機能を有するマ
イクロコンピュータ装置に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a microcomputer widely used for various controls and the like, and more particularly to a microcomputer having a function of detecting a runaway during execution of a program and resetting the program.

【0002】[0002]

【従来の技術】従来から、マイクロコンピュータ装置
(以下、「マイコン」と略称することもある)を用いて
各種制御などがプログラム動作に基づいて自動的に行わ
れている。たとえば、自動車には、「ECU」と呼ばれ
る制御用マイクロコンピュータ装置が各種搭載される。
プログラム動作を行うマイクロコンピュータは、プログ
ラム自体の誤りや、外部からのノイズなどの影響によっ
て、正常なプログラム実行中の動作ではない「暴走」を
起こすことがある。
2. Description of the Related Art Conventionally, various controls and the like have been automatically performed based on a program operation using a microcomputer device (hereinafter sometimes abbreviated as "microcomputer"). For example, an automobile is equipped with various control microcomputer devices called “ECUs”.
A microcomputer that performs a program operation may cause “runaway” which is not an operation during normal program execution due to an error in the program itself or an external noise.

【0003】マイクロコンピュータ装置が正常なプログ
ラム動作から外れる暴走状態となると、制御用などのマ
イクロコンピュータ装置の動作が予測がつかないものに
なってしまう。暴走が部分的であっても、制御の信頼性
が低くなってしまう。CPUの命令セット中にリセット
命令を備えるマイクロコンピュータ装置であれば、暴走
を検知したときにリセット命令を実行し、リセット状態
からプログラムの実行を再開させる。CPUの動作がリ
セット状態から開始するときには、各種データなどを初
期化し、一定の環境を整えてプログラムの実行が行われ
る。
If the microcomputer device goes out of control from the normal program operation, the operation of the microcomputer device for control or the like becomes unpredictable. Even if the runaway is partial, the reliability of the control is reduced. If the microcomputer device has a reset instruction in the instruction set of the CPU, the microcomputer executes the reset instruction when runaway is detected, and restarts the execution of the program from the reset state. When the operation of the CPU starts from the reset state, various data and the like are initialized, and a certain environment is prepared to execute the program.

【0004】CPUが暴走すると、リセット状態で整え
られた各種データなどの値も異常になってしまう可能性
があるので、暴走検知の際にはリセットをかけることが
有効である。操作者が暴走に気付いたときは、リセット
用スイッチなどを操作してリセットをかける。
When the CPU goes out of control, the values of various data and the like prepared in the reset state may become abnormal. Therefore, it is effective to perform a reset when detecting a runaway. When the operator notices a runaway, he operates a reset switch or the like to perform a reset.

【0005】マイクロコンピュータ装置の暴走検出につ
いて、ソフトウエアにて実現する方法は、一般によく知
られている。実際に「暴走」を生じていると検出される
場合には、マイクロコンピュータ装置のCPUが備える
命令セットにリセット命令が含まれていれば、リセット
命令に対応する命令語を暴走対策プログラム中で実行す
るようにすればよい。
[0005] A method of detecting runaway of a microcomputer device by software is generally well known. If it is detected that “runaway” has actually occurred, if the reset instruction is included in the instruction set provided in the CPU of the microcomputer device, the instruction corresponding to the reset instruction is executed in the runaway countermeasure program. What should I do?

【0006】特開昭62−52647には、ウオッチド
ッグタイマを備え、CPUから周期的にウオッチドッグ
パルスが導出されなくなると、CPUをリセットするマ
イクロプロセッサの暴走監視システムについての先行技
術が開示されている。この先行技術では、CPUは複数
のサブルーチンを含むメインルーチンを周期的に繰返し
て実行する。サブルーチンを通る回数はカウンタによっ
て計数され、プログラムが部分的に暴走して、メインル
ーチンの最後に計数値が異常であると、ウオッチドック
パルスの出力を停止する。プログラムが完全に暴走する
ときにもウオッチドックパルスの出力は停止するので、
プログラムの完全暴走と、部分的な暴走とで、いずれも
ウオッチドックタイマが動作し、CPUのリセットな
ど、暴走対策のための処置が行われる。特開平6−20
2909には、マイクロコンピュータ装置のプログラム
が格納されるプログラムメモリの空きメモリエリアの最
後などに暴走処理命令を配置し、他の空きメモリエリア
には無処理命令を配置して、プログラムの暴走によっ
て、本来アクセスされるはずのない空きメモリエリアに
プログラムの実行アドレスが移ってしまっても、暴走処
理命令を実行して暴走を停止させる先行技術が開示され
ている。暴走処理命令は、リセット命令に相当する命令
であり、たとえばプログラムカウンタの初期値である0
番地などにジャンプする命令が用いられる。
Japanese Patent Application Laid-Open No. 62-52647 discloses a prior art about a runaway monitoring system of a microprocessor having a watchdog timer and resetting the CPU when a watchdog pulse is not periodically derived from the CPU. I have. In this prior art, the CPU periodically and repeatedly executes a main routine including a plurality of subroutines. The number of times the subroutine is passed is counted by a counter. If the count value is abnormal at the end of the main routine, the output of the watchdog pulse is stopped. Since the output of the watchdog pulse stops even when the program runs out of control completely,
The watchdog timer operates for both complete runaway and partial runaway of the program, and measures such as resetting the CPU are taken to prevent runaway. JP-A-6-20
In 2909, a runaway processing instruction is arranged at the end of a free memory area of a program memory in which a program of a microcomputer device is stored, and a no-processing instruction is arranged in another free memory area. A prior art has been disclosed in which a runaway processing instruction is executed to stop a runaway even if a program execution address is moved to a free memory area that should not be accessed originally. The runaway processing instruction is an instruction corresponding to a reset instruction, for example, 0 which is an initial value of a program counter.
An instruction to jump to an address or the like is used.

【0007】[0007]

【発明が解決しようとする課題】前述のように、プログ
ラムが暴走しているときに、CPUをリセットすれば、
暴走状態が解除されると期待される。しかしながら、リ
セット命令を有していないCPUでは、ソフトウエアに
よって簡単にリセットをかけることができない。CPU
の命令リセットはコードの種類に限界があり、含むこと
ができる命令の数にも限界が生じる。このため、CPU
には必ずしもリセット命令が含まれているとは限らな
い。
As described above, if the CPU is reset while the program is running away,
The runaway condition is expected to be lifted. However, a CPU that does not have a reset command cannot easily reset by software. CPU
The instruction reset has a limitation in the type of code and the number of instructions that can be included. Therefore, CPU
Does not always include a reset instruction.

【0008】リセット命令を有していないCPUを有す
るマイクロコンピュータ装置でのプログラム暴走対策に
は、特開昭62−52647の先行技術のように、ウオ
ッチドッグタイマ機能を用いることも多い。しかしなが
ら、ウオッチドッグタイマ機能でも、プログラム暴走時
に完全にリセットすることができるとは限らない。たと
えば、部分的なプログラムの暴走によって、プログラム
メモリの未使用部分にプログラムの実行アドレスが一時
的に移ってしまっても、元のプログラム領域に復帰して
ウォッチドッグパルスを発生するような場合には、ウオ
ッチドッグタイマ機能を利用するリセットを行うことが
できない。リセットを行うことができないにもかかわら
ず、プログラム領域への復帰がどのように行われるかが
不明であるので、誤動作は生じてしまう。
As a countermeasure against program runaway in a microcomputer having a CPU having no reset instruction, a watchdog timer function is often used as in the prior art of Japanese Patent Application Laid-Open No. 62-52647. However, even with the watchdog timer function, it is not always possible to completely reset at the time of program runaway. For example, if the program execution address temporarily moves to an unused part of the program memory due to a partial program runaway, the program returns to the original program area and a watchdog pulse is generated. , The reset using the watchdog timer function cannot be performed. Although reset cannot be performed, it is not clear how to return to the program area, and a malfunction occurs.

【0009】本発明の目的は、リセット命令を有してし
ないCPUに対し、簡単かつ確実にリセットをかけるこ
とができるマイクロコンピュータ装置を提供することで
ある。
An object of the present invention is to provide a microcomputer device which can easily and surely reset a CPU having no reset instruction.

【0010】[0010]

【課題を解決するための手段】本発明は、スタックポイ
ンタの異常検出時にリセット状態へ移行する機能を備え
るCPUと、CPUのプログラム実行動作中に、暴走が
生じているか否かを検出する暴走検出手段と、暴走検出
手段によって暴走が生じていると判断されるとき、スタ
ックポインタ操作命令を実行することでスタックポイン
タを異常値とさせることで、CPUをリセットさせる暴
走対策手段とを含むことを特徴とするマイクロコンピュ
ータ装置である。
SUMMARY OF THE INVENTION The present invention provides a CPU having a function of shifting to a reset state when an abnormality of a stack pointer is detected, and a runaway detection for detecting whether or not a runaway occurs during a program execution operation of the CPU. Means for preventing runaway by resetting the CPU by causing a stack pointer to become an abnormal value by executing a stack pointer operation instruction when runaway is determined by the runaway detection means. Is a microcomputer device.

【0011】本発明に従えば、CPUのプログラム実行
動作中に、暴走検出手段によって暴走が生じていること
が検出されると、暴走対策手段によってスタックポイン
タを異常にするスタックポインタ操作命令が実行され
る。CPUは、スタックポインタの異常検出時にリセッ
ト状態へ移行する機能を備えているので、スタックポイ
ンタが異常になった時点で、リセット状態へ移行させる
ことができる。
According to the present invention, during the program execution operation of the CPU, when the runaway detecting means detects that a runaway has occurred, the runaway countermeasure means executes a stack pointer operation instruction to make the stack pointer abnormal. You. Since the CPU has a function of shifting to a reset state when an abnormality of the stack pointer is detected, the CPU can shift to the reset state when the stack pointer becomes abnormal.

【0012】さらに本発明は、スタックポインタの異常
検出時にリセット状態へ移行する機能を備えるCPU
と、CPUの動作用プログラムが格納され、未使用部分
に、スタックポインタを異常にするスタックポインタ操
作命令が格納されるプログラムメモリとを含むことを特
徴とするマイクロコンピュータ装置である。
Further, the present invention provides a CPU having a function of shifting to a reset state when an abnormality of a stack pointer is detected.
And a program memory in which an operation program of the CPU is stored and a stack pointer operation instruction for making the stack pointer abnormal is stored in an unused portion.

【0013】本発明に従えば、CPUの動作用プログラ
ムが格納されているプログラムメモリには、未使用部分
にスタックポインタを異常にするスタックポインタ操作
命令が格納される。プログラムの暴走の結果、プログラ
ムメモリの未使用部分に移行すると、CPUはスタック
ポインタを異常にするスタックポインタ操作命令を読込
んで実行する。スタックポインタの値が異常になると、
リセット状態に移行するので、暴走状態を解消させるこ
とができる。
According to the present invention, the program memory storing the operation program of the CPU stores a stack pointer operation instruction for making the stack pointer abnormal in an unused portion. When the program shifts to an unused portion of the program memory as a result of the program runaway, the CPU reads and executes a stack pointer operation instruction that makes the stack pointer abnormal. If the value of the stack pointer becomes abnormal,
Since the state shifts to the reset state, the runaway state can be eliminated.

【0014】さらに本発明は、リセット入力端子を備え
るCPUと、CPUのプログラム実行動作中に、暴走が
生じているか否かを検出する暴走検出手段と、暴走検出
手段によって暴走が生じていると判断されるとき、CP
Uのリセット入力端子にCPUにリセットをかける信号
を出力するリセット出力手段とを含むことを特徴とする
マイクロコンピュータ装置である。
Further, according to the present invention, a CPU having a reset input terminal, a runaway detecting means for detecting whether or not runaway has occurred during a program execution operation of the CPU, and a runaway detecting means for determining that runaway has occurred. When done, CP
And a reset output means for outputting a signal for resetting the CPU to a reset input terminal of U.

【0015】本発明に従えば、暴走検出手段によって、
CPUの実行動作中に暴走が生じていると判断される
と、CPUのリセット入力端子にCPUにリセットをか
ける信号を、リセット出力手段からリセット入力端子に
与えるので、プログラム暴走時にはリセット状態に移行
し、暴走状態を解除することができる。
According to the present invention, the runaway detecting means
If it is determined that a runaway has occurred during the execution operation of the CPU, a signal for resetting the CPU is applied to the reset input terminal of the CPU from the reset output means to the reset input terminal. , The runaway state can be canceled.

【0016】さらに本発明は、リセット入力端子を備え
るCPUと、CPUの予め定める出力端子からの出力に
応答し、所定の出力が導出されるときリセット入力端子
にCPUにリセットをかける信号を出力するリセット出
力手段と、CPUの動作用プログラムが格納され、未使
用部分に、リセット出力手段に所定の出力を導出する命
令が格納されるプログラムメモリとを含むことを特徴と
するマイクロコンピュータ装置である。
The present invention further provides a CPU having a reset input terminal and a signal for resetting the CPU to the reset input terminal when a predetermined output is derived in response to an output from a predetermined output terminal of the CPU. A microcomputer device comprising: a reset output unit; and a program memory in which an operation program of the CPU is stored, and an unused portion stores an instruction for deriving a predetermined output to the reset output unit.

【0017】本発明に従えば、CPUがプログラム実行
中に暴走して、プログラムメモリの未使用部分に移行す
ると、リセット出力手段に所定の出力を導出して、CP
Uの入力端子にリセットをかける信号が出力される。暴
走によって未使用部分にプログラムの実行アドレスが移
行すれば、確実にリセット状態に移ることができる。
According to the present invention, when the CPU runs away during the execution of the program and shifts to an unused portion of the program memory, the CPU outputs a predetermined output to the reset output means,
A signal for resetting is output to the input terminal of U. If the program execution address shifts to an unused portion due to a runaway, the reset state can be reliably transferred.

【0018】さらに本発明は、リセット後に特定の開始
アドレスからプログラムの実行動作を開始するCPU
と、CPUのプログラム実行動作中に、暴走が生じてい
るか否かを検出する暴走検出手段と、暴走検出手段によ
って暴走が生じていると判断されるとき、プログラムの
実行を、前記開始アドレスに移行させる暴走対策手段と
を含むことを特徴とするマイクロコンピュータ装置であ
る。
Further, according to the present invention, there is provided a CPU which starts a program execution operation from a specific start address after reset.
And a runaway detecting means for detecting whether runaway has occurred during the program execution operation of the CPU, and when the runaway detecting means determines that runaway has occurred, the execution of the program is shifted to the start address. And a runaway countermeasure means.

【0019】本発明に従えば、暴走検出手段によって、
プログラムの実行中に暴走が生じていると判断されると
きには、リセット後にプログラムの実行動作を開始する
特定の開始アドレスにプログラムの実行が移行するの
で、暴走状態を解消させることができる。
According to the present invention, the runaway detecting means
When it is determined that a runaway has occurred during the execution of the program, the execution of the program shifts to a specific start address where the execution of the program is started after the reset, so that the runaway state can be eliminated.

【0020】[0020]

【発明の実施の形態】図1は、本発明の実施の第1形態
としてのマイクロコンピュータ装置1の概略的なシステ
ム構成を示す。CPU2と、その動作用プログラムが格
納されているROMやワークエリアなどとして使用され
るRAMを含むプログラムメモリ3とは、システムバス
4を介して接続される。CPU2内には、プログラムカ
ウンタ(以下「PC」と略称する)5や、スタックポイ
ンタ(以下「SP」と略称する)6などが含まれる。P
C5は、プログラムメモリ3中で、CPU2が実行する
プログラムが格納されているメモリ領域のアドレスを参
照するために用いられ、通常プログラムのコードが読込
まれると次のアドレスを指定するように自動的に変更さ
れる。SP6は、プログラムメモリ3中のRAMに設定
されるスタック領域をアクセスするように、アドレス値
が設定される。サブルーチンへのジャンプが行われる
と、復帰アドレスがSP6によって示されるプログラム
メモリ3のアドレスに保存され、SP6の値は、たとえ
ば増加するように変更される。サブルーチンから復帰す
るリターン命令などを実行すると、SP6の値は、たと
えば減少するように変更され、SP6で指定されるアド
レスから復帰アドレスがPC5に読込まれ、元のプログ
ラムに復帰する。CPU2内の各種レジスタなどの値を
スタック領域に保存したり、スタック領域から読込んだ
りするためには、プッシュ(PUSH)命令やポップ
(POP)命令などが一般に備えられる。これらの命令
は、SP6の値を、現在値を基準に相対的に増減する。
マイクロコンピュータによっては、SP6の値を直接変
更する命令を備えている場合もある。
FIG. 1 shows a schematic system configuration of a microcomputer device 1 according to a first embodiment of the present invention. The CPU 2 is connected via a system bus 4 to a program memory 3 including a ROM for storing its operation program and a RAM used as a work area. The CPU 2 includes a program counter (hereinafter abbreviated as “PC”) 5, a stack pointer (hereinafter abbreviated as “SP”) 6, and the like. P
C5 is used to refer to an address of a memory area where a program to be executed by the CPU 2 is stored in the program memory 3, and when a code of a normal program is read, an automatic address is designated so as to designate the next address. Is changed to In SP6, an address value is set so as to access a stack area set in the RAM in the program memory 3. When the jump to the subroutine is performed, the return address is stored in the address of the program memory 3 indicated by SP6, and the value of SP6 is changed, for example, to increase. When a return instruction or the like for returning from the subroutine is executed, the value of SP6 is changed so as to decrease, for example, the return address is read from the address designated by SP6 to PC5, and the program returns to the original program. A push (PUSH) instruction, a pop (POP) instruction, and the like are generally provided to save values of various registers and the like in the CPU 2 in the stack area and to read the values from the stack area. These instructions increase or decrease the value of SP6 relative to the current value.
Some microcomputers have an instruction to directly change the value of SP6.

【0021】CPU2では、SP6の値として、予め許
容される値を外れると、リセット動作に移行する機能が
備えられている場合を想定する。SP6の値が異常にな
り、たとえばRAMのアドレス領域を外れると、正常な
スタック動作を行うことができなくなるので、そのよう
な事態を避けるために、SP6の値を監視する機能が備
えられる場合がある。また、マイクロコンピュータによ
っては、スタック領域を外部のメモリには設けずに、C
PUの内部レジスタやメモリに設ける場合もある。この
ようなアーキテクチャのCPUでは、スタック領域の制
限は厳しく、SPの値が異常になるときの保護も一層、
必要となる。
It is assumed that the CPU 2 has a function of shifting to a reset operation when the value of SP6 deviates from a previously permitted value. If the value of SP6 becomes abnormal and goes out of the address area of the RAM, for example, a normal stack operation cannot be performed. Therefore, in order to avoid such a situation, a function of monitoring the value of SP6 may be provided. is there. In some microcomputers, a stack area is not provided in an external memory, and
It may be provided in an internal register or memory of the PU. In a CPU having such an architecture, the stack area is severely restricted, and protection when an SP value becomes abnormal is further improved.
Required.

【0022】図2は、図1に示すCPU2を用いて、プ
ログラムの暴走を監視し、暴走検出時にリセット動作を
行う処理を示す。ステップa1からメインルーチンの処
理を行う。メインルーチンの最後に、ステップa10で
マイコン暴走検出処理を行う。マイコン暴走検出処理
は、たとえば特開昭62−52647の先行技術に示さ
れているように、サブルーチンのカウント動作などによ
って行うことができる。ステップa11で、マイクロコ
ンピュータが暴走していないと判断されれば、ステップ
a12で、次のモジュールのプログラム動作に移り、さ
らにステップa1のメインルーチン処理に戻る。ステッ
プa11で、マイクロコンピュータの暴走が検出される
と、ステップa13で、スタックポインタ操作命令が行
われる。このスタックポインタ操作命令は、たとえばP
USHあるいはPOP命令の一方を繰返す無限ループと
する。PUSH命令を繰返して行うと、SP6の値が順
次変化し、制限範囲を超えるとCPU2がリセットされ
る。
FIG. 2 shows processing for monitoring runaway of a program using the CPU 2 shown in FIG. 1 and performing a reset operation when runaway is detected. The processing of the main routine is performed from step a1. At the end of the main routine, microcomputer runaway detection processing is performed in step a10. The microcomputer runaway detection process can be performed by a subroutine counting operation, for example, as shown in the prior art of Japanese Patent Application Laid-Open No. 62-52647. If it is determined in step a11 that the microcomputer has not run away, the program proceeds to the program operation of the next module in step a12, and further returns to the main routine processing in step a1. If runaway of the microcomputer is detected in step a11, a stack pointer operation instruction is executed in step a13. This stack pointer operation instruction is, for example, P
An infinite loop that repeats either the USH or POP instruction. When the PUSH instruction is repeatedly executed, the value of SP6 is sequentially changed. When the value exceeds the limit range, the CPU 2 is reset.

【0023】図3は、本発明の実施の第2形態の動作を
示す。本実施形態は、図1に示すようなシステム構成で
行われ、プログラムメモリ3には、図3(a)に示すよ
うなメインルーチンの処理プログラムが格納される。す
なわち、ステップba1からステップbamまで、メイ
ンルーチンが繰返して実行される。プログラムメモリ3
の未使用部分3xには、図3(b)に示すようなスタッ
クポインタ操作命令が格納される。すなわちステップb
b1、ステップbb2、ステップbb3、…ステップb
bnには、たとえばPUSH命令が格納される。他のス
タックポインタ操作命令、たとえばPOP命令であって
も同様である。プログラムが暴走して、図3(a)に示
すメインルーチン処理から逸脱し、図3(b)に示す未
使用部分3xに移行すると、SP6の値が増加または減
少するいずれかの方向に変化し、制限値を超えてCPU
2はリセットされる。
FIG. 3 shows the operation of the second embodiment of the present invention. This embodiment is performed with a system configuration as shown in FIG. 1, and a program memory 3 stores a main routine processing program as shown in FIG. That is, the main routine is repeatedly executed from step ba1 to step bam. Program memory 3
The unused portion 3x stores a stack pointer operation instruction as shown in FIG. 3B. That is, step b
b1, step bb2, step bb3,... step b
In bn, for example, a PUSH instruction is stored. The same applies to another stack pointer operation instruction, for example, a POP instruction. When the program runs away from the main routine shown in FIG. 3A and shifts to the unused portion 3x shown in FIG. 3B, the value of SP6 changes in either direction of increasing or decreasing. CPU beyond limit
2 is reset.

【0024】図4は、本発明の実施の第3形態の概略的
な電気的構成を示す。本形態のマイクロコンピュータ装
置11では、CPU12のリセット入力端子13に、出
力ポート14からの出力が接続される。リセット入力端
子13は、たとえばローレベルの入力でCPU12にリ
セットをかけることができる。通常は、リセット入力端
子13を抵抗15で直流の正電圧Vccにプルアップし
ておく。CPU12は、システムバスチを介して、プロ
グラムメモリ3に接続され、PC5のアドレス値に従っ
て命令を実行する。
FIG. 4 shows a schematic electrical configuration of a third embodiment of the present invention. In the microcomputer device 11 of the present embodiment, the output from the output port 14 is connected to the reset input terminal 13 of the CPU 12. The reset input terminal 13 can reset the CPU 12 by a low level input, for example. Normally, the reset input terminal 13 is pulled up by the resistor 15 to the DC positive voltage Vcc. The CPU 12 is connected to the program memory 3 via the system bush, and executes an instruction according to the address value of the PC 5.

【0025】図5は、本実施形態の動作用プログラムを
示す。ステップc1からステップc12までは、図2の
ステップa1〜ステップa12とそれぞれ同等の動作で
ある。ステップc11で、マイクロコンピュータ装置1
1の暴走が検出されたときの動作であるステップc13
では、出力ポート14にローレベルを出力する命令を実
行する。この出力ポート14にローレベルの出力を実行
する命令が無限ループで繰返されるので、リセット端子
13には出力ポート14からローレベルの入力信号が連
続的に与えられ、CPU12はリセットされる。
FIG. 5 shows an operation program according to this embodiment. Steps c1 to c12 are the same operations as steps a1 to a12 in FIG. At Step c11, the microcomputer 1
Step c13 which is the operation when the runaway of No. 1 is detected
Then, an instruction to output a low level to the output port 14 is executed. Since an instruction to execute a low-level output to the output port 14 is repeated in an infinite loop, a low-level input signal is continuously supplied to the reset terminal 13 from the output port 14, and the CPU 12 is reset.

【0026】図6は、本発明の実施の第4形態の動作を
示す。本実施形態も、図4に示すようなマイクロコンピ
ュータ装置11を使用することを前提とする。図6
(a)に示すように、メインルーチン処理であるステッ
プda1からステップdamは、図3(a)のメインル
ーチン処理、すなわちステップba1からステップba
mと同等である。図6(b)に示すプログラムメモリ3
の未使用部分3xの命令は、ステップdb1、ステップ
db2、ステップdb3、…ステップdbnともに、出
力ポート14にローレベルの出力を与える命令とする。
これによって、プログラムが暴走し、未使用部分3xを
アクセスするようになると、出力ポート14にローレベ
ルが出力され、リセット入力端子13からCPU12が
リセットされ、暴走状態を解消することができる。
FIG. 6 shows the operation of the fourth embodiment of the present invention. This embodiment also assumes that a microcomputer device 11 as shown in FIG. 4 is used. FIG.
As shown in FIG. 3A, steps da1 to dam, which are main routine processes, are performed in the main routine process of FIG. 3A, that is, steps ba1 to ba.
It is equivalent to m. The program memory 3 shown in FIG.
The instruction of the unused portion 3x is an instruction for giving a low-level output to the output port 14 in all of the steps db1, db2, db3,..., Step dbn.
Thus, when the program runs away and accesses the unused portion 3x, a low level is output to the output port 14, the CPU 12 is reset from the reset input terminal 13, and the runaway state can be eliminated.

【0027】図7は、本発明の実施の第5形態の動作を
示す。本実施形態では、マイクロコンピュータ装置とし
てのハードウエア構成がどのような場合であっても、基
本的に実現可能である。ステップe1からステップe1
2までは、図2のステップa1〜ステップa12までと
同等の動作を行う。ステップe11で、マイクロコンピ
ュータ装置が暴走していると判断されると、ステップe
13で、ジャンプAAA命令を実行する。ここでAAA
はCPUがリセット状態の後、実行するアドレスであ
る。CPUは、一般に電源投入時にはハードウエアによ
って自動的にリセットされ、特定のアドレス、たとえば
0番地や最終番地からプログラムの実行を開始する。本
実施形態では、プログラムの暴走が検出されると、その
先頭アドレスからプログラム実行を再開する。
FIG. 7 shows the operation of the fifth embodiment of the present invention. In the present embodiment, it is basically feasible regardless of the hardware configuration of the microcomputer device. Step e1 to step e1
Up to 2, the same operations as those in steps a1 to a12 in FIG. 2 are performed. If it is determined in step e11 that the microcomputer device is out of control, step e11 is executed.
At 13, a jump AAA instruction is executed. Where AAA
Is an address to be executed after the CPU is reset. The CPU is generally automatically reset by hardware when the power is turned on, and starts executing the program from a specific address, for example, address 0 or the last address. In this embodiment, when a runaway of the program is detected, the program execution is restarted from the head address.

【0028】[0028]

【発明の効果】以上のように本発明によれば、プログラ
ムの実行中に暴走が検出されると、スタックポインタの
値を異常にするプログラムが実行され、スタックポイン
タの値が異常となってCPUがリセット動作を行うの
で、CPUの命令セット中にリセット命令が含まれてい
なくても、暴走を検出して簡単かつ確実にリセットをか
けることができる。
As described above, according to the present invention, when a runaway is detected during the execution of a program, a program for making the value of the stack pointer abnormal is executed, and the value of the stack pointer becomes abnormal and the CPU becomes abnormal. Performs a reset operation, so that runaway can be detected and reset can be easily and reliably performed even if the reset instruction is not included in the instruction set of the CPU.

【0029】また本発明によれば、CPUのプログラム
実行中に、暴走を生じてプログラムメモリの未使用部分
に実行アドレスが移行すれば、スタックポインタの値を
異常にするスタックポインタ操作命令が実行され、スタ
ックポインタの値が異常になって、CPUはリセット状
態に移行するので、容易にかつ確実に暴走状態を解消さ
せることができる。
Further, according to the present invention, if a runaway occurs during execution of a program by the CPU and the execution address shifts to an unused portion of the program memory, a stack pointer operation instruction for making the value of the stack pointer abnormal is executed. Since the value of the stack pointer becomes abnormal and the CPU shifts to the reset state, the runaway state can be easily and reliably eliminated.

【0030】さらに本発明によれば、リセット入力端子
を備えるCPUであれば、暴走検出手段によってCPU
のプログラム動作中に暴走が生じていると判断されると
き、リセット出力手段からリセット入力端子にCPUを
リセットさせる信号を出力することができるので、暴走
状態を簡単かつ確実に解消させることができる。
Further, according to the present invention, if the CPU has a reset input terminal, the runaway detecting means can control the CPU.
When it is determined that a runaway has occurred during the program operation, the reset output means can output a signal for resetting the CPU to the reset input terminal, so that the runaway state can be easily and reliably eliminated.

【0031】さらに本発明によれば、CPUがプログラ
ム動作中に暴走し、プログラムメモリの未使用部分の命
令を読込んでも、リセット出力手段を介してリセット入
力端子にリセットをかけることができるので、暴走を簡
単かつ確実に解消させることができる。
Further, according to the present invention, even if the CPU runs away during the program operation and reads an instruction in an unused portion of the program memory, it is possible to reset the reset input terminal via the reset output means. Runaway can be easily and reliably eliminated.

【0032】さらに本発明によれば、暴走検出手段によ
ってプログラムの実行動作中に暴走が生じていると判断
されるときには、CPUがリセット後にプログラム実行
動作を開始する特定の開始アドレスに移行するので、リ
セットと同様にプログラムの暴走を解消させることがで
きる。
Further, according to the present invention, when the runaway detection means determines that a runaway has occurred during the execution of the program, the CPU shifts to a specific start address where the CPU starts the program execution after reset. Runaway of the program can be eliminated similarly to the reset.

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

【図1】本発明の実施の第1および第2形態の概略的な
電気的構成を示すブロック図である。
FIG. 1 is a block diagram showing a schematic electrical configuration of first and second embodiments of the present invention.

【図2】本発明の実施の第1形態の動作を示すフローチ
ャートである。
FIG. 2 is a flowchart showing the operation of the first embodiment of the present invention.

【図3】本発明の実施の第2形態の動作を示すフローチ
ャートである。
FIG. 3 is a flowchart showing the operation of the second embodiment of the present invention.

【図4】本発明の実施の第3および第4形態の概略的な
電気的構成を示すブロック図である。
FIG. 4 is a block diagram showing a schematic electrical configuration of third and fourth embodiments of the present invention.

【図5】本発明の実施の第3形態の動作を示すフローチ
ャートである。
FIG. 5 is a flowchart showing the operation of the third embodiment of the present invention.

【図6】本発明の実施の第4形態の動作を示すフローチ
ャートである。
FIG. 6 is a flowchart showing the operation of the fourth embodiment of the present invention.

【図7】本発明の実施の第5形態の動作を示すフローチ
ャートである。
FIG. 7 is a flowchart showing the operation of the fifth embodiment of the present invention.

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

1,11 マイクロコンピュータ装置 2,12 CPU 3 プログラムメモリ 3x 未使用部分 4 システムバス 5 PC 6 SP 13 リセット入力端子 14 出力ポート 1,11 microcomputer device 2,12 CPU 3 program memory 3x unused part 4 system bus 5 PC 6 SP 13 reset input terminal 14 output port

Claims (5)

【特許請求の範囲】[Claims] 【請求項1】 スタックポインタの異常検出時にリセッ
ト状態へ移行する機能を備えるCPUと、 CPUのプログラム実行動作中に、暴走が生じているか
否かを検出する暴走検出手段と、 暴走検出手段によって暴走が生じていると判断されると
き、スタックポインタ操作命令を実行することでスタッ
クポインタを異常値とさせることで、CPUをリセット
させる暴走対策手段とを含むことを特徴とするマイクロ
コンピュータ装置。
1. A CPU having a function of shifting to a reset state when an abnormality of a stack pointer is detected, a runaway detecting means for detecting whether runaway has occurred during a program execution operation of the CPU, and a runaway detection means A microcomputer device comprising: a runaway countermeasure for resetting the CPU by causing a stack pointer to become an abnormal value by executing a stack pointer operation instruction when it is determined that the error occurs.
【請求項2】 スタックポインタの異常検出時にリセッ
ト状態へ移行する機能を備えるCPUと、 CPUの動作用プログラムが格納され、未使用部分に、
スタックポインタを異常にするスタックポインタ操作命
令が格納されるプログラムメモリとを含むことを特徴と
するマイクロコンピュータ装置。
2. A CPU having a function of shifting to a reset state when an abnormality of a stack pointer is detected, and an operation program of the CPU is stored in an unused portion.
And a program memory for storing a stack pointer operation instruction for causing a stack pointer to become abnormal.
【請求項3】 リセット入力端子を備えるCPUと、 CPUのプログラム実行動作中に、暴走が生じているか
否かを検出する暴走検出手段と、 暴走検出手段によって暴走が生じていると判断されると
き、 CPUのリセット入力端子にCPUにリセットをかける
信号を出力するリセット出力手段とを含むことを特徴と
するマイクロコンピュータ装置。
3. A CPU having a reset input terminal; a runaway detecting means for detecting whether runaway has occurred during a program execution operation of the CPU; and a runaway detecting means determining that runaway has occurred. And a reset output means for outputting a signal for resetting the CPU to a reset input terminal of the CPU.
【請求項4】 リセット入力端子を備えるCPUと、 CPUの予め定める出力端子からの出力に応答し、所定
の出力が導出されるときリセット入力端子にCPUにリ
セットをかける信号を出力するリセット出力手段と、 CPUの動作用プログラムが格納され、未使用部分に、
リセット出力手段に所定の出力を導出する命令が格納さ
れるプログラムメモリとを含むことを特徴とするマイク
ロコンピュータ装置。
4. A CPU having a reset input terminal, and reset output means for responding to an output from a predetermined output terminal of the CPU and outputting a signal for resetting the CPU to the reset input terminal when a predetermined output is derived. And an operation program of the CPU are stored, and in an unused portion,
And a program memory in which an instruction for deriving a predetermined output is stored in the reset output means.
【請求項5】 リセット後に特定の開始アドレスからプ
ログラムの実行動作を開始するCPUと、 CPUのプログラム実行動作中に、暴走が生じているか
否かを検出する暴走検出手段と、 暴走検出手段によって暴走が生じていると判断されると
き、プログラムの実行を、前記開始アドレスに移行させ
る暴走対策手段とを含むことを特徴とするマイクロコン
ピュータ装置。
5. A CPU which starts a program execution operation from a specific start address after reset, a runaway detection means for detecting whether or not a runaway occurs during a program execution operation of the CPU, and a runaway detection means. And a runaway countermeasure for shifting the execution of the program to the start address when it is determined that the program has occurred.
JP17236997A 1997-06-27 1997-06-27 Microcomputer device Expired - Fee Related JP3182373B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP17236997A JP3182373B2 (en) 1997-06-27 1997-06-27 Microcomputer device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP17236997A JP3182373B2 (en) 1997-06-27 1997-06-27 Microcomputer device

Publications (2)

Publication Number Publication Date
JPH1124962A true JPH1124962A (en) 1999-01-29
JP3182373B2 JP3182373B2 (en) 2001-07-03

Family

ID=15940638

Family Applications (1)

Application Number Title Priority Date Filing Date
JP17236997A Expired - Fee Related JP3182373B2 (en) 1997-06-27 1997-06-27 Microcomputer device

Country Status (1)

Country Link
JP (1) JP3182373B2 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2003063278A3 (en) * 2002-01-18 2004-12-09 Intelligent Energy Ltd Fuel cell oxygen removal and pre-conditioning system
WO2004045012A3 (en) * 2002-11-12 2005-01-06 Nissan Motor Fuel cell system

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2003063278A3 (en) * 2002-01-18 2004-12-09 Intelligent Energy Ltd Fuel cell oxygen removal and pre-conditioning system
WO2004045012A3 (en) * 2002-11-12 2005-01-06 Nissan Motor Fuel cell system

Also Published As

Publication number Publication date
JP3182373B2 (en) 2001-07-03

Similar Documents

Publication Publication Date Title
US4775957A (en) Microcomputer with abnormality sensing function
JP3255693B2 (en) Automotive multi-computer system
US20090217090A1 (en) Method, operating system and computing hardware for running a computer program
US7788533B2 (en) Restarting an errored object of a first class
US4839895A (en) Early failure detection system for multiprocessor system
JPH08503802A (en) Microcomputer
JPH1124962A (en) Microcomputer device
JPH04266141A (en) Stack overflow detection system
US6185700B1 (en) Method and device for evaluating a program
JPH0325813B2 (en)
US6904543B2 (en) Electronic control having floating-point data check function
US7246206B2 (en) Method and device for storing a computer program in a program memory of a control unit
JPS6118045A (en) Detecting system of program runaway
JPH07281912A (en) Stack abnormality detecting device
JPS6136665B2 (en)
JP2870202B2 (en) Method and apparatus for mutual monitoring between processors
JPS6211745B2 (en)
JPH03252735A (en) Detecting method for runaway of program
JPH06103467B2 (en) Preventing malfunction of automobile computer
JPH08123704A (en) Controller
JP3169879B2 (en) Microprocessor runaway detection method
JPS5833758A (en) Programmable controller
JPS63109545A (en) Self-diagnostic system for hardware
JPH0784786A (en) Program execution control method
JP2001043111A (en) Interruption control circuit and microcontroller

Legal Events

Date Code Title Description
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20010410

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

Free format text: PAYMENT UNTIL: 20080420

Year of fee payment: 7

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

Free format text: PAYMENT UNTIL: 20090420

Year of fee payment: 8

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

Free format text: PAYMENT UNTIL: 20090420

Year of fee payment: 8

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

Free format text: PAYMENT UNTIL: 20100420

Year of fee payment: 9

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

Free format text: PAYMENT UNTIL: 20110420

Year of fee payment: 10

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

Free format text: PAYMENT UNTIL: 20110420

Year of fee payment: 10

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

Free format text: PAYMENT UNTIL: 20120420

Year of fee payment: 11

LAPS Cancellation because of no payment of annual fees