JP6589767B2 - Electronic control unit - Google Patents

Electronic control unit Download PDF

Info

Publication number
JP6589767B2
JP6589767B2 JP2016147634A JP2016147634A JP6589767B2 JP 6589767 B2 JP6589767 B2 JP 6589767B2 JP 2016147634 A JP2016147634 A JP 2016147634A JP 2016147634 A JP2016147634 A JP 2016147634A JP 6589767 B2 JP6589767 B2 JP 6589767B2
Authority
JP
Japan
Prior art keywords
memory protection
violation
unit
memory
access
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
JP2016147634A
Other languages
Japanese (ja)
Other versions
JP2018018274A (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.)
Denso Corp
Original Assignee
Denso 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 Denso Corp filed Critical Denso Corp
Priority to JP2016147634A priority Critical patent/JP6589767B2/en
Priority to DE102017211568.8A priority patent/DE102017211568B4/en
Publication of JP2018018274A publication Critical patent/JP2018018274A/en
Application granted granted Critical
Publication of JP6589767B2 publication Critical patent/JP6589767B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/14Protection against unauthorised use of memory or access to memory
    • G06F12/1416Protection against unauthorised use of memory or access to memory by checking the object accessibility, e.g. type of access defined by the memory independently of subject rights
    • G06F12/1425Protection against unauthorised use of memory or access to memory by checking the object accessibility, e.g. type of access defined by the memory independently of subject rights the protection being physical, e.g. cell, word, block
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0706Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation the processing taking place on a specific hardware platform or in a specific software environment
    • G06F11/073Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation the processing taking place on a specific hardware platform or in a specific software environment in a memory management context, e.g. virtual memory or cache management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0751Error or fault detection not based on redundancy
    • G06F11/0754Error or fault detection not based on redundancy by exceeding limits
    • G06F11/076Error or fault detection not based on redundancy by exceeding limits by exceeding a count or rate limit, e.g. word- or bit count limit
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0766Error or fault reporting or storing
    • G06F11/0772Means for error signaling, e.g. using interrupts, exception flags, dedicated error registers
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0793Remedial or corrective actions
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/55Detecting local intrusion or implementing counter-measures
    • G06F21/552Detecting local intrusion or implementing counter-measures involving long-term monitoring or reporting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/70Protecting specific internal or peripheral components, in which the protection of a component leads to protection of the entire computer
    • G06F21/78Protecting specific internal or peripheral components, in which the protection of a component leads to protection of the entire computer to assure secure storage of data
    • G06F21/79Protecting specific internal or peripheral components, in which the protection of a component leads to protection of the entire computer to assure secure storage of data in semiconductor storage media, e.g. directly-addressable memories
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/30Services specially adapted for particular environments, situations or purposes
    • H04W4/40Services specially adapted for particular environments, situations or purposes for vehicles, e.g. vehicle-to-pedestrians [V2P]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/10Providing a specific technical effect
    • G06F2212/1041Resource optimization
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/10Providing a specific technical effect
    • G06F2212/1052Security improvement
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/17Embedded application
    • G06F2212/173Vehicle or other transportation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2221/00Indexing scheme relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/21Indexing scheme relating to G06F21/00 and subgroups addressing additional information or applications relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/2139Recurrent verification
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2221/00Indexing scheme relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/21Indexing scheme relating to G06F21/00 and subgroups addressing additional information or applications relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/2141Access rights, e.g. capability lists, access control lists, access tables, access matrices

Description

本発明は、アクセスが認められたメモリ領域外へのアクセスを違反アクセスとして禁止するとともに、違反アクセスが生じた場合にメモリ保護違反割込みを発生させるメモリ保護部を有するマイコンを備えた電子制御装置に関する。   The present invention relates to an electronic control device including a microcomputer having a memory protection unit that prohibits access outside a memory area where access is permitted as a violation access and generates a memory protection violation interrupt when a violation access occurs. .

例えば、メモリ保護を行うための技術として、特許文献1に記載された情報処理装置が知られている。特許文献1の情報処理装置は、メモリに記憶された複数のアプリを実行するCPUと、各アプリ毎にメモリへのアクセスを許可するか又は禁止するかの許否情報がアドレスに対応付けて登録されるアクセス監視手段と、を備えている。   For example, an information processing apparatus described in Patent Document 1 is known as a technique for protecting a memory. In the information processing apparatus disclosed in Patent Literature 1, a CPU that executes a plurality of applications stored in a memory and permission information for permitting or prohibiting access to each memory are registered in association with addresses. Access monitoring means.

さらに、特許文献1の情報処理装置は、アプリを実行するCPUによって禁止されたメモリへのアクセスがなされたことをアクセス監視手段が検出した場合に、CPUがメモリアクセスしたアドレスに記憶されたデータを、そのアドレスと対応付けてメモリから退避領域に退避させるデータ退避手段と、CPUがメモリアクセスしたアドレスへのアクセスが許可されるように、許否情報を変更する許否情報変更手段と、禁止されたメモリへのアクセスを行ったアプリを実行するCPUが、該当するアドレスへのメモリアクセスを行った後に、そのアドレスのデータを当該アドレスと対応付けてメモリからバックアップ領域にバックアップするバックアップ手段と、を有している。そして、バックアップ手段は、CPUが禁止されたメモリアクセスを行ったアプリを次に実行する前に、バックアップ領域のデータを、対応付けられているアドレスに復帰させるように構成されている。なお、バックアップ手段が、バックアップ領域のデータを復帰させる場合には、当該アドレスのデータは、データ退避手段により、退避領域に退避させられる。   Furthermore, when the access monitoring unit detects that the memory prohibited by the CPU executing the application has been accessed, the information processing apparatus disclosed in Patent Document 1 stores the data stored in the address accessed by the CPU. A data saving means for saving the address from the memory in association with the address, a permission information changing means for changing the permission information so that access to the address accessed by the CPU is permitted, and a prohibited memory The CPU that executes the application that has accessed the memory has backup means for backing up the data at the address from the memory to the backup area in association with the address after performing the memory access to the corresponding address. ing. The backup unit is configured to restore the data in the backup area to the associated address before the next execution of the application that has performed the memory access prohibited by the CPU. When the backup unit restores the data in the backup area, the data at the address is saved in the save area by the data save unit.

一般的なメモリ保護装置では、アクセス違反が生じた場合、例外処理として、メモリ保護違反割込みを発生させ、現行のプロセスを終了(命令の破棄)させて、次のプロセスをCPUに割り付けたり、OSをリスタートさせたりする。この場合、プログラムの実行が制限されてしまうが、特許文献1の情報処理装置によれば、アクセス違反が生じてもプログラム(アプリ)の実行を継続することが可能となる。   In an ordinary memory protection device, when an access violation occurs, a memory protection violation interrupt is generated as an exception process, the current process is terminated (instructions are discarded), and the next process is assigned to the CPU, or the OS Or restart. In this case, the execution of the program is limited, but according to the information processing apparatus of Patent Document 1, it is possible to continue the execution of the program (application) even if an access violation occurs.

特開2014−137734号公報JP 2014-137734 A

しかしながら、特許文献1の情報処理装置では、データの退避用及びバックアップ用のメモリ領域を冗長に確保しなければならないという問題がある。さらに、アクセス違反が生じた場合、メモリ保護装置が例外を発生させ、割込みにより、データのバックアップや許否情報の変更処理が行われたり、アプリの切り替え時に、データを退避領域に退避させた上で、バックアップ領域からデータを移したりするため、オーバーヘッドが増加するという問題も生じる。   However, the information processing apparatus disclosed in Patent Document 1 has a problem that redundant memory areas for data saving and backup must be secured. In addition, when an access violation occurs, the memory protection device generates an exception, and the data is backed up or the permission information is changed by interruption, or the data is saved in the save area when the application is switched. In addition, since data is moved from the backup area, there is a problem that overhead increases.

本発明は、上述した点に鑑みてなされたもので、メモリ領域の冗長化やオーバーヘッドの増加を招くことなく、極力安全にプログラムの実行を継続することが可能な電子制御装置を提供することを目的とする。   The present invention has been made in view of the above points, and it is an object of the present invention to provide an electronic control device capable of continuing the execution of a program as safely as possible without causing redundancy of a memory area and an increase in overhead. Objective.

