JP2020144699A - Control device and cause determination method - Google Patents

Control device and cause determination method Download PDF

Info

Publication number
JP2020144699A
JP2020144699A JP2019041881A JP2019041881A JP2020144699A JP 2020144699 A JP2020144699 A JP 2020144699A JP 2019041881 A JP2019041881 A JP 2019041881A JP 2019041881 A JP2019041881 A JP 2019041881A JP 2020144699 A JP2020144699 A JP 2020144699A
Authority
JP
Japan
Prior art keywords
microcomputer
stack
unit
reset
fail
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2019041881A
Other languages
Japanese (ja)
Inventor
博文 田口
Hirobumi Taguchi
博文 田口
吉田 英生
Hideo Yoshida
英生 吉田
慎吾 澁谷
Shingo Shibuya
慎吾 澁谷
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Denso Ten Ltd
Original Assignee
Denso Ten Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Denso Ten Ltd filed Critical Denso Ten Ltd
Priority to JP2019041881A priority Critical patent/JP2020144699A/en
Publication of JP2020144699A publication Critical patent/JP2020144699A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

To easily identify a cause of reset of a microcomputer.SOLUTION: A control device includes an acquisition section, a detection section, and a determination section. The acquisition section acquires a value of a stack pointer included in a microcomputer. The detection section detects a sign of stack overflow and stores detection history in a nonvolatile memory region when the value of the stack pointer acquired by the acquisition section reaches a previously defined abnormal range. The determination section determines reset is caused by the stack overflow if there is the detection history when recovering from the reset of the microcomputer.SELECTED DRAWING: Figure 2

Description

開示の実施形態は、制御装置および原因判定方法に関する。 The disclosed embodiments relate to control devices and cause determination methods.

従来、車両に搭載され、エンジンやトランスミッション、カーナビゲーションといった車両の各種システムをそれぞれ電子制御する制御装置(ECU:Electronic Control Unit)が知られている。かかる制御装置では、内蔵されたマイクロコンピュータ(以下、「マイコン」と記載する)が制御プログラムを実行することにより、割り当てられた各種機能を実現する。 Conventionally, a control device (ECU: Electronic Control Unit) that is mounted on a vehicle and electronically controls various vehicle systems such as an engine, a transmission, and a car navigation system is known. In such a control device, a built-in microcomputer (hereinafter, referred to as "microcomputer") executes a control program to realize various assigned functions.

なお、かかる制御装置では、たとえば電源IC(Integrated Circuit)が、マイコンが正常に動作しているか否かを監視する監視部として機能する。マイコン監視の方式としては、たとえばマイコンから出力されるウォッチドッグカウンタ(以下、「WDC」と記載する)信号のパルス間隔を監視するWDC監視方式が従来から知られている。かかるWDC監視方式により、マイコンの動作不良が検出された場合、電源ICは、マイコンをリセットさせる。 In such a control device, for example, a power supply IC (Integrated Circuit) functions as a monitoring unit for monitoring whether or not the microcomputer is operating normally. As a microcomputer monitoring method, for example, a WDC monitoring method for monitoring the pulse interval of a watchdog counter (hereinafter, referred to as “WDC”) signal output from a microcomputer has been conventionally known. When a malfunction of the microcomputer is detected by such a WDC monitoring method, the power supply IC resets the microcomputer.

ところで、マイコンの動作不良の一例として、スタックオーバフローの発生がある。スタックオーバフローの発生は、たとえばサブルーチンの再帰呼び出しによる無限ループ等によって、メモリ領域に確保されたスタック領域(コールスタック)に蓄積されるデータ量が限界を超えることを原因とする。 By the way, an example of a malfunction of a microcomputer is the occurrence of stack overflow. The occurrence of stack overflow is caused by the amount of data stored in the stack area (call stack) secured in the memory area exceeding the limit due to, for example, an infinite loop due to a recursive call of a subroutine.

そこで、スタック領域の先頭のアドレスが格納されるスタックポインタの値の増減値を記憶しておき、前回の値と比較することでマイコンが暴走状態にあるか否かを判定する技術が提案されている(たとえば、特許文献1参照)。 Therefore, a technique has been proposed in which the increase / decrease value of the stack pointer value in which the start address of the stack area is stored is stored and compared with the previous value to determine whether or not the microcomputer is in a runaway state. (See, for example, Patent Document 1).

特開2005−216015号公報Japanese Unexamined Patent Publication No. 2005-216015

しかしながら、上述した従来技術には、マイコンがリセットされた原因を容易に特定するうえで更なる改善の余地がある。 However, the above-mentioned prior art has room for further improvement in easily identifying the cause of the reset of the microcomputer.

具体的には、上述した制御装置では、スタックオーバフローが発生した場合、電源ICがマイコンをリセットさせることとなるが、車両に搭載される制御装置の場合、起動中のリセットは車両動作に影響するため、同じ原因でのリセットが将来的に再現することのないよう、早期にリセットの原因を特定する必要がある。 Specifically, in the above-mentioned control device, when a stack overflow occurs, the power supply IC resets the microcomputer, but in the case of the control device mounted on the vehicle, the reset during startup affects the vehicle operation. Therefore, it is necessary to identify the cause of the reset at an early stage so that the reset due to the same cause will not be reproduced in the future.

しかし、上述した従来技術は、マイコンが暴走状態にあるか否かを判定するものに過ぎず、マイコンがリセットされた原因を容易に特定させるものではない。 However, the above-mentioned conventional technique merely determines whether or not the microcomputer is in a runaway state, and does not easily identify the cause of the reset of the microcomputer.

実施形態の一態様は、上記に鑑みてなされたものであって、マイコンがリセットされた原因を容易に特定することができる制御装置および原因判定方法を提供することを目的とする。 One aspect of the embodiment is made in view of the above, and an object of the present invention is to provide a control device and a cause determination method capable of easily identifying the cause of resetting the microcomputer.

