JP6463445B1 - In-vehicle control device - Google Patents

In-vehicle control device Download PDF

Info

Publication number
JP6463445B1
JP6463445B1 JP2017216162A JP2017216162A JP6463445B1 JP 6463445 B1 JP6463445 B1 JP 6463445B1 JP 2017216162 A JP2017216162 A JP 2017216162A JP 2017216162 A JP2017216162 A JP 2017216162A JP 6463445 B1 JP6463445 B1 JP 6463445B1
Authority
JP
Japan
Prior art keywords
cpu
program
interrupt
execution
address
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
JP2017216162A
Other languages
Japanese (ja)
Other versions
JP2019087118A (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.)
Mitsubishi Electric Corp
Original Assignee
Mitsubishi Electric 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 Mitsubishi Electric Corp filed Critical Mitsubishi Electric Corp
Priority to JP2017216162A priority Critical patent/JP6463445B1/en
Application granted granted Critical
Publication of JP6463445B1 publication Critical patent/JP6463445B1/en
Publication of JP2019087118A publication Critical patent/JP2019087118A/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

【課題】デバッガを使用しなくても制御プログラムの不具合の原因を特定できるとともに、フック関数を用意しなくても制御プログラムの不具合の解消を確認できる車載制御装置を提供する。【解決手段】車載制御装置1は、ROM7とRAM6とCPU5とを備える。ROMは、周期制御処理と、周期制御処理を構成する一連の処理の中で複数の予め決められる特定処理が個別に実行されるたびに実行される割り込み処理とを含む、制御プログラムを記憶する。RAMは、拡張プログラムとして、周期制御処理において不具合を発見し、その不具合の原因を特定できる、第1拡張プログラム、および、処理部分の不具合を修正する前の制御プログラムに対して、不具合を修正した後の処理部分が追加され、修正前の処理部分の代わりに実行され、制御プログラムの不具合の解消を確認できる、第2拡張プログラムを記憶する。CPUは、制御プログラムおよび拡張プログラムを実行する。【選択図】図1An in-vehicle control device that can identify the cause of a malfunction of a control program without using a debugger and can confirm the elimination of the malfunction of the control program without preparing a hook function. An in-vehicle control device includes a ROM, a RAM, and a CPU. The ROM stores a control program including a cycle control process and an interrupt process that is executed each time a plurality of predetermined specific processes are individually executed in a series of processes constituting the cycle control process. RAM, as an extended program, has discovered a problem in the periodic control process, and has corrected the problem with respect to the first extended program that can identify the cause of the problem and the control program prior to correcting the problem in the processing part A later processing part is added and stored in the second extension program, which is executed in place of the processing part before correction, and which can confirm that the control program has been solved. The CPU executes a control program and an extension program. [Selection] Figure 1

Description

本発明は、制御プログラムの実行結果に関する情報をRAMから取得することができるように工夫された車載制御装置に関するものである。   The present invention relates to an in-vehicle control device devised so that information related to the execution result of a control program can be acquired from a RAM.

モータ駆動用インバータ、照明駆動用コンバータ等の制御を行う車載制御装置(Electronic Contol Unit;以下、「ECU」と記す)は、モータ、照明機器等の制御対象のハウジング内に組み込まれ、機能部品として製品化される。   An in-vehicle control unit (Electronic Control Unit; hereinafter referred to as “ECU”) that controls an inverter for driving a motor, a converter for driving an illumination, and the like is incorporated in a housing to be controlled such as a motor and an illumination device as a functional component. It is commercialized.

ECUは、各種制御処理を行ったり、他のECUと情報交換、協調動作等を行ったりするために、以下のように構成される。すなわち、ECUは、CAN、FlexRay、Ethernet(登録商標)等の通信線に接続される他のECU、各種ツール等との通信(以下、「外部通信」と記す)を行う機能を有するマイクロコンピュータ(以下、「マイコン」と記す)を備えて構成される。   The ECU is configured as follows in order to perform various control processes, exchange information with other ECUs, perform cooperative operations, and the like. That is, the ECU has a function of performing communication (hereinafter referred to as “external communication”) with other ECUs and various tools connected to communication lines such as CAN, FlexRay, and Ethernet (registered trademark) ( (Hereinafter referred to as “microcomputer”).

Universal Measurement and Calibration Protocol、[平成29年8月25日検索]、インターネット <URL : https://wiki.asam.net/display/STANDARDS/ASAM+MCD−1+XCP>Universal Measurement and Calibration Protocol, [Search on August 25, 2017], Internet <URL: https: // wiki. asam. net / display / STANDARDS / ASAM + MCD-1 + XCP> Bypassing−Externally or Directly on the ECU、[平成29年8月25日検索]、インターネット <URL : https://www.dspace.com/en/pub/home/products/systems/functp/bypassing.cfm>Bypassing-Externally or Directly on the ECU, [August 25, 2017 search], Internet <URL: https: // www. dspace. com / en / pub / home / products / systems / funtp / bypassing. cfm>

ここで、マイコンが実行する制御プログラムの開発では、製品に課せられた要求を満たすように、処理を追加したり変更したり削除したりして、その結果が妥当であるか否かを確認するための試験が行われる。また、この開発では、要求を満足しない処理、意図しない振る舞い、誤り等(以下、「不具合」と記す)を繰り返し修正することが行われる。   Here, in the development of the control program executed by the microcomputer, processing is added, changed, or deleted to meet the requirements imposed on the product, and whether the result is valid is confirmed. Tests are conducted for In this development, processing that does not satisfy the requirements, unintended behavior, errors, etc. (hereinafter referred to as “defects”) are repeatedly corrected.

制御プログラムの開発初期において、制御プログラムの実用性が十分確認できない段階では、ECUを制御対象と組み合わせることなく、ECU単体で開発が行われる。ECU単体で開発が行われる場合、ECUのマイコンにデバッガを常に接続した状態で、その開発を進めることができる。制御プログラムに不具合が発見された場合、その不具合の原因の調査は、以下のように進められる。すなわち、その調査は、デバッガによって提供されるソースレベルデバッグ機能を利用することによって、制御プログラムのソースコードの各行において意図通りの実行結果となっているか否かを確認しながら進められる。   In the initial stage of development of the control program, at the stage where the practicality of the control program cannot be sufficiently confirmed, development is performed by the ECU alone without combining the ECU with the control target. When development is performed by the ECU alone, the development can proceed with the debugger always connected to the microcomputer of the ECU. When a defect is found in the control program, the investigation of the cause of the defect proceeds as follows. That is, the investigation proceeds while confirming whether or not the execution result is as intended in each line of the source code of the control program by using the source level debugging function provided by the debugger.

制御プログラムは、その実用性が十分確認できたところで、制御対象と組み合わされて統合試験が行われる。この段階では、ECUは、制御対象のハウジング内に組み込まれることが多く、ECUのマイコンにデバッガを接続することが困難な場合が多い。そこで、ECUが通常備える外部通信機能に対して、制御プログラムの処理データ、状態を示す変数等の実行時データの送信機能を追加する。この送信機能によって送信される実行時データを受信して観測することで、制御プログラムが正常に動作しているか否かを確認する。   When the practicality of the control program is sufficiently confirmed, an integrated test is performed in combination with the control target. At this stage, the ECU is often incorporated in the housing to be controlled, and it is often difficult to connect a debugger to the microcomputer of the ECU. Therefore, a function for transmitting processing data of the control program, execution time data such as a variable indicating the state is added to the external communication function normally provided in the ECU. By receiving and observing the runtime data transmitted by this transmission function, it is confirmed whether or not the control program is operating normally.

上述の制御プログラムの実行時データは、例えば、ASAM(Association for Standardisation of Automation and Measuring Systems)が規格化しているCAN Calibration Protocol、またはUniversal Measurement and Calibration Protocol(以下、「XCP」と記す)に基づいたプロトコルを適用して送信される(例えば、非特許文献1参照)。   The execution data of the above-described control program is, for example, CAN Calibration Protocol (hereinafter referred to as Universal Measurement and Calibration), which is standardized by Association for Standardization of Automation and Measurement Systems (ASAM), or Universal Measurement and Calibration. It is transmitted by applying a protocol (see, for example, Non-Patent Document 1).

非特許文献1によれば、XCPを適用するECUは、制御プログラムを実行するCPU(central processing unit)がアクセス可能な各アドレスが保持する値の読み出しが可能であり、さらに、アドレスがRAM(random access memory)または周辺機能レジスタである場合、そのアドレスに指定の値を書き込むことができる。この場合、単位時間あたりに取得可能な制御プログラムの実行時データの数および量は、ECUの外部通信機能の通信速度、データ処理速度等の性能によって制限される。   According to Non-Patent Document 1, an ECU to which XCP is applied can read a value held by each address accessible by a CPU (central processing unit) that executes a control program, and further, the address can be stored in a RAM (random). in the case of an access memory) or a peripheral function register, a specified value can be written to the address. In this case, the number and amount of execution data of the control program that can be acquired per unit time is limited by performance such as the communication speed and data processing speed of the external communication function of the ECU.

XCPの主な用途として、例えば、制御プログラムが算出する制御目標値が制御対象にとって最適でない場合、その算出に使用する各種制御パラメータを繰り返し調整する工程(以下、「キャリブレーション」と記す)に使用される。   As a main application of XCP, for example, when the control target value calculated by the control program is not optimal for the control target, it is used for the process of repeatedly adjusting various control parameters used for the calculation (hereinafter referred to as “calibration”). Is done.

また、XCPを適用するECUは、上述のRAMだけでなく、制御プログラム、データ等を記憶するフラッシュメモリを書き変えるPROGRAMコマンドに対応することができる。このコマンドを利用すれば、ECUの外部通信機能を介してフラッシュメモリに記憶された制御プログラムまたはデータの一部または全部を書き換えることができる。さらに、XCPに定義されていないコマンドをユーザーが追加定義して使用することも可能である。   Further, the ECU to which XCP is applied can correspond to a PROGRAM command for rewriting a flash memory storing a control program, data, and the like as well as the above-described RAM. By using this command, part or all of the control program or data stored in the flash memory can be rewritten via the external communication function of the ECU. Further, it is possible for the user to additionally define and use a command not defined in XCP.

上述の統合試験において、制御プログラムに不具合が発見された場合、制御プログラムの開発者は、上述の実行時データを取得して解析し、制御プログラムの不具合の原因を特定しなければならない場合がある。この場合、制御プログラム開発者は、制御プログラムの実行時データの一部しか取得することができず、マイコンにデバッガを接続した場合に提供される制御プログラムのソースレベルデバッグ機能を利用することができない。そのため、制御プログラムの不具合の原因の調査が困難であるという問題がある。   When a defect is found in the control program in the integration test described above, the developer of the control program may need to acquire and analyze the above-mentioned runtime data to identify the cause of the defect in the control program. . In this case, the control program developer can obtain only a part of the control program runtime data, and cannot use the source level debugging function of the control program provided when the debugger is connected to the microcomputer. . Therefore, there is a problem that it is difficult to investigate the cause of the malfunction of the control program.

したがって、制御プログラム開発者は、制御プログラムの実行時データの一部に基づき、制御プログラムの不具合の原因を推定し、修正した制御プログラムをXCP等の手段を用いてECUに書き込み、再度の統合試験を行うことになる。   Therefore, the control program developer estimates the cause of the malfunction of the control program based on a part of the execution data of the control program, writes the corrected control program to the ECU using means such as XCP, and performs the integration test again. Will do.

ただし、制御プログラムの不具合の原因の推定が正しくない場合、その不具合が完全に解消できないことがある。その場合、制御プログラムの不具合の真の原因が特定されるまで、上述の制御プログラムの実行時データを取得する工程から、統合試験を行う工程までの開発サイクルを繰り返すことになる。その結果、制御プログラムの開発に時間がかかるという問題がある。   However, when the cause of the malfunction of the control program is not correctly estimated, the malfunction may not be completely eliminated. In that case, the development cycle from the process of acquiring the above-mentioned control program execution data to the process of performing the integration test is repeated until the true cause of the malfunction of the control program is identified. As a result, there is a problem that it takes time to develop a control program.

上述したXCPのPROGRAMコマンドを利用すれば、ECUのフラッシュメモリを書き換えて、不具合を修正した後の制御プログラムに更新することができる。しかしながら、上述したように、制御プログラムの不具合の原因の推定が正しくない場合、不具合の原因を正しく推定するために、不具合が発生する制御プログラムの実行時データを取得する工程に戻る必要がある。そのため、修正後の制御プログラムを修正前の状態に戻す必要があることが多い。このようなことから、修正後の制御プログラムを修正前の状態に戻すことなく、不具合の原因を特定し、修正の効果を確認できることが望ましい。   If the XCP PROGRAM command described above is used, the flash memory of the ECU can be rewritten to update the control program after correcting the problem. However, as described above, when the cause of the malfunction of the control program is not correctly estimated, it is necessary to return to the step of acquiring the execution data of the control program in which the malfunction occurs in order to correctly estimate the cause of the malfunction. Therefore, it is often necessary to return the control program after correction to the state before correction. For this reason, it is desirable to be able to identify the cause of the defect and confirm the effect of the correction without returning the corrected control program to the state before the correction.

上述の開発サイクル、特に制御プログラムのアルゴリズムを修正する工程の繰り返しに要する時間を短縮するための手段として、例えば、Bypassingが従来から知られている(例えば、非特許文献1、2参照)。   As a means for shortening the time required for repeating the above-described development cycle, particularly the process of correcting the algorithm of the control program, for example, Bypassing has been conventionally known (for example, refer to Non-Patent Documents 1 and 2).

非特許文献2によれば、元のプログラム処理を実行する直前に、フック関数と呼ばれる分岐処理関数を設け、このフック関数内で元の処理、または後で作成した制御パラメータを変更した処理を選択して実行する。これにより、ECUのROM(read only memory)に記憶される制御プログラム全体を書き変えることなく、変更が必要な処理だけを変更後の処理に切り替えてプログラムを実行させることが可能である。   According to Non-Patent Document 2, a branch processing function called a hook function is provided immediately before executing the original program process, and the original process or a process in which a control parameter created later is changed in the hook function is selected. And run. Thereby, it is possible to switch only the process that needs to be changed to the post-change process and execute the program without rewriting the entire control program stored in the ROM (read only memory) of the ECU.

