JP6466269B2 - Electronic control device and stack area usage monitoring method - Google Patents

Electronic control device and stack area usage monitoring method Download PDF

Info

Publication number
JP6466269B2
JP6466269B2 JP2015132781A JP2015132781A JP6466269B2 JP 6466269 B2 JP6466269 B2 JP 6466269B2 JP 2015132781 A JP2015132781 A JP 2015132781A JP 2015132781 A JP2015132781 A JP 2015132781A JP 6466269 B2 JP6466269 B2 JP 6466269B2
Authority
JP
Japan
Prior art keywords
task
electronic control
stack area
control device
stack
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
JP2015132781A
Other languages
Japanese (ja)
Other versions
JP2017016410A (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.)
Hitachi Astemo Ltd
Original Assignee
Hitachi Automotive Systems 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 Hitachi Automotive Systems Ltd filed Critical Hitachi Automotive Systems Ltd
Priority to JP2015132781A priority Critical patent/JP6466269B2/en
Publication of JP2017016410A publication Critical patent/JP2017016410A/en
Application granted granted Critical
Publication of JP6466269B2 publication Critical patent/JP6466269B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Description

本発明は、スタック領域を使用する電子制御装置及びスタック領域の使用監視方法に関する。   The present invention relates to an electronic control device using a stack area and a method for monitoring the use of the stack area.

電子制御装置において、RAM(Random Access Memory)の一部がスタック領域として使用される。このスタック領域は、電子制御装置における処理中のデータなどを一時的に退避させる場合に使用される(例えば、特許文献1参照)。   In the electronic control unit, a part of RAM (Random Access Memory) is used as a stack area. This stack area is used when data being processed in the electronic control device is temporarily saved (see, for example, Patent Document 1).

特開2008−184912号公報JP 2008-184912 A

ISO26262において、車両の機能安全についての基準が定められている。この基準において、ASIL(Automotive Safety Integrity Level)という安全性のレベルが定められている。安全性のレベルは、5段階あり、安全性の基準が高い順にASIL−D,ASIL−C,ASIL−B,ASIL−A,QMとなっている。そして、前記機能安全を実現する上では、例えば、タスクごとにこの安全性のレベルが割り当てられ、割り当てられたレベルが低いものの障害がよりレベルが高いものに影響を与えないことが求められる。このため、電子制御装置において、高い安全性のレベル(例えば、ASIL−D)が割り当てられたタスクによりスタック領域に一時的に退避されたデータが、より低い安全性のレベル(例えば、QM)が割り当てられたタスクによってアクセスされないようにする。例えば、スタック領域が複数確保され、タスクのASILレベルに応じて、そのタスクが使用するスタック領域が少なくとも一つ割り当てられるようにする。 In ISO 26262, standards for functional safety of vehicles are set. In this standard, a safety level called ASIL (Automotive Safety Integrity Level) is defined. There are five levels of safety, ASIL-D, ASIL-C, ASIL-B, ASIL-A, and QM in descending order of safety standards. And in order to implement | achieve the said functional safety, this safety | security level is allocated for every task, for example, It is calculated | required that although the allocated level is low, the failure does not affect a higher level. For this reason, in the electronic control device, data temporarily saved in the stack area by a task to which a high safety level (for example, ASIL-D) is assigned has a lower safety level (for example, QM). Prevent access by assigned tasks. For example, a plurality of stack areas are secured, and at least one stack area used by the task is allocated according to the ASIL level of the task.

このようにした場合に、割り当てられたスタック領域が適切に使用されているかを監視する必要がある。このような監視において、実行されるタスクの中で決まったタイミングで監視をしても、そのタイミングにおける異常以外を発見することができないため、信頼性が低下し機能安全が実現できない恐れがある。また、実行されるタスクの中で異なるタイミングで監視をしようとすると、タスクが複雑化し、処理に時間がかかり、車両の他の制御に影響を及ぼし機能安全が実現できない恐れがある。   In such a case, it is necessary to monitor whether or not the allocated stack area is properly used. In such monitoring, even if monitoring is performed at a predetermined timing in the task to be executed, it is impossible to find anything other than an abnormality at that timing, so there is a possibility that reliability is lowered and functional safety cannot be realized. In addition, if monitoring is performed at different timings among the tasks to be executed, the tasks become complicated, processing takes time, and other control of the vehicle is affected, and functional safety may not be realized.

そこで、機能安全を実現するべく、タスクが当該タスクに割り当てられたスタック領域を適切に使用しているかを監視することができる電子制御装置及びスタック領域の使用監視方法を提供する。   Therefore, an electronic control apparatus and a stack area usage monitoring method that can monitor whether a task appropriately uses a stack area allocated to the task in order to realize functional safety.

前記課題を解決するために、電子制御装置が、メモリ及びプロセッサを備え、プロセッサが定時的な割り込みによって第1のタスクを実行するときに、当該第1のタスクについて、メモリに確保された複数のスタック領域のうち、第1のタスクに予め割り当てられた少なくとも1つのスタック領域を使用させ、第1のタスクが当該第1のタスクに予め割り当てられた少なくとも1つのスタック領域を使用しているか否かを、定時的な割り込みの発生タイミングとは相関しないランダムなタイミングで発生する第2のタスクによって監視させる。 In order to solve the above-described problem, an electronic control device includes a memory and a processor, and when the processor executes the first task by a periodic interrupt, a plurality of the first tasks are secured in the memory. Whether at least one stack area pre-assigned to the first task is used among the stack areas, and whether the first task uses at least one stack area pre-assigned to the first task Are monitored by a second task that occurs at random timing that is not correlated with the timing of occurrence of a periodic interrupt.