実施形態の一態様に係る制御装置は、取得部と、検出部と、判定部とを備える。前記取得部は、マイクロコンピュータの備えるスタックポインタの値を周期的に取得する。前記検出部は、前記取得部によって取得された前記スタックポインタの値が予め定義された異常範囲内に到達した場合に、スタックオーバフローの予兆を検出するとともに、検出履歴を不揮発性メモリ領域へ記録する。前記判定部は、前記マイクロコンピュータのリセットからの復帰時において前記検出履歴がある場合に、当該リセットを前記スタックオーバフローによるものと判定する。 The control device according to one aspect of the embodiment includes an acquisition unit, a detection unit, and a determination unit. The acquisition unit periodically acquires the value of the stack pointer included in the microcomputer. The detection unit detects a sign of stack overflow when the value of the stack pointer acquired by the acquisition unit reaches within a predefined abnormal range, and records the detection history in the non-volatile memory area. .. When the determination unit has the detection history at the time of returning from the reset of the microcomputer, the determination unit determines that the reset is due to the stack overflow.

実施形態の一態様によれば、マイコンがリセットされた原因を容易に特定することができる。 According to one aspect of the embodiment, the cause of resetting the microcomputer can be easily identified.

図1Aは、車載システムの概要説明図である。FIG. 1A is a schematic explanatory view of an in-vehicle system. 図1Bは、比較例に係る原因判定方法の概要説明図である。FIG. 1B is a schematic explanatory view of a cause determination method according to a comparative example. 図1Cは、実施形態に係る原因判定方法の概要説明図である。FIG. 1C is a schematic explanatory view of a cause determination method according to an embodiment. 図2は、実施形態に係るECUのブロック図である。FIG. 2 is a block diagram of the ECU according to the embodiment. 図3Aは、スタック監視部の処理説明図(その1)である。FIG. 3A is a processing explanatory diagram (No. 1) of the stack monitoring unit. 図3Bは、スタック監視部の処理説明図(その2)である。FIG. 3B is a processing explanatory diagram (No. 2) of the stack monitoring unit. 図3Cは、スタック監視部の処理説明図(その3)である。FIG. 3C is a processing explanatory diagram (No. 3) of the stack monitoring unit. 図3Dは、スタック監視部の処理説明図(その4)である。FIG. 3D is a processing explanatory diagram (No. 4) of the stack monitoring unit. 図4Aは、実施形態に係るマイコンのスタック監視部が実行する処理手順を示すフローチャートである。FIG. 4A is a flowchart showing a processing procedure executed by the stack monitoring unit of the microcomputer according to the embodiment. 図4Bは、実施形態に係るマイコンの判定部が実行する処理手順を示すフローチャートである。FIG. 4B is a flowchart showing a processing procedure executed by the determination unit of the microcomputer according to the embodiment.

以下、添付図面を参照して、本願の開示する制御装置および原因判定方法の実施形態を詳細に説明する。なお、以下に示す実施形態によりこの発明が限定されるものではない。 Hereinafter, embodiments of the control device and the cause determination method disclosed in the present application will be described in detail with reference to the accompanying drawings. The present invention is not limited to the embodiments shown below.

また、以下では、実施形態に係る原因判定方法の概要について図1A〜図1Cを用いて説明した後に、実施形態に係る原因判定方法を適用したECU10(「制御装置」の一例に相当)について、図2〜図4Bを用いて説明することとする。 Further, in the following, after explaining the outline of the cause determination method according to the embodiment with reference to FIGS. 1A to 1C, the ECU 10 (corresponding to an example of the “control device”) to which the cause determination method according to the embodiment is applied will be described. It will be described with reference to FIGS. 2 to 4B.

まず、実施形態に係る原因判定方法の概要について図1A〜図1Cを用いて説明する。図1Aは、車載システム1の概要説明図である。また、図1Bは、比較例に係る原因判定方法の概要説明図である。また、図1Cは、実施形態に係る原因判定方法の概要説明図である。なお、図1A中の「n」は、1以上の任意の自然数とする。また、図1Bでは、本実施形態との区別のために、構成要素の符号に「’」を付す。 First, the outline of the cause determination method according to the embodiment will be described with reference to FIGS. 1A to 1C. FIG. 1A is a schematic explanatory view of the in-vehicle system 1. Further, FIG. 1B is a schematic explanatory view of a cause determination method according to a comparative example. Further, FIG. 1C is a schematic explanatory view of a cause determination method according to an embodiment. In addition, "n" in FIG. 1A is an arbitrary natural number of 1 or more. Further, in FIG. 1B, "'" is added to the reference numerals of the components to distinguish them from the present embodiment.

図1Aに示すように、車両Cは、車載システム1を備える。車載システム1は、複数のECU10−1〜10−nを備える。ECU10−1〜10−nは、CAN(Controller Area Network)等のネットワークNにより相互通信可能に接続され、それぞれ制御プログラムを実行することによって制御対象20−1〜20−nを電子制御する。制御対象20−1〜20−nは、たとえばエンジンやトランスミッション、カーナビゲーションといった各種システムである。 As shown in FIG. 1A, the vehicle C includes an in-vehicle system 1. The in-vehicle system 1 includes a plurality of ECUs 10-1 to 10-n. The ECUs 10-1 to 10-n are connected to each other by a network N such as CAN (Controller Area Network) so that they can communicate with each other, and the controlled objects 20-1 to 20-n are electronically controlled by executing control programs, respectively. The controlled objects 20-1 to 20-n are various systems such as an engine, a transmission, and a car navigation system.

ここで、図1Bに示すように、比較例となる従来構成に係るECU10’は、マイコン11’と、電源IC12’とを備える。マイコン11’は、ECU10’の主処理部であって、制御プログラムを実行することによって、ECU10’それぞれに割り当てられた各種機能を実現する。 Here, as shown in FIG. 1B, the ECU 10 ′ according to the conventional configuration as a comparative example includes a microcomputer 11 ′ and a power supply IC 12 ′. The microcomputer 11'is the main processing unit of the ECU 10', and by executing the control program, various functions assigned to each of the ECUs 10' are realized.