なお、上述のBypassingの実装方法としては、以下の2通りの方法が知られている(例えば、非特許文献2参照)。すなわち、第1方法として、フック関数がXCPおよび外部通信を介して、処理に使用するパラメータ、すなわち関数の引数を、例えばパーソナルコンピュータ等の外部に送信し、外部で処理を実行した結果をECUに返信するExternal Bypassingが挙げられる。第2方法として、予めECUのRAMに記憶した変更後のプログラム部分にフック関数内から分岐して実行するOn−target Bypassingが挙げられる。特に、ECUでは、制御処理の周期が数十μ秒と短い場合があり、External Bypassingでは、外部通信が時間的なボトルネックとなり、その周期以内に外部通信から処理結果を受信することが困難である。したがって、ECUでは、ECU内で処理を実行できるOn−target Bypassingが必要になることがある。   Note that the following two methods are known as mounting methods of the above-mentioned bypassing (for example, see Non-Patent Document 2). That is, as a first method, a hook function transmits parameters used for processing, that is, an argument of the function to the outside of, for example, a personal computer or the like via XCP and external communication, and the result of executing processing outside is sent to the ECU. There is an example of External Bypassing. As a second method, there is On-target Bypassing that is executed by branching from the hook function to the changed program portion stored in advance in the RAM of the ECU. In particular, in ECUs, the cycle of control processing may be as short as several tens of microseconds. With External Bypassing, external communication becomes a time bottleneck, and it is difficult to receive processing results from external communication within that cycle. is there. Therefore, the ECU may require on-target bypassing that can execute processing in the ECU.

制御パラメータのキャリブレーションを行う場合、制御パラメータの調整が必要な処理の箇所が分かっているので、予め必要な処理箇所だけにフック関数を追加することができる。   When calibrating the control parameter, the processing function that requires adjustment of the control parameter is known, so that the hook function can be added only to the necessary processing part.

しかしながら、制御プログラムのアルゴリズムに不具合が発生する場合、その発生箇所を予め予測してフック関数を用意しておくことが困難である。したがって、任意の箇所で発生する制御プログラムの不具合に対して予め対応可能とするためには、例えば、全ての関数にフック関数を用意する必要がある。この場合、制御プログラムの一部で発生する不具合に対応するために、制御プログラム全域にわたってフック関数を作成するのは非効率であるという問題がある。   However, when a problem occurs in the algorithm of the control program, it is difficult to predict the occurrence location in advance and prepare a hook function. Therefore, in order to be able to cope with a malfunction of a control program that occurs at an arbitrary location in advance, for example, it is necessary to prepare hook functions for all functions. In this case, there is a problem that it is inefficient to create a hook function over the entire control program in order to cope with a problem occurring in a part of the control program.

本発明は、上述のような課題を解決するためになされたものであり、デバッガを使用しなくても制御プログラムの不具合の原因を特定することができるとともに、フック関数を用意しなくても制御プログラムの不具合の解消を確認することができる車載制御装置を得ることを目的とする。   The present invention has been made to solve the above-described problems, and can determine the cause of a malfunction of a control program without using a debugger, and can control without preparing a hook function. An object of the present invention is to obtain an in-vehicle control device capable of confirming the elimination of a program defect.

本発明における車載制御装置は、制御対象を周期的に制御するための周期制御処理と、周期制御処理を構成する一連の処理の中で複数の予め決められる特定処理が個別に実行されるたびに実行される割り込み処理とを含む制御プログラムを記憶するROMと、拡張プログラムとして第1拡張プログラムおよび第2拡張プログラムを記憶するRAMと、制御プログラムおよび拡張プログラムを実行するCPUと、を備え、CPUは、特定処理を実行する際にアクセスする実行アドレスにアクセスしたことを検知して、割り込みを発生させるアクセス検知機能を備え、アクセス検知機能によって発生した割り込みに応答して割り込み処理を実行させることで、周期制御処理で特定処理の実行後以降の処理を中断し、第1拡張プログラムまたは第2拡張プログラムを実行し、当該実行後に、周期制御処理で特定処理の実行後以降の処理を再開し、第1拡張プログラムを実行させることで、特定処理の処理結果をRAMに記憶させるとともに、周期制御処理で特定処理の次に実行される次の特定処理の実行アドレスにCPUがアクセスしたことをアクセス検知機能が検知するように、アクセス検知機能を設定し、第2拡張プログラムを実行させることで、周期制御処理で不具合が発生する原因である処理の結果を修正するものである。 The vehicle-mounted control device according to the present invention each time a plurality of predetermined specific processes are individually executed in a cycle control process for periodically controlling a control target and a series of processes constituting the cycle control process. A ROM for storing a control program including interrupt processing to be executed, a RAM for storing a first extension program and a second extension program as an extension program, and a CPU for executing the control program and the extension program. , Equipped with an access detection function that detects an access to an execution address that is accessed when executing a specific process and generates an interrupt, and by executing an interrupt process in response to an interrupt generated by the access detection function, The process after the execution of the specific process is interrupted in the cycle control process, and the first extension program or second After executing the program, the process after the execution of the specific process is resumed in the cyclic control process, and the first extension program is executed, so that the processing result of the specific process is stored in the RAM and the cyclic control is performed. By setting the access detection function and executing the second extension program so that the access detection function detects that the CPU has accessed the execution address of the next specific process executed next to the specific process in the process, it is intended to correct the result of the cause of the defect in processing at a cycle control process.

本発明によれば、デバッガを使用しなくても制御プログラムの不具合の原因を特定することができるとともに、フック関数を用意しなくても制御プログラムの不具合の解消を確認することができる車載制御装置を得ることができる。   According to the present invention, an in-vehicle control apparatus that can identify the cause of a malfunction of a control program without using a debugger and can confirm the elimination of the malfunction of the control program without preparing a hook function. Can be obtained.

本発明の実施の形態1におけるECUの構成を示すブロック図である。It is a block diagram which shows the structure of ECU in Embodiment 1 of this invention. 本発明の実施の形態1におけるCPUに具備される機能を示すブロック図である。It is a block diagram which shows the function with which CPU in Embodiment 1 of this invention is equipped. 本発明の実施の形態1におけるRAMに設けられる制御プログラム拡張部を示すブロック図である。It is a block diagram which shows the control program expansion part provided in RAM in Embodiment 1 of this invention. 本発明の実施の形態1におけるCPUが実行する拡張プログラムのコマンドの定義の一例を示す表である。It is a table | surface which shows an example of the definition of the command of the extended program which CPU in Embodiment 1 of this invention performs. 本発明の実施の形態1におけるROMに記憶される制御プログラムを示すブロック図である。It is a block diagram which shows the control program memorize | stored in ROM in Embodiment 1 of this invention. 本発明の実施の形態1におけるCPUが実行する制御プログラムの周期制御処理を示すフローチャートである。It is a flowchart which shows the period control process of the control program which CPU in Embodiment 1 of this invention performs. 本発明の実施の形態1におけるCPUが実行する制御プログラムの割り込み処理を示すフローチャートである。It is a flowchart which shows the interruption process of the control program which CPU runs in Embodiment 1 of this invention. 本発明の実施の形態1におけるCPUが実行する制御プログラムの割り込み処理で呼び出されるサブルーチンを示すフローチャートである。It is a flowchart which shows the subroutine called by the interruption process of the control program which CPU runs in Embodiment 1 of this invention. 本発明の実施の形態1におけるCPUが実行する制御プログラムの割り込み処理で呼び出されるサブルーチンのコマンドの定義の一例を示す表である。It is a table | surface which shows an example of the definition of the command of the subroutine called by the interruption process of the control program which CPU in Embodiment 1 of this invention performs. 本発明の実施の形態1におけるCPUが実行する制御プログラムの割り込み処理で呼び出されるサブルーチンのコマンドの定義の一例を示す表である。It is a table | surface which shows an example of the definition of the command of the subroutine called by the interruption process of the control program which CPU in Embodiment 1 of this invention performs. 本発明の実施の形態1におけるCPUが実行する制御プログラムの割り込み処理で呼び出されるサブルーチンを示すフローチャートである。It is a flowchart which shows the subroutine called by the interruption process of the control program which CPU runs in Embodiment 1 of this invention.

以下、本発明による車載制御装置を、好適な実施の形態にしたがって図面を用いて説明する。なお、図面の説明においては、同一部分または相当部分には同一符号を付し、重複する説明を省略する。   Hereinafter, a vehicle-mounted control device according to the present invention will be described with reference to the drawings according to a preferred embodiment. In the description of the drawings, the same portions or corresponding portions are denoted by the same reference numerals, and redundant description is omitted.

実施の形態1.
図1は、本発明の実施の形態1におけるECU1の構成を示すブロック図である。図1では、ECU1は、制御対象の一例であるモータ11の制御を実行するとともに、外部通信線12によって外部と通信するように構成される場合を例示している。
Embodiment 1 FIG.
FIG. 1 is a block diagram showing a configuration of ECU 1 according to Embodiment 1 of the present invention. In FIG. 1, the ECU 1 exemplifies a case in which the control of the motor 11 that is an example of the control target is performed and the external communication line 12 is configured to communicate with the outside.

ここで、後述するECU1の構成によって、ECU1によって制御プログラム内の周期制御処理において不具合を発見し、その不具合の原因を特定することができる。周期制御処理は、例えば50μ秒といった短い周期で実行される。また、ECU1の構成によって、処理部分の不具合を修正する前の制御プログラムに対して、その不具合を修正した後の処理部分が追加され、修正前の処理部分の代わりに、追加した処理部分が実行される。その結果、制御プログラムの不具合の解消を確認することができる。   Here, with the configuration of the ECU 1, which will be described later, the ECU 1 can find a problem in the periodic control process in the control program and specify the cause of the problem. The cycle control process is executed at a short cycle of, for example, 50 μsec. Moreover, the processing part after correcting the defect is added to the control program before correcting the defect of the processing part by the configuration of the ECU 1, and the added processing part is executed instead of the processing part before the correction. Is done. As a result, it is possible to confirm that the control program has been solved.

図1において、ECU1は、入力回路2、マイコン3および駆動回路10を備え、モータ11を制御するとともに、外部通信線12と接続される。マイコン3は、入出力機能(以下、I/Oと記す)4と、CPU5と、RAM6と、ROM7と、タイマ8と、外部通信機能9とを備える。   In FIG. 1, an ECU 1 includes an input circuit 2, a microcomputer 3, and a drive circuit 10, and controls a motor 11 and is connected to an external communication line 12. The microcomputer 3 includes an input / output function (hereinafter referred to as I / O) 4, a CPU 5, a RAM 6, a ROM 7, a timer 8, and an external communication function 9.

ここで、本実施の形態1のECU1の構成では、マイコン3の外部通信機能9に対して例えばXCPに基づいたプロトコルを追加する。これにより、外部通信から指定のメモリアドレスのアクセスを検知するための設定が行われ、後述する図9および図10に示す指定のコマンドとその引数がRAM6に記憶される。   Here, in the configuration of the ECU 1 of the first embodiment, a protocol based on, for example, XCP is added to the external communication function 9 of the microcomputer 3. As a result, the setting for detecting the access of the designated memory address from the external communication is performed, and the designated command and its argument shown in FIGS. 9 and 10 to be described later are stored in the RAM 6.

入力回路2は、外部からの信号、および制御対象であるモータ11に設けられる各種センサからの信号を電圧として読み取る。I/O4は、デジタル信号の入出力を行い、入力回路2によって読み取られた電圧のマイコン3内への取り込みを行い、駆動回路10への制御信号の出力を行う。   The input circuit 2 reads signals from the outside and signals from various sensors provided in the motor 11 to be controlled as voltages. The I / O 4 inputs and outputs digital signals, takes in the voltage read by the input circuit 2 into the microcomputer 3, and outputs a control signal to the drive circuit 10.

CPU5は、周知のアーキテクチャを用いたマイクロプロセッサであり、ROM7に記憶される後述する制御プログラム70を実行可能に構成される。また、CPU5は、制御プログラム70の実行中に割り込みが発生した場合、その割り込みに応じた処理を実行する。なお、CPU5として適用されるマイクロプロセッサによっては、割り込みを例外と呼ぶことがあるが、本実施の形態1では、両者を特に区別せず、単に割り込みと呼ぶこととする。   The CPU 5 is a microprocessor using a well-known architecture, and is configured to be able to execute a later-described control program 70 stored in the ROM 7. Further, when an interrupt occurs during the execution of the control program 70, the CPU 5 executes a process corresponding to the interrupt. Depending on the microprocessor applied as the CPU 5, the interrupt may be referred to as an exception, but in the first embodiment, the two are not particularly distinguished and are simply referred to as an interrupt.

続いて、CPU5に具備される機能について、図2を参照しながら説明する。図2は、本発明の実施の形態1におけるCPU5に具備される機能を示すブロック図である。   Next, functions provided in the CPU 5 will be described with reference to FIG. FIG. 2 is a block diagram illustrating functions provided in the CPU 5 according to Embodiment 1 of the present invention.

図2に示すように、CPU5は、ブレイクポイント機能(以下、「BP」と記す)51と、2つのメモリ保護機能(以下、「MPU」と記す)、すなわち、第1MPU52および第2MPU53によって構成されるメモリ保護機能組とを備える。   As shown in FIG. 2, the CPU 5 includes a breakpoint function (hereinafter referred to as “BP”) 51 and two memory protection functions (hereinafter referred to as “MPU”), that is, a first MPU 52 and a second MPU 53. A memory protection function group.

なお、CPU5に具備されるBP51の数は1つ以上必要であり、CPU5に具備されるメモリ保護機能組の組数は1組以上必要である。   Note that the number of BPs 51 included in the CPU 5 is one or more, and the number of memory protection function groups included in the CPU 5 is one or more.

BP51は、CPU5のレジスタまたはCPU5がアクセス可能なメモリ空間に配置されている。CPU5は、ROM7に記憶されるプログラムを実行することで、BP51を、特定のメモリアドレスに設定可能である。BP51は、CPU5がアクセスするメモリアドレスを監視し、設定されたアドレスにCPU5がアクセスすれば、設定されたアドレスにCPU5がアクセスしたことをCPU5に通知する割り込み(以下、「BP割り込み」と記す)を発生させる。つまり、BP51は、CPU5が特定のアドレスにアクセスしたことを検知することができる。   The BP 51 is arranged in a register of the CPU 5 or a memory space accessible by the CPU 5. The CPU 5 can set the BP 51 to a specific memory address by executing a program stored in the ROM 7. The BP 51 monitors a memory address accessed by the CPU 5, and if the CPU 5 accesses the set address, an interrupt that notifies the CPU 5 that the CPU 5 has accessed the set address (hereinafter referred to as "BP interrupt"). Is generated. That is, the BP 51 can detect that the CPU 5 has accessed a specific address.