前記電子制御装置によれば、タスクが当該タスクに割り当てられたスタック領域を適切に使用しているかを監視することができ、機能安全を実現できる。   According to the electronic control device, it is possible to monitor whether a task appropriately uses the stack area allocated to the task, and functional safety can be realized.

電子制御装置の実施形態を示すブロック図である。It is a block diagram which shows embodiment of an electronic controller. 前記電子制御装置のスタック領域の構成を示す図である。It is a figure which shows the structure of the stack area | region of the said electronic controller. 前記電子制御装置がタスクを実行する際のフローを示す図である。It is a figure which shows the flow at the time of the said electronic control apparatus performing a task. 前記電子制御装置がスタック領域の使用を監視するタスクを実行する際のフローを示す図である。It is a figure which shows the flow at the time of the said electronic control apparatus performing the task which monitors use of a stack area. 前記電子制御装置がスタック領域の使用を監視するタイミングを示した図である。It is the figure which showed the timing which the said electronic control unit monitors use of a stack area.

以下、本発明の実施の形態を添付図面に基づいて説明する。
図1は、自動車に搭載された電子制御装置100の実施形態を示す図である。この電子制御装置100は、車両の様々な制御を行うもので、例えば、内燃機関の制御を行う。電子制御装置100は、複数のCPU(Central Processing Unit)110と、複数のローカルメモリ120と、グローバルメモリ130と、を備えている。
Hereinafter, embodiments of the present invention will be described with reference to the accompanying drawings.
FIG. 1 is a diagram illustrating an embodiment of an electronic control device 100 mounted on an automobile. The electronic control device 100 performs various controls of the vehicle, and controls, for example, an internal combustion engine. The electronic control device 100 includes a plurality of CPUs (Central Processing Units) 110, a plurality of local memories 120, and a global memory 130.

CPU110は、電子制御装置100に接続された各種センサの検出値等を読み出して車両制御用の目標値を算出することができる。具体的には、CPU110には、図示していないクランク角センサ、カム角センサ、水温センサ、スロットルセンサ、エアフローセンサ、空燃比センサを含む各種センサ等の信号が入力され、また、電子スロットル弁、燃料噴射弁、点火コイル等の各種制御に必要なデータを演算することができる。   The CPU 110 can read out detection values and the like of various sensors connected to the electronic control device 100 and calculate a target value for vehicle control. Specifically, the CPU 110 receives signals from various sensors including a crank angle sensor, a cam angle sensor, a water temperature sensor, a throttle sensor, an air flow sensor, and an air-fuel ratio sensor (not shown), and an electronic throttle valve, Data necessary for various controls such as a fuel injection valve and an ignition coil can be calculated.

前記CPU110には、CPU110にそれぞれ設けられたローカルメモリ120と、全てのCPU110がアクセス可能なグローバルメモリ130とが接続されている。このローカルメモリ120は、CPU110に1対1で対応し、対応するCPU110の実行にのみ用いられる。このローカルメモリ120には、LIFO(Last In First Out)方式でデータを保持するスタック領域122や他の各種メモリ領域が設けられている。   Connected to the CPU 110 are a local memory 120 provided in the CPU 110 and a global memory 130 accessible by all the CPUs 110. The local memory 120 corresponds to the CPU 110 on a one-to-one basis, and is used only for execution of the corresponding CPU 110. The local memory 120 is provided with a stack area 122 for holding data by a LIFO (Last In First Out) system and other various memory areas.

電子制御装置100は、タスクを実行する上で、スタック領域へのアクセス制限の異なる複数のモードを有している。このアクセス制限は、安全性の基準に基づいたレベルに応じて定められている。本実施形態では、複数のモードとして、スーパーバイザーモード(SVM:supervisor mode)と、ユーザーモード(UM:user mode)とがあり、それぞれにアクセス権限が割り当てられてアクセス制限を実現している。そして、SVMのときには、安全性レベルがASIL−D,C,B,Aのいずれかであるタスクが実行され、UMのときには、安全性レベルがQMであるタスクが実行される。換言すると、電子制御装置100において、タスクは、安全性レベルなどの所定規則に基づいてグループに分類され、グループに応じたモードで実行されるようになっている。   The electronic control device 100 has a plurality of modes with different access restrictions on the stack area when executing a task. This access restriction is determined according to a level based on a safety standard. In the present embodiment, there are a supervisor mode (SVM: supervisor mode) and a user mode (UM: user mode) as a plurality of modes, and an access authority is assigned to each mode to achieve access restriction. In SVM, a task whose safety level is ASIL-D, C, B, or A is executed. In UM, a task whose safety level is QM is executed. In other words, in the electronic control device 100, the tasks are classified into groups based on a predetermined rule such as a safety level, and are executed in a mode corresponding to the group.