かかる各種機能の「通常制御中」において、マイコン11’から電源IC12’に対しては、周期的に「WDC出力」、すなわちWDC信号の出力がなされ、電源IC12’はそのパルス間隔を監視することによって、マイコン11’の動作状況を監視する。 During "normal control" of these various functions, the microcomputer 11'is periodically output a "WDC output", that is, a WDC signal to the power supply IC 12', and the power supply IC 12'monitors the pulse interval. Monitors the operating status of the microcomputer 11'.

その過程において、図1Bに示すように、マイコン11’に「スタックオーバフロー」が発生したものとする。かかる場合、マイコン11’は未定義動作を引き起こして暴走状態となるので、たとえば「WDC出力」が滞る。すると、電源IC12’は、「タイムアウトを検出」して、マイコン11’を「リセット」させる。 In the process, as shown in FIG. 1B, it is assumed that "stack overflow" has occurred in the microcomputer 11'. In such a case, the microcomputer 11'causes an undefined operation and goes into a runaway state, so that, for example, the "WDC output" is delayed. Then, the power supply IC 12'"detects a timeout" and "resets" the microcomputer 11'.

これにより、マイコン11’は「再起動」し、スタックオーバフローによる暴走状態は解消するが、「リセット原因は不明」のままとなる。したがって、リセットの原因は特定されずに、かかるリセットの再度の発生を防止するうえでは、たとえば不要な部品交換等により対処される可能性がある。すなわち、比較例に係る原因判定方法によれば、不経済であるうえ、リセットの真の原因を特定することが難しい。 As a result, the microcomputer 11'is "restarted" and the runaway state due to stack overflow is resolved, but "the cause of the reset is unknown" remains. Therefore, the cause of the reset is not specified, and in order to prevent the reset from occurring again, for example, unnecessary parts replacement may be taken. That is, according to the cause determination method according to the comparative example, it is uneconomical and it is difficult to identify the true cause of the reset.

そこで、実施形態に係る原因判定方法では、図1Cに示すように、マイコン11による「通常制御中」に並行して、「スタックポインタの値を常時監視」する(ステップS1)。「スタックポインタの値」は、すなわちスタック領域において次回にデータが退避される場所のアドレスである。また、ここに言う「常時監視」は、所定の間隔を空けて周期的に監視する場合に含まれる。 Therefore, in the cause determination method according to the embodiment, as shown in FIG. 1C, "the value of the stack pointer is constantly monitored" in parallel with "during normal control" by the microcomputer 11 (step S1). The "stack pointer value" is the address of the place where data is saved next time in the stack area. Further, the "constant monitoring" referred to here is included in the case of periodic monitoring at predetermined intervals.

なお、実施形態に係る原因判定方法では、予めスタックポインタがとりうる値のうち、スタックオーバフローの予兆を示すデータ範囲を異常範囲として定義付けており、スタックポインタがかかる異常範囲内に到達したことにより、「スタックオーバフローの予兆を検出」する(ステップS2)。 In the cause determination method according to the embodiment, among the values that the stack pointer can take, the data range indicating the sign of stack overflow is defined as the abnormal range, and the stack pointer reaches the abnormal range. , "Detecting a sign of stack overflow" (step S2).

そして、実施形態に係る原因判定方法では、ステップS2で予兆が検出されたならば、その検出履歴を不揮発性メモリに記憶する(ステップS3)。そして、そのうえで、実施形態に係る原因判定方法では、「フェイルセーフ処理を実行」する(ステップS4)。 Then, in the cause determination method according to the embodiment, if a sign is detected in step S2, the detection history is stored in the non-volatile memory (step S3). Then, in the cause determination method according to the embodiment, "fail-safe processing is executed" (step S4).

「フェイルセーフ処理」は、たとえばマイコン11からの要求をトリガとするリセットである。かかるリセットの場合、マイコン11は、電源IC12へ「リセット要求」を送信し、電源IC12は、かかる「リセット要求」に応じてマイコン11を「リセット」させる。 The "fail-safe process" is, for example, a reset triggered by a request from the microcomputer 11. In the case of such a reset, the microcomputer 11 transmits a "reset request" to the power supply IC 12, and the power supply IC 12 "resets" the microcomputer 11 in response to the "reset request".

これにより、マイコン11は「再起動」するが、マイコン11はその起動時のチェック処理において、リセットされたことと、不揮発性メモリに記憶されたスタックオーバフローの検出履歴が存在することとによって、原因を特定することが可能となる(ステップS5)。 As a result, the microcomputer 11 is "restarted", but the cause is that the microcomputer 11 was reset in the check process at the time of its startup and that the stack overflow detection history stored in the non-volatile memory exists. Can be specified (step S5).

このように、実施形態に係る原因判定方法では、マイコン11が、通常制御に並行して、スタックポインタの値を常時監視する。また、マイコン11は、かかるスタックポインタの値が、予め定義されたスタックポインタのとりうる値の異常範囲内に到達した場合に、スタックオーバフローの予兆を検出する。また、マイコン11は、かかる予兆を検出した場合に、その検出履歴を不揮発性メモリに記憶させた後、所定のフェイルセーフ処理を実行する。 As described above, in the cause determination method according to the embodiment, the microcomputer 11 constantly monitors the value of the stack pointer in parallel with the normal control. Further, the microcomputer 11 detects a sign of stack overflow when the value of the stack pointer reaches within the abnormal range of the value that the stack pointer can take. Further, when the microcomputer 11 detects such a sign, the microcomputer 11 stores the detection history in the non-volatile memory and then executes a predetermined fail-safe process.

これにより、実施形態に係る原因判定方法によれば、マイコン11がリセットされた原因を容易に特定することができる。 As a result, according to the cause determination method according to the embodiment, the cause of the reset of the microcomputer 11 can be easily identified.

以下、上述した実施形態に係る原因判定方法を適用したECU10について、さらに具体的に説明する。 Hereinafter, the ECU 10 to which the cause determination method according to the above-described embodiment is applied will be described more specifically.