上記目的を達成するために、本発明による電子制御装置(10)は、アクセスが認められたメモリ領域外へのアクセスを違反アクセスとして禁止するとともに、違反アクセスが生じた場合にメモリ保護違反割込みを発生させるメモリ保護部(22、24、28)を有するマイコン(12)を備え、さらに、
違反アクセスの回数をカウントするカウント部(S400)と、
カウント部によってカウントされた回数が所定回数以上となった場合に、メモリ保護違反割込みの発生を無効化する無効化部(S300、S320)と、を備える。
In order to achieve the above object, the electronic control device (10) according to the present invention prohibits access outside the memory area to which access is permitted as a violation access, and issues a memory protection violation interrupt when the violation access occurs. A microcomputer (12) having a memory protection unit (22, 24, 28) to be generated;
A counting unit (S400) for counting the number of violation accesses;
An invalidation unit (S300, S320) for invalidating the occurrence of a memory protection violation interrupt when the number of times counted by the count unit exceeds a predetermined number.

このような構成を備えるため、本発明による電子制御装置では、違反アクセスの回数が所定回数以上となると、メモリ保護違反割込みの発生が無効化される。このため、メモリ保護違反割込みの無効化後は、現行のプロセスが終了されたり、OSがリスタートされたりすることなく、プログラムの実行を継続することが可能になる。この場合、メモリ保護違反割込みは無効化されるが、メモリ保護部による、アクセスが認められたメモリ領域外への違反アクセスは継続して禁止されるので、データが不当に書き込まれたり、読み出されたりすることはなく、安全にプログラムの実行を継続させることができる。   With such a configuration, in the electronic control device according to the present invention, when the number of violation accesses exceeds a predetermined number, generation of a memory protection violation interrupt is invalidated. For this reason, after invalidating the memory protection violation interrupt, it is possible to continue the execution of the program without terminating the current process or restarting the OS. In this case, the memory protection violation interrupt is invalidated, but illegal access to the outside of the authorized memory area by the memory protection unit is continuously prohibited, so data is illegally written or read. The program can be safely continued without being executed.

上述した電子制御装置において、さらに、
電子制御装置は、所定の制御対象に制御信号を出力して制御するものであり、
無効化部によってメモリ保護違反割込みの発生を無効化してからの無効化時間を計測する計測部(S340)と、
計測部により計測される無効化時間が所定時間に達したとき、制御対象への制御信号の出力を遮断する遮断部(S350、S360)と、を備えるように構成しても良い。
In the electronic control device described above,
The electronic control device is to output and control a control signal to a predetermined control target,
A measurement unit (S340) for measuring the invalidation time after invalidating the generation of the memory protection violation interrupt by the invalidation unit;
You may comprise so that when the invalidation time measured by a measurement part reaches predetermined time, the interruption | blocking part (S350, S360) which interrupts | blocks the output of the control signal to a control object.

上述したように、違反アクセスは禁止されるが、違反アクセスが継続して発生する状況のまま、無制限にプログラムの実行を継続すると、万一、メモリ保護部に故障が生じた場合、違反アクセスを禁止することができず、不測の事態を招く虞がある。そのため、上述したように、メモリ保護違反割込みの発生を無効化してからの無効化時間が所定時間に達した時に、制御対象への制御信号の出力を遮断して、制御対象に対する制御が行われなくすることが好ましい。   As described above, violation access is prohibited, but if the program execution is continued in an unlimited manner in a situation where violation access continues, if the memory protection unit fails, the violation access is It cannot be prohibited and may lead to unexpected situations. Therefore, as described above, when the invalidation time after invalidating the occurrence of the memory protection violation interrupt reaches a predetermined time, the output of the control signal to the controlled object is cut off and the controlled object is controlled. It is preferable to eliminate.

上記括弧内の参照番号は、本発明の理解を容易にすべく、後述する実施形態における具体的な構成との対応関係の一例を示すものにすぎず、なんら本発明の範囲を制限することを意図したものではない。   The reference numerals in the parentheses merely show an example of a correspondence relationship with a specific configuration in an embodiment described later in order to facilitate understanding of the present invention, and are intended to limit the scope of the present invention. Not intended.

また、上述した特徴以外の、特許請求の範囲の各請求項に記載した技術的特徴に関しては、後述する実施形態の説明及び添付図面から明らかになる。   Further, the technical features described in the claims of the claims other than the features described above will become apparent from the description of embodiments and the accompanying drawings described later.

実施形態に係る電子制御装置の構成を示すブロック図である。It is a block diagram which shows the structure of the electronic control apparatus which concerns on embodiment. メモリ保護設定レジスタに設定されたメモリ領域設定用データに基づく、メモリ保護装置によるメモリ保護処理を示すフローチャートである。It is a flowchart which shows the memory protection process by a memory protection apparatus based on the memory area setting data set to the memory protection setting register. エラー制御装置における処理を示すフローチャートである。It is a flowchart which shows the process in an error control apparatus. メモリ保護違反割込みが無効設定に切り替えられる判定処理、及びメモリ保護違反割込みが無効設定された場合の安全処理を示すフローチャートである。It is a flowchart which shows the safety process when the determination process by which a memory protection violation interrupt is switched to an invalid setting, and the memory protection violation interrupt is invalidated. 違反アクセスが発生し、メモリ保護装置にてメモリ保護違反の発生が判定されたときに実行されるエラー処理を示すフローチャートである。10 is a flowchart illustrating error processing that is executed when a violation access occurs and the memory protection device determines that a memory protection violation has occurred. マイコンにおいて実行される各プログラムによる処理の時間的な関係の一例を示したシーケンス図である。It is the sequence diagram which showed an example of the time relationship of the process by each program performed in a microcomputer. メモリ保護違反カウンタ及び無効化時間のリセット処理を示すフローチャートである。It is a flowchart which shows the reset process of a memory protection violation counter and invalidation time.

以下、本発明の実施形態を図に基づいて説明する。本実施形態に係る電子制御装置は、例えば、電子スロットルなどの車載装置を制御するために使用される。図1には、電子スロットル40を制御対象とした場合の電子制御装置(Electronic Control Unit:ECU)10の全体構成の一例を図示している。この場合、ECU10は、アクセルセンサによって検出される運転者のアクセルペダルの操作量に基づき、運転者が求めるエンジン出力を計算し、その計算したエンジン出力が発生するように、電子スロットル40を制御する。   Hereinafter, embodiments of the present invention will be described with reference to the drawings. The electronic control device according to the present embodiment is used to control an in-vehicle device such as an electronic throttle. FIG. 1 illustrates an example of the overall configuration of an electronic control unit (ECU) 10 when the electronic throttle 40 is a control target. In this case, the ECU 10 calculates the engine output required by the driver based on the operation amount of the accelerator pedal of the driver detected by the accelerator sensor, and controls the electronic throttle 40 so that the calculated engine output is generated. .

ただし、本発明に係る電子制御装置の制御対象は、電子スロットルに限られる訳ではなく、他の車載機器を制御対象としても良い。さらに、車載機器以外の機器を制御対象としても良い。   However, the control target of the electronic control device according to the present invention is not limited to the electronic throttle, and other in-vehicle devices may be controlled. Furthermore, devices other than on-vehicle devices may be controlled.

図1において、ECU10は、マイコン12、スロットルモータ駆動回路14、及び監視IC16を備えている。マイコン12は、入力回路34を介してアクセルペダルの操作量を検出するアクセルセンサの検出信号を入力する。そして、入力した検出信号に基づいて、運転者が要求するエンジン出力(エンジントルク)を計算する。マイコン12は、計算したエンジン出力を発生させるように電子スロットル40を制御するべく、出力回路36を介してスロットルモータ駆動回路14に駆動出力を与える。スロットルモータ駆動回路14は、マイコン12から与えられた駆動出力に応じて、スロットルモータ(図示せず)を回転させるための駆動電流を出力する。この駆動電流によりスロットルモータが回転することで、電子スロットル40の開度が変化する。   In FIG. 1, the ECU 10 includes a microcomputer 12, a throttle motor drive circuit 14, and a monitoring IC 16. The microcomputer 12 inputs a detection signal of an accelerator sensor that detects an operation amount of the accelerator pedal via the input circuit 34. Based on the input detection signal, the engine output (engine torque) requested by the driver is calculated. The microcomputer 12 gives a drive output to the throttle motor drive circuit 14 via the output circuit 36 in order to control the electronic throttle 40 so as to generate the calculated engine output. The throttle motor drive circuit 14 outputs a drive current for rotating a throttle motor (not shown) in accordance with the drive output given from the microcomputer 12. As the throttle motor is rotated by this drive current, the opening degree of the electronic throttle 40 changes.