ローカルメモリ120に設けられたスタック領域122は、QM用スタック領域124と、ASIL用スタック領域126との、2つの領域に分けられている。すなわち、ローカルメモリ120には2つのスタック領域が確保されている。そして、UMが割り当てられたタスクは、QM用スタック領域124にのみアクセスが可能であり、ASIL用スタック領域126へのアクセスが禁止されている。SVMが割り当てられたタスクは、ASIL用スタック領域126及びQM用スタック領域124にアクセスが可能である。このようなタスクごとのアクセスの制限は、メモリ管理ユニット等のハードウェアで実現することができる。なお、本実施形態では、アクセスの種別として読み込み、書き込み、実行の3種類があり、これら全てのアクセスがまとめて禁止されるか又は許可されている。しかし、例えば、書き込み及び実行は禁止するが読み込みだけを許可するといったように、一部のアクセスを許可するような設定をすることができる。また、各モードにおいて、スタック領域ごとに、かつ、アクセス種別ごとに許可又は禁止の設定をすることができる。
なお、本実施形態においてはローカルメモリ120に2つのスタック領域が確保されているが、電子制御装置はローカルメモリに複数のスタック領域を確保することができる。
The stack area 122 provided in the local memory 120 is divided into two areas, a QM stack area 124 and an ASIL stack area 126. That is, two stack areas are secured in the local memory 120. A task to which a UM is assigned can access only the QM stack area 124, and access to the ASIL stack area 126 is prohibited. The task to which the SVM is assigned can access the ASIL stack area 126 and the QM stack area 124. Such access restriction for each task can be realized by hardware such as a memory management unit. In the present embodiment, there are three types of access: read, write, and execute, and all these accesses are prohibited or permitted collectively. However, for example, it is possible to set to permit a part of access such as prohibiting writing and execution but allowing only reading. In each mode, permission or prohibition can be set for each stack area and for each access type.
In the present embodiment, two stack areas are secured in the local memory 120, but the electronic control unit can secure a plurality of stack areas in the local memory.

次に、図2を参照してスタック領域122について詳細に説明する。
スタック領域122において、例えば、アドレスが大きくなる方向にデータが蓄積される。図2においては上方向がアドレスの値が大きくなる方向である。そして、スタック領域122においては、図2(a)(b)に示すように、アドレスが小さい方からASIL用スタック領域126、QM用スタック領域124の順で、メモリ領域が割り付けられている。すなわち、スタック領域122は、データが蓄積される方向側に、より重要度が低いスタック領域が設けられている。換言すると、各スタック領域122は、分割されたスタック領域のうち重要度が高いスタック領域からスタックデータが蓄積される方向に割り付けられている。
Next, the stack area 122 will be described in detail with reference to FIG.
In the stack area 122, for example, data is accumulated in the direction of increasing addresses. In FIG. 2, the upward direction is the direction in which the address value increases. In the stack area 122, as shown in FIGS. 2A and 2B, memory areas are allocated in the order of the ASIL stack area 126 and the QM stack area 124 from the smallest address. That is, the stack area 122 is provided with a stack area having a lower importance level on the side where data is accumulated. In other words, each stack area 122 is allocated in a direction in which stack data is accumulated from a stack area having a high degree of importance among the divided stack areas.

また、図2に記載のように、このスタック領域122において、ASIL用スタック領域126の最も新しく格納されたデータASIL−2を示す第1のスタックポインタと、QM用スタック領域124の最も新しく格納されたデータQM−3を示す第2のスタックポインタと、をモードに応じて切り換えることができる。図2(a)は、SVMのタスクが実行されている場合を表している。この場合には、電子制御装置100は、第1のスタックポインタ及び第2のスタックポインタを切り換えて使用することができる。そして、SVMのタスクが実行されるときには、QM用スタック領域124及びASIL用スタック領域126にアクセスすることが可能である。また、図2(b)は、UMのタスクが実行されている場合を表している。この場合には、電子制御装置100は、第2のスタックポインタを使用する。そして、QMのタスクが実行されるときには、ASIL用スタック領域126へのアクセスが禁止されている。   Further, as shown in FIG. 2, in this stack area 122, the first stack pointer indicating the most recently stored data ASIL-2 in the ASIL stack area 126 and the latest stored in the QM stack area 124 are stored. The second stack pointer indicating the data QM-3 can be switched according to the mode. FIG. 2A shows a case where an SVM task is being executed. In this case, the electronic control apparatus 100 can switch between the first stack pointer and the second stack pointer. When the SVM task is executed, the QM stack area 124 and the ASIL stack area 126 can be accessed. FIG. 2B shows a case where a UM task is being executed. In this case, the electronic control unit 100 uses the second stack pointer. When the QM task is executed, access to the ASIL stack area 126 is prohibited.

このようにして、電子制御装置100において、CPU110がタスクを実行するときに当該タスクに使用させるスタック領域として、ローカルメモリ120に確保された複数のスタック領域のうち少なくとも1つのスタック領域が予め割り当てられる。そして、タスクが使用する少なくとも1つのスタック領域は、安全性レベルなどの所定規則によりタスクを分類したグループごとに設定されている。これにより、電子制御装置100における機能安全が実現される。   In this way, in the electronic control unit 100, at least one stack area among a plurality of stack areas secured in the local memory 120 is allocated in advance as a stack area to be used for the task when the CPU 110 executes the task. . At least one stack area used by the task is set for each group in which the task is classified according to a predetermined rule such as a safety level. Thereby, functional safety in the electronic control unit 100 is realized.

また、このように構成された電子制御装置100で実行されるタスクにおいては、割り当てられたモードよりも権限が高くなる方向にモード変更ができないようになっている。例えば、UMのタスクは、UMからSVMへのモード変更は行えない。   Further, in the task executed by the electronic control device 100 configured as described above, the mode cannot be changed in a direction in which the authority is higher than the assigned mode. For example, a UM task cannot change the mode from UM to SVM.

ここで、前記電子制御装置100がタスクを実行する際のフローについて図3を参照して説明する。
まず、このフローはモードがSVMで起動される。このとき、電子制御装置100は、フローがSVMで始まるので、ASIL用スタック領域126の最も新しく格納されたデータを示す第1のスタックポインタを使用している。そして、イニシャルプログラムを実行する(S101)。
Here, a flow when the electronic control apparatus 100 executes a task will be described with reference to FIG.
First, this flow is activated in SVM mode. At this time, since the flow starts with SVM, the electronic control unit 100 uses the first stack pointer indicating the most recently stored data in the ASIL stack area 126. Then, the initial program is executed (S101).