図2は、実施形態に係るECU10のブロック図である。なお、図2では、本実施形態の特徴を説明するために必要な構成要素のみを機能ブロックで表しており、一般的な構成要素についての記載を省略している。 FIG. 2 is a block diagram of the ECU 10 according to the embodiment. Note that, in FIG. 2, only the components necessary for explaining the features of the present embodiment are represented by functional blocks, and the description of general components is omitted.

換言すれば、図2に図示される各構成要素は機能概念的なものであり、必ずしも物理的に図示の如く構成されていることを要しない。例えば、各機能ブロックの分散・統合の具体的形態は図示のものに限られず、その全部または一部を、各種の負荷や使用状況などに応じて、任意の単位で機能的または物理的に分散・統合して構成することが可能である。 In other words, each component shown in FIG. 2 is a functional concept and does not necessarily have to be physically configured as shown. For example, the specific form of distribution / integration of each functional block is not limited to the one shown in the figure, and all or part of the functional blocks are functionally or physically distributed in arbitrary units according to various loads and usage conditions. -It is possible to integrate and configure.

図2に示すように、ECU10は、マイコン11と、電源IC12とを備える。まず、電源IC12から説明する。電源IC12は、後述する主処理実行部111aからのWDC信号の出力に応じ、WDC監視方式により、マイコン11を監視する。監視の結果、マイコン11の動作不良が検出されれば、電源IC12はマイコン11をリセットさせる。 As shown in FIG. 2, the ECU 10 includes a microcomputer 11 and a power supply IC 12. First, the power supply IC 12 will be described. The power supply IC 12 monitors the microcomputer 11 by the WDC monitoring method in response to the output of the WDC signal from the main processing execution unit 111a described later. If a malfunction of the microcomputer 11 is detected as a result of the monitoring, the power supply IC 12 resets the microcomputer 11.

また、電源IC12は、後述するフェイルセーフ処理実行部111bcからリセット要求を受け付けたならば、マイコン11をリセットさせる。 Further, the power supply IC 12 resets the microcomputer 11 when the reset request is received from the fail-safe processing execution unit 111bc described later.

マイコン11は、制御部111と、記憶部112とを備える。制御部111は、主処理実行部111aと、スタック監視部111bと、判定部111cと、ダイアグ出力部111dとを備える。スタック監視部111bは、取得部111baと、検出部111bbと、フェイルセーフ処理実行部111bcとを有する。 The microcomputer 11 includes a control unit 111 and a storage unit 112. The control unit 111 includes a main processing execution unit 111a, a stack monitoring unit 111b, a determination unit 111c, and a diagnostic output unit 111d. The stack monitoring unit 111b includes an acquisition unit 111ba, a detection unit 111bb, and a fail-safe processing execution unit 111bc.

記憶部112は、スタックポインタ112aと、定義情報112bと、検出履歴112cと、リセット履歴112dとを記憶する。なお、スタックポインタ112aは記憶部112に含まれるレジスタの一種である。定義情報112b、検出履歴112cおよびリセット履歴112dは、記憶部112の不揮発性メモリ領域に記憶される。なお、ここに言う不揮発性メモリ領域は、リテンションRAM(Random Access Memory)領域を含む。 The storage unit 112 stores the stack pointer 112a, the definition information 112b, the detection history 112c, and the reset history 112d. The stack pointer 112a is a type of register included in the storage unit 112. The definition information 112b, the detection history 112c, and the reset history 112d are stored in the non-volatile memory area of the storage unit 112. The non-volatile memory area referred to here includes a retention RAM (Random Access Memory) area.

リテンションRAM領域は、マイコン11がリセットされても情報を保持するRAM領域、言い換えれば装置電源が保たれていれば情報を保持可能なRAM領域であって、たとえばフリップフロップで構成されたSRAM(Static Random Access Memory)である。 The retention RAM area is a RAM area that retains information even when the microcomputer 11 is reset, in other words, a RAM area that can retain information if the device power supply is maintained, and is, for example, an SRAM (Static) composed of flip-flops. Random Access Memory).

制御部111は、たとえば、CPU(Central Processing Unit)であって、マイコン11の全体制御を行う。主処理実行部111aは、マイコン11の起動時に、記憶部112から図示しない制御プログラムを読み出して実行することにより、ECU10に割り当てられた電子制御機能を実現する。 The control unit 111 is, for example, a CPU (Central Processing Unit) and controls the entire microcomputer 11. The main processing execution unit 111a realizes the electronic control function assigned to the ECU 10 by reading a control program (not shown) from the storage unit 112 and executing it when the microcomputer 11 is started.

また、主処理実行部111aは、制御プログラムの実行中にサブルーチン呼び出しまたはサブルーチンからのリターン等が発生するごとに、図示しないスタック領域へデータをプッシュまたはポップし、スタックポインタ112aを適宜更新する。 Further, the main processing execution unit 111a pushes or pops data to a stack area (not shown) and updates the stack pointer 112a as appropriate each time a subroutine call or a return from the subroutine occurs during execution of the control program.

スタック監視部111bは、かかるスタックポインタ112aを常時監視し、監視の結果、スタックオーバフローの予兆を検出した場合には、所定のフェイルセーフ処理を実行する。 The stack monitoring unit 111b constantly monitors the stack pointer 112a, and when a sign of stack overflow is detected as a result of the monitoring, a predetermined fail-safe process is executed.

具体的には、取得部111baが、スタックポインタ112aの値を常時取得し、検出部111bbへ渡す。検出部111bbは、予めスタックポインタ112aのとりうる値のうちの異常範囲が定義された定義情報112bに対し、直近に取得したスタックポインタ112aの値を照らす。 Specifically, the acquisition unit 111ba constantly acquires the value of the stack pointer 112a and passes it to the detection unit 111bb. The detection unit 111bb illuminates the value of the stack pointer 112a acquired most recently with respect to the definition information 112b in which the abnormal range of the possible values of the stack pointer 112a is defined in advance.