マイコン12は、上述した入力回路34、出力回路36に加えて、CPU20、メモリ保護設定レジスタ22、メモリ保護装置24、メモリ保護違反割込み設定レジスタ26、エラー制御装置28、ROM30、RAM32、及び通信装置38を備えている。CPU20は、ROM30に記憶された各種のプログラムを実行することで、電子スロットル40の開度制御機能、メモリ保護違反が生じたときのエラー処理機能や安全機能などを発揮する。そのため、ROM30には、図1に示すように、少なくとも、電子スロットル40の開度を制御するための制御機能プログラム30A、マイコン12の診断を行ったり、メモリ保護違反が生じたときに、安全を確保するための処置を行ったりする安全機能プログラム30B、エラー制御装置28によるメモリ保護違反割込みが生じたときに実行するエラー処理を規定するエラー処理プログラム30C、及び上述した各アプリケーションプログラムの実行を支援、管理する基本ソフトとしてのOSプログラム30Dが記憶されている。   In addition to the above-described input circuit 34 and output circuit 36, the microcomputer 12 includes a CPU 20, a memory protection setting register 22, a memory protection device 24, a memory protection violation interrupt setting register 26, an error control device 28, a ROM 30, a RAM 32, and a communication device. 38. The CPU 20 executes various programs stored in the ROM 30 to exhibit an opening control function of the electronic throttle 40, an error processing function when a memory protection violation occurs, a safety function, and the like. Therefore, as shown in FIG. 1, the ROM 30 is provided with a safety function when at least a control function program 30A for controlling the opening degree of the electronic throttle 40 and the microcomputer 12 is diagnosed or a memory protection violation occurs. Supports the execution of the safety function program 30B for performing measures for securing, the error processing program 30C for defining error processing to be executed when a memory protection violation interrupt is generated by the error control device 28, and the above-described application programs The OS program 30D as basic software to be managed is stored.

マイコン12に電源が投入されると、CPU20は、OSプログラム30DをROM30から読み込んで実行する。その他のアプリケーションプログラムも、各々の起床条件が成立したときに、CPU20に読み込まれて実行される。それぞれのプログラムが実行されるときに、その実行に必要な各種のデータを保存しておくため、RAM32には、各プログラムに割り当てられた専用領域が設けられている。各プログラムの専用領域は、原則として、別のプログラムによってアクセスすることができないように、メモリ保護装置24が設けられている。   When the microcomputer 12 is powered on, the CPU 20 reads the OS program 30D from the ROM 30 and executes it. Other application programs are also read and executed by the CPU 20 when the respective wake-up conditions are satisfied. In order to save various data necessary for the execution of each program, the RAM 32 is provided with a dedicated area assigned to each program. In principle, the memory protection device 24 is provided so that the dedicated area of each program cannot be accessed by another program.

メモリ保護装置24は、メモリ保護設定レジスタ22に設定されたメモリ領域設定用データに基づき、CPU20によって実行されるプログラムによるメモリアクセス要求に対して、アクセスを許容するか否かを判定する。具体的には、メモリアクセス要求が、アクセスが許可されているメモリ領域に対するものである場合にはアクセスを許容すると判定し、該当するメモリ領域へのアクセスを許可する。一方、メモリアクセス要求が、アクセスが禁止されているメモリ領域に対する違反アクセスであると判定した場合、該当するメモリ領域へのアクセスを禁止するとともに、メモリ保護違反の発生を判定する。これにより、例えば、あるアプリケーションプログラムの実行によって、別のアプリケーションプログラム又はOSプログラムや、それぞれのプログラムによって使用されるデータ等が誤って書き換えられてしまうような事態の発生を防止することができる。   Based on the memory area setting data set in the memory protection setting register 22, the memory protection device 24 determines whether or not to permit access to a memory access request by a program executed by the CPU 20. Specifically, if the memory access request is for a memory area to which access is permitted, it is determined that access is permitted, and access to the corresponding memory area is permitted. On the other hand, when it is determined that the memory access request is a violation access to a memory area for which access is prohibited, access to the corresponding memory area is prohibited and occurrence of a memory protection violation is determined. Accordingly, for example, it is possible to prevent a situation in which another application program or OS program, data used by each program, and the like are erroneously rewritten by executing an application program.

メモリ保護設定レジスタ22に設定されるメモリ領域設定用データは、各アプリケーションプログラムやOSプログラムがアクセス可能なメモリ領域を示すものである。ただし、各プログラムがアクセス不可のメモリ領域をメモリ領域設定用データとしても良い。   The memory area setting data set in the memory protection setting register 22 indicates a memory area accessible by each application program or OS program. However, a memory area that cannot be accessed by each program may be used as memory area setting data.

メモリ保護設定レジスタ22へのメモリ領域設定用データの格納は、OSプログラムによって行われる。例えば、メモリ領域設定用データは、予めプログラム毎にROM30に保存されている。そして、電源が投入されてマイコン12が起動されると、各プログラムのメモリ領域設定用データは、ROM30から読み出されて、RAM32に保存される。OSプログラムは、RAM32から、実行されるプログラムのメモリ領域設定用データを読み出して、メモリ保護設定レジスタ22へ格納する。   Storage of the memory area setting data in the memory protection setting register 22 is performed by the OS program. For example, the memory area setting data is stored in advance in the ROM 30 for each program. When the power is turned on and the microcomputer 12 is activated, the memory area setting data for each program is read from the ROM 30 and stored in the RAM 32. The OS program reads the memory area setting data of the program to be executed from the RAM 32 and stores it in the memory protection setting register 22.

なお、メモリ保護設定レジスタ22は、例えば、複数のレジスタを備えていても良い。この場合、例えば、少なくとも1つのレジスタは、OSプログラムがアクセス可能なメモリ領域を示すメモリ領域設定用データを格納するために使用される。他のレジスタは、アプリケーションプログラムがアクセス可能なメモリ領域を示すメモリ領域設定用データを格納するために使用される。そして、OSプログラムは、実行するアプリケーションプログラムが切り替えられる時に、アプリケーションプログラム用のメモリ領域設定用データを格納するレジスタの内容だけを書き換える。このように、メモリ保護設定レジスタ22として複数のレジスタが設けられていると、メモリ領域設定用データの書き換え頻度を低減することが可能になる。   The memory protection setting register 22 may include a plurality of registers, for example. In this case, for example, at least one register is used to store memory area setting data indicating a memory area accessible by the OS program. The other register is used for storing memory area setting data indicating a memory area accessible by the application program. Then, when the application program to be executed is switched, the OS program rewrites only the contents of the register storing the memory area setting data for the application program. Thus, when a plurality of registers are provided as the memory protection setting register 22, the frequency of rewriting the memory area setting data can be reduced.

また、上述したメモリは、主として、各プログラムのワークスペースとして用いられるRAM32を意味するが、さらに、ROM30やレジスタなどを含むものであっても良い。すなわち、メモリは、RAM32、ROM30、レジスタを含み、これらを、一つのアドレス空間として一括管理されるものであっても良い。   The above-described memory mainly means the RAM 32 used as a work space for each program, but may further include a ROM 30 and a register. That is, the memory may include a RAM 32, a ROM 30, and a register, and these may be collectively managed as one address space.