次に、プログラムの実行上、UMのタスクを実行することがあり、それに伴いモードをSVMからUMに切り換えることがある。このとき、まず、電子制御装置100は、スタックポインタをQM用スタック領域124の最も新しく格納されたデータを示す第2のスタックポインタに切り換える(S102)。そして、電子制御装置100はモードをSVMからUMに切り換える(S103)。
そして、モードがUMに遷移した後に電子制御装置100はQMのタスクを実行して、その際にスタック領域としてQM用スタック領域124を使用する(S104)。
Next, in executing the program, a UM task may be executed, and the mode may be switched from SVM to UM accordingly. At this time, first, the electronic control unit 100 switches the stack pointer to the second stack pointer indicating the most recently stored data in the QM stack area 124 (S102). Then, the electronic control unit 100 switches the mode from SVM to UM (S103).
Then, after the mode transitions to UM, the electronic control unit 100 executes the QM task, and uses the QM stack area 124 as the stack area (S104).

例えば、QMのタスクとしては、アクセル開度から目標トルクを演算し、その目標トルクに基づいて電子スロットルの目標スロットル開度を演算する目標トルク演算タスクがある。以下、目標トルク演算タスクが実施される例について説明する。   For example, as a QM task, there is a target torque calculation task that calculates a target torque from an accelerator opening and calculates a target throttle opening of an electronic throttle based on the target torque. Hereinafter, an example in which the target torque calculation task is performed will be described.

この目標トルク演算タスクにおいて、電子制御装置100は、まず、アクセルペダルセンサからアクセル開度の出力を読み込む。そして、電子制御装置100は、アクセル開度から目標トルクを演算する。そして、電子制御装置100は、演算した目標トルクとなるように目標スロットル開度を演算し、その目標スロットル開度に基づいて電子制御スロットルを制御する。   In this target torque calculation task, the electronic control device 100 first reads the output of the accelerator opening from the accelerator pedal sensor. Then, the electronic control unit 100 calculates a target torque from the accelerator opening. Then, the electronic control unit 100 calculates the target throttle opening so that the calculated target torque is obtained, and controls the electronic control throttle based on the target throttle opening.

次に、このような電子制御スロットルの制御において、異常が発生しているかを検知する必要がある。そこで、目標トルクとは別に、現在のトルクを算出して、目標トルクと現在のトルクとを対比させて、異常が発生しているかの判定を行う。ここで、このような判定を行うタスクは、安全性のレベルがQMよりも高いものである(例えば、ASIL−C)。それゆえ、このタスクは、UMでは行われることができずSVMで行われる必要がある。そこで、電子制御装置100は、割り込み指令を出してSVMの異常検知タスク(割り込み処理1)を割り込みさせることによって処理を行う。   Next, it is necessary to detect whether an abnormality has occurred in the control of such an electronically controlled throttle. Therefore, separately from the target torque, the current torque is calculated, and the target torque is compared with the current torque to determine whether an abnormality has occurred. Here, the task for making such a determination has a safety level higher than QM (for example, ASIL-C). Therefore, this task cannot be done in UM and needs to be done in SVM. Therefore, the electronic control unit 100 performs processing by issuing an interrupt command and interrupting the SVM abnormality detection task (interrupt processing 1).

割り込み処理1では、まず、電子制御装置100は、この異常検知タスクはSVMで行われるものであるので、ASIL用スタック領域126のデータを示す第1のスタックポインタを使用する必要がある。本事例では割り込み前にはQMのタスクが実施されており第2のスタックポインタが使用されているので、電子制御装置100は、スタックポインタを切り換えて第1のスタックポインタを使用して、スタック領域としてASIL用スタック領域126を使用して処理を行うようにする(S201)。次に、電子制御装置100は、各種センサからの出力に基づいて現在のトルクを算出する。そして、電子制御装置100は、目標トルクと現在のトルクとを対比し、異常が発生しているか否かの判定を行う(S202)。   In the interrupt process 1, first, the electronic control unit 100 needs to use the first stack pointer indicating the data in the ASIL stack area 126 because the abnormality detection task is performed by the SVM. In this example, since the QM task is executed before the interruption and the second stack pointer is used, the electronic control unit 100 switches the stack pointer and uses the first stack pointer to use the stack area. The processing is performed using the ASIL stack area 126 (S201). Next, the electronic control unit 100 calculates the current torque based on outputs from various sensors. Then, the electronic control unit 100 compares the target torque with the current torque and determines whether or not an abnormality has occurred (S202).

更に、前記異常の判定とは別に、タスクの実行順や実行タイミングに異常があるか否かを判定し、処置を行うタスクが実行される。このタスクは、安全性レベルがQMよりも高いものである(例えば、ASIL−C)。それゆえ、このタスクはSVMで行われる必要がある。そこで、割り込み処理1のステップ202での処理中にこのような機能動作の異常判定を行う必要がある場合には、更に機能動作の異常判定タスクである割り込み処理2を実行する。この機能動作の異常判定タスクは、SVMで行われるものであるので、まず、第1のスタックポインタが使用されているかを判定する。本事例では、割り込み処理1中に行われているので、既に第1のスタックポインタが使用されると共にスタック領域としてASIL用スタック領域126が使用されている。したがって、スタックポインタの切り換えは行われない(S301)。そして、前記機能動作の異常判定タスクが行われる(S302)。このタスクの終了後に戻る処理がSVMでの処理であるので、電子制御装置100は、スタックポインタを第1のスタックポインタから切り換えずに割り込み処理1に戻る(S303)。   Further, separately from the determination of the abnormality, it is determined whether or not there is an abnormality in the execution order and execution timing of the tasks, and the task for performing the action is executed. This task has a safety level higher than QM (eg, ASIL-C). Therefore, this task needs to be done in SVM. Therefore, when it is necessary to perform such a functional operation abnormality determination during the processing in step 202 of the interrupt processing 1, an interruption process 2 which is a functional operation abnormality determination task is further executed. Since this functional operation abnormality determination task is performed by the SVM, it is first determined whether or not the first stack pointer is used. In this example, since the process is performed during the interrupt process 1, the first stack pointer is already used and the ASIL stack area 126 is used as the stack area. Therefore, the stack pointer is not switched (S301). Then, an abnormality determination task for the functional operation is performed (S302). Since the processing to return after the end of the task is processing in SVM, the electronic control unit 100 returns to the interrupt processing 1 without switching the stack pointer from the first stack pointer (S303).