そして、検出部111bbは、かかるスタックポインタ112aの直近の値が異常範囲内に到達したならば、スタックオーバフローの予兆を検出したとしてかかる検出の履歴を検出履歴112cへ記憶させる。そのうえで、検出部111bbは、フェイルセーフ処理実行部111bcに所定のフェイルセーフ処理を実行させる。 Then, when the latest value of the stack pointer 112a reaches the abnormal range, the detection unit 111bb stores the detection history in the detection history 112c, assuming that a sign of stack overflow has been detected. Then, the detection unit 111bb causes the fail-safe processing execution unit 111bc to execute a predetermined fail-safe processing.

また、検出部111bbは、かかるスタックポインタ112aの直近の値が異常範囲内に到達したことを検出したならば、かかる到達の検出の履歴を検出履歴112cへ記憶させてもよい。この場合、スタックオーバフローの予兆の検出処理を省略しつつ、フェイルセーフ処理実行部111bcに所定のフェイルセーフ処理を実行させることができる。 Further, if the detection unit 111bb detects that the latest value of the stack pointer 112a has reached the abnormal range, the detection history 112c may store the history of the detection of such arrival. In this case, the fail-safe processing execution unit 111bc can execute a predetermined fail-safe processing while omitting the detection processing of the sign of the stack overflow.

フェイルセーフ処理実行部111bcは、所定のフェイルセーフ処理を実行する。フェイルセーフ処理実行部111bcは、たとえば所定のフェイルセーフ処理としてマイコン11をリセットさせるために、電源IC12へリセット要求を送信する。 The fail-safe processing execution unit 111bc executes a predetermined fail-safe processing. The fail-safe processing execution unit 111bc transmits a reset request to the power supply IC 12 in order to reset the microcomputer 11 as a predetermined fail-safe processing, for example.

なお、所定のフェイルセーフ処理はリセットに限らず、たとえば主処理実行部111aに制御プログラムを強制リターンさせてもよい。かかる場合、スタックオーバフローの予兆の段階で強制リターンさせることとなるので、少なくともスタック領域のオーバフローには至らず、未定義動作を引き起こして制御プログラムを暴走させることがない。 The predetermined fail-safe process is not limited to reset, and the control program may be forcibly returned to the main process execution unit 111a, for example. In such a case, since the forced return is performed at the stage of predicting the stack overflow, at least the stack area does not overflow, and the control program does not run out of control by causing undefined behavior.

また、所定のフェイルセーフ処理は、ROB機能と呼ばれる異常状態発生時に所定の異常コードを不揮発性メモリに記憶させる機能を用いたものであってもよい。 Further, the predetermined fail-safe process may use a function called a ROB function for storing a predetermined abnormal code in the non-volatile memory when an abnormal state occurs.

ここで、スタック監視部111bが実行する処理の処理内容について、図3A〜図3Dを用いてより具体的に説明する。図3A〜図3Dは、スタック監視部111bにおける処理説明図(その1)〜(その4)である。 Here, the processing content of the processing executed by the stack monitoring unit 111b will be described more specifically with reference to FIGS. 3A to 3D. 3A to 3D are processing explanatory views (No. 1) to (No. 4) in the stack monitoring unit 111b.

図2の記憶部112には図示していなかったが、主処理実行部111aによる制御プラグラムの実行時には、記憶部112に含まれるメモリ空間に、図3Aに示す各領域が確保される。「スタック領域」は、同図に示すように、たとえば「変数データ領域」に隣接して確保される。 Although not shown in the storage unit 112 of FIG. 2, each area shown in FIG. 3A is secured in the memory space included in the storage unit 112 when the control program is executed by the main processing execution unit 111a. As shown in the figure, the "stack area" is secured adjacent to, for example, the "variable data area".

一般に知られているが、かかる「スタック領域」は、図3Bに示すように、データを後入れ先出し(LIFO:Last In First Out)の構造で保持する領域であって、2つの基本操作であるプッシュとポップを持つ。プッシュは、データをスタック領域の先頭(トップ)に追加し、既存のデータはその下にそのまま置いておく。ポップは、スタックの現在のトップのデータを外して取り出す。したがって、スタック領域に保持されるデータは、同図に示すように下に行くほど古い。 As is generally known, such a "stack area" is an area for holding data in a last in first out (LIFO) structure as shown in FIG. 3B, and is two basic operations. Has push and pop. Push adds data to the top of the stack area and leaves existing data underneath. Pop removes and retrieves the current top data on the stack. Therefore, the data held in the stack area is older as it goes down as shown in the figure.

そして、スタックポインタ112aは、かかるスタック領域において次にデータを退避する場所のアドレスが値として格納される。たとえば、図3Cに示すように、プッシュによりスタック領域のアドレス0x0FFFが指す領域にデータが退避されると、スタック領域で次にデータを退避する場所を指すとともにアドレス0x0FFFより小さいアドレス0x0FFEがスタックポインタ112aに格納される。ポップの場合はアドレスの大小関係は逆である。すなわち、同図に示すように、プッシュ(またはポップ)によりスタックの先頭が更新される。 Then, the stack pointer 112a stores the address of the place where the data is saved next in the stack area as a value. For example, as shown in FIG. 3C, when data is saved in the area pointed to by the address 0x0FFF of the stack area by pushing, the address 0x0FFE smaller than the address 0x0FFF points to the next place to save the data in the stack area and the stack pointer 112a Stored in. In the case of pop, the magnitude relationship of addresses is opposite. That is, as shown in the figure, the top of the stack is updated by pushing (or popping).

このようなスタック領域のデータ構造およびスタックポインタ112aの更新のされ方を前提として、図3Dに示すように、実施形態に係るECU10は、定義情報112bにスタックポインタ112aがとりうる値のうちの「異常範囲を定義」している(ステップS11)。なお、ここでは、スタック領域とスタックオーバフロー領域との境界において、アドレス0x0FFB〜0x0FFEが異常範囲とされている例を示している。 As shown in FIG. 3D, on the premise of such a data structure of the stack area and how to update the stack pointer 112a, the ECU 10 according to the embodiment has "the value that the stack pointer 112a can take in the definition information 112b". Anomalous range is defined ”(step S11). Here, an example is shown in which addresses 0x0FFB to 0x0FFE are set as an abnormal range at the boundary between the stack area and the stack overflow area.