エラー制御装置28は、メモリ保護装置24がメモリ保護違反の発生を判定し、その旨の通知を受信したとき、メモリ保護違反割込み設定レジスタ26において、メモリ保護違反割込みが有効設定されている場合、CPU20へメモリ保護違反割込みを出力する。一方、メモリ保護違反割込み設定レジスタ26において、メモリ保護違反割込みが無効設定されている場合には、メモリ保護装置24からメモリ保護違反の発生通知を受信しても、メモリ保護違反割込みを出力しない。CPU20は、エラー制御装置28からのメモリ保護違反割込みを受信すると、所定のエラー処理を実行する。この所定のエラー処理として、メモリ保護違反カウンタによってメモリ保護違反の発生回数をカウントするとともに、例えば無限ループ処理を実行することでマイコン12の出力回路36から監視IC16へのウォッチドッグ信号の出力を停止させる処理を行う。   When the memory protection device 24 determines that the memory protection violation has occurred and receives a notification to that effect, the error control device 28 determines that the memory protection violation interrupt is enabled in the memory protection violation interrupt setting register 26. A memory protection violation interrupt is output to the CPU 20. On the other hand, if the memory protection violation interrupt is disabled in the memory protection violation interrupt setting register 26, the memory protection violation interrupt is not output even if the memory protection violation occurrence notification is received from the memory protection device 24. When the CPU 20 receives a memory protection violation interrupt from the error control device 28, the CPU 20 executes predetermined error processing. As this predetermined error processing, the memory protection violation counter counts the number of occurrences of memory protection violations and, for example, the output of the watchdog signal from the output circuit 36 of the microcomputer 12 to the monitoring IC 16 is stopped by executing infinite loop processing. To perform the process.

マイコン12の監視IC16は、マイコン12から所定時間、ウォッチドッグ信号が出力されない場合、マイコン12に対してリセット信号を出力する。このため、メモリ保護違反割込みが有効と設定されている場合には、メモリ保護装置24がメモリ保護違反の発生を判定するごとに、マイコン12がリセットされることになる。なお、メモリ保護違反割込みに応じて、従来と同様に、現行のプロセスを終了(命令の破棄)させて、次のプロセスに遷移したり、OSをリスタートさせたりするようにしても良い。   The monitoring IC 16 of the microcomputer 12 outputs a reset signal to the microcomputer 12 when no watchdog signal is output from the microcomputer 12 for a predetermined time. For this reason, when the memory protection violation interrupt is set to be valid, the microcomputer 12 is reset every time the memory protection device 24 determines the occurrence of the memory protection violation. In response to a memory protection violation interrupt, the current process may be terminated (discarding the instruction) and the process may be shifted to the next process, or the OS may be restarted, as in the past.

しかしながら、メモリ保護違反の発生原因がプログラムのバグなど恒久的な異常によるものである場合、マイコン12をリセットしても、メモリ保護違反割込みが繰り返され、実質的に、マイコン12による制御を継続することが困難になる可能性がある。また、メモリ保護違反割込みに応じて、現行のプロセスを終了させて次のプロセスに遷移したり、OSをリスタートさせたりする場合には、プログラムを正常に継続することができなくなる可能性が高い。   However, if the cause of the memory protection violation is due to a permanent abnormality such as a bug in the program, even if the microcomputer 12 is reset, the memory protection violation interrupt is repeated and the control by the microcomputer 12 is substantially continued. Can be difficult. Also, if the current process is terminated and transitioned to the next process or the OS is restarted in response to a memory protection violation interrupt, there is a high possibility that the program cannot continue normally. .

そこで、本実施形態では、上述したように、メモリ保護違反割込み設定レジスタ26を設けて、メモリ保護違反割込みを無効と設定することができるようにした。メモリ保護違反割込み設定レジスタ26において、メモリ保護違反割込みが無効と設定されている場合には、メモリ保護装置24からメモリ保護違反の発生通知を受信しても、エラー制御装置28はメモリ保護違反割込みを発生しないようになっている。このため、マイコン12がリセットされたり、現行のプロセスが終了されたり、OSプログラムがリスタートされたりすることなく、プログラムの実行を継続することが可能になる。この場合、メモリ保護違反割込みは無効化されるが、メモリ保護装置24による、アクセスが認められたメモリ領域外への違反アクセスは継続して禁止される。このため、データが不当に書き込まれたり、読み出されたりすることはなく、安全にプログラムの実行を継続させることができる。   Therefore, in this embodiment, as described above, the memory protection violation interrupt setting register 26 is provided so that the memory protection violation interrupt can be set to invalid. In the memory protection violation interrupt setting register 26, if the memory protection violation interrupt is set to be invalid, the error control device 28 will receive the memory protection violation interrupt even if the memory protection violation occurrence notification is received from the memory protection device 24. Is supposed not to occur. Therefore, it is possible to continue the execution of the program without resetting the microcomputer 12, ending the current process, or restarting the OS program. In this case, the memory protection violation interrupt is invalidated, but the violation access to the outside of the memory area permitted to be accessed by the memory protection device 24 is continuously prohibited. For this reason, data is not illegally written or read, and execution of the program can be safely continued.

上述したメモリ保護の他にも、例えば、CPU20は、安全機能プログラム30Bを実行することにより、マイコン12が正常に動作しているかを確認するための診断処理を行う。この診断処理による診断結果は、通信装置38を介して、監視IC16に送信される。監視IC16は、診断結果に基づき、電子スロットル40に対する制御を正常に実行することができないような重大な異常が発生していると判定した場合、スロットルモータ駆動回路14に対して、シャットダウン出力を与える。スロットルモータ駆動回路14は、シャットダウン出力が与えられると、電子スロットル40を駆動するスロットルモータへの駆動電流を停止する。これにより、マイコン12の異常により電子スロットル40の動作異常が生じて、不測の事態を招くことを未然に防ぐことができる。   In addition to the above-described memory protection, for example, the CPU 20 performs a diagnostic process for confirming whether the microcomputer 12 is operating normally by executing the safety function program 30B. The diagnosis result by this diagnosis processing is transmitted to the monitoring IC 16 via the communication device 38. The monitoring IC 16 gives a shutdown output to the throttle motor drive circuit 14 when it is determined based on the diagnosis result that a serious abnormality has occurred that prevents the control of the electronic throttle 40 from being executed normally. . When a shutdown output is given, the throttle motor drive circuit 14 stops the drive current to the throttle motor that drives the electronic throttle 40. As a result, it is possible to prevent an unexpected situation from occurring due to an abnormal operation of the electronic throttle 40 due to an abnormality in the microcomputer 12.

本実施形態では、マイコン12の出力回路36からも、スロットルモータ駆動回路14に対してシャットダウン出力を与えることができるように構成されている。マイコン12が、出力回路36を介して、スロットルモータ駆動回路14にシャットダウン出力を与えるのは、例えば、次のような場合である。マイコン12は、メモリ保護違反割込み設定レジスタ26により、メモリ保護違反割込みの発生を無効化してからの無効化時間を計測する。そして、計測された無効化時間が所定時間に達したときに、出力回路36からスロットルモータ駆動回路14へシャットダウン出力を与える。   In the present embodiment, the output circuit 36 of the microcomputer 12 is also configured to provide a shutdown output to the throttle motor drive circuit 14. The microcomputer 12 gives a shutdown output to the throttle motor drive circuit 14 via the output circuit 36 in the following cases, for example. The microcomputer 12 uses the memory protection violation interrupt setting register 26 to measure the invalidation time after invalidating the occurrence of the memory protection violation interrupt. When the measured invalidation time reaches a predetermined time, a shutdown output is given from the output circuit 36 to the throttle motor drive circuit 14.

メモリ保護違反割込みの発生を無効化すると、違反アクセスによるメモリへのアクセスは禁止されるが、違反アクセスそのものが継続して発生可能な状況となり得る。このような状況のまま、無制限にプログラムの実行を継続すると、万一、メモリ保護装置24に故障が生じた場合、メモリへの違反アクセスを禁止することができず、不測の事態を招く虞がある。そのため、上述したように、メモリ保護違反割込みの発生を無効化してからの無効化時間が所定時間に達した時に、出力回路36からスロットルモータ駆動回路14にシャットダウン出力を与えるようにして、電子スロットル40への駆動電流を停止するのである。   When the generation of the memory protection violation interrupt is invalidated, access to the memory by the violation access is prohibited, but the violation access itself can be continuously generated. If the program execution is continued without limitation in such a situation, in the unlikely event that a failure occurs in the memory protection device 24, violation access to the memory cannot be prohibited, and an unexpected situation may occur. is there. Therefore, as described above, when the invalidation time after the occurrence of the memory protection violation interrupt is invalidated reaches a predetermined time, a shutdown output is given from the output circuit 36 to the throttle motor drive circuit 14 so that the electronic throttle The drive current to 40 is stopped.