電子制御装置100は、処理を割り込み処理1に戻らせ、処理を再開する。そして、電子制御装置100は、割り込み処理1が終了したら、戻るタスクがUMのタスクであるので、スタックポインタを第2のスタックポインタに切り換え、スタック領域としてQM用スタック領域124を使用して処理を行うようにする(S203)。その後、電子制御装置100は、目標トルク演算タスクを再開して実行する。   The electronic control apparatus 100 returns the process to the interrupt process 1 and restarts the process. When the interrupt process 1 is completed, the electronic control device 100 switches the stack pointer to the second stack pointer because the returning task is a UM task, and performs processing using the QM stack area 124 as the stack area. This is performed (S203). Thereafter, the electronic control unit 100 resumes and executes the target torque calculation task.

ここで、電子制御装置100における制御において、プログラムの書き換え等の特殊モードへのモード遷移が必要となる場合があり、UMからより高い重要度が割り当てられたSVMへ遷移することがある。しかし、電子制御装置100において、QMのタスクはQMからSVMにモード遷移することができない。ここで、本実施例においては、低い重要度のモードから高い重要度のモードへの遷移は、SVMのタスクを割り込ませて割り込み処理にて実施する。具体的には、電子制御装置100は、割り込み命令を出し(S105)、これによりSVMのタスクを割り込ませて、QMからSVMにモード遷移をする(S401)。そして、モード遷移後にSVMのタスクがスタックポインタを第1のスタックポインタに切り換えてスタック領域としてASIL用スタック領域126を使用して処理を行うようにし(S106)、電子制御装置100は特殊モードでの処理等を実行する。   Here, in the control in the electronic control unit 100, mode transition to a special mode such as rewriting of a program may be required, and transition from UM to SVM assigned higher importance may occur. However, in the electronic control unit 100, the QM task cannot make a mode transition from the QM to the SVM. Here, in the present embodiment, the transition from the low importance mode to the high importance mode is performed by interrupt processing by interrupting the SVM task. Specifically, the electronic control unit 100 issues an interrupt command (S105), thereby interrupting the SVM task, and makes a mode transition from QM to SVM (S401). Then, after the mode transition, the SVM task switches the stack pointer to the first stack pointer and performs processing using the ASIL stack area 126 as the stack area (S106), and the electronic control unit 100 operates in the special mode. Execute processing etc.

以上のようにして、電子制御装置100は、複数のスタック領域が確保された上で、実行されるタスクに応じて割り込み処理を行い、適宜スタックポインタ及びスタック領域を切り換えてプログラムを実行する。   As described above, the electronic control unit 100 secures a plurality of stack areas, performs interrupt processing according to the task to be executed, and executes the program by appropriately switching the stack pointer and the stack area.

ここで、電子制御装置100は、複数のスタック領域が確保された場合において、スタック領域が、タスクが実行される際にそのタスクが属するグループに応じて適切に使用されているかを監視することができる。
このような監視をするタスクは、割り込み処理にて実行される。この割り込み処理について図4及び5を参照しつつ説明する。
図4は、割り込み処理1及び割り込み処理2が実行されるフローにおいて、更に割り込み処理として、スタック領域の使用が適切に行われているかを監視するタスク(割り込み処理4)が行われる場合を表す概念図である。なお、上記説明した割り込み処理1及び2は定時的な割り込みとして実行される処理である。
Here, when a plurality of stack areas are secured, the electronic control unit 100 can monitor whether the stack area is appropriately used according to the group to which the task belongs when the task is executed. it can.
Such a task for monitoring is executed by interrupt processing. This interrupt process will be described with reference to FIGS.
FIG. 4 shows a concept representing a case where a task (interrupt process 4) for monitoring whether or not the stack area is properly used is performed as an interrupt process in the flow in which the interrupt process 1 and the interrupt process 2 are executed. FIG. Note that the interrupt processes 1 and 2 described above are processes executed as regular interrupts.

図4において示されたフローは、定時的な割り込みである前記割り込み処理1が割り込んだ状態から始まっている。そして、電子制御装置100は、割り込み処理1が実行されるので、スタックポインタを第1のスタックポインタに切り換えて、スタック領域としてASIL用スタック領域126を使用して処理を行うようにする(S501)。そして、電子制御装置100は、タスクを実行する前に実行するタスクを示す実行タスク情報を適切なメモリに記録する(S502)。その後、割り込み処理1が実行される(S503)。   The flow shown in FIG. 4 starts from a state where the interrupt processing 1 which is a periodic interrupt is interrupted. Then, since the interrupt process 1 is executed, the electronic control unit 100 switches the stack pointer to the first stack pointer, and performs processing using the ASIL stack area 126 as the stack area (S501). . Then, the electronic control apparatus 100 records execution task information indicating a task to be executed before executing the task in an appropriate memory (S502). Thereafter, interrupt processing 1 is executed (S503).