CPU5がBP51を操作できない場合、すなわち、BP51を使用できない場合、BP51の代わりに、第1MPU52および第2MPU53が使用される。CPU5は、I/O4、RAM6、ROM7、タイマ8および外部通信機能9にアクセスすることができれば、単一コアでもあっても、複数コアであってもよい。   When the CPU 5 cannot operate the BP 51, that is, when the BP 51 cannot be used, the first MPU 52 and the second MPU 53 are used instead of the BP 51. The CPU 5 may be a single core or a plurality of cores as long as it can access the I / O 4, the RAM 6, the ROM 7, the timer 8, and the external communication function 9.

第1MPU52および第2MPU53は、CPU5がアクセスするメモリアドレスが、第1MPU52および第2MPU53が設定されるアドレス範囲内か否かを監視する。CPU5は、第1MPU52および第2MPU53を、それぞれ、アドレス範囲の下限値と上限値に設定可能である。第1MPU52および第2MPU53は、CPU5がアクセスするメモリアドレスが、設定されたアドレス範囲外であれば、設定されたアドレス範囲外のアドレスにCPU5がアクセスしたことをCPU5に通知する割り込み(以下、「MPU割り込み」と記す)を発生させる。   The first MPU 52 and the second MPU 53 monitor whether or not the memory address accessed by the CPU 5 is within an address range in which the first MPU 52 and the second MPU 53 are set. The CPU 5 can set the first MPU 52 and the second MPU 53 to the lower limit value and the upper limit value of the address range, respectively. If the memory address accessed by the CPU 5 is outside the set address range, the first MPU 52 and the second MPU 53 notify the CPU 5 that the CPU 5 has accessed an address outside the set address range (hereinafter referred to as “MPU”). Interrupt ”).

本実施の形態1では、BP51を使用できない場合、第1MPU52および第2MPU53の上述の機能を利用して、CPU5が特定のメモリアドレスにアクセスしたことを検知する。例えば、CPU5が或るアドレスAにアクセスしたことを検知する場合、CPU5は、CPU5がアクセス可能なメモリ空間の先頭からアドレスA−1までの範囲に第1MPU52を設定し、アドレスA+1からCPU5がアクセス可能なメモリ空間の末尾までの範囲に第2MPU53を設定する。その後、CPU5は、第1MPU52と第2MPU53の機能を有効化する。   In the first embodiment, when the BP 51 cannot be used, the CPU 5 detects that the CPU 5 has accessed a specific memory address by using the above-described functions of the first MPU 52 and the second MPU 53. For example, when it is detected that the CPU 5 accesses a certain address A, the CPU 5 sets the first MPU 52 in the range from the beginning of the memory space accessible by the CPU 5 to the address A-1, and the CPU 5 accesses from the address A + 1. The second MPU 53 is set in a range up to the end of the possible memory space. Thereafter, the CPU 5 validates the functions of the first MPU 52 and the second MPU 53.

このように、CPU5は、第1MPU52および第2MPU53を上述のアドレス範囲に設定し、第1MPU52と第2MPU53の機能を有効化する。その後、CPU5がアドレスAをアクセスすれば、アドレスAが、第1MPU52および第2MPU53が設定されたアドレス範囲外のアドレスであるので、MPU割り込みが発生する。つまり、第1MPU52および第2MPU53は、CPU5がアドレスA、すなわち特定のアドレスにアクセスしたことを検知することができる。   As described above, the CPU 5 sets the first MPU 52 and the second MPU 53 in the above-described address range, and validates the functions of the first MPU 52 and the second MPU 53. Thereafter, when the CPU 5 accesses the address A, an MPU interrupt occurs because the address A is an address outside the address range in which the first MPU 52 and the second MPU 53 are set. That is, the first MPU 52 and the second MPU 53 can detect that the CPU 5 has accessed the address A, that is, a specific address.

図1の説明に戻り、駆動回路10は、マイコン3から入力される制御量に従って、モータ11を駆動する。外部通信機能9は、外部通信線12に接続される。外部通信線12は、CAN、CAN FD、FlexRay、Ethernet(登録商標)等の、ECUで使用される一般的な通信線である。なお、本実施の形態1では、モータ11を制御するECU1に対して本発明を適用する場合を例示しているが、これに限定されず、モータ11以外の別の制御対象を制御するECUに対しても本発明が適用可能である。例えば、駆動回路10としてコンバータを用いて、制御対象をモータ11からLEDに代えた場合、LEDの照度制御についても、モータ11の駆動制御と同様に、短い周期で制御処理が行われる。また、外部通信機能9の構成について、特に限定されず、例えば、上述した通信方式を組み合わせて使用される構成、または、同一の通信方式を複数使用される構成が考えられる。さらに、ECU1に対して配線を追加することが可能な場合、マイコン3に具備される例えばUART、SPI等の各種シリアル通信、汎用デジタル入出力(GPIO)等を、外部通信機能9として適用することができる。   Returning to the description of FIG. 1, the drive circuit 10 drives the motor 11 according to the control amount input from the microcomputer 3. The external communication function 9 is connected to the external communication line 12. The external communication line 12 is a general communication line used in an ECU such as CAN, CAN FD, FlexRay, Ethernet (registered trademark), or the like. In addition, in this Embodiment 1, although the case where this invention is applied with respect to ECU1 which controls the motor 11 is illustrated, it is not limited to this, ECU which controls another control object other than the motor 11 is shown. The present invention can also be applied to this. For example, when the converter is used as the drive circuit 10 and the object to be controlled is changed from the motor 11 to the LED, the illuminance control of the LED is also performed in a short cycle similarly to the drive control of the motor 11. The configuration of the external communication function 9 is not particularly limited. For example, a configuration in which the above-described communication methods are used in combination or a configuration in which a plurality of the same communication methods are used is conceivable. Further, when wiring can be added to the ECU 1, various serial communications such as UART and SPI, general-purpose digital input / output (GPIO), etc. provided in the microcomputer 3 are applied as the external communication function 9. Can do.

続いて、RAM6に設けられる制御プログラム拡張部60について、図3を参照しながら説明する。図3は、本発明の実施の形態1におけるRAM6に設けられる制御プログラム拡張部60を示すブロック図である。   Next, the control program extension unit 60 provided in the RAM 6 will be described with reference to FIG. FIG. 3 is a block diagram showing the control program extension unit 60 provided in the RAM 6 according to Embodiment 1 of the present invention.

CPU5は、RAM6にアクセス可能である。図3に示すように、RAM6に設けられる制御プログラム拡張部60は、サブルーチン開始アドレス記憶変数611を有する拡張プログラム開始アドレス記憶部61と、識別番号記憶配列621、第1引数記憶配列622、第2引数記憶配列623およびコマンド実行結果記憶領域624を有するコマンド記憶部62と、プログラム記憶領域631を有する拡張プログラム記憶部63とを備える。   The CPU 5 can access the RAM 6. As shown in FIG. 3, the control program expansion unit 60 provided in the RAM 6 includes an expansion program start address storage unit 61 having a subroutine start address storage variable 611, an identification number storage array 621, a first argument storage array 622, a second A command storage unit 62 having an argument storage array 623 and a command execution result storage region 624 and an extended program storage unit 63 having a program storage region 631 are provided.

拡張プログラム開始アドレス記憶部61において、サブルーチン開始アドレス記憶変数611には、後述するサブルーチンの開始アドレスが記憶される。ここで、サブルーチンは、制御プログラム70を拡張するプログラムの処理単位であり、呼び出し側に処理を返すリターン命令で処理を終えるものであり、例として、C言語では関数と呼ばれる処理単位を意味するものである。   In the extended program start address storage unit 61, a subroutine start address storage variable 611 stores a subroutine start address to be described later. Here, the subroutine is a processing unit of a program that extends the control program 70, and ends processing with a return instruction that returns processing to the caller. For example, in the C language, it means a processing unit called a function. It is.

サブルーチン開始アドレス記憶変数611に記憶される有効なアドレスは、例えばプログラム記憶領域631に記憶されるサブルーチンの開始アドレス、ROM7に記憶されるサブルーチンの開始アドレス等である。   Valid addresses stored in the subroutine start address storage variable 611 are, for example, a subroutine start address stored in the program storage area 631, a subroutine start address stored in the ROM 7, and the like.

コマンド記憶部62において、識別番号記憶配列621には、コマンドを識別するための識別番号が記憶される。第1引数記憶配列622には、識別番号に対応するコマンドを実行するために必要な1つ目の引数情報が第1引数として記憶される。第2引数記憶配列623には、識別番号に対応するコマンドを実行するために必要な2つ目の引数情報が第2引数として記憶される。コマンド実行結果記憶領域624には、識別番号に対応するコマンドを実行した結果が記憶される。   In the command storage unit 62, the identification number storage array 621 stores an identification number for identifying a command. The first argument storage array 622 stores the first argument information necessary for executing the command corresponding to the identification number as the first argument. The second argument storage array 623 stores second argument information necessary for executing the command corresponding to the identification number as the second argument. The command execution result storage area 624 stores the result of executing the command corresponding to the identification number.

ここで、上述のコマンドの一例について、図4を参照しながら説明する。図4は、本発明の実施の形態1におけるCPU5が実行する拡張プログラムのコマンドの定義の一例を示す表である。   Here, an example of the above-described command will be described with reference to FIG. FIG. 4 is a table showing an example of the definition of the extended program command executed by the CPU 5 according to the first embodiment of the present invention.

図4では、識別番号記憶配列621に記憶される識別番号が示され、さらに、サブルーチンの振る舞いが、識別番号に対応するコマンドの定義として示されている。また、第1引数記憶配列622に記憶される第1引数の用途と、第2引数記憶配列623に記憶される第2引数の用途は、図4に示すコマンドの定義から分かる。   In FIG. 4, the identification numbers stored in the identification number storage array 621 are shown, and further, the behavior of the subroutine is shown as the definition of the command corresponding to the identification number. Further, the use of the first argument stored in the first argument storage array 622 and the use of the second argument stored in the second argument storage array 623 can be understood from the command definition shown in FIG.

識別番号記憶配列621、第1引数記憶配列622および第2引数記憶配列623を一組の記憶配列として、複数組の記憶配列をコマンド記憶部62に記憶することで、複数のコマンドをコマンド記憶部62に記憶することができる。なお、図3では、前記一組の記憶配列を個々の配列を用いて例示しているが、プログラムの実装の形態としては、例えばC言語で定義可能な構造体、C++言語で定義可能なクラス等に識別番号記憶配列621、第1引数記憶配列622および第2引数記憶配列623の各要素を定義し、その構造体、クラス等の配列を用いてもよい。   By storing the identification number storage array 621, the first argument storage array 622, and the second argument storage array 623 as one set of storage arrays and storing a plurality of sets of storage arrays in the command storage unit 62, a plurality of commands can be stored in the command storage unit. 62 can be stored. In FIG. 3, the set of storage arrays is illustrated by using individual arrays. However, as a program implementation form, for example, a structure that can be defined in C language, a class that can be defined in C ++ language, or the like. Each element of the identification number storage array 621, the first argument storage array 622, and the second argument storage array 623 may be defined and the structure, the class, and the like may be used.

続いて、ROM7に記憶される制御プログラム70について、図5を参照しながら説明する。図5は、本発明の実施の形態1におけるROM7に記憶される制御プログラム70を示すブロック図である。   Next, the control program 70 stored in the ROM 7 will be described with reference to FIG. FIG. 5 is a block diagram showing a control program 70 stored in the ROM 7 in the first embodiment of the present invention.

ROM7には、制御プログラム70が記憶されており、CPU5は、ROM7に記憶される制御プログラム70を読み出して実行する。図5に示すように、ROM7に記憶される制御プログラム70は、初期化処理71と、制御対象の一例であるモータ11を周期的に制御するための周期制御処理72と、外部通信機能9とXCPを利用して外部通信を行うためのXCP処理73と、BP割り込み処理74と、MPU割り込み処理75とを有する。   The ROM 7 stores a control program 70, and the CPU 5 reads and executes the control program 70 stored in the ROM 7. As shown in FIG. 5, the control program 70 stored in the ROM 7 includes an initialization process 71, a period control process 72 for periodically controlling the motor 11, which is an example of a control target, an external communication function 9, and the like. It has an XCP process 73 for performing external communication using XCP, a BP interrupt process 74, and an MPU interrupt process 75.

次に、制御プログラム70の周期制御処理72について、図6を参照しながら説明する。図6は、本発明の実施の形態1におけるCPU5が実行する制御プログラム70の周期制御処理72を示すフローチャートである。   Next, the cycle control process 72 of the control program 70 will be described with reference to FIG. FIG. 6 is a flowchart showing the cycle control process 72 of the control program 70 executed by the CPU 5 in the first embodiment of the present invention.

ステップS101において、CPU5は、I/O4から入力されるセンサ電圧値を読み出して取得し、処理がステップS102へと進む。CPU5がセンサ電圧値を読み出す手段としては、例えば、マイコン3に具備されるA/D変換機能、あるいは、センサと通信するためのSENTまたはPSI5のプロトコルを利用する手段が考えられる。   In step S101, the CPU 5 reads and acquires the sensor voltage value input from the I / O 4, and the process proceeds to step S102. As a means for the CPU 5 to read the sensor voltage value, for example, an A / D conversion function provided in the microcomputer 3 or a means using a SENT or PSI 5 protocol for communicating with the sensor can be considered.

ステップS102において、CPU5は、ステップS101で取得したセンサ電圧値を補正し、処理がステップS105へと進む。   In step S102, the CPU 5 corrects the sensor voltage value acquired in step S101, and the process proceeds to step S105.

ステップS105において、CPU5は、周期制御処理72の仕様に対しての対応の要否を示す対応要否情報を読み出し、その対応要否情報を判定する。なお、周期制御処理72は、2種類以上の仕様を有し、2種類以上の仕様のうちの特定の仕様に対しての対応として、後述するステップS106の処理を実行する必要がある。   In step S <b> 105, the CPU 5 reads out correspondence necessity information indicating necessity of correspondence to the specification of the cycle control process 72, and determines the necessity information. Note that the cycle control process 72 has two or more types of specifications, and it is necessary to execute the process of step S106 described later as a response to a specific specification of the two or more types of specifications.