次に、メモリ保護に関して、マイコン12のCPU20等において実行される処理について、図2〜5のフローチャートを参照して説明する。なお、図2のフローチャートは、メモリ保護設定レジスタ22に設定されたメモリ領域設定用データに基づく、メモリ保護装置24によるメモリ保護処理を示している。図3のフローチャートは、エラー制御装置28における処理を示している。図4のフローチャートは、メモリ保護違反割込みが無効設定に切り替えられる判定処理、及びメモリ保護違反割込みが無効設定された場合の安全処理を示している。さらに、図5のフローチャートは、エラー制御装置28によってメモリ保護違反割込みが発生されたときに実行されるエラー処理を示している。   Next, regarding memory protection, processing executed by the CPU 20 of the microcomputer 12 will be described with reference to the flowcharts of FIGS. The flowchart of FIG. 2 shows a memory protection process by the memory protection device 24 based on the memory area setting data set in the memory protection setting register 22. The flowchart in FIG. 3 shows processing in the error control device 28. The flowchart of FIG. 4 shows a determination process in which the memory protection violation interrupt is switched to the invalid setting, and a safety process in the case where the memory protection violation interrupt is invalidated. Further, the flowchart of FIG. 5 shows error processing that is executed when a memory protection violation interrupt is generated by the error control device 28.

図2のフローチャートにおいて、まず、ステップS100では、メモリ保護装置24はメモリへのアクセス要求を受信する。このメモリアクセス要求には、例えば、アクセスしようとしているメモリのアドレス、メモリアクセス要求を出したプログラムの種類、メモリに対する処理内容(読み出し、書き込み)を示す情報が含まれている。   In the flowchart of FIG. 2, first, in step S100, the memory protection device 24 receives an access request to the memory. This memory access request includes, for example, information indicating the address of the memory to be accessed, the type of program that issued the memory access request, and the processing contents (reading and writing) to the memory.

メモリ保護装置24は、ステップS110において、実行中のプログラムがアクセスしようとしているメモリのアドレスが、メモリ保護設定レジスタ22に設定されたアドレス範囲に含まれる正常アクセスであるか、それともアドレス範囲に含まれない違反アクセスであるかを判定する。なお、メモリ保護設定レジスタ22へのメモリ領域設定用データの格納は、実行されるプログラムが切り替えられるときに、OSプログラムによって行われている。そのため、メモリ保護装置24は、メモリへのアクセス要求を受信したときに、メモリ保護設定レジスタ22の内容を参照することで、正常アクセスであるか、違反アクセスであるかを判定することができる。   In step S110, the memory protection device 24 determines whether the address of the memory to be accessed by the program being executed is a normal access included in the address range set in the memory protection setting register 22, or is included in the address range. Determine if there is no violation access. Note that storage of memory area setting data in the memory protection setting register 22 is performed by the OS program when the program to be executed is switched. Therefore, when the memory protection device 24 receives an access request to the memory, the memory protection device 24 can determine whether the access is normal access or violation access by referring to the contents of the memory protection setting register 22.

ステップS110の判定処理において、正常アクセスであると判定した場合には、ステップS120の処理に進んで、メモリへのアクセスを許可する。一方、ステップS110の判定処理において、違反アクセスであると判定した場合には、ステップS130の処理に進んで、メモリへのアクセスを禁止する。さらに、続くステップS140において、メモリ保護違反が発生した旨をエラー制御装置28に通知する。なお、正常アクセスであるか違反アクセスであるかを判定する際、アクセスしようとしているメモリ領域のみでなく、メモリに対する処理内容も考慮するようにしても良い。   If it is determined in step S110 that the access is normal, the process proceeds to step S120 to permit access to the memory. On the other hand, if it is determined in step S110 that the access is a violation, the process proceeds to step S130 to prohibit access to the memory. In step S140, the error control device 28 is notified that a memory protection violation has occurred. When determining whether the access is normal access or illegal access, not only the memory area to be accessed but also the processing contents for the memory may be considered.

次に、エラー制御装置28における処理を図3のフローチャートに基づき説明する。図3のフローチャートでは、まず、ステップS200において、メモリ保護装置24からメモリ保護違反の発生通知を受信したか否かを判定する。受信したと判定した場合、ステップS210の処理に進み、受信していないと判定した場合には、再度ステップS200の処理を実行することで、メモリ保護違反発生通知の受信を待機する。   Next, processing in the error control device 28 will be described based on the flowchart of FIG. In the flowchart of FIG. 3, first, in step S <b> 200, it is determined whether a notification of occurrence of memory protection violation is received from the memory protection device 24. If it is determined that it has been received, the process proceeds to step S210. If it is determined that it has not been received, the process of step S200 is executed again to wait for reception of a memory protection violation occurrence notification.

ステップS210では、メモリ保護違反割込み設定レジスタ26の設定が、違反割込みを有効とする設定となっているか、無効とする設定となっているかを判定する。この判定処理において、違反割込みを有効とする設定となっていると判定すると、ステップS220において、エラー制御装置28はメモリ保護違反割込みを発生する。一方、違反割込みを無効とする設定となっていると判定した場合には、メモリ保護違反割込みを発生することなく、処理を一旦終了する。   In step S210, it is determined whether the setting of the memory protection violation interrupt setting register 26 is set to enable or disable the violation interrupt. In this determination process, if it is determined that the violation interrupt is set to be valid, the error control device 28 generates a memory protection violation interrupt in step S220. On the other hand, if it is determined that the violation interrupt is set to be invalid, the processing is temporarily terminated without generating a memory protection violation interrupt.

次に、図4のフローチャートについて説明する。この図4のフローチャートに示す処理は、所定の周期で繰り返し実行される。まず、ステップS300において、メモリ保護違反カウンタのカウント値が所定値以下であるか否かを判定する。メモリ保護違反カウンタは、後述する図5のフローチャートのステップS300において、インクリメントされるものであり、図5のフローチャートは、エラー制御装置28によってメモリ保護違反割込みが発生された場合に実行されるものである。このため、メモリ保護違反カウンタのカウント値は、違反アクセスの回数、すなわちメモリ保護違反の発生回数を示すものとなる。   Next, the flowchart of FIG. 4 will be described. The process shown in the flowchart of FIG. 4 is repeatedly executed at a predetermined cycle. First, in step S300, it is determined whether or not the count value of the memory protection violation counter is equal to or less than a predetermined value. The memory protection violation counter is incremented in step S300 of the flowchart of FIG. 5 described later. The flowchart of FIG. 5 is executed when a memory protection violation interrupt is generated by the error control device 28. is there. For this reason, the count value of the memory protection violation counter indicates the number of violation accesses, that is, the number of occurrences of memory protection violations.

ステップS300において、メモリ保護違反カウンタのカウント値が所定値以下であると判定すると、ステップS310の処理に進んで、メモリ保護違反割込み設定レジスタ26における設定として、メモリ保護違反割込みは有効と設定する。一方、メモリ保護違反カウンタのカウント値が所定値より大きいと判定すると、ステップS320の処理に進んで、メモリ保護違反割込みは無効と設定する。従って、メモリ保護違反の発生回数が所定値以下である間は、メモリ保護違反割込みは有効であり、メモリ保護違反の発生の都度、メモリ保護違反割込みが発生する。しかし、メモリ保護違反の発生回数が所定値より大きくなると、メモリ保護違反割込みが無効化されるため、メモリ保護違反が生じても、メモリ保護違反割込みは発生しなくなる。   If it is determined in step S300 that the count value of the memory protection violation counter is equal to or less than the predetermined value, the process proceeds to step S310, and the memory protection violation interrupt is set as valid as the setting in the memory protection violation interrupt setting register 26. On the other hand, if it is determined that the count value of the memory protection violation counter is larger than the predetermined value, the process proceeds to step S320, and the memory protection violation interrupt is set to invalid. Therefore, while the number of occurrences of memory protection violation is equal to or less than the predetermined value, the memory protection violation interrupt is valid, and a memory protection violation interrupt occurs every time a memory protection violation occurs. However, when the number of occurrences of memory protection violations exceeds a predetermined value, the memory protection violation interrupt is invalidated, so that even if a memory protection violation occurs, the memory protection violation interrupt does not occur.