ここで割り込み処理1の実行中に、定時的な割り込みが実行されるタイミングとは相関しないタイミングで、実行されているタスクが、当該タスクが属するグループに応じて予め割り当てられたスタック領域を使用しているかを監視する割り込み処理4が行われる。本実施例においては、電子制御装置100は、クランク角センサ等のエンジン回転センサにおける立ち上がりエッジ及び立ち下りエッジの検出がなされるタイミングで割り込み処理4を実行する。   Here, during execution of interrupt processing 1, the task being executed uses a stack area that is allocated in advance according to the group to which the task belongs at a timing that does not correlate with the timing at which the periodic interrupt is executed. Interrupt processing 4 for monitoring whether or not In the present embodiment, the electronic control unit 100 executes the interrupt process 4 at a timing at which a rising edge and a falling edge are detected in an engine rotation sensor such as a crank angle sensor.

この割り込み処理4では、電子制御装置100は、グループに属するタスクとそのグループのタスクに使用させる予め割り当てられたスタック領域とが示されたテーブルを参照して、割り込み処理3で実施されたタスクがそのタスクが属するグループに応じて予め割り当てられたスタック領域を使用しているか否かを監視する。   In this interrupt process 4, the electronic control unit 100 refers to a table showing tasks belonging to a group and a pre-assigned stack area to be used for the tasks of the group. It is monitored whether or not a stack area allocated in advance according to the group to which the task belongs is used.

例えば、まず、実行タスク情報を読み出す(S601)。そして、電子制御装置100は、グループに属するタスクと当該グループに応じて予め割り当てられたスタック領域のアドレスの範囲とがグループごとに示されたテーブルを参照して、実行タスク情報が属するグループに基づいて、そのグループに応じて予め割り当てられたスタック領域のアドレスの範囲を読み出す。そして、電子制御装置100は、スタックポインタが、前記読み出した予め割り当てられたアドレスの範囲内を示していれば、実行タスクがその属するグループに応じて予め割り当てられたスタック領域を使用していると判定する。一方、電子制御装置100は、スタックポインタが、前記読み出した予め割り当てられたアドレスの範囲外を示していれば、実行タスクがその属するグループに応じて予め割り当てられたスタック領域を使用していないと判定する。そして、電子制御装置100は、実行タスクがその属するグループに応じて予め割り当てられたスタック領域を使用していると判定した場合には、割り込みを終了して元の処理に戻る。一方、電子制御装置100は、実行タスクがその属するグループに応じて予め割り当てられたスタック領域を使用していないと判定した場合には、例えば、外部装置にエラーを通知するか、又は、図示しない不揮発性のメモリ(フラッシュメモリ等)へエラーを記録する(S602)。   For example, first, the execution task information is read (S601). The electronic control device 100 refers to a table in which tasks belonging to a group and a stack area address range allocated in advance according to the group are shown for each group, and based on the group to which the execution task information belongs. Thus, the address range of the stack area allocated in advance according to the group is read. When the stack pointer indicates the range of the pre-assigned address that has been read, the electronic control device 100 uses the stack area pre-assigned according to the group to which the execution task belongs. judge. On the other hand, if the stack pointer indicates outside the range of the pre-assigned address that has been read, the electronic control apparatus 100 does not use the pre-assigned stack area according to the group to which the execution task belongs. judge. If the electronic control device 100 determines that the execution task is using the stack area allocated in advance according to the group to which the execution task belongs, the electronic control device 100 ends the interrupt and returns to the original processing. On the other hand, when the electronic control device 100 determines that the execution task does not use the stack area allocated in advance according to the group to which the execution task belongs, for example, the electronic control device 100 notifies the external device of an error or is not shown. An error is recorded in a non-volatile memory (flash memory or the like) (S602).

次に、スタック監視をする割り込み処理4が終了して割り込み処理1に処理が戻る。そして、割り込み処理1の実行中に前述したように機能動作の異常判定タスクである割り込み処理2が定時的な割り込みとして実行される。割り込み処理2は、SVMのタスクであり、スタック領域は、ASIL用スタック領域126を使用する。既に、割り込み処理1において、第1のスタックポインタが使用されているので、電子制御装置100は、スタックポインタの切り換えを実行しない(S504)。そして、電子制御装置100は、S502と同様に割り込み処理2の実行タスク情報を記録する(S505)。その後、電子制御装置100は、割り込み処理2を実行する。   Next, the interrupt process 4 for monitoring the stack ends, and the process returns to the interrupt process 1. Then, during the execution of the interrupt process 1, as described above, the interrupt process 2 which is a function operation abnormality determination task is executed as a periodic interrupt. The interrupt processing 2 is an SVM task, and the ASIL stack area 126 is used as the stack area. Since the first stack pointer has already been used in the interrupt process 1, the electronic control unit 100 does not perform stack pointer switching (S504). Then, the electronic control unit 100 records the execution task information of the interrupt process 2 as in S502 (S505). Thereafter, the electronic control unit 100 executes the interrupt process 2.