また、ステップS105の判定処理では、対応要否情報が「0」である場合には、対応が不要であると判定され、対応要否情報が、「0」でない、すなわち「1」である場合には、対応が必要であると判定されるように構成されている。   Further, in the determination process of step S105, if the correspondence necessity information is “0”, it is determined that no correspondence is necessary, and the correspondence necessity information is not “0”, that is, “1”. Is configured so that it is determined that a response is necessary.

ステップS105において、CPU5は、対応要否情報が、対応が不要であることを示す「0」であるか否かを判定する。CPU5は、対応要否情報が「0」であると判定した場合には、処理がステップS103へと進む。一方、CPU5は、対応要否情報が「0」でないと判定した場合には、処理がステップS106へと進む。   In step S105, the CPU 5 determines whether or not the correspondence necessity information is “0” indicating that no correspondence is necessary. If the CPU 5 determines that the necessity information is “0”, the process proceeds to step S103. On the other hand, if the CPU 5 determines that the correspondence necessity information is not “0”, the process proceeds to step S106.

CPU5が、対応要否情報が「0」であるか否かを判定する手段としては、例えば、以下の手段が考えられる。すなわち、CPU5は、周期制御処理72の処理開始時にI/O4から入力されるデジタル入力値を読み出して取得し、その値がHighレベルであるかLowレベルであるかによって、対応要否情報が「0」であるか否かを判定する。   For example, the following means can be considered as means for the CPU 5 to determine whether the correspondence necessity information is “0”. That is, the CPU 5 reads out and acquires the digital input value input from the I / O 4 at the start of the cycle control processing 72, and the correspondence necessity information is “high level or low level” depending on whether the value is the high level or the low level. Whether or not “0” is determined.

ステップS106において、CPU5は、ステップS102で補正されたセンサ電圧値に対してさらに補正、すなわち、センサ電圧値を追加補正し、処理がステップS103へと進む。   In step S106, the CPU 5 further corrects the sensor voltage value corrected in step S102, that is, additionally corrects the sensor voltage value, and the process proceeds to step S103.

ステップS103において、CPU5は、ステップS102での補正後のセンサ電圧値、またはステップS106での追加補正後のセンサ電圧値から、制御量を算出し、処理がステップS104へと進む。   In step S103, the CPU 5 calculates a control amount from the sensor voltage value after correction in step S102 or the sensor voltage value after additional correction in step S106, and the process proceeds to step S104.

ステップS104において、CPU5は、ステップS104で算出された制御量をI/O4に出力し、処理が終了となる。CPU5は、例えば、PWM(Pulse Width Modulation)制御に対応した制御量をI/O4に出力する。駆動回路10は、I/O4から入力される制御量に従って、モータ11を駆動する。   In step S104, the CPU 5 outputs the control amount calculated in step S104 to the I / O 4, and the process ends. For example, the CPU 5 outputs a control amount corresponding to PWM (Pulse Width Modulation) control to the I / O 4. The drive circuit 10 drives the motor 11 according to the control amount input from the I / O 4.

次に、図6に示す制御プログラム70の周期制御処理72の不具合が発生した際のその不具合の原因を特定する手順について説明する。ここでは、図6に示す周期制御処理72の不具合の一例として、ステップS105において、CPU5が、周期制御処理72の仕様に対しての対応が必要であると判定し、ステップS106を実行すべきところを、逆の判定が行われて、ステップS106が実行されない場合を考える。この場合、ステップS106でセンサ電圧値が追加補正されることなく、ステップS103で制御量が算出されるので、結果として、制御プログラム70について統合試験を実施した際に、要求性能を満足しない結果となる。   Next, a procedure for specifying the cause of the malfunction when the malfunction of the periodic control process 72 of the control program 70 shown in FIG. 6 occurs will be described. Here, as an example of the malfunction of the cycle control process 72 shown in FIG. 6, in step S105, the CPU 5 determines that it is necessary to cope with the specification of the cycle control process 72, and step S106 should be executed. Consider the case where the reverse determination is made and step S106 is not executed. In this case, since the control amount is calculated in step S103 without additional correction of the sensor voltage value in step S106, as a result, when the integrated test is performed on the control program 70, the result that the required performance is not satisfied. Become.

なお、ここでは説明のために、上述のとおり不具合の原因を予め示しているが、実際の不具合の原因の調査の開始段階では、要求性能を満足しないこと以外、不具合の原因が不明の状態である。   For the sake of explanation, the cause of the failure is shown in advance as described above. However, at the start of the investigation of the cause of the actual failure, the cause of the failure is unknown unless it satisfies the required performance. is there.

本実施の形態1では、不具合の原因を特定するために、図6に示す周期制御処理72において、I/O4から入力されるセンサ電圧値に対して、次の3つの項目(1)〜(3)を確認する。   In the first embodiment, in order to identify the cause of the malfunction, the following three items (1) to (1) are applied to the sensor voltage value input from the I / O 4 in the cycle control process 72 shown in FIG. Check 3).

・項目(1):ステップS104でI/O4に出力された制御量が設計範囲内であること
・項目(2):ステップS103で算出された制御量が設計範囲内であること
・項目(3):ステップS102で補正されたセンサ電圧値が設計範囲内であること
Item (1): The control amount output to the I / O 4 in step S104 is within the design range. Item (2): The control amount calculated in step S103 is within the design range. Item (3) ): The sensor voltage value corrected in step S102 is within the design range.

上述の項目(1)〜(3)の確認を効率良く行うために、RAM6の拡張プログラム記憶部63のプログラム記憶領域631には、後述する図8に示す拡張プログラム、すなわち、第1拡張プログラムが記憶される。また、その拡張プログラムの開始アドレスは、外部通信機能9とXCPを利用するなどして記憶される。   In order to efficiently check the above items (1) to (3), the program storage area 631 of the extension program storage unit 63 of the RAM 6 contains an extension program shown in FIG. Remembered. The start address of the extension program is stored by using the external communication function 9 and XCP.

コマンド記憶部62の識別番号記憶配列621と、第1引数記憶配列622と、第2引数記憶配列623のそれぞれには、後述する図9に示す識別番号と、第1引数と、第2引数とが対応付けられて記憶される。   Each of the identification number storage array 621, the first argument storage array 622, and the second argument storage array 623 of the command storage unit 62 includes an identification number, a first argument, and a second argument shown in FIG. Are stored in association with each other.

図8および図9に示されるNは、制御プログラム拡張部60をRAM6に記憶する際に0に設定される。制御プログラム拡張部60をRAM6に記憶する際に、コマンド実行結果記憶領域624には、図9に示すコマンドの実行結果が未だ記憶されていないことを示す、例えば0または255等の初期値が記憶される。   N shown in FIGS. 8 and 9 is set to 0 when the control program expansion unit 60 is stored in the RAM 6. When the control program expansion unit 60 is stored in the RAM 6, the command execution result storage area 624 stores an initial value such as 0 or 255 indicating that the execution result of the command shown in FIG. Is done.

なお、図9では、BP割り込みが発生する場合に実行されるコマンドが示されているが、BP割り込みの代わりにMPU割り込みが発生するようにした場合であっても、図9と同様のコマンドが実行される。以下では、説明の簡単化のため、BP割り込みが発生する場合について説明する。   Note that FIG. 9 shows a command that is executed when a BP interrupt occurs, but even if an MPU interrupt is generated instead of a BP interrupt, a command similar to FIG. Executed. Hereinafter, a case where a BP interrupt occurs will be described for the sake of simplicity.

CPU5が図6に示すステップS101を実行した後にBP割り込みを発生させるために、CPU5は、ステップS101を実行する際にアクセスする実行アドレス、すなわちステップS101の実行アドレスにBP51を設定する。CPU5がアクセス可能なアドレスにBP51が配置されている場合、この設定は、外部通信機能9とXCPを利用して実施される。CPU5がアクセス可能なアドレスにBP51が配置されておらず、CPU5の専用命令等を使用してこの設定を実施する必要がある場合、XCPにユーザー定義のコマンドを追加することで、この設定を実施することができる。   In order to generate a BP interrupt after the CPU 5 executes Step S101 shown in FIG. 6, the CPU 5 sets the BP 51 as an execution address to be accessed when executing Step S101, that is, the execution address of Step S101. When the BP 51 is arranged at an address accessible by the CPU 5, this setting is performed using the external communication function 9 and XCP. If the BP51 is not located at an address accessible by the CPU5 and this setting needs to be performed using a dedicated instruction of the CPU5, this setting is performed by adding a user-defined command to the XCP. can do.

このように、アクセス検知機能としてのBP51は、CPU5が、周期制御処理72を構成する一連の処理であるステップS101〜S106の中で複数の予め決められる特定処理を実行する際にアクセスする実行アドレスに、CPU5がアクセスしたことを検知して、割り込みを発生させる。   As described above, the BP 51 as the access detection function is an execution address that is accessed when the CPU 5 executes a plurality of predetermined specific processes in steps S101 to S106 which are a series of processes constituting the cycle control process 72. Then, it detects that the CPU 5 has accessed and generates an interrupt.

本実施の形態1では、上述したとおり、アクセス検知機能がBP51によって構成されている場合を例示している。この場合、CPU5は、BP51を特定処理の実行アドレスに設定する。このようにアクセス検知機能としてのBP51を設定することで、BP51は、この実行アドレスにCPUがアクセスしたことを検知して、割り込みを発生させる。   In the first embodiment, as described above, the case where the access detection function is configured by the BP 51 is illustrated. In this case, the CPU 5 sets the BP 51 as the execution address for the specific process. By setting the BP 51 as the access detection function in this way, the BP 51 detects that the CPU has accessed this execution address and generates an interrupt.

なお、アクセス検知機能が第1MPU52および第2MPU53によって構成される場合、CPU5は、第1MPU52および第2MPU53を、特定処理の実行アドレスに基づいたアドレス範囲に設定する。具体的なアドレス範囲の設定方法は、上述したMPU割り込みを発生させるための方法と同様である。このようにアクセス検知機能としての第1MPU52および第2MPU53を設定することで、第1MPU52および第2MPU53は、CPU5がアクセスした実行アドレスがアドレス範囲外であることをもって、実行アドレスにCPUがアクセスしたことを検知して、割り込みを発生させる。   When the access detection function is configured by the first MPU 52 and the second MPU 53, the CPU 5 sets the first MPU 52 and the second MPU 53 in an address range based on the execution address of the specific process. A specific address range setting method is the same as the method for generating the MPU interrupt described above. By setting the first MPU 52 and the second MPU 53 as the access detection function in this way, the first MPU 52 and the second MPU 53 indicate that the CPU has accessed the execution address when the execution address accessed by the CPU 5 is outside the address range. Detect and generate an interrupt.

なお、BP51が設定されるステップS101〜ステップS104のそれぞれの実行アドレスは、例えば、制御プログラム70をPC上のデバッガで読み込み、処理とアドレスとの対応を表示することで取得可能である。   In addition, each execution address of step S101-step S104 in which BP51 is set can be acquired by, for example, reading the control program 70 with a debugger on the PC and displaying the correspondence between the process and the address.

次に、図6に示す周期制御処理72のステップS101〜ステップS104のそれぞれが実行されるたびにBP割り込みが発生する場合のCPU5の動作について説明する。   Next, the operation of the CPU 5 when a BP interrupt is generated each time steps S101 to S104 of the cycle control process 72 shown in FIG. 6 are executed will be described.

上述のとおり、制御プログラム拡張部60がRAM6に記憶され、BP51の機能が有効化された後、CPU5がステップS101を実行すれば、第1BP割り込みが発生する。   As described above, after the control program extension unit 60 is stored in the RAM 6 and the function of the BP 51 is validated, the CPU 5 executes step S101, so that the first BP interrupt is generated.

第1BP割り込みが発生すると、CPU5は、図7に示す割り込み処理を実行する。ここで、BP割り込みが発生する場合に実行される割り込み処理について、図7を参照しながら説明する。図7は、本発明の実施の形態1におけるCPU5が実行する制御プログラム70のBP割り込み処理74を示すフローチャートである。割り込み処理は、後述するように、周期制御処理72を構成する一連の処理であるステップS101〜S106の中で、複数の予め決められる特定処理が個別に実行されるたびに実行される。   When the first BP interrupt occurs, the CPU 5 executes the interrupt process shown in FIG. Here, an interrupt process executed when a BP interrupt occurs will be described with reference to FIG. FIG. 7 is a flowchart showing the BP interrupt process 74 of the control program 70 executed by the CPU 5 in the first embodiment of the present invention. As will be described later, the interrupt process is executed each time a plurality of predetermined specific processes are individually executed in steps S101 to S106 which are a series of processes constituting the cycle control process 72.

図7に示す割り込み処理は、発生した割り込みに応答して、周期制御処理72で特定処理の実行後以降の処理を中断し、第1拡張プログラムまたは第2拡張プログラムを実行し、当該実行後に、周期制御処理72で特定処理の実行後以降の処理を再開するように、CPU5に対して動作させる。   In response to the generated interrupt, the interrupt process shown in FIG. 7 interrupts the process after the execution of the specific process in the cycle control process 72, executes the first extension program or the second extension program, and after the execution, In the cycle control process 72, the CPU 5 is operated so as to resume the process after the execution of the specific process.

なお、図7に示す割り込み処理は、制御プログラム70のBP割り込み処理74と、MPU割り込み処理75に適用可能な処理である。つまり、図7に示す割り込み処理は、BP割り込み処理74およびMPU割り込み処理75のいずれにも適用可能である。図7に示す割り込み処理は、BP割り込み処理74およびMPU割り込み処理75のいずれかに適用してもよいし、両方に適用してもよい。   The interrupt process shown in FIG. 7 is a process applicable to the BP interrupt process 74 and the MPU interrupt process 75 of the control program 70. That is, the interrupt process shown in FIG. 7 can be applied to both the BP interrupt process 74 and the MPU interrupt process 75. The interrupt process shown in FIG. 7 may be applied to either the BP interrupt process 74 or the MPU interrupt process 75, or may be applied to both.

図7に示すように、第1BP割り込みが発生して割り込み処理の実行が開始されると、ステップS201において、CPU5は、サブルーチン開始アドレス記憶変数611に記憶されるサブルーチンの開始アドレスを読み出し、処理がステップS202へと進む。   As shown in FIG. 7, when the first BP interrupt occurs and the execution of the interrupt process is started, in step S201, the CPU 5 reads the subroutine start address stored in the subroutine start address storage variable 611, and the process is executed. Proceed to step S202.