そして、このような定義情報112bを参照しつつ、スタック監視部111bは、スタックポインタ112aを「常時監視」する(ステップS12)。ここで、同図に示すように、スタックポインタ112aに異常範囲内の値である0x0FFEが格納されたものとする。 Then, while referring to such definition information 112b, the stack monitoring unit 111b "constantly monitors" the stack pointer 112a (step S12). Here, as shown in the figure, it is assumed that 0x0FFE, which is a value within the abnormal range, is stored in the stack pointer 112a.

すると、スタック監視部111bは、スタックポインタ112aの値の「異常範囲内への到達を検出」する(ステップS13)。そして、スタック監視部111bは、かかる検出結果に基づき、「スタックオーバフローの予兆ありと判定」することとなる(ステップS14)。 Then, the stack monitoring unit 111b “detects arrival within the abnormal range” of the value of the stack pointer 112a (step S13). Then, the stack monitoring unit 111b "determines that there is a sign of stack overflow" based on the detection result (step S14).

図2の説明に戻る。判定部111cは、たとえばマイコン11がリセットされた後の再起動時に、検出履歴112cおよびリセット履歴112dを参照して、スタックオーバフローの予兆の検出履歴およびリセットの履歴がある場合に、スタックオーバフローによるリセットが行われたと判定する。また、判定部111cは、かかる判定結果をダイアグ出力部111dへ通知する。 Returning to the description of FIG. For example, when the microcomputer 11 is restarted after being reset, the determination unit 111c refers to the detection history 112c and the reset history 112d, and resets by stack overflow when there is a detection history of a sign of stack overflow and a reset history. Is determined to have been performed. Further, the determination unit 111c notifies the diagnosis output unit 111d of the determination result.

ダイアグ出力部111dは、判定部111cから通知された判定結果をダイアグノシス信号として出力する。これにより、リセットの原因がスタックオーバフローであったことをダイアグノシス診断によって検知することが可能となる。 The diagnosis output unit 111d outputs the determination result notified from the determination unit 111c as a diagnosis signal. This makes it possible to detect by diagnostic diagnosis that the cause of the reset was stack overflow.

次に、実施形態に係るマイコン11のスタック監視部111bおよび判定部111cがそれぞれ実行する処理手順について、図4Aおよび図4Bを用いて説明する。図4Aは、実施形態に係るマイコン11のスタック監視部111bが実行する処理手順を示すフローチャートである。また、図4Bは、実施形態に係るマイコン11の判定部111cが実行する処理手順を示すフローチャートである。 Next, the processing procedures executed by the stack monitoring unit 111b and the determination unit 111c of the microcomputer 11 according to the embodiment will be described with reference to FIGS. 4A and 4B. FIG. 4A is a flowchart showing a processing procedure executed by the stack monitoring unit 111b of the microcomputer 11 according to the embodiment. Further, FIG. 4B is a flowchart showing a processing procedure executed by the determination unit 111c of the microcomputer 11 according to the embodiment.

なお、図4Aに示す処理手順とは並行して、主処理実行部111aによってECU10の主たる制御プラグラムが実行され、ECU10は通常制御中であるものとする。 It is assumed that the main control program of the ECU 10 is executed by the main processing execution unit 111a in parallel with the processing procedure shown in FIG. 4A, and the ECU 10 is normally in control.

図4Aに示すように、まずスタックポインタ112aの値の異常範囲が予め定義される(ステップS101)。そのうえで、スタック監視部111bの取得部111baが、スタックポインタ112aの値を取得する(ステップS102)。 As shown in FIG. 4A, first, the abnormal range of the value of the stack pointer 112a is defined in advance (step S101). Then, the acquisition unit 111ba of the stack monitoring unit 111b acquires the value of the stack pointer 112a (step S102).

そして、スタック監視部111bの検出部111bbが、取得部111baによって取得されたスタックポインタ112aの値が異常範囲内であるか否かを判定する(ステップS103)。ここで、異常範囲外である場合(ステップS103,No)、スタック監視部111bは、ステップS102からの処理を繰り返す。 Then, the detection unit 111bb of the stack monitoring unit 111b determines whether or not the value of the stack pointer 112a acquired by the acquisition unit 111ba is within the abnormal range (step S103). Here, when it is out of the abnormal range (steps S103, No), the stack monitoring unit 111b repeats the processing from step S102.

また、異常範囲内である場合(ステップS103,Yes)、検出部111bbは、スタックオーバフローの予兆を検出する(ステップS104)。そして、検出部111bbは、かかる検出結果を反映した検出履歴112cを不揮発性メモリに記憶させる(ステップS105)。 If it is within the abnormal range (step S103, Yes), the detection unit 111bb detects a sign of stack overflow (step S104). Then, the detection unit 111bb stores the detection history 112c reflecting the detection result in the non-volatile memory (step S105).

そして、フェイルセーフ処理実行部111bcが、所定のフェイルセーフ処理を実行し(ステップS106)、処理を終了する。なお、ここではフェイルセーフ処理として、マイコン11がリセットされたものとする。 Then, the fail-safe processing execution unit 111bc executes a predetermined fail-safe processing (step S106), and ends the processing. Here, it is assumed that the microcomputer 11 has been reset as a fail-safe process.

かかるリセットにより、図4Bに示すように、まずマイコン11が起動する(ステップS201)。そして、判定部111cが、たとえばかかる起動時のチェック処理において、検出履歴112c、かつ、リセット履歴112dがあるか否かを判定する(ステップS202)。 By such a reset, as shown in FIG. 4B, the microcomputer 11 is first activated (step S201). Then, the determination unit 111c determines whether or not there is a detection history 112c and a reset history 112d in, for example, the check process at the time of activation (step S202).

ここで、これら履歴がある場合(ステップS202,Yes)、判定部111cは、スタックオーバフローによるリセットと判定し(ステップS203)、かかる判定結果を必要に応じてダイアグ出力して、処理を終了する。 Here, when there is such a history (step S202, Yes), the determination unit 111c determines that the reset is due to stack overflow (step S203), outputs the determination result as a diagnostic as necessary, and ends the process.