続くステップS330では、例えば、運転者前方のメータパネル内に設けられた警告灯を点灯することにより、メモリ保護違反が継続的に発生する異常が生じていることを運転者に報知する。ただし、警告灯が点灯した段階では、メモリ保護違反割込みは無効化されているが、メモリ保護装置24によるメモリ保護機能は有効に作動しており、メモリ内のデータが不当に書き換えられたりされることはなく、安全に制御を継続することができる。   In the subsequent step S330, for example, a warning lamp provided in a meter panel in front of the driver is turned on to notify the driver that an abnormality that continuously causes memory protection violation has occurred. However, when the warning light is turned on, the memory protection violation interrupt is invalidated, but the memory protection function by the memory protection device 24 is operating effectively, and the data in the memory is illegally rewritten. It is possible to continue the control safely.

続くステップS340では、メモリ保護違反割込みの無効設定後の無効化時間を計測する。そして、ステップS350において、無効化時間が所定時間よりも長くなったか否かを判定する。無効化時間が所定時間よりも長くなったと判定した場合には、ステップS360の処理に進み、出力回路36を介して、スロットルモータ駆動回路14へシャットダウン出力を与える。これにより、メモリ保護違反割込みを無効化した後に、メモリ保護装置24に故障が生じて、違反アクセスを禁止することができず、不測の事態を招いてしまう虞を低減することができる。この際、ステップS330の警告灯とは異なる警告灯を点灯したり、もしくは警告灯を点灯する態様を異ならせたりすることにより、運転者に対し、ECU10が制御対象への制御を停止したことを報知することが望ましい。   In the subsequent step S340, the invalidation time after invalid setting of the memory protection violation interrupt is measured. In step S350, it is determined whether the invalidation time is longer than a predetermined time. If it is determined that the invalidation time is longer than the predetermined time, the process proceeds to step S360, and a shutdown output is given to the throttle motor drive circuit 14 via the output circuit 36. Thereby, after invalidating the memory protection violation interrupt, it is possible to reduce a possibility that a failure occurs in the memory protection device 24 and the violation access cannot be prohibited, thereby causing an unexpected situation. At this time, by turning on a warning light that is different from the warning light in step S330 or by changing the manner in which the warning light is turned on, the fact that the ECU 10 has stopped controlling the control target is indicated to the driver. It is desirable to notify.

メモリ保護違反割込みの発生時に実行される図5のフローチャートに示す処理では、ステップS400において、メモリ保護違反カウンタをインクリメントする。さらに、ステップS410で、例えば無限ループ処理を実行することにより、ウォッチドッグ信号の出力を停止させる。これにより、監視IC16からのマイコンリセット信号によってマイコン12がリセットされるので、メモリアクセス違反が一時的な原因によって生じた場合には、以後、メモリアクセス違反が発生しないようにマイコン12を正常化することができる。   In the process shown in the flowchart of FIG. 5 that is executed when a memory protection violation interrupt occurs, the memory protection violation counter is incremented in step S400. Further, in step S410, the output of the watchdog signal is stopped by executing, for example, an infinite loop process. Thereby, since the microcomputer 12 is reset by the microcomputer reset signal from the monitoring IC 16, if the memory access violation occurs due to a temporary cause, the microcomputer 12 is normalized so that the memory access violation does not occur thereafter. be able to.

しかし、メモリアクセス違反が恒久的な原因によって生じた場合には、マイコン12のリセットが繰り返され、実質的に、マイコン12が制御を継続することができなくなってしまう。その点、本実施形態では、ステップS210において、メモリ保護違反割込みは無効に設定されていると判定した場合には、メモリ保護違反割込みを発生することなく、図3のフローチャートの処理を一旦終了する。このため、ECU10は、メモリ保護違反が発生しても、制御対象に対する制御を継続することが可能となる。   However, if the memory access violation occurs due to a permanent cause, the microcomputer 12 is repeatedly reset, and the microcomputer 12 cannot substantially continue control. In this regard, in this embodiment, if it is determined in step S210 that the memory protection violation interrupt is set to be invalid, the processing of the flowchart of FIG. 3 is temporarily terminated without generating a memory protection violation interrupt. . For this reason, the ECU 10 can continue to control the controlled object even if a memory protection violation occurs.

図6は、マイコン12において実行される各プログラムによる処理の時間的な関係の一例を示したシーケンス図である。図6に示される例によれば、OSプログラムが、メモリ保護違反カウンタのカウント値に基づき、メモリ保護違反割込みの有効もしくは無効を設定した後、制御機能プログラムを呼び出して起動する。この制御機能プログラムの実行中にメモリ保護違反が発生すると、メモリ保護違反割込みが有効設定されている場合には、エラー制御装置28によりメモリ保護違反割込みが発生される。このメモリ保護違反割込みにより、制御機能プログラムは実行を中断されるとともに、エラー処理が開始される。具体的には、メモリ保護違反カウンタをインクリメントし、さらに、ウォッチドッグ信号を停止するための処理を実施する。これにより、ウォッチドッグ信号が停止されるので、マイコン12は監視IC16によってリセットされる。   FIG. 6 is a sequence diagram showing an example of a temporal relationship of processing by each program executed in the microcomputer 12. According to the example shown in FIG. 6, the OS program sets the memory protection violation interrupt valid or invalid based on the count value of the memory protection violation counter, and then calls and starts the control function program. If a memory protection violation occurs during execution of this control function program, a memory protection violation interrupt is generated by the error control device 28 if the memory protection violation interrupt is enabled. Due to this memory protection violation interrupt, execution of the control function program is interrupted and error processing is started. Specifically, the memory protection violation counter is incremented, and processing for stopping the watchdog signal is performed. As a result, the watchdog signal is stopped, and the microcomputer 12 is reset by the monitoring IC 16.

マイコン12がリセットにより再起動されると、OSプログラムが起動することで、ウォッチドッグ信号が定期的に出力されるようになる(ウォッチドッグ信号の活性化)。そして、OSプログラムは、安全機能プログラムを呼び出して起動する。安全機能プログラムは、マイコン12が正常に動作しているか否かに関する診断を行い、その診断結果を監視IC16に出力する。監視IC16は、診断結果が重大な故障を示す場合、スロットルモータ駆動回路14にシャットダウン出力を与える。   When the microcomputer 12 is restarted by reset, the OS program is started so that a watchdog signal is periodically output (activation of the watchdog signal). Then, the OS program calls and starts the safety function program. The safety function program diagnoses whether or not the microcomputer 12 is operating normally, and outputs the diagnosis result to the monitoring IC 16. The monitoring IC 16 gives a shutdown output to the throttle motor drive circuit 14 when the diagnosis result indicates a serious failure.

また、安全機能プログラムは、メモリ保護違反カウンタのカウント値が所定値より大きい場合、すなわち、メモリ保護違反割込みが無効設定されている場合、メモリ保護違反割込みの無効化時間を計測するとともに、警告灯を点灯する処理を行う。そして、無効化時間が所定時間よりも長くなったと判定すると、出力回路36を介して、スロットルモータ駆動回路14にシャットダウン出力を与える。   In addition, when the count value of the memory protection violation counter is larger than the predetermined value, that is, when the memory protection violation interrupt is disabled, the safety function program measures the invalidation time of the memory protection violation interrupt and displays a warning lamp. The process of lighting is performed. When it is determined that the invalidation time is longer than the predetermined time, a shutdown output is given to the throttle motor drive circuit 14 via the output circuit 36.

次に、図7のフローチャートを参照して、メモリ保護違反カウンタ及び無効化時間のリセット処理について説明する。図7のフローチャートに示すリセット処理は、車両のイグニッションスイッチがオフされたことが検出されたときに実行される。すなわち、イグニッションスイッチのオンからオフまでを1ドライビングサイクルとすると、図7のフローチャートに示すリセット処理は、各ドライビングサイクルの終了時に実行される。   Next, the memory protection violation counter and invalidation time reset processing will be described with reference to the flowchart of FIG. The reset process shown in the flowchart of FIG. 7 is executed when it is detected that the ignition switch of the vehicle has been turned off. That is, assuming that one ignition cycle is from on to off of the ignition switch, the reset process shown in the flowchart of FIG. 7 is executed at the end of each driving cycle.