ステップS202において、CPU5は、ステップS201で読み出したサブルーチンの開始アドレスが有効であるか否かを判定する。開始アドレスが有効であると判定された場合には、処理がステップS203へと進み、開始アドレスが有効でない、すなわち無効であると判定された場合には、処理が終了となる。   In step S202, the CPU 5 determines whether or not the start address of the subroutine read in step S201 is valid. If it is determined that the start address is valid, the process proceeds to step S203. If it is determined that the start address is not valid, that is, invalid, the process ends.

CPU5がサブルーチン開始アドレス記憶変数611に記憶されるサブルーチンの開始アドレスが有効であるか無効であるかを判定する手段としては、例えば、以下の手段が考えられる。すなわち、CPU5は、開始アドレスがゼロであれば無効であると判定し、開始アドレスがゼロ以外であれば有効であると判定する。   For example, the following means can be considered as means for the CPU 5 to determine whether the subroutine start address stored in the subroutine start address storage variable 611 is valid or invalid. That is, the CPU 5 determines that it is invalid if the start address is zero, and determines that it is valid if the start address is other than zero.

ステップS203において、CPU5は、ステップS201で読み出した開始アドレスに対応するサブルーチンを実行し、処理が終了となる。   In step S203, the CPU 5 executes a subroutine corresponding to the start address read in step S201, and the process ends.

なお、サブルーチン開始アドレス記憶変数611は、制御プログラム70の実行開始時に、初期化処理71によって初期化されて、無効なアドレスを記憶する。   Note that the subroutine start address storage variable 611 is initialized by the initialization processing 71 at the start of execution of the control program 70, and stores an invalid address.

図6に戻り、CPU5は、ステップS101を実行した後、第1BP割り込みが発生すると、図7に示す割り込み処理を実行する。第1BP割り込みが発生する場合、上述したように、サブルーチン開始アドレス記憶変数611には、有効な開始アドレスが設定されている。   Returning to FIG. 6, the CPU 5 executes the interrupt process shown in FIG. 7 when the first BP interrupt occurs after executing Step S <b> 101. When the first BP interrupt occurs, a valid start address is set in the subroutine start address storage variable 611 as described above.

したがって、CPU5は、割り込み処理において、ステップS201を実行した後、ステップS202において、ステップS201で読み出した開始アドレスが有効であると判定し、処理がステップS203へと進む。   Therefore, after executing step S201 in the interrupt process, the CPU 5 determines in step S202 that the start address read in step S201 is valid, and the process proceeds to step S203.

ステップS203において、CPU5は、ステップS201で読み出した開始アドレスに対応するサブルーチンを呼び出し、そのサブルーチンの実行を開始する。   In step S203, the CPU 5 calls a subroutine corresponding to the start address read in step S201, and starts executing the subroutine.

ここで、割り込み処理で呼び出されるサブルーチンについて、図8を参照しながら説明する。図8は、本発明の実施の形態1におけるCPU5が実行する制御プログラム70の割り込み処理で呼び出されるサブルーチンを示すフローチャートである。   Here, a subroutine called in the interrupt process will be described with reference to FIG. FIG. 8 is a flowchart showing a subroutine called in the interrupt process of the control program 70 executed by the CPU 5 in the first embodiment of the present invention.

図8に示す拡張プログラム、すなわち第1拡張プログラムは、特定処理の処理結果をRAM6に記憶するとともに、周期制御処理72で特定処理の次に実行される次の特定処理の実行アドレスにCPU5がアクセスしたことをアクセス検知機能が検知するように、アクセス検知機能を設定するよう、CPU5に対して動作させる。   The extension program shown in FIG. 8, that is, the first extension program, stores the processing result of the specific process in the RAM 6, and the CPU 5 accesses the execution address of the next specific process executed after the specific process in the cycle control process 72. The CPU 5 is caused to operate so as to set the access detection function so that the access detection function detects this.

割り込み処理でサブルーチンが呼び出されると、拡張プログラム記憶部63のプログラム記憶領域631に記憶される拡張プログラム、すなわち図8に示すサブルーチンが実行される。ステップS301において、CPU5は、コマンド記憶部62の識別番号記憶配列621に記憶される要素Nを読み出し、処理がステップS302へと進む。   When the subroutine is called in the interrupt process, the extension program stored in the program storage area 631 of the extension program storage unit 63, that is, the subroutine shown in FIG. 8 is executed. In step S301, the CPU 5 reads the element N stored in the identification number storage array 621 of the command storage unit 62, and the process proceeds to step S302.

ステップS302において、CPU5は、ステップS301で読み出した要素Nに対して1を加算し、その加算後の要素Nを識別番号記憶配列621に記憶し、処理がステップS303へと進む。   In step S302, the CPU 5 adds 1 to the element N read in step S301, stores the element N after the addition in the identification number storage array 621, and the process proceeds to step S303.

ステップS303において、CPU5は、ステップS301で読み出した要素Nに対応するコマンドが終了コマンドであるか否かを判定する。コマンドが終了コマンドであると判定された場合には、処理が終了となり、コマンドが終了コマンドでないと判定された場合には、処理がステップS304へと進む。   In step S303, the CPU 5 determines whether or not the command corresponding to the element N read in step S301 is an end command. If it is determined that the command is an end command, the process ends. If it is determined that the command is not an end command, the process proceeds to step S304.

ステップS304において、ステップS301で読み出した要素Nに対応するコマンドを実行し、処理がステップS301へと戻り、ステップS301以降の処理を再び実行する。   In step S304, the command corresponding to the element N read in step S301 is executed, the process returns to step S301, and the processes after step S301 are executed again.

ここで、図8に示すサブルーチンで実行されるコマンドについて、図9を参照しながら説明する。図9は、本発明の実施の形態1におけるCPU5が実行する制御プログラム70の割り込み処理で呼び出されるサブルーチンのコマンドの定義の一例を示す表である。   Here, the commands executed in the subroutine shown in FIG. 8 will be described with reference to FIG. FIG. 9 is a table showing an example of the definition of a subroutine command called in the interrupt process of the control program 70 executed by the CPU 5 according to the first embodiment of the present invention.

図9に示すように、要素Nおよび識別番号と、第1引数と、第2引数とが対応付けられて、識別番号記憶配列621と、第1引数記憶配列622と、第2引数記憶配列623とにそれぞれ記憶されている。また、図9では、要素Nに対応するコマンドの意味も併せて示している。   As shown in FIG. 9, the element N, the identification number, the first argument, and the second argument are associated with each other, and the identification number storage array 621, the first argument storage array 622, and the second argument storage array 623 are associated with each other. And are stored respectively. FIG. 9 also shows the meaning of the command corresponding to the element N.

図7に戻り、割り込み処理でサブルーチンが呼び出されると、はじめは、N=0であるので、図8に示すサブルーチンでは、ステップS302において、N=1となり、ステップS304において、N=0に対応するコマンドが実行される。この場合、図9から分かるように、CPU5は、ステップS101で取得したセンサ電圧値を読み出して第1データとしてコマンド実行結果記憶領域624に記憶する。   Returning to FIG. 7, when the subroutine is called in the interrupt process, N = 0 at first. Therefore, in the subroutine shown in FIG. 8, N = 1 in step S <b> 302, and N = 0 in step S <b> 304. The command is executed. In this case, as can be seen from FIG. 9, the CPU 5 reads the sensor voltage value acquired in step S101 and stores it in the command execution result storage area 624 as first data.

N=0に対応するコマンドは、処理の終了を指示する終了コマンドではないので、サブルーチンでは、引き続き、ステップS301以降の処理が実行される。サブルーチンでは、ステップS302において、N=2となり、ステップS304において、N=1に対応するコマンドが実行される。この場合、CPU5が図6に示すステップS102を実行した後にBP割り込みを発生させるために、CPU5は、ステップS102を実行する際にアクセスする実行アドレス、すなわちステップS102の実行アドレスにBP51を設定する。   Since the command corresponding to N = 0 is not an end command for instructing the end of the process, the processes in and after step S301 are continuously executed in the subroutine. In the subroutine, N = 2 in step S302, and a command corresponding to N = 1 is executed in step S304. In this case, in order for the CPU 5 to generate a BP interrupt after executing step S102 shown in FIG. 6, the CPU 5 sets the BP 51 as the execution address to be accessed when executing step S102, that is, the execution address of step S102.

N=1に対応するコマンドは、終了コマンドではないので、サブルーチンでは、引き続き、ステップS301以降の処理が実行される。サブルーチンでは、ステップS302において、N=3となり、ステップS303において、N=2に対応するコマンドが終了コマンドであると判定され、処理が終了となる。   Since the command corresponding to N = 1 is not an end command, the processing subsequent to step S301 is subsequently executed in the subroutine. In the subroutine, in step S302, N = 3, and in step S303, it is determined that the command corresponding to N = 2 is an end command, and the process ends.

この場合、サブルーチンが終了となり、処理が図7に示す割り込み処理に返され、さらに割り込み処理が終了となり、処理が図6に示す周期制御処理72のステップS101の実行の完了地点に戻る。なお、サブルーチンの終了時において、識別番号記憶配列621に記憶される要素Nの値そのものは、上述したとおり、N=3になっている。   In this case, the subroutine is finished, the process is returned to the interrupt process shown in FIG. 7, the interrupt process is further finished, and the process returns to the completion point of execution of step S101 of the cycle control process 72 shown in FIG. At the end of the subroutine, the value of the element N stored in the identification number storage array 621 is N = 3 as described above.

このように、CPU5は、アクセス検知機能としてのBP51によって発生した割り込みに応答して、周期制御処理72でステップS101の実行後以降の処理を中断する。また、CPU5は、割り込み処理を実行させることで、拡張プログラムに従って、ステップS101の処理結果をコマンド実行結果記憶領域624に記憶する。   As described above, the CPU 5 interrupts the processing after the execution of step S101 in the cycle control processing 72 in response to the interrupt generated by the BP 51 as the access detection function. Further, the CPU 5 stores the processing result of step S101 in the command execution result storage area 624 according to the extended program by executing the interrupt processing.

続いて、CPU5は、周期制御処理72でステップS101の次に実行される次の特定処理であるステップS102の実行アドレスにCPU5がアクセスしたことをBP51が検知するように、BP51を設定する。また、CPU5は、割り込み処理を終了し、周期制御処理72でステップS101実行後以降の処理を再開する。   Subsequently, the CPU 5 sets the BP 51 so that the BP 51 detects that the CPU 5 has accessed the execution address of step S102, which is the next specific process executed next to step S101 in the cycle control process 72. Further, the CPU 5 ends the interrupt process, and restarts the processes after the execution of step S101 in the cycle control process 72.

図6に戻り、CPU5は、ステップS102を実行した後、第2BP割り込みが発生すると、図7に示す割り込み処理を再度実行する。この場合、ステップS203でサブルーチンが呼び出され、そのサブルーチンが再度実行される。   Returning to FIG. 6, after executing step S <b> 102, when the second BP interrupt occurs, the CPU 5 executes the interrupt process shown in FIG. 7 again. In this case, a subroutine is called in step S203, and the subroutine is executed again.

割り込み処理でサブルーチンが呼び出されると、前回のサブルーチンの終了時では、N=3になっているので、今回のサブルーチンでは、ステップS302において、N=4となり、ステップS304において、N=3に対応するコマンドが実行される。この場合、CPU5は、ステップS102で補正したセンサ電圧値を読み出して第2データとしてコマンド実行結果記憶領域624に記憶する。   When a subroutine is called by interrupt processing, N = 3 at the end of the previous subroutine, so in this subroutine, N = 4 in step S302 and N = 3 in step S304. The command is executed. In this case, the CPU 5 reads the sensor voltage value corrected in step S102 and stores it in the command execution result storage area 624 as second data.

N=3に対応するコマンドは、終了コマンドではないので、サブルーチンでは、引き続き、ステップS301以降の処理が実行される。サブルーチンでは、ステップS302において、N=5となり、ステップS304において、N=4に対応するコマンドが実行される。この場合、CPU5が図6に示すステップS103を実行した後にBP割り込みを発生させるために、CPU5は、ステップS103を実行する際にアクセスする実行アドレス、すなわちステップS103の実行アドレスにBP51を設定する。   Since the command corresponding to N = 3 is not an end command, processing in step S301 and subsequent steps is continued in the subroutine. In the subroutine, N = 5 in step S302, and a command corresponding to N = 4 is executed in step S304. In this case, in order for the CPU 5 to generate a BP interrupt after executing step S103 shown in FIG. 6, the CPU 5 sets the BP 51 as the execution address to be accessed when executing step S103, that is, the execution address of step S103.

N=4に対応するコマンドは、終了コマンドではないので、サブルーチンでは、引き続き、ステップS301以降の処理が実行される。サブルーチンでは、ステップS302において、N=6となり、ステップS303において、N=5に対応するコマンドが終了コマンドであると判定され、処理が終了となる。   Since the command corresponding to N = 4 is not an end command, processing in step S301 and subsequent steps is continued in the subroutine. In the subroutine, in step S302, N = 6, and in step S303, it is determined that the command corresponding to N = 5 is an end command, and the process ends.

この場合、サブルーチンが終了となり、処理が図7に示す割り込み処理に返され、さらに割り込み処理が終了となり、処理が図6に示す周期制御処理72のステップS102の実行の完了地点に戻る。なお、サブルーチンの終了時において、識別番号記憶配列621に記憶される要素Nの値そのものは、上述したとおり、N=6になっている。   In this case, the subroutine is finished, the process is returned to the interrupt process shown in FIG. 7, the interrupt process is finished, and the process returns to the completion point of execution of step S102 of the cycle control process 72 shown in FIG. At the end of the subroutine, the value of the element N stored in the identification number storage array 621 is N = 6 as described above.

このように、CPU5は、アクセス検知機能としてのBP51によって発生した割り込みに応答して、周期制御処理72でステップS102の実行後以降の処理を中断する。また、CPU5は、割り込み処理を実行させることで、拡張プログラムに従って、ステップS102の処理結果をコマンド実行結果記憶領域624に記憶する。   As described above, the CPU 5 interrupts the processing after the execution of step S102 in the cycle control processing 72 in response to the interrupt generated by the BP 51 as the access detection function. Further, the CPU 5 stores the processing result of step S102 in the command execution result storage area 624 according to the extension program by executing the interrupt processing.