上述してきたように、実施形態に係るECU10(「制御装置」の一例に相当)は、取得部111baと、検出部111bbと、判定部111cとを備える。取得部111baは、マイコン11(「マイクロコンピュータ」の一例に相当)の備えるスタックポインタ112aの値を取得する。検出部111bbは、取得部111baによって取得されたスタックポインタの値が予め定義された異常範囲内に到達した場合に、スタックオーバフローの予兆を検出するとともに、検出履歴を不揮発性メモリ領域へ記録する。判定部111cは、マイコン11のリセットからの復帰時において上記検出履歴がある場合に、当該リセットをスタックオーバフローによるものと判定する。 As described above, the ECU 10 (corresponding to an example of the “control device”) according to the embodiment includes an acquisition unit 111ba, a detection unit 111bb, and a determination unit 111c. The acquisition unit 111ba acquires the value of the stack pointer 112a included in the microcomputer 11 (corresponding to an example of the “microcomputer”). When the value of the stack pointer acquired by the acquisition unit 111ba reaches the predetermined abnormal range, the detection unit 111bb detects a sign of stack overflow and records the detection history in the non-volatile memory area. When the determination unit 111c has the above-mentioned detection history at the time of returning from the reset of the microcomputer 11, the determination unit 111c determines that the reset is due to stack overflow.

したがって、実施形態に係るECU10によれば、マイコン11がリセットされた原因を容易に特定することができる。 Therefore, according to the ECU 10 according to the embodiment, the cause of the reset of the microcomputer 11 can be easily identified.

また、実施形態に係るECU10は、フェイルセーフ処理実行部111bcをさらに備える。フェイルセーフ処理実行部111bcは、検出部111bbによる検出履歴の記録後に、所定のフェイルセーフ処理を実行する。 Further, the ECU 10 according to the embodiment further includes a fail-safe processing execution unit 111bc. The fail-safe processing execution unit 111bc executes a predetermined fail-safe processing after recording the detection history by the detection unit 111bb.

したがって、実施形態に係るECU10によれば、スタックオーバフローの予兆段階で、フェイルセーフ処理を実行することができる。 Therefore, according to the ECU 10 according to the embodiment, the fail-safe process can be executed at the stage of predicting stack overflow.

また、フェイルセーフ処理実行部111bcは、フェイルセーフ処理としてマイコン11をリセットさせる。 Further, the fail-safe processing execution unit 111bc resets the microcomputer 11 as a fail-safe processing.

したがって、実施形態に係るECU10によれば、検出部111bbによる検出履歴の記録後に、フェイルセーフ処理としてマイコン11をリセットさせるので、リセットからの復帰時において、容易に当該リセットがスタックオーバフローによるものと判定させることができる。 Therefore, according to the ECU 10 according to the embodiment, after the detection history is recorded by the detection unit 111bb, the microcomputer 11 is reset as a fail-safe process. Therefore, when returning from the reset, it is easily determined that the reset is due to stack overflow. Can be reset.

また、フェイルセーフ処理実行部111bcは、フェイルセーフ処理として、マイコン11において主たる制御プログラムを実行する主処理実行部111aをかかる制御プログラムの実行から強制的に復帰させる。 Further, the fail-safe processing execution unit 111bc forcibly returns the main processing execution unit 111a that executes the main control program in the microcomputer 11 from the execution of the control program as the fail-safe processing.

したがって、実施形態に係るECU10によれば、スタックオーバフローを予兆段階で留めつつ、マイコン11のリセットを回避することができる。 Therefore, according to the ECU 10 according to the embodiment, it is possible to avoid the reset of the microcomputer 11 while keeping the stack overflow at the predictive stage.

また、検出部111bbは、スタックオーバフロー領域との境界に接したスタック領域の所定量分を指し示すアドレス範囲を上記異常範囲として、スタックオーバフローの予兆を検出する。 Further, the detection unit 111bb detects a sign of stack overflow by setting an address range indicating a predetermined amount of the stack area in contact with the boundary with the stack overflow area as the abnormal range.

したがって、実施形態に係るECU10によれば、スタックオーバフローの予兆段階で異常と判定することができるので、スタックオーバフローの発生を予防することができる。 Therefore, according to the ECU 10 according to the embodiment, it is possible to determine that an abnormality occurs at the predictive stage of stack overflow, so that the occurrence of stack overflow can be prevented.

なお、上述した実施形態では、ECU10は車両Cに設けられることとしたが、無論、車両Cに限られるものではなく、たとえば船舶や航空機等に設けられてもよい。 In the above-described embodiment, the ECU 10 is provided in the vehicle C, but of course, the ECU 10 is not limited to the vehicle C, and may be provided in, for example, a ship or an aircraft.

また、上述した実施形態では、マイコン11はマイクロコンピュータの一例であることとしたが、マイコロコントローラまたはマイクロプロセッサであってもよい。 Further, in the above-described embodiment, the microcomputer 11 is an example of a microcomputer, but it may be a mycolo controller or a microprocessor.

さらなる効果や変形例は、当業者によって容易に導き出すことができる。このため、本発明のより広範な態様は、以上のように表しかつ記述した特定の詳細および代表的な実施形態に限定されるものではない。したがって、添付の特許請求の範囲およびその均等物によって定義される総括的な発明の概念の精神または範囲から逸脱することなく、様々な変更が可能である。 Further effects and variations can be easily derived by those skilled in the art. For this reason, the broader aspects of the invention are not limited to the particular details and representative embodiments expressed and described as described above. Therefore, various modifications can be made without departing from the spirit or scope of the general concept of the invention as defined by the appended claims and their equivalents.