ここで、割り込み処理2の実行中に、電子制御装置100は、例えば、エンジン回転センサにおけるエッジを検出して、スタック監視をする割り込み処理4を行う。電子制御装置100は、この割り込み処理で、実行タスク情報を読み出す(S603)。電子制御装置100は、読み出した実行タスク情報に基づいて、実行タスクがその属するグループに応じて予め割り当てられたスタック領域を使用しているかを判定し、S602と同様の処理を行う(S604)。その後、電子制御装置100は、割り込み処理4を終了させて、割り込み処理2の実行に戻る。   Here, during the execution of the interrupt process 2, the electronic control unit 100 performs an interrupt process 4 for detecting an edge in the engine rotation sensor and monitoring the stack, for example. The electronic control unit 100 reads out the execution task information in this interrupt process (S603). Based on the read execution task information, the electronic control unit 100 determines whether the execution task uses a stack area allocated in advance according to the group to which the execution task belongs, and performs the same processing as S602 (S604). Thereafter, the electronic control unit 100 ends the interrupt process 4 and returns to the execution of the interrupt process 2.

このようなタスク監視を行う一例における、時間、実行タスク、使用スタック領域、スタック監視タスクの実行タイミングの関係を、図5を参照して説明する。
まず、実行タスクと使用されるスタック領域との関係について説明する。時間t1で定時的な割り込みである割り込み処理1が実行される。この場合の使用されるスタック領域はASIL用スタック領域である。次に時間t2で割り込み処理2が実行される。この場合の使用されるスタック領域は割り込み処理1と同様にASIL用スタック領域である。そして、時間t3で割り込み処理2が終了し、割り込み処理1に戻る。更に、時間t4で割り込み処理1が終了し、通常タスクに戻る。このときに、スタックポインタが切り換わり、QM用スタック領域を示すようになる。そして次に、時間t5で通常タスク実行時に定時割り込みで割り込み処理1が実行される。これに対しスタック監視タスクは、エンジン回転センサにおけるエッジの検出時(t11〜t16)に割り込みを発生して、スタック監視タスクを実行する。ここで、エンジン回転センサにおけるエッジの検出タイミングは、定時的な割り込みである割り込み処理1及び定時的な割り込みである割り込み処理2の割り込みのタイミングとは相関していない。このように、定時的な割り込みタイミングとは相関しない、エンジン回転センサにおけるエッジの検出タイミングで、スタック監視タスクを実行することにより、定時的ではないランダムなタイミングでスタック領域の使用を監視することができる。
The relationship among time, execution task, used stack area, and stack monitoring task execution timing in an example of performing such task monitoring will be described with reference to FIG.
First, the relationship between the execution task and the stack area used will be described. Interrupt processing 1 which is a periodic interrupt is executed at time t1. The stack area used in this case is the ASIL stack area. Next, interrupt processing 2 is executed at time t2. The stack area used in this case is the ASIL stack area as in the interrupt processing 1. At time t3, the interrupt process 2 ends and the process returns to the interrupt process 1. Furthermore, interrupt processing 1 ends at time t4 and returns to the normal task. At this time, the stack pointer is switched to indicate the QM stack area. Next, at time t5, interrupt processing 1 is executed by a scheduled interrupt during normal task execution. In contrast, the stack monitoring task generates an interrupt when an edge is detected in the engine rotation sensor (t11 to t16), and executes the stack monitoring task. Here, the edge detection timing in the engine rotation sensor does not correlate with the interrupt timings of interrupt processing 1 which is a periodic interrupt and interrupt processing 2 which is a periodic interrupt. In this way, by using the stack monitoring task at the edge detection timing in the engine rotation sensor that does not correlate with the regular interrupt timing, it is possible to monitor the use of the stack area at a random timing that is not regular. it can.

なお、本明細書においては2つのCPUで構成されたデュアルプロセッサについて説明したが、ローカルメモリをそれぞれ有する3以上のCPUで構成されたマルチプロセッサにおいても、本実施形態に記載したスタック領域を適用することができる。また、マルチコアプロセッサにおいてコアごとにローカルメモリが接続されている場合に、その各ローカルメモリに本実施形態に記載したスタック領域を設けることができる。   In the present specification, a dual processor configured with two CPUs has been described. However, the stack area described in the present embodiment is also applied to a multiprocessor configured with three or more CPUs each having a local memory. be able to. Further, when a local memory is connected to each core in the multi-core processor, the stack area described in the present embodiment can be provided in each local memory.

本実施形態においては、2つの重要度に分けて2つのモードで実行される場合について説明したが、電子制御装置は、3つ以上の重要度の分類が設けられて、その重要度の分類の数に応じてモードが分けられると共にスタック領域が複数確保されてもよい。   In this embodiment, the case where the control is executed in two modes divided into two importance levels has been described. However, the electronic control apparatus is provided with three or more importance classifications, and the importance classifications are classified. The mode may be divided according to the number and a plurality of stack areas may be secured.

本明細書における、定時的とは、決められた時間間隔にという意味を指すだけではなく、決められた手順の中で決められたタイミングでという意味をも含む。   In the present specification, the term “scheduled” does not only mean a predetermined time interval but also includes a meaning determined at a predetermined timing in a predetermined procedure.

100…電子制御装置、122…スタック領域   100: Electronic control unit, 122: Stack area

Claims (6)