続いて、CPU5は、周期制御処理72でステップS102の次に実行される次の特定処理であるステップS103の実行アドレスにCPU5がアクセスしたことをBP51が検知するように、BP51を設定する。また、CPU5は、割り込み処理を終了し、周期制御処理72でステップS102実行後以降の処理を再開する。   Subsequently, the CPU 5 sets the BP 51 so that the BP 51 detects that the CPU 5 has accessed the execution address of step S103, which is the next specific process executed next to step S102 in the cycle control process 72. Further, the CPU 5 ends the interrupt process, and restarts the processes after the execution of step S102 in the cycle control process 72.

図6に戻り、CPU5は、ステップS103を実行した後、第3BP割り込みが発生すると、図7に示す割り込み処理を再度実行する。この場合、ステップS203でサブルーチンが呼び出され、そのサブルーチンが再度実行される。   Returning to FIG. 6, after executing step S <b> 103, when the third BP interrupt occurs, the CPU 5 executes the interrupt process shown in FIG. 7 again. In this case, a subroutine is called in step S203, and the subroutine is executed again.

割り込み処理でサブルーチンが呼び出されると、前回のサブルーチンの終了時では、N=6になっているので、今回のサブルーチンでは、ステップS302において、N=7となり、ステップS304において、N=6に対応するコマンドが実行される。この場合、CPU5は、ステップS103で算出した制御量を読み出して第3データとしてコマンド実行結果記憶領域624に記憶する。   When a subroutine is called in the interrupt process, N = 6 at the end of the previous subroutine, so in this subroutine, N = 7 in step S302 and N = 6 in step S304. The command is executed. In this case, the CPU 5 reads the control amount calculated in step S103 and stores it in the command execution result storage area 624 as third data.

N=6に対応するコマンドは、終了コマンドではないので、サブルーチンでは、引き続き、ステップS301以降の処理が実行される。サブルーチンでは、ステップS302において、N=8となり、ステップS304において、N=7に対応するコマンドが実行される。この場合、CPU5が図6に示すステップS104を実行した後にBP割り込みを発生させるために、CPU5は、ステップS104を実行する際にアクセスする実行アドレス、すなわちステップS104の実行アドレスにBP51を設定する。   Since the command corresponding to N = 6 is not an end command, the processing subsequent to step S301 is subsequently executed in the subroutine. In the subroutine, N = 8 in step S302, and a command corresponding to N = 7 is executed in step S304. In this case, in order for the CPU 5 to generate a BP interrupt after executing step S104 shown in FIG. 6, the CPU 5 sets BP51 as an execution address to be accessed when executing step S104, that is, the execution address of step S104.

N=7に対応するコマンドは、終了コマンドではないので、サブルーチンでは、引き続き、ステップS301以降の処理が実行される。サブルーチンでは、ステップS302において、N=9となり、ステップS303において、N=8に対応するコマンドが終了コマンドであると判定され、処理が終了となる。   Since the command corresponding to N = 7 is not an end command, the processing subsequent to step S301 is subsequently executed in the subroutine. In the subroutine, in step S302, N = 9, and in step S303, it is determined that the command corresponding to N = 8 is an end command, and the process ends.

この場合、サブルーチンが終了となり、処理が図7に示す割り込み処理に返され、さらに割り込み処理が終了となり、処理が図6に示す周期制御処理72のステップS103の実行の完了地点に戻る。なお、サブルーチンの終了時において、識別番号記憶配列621に記憶される要素Nの値そのものは、上述したとおり、N=9になっている。   In this case, the subroutine is ended, the process is returned to the interrupt process shown in FIG. 7, the interrupt process is further ended, and the process returns to the completion point of execution of step S103 of the cycle control process 72 shown in FIG. At the end of the subroutine, the value of the element N stored in the identification number storage array 621 is N = 9 as described above.

このように、CPU5は、アクセス検知機能としてのBP51によって発生した割り込みに応答して、周期制御処理72でステップS103の実行後以降の処理を中断する。また、CPU5は、割り込み処理を実行させることで、拡張プログラムに従って、ステップS103の処理結果をコマンド実行結果記憶領域624に記憶する。   As described above, the CPU 5 interrupts the processing after the execution of step S103 in the cycle control processing 72 in response to the interrupt generated by the BP 51 as the access detection function. Further, the CPU 5 stores the processing result of step S103 in the command execution result storage area 624 according to the extended program by executing the interrupt processing.

続いて、CPU5は、周期制御処理72でステップS103の次に実行される次の特定処理であるステップS104の実行アドレスにCPU5がアクセスしたことをBP51が検知するように、BP51を設定する。また、CPU5は、割り込み処理を終了し、周期制御処理72でステップS103実行後以降の処理を再開する。   Subsequently, the CPU 5 sets the BP 51 so that the BP 51 detects that the CPU 5 has accessed the execution address of step S104, which is the next specific process executed next to step S103 in the cycle control process 72. Further, the CPU 5 ends the interrupt process, and resumes the processes after the execution of step S103 in the cycle control process 72.

図6に戻り、CPU5は、ステップS104を実行した後、第4BP割り込みが発生すると、図7に示す割り込み処理を再度実行する。この場合、ステップS203でサブルーチンが呼び出され、そのサブルーチンが再度実行される。   Returning to FIG. 6, when the fourth BP interrupt occurs after executing step S104, the CPU 5 again executes the interrupt process shown in FIG. In this case, a subroutine is called in step S203, and the subroutine is executed again.

割り込み処理でサブルーチンが呼び出されると、前回のサブルーチンの終了時では、N=9になっているので、今回のサブルーチンでは、ステップS302において、N=10となり、ステップS304において、N=9に対応するコマンドが実行される。この場合、CPU5は、ステップS104で出力した制御量を読み出して第4データとしてコマンド実行結果記憶領域624に記憶する。   When a subroutine is called in the interrupt process, N = 9 at the end of the previous subroutine, so in this subroutine, N = 10 in step S302 and N = 9 in step S304. The command is executed. In this case, the CPU 5 reads the control amount output in step S104 and stores it in the command execution result storage area 624 as fourth data.

N=9に対応するコマンドは、終了コマンドではないので、サブルーチンでは、引き続き、ステップS301以降の処理が実行される。サブルーチンでは、ステップS302において、N=11となり、ステップS304において、N=10に対応するコマンドが実行される。この場合、CPU5は、BP51を0に設定することで実質的にBP割り込みを無効化する。   Since the command corresponding to N = 9 is not an end command, processing in step S301 and subsequent steps is continuously executed in the subroutine. In the subroutine, N = 11 in step S302, and a command corresponding to N = 10 is executed in step S304. In this case, the CPU 5 substantially disables the BP interrupt by setting the BP 51 to 0.

N=10に対応するコマンドは、終了コマンドではないので、サブルーチンでは、引き続き、ステップS301以降の処理が実行される。サブルーチンでは、ステップS302において、N=12となり、ステップS303において、N=11に対応するコマンドが終了コマンドであると判定され、処理が終了となる。   Since the command corresponding to N = 10 is not an end command, the processing subsequent to step S301 is subsequently executed in the subroutine. In the subroutine, in step S302, N = 12, and in step S303, it is determined that the command corresponding to N = 11 is an end command, and the process ends.

この場合、サブルーチンが終了となり、処理が図7に示す割り込み処理に返され、さらに割り込み処理が終了となり、処理が図6に示す周期制御処理72のステップS104の実行の完了地点に戻り、処理が終了となる。   In this case, the subroutine ends, the process returns to the interrupt process shown in FIG. 7, the interrupt process ends, the process returns to the completion point of execution of step S104 of the cycle control process 72 shown in FIG. End.

このように、CPU5は、アクセス検知機能としてのBP51によって発生した割り込みに応答して、周期制御処理72でステップS104の実行後以降の処理を中断する。また、CPU5は、割り込み処理を実行させることで、拡張プログラムに従って、ステップS104の処理結果をコマンド実行結果記憶領域624に記憶する。   As described above, the CPU 5 interrupts the processing after the execution of step S104 in the cycle control processing 72 in response to the interrupt generated by the BP 51 as the access detection function. Further, the CPU 5 stores the processing result of step S104 in the command execution result storage area 624 according to the extension program by executing the interrupt processing.

CPU5は、周期制御処理72を構成する一連の処理の中での特定処理であるステップS101〜S104をすべて実行し、さらに、周期制御処理72の最後の処理であるステップS104を実行したので、周期制御処理72が終了となる。   Since the CPU 5 executes all the steps S101 to S104 which are specific processes in the series of processes constituting the cycle control process 72, and further executes step S104 which is the last process of the cycle control process 72, the cycle The control process 72 ends.

このように、第4BP割り込みが発生した後については、新たなBP割り込みが発生しないので、割り込み処理が実行されることなく、図6に示す周期制御処理72が終了となる。したがって、コマンド実行結果記憶領域624には、上述のN=0〜11に対応する一連のコマンド実行後のデータとして、第1データ、第2データ、第3データおよび第4データが記憶される。コマンド実行結果記憶領域624に記憶されるデータを、外部通信機能9とXCPを利用して読み出すことで、ステップS101、S102、S103およびS104のそれぞれを実行した結果を、制御プログラム70の周期制御処理72を変更することなく、取得することができる。   As described above, after the fourth BP interrupt occurs, no new BP interrupt occurs, so the interrupt process is not executed, and the cycle control process 72 shown in FIG. 6 ends. Therefore, the command execution result storage area 624 stores the first data, the second data, the third data, and the fourth data as the data after the series of commands corresponding to the above-described N = 0 to 11. By reading the data stored in the command execution result storage area 624 using the external communication function 9 and XCP, the results of executing each of steps S101, S102, S103, and S104 are converted into the periodic control processing of the control program 70. 72 can be obtained without changing.

これに対して、本実施の形態1におけるECU1の構成を適用せずに、XCPのみを利用する場合、XCPではアドレスが既知の静的変数に記憶されるデータのみを取得可能なため、自動変数、およびCPUレジスタに一時的に保持されるデータを取得することができない。しかしながら、本実施の形態1におけるECU1の構成によれば、CPU5が実行するコマンドおよびスタックフレームを取得するコマンドを定義することで、制御プログラム70の周期制御処理72内で一時的に使用される自動変数および一時的にCPUレジスタに保持されるデータを取得することが可能である。   On the other hand, when only the XCP is used without applying the configuration of the ECU 1 in the first embodiment, since the XCP can acquire only the data stored in the static variable whose address is known, the automatic variable And data temporarily held in the CPU register cannot be acquired. However, according to the configuration of the ECU 1 in the first embodiment, by defining a command to be executed by the CPU 5 and a command to obtain a stack frame, an automatic that is temporarily used in the cycle control process 72 of the control program 70. It is possible to obtain variables and data held temporarily in the CPU register.

上述のN=0〜11に対応する一連のコマンド実行後のデータをコマンド実行結果記憶領域624から取得することで、上述の項目(1)〜(3)を確認することができる。その結果、ステップS104でI/O4に出力された制御量、ステップS103で算出された制御量およびステップS102で補正されたセンサ電圧値が、それぞれ設計範囲内ではないことが分かる。つまり、ステップS101で取得されたセンサ電圧値が設計どおりに補正されていないことを推定することができる。   By acquiring data after executing a series of commands corresponding to the above-described N = 0 to 11 from the command execution result storage area 624, the above-described items (1) to (3) can be confirmed. As a result, it can be seen that the control amount output to the I / O 4 in step S104, the control amount calculated in step S103, and the sensor voltage value corrected in step S102 are not within the design range. That is, it can be estimated that the sensor voltage value acquired in step S101 is not corrected as designed.

本実施の形態1では、センサ電圧値が設計どおりに補正されていないという推定を確認するために、図6に示す周期制御処理72において、次の3つの項目(4)〜(6)をさらに確認する。   In the first embodiment, in order to confirm the estimation that the sensor voltage value is not corrected as designed, the following three items (4) to (6) are further added in the cycle control process 72 shown in FIG. Check.

・項目(4):対応要否情報を正しく読み出していること
・項目(5):ステップS106で追加補正が実行されていること
・項目(6):ステップS106で追加補正されたセンサ電圧値が設計範囲内であること
Item (4): The information on necessity of correspondence is correctly read. Item (5): Additional correction is performed in step S106. Item (6): The sensor voltage value additionally corrected in step S106 is obtained. Within the design range

上述の項目(4)〜(6)の確認を効率良く行うために、RAM6の拡張プログラム記憶部63のプログラム記憶領域631には、上述の図8に示す拡張プログラムが記憶される。また、その拡張プログラムの開始アドレスは、外部通信機能9とXCPを利用するなどして記憶される。   In order to check the above items (4) to (6) efficiently, the extension program shown in FIG. 8 is stored in the program storage area 631 of the extension program storage unit 63 of the RAM 6. The start address of the extension program is stored by using the external communication function 9 and XCP.

コマンド記憶部62の識別番号記憶配列621と、第1引数記憶配列622と、第2引数記憶配列623のそれぞれには、後述する図10に示す識別番号と、第1引数と、第2引数とが対応付けられて記憶される。また、CPU5が図6に示すステップS102を実行した後にBP割り込みを発生させるために、CPU5は、ステップS102の実行アドレスにBP51を設定する。   Each of the identification number storage array 621, the first argument storage array 622, and the second argument storage array 623 of the command storage unit 62 includes an identification number, a first argument, and a second argument shown in FIG. Are stored in association with each other. Further, in order for the CPU 5 to generate a BP interrupt after executing step S102 shown in FIG. 6, the CPU 5 sets BP51 as the execution address of step S102.

上述したとおり、制御プログラム拡張部60がRAM6に記憶され、BP51の機能が有効化された後、CPU5がステップS102を実行すれば、第1BP割り込みが発生する。   As described above, after the control program expansion unit 60 is stored in the RAM 6 and the function of the BP 51 is validated, if the CPU 5 executes step S102, the first BP interrupt is generated.

第1BP割り込みが発生すると、CPU5は、上述の項目(1)〜(3)を確認する場合と同様に、図7に示す割り込み処理を実行する。CPU5は、割り込み処理において、サブルーチン開始アドレス記憶変数611に記憶される開始アドレスに対応するサブルーチンを呼び出し、そのサブルーチンの実行を開始する。   When the first BP interrupt occurs, the CPU 5 executes the interrupt process shown in FIG. 7 as in the case of confirming the items (1) to (3) described above. In the interrupt processing, the CPU 5 calls a subroutine corresponding to the start address stored in the subroutine start address storage variable 611 and starts executing the subroutine.