まず、最初のステップS500では、ドライビングサイクルの終了に合わせて、ドライビングサイクルの更新処理を行う。続くステップS510では、前回のドライビングサイクルにて記憶されたメモリ保護違反カウンタのカウント値を読み出す。なお、メモリ保護違反カウンタのカウント値は、対応するドライビングサイクルと関連付けて、イグニッションスイッチがオフされた後も、記憶内容を保持可能な不揮発性メモリや電源バックアップされたRAM等に保存されている。   First, in the first step S500, a driving cycle update process is performed at the end of the driving cycle. In subsequent step S510, the count value of the memory protection violation counter stored in the previous driving cycle is read. Note that the count value of the memory protection violation counter is stored in a non-volatile memory capable of holding stored contents or a power-backed RAM in association with the corresponding driving cycle even after the ignition switch is turned off.

続くステップS520では、現在のメモリ保護違反カウンタのカウント値を読み出す。そして、ステップS530において、前回のドライビングサイクルで記憶されたメモリ保護違反カウンタのカウント値と、現在のメモリ保護違反カウンタのカウント値とを比較して、両カウント値が同じであるか否かを判定する。メモリ保護違反カウンタは、上述した図5のフローチャートのステップS400でインクリメントされるか、後述するステップS540にてゼロクリアされるまでは、イグニッションスイッチのオン、オフに係わらず、カウント値を維持する。従って、ステップS530の判定処理において、両カウント値が同じである場合、今回のドライビングサイクルでは、メモリ保護違反は発生しておらず、メモリ保護違反に関する異常は正常復帰したとみなすことができる。そのため、ステップS540に進んで、メモリ保護違反カウンタのカウント値及び無効化時間をゼロクリアする。一方、両カウント値が異なる場合、すなわち、記憶されたカウント値よりも現行のカウント値が大きい場合、ステップS550に進んで、現在のカウント値を更新されたドライビングサイクルに関連付けて保存する。   In subsequent step S520, the current count value of the memory protection violation counter is read. In step S530, the count value of the memory protection violation counter stored in the previous driving cycle is compared with the count value of the current memory protection violation counter to determine whether or not both count values are the same. To do. The memory protection violation counter maintains the count value regardless of whether the ignition switch is turned on or off until it is incremented at step S400 in the flowchart of FIG. 5 described above or cleared to zero at step S540 described later. Therefore, if both count values are the same in the determination process of step S530, it can be considered that a memory protection violation has not occurred in the current driving cycle, and an abnormality related to the memory protection violation has returned to normal. Therefore, the process proceeds to step S540, and the count value and invalidation time of the memory protection violation counter are cleared to zero. On the other hand, if both count values are different, that is, if the current count value is larger than the stored count value, the process proceeds to step S550, and the current count value is stored in association with the updated driving cycle.

なお、イグニッションスイッチがオンされて、今回のドライビングサイクルが開始されるときに、初期化処理の一環として、メモリ保護違反割込みが有効設定される。そのため、今回のドライビングサイクルにおいて、メモリ保護違反が発生すると、メモリ保護違反割込みによるエラー処理が実行され、メモリ保護違反カウンタのカウント値がインクリメントされる。一方、今回のドライビングサイクルにてメモリ保護違反が発生していなければ、メモリ保護違反カウンタのカウント値は、前回のドライビングサイクルで記憶されたメモリ保護違反カウンタのカウント値と同一値を維持する。   Note that when the ignition switch is turned on and the current driving cycle is started, the memory protection violation interrupt is enabled as part of the initialization process. For this reason, if a memory protection violation occurs in the current driving cycle, error processing by a memory protection violation interrupt is executed, and the count value of the memory protection violation counter is incremented. On the other hand, if no memory protection violation has occurred in the current driving cycle, the count value of the memory protection violation counter remains the same as the count value of the memory protection violation counter stored in the previous driving cycle.

また、初期化処理の一環として、メモリ保護違反割込みを有効設定した後、少なくとも1回、メモリ保護違反の発生が判定されるまでは、メモリ保護違反カウンタのカウント値に基づく、メモリ保護違反割込みの有効、無効の設定の切り替えは、行われないようになっている。これにより、前回のドライビングサイクルにおいて、メモリ保護違反割込みが無効設定されるまで、メモリ保護違反カウンタのカウント値がインクリメントされていても、今回のドライビングサイクルにおいて、少なくとも1回は、メモリ保護違反カウンタにより、メモリ保護違反の発生をカウントすることができる。   Also, as part of the initialization process, after enabling memory protection violation interrupts, the memory protection violation interrupt based on the count value of the memory protection violation counter is determined at least once until the occurrence of a memory protection violation is determined. Switching between valid and invalid settings is not performed. Thus, even if the count value of the memory protection violation counter is incremented until the memory protection violation interrupt is disabled in the previous driving cycle, at least once in the current driving cycle, the memory protection violation counter The occurrence of memory protection violations can be counted.

以上、本発明の好ましい実施形態について説明した。しかしながら、本発明は、上述した実施形態に何ら制限されることはなく、本発明の趣旨を逸脱しない範囲において、種々の変形が可能である。   The preferred embodiments of the present invention have been described above. However, the present invention is not limited to the embodiments described above, and various modifications can be made without departing from the spirit of the present invention.

例えば、上述した実施形態において、スロットルモータ駆動回路14にシャットダウン出力を与えるタイミングを判定するために、無効化時間と比較される所定時間は、一定時間であっても良いし、可変時間であっても良い。所定時間を可変時間とする場合には、例えばメモリ保護違反割込みの発生時間間隔に応じて、所定時間の長さを可変することができる。具体的には、メモリ保護違反割込みが発生する間隔を測定する間隔測定部を設け、この間隔測定部が測定するメモリ保護違反割込みの発生間隔の平均値が長くなるほど、無効化時間と比較される所定時間が長くなるように設定すれば良い。   For example, in the above-described embodiment, the predetermined time compared with the invalidation time may be a fixed time or a variable time in order to determine the timing for giving the shutdown output to the throttle motor drive circuit 14. Also good. In the case where the predetermined time is a variable time, the length of the predetermined time can be varied according to, for example, the occurrence time interval of the memory protection violation interrupt. Specifically, an interval measurement unit that measures the interval at which a memory protection violation interrupt occurs is provided, and the average value of the occurrence intervals of memory protection violation interrupts measured by this interval measurement unit is compared with the invalidation time. What is necessary is just to set so that predetermined time may become long.

また、上述した実施形態では、前回のドライビングサイクルの終了時点のメモリ保護違反カウンタのカウンタ値を記憶しておき、今回のドライビングサイクルの終了時点のメモリ保護違反カウンタのカウンタ値と比較して、メモリ保護違反に関する異常が回復したか否かを判定するものであった。しかしながら、今回のドライビングサイクルにおいて、メモリ保護違反カウンタのカウント値を測定するタイミング(第2のタイミング)は、今回のドライビングサイクルが開始された後に、メモリ保護違反を発生したプログラムが少なくとも1回実行されるに十分な間隔を確保できるタイミングであれば良く、必ずしも、今回のドライビングサイクルの終了時点でなくとも良い。   In the above-described embodiment, the counter value of the memory protection violation counter at the end of the previous driving cycle is stored, and compared with the counter value of the memory protection violation counter at the end of the current driving cycle, It was determined whether or not the abnormality related to the protection violation was recovered. However, in the current driving cycle, the timing at which the count value of the memory protection violation counter is measured (second timing) is executed at least once after the start of the current driving cycle. In other words, the timing may be a timing at which a sufficient interval can be secured, and does not necessarily have to be at the end of the current driving cycle.