10 ECU
11 マイコン
12 電源IC
20 制御対象
111 制御部
111a 主処理実行部
111b スタック監視部
111ba 取得部
111bb 検出部
111bc フェイルセーフ処理実行部
111c 判定部
111d ダイアグ出力部
112 記憶部
112a スタックポインタ
112b 定義情報
112c 検出履歴
112d リセット履歴
C 車両
N ネットワーク
10 ECU
11 Microcomputer 12 Power supply IC
20 Control target 111 Control unit 111a Main processing execution unit 111b Stack monitoring unit 111ba Acquisition unit 111bb Detection unit 111bc Fail-safe processing execution unit 111c Judgment unit 111d Diag output unit 112 Storage unit 112a Stack pointer 112b Definition information 112c Detection history 112d Reset history C Vehicle N network

Claims (6)

マイクロコンピュータの備えるスタックポインタの値を取得する取得部と、
前記取得部によって取得された前記スタックポインタの値が予め定義された異常範囲内に到達した場合に、スタックオーバフローの予兆を検出するとともに、検出履歴を不揮発性メモリ領域へ記録する検出部と、
前記マイクロコンピュータのリセットからの復帰時において前記検出履歴がある場合に、当該リセットを前記スタックオーバフローによるものと判定する判定部と
を備えることを特徴とする制御装置。
An acquisition unit that acquires the value of the stack pointer provided by the microcomputer,
A detection unit that detects a sign of stack overflow and records the detection history in a non-volatile memory area when the value of the stack pointer acquired by the acquisition unit reaches within a predefined abnormal range.
A control device including a determination unit that determines that the reset is due to the stack overflow when there is the detection history at the time of returning from the reset of the microcomputer.
前記検出部による前記検出履歴の記録後に、所定のフェイルセーフ処理を実行するフェイルセーフ処理実行部
をさらに備える
ことを特徴とする請求項1に記載の制御装置。
The control device according to claim 1, further comprising a fail-safe processing execution unit that executes a predetermined fail-safe processing after the detection history is recorded by the detection unit.
前記フェイルセーフ処理実行部は、
前記フェイルセーフ処理として前記マイクロコンピュータをリセットさせる
ことを特徴とする請求項2に記載の制御装置。
The fail-safe processing execution unit
The control device according to claim 2, wherein the microcomputer is reset as the fail-safe process.
前記フェイルセーフ処理実行部は、
前記フェイルセーフ処理として、前記マイクロコンピュータにおいて主たる制御プログラムを実行する主処理実行部を当該制御プログラムの実行から強制的に復帰させる
ことを特徴とする請求項2に記載の制御装置。
The fail-safe processing execution unit
The control device according to claim 2, wherein as the fail-safe process, the main process execution unit that executes the main control program in the microcomputer is forcibly returned from the execution of the control program.
前記検出部は、
スタックオーバフロー領域との境界に接したスタック領域の所定量分を指し示すアドレス範囲を前記異常範囲として、前記スタックオーバフローの予兆を検出する
ことを特徴とする請求項1〜4のいずれか一つに記載の制御装置。
The detection unit
The invention according to any one of claims 1 to 4, wherein an address range indicating a predetermined amount of the stack area in contact with the boundary with the stack overflow area is set as the abnormal range, and a sign of the stack overflow is detected. Control device.
マイクロコンピュータの備えるスタックポインタの値を取得する取得工程と、
前記取得工程によって取得された前記スタックポインタの値が予め定義された異常範囲内に到達した場合に、スタックオーバフローの予兆を検出するとともに、検出履歴を不揮発性メモリ領域へ記録する検出工程と、
前記マイクロコンピュータのリセットからの復帰時において前記検出履歴がある場合に、当該リセットを前記スタックオーバフローによるものと判定する判定工程と
を含むことを特徴とする原因判定方法。
The acquisition process to acquire the value of the stack pointer provided by the microcomputer,
A detection step of detecting a sign of stack overflow and recording the detection history in a non-volatile memory area when the value of the stack pointer acquired by the acquisition step reaches within a predefined abnormal range.
A cause determination method including a determination step of determining that the reset is due to the stack overflow when there is the detection history at the time of returning from the reset of the microcomputer.
JP2019041881A 2019-03-07 2019-03-07 Control device and cause determination method Pending JP2020144699A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2019041881A JP2020144699A (en) 2019-03-07 2019-03-07 Control device and cause determination method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2019041881A JP2020144699A (en) 2019-03-07 2019-03-07 Control device and cause determination method

Publications (1)

Publication Number Publication Date
JP2020144699A true JP2020144699A (en) 2020-09-10

Family

ID=72354277

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2019041881A Pending JP2020144699A (en) 2019-03-07 2019-03-07 Control device and cause determination method

Country Status (1)

Country Link
JP (1) JP2020144699A (en)

Similar Documents

Publication Publication Date Title
US9632855B2 (en) Method and apparatus for controlling watchdog
US8677189B2 (en) Recovering from stack corruption faults in embedded software systems
US7350007B2 (en) Time-interval-based system and method to determine if a device error rate equals or exceeds a threshold error rate
CN101667128B (en) Method for updating and repairing basic input and output system
US10691565B2 (en) Storage control device and storage control method
US20160357623A1 (en) Abnormality detection method and information processing apparatus
CN114691025A (en) Log recording method, device, equipment and storage medium
US20210124655A1 (en) Dynamic Configurable Microcontroller Recovery
JP4886558B2 (en) Information processing device
JP6723941B2 (en) Control device and control program updating method
US20170154480A1 (en) Information processing apparatus and large scale integrated circuit
US20170242760A1 (en) Monitoring device, fault-tolerant system, and control method
JP6880961B2 (en) Information processing device and log recording method
JP2020144699A (en) Control device and cause determination method
JP2016066139A (en) Vehicle control unit
JP6183251B2 (en) Electronic control unit
CN108073489B (en) Method for ensuring operation of calculator
US10540222B2 (en) Data access device and access error notification method
JP4562641B2 (en) Computer system, operation state determination program, and operation state determination method
US10108499B2 (en) Information processing device with watchdog timer
JP5942904B2 (en) Processing equipment
JP2021189864A (en) Vehicle electronic controller and vehicle control method
CN108415788B (en) Data processing apparatus and method for responding to non-responsive processing circuitry
KR100188716B1 (en) Memory diagnosing method of ecu
JP7504222B2 (en) In-vehicle control systems