メモリ及びプロセッサを備えた電子制御装置において、
前記プロセッサが定時的な割り込みによって第1のタスクを実行するときに、当該第1のタスクについて、前記メモリに確保された複数のスタック領域のうち、前記第1のタスクに予め割り当てられた少なくとも1つの前記スタック領域を使用させ、
前記第1のタスクが当該第1のタスクに予め割り当てられた少なくとも1つのスタック領域を使用しているか否かを、前記定時的な割り込みの発生タイミングとは相関しないランダムなタイミングで発生する第2のタスクによって監視させる、
ことを特徴とする電子制御装置。
In an electronic control device comprising a memory and a processor,
When the processor executes the first task by a scheduled interrupt, at least one of the plurality of stack areas reserved in the memory is assigned to the first task in advance for the first task. Two stack areas are used,
Whether or not the first task uses at least one stack area pre-assigned to the first task is generated at a random timing that is not correlated with the occurrence timing of the regular interrupt To be monitored by
An electronic control device characterized by that.
前記第2のタスクは、前記予め割り当てられた少なくとも1つのスタック領域をスタックポインタが指しているか否かを介して、前記第1のタスクが前記予め割り当てられた少なくとも1つのスタック領域を使用しているか否かを監視する、
ことを特徴とする請求項1に記載の電子制御装置。
The second task uses the at least one stack area pre-allocated by the first task via whether or not a stack pointer points to the at least one pre-allocated stack area. Monitoring whether or not
The electronic control device according to claim 1.
前記第1のタスクが使用する少なくとも1つのスタック領域は、前記第1のタスクを所定規則により分類したグループに基づいて設定された、
ことを特徴とする請求項1又は2に記載の電子制御装置。
At least one stack area used by the first task is set based on a group obtained by classifying the first task according to a predetermined rule;
The electronic control device according to claim 1, wherein the electronic control device is an electronic control device.
前記ランダムなタイミングは、エンジン回転センサの出力に基づくタイミングである、The random timing is a timing based on the output of the engine rotation sensor.
ことを特徴とする請求項1〜3のいずれか1つに記載の電子制御装置。The electronic control device according to claim 1, wherein the electronic control device is an electronic control device.
前記エンジン回転センサの出力に基づくタイミングは、当該エンジン回転センサにおけるエッジの検出タイミングである、The timing based on the output of the engine rotation sensor is an edge detection timing in the engine rotation sensor.
ことを特徴とする請求項4に記載の電子制御装置。The electronic control device according to claim 4.
電子制御装置が、定時的な割り込みによって第1のタスクを実行するときに、当該第1のタスクについて、メモリに確保された複数のスタック領域のうち、前記第1のタスクに予め割り当てられた少なくとも1つの前記スタック領域を使用させ、
前記第1のタスクが当該第1のタスクに予め割り当てられた少なくとも1つのスタック領域を使用しているか否かを、前記定時的な割り込みの発生タイミングとは相関しないランダムなタイミングで発生する第2のタスクによって監視させる、
ことを特徴とするスタック領域の使用監視方法。
When the electronic control unit executes the first task by a scheduled interruption, at least the first task of the plurality of stack areas secured in the memory is assigned to the first task. One stack area is used,
Whether or not the first task uses at least one stack area pre-assigned to the first task is generated at a random timing that is not correlated with the occurrence timing of the regular interrupt To be monitored by
A method for monitoring the use of the stack area.
JP2015132781A 2015-07-01 2015-07-01 Electronic control device and stack area usage monitoring method Active JP6466269B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2015132781A JP6466269B2 (en) 2015-07-01 2015-07-01 Electronic control device and stack area usage monitoring method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2015132781A JP6466269B2 (en) 2015-07-01 2015-07-01 Electronic control device and stack area usage monitoring method

Publications (2)

Publication Number Publication Date
JP2017016410A JP2017016410A (en) 2017-01-19
JP6466269B2 true JP6466269B2 (en) 2019-02-06

Family

ID=57828202

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2015132781A Active JP6466269B2 (en) 2015-07-01 2015-07-01 Electronic control device and stack area usage monitoring method

Country Status (1)

Country Link
JP (1) JP6466269B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP7414667B2 (en) 2020-08-27 2024-01-16 日立Astemo株式会社 electronic control unit

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2001022222A1 (en) * 1999-09-17 2001-03-29 Keihin Corporation Automobile control unit
JP2004157662A (en) * 2002-11-05 2004-06-03 Matsushita Electric Ind Co Ltd Dynamic stack overwrite monitoring method

Also Published As

Publication number Publication date
JP2017016410A (en) 2017-01-19

Similar Documents

Publication Publication Date Title
JP4709268B2 (en) Multi-core system for vehicle control or control device for internal combustion engine
JP5867495B2 (en) Electronic control unit
JP4920015B2 (en) Control software for distributed control and electronic control device
US7086056B2 (en) Processor unit for executing event processes in real time without causing process interference
JP4770602B2 (en) Electronics
JP2009251967A (en) Multicore system
JP5533789B2 (en) In-vehicle electronic control unit
US20180259577A1 (en) Electronic control apparatus and method
JP5975923B2 (en) Vehicle control device
JP6306530B2 (en) Electronic control unit for automobile
JP6466269B2 (en) Electronic control device and stack area usage monitoring method
JP6771272B2 (en) In-vehicle electronic control device and stack usage
JP5699896B2 (en) Information processing apparatus and abnormality determination method
JP6877475B2 (en) Electronic control device and stack usage
JP6471510B2 (en) Microcomputer
JP2010113419A (en) Multicore controller
JP5978873B2 (en) Electronic control unit
US6904543B2 (en) Electronic control having floating-point data check function
JP6596455B2 (en) Electronic control unit for automobile
JP5942904B2 (en) Processing equipment
JP2021076021A (en) Electronic control unit
JP2006323617A (en) Memory management method and memory management device
JP2023009818A (en) Electronic control device for vehicle and control method by electronic control device for vehicle
JP2021152338A (en) Controller
JP2013152563A (en) Electronic control device and memory check method

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20170920

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20180425

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20180508

A601 Written request for extension of time

Free format text: JAPANESE INTERMEDIATE CODE: A601

Effective date: 20180709

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20180809

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: 20181211

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20190109

R150 Certificate of patent or registration of utility model

Ref document number: 6466269

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

S533 Written request for registration of change of name

Free format text: JAPANESE INTERMEDIATE CODE: R313533

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250