10 電子制御装置(ECU)
12 マイコン
14 スロットルモータ駆動回路
16 監視IC
20 CPU
22 メモリ保護設定レジスタ
24 メモリ保護装置
26 メモリ保護違反割込み設定レジスタ
28 エラー制御装置
30 ROM
32 RAM
10 Electronic control unit (ECU)
12 Microcomputer 14 Throttle motor drive circuit 16 Monitoring IC
20 CPU
22 Memory Protection Setting Register 24 Memory Protection Device 26 Memory Protection Violation Interrupt Setting Register 28 Error Control Device 30 ROM
32 RAM

Claims (5)

アクセスが認められたメモリ領域外へのアクセスを違反アクセスとして禁止するとともに、前記違反アクセスが生じた場合にメモリ保護違反割込みを発生させるメモリ保護部(22、24、28)を有するマイコン(12)を備えた電子制御装置において、
前記違反アクセスの回数をカウントするカウント部(S400)と、
前記カウント部によってカウントされた回数が所定回数以上となった場合に、前記メモリ保護違反割込みの発生を無効化する無効化部(S300、S320)と、を備える電子制御装置。
Microcomputer (12) having a memory protection unit (22, 24, 28) that prohibits access outside the memory area where access is permitted as a violation access and generates a memory protection violation interrupt when the violation access occurs In an electronic control device comprising:
A counting unit (S400) for counting the number of violation accesses;
An electronic control device comprising: an invalidating unit (S300, S320) for invalidating the occurrence of the memory protection violation interrupt when the number of times counted by the counting unit exceeds a predetermined number.
前記電子制御装置は、所定の制御対象に制御信号を出力して制御するものであり、
前記無効化部によって前記メモリ保護違反割込みの発生を無効化してからの無効化時間を計測する計測部(S340)と、
前記計測部により計測される無効化時間が所定時間に達したとき、前記制御対象への前記制御信号の出力を遮断する遮断部(S350、S360)と、を備える請求項1に記載の電子制御装置。
The electronic control device is for controlling a predetermined control target by outputting a control signal,
A measurement unit (S340) for measuring an invalidation time after invalidating the occurrence of the memory protection violation interrupt by the invalidation unit;
The electronic control according to claim 1, further comprising: a blocking unit (S350, S360) that blocks output of the control signal to the control target when the invalidation time measured by the measuring unit reaches a predetermined time. apparatus.
前記電子制御装置は、車両に搭載された車載機器を制御するものであり、
前記車両のイグニッションスイッチがオフされる第1のタイミングにおいて、前記カウント部によってカウントされている前記違反アクセスの回数を保存する保存部(S550)と、
前記車両のイグニッションスイッチがオンされた後の第2のタイミングにおいて、前記カウント部によってカウントされている前記違反アクセスの回数を読み出して、前記保存部に保存されている回数と比較した結果、前記違反アクセスの回数に変化がない場合、前記カウント部によりカウントされた回数をリセットするリセット部(S520、S530、S540)と、を備える請求項1に記載の電子制御装置。
The electronic control device controls an in-vehicle device mounted on a vehicle,
A storage unit (S550) for storing the number of violation accesses counted by the counting unit at a first timing when the ignition switch of the vehicle is turned off;
At a second timing after the ignition switch of the vehicle is turned on, the number of violation accesses counted by the counting unit is read out and compared with the number of times stored in the storage unit. The electronic control device according to claim 1, further comprising: a reset unit (S520, S530, S540) that resets the number of times counted by the count unit when there is no change in the number of accesses.
前記電子制御装置は、車両に搭載された車載機器を制御するものであり、
前記車両のイグニッションスイッチがオフされる第1のタイミングにおいて、前記カウント部によってカウントされている前記違反アクセスの回数を保存する保存部(S550)と、
前記車両のイグニッションスイッチがオンされた後の第2のタイミングにおいて、前記カウント部によってカウントされている前記違反アクセスの回数を読み出して、前記保存部に保存されている回数と比較した結果、前記違反アクセスの回数に変化がない場合、前記カウント部によりカウントされた回数及び前記計測部により計測された無効化時間をリセットするリセット部(S520、S530、S540)と、を備える請求項2に記載の電子制御装置。
The electronic control device controls an in-vehicle device mounted on a vehicle,
A storage unit (S550) for storing the number of violation accesses counted by the counting unit at a first timing when the ignition switch of the vehicle is turned off;
At a second timing after the ignition switch of the vehicle is turned on, the number of violation accesses counted by the counting unit is read out and compared with the number of times stored in the storage unit. The reset part (S520, S530, S540) which resets the invalidation time measured by the frequency | count counted by the said count part and the said measurement part, when there is no change in the frequency | count of access. Electronic control device.
前記メモリ保護違反割込みが発生する間隔を測定する間隔測定部を備え、
前記遮断部は、前記間隔測定部が測定する間隔の平均値が長くなるほど、前記無効化時間と比較される前記所定時間を長く設定する請求項2又は4に記載の電子制御装置。
An interval measuring unit for measuring an interval at which the memory protection violation interrupt occurs;
5. The electronic control device according to claim 2, wherein the blocking unit sets the predetermined time to be compared with the invalidation time longer as an average value of the interval measured by the interval measuring unit becomes longer.
JP2016147634A 2016-07-27 2016-07-27 Electronic control unit Active JP6589767B2 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
JP2016147634A JP6589767B2 (en) 2016-07-27 2016-07-27 Electronic control unit
DE102017211568.8A DE102017211568B4 (en) 2016-07-27 2017-07-06 ELECTRONIC CONTROL UNIT

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2016147634A JP6589767B2 (en) 2016-07-27 2016-07-27 Electronic control unit

Publications (2)

Publication Number Publication Date
JP2018018274A JP2018018274A (en) 2018-02-01
JP6589767B2 true JP6589767B2 (en) 2019-10-16

Family

ID=60951528

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2016147634A Active JP6589767B2 (en) 2016-07-27 2016-07-27 Electronic control unit

Country Status (2)

Country Link
JP (1) JP6589767B2 (en)
DE (1) DE102017211568B4 (en)

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006235924A (en) * 2005-02-24 2006-09-07 Denso Corp Electronic control device for detecting execution address abnormality of program
US8566940B1 (en) 2009-11-25 2013-10-22 Micron Technology, Inc. Authenticated operations and event counters
JP5942778B2 (en) * 2012-10-22 2016-06-29 トヨタ自動車株式会社 Information processing device
JP5842833B2 (en) 2013-01-17 2016-01-13 トヨタ自動車株式会社 Information processing apparatus and program
JP5975923B2 (en) * 2013-03-29 2016-08-23 日立オートモティブシステムズ株式会社 Vehicle control device
JP6323235B2 (en) * 2014-07-29 2018-05-16 株式会社デンソー Electronic control unit

Also Published As

Publication number Publication date
DE102017211568B4 (en) 2022-04-28
DE102017211568A1 (en) 2018-02-01
JP2018018274A (en) 2018-02-01

Similar Documents

Publication Publication Date Title
JP5244981B2 (en) Microcomputer and operation method thereof
JP5967059B2 (en) Electronic control device for vehicle
JP5094777B2 (en) In-vehicle electronic control unit
JP2008033890A (en) Microcomputer system
JP6589767B2 (en) Electronic control unit
JP4812699B2 (en) Power control device
JP7155902B2 (en) electronic controller
JP2004338883A (en) Elevator controller
JP5579257B2 (en) Apparatus and method for restoring information in main memory
JP5880411B2 (en) Information processing device
JP7024582B2 (en) In-vehicle control device
JP5842833B2 (en) Information processing apparatus and program
JP2005250854A (en) Controller
JP2007283788A (en) Vehicular electronic control device
JP4856023B2 (en) Real-time watch apparatus and method
JP2017007539A (en) Control device
WO2013073009A1 (en) Microcomputer system and monitoring microcomputer
JP6172040B2 (en) Electronic control unit
JP7200883B2 (en) electronic controller
KR101548924B1 (en) Electronic control unit for vehicle and method to disable tuning protection function
JP7091853B2 (en) Electronic control device
WO2023119652A1 (en) Electronic control device and access control method
JP2018010362A (en) Electronic control unit
JP6799404B2 (en) Information processing device and information processing method
JP2022068946A (en) Electronic controller

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20180831

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20190619

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20190820

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20190902

R151 Written notification of patent or utility model registration

Ref document number: 6589767

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R151

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250