ステップS203でのサブルーチンの呼び出しによって、図8に示すサブルーチンが実行される。このサブルーチンでは、図10に示すコマンドが実行される。図10は、本発明の実施の形態1におけるCPU5が実行する制御プログラム70の割り込み処理で呼び出されるサブルーチンのコマンドの定義の一例を示す表である。   The subroutine shown in FIG. 8 is executed by calling the subroutine in step S203. In this subroutine, the command shown in FIG. 10 is executed. FIG. 10 is a table showing an example of the definition of a subroutine command called in the interrupt process of the control program 70 executed by the CPU 5 according to the first embodiment of the present invention.

図10に示すように、要素Nおよび識別番号と、第1引数と、第2引数とが対応付けられて、識別番号記憶配列621と、第1引数記憶配列622と、第2引数記憶配列623とにそれぞれ記憶されている。また、図10では、要素Nに対応するコマンドの意味も併せて示している。   As shown in FIG. 10, the element N, the identification number, the first argument, and the second argument are associated with each other, and the identification number storage array 621, the first argument storage array 622, and the second argument storage array 623 are associated with each other. And are stored respectively. FIG. 10 also shows the meaning of the command corresponding to the element N.

サブルーチンにおいて、図10に示すN=0〜2に対応するコマンドが実行された後、呼び出し側の割り込み処理に処理が返される。この時点で、CPU5は、ステップS102の実行の完了地点、すなわち、ステップS105の実行の開始直前において、上述の読み出された対応要否情報を、第1データとして、コマンド実行結果記憶領域624に記憶する。   In the subroutine, after the command corresponding to N = 0 to 2 shown in FIG. 10 is executed, the process is returned to the caller interrupt process. At this time, the CPU 5 stores the above-described read necessity information as first data in the command execution result storage area 624 immediately before the execution of step S102, that is, immediately before the start of execution of step S105. Remember.

上述したとおり、図8に示すサブルーチンの終了によって、図7に示す割り込み処理に処理が返され、さらに、割り込み処理が終了となり、CPU5は、ステップS102の実行の完了地点に復帰する。その後、CPU5は、ステップS105を実行する。   As described above, upon completion of the subroutine shown in FIG. 8, the process is returned to the interrupt process shown in FIG. 7, and the interrupt process is finished, and the CPU 5 returns to the completion point of execution of step S102. Thereafter, the CPU 5 executes Step S105.

本実施の形態1では、上述したとおり、不具合の一例として、ステップS105において、CPU5が、周期制御処理72の仕様に対しての対応が必要であると判定し、ステップS106を実行すべきところを、逆の判定が行われて、ステップS106が実行されない場合を考えている。したがって、ステップS105において、CPU5は、対応要否情報が、対応が不要であることを示す「0」であると判定し、ステップS106を実行せずに、ステップS103を実行する。   In the first embodiment, as described above, as an example of the problem, in step S105, the CPU 5 determines that it is necessary to cope with the specification of the cycle control process 72, and the step S106 is to be executed. Consider the case where the reverse determination is made and step S106 is not executed. Therefore, in step S105, the CPU 5 determines that the correspondence necessity information is “0” indicating that no correspondence is necessary, and executes step S103 without executing step S106.

そのため、CPU5は、図10に示すN=1に対応するコマンドを実行することでBP51を、ステップS106の実行アドレスに設定したものの、ステップS106を実行していないので、第2BP割り込みが発生しない。その結果、コマンド実行結果記憶領域624に第2データとして記憶される追加補正後のセンサ電圧値が初期値のままとなり、さらに、要素Nの値が3に保持されたままとなる。   Therefore, the CPU 5 sets the BP 51 as the execution address of step S106 by executing the command corresponding to N = 1 shown in FIG. 10, but the second BP interrupt does not occur because step S106 is not executed. As a result, the sensor voltage value after the additional correction stored as the second data in the command execution result storage area 624 remains the initial value, and further, the value of the element N remains at 3.

上述のN=0〜5に対応する一連のコマンド実行後のデータをコマンド実行結果記憶領域624から取得することで、上述の項目(4)〜(6)を確認することができる。その結果、対応要否情報が正しく読み出されており、追加補正が実行されておらず、追加補正後のセンサ電圧値がステップS106の未実行のため初期値であることが分かる。   By acquiring data after executing a series of commands corresponding to N = 0 to 5 described above from the command execution result storage area 624, the above items (4) to (6) can be confirmed. As a result, it can be seen that the correspondence necessity information is read correctly, the additional correction is not executed, and the sensor voltage value after the additional correction is the initial value because step S106 is not executed.

上述の項目(1)〜(6)の確認結果から、不具合の原因は、センサ電圧値の追加補正が未実施であることによる可能性があることが分かる。   From the confirmation results of the items (1) to (6) described above, it can be understood that the cause of the problem may be due to the fact that additional correction of the sensor voltage value has not been performed.

これに対して、本実施の形態1におけるECU1の構成を適用せずに、XCPのみを利用する場合、項目(4)および(5)を直接確認することができない。そのため、ステップS103の実行前における補正後のセンサ電圧値が設計範囲外であることを確認できたとしても、その理由がステップS106の未実行によるものであるという直接の証拠を得ることができない。   On the other hand, when only the XCP is used without applying the configuration of the ECU 1 in the first embodiment, the items (4) and (5) cannot be confirmed directly. Therefore, even if it can be confirmed that the corrected sensor voltage value before the execution of step S103 is outside the design range, direct evidence that the reason is due to the non-execution of step S106 cannot be obtained.

しかしながら、本実施の形態1におけるECU1の構成によれば、項目(4)および(5)を確認することができる。そのため、ステップS103の実行前における補正後のセンサ電圧値が設計範囲外である理由が、対応要否情報が正しく読み出されているものの、ステップS105での判定が誤り、ステップS106が未実行であったためであると推定することができる。   However, according to the configuration of ECU 1 in the first embodiment, items (4) and (5) can be confirmed. Therefore, the reason why the corrected sensor voltage value before the execution of step S103 is outside the design range is that the correspondence necessity information is correctly read, but the determination in step S105 is incorrect, and step S106 is not executed. It can be presumed that this is because.

なお、一般的なBPの機能では、特定のアドレスの実行を検知するのみでなく、特定のアドレスのデータ読み出しまたはデータ書き込みも検知可能である場合が多い。そこで、BP51における特定のアドレスのデータ読み出しの検知機能を使用して、CPU5が上述の対応要否情報を読み出した際にBP割り込みを発生させてもよい。この場合、CPU5は、そのBP割り込みの発生に応答して、割り込み処理内で、対応要否情報をコマンド実行結果記憶領域624に記憶することができる。   Note that in general BP functions, it is often possible not only to detect the execution of a specific address, but also to detect data reading or data writing at a specific address. Therefore, a detection function of data reading at a specific address in the BP 51 may be used to generate a BP interrupt when the CPU 5 reads out the above-described correspondence necessity information. In this case, in response to the occurrence of the BP interrupt, the CPU 5 can store the correspondence necessity information in the command execution result storage area 624 in the interrupt processing.

上述の不具合の原因の推定確度が高ければ、ステップS105の判定の内容を確認し、判定論理が逆であることを見つけることが容易になる。つまり、本実施の形態1におけるECU1の構成によって、上述の項目(1)〜(6)を確認すれば、デバッガを使用することなく、XCPのメモリアクセス機能のみを用いた場合よりも高い確度で不具合の原因を特定することができる。   If the estimation accuracy of the cause of the above-described defect is high, it is easy to confirm the content of the determination in step S105 and find that the determination logic is reversed. In other words, if the above items (1) to (6) are confirmed by the configuration of the ECU 1 according to the first embodiment, the accuracy is higher than when only the XCP memory access function is used without using a debugger. The cause of the failure can be identified.

このようにCPU5は、BP51によって発生した割り込みに応答して、割り込み処理を実行させることで、周期制御処理72で特定処理の実行後以降の処理を中断し、図8に示す拡張プログラムを実行する。CPU5は、図8に示す拡張プログラムを実行させることで、特定処理、すなわちデータを取得することを所望する処理の処理結果をRAM6のコマンド実行結果記憶領域624に記憶させる。   As described above, the CPU 5 interrupts the processing after executing the specific processing in the cycle control processing 72 by executing the interrupt processing in response to the interrupt generated by the BP 51, and executes the extension program shown in FIG. . The CPU 5 causes the command execution result storage area 624 of the RAM 6 to store the processing result of the specific process, that is, the process for which data is desired to be acquired, by executing the extension program shown in FIG.

また、CPU5は、図8に示す拡張プログラムを実行させることで、周期制御処理72で特定処理の次に実行される次の特定処理の実行アドレスにCPU5がアクセスしたことをBP51が検知するように、BP51を設定する。その後、CPU5は、拡張プログラムの実行後に、周期制御処理72で特定処理の実行後以降の処理を再開する。   Further, the CPU 5 causes the BP 51 to detect that the CPU 5 has accessed the execution address of the next specific process executed next to the specific process in the cycle control process 72 by executing the extension program shown in FIG. , BP51 is set. Thereafter, the CPU 5 restarts the processing after the execution of the specific processing in the cycle control processing 72 after the execution of the extension program.

本実施の形態1では、制御プログラム70の周期制御処理72の不具合の原因を推定した後、その不具合を修正し、その修正後の周期制御処理72の結果を確認する。   In this Embodiment 1, after estimating the cause of the malfunction of the periodic control process 72 of the control program 70, the malfunction is corrected, and the result of the periodic control process 72 after the correction is confirmed.

上述の修正の確認を効率良く実施するために、RAM6の拡張プログラム記憶部63のプログラム記憶領域631には、後述する図11に示す拡張プログラム、すなわち、第2拡張プログラムが記憶される。また、その拡張プログラムの開始アドレスは、外部通信機能9とXCPを利用するなどして記憶される。   In order to efficiently perform the above-described correction check, an extension program shown in FIG. 11, which will be described later, that is, a second extension program, is stored in the program storage area 631 of the extension program storage unit 63 of the RAM 6. The start address of the extension program is stored by using the external communication function 9 and XCP.

CPU5が図6に示すステップS102を実行した後にBP割り込みを発生させるために、CPU5は、ステップS102の実行アドレスにBP51を設定する。   In order to generate a BP interrupt after the CPU 5 executes step S102 shown in FIG. 6, the CPU 5 sets BP51 as the execution address of step S102.

上述したとおり、制御プログラム拡張部60がRAM6に記憶され、BP51の機能が有効化された後、CPU5がステップS102を実行すれば、CPU5がステップS105を実行する直前で、BP割り込みが発生する。   As described above, after the control program expansion unit 60 is stored in the RAM 6 and the function of the BP 51 is activated, if the CPU 5 executes step S102, a BP interrupt is generated immediately before the CPU 5 executes step S105.

BP割り込みが発生すると、CPU5は、図7に示す割り込み処理を実行する。CPU5は、割り込み処理において、サブルーチン開始アドレス記憶変数611に記憶される開始アドレスに対応する図11に示すサブルーチンを呼び出し、そのサブルーチンの実行を開始する。   When the BP interrupt occurs, the CPU 5 executes the interrupt process shown in FIG. In the interrupt process, the CPU 5 calls a subroutine shown in FIG. 11 corresponding to the start address stored in the subroutine start address storage variable 611 and starts executing the subroutine.

ここで、割り込み処理で呼び出されるサブルーチンについて、図11を参照しながら説明する。図11は、本発明の実施の形態1におけるCPU5が実行する制御プログラム70の割り込み処理で呼び出されるサブルーチンを示すフローチャートである。   Here, a subroutine called in the interrupt process will be described with reference to FIG. FIG. 11 is a flowchart showing a subroutine called in the interrupt process of the control program 70 executed by the CPU 5 in the first embodiment of the present invention.

図11に示す拡張プログラム、すなわち、第2拡張プログラムは、周期制御処理72で発生する不具合の原因である処理を修正した後の修正後処理を実行するように、CPU5に対して動作させる。修正後処理は、図11に示すステップS105NおよびS106に対応する。   The extension program shown in FIG. 11, that is, the second extension program, causes the CPU 5 to operate so as to execute the post-correction process after correcting the process that is the cause of the malfunction occurring in the cycle control process 72. The post-correction processing corresponds to steps S105N and S106 shown in FIG.

割り込み処理でサブルーチンが呼び出されると、CPU5は、拡張プログラム記憶部63のプログラム記憶領域631に記憶される図11に示す拡張プログラムを実行する。この場合、ステップS105Nにおいて、CPU5は、対応要否情報が、対応が不要であることを示す「1」であるか否かを判定する。   When the subroutine is called in the interrupt process, the CPU 5 executes the extension program shown in FIG. In this case, in step S105N, the CPU 5 determines whether or not the correspondence necessity information is “1” indicating that no correspondence is necessary.

ここで、ステップS105Nの判定処理では、対応要否情報が「1」である場合には、対応が不要であると判定され、対応要否情報が、「1」でない、すなわち「0」である場合には、対応が必要であると判定されるように構成されている。つまり、ステップS105Nは、周期制御処理72で発生する不具合の原因である図6に示すステップS105を修正している。具体的には、ステップS105Nの判定論理は、ステップS105の判定論理の逆となるように修正されている。   Here, in the determination process in step S105N, if the correspondence necessity information is “1”, it is determined that no correspondence is necessary, and the correspondence necessity information is not “1”, that is, “0”. In such a case, it is determined that a response is necessary. That is, step S105N corrects step S105 shown in FIG. 6 which is the cause of the problem that occurs in the cycle control process 72. Specifically, the determination logic in step S105N is modified to be the reverse of the determination logic in step S105.

ステップS105Nにおいて、CPU5は、対応要否情報が「1」であると判定した場合には、処理が終了となる。一方、CPU5は、対応要否情報が「1」でないと判定した場合には、処理がステップS106へと進む。   In step S105N, when the CPU 5 determines that the correspondence necessity information is “1”, the process ends. On the other hand, if the CPU 5 determines that the correspondence necessity information is not “1”, the process proceeds to step S106.

図11に示すステップS106を実行後、サブルーチンが終了する。図11に示すサブルーチンの終了によって、図7に示す割り込み処理に処理が返され、さらに割り込み処理が終了となり、処理が図6に示すステップS102の実行の完了地点に戻る。その後、CPU5は、ステップS105の判定を実行するものの、この判定は、上述した不具合によって正しく行われない。そのため、CPU5は、ステップS106を実行せずに、ステップS103を実行する。その後、CPU5は、ステップS104を実行し、周期制御処理72が終了となる。   After executing step S106 shown in FIG. 11, the subroutine ends. By the end of the subroutine shown in FIG. 11, the process is returned to the interrupt process shown in FIG. 7, and the interrupt process is further ended, and the process returns to the completion point of the execution of step S102 shown in FIG. Thereafter, the CPU 5 executes the determination in step S105, but this determination is not correctly performed due to the above-described problem. Therefore, the CPU 5 executes Step S103 without executing Step S106. Thereafter, the CPU 5 executes step S104, and the cycle control process 72 ends.

このように、CPU5は、図11に示す拡張プログラムを実行させることで、周期制御処理72で不具合が発生する原因である処理を修正した後の修正後処理を実行する。CPU5は、その後、CPU5は、拡張プログラムの実行後に、周期制御処理72で特定処理の実行後以降の処理を再開する。すなわち、図11に示すサブルーチンによって、CPU5は、ステップS105NおよびステップS106を実行することでセンサ電圧値の追加補正を行う。その後、CPU5は、図6に示す周期制御処理72によって、ステップS105およびS103を順に実行し、最後にステップS104を実行する。したがって、図11に示す拡張プログラムをRAM6に記憶した上で、制御プログラム70について統合試験を実施すれば、制御プログラム70の周期制御処理72を変更することなく、要求性能を満足しない不具合が解消することを確認できる。つまり、制御プログラム70の不具合修正の結果を確認する際に、On−target Bypassingに必要なフック関数を使用する必要がなくなる。   As described above, the CPU 5 executes the extension program shown in FIG. 11 to execute the post-correction process after correcting the process that causes the malfunction in the cycle control process 72. After that, the CPU 5 resumes the process after the execution of the specific process in the cycle control process 72 after the execution of the extension program. That is, according to the subroutine shown in FIG. 11, the CPU 5 performs additional correction of the sensor voltage value by executing Step S105N and Step S106. Thereafter, the CPU 5 sequentially executes steps S105 and S103 by the cycle control process 72 shown in FIG. 6, and finally executes step S104. Therefore, if the integration program is executed for the control program 70 after the expansion program shown in FIG. 11 is stored in the RAM 6, the problem that does not satisfy the required performance is solved without changing the periodic control processing 72 of the control program 70. I can confirm that. That is, it is not necessary to use a hook function necessary for on-target bypassing when confirming the result of defect correction of the control program 70.

以上、本実施の形態1の車載制御装置によれば、周期制御処理と、周期制御処理を構成する一連の処理の中で複数の予め決められる特定処理が個別に実行されるたびに実行される割り込み処理とを含む制御プログラムを記憶するROMと、拡張プログラムとして第1拡張プログラムおよび第2拡張プログラムを記憶するRAMと、制御プログラムおよび拡張プログラムを実行するCPUとを備えて構成されている。   As mentioned above, according to the vehicle-mounted control apparatus of this Embodiment 1, it is performed whenever a plurality of predetermined specific processes are individually executed in the cycle control process and a series of processes constituting the cycle control process. It comprises a ROM that stores a control program including interrupt processing, a RAM that stores a first extension program and a second extension program as extension programs, and a CPU that executes the control program and the extension program.

また、上記の構成において、CPUは、以下のように構成されている。すなわち、CPUは、特定処理を実行する際にアクセスする実行アドレスにアクセスしたことを検知して、割り込みを発生させるアクセス検知機能を備えて構成されている。   In the above configuration, the CPU is configured as follows. That is, the CPU is configured to include an access detection function that detects an access to an execution address that is accessed when executing a specific process and generates an interrupt.

CPUは、アクセス検知機能によって発生した割り込みに応答して割り込み処理を実行させることで、周期制御処理で特定処理の実行後以降の処理を中断し、第1拡張プログラムまたは第2拡張プログラムを実行し、当該実行後に、周期制御処理で特定処理の実行後以降の処理を再開するように構成されている。CPUは、第1拡張プログラムを実行させることで、特定処理の処理結果をRAMに記憶させるとともに、周期制御処理で特定処理の次に実行される次の特定処理の実行アドレスにCPUがアクセスしたことをアクセス検知機能が検知するように、アクセス検知機能を設定するように構成されている。CPUは、第2拡張プログラムを実行させることで、周期制御処理で不具合が発生する原因である処理を修正した後の修正後処理を実行するように構成されている。   The CPU executes the interrupt process in response to the interrupt generated by the access detection function, thereby interrupting the process after the execution of the specific process in the cycle control process and executing the first extension program or the second extension program. After the execution, the process after the execution of the specific process is resumed in the periodic control process. The CPU stores the processing result of the specific process in the RAM by executing the first extension program, and the CPU has accessed the execution address of the next specific process executed after the specific process in the cycle control process Is configured to set the access detection function so that the access detection function detects. The CPU is configured to execute a post-correction process after correcting a process that causes a problem in the periodic control process by executing the second extension program.

上述の車載制御装置を構成することで、デバッガを使用しなくても制御プログラムの不具合の原因を特定することができるとともに、フック関数を用意しなくても制御プログラムの不具合の解消を確認することができる。   By configuring the above-mentioned in-vehicle control device, it is possible to identify the cause of the malfunction of the control program without using a debugger, and confirm the elimination of the malfunction of the control program without preparing a hook function. Can do.

1 車載制御装置(ECU)、2 入力回路、3 マイコン、4 I/O、5 CPU、6 RAM、7 ROM、8 タイマ、9 外部通信機能、10 駆動回路、11 モータ、12 外部通信線、51 ブレイクポイント機能、52 第1メモリ保護機能、53 第2メモリ保護機能、60 制御プログラム拡張部、61 拡張プログラム開始アドレス記憶部、611 サブルーチン開始アドレス記憶変数、62 コマンド記憶部、621 識別番号記憶配列、622 第1引数記憶配列、623 第2引数記憶配列、624 コマンド実行結果記憶領域、63 拡張プログラム記憶部、631 プログラム記憶領域、70 制御プログラム、71 初期化処理、72 周期制御処理、73 XCP処理、74 BP割り込み処理、75 MPU割り込み処理。   DESCRIPTION OF SYMBOLS 1 In-vehicle control apparatus (ECU), 2 input circuits, 3 Microcomputer, 4 I / O, 5 CPU, 6 RAM, 7 ROM, 8 Timer, 9 External communication function, 10 Drive circuit, 11 Motor, 12 External communication line, 51 Break point function, 52 first memory protection function, 53 second memory protection function, 60 control program extension section, 61 extension program start address storage section, 611 subroutine start address storage variable, 62 command storage section, 621 identification number storage array, 622 First argument storage array, 623 Second argument storage array, 624 Command execution result storage area, 63 Extended program storage section, 631 Program storage area, 70 Control program, 71 Initialization process, 72 Period control process, 73 XCP process, 74 BP interrupt processing, 75 MPU interrupt processing .

Claims (3)

制御対象を周期的に制御するための周期制御処理と、前記周期制御処理を構成する一連の処理の中で複数の予め決められる特定処理が個別に実行されるたびに実行される割り込み処理とを含む制御プログラムを記憶するROMと、
拡張プログラムとして第1拡張プログラムおよび第2拡張プログラムを記憶するRAMと、
前記制御プログラムおよび前記拡張プログラムを実行するCPUと、
を備え、
前記CPUは、
前記特定処理を実行する際にアクセスする実行アドレスにアクセスしたことを検知して、割り込みを発生させるアクセス検知機能を備え、
前記アクセス検知機能によって発生した前記割り込みに応答して前記割り込み処理を実行させることで、前記周期制御処理で前記特定処理の実行後以降の処理を中断し、前記第1拡張プログラムまたは前記第2拡張プログラムを実行し、当該実行後に、前記周期制御処理で前記特定処理の実行後以降の処理を再開し、
前記第1拡張プログラムを実行させることで、前記特定処理の処理結果を前記RAMに記憶させるとともに、前記周期制御処理で前記特定処理の次に実行される次の特定処理の実行アドレスに前記CPUがアクセスしたことを前記アクセス検知機能が検知するように、前記アクセス検知機能を設定し、
前記第2拡張プログラムを実行させることで、前記周期制御処理で不具合が発生する原因である処理の結果を修正する
車載制御装置。
A cycle control process for periodically controlling the control target, and an interrupt process executed each time a plurality of predetermined specific processes are individually executed in a series of processes constituting the cycle control process. A ROM for storing a control program including:
A RAM for storing a first extension program and a second extension program as an extension program;
A CPU for executing the control program and the extension program;
With
The CPU
An access detection function for detecting an access to an execution address to be accessed when executing the specific process, and generating an interrupt;
By executing the interrupt process in response to the interrupt generated by the access detection function, the process after the execution of the specific process is interrupted in the cycle control process, and the first extension program or the second extension Execute the program, and after the execution, resume the process after the execution of the specific process in the periodic control process,
By executing the first extension program, the processing result of the specific process is stored in the RAM, and the CPU is assigned to the execution address of the next specific process executed next to the specific process in the cycle control process. Set the access detection function so that the access detection function detects access,
An in- vehicle control device that corrects a result of a process that causes a failure in the periodic control process by executing the second extension program.
前記アクセス検知機能は、ブレイクポイント機能によって構成され、
前記CPUは、前記ブレイクポイント機能を、前記実行アドレスに設定し、
前記ブレイクポイント機能は、前記実行アドレスに前記CPUがアクセスしたことを検知して、前記割り込みを発生させる
請求項1に記載の車載制御装置。
The access detection function is configured by a breakpoint function,
The CPU sets the breakpoint function to the execution address,
The in-vehicle control device according to claim 1, wherein the breakpoint function detects that the CPU has accessed the execution address and generates the interrupt.
前記アクセス検知機能は、
適用するアドレス範囲の下限値と上限値が設定される第1メモリ保護機能および適用するアドレス範囲の下限値と上限値が設定され、前記第1メモリ保護機能とは、適用するアドレス範囲が異なる第2メモリ保護機能によって構成され、
前記CPUは、前記第1メモリ保護機能および前記第2メモリ保護機能を適用するアドレス範囲を、前記実行アドレスに基づいて設定し、
前記第1メモリ保護機能および前記第2メモリ保護機能は、前記CPUがアクセスした前記実行アドレスが前記アドレス範囲外であることをもって、前記実行アドレスに前記CPUがアクセスしたことを検知して、前記割り込みを発生させる
請求項1に記載の車載制御装置。
The access detection function
A first memory protection function in which a lower limit value and an upper limit value of an applied address range are set, and a lower limit value and an upper limit value of an applied address range are set, and the applied address range is different from the first memory protection function. A second memory protection function,
Wherein the CPU, the address range to apply the first protected memory and the second memory protection function, and set based on the execution address,
The first memory protection function and the second memory protection function detect that the CPU has accessed the execution address when the execution address accessed by the CPU is out of the address range, and the interrupt The in-vehicle control device according to claim 1.
JP2017216162A 2017-11-09 2017-11-09 In-vehicle control device Active JP6463445B1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2017216162A JP6463445B1 (en) 2017-11-09 2017-11-09 In-vehicle control device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2017216162A JP6463445B1 (en) 2017-11-09 2017-11-09 In-vehicle control device

Publications (2)

Publication Number Publication Date
JP6463445B1 true JP6463445B1 (en) 2019-02-06
JP2019087118A JP2019087118A (en) 2019-06-06

Family

ID=65270578

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2017216162A Active JP6463445B1 (en) 2017-11-09 2017-11-09 In-vehicle control device

Country Status (1)

Country Link
JP (1) JP6463445B1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP4224054A1 (en) 2020-09-29 2023-08-09 Nitto Denko Corporation Optical member, manufacturing method therefor, and light distribution element

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006079180A (en) * 2004-09-07 2006-03-23 Nec Electronics Corp Microcomputer
JP2009116815A (en) * 2007-11-09 2009-05-28 Denso Corp Test system and program
WO2013073009A1 (en) * 2011-11-15 2013-05-23 トヨタ自動車株式会社 Microcomputer system and monitoring microcomputer

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006079180A (en) * 2004-09-07 2006-03-23 Nec Electronics Corp Microcomputer
JP2009116815A (en) * 2007-11-09 2009-05-28 Denso Corp Test system and program
WO2013073009A1 (en) * 2011-11-15 2013-05-23 トヨタ自動車株式会社 Microcomputer system and monitoring microcomputer

Also Published As

Publication number Publication date
JP2019087118A (en) 2019-06-06

Similar Documents

Publication Publication Date Title
US20180137022A1 (en) Arithmetic operation device and virtual development environment apparatus
US20170146987A1 (en) Electronic control module testing system
JP2008009721A (en) Evaluation system and evaluation method thereof
JP2010173633A (en) Method and operation unit for adjusting control device
CN111090915A (en) Automatic driving simulation method, device and storage medium
JP6463445B1 (en) In-vehicle control device
JP5777483B2 (en) Programmable controller system
US10318687B2 (en) Implementing a constant in FPGA code
JP5982845B2 (en) Trace control apparatus and trace control method
JP6870234B2 (en) Control device, control system and control method
JP2007304972A (en) Microprocessor system
JP2003122594A (en) Semiconductor device and evaluation tool
JP2007058450A (en) Semiconductor integrated circuit
JP2005276113A (en) Pseudo random number generating method, security check method and controller
JP4466372B2 (en) Temporal correlation of messages transmitted by microprocessor monitor circuits.
CN110737480A (en) Multiplexing method and device for serial port drivers
US20180090225A1 (en) Semiconductor device and diagnosis method thereof
CN116643998B (en) AUTOSAR RTM-based test method and device
JP4976817B2 (en) Program processing apparatus and program processing method
JP2011034517A (en) Equivalence verification device, data processing method thereof, and program
CN107977315B (en) Embedded software object code unit testing method based on Bootloader mode
JP6761280B2 (en) Data retention device and data retention system
JP5000689B2 (en) Temporal correlation of messages transmitted by microprocessor monitor circuits.
JP6505482B2 (en) Electronic control unit
TWI566179B (en) Debug Message Outputting Method and Computer Program Product for BIOS

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20171109

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20180914

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20181016

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20181115

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20181228

R150 Certificate of patent or registration of utility model

Ref document number: 6463445

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

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