JP2019087118A - On-vehicle control device - Google Patents

On-vehicle control device Download PDF

Info

Publication number
JP2019087118A
JP2019087118A JP2017216162A JP2017216162A JP2019087118A JP 2019087118 A JP2019087118 A JP 2019087118A JP 2017216162 A JP2017216162 A JP 2017216162A JP 2017216162 A JP2017216162 A JP 2017216162A JP 2019087118 A JP2019087118 A JP 2019087118A
Authority
JP
Japan
Prior art keywords
cpu
program
processing
interrupt
execution
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
JP2017216162A
Other languages
Japanese (ja)
Other versions
JP6463445B1 (en
Inventor
石原 健太郎
Kentaro Ishihara
健太郎 石原
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

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

To provide an on-vehicle control device capable of identifying a cause of a bug in a control program even without using a debugger and capable of eliminating the bug of a control program even if a hook function is not prepared.SOLUTION: An on-vehicle control device 1 includes a ROM 7, a RAM 6, and a CPU 5. The ROM includes a control program that includes periodical control processing, and interruption processing executed each time when a plurality of predetermined specific processes are executed individually in a series of processes for composing the periodical control processing. The RAM includes, as expansion programs, a first expansion program capable of finding a bug in the periodical control processing and identifying a cause of the bug, and a second expansion program that can add a processed part after correction of a bug to a control program before correction of the bug in the processed part, can be executed instead of the processed part before correction, and can verify elimination of the bug in the control program. The CPU can execute the control program and the expansion program.SELECTED DRAWING: Figure 1

Description

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

モータ駆動用インバータ、照明駆動用コンバータ等の制御を行う車載制御装置(Electronic Contol Unit;以下、「ECU」と記す)は、モータ、照明機器等の制御対象のハウジング内に組み込まれ、機能部品として製品化される。   An on-board control unit (Electronic Control Unit; hereinafter referred to as "ECU") for controlling a motor drive inverter, a lighting drive converter, etc. is incorporated in a housing to be controlled such as a motor or a lighting device, and is provided 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, coordinate operations, and the like. That is, the ECU has a function of performing communication (hereinafter referred to as “external communication”) with other ECUs connected to communication lines such as CAN, FlexRay, Ethernet (registered trademark), various tools, etc. (hereinafter referred to as “external communication”) Hereinafter, it is configured to include “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, [August 25, 2017 search], 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 / functp / bypassing. cfm>

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

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

制御プログラムは、その実用性が十分確認できたところで、制御対象と組み合わされて統合試験が行われる。この段階では、ECUは、制御対象のハウジング内に組み込まれることが多く、ECUのマイコンにデバッガを接続することが困難な場合が多い。そこで、ECUが通常備える外部通信機能に対して、制御プログラムの処理データ、状態を示す変数等の実行時データの送信機能を追加する。この送信機能によって送信される実行時データを受信して観測することで、制御プログラムが正常に動作しているか否かを確認する。   The control program is combined with the control target and integrated testing is performed when its practicality is sufficiently confirmed. At this stage, the ECU is often incorporated into the housing to be controlled, and it is often difficult to connect the debugger to the microcomputer of the ECU. Therefore, the function of transmitting execution data such as processing data of the control program and variables indicating the state is added to the external communication function normally provided by the ECU. By receiving and observing the runtime data sent by the sending function, it is checked whether 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 runtime data of the control program described above is based on, for example, CAN Calibration Protocol standardized by Association for Standardization of Automation and Measuring Systems (ASAM) or Universal Measurement and Calibration Protocol (hereinafter referred to as “XCP”). It applies and transmits a protocol (for example, refer nonpatent literature 1).

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

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 in the step of repeatedly adjusting various control parameters used for the calculation (hereinafter referred to as "calibration") Be done.

また、XCPを適用するECUは、上述のRAMだけでなく、制御プログラム、データ等を記憶するフラッシュメモリを書き変えるPROGRAMコマンドに対応することができる。このコマンドを利用すれば、ECUの外部通信機能を介してフラッシュメモリに記憶された制御プログラムまたはデータの一部または全部を書き換えることができる。さらに、XCPに定義されていないコマンドをユーザーが追加定義して使用することも可能である。   Further, the ECU to which XCP is applied can correspond not only to the above-described RAM, but also to a PROGRAM command that rewrites a flash memory storing control programs, data and the like. 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. Furthermore, it is possible for the user to additionally define and use commands not defined in XCP.

上述の統合試験において、制御プログラムに不具合が発見された場合、制御プログラムの開発者は、上述の実行時データを取得して解析し、制御プログラムの不具合の原因を特定しなければならない場合がある。この場合、制御プログラム開発者は、制御プログラムの実行時データの一部しか取得することができず、マイコンにデバッガを接続した場合に提供される制御プログラムのソースレベルデバッグ機能を利用することができない。そのため、制御プログラムの不具合の原因の調査が困難であるという問題がある。   If a defect is found in the control program in the integrated test described above, the developer of the control program may have to obtain 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 execution time data, and can not 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 control program failure.

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

ただし、制御プログラムの不具合の原因の推定が正しくない場合、その不具合が完全に解消できないことがある。その場合、制御プログラムの不具合の真の原因が特定されるまで、上述の制御プログラムの実行時データを取得する工程から、統合試験を行う工程までの開発サイクルを繰り返すことになる。その結果、制御プログラムの開発に時間がかかるという問題がある。   However, if the cause of the control program's failure is not correctly estimated, the failure may not be completely eliminated. In that case, the development cycle from the step of acquiring the execution time data of the control program to the step of performing the integrated test is repeated until the true cause of the failure 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のフラッシュメモリを書き換えて、不具合を修正した後の制御プログラムに更新することができる。しかしながら、上述したように、制御プログラムの不具合の原因の推定が正しくない場合、不具合の原因を正しく推定するために、不具合が発生する制御プログラムの実行時データを取得する工程に戻る必要がある。そのため、修正後の制御プログラムを修正前の状態に戻す必要があることが多い。このようなことから、修正後の制御プログラムを修正前の状態に戻すことなく、不具合の原因を特定し、修正の効果を確認できることが望ましい。   By using the above-mentioned XCP PROGRAM command, it is possible to rewrite the flash memory of the ECU and update the control program after correcting the defect. However, as described above, when the cause of the failure of the control program is not correctly estimated, it is necessary to return to the step of acquiring the runtime data of the control program in which the failure occurs in order to correctly estimate the cause of the failure. Therefore, it is often necessary to restore the corrected control program to the state before the correction. From such a thing, it is desirable to be able to identify the cause of the failure and confirm the effect of the correction without returning the control program after the correction to the state before the correction.

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

非特許文献2によれば、元のプログラム処理を実行する直前に、フック関数と呼ばれる分岐処理関数を設け、このフック関数内で元の処理、または後で作成した制御パラメータを変更した処理を選択して実行する。これにより、ECUのROM(read only memory)に記憶される制御プログラム全体を書き変えることなく、変更が必要な処理だけを変更後の処理に切り替えてプログラムを実行させることが可能である。   According to Non-Patent Document 2, just before executing the original program processing, a branch processing function called a hook function is provided, and in this hook function, the original processing or a processing in which a control parameter created later is changed is selected. And run. As a result, it is possible to switch only the process requiring the change to the process after the change 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が必要になることがある。   In addition, the following two methods are known as a mounting method of the above-mentioned Bypassing (for example, refer nonpatent literature 2). That is, as a first method, a hook function transmits a parameter used for processing, that is, an argument of the function, to an external device such as a personal computer via XCP and external communication, and the result of external processing is sent to the ECU. There is External Bypassing to reply. As a second method, there is On-target Bypassing, which is executed by branching from inside the hook function to the changed program part stored in advance in the RAM of the ECU. In particular, in the ECU, the cycle of control processing may be as short as tens of microseconds, and in External Bypassing, external communication becomes a temporal bottleneck, and it is difficult to receive processing results from the external communication within that cycle. is there. Therefore, the ECU may need on-target bypassing that can execute processing in the ECU.

制御パラメータのキャリブレーションを行う場合、制御パラメータの調整が必要な処理の箇所が分かっているので、予め必要な処理箇所だけにフック関数を追加することができる。   When calibration of the control parameter is performed, since the location of the process requiring adjustment of the control parameter is known, it is possible to add a hook function only to the required process location in advance.

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

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

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

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

本発明の実施の形態1におけるECUの構成を示すブロック図である。FIG. 2 is a block diagram showing a configuration of an ECU according to Embodiment 1 of the present invention. 本発明の実施の形態1におけるCPUに具備される機能を示すブロック図である。It is a block diagram which shows the function comprised to CPU in Embodiment 1 of this invention. 本発明の実施の形態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 runs in Embodiment 1 of this invention. 本発明の実施の形態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 interrupt processing 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 interrupt processing 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 interrupt processing of the control program which CPU performs 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 interrupt processing of the control program which CPU performs in Embodiment 1 of this invention. 本発明の実施の形態1におけるCPUが実行する制御プログラムの割り込み処理で呼び出されるサブルーチンを示すフローチャートである。It is a flowchart which shows the subroutine called by the interrupt processing of the control program which CPU in Embodiment 1 of this invention performs.

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

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

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

図1において、ECU1は、入力回路2、マイコン3および駆動回路10を備え、モータ11を制御するとともに、外部通信線12と接続される。マイコン3は、入出力機能(以下、I/Oと記す)4と、CPU5と、RAM6と、ROM7と、タイマ8と、外部通信機能9とを備える。   In FIG. 1, the ECU 1 includes an input circuit 2, a microcomputer 3 and a drive circuit 10, and controls the motor 11 and is connected to an external communication line 12. The microcomputer 3 includes an input / output function (hereinafter referred to as an 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, for example, a protocol based on XCP is added to the external communication function 9 of the microcomputer 3. As a result, setting for detecting access of a specified memory address from external communication is performed, and a specified command and its arguments shown in FIGS. 9 and 10 described later are stored in the RAM 6.

入力回路2は、外部からの信号、および制御対象であるモータ11に設けられる各種センサからの信号を電圧として読み取る。I/O4は、デジタル信号の入出力を行い、入力回路2によって読み取られた電圧のマイコン3内への取り込みを行い、駆動回路10への制御信号の出力を行う。   The input circuit 2 reads a signal from the outside and signals from various sensors provided on 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 known architecture, and is configured to be able to execute a control program 70 described later stored in the ROM 7. Further, when an interrupt occurs during execution of the control program 70, the CPU 5 executes processing corresponding to the interrupt. Although an interrupt may be called an exception depending on a microprocessor applied as the CPU 5, in the first embodiment, the two are not particularly distinguished and are simply called an interrupt.

続いて、CPU5に具備される機能について、図2を参照しながら説明する。図2は、本発明の実施の形態1におけるCPU5に具備される機能を示すブロック図である。   Subsequently, functions provided in the CPU 5 will be described with reference to FIG. FIG. 2 is a block diagram showing functions provided to CPU 5 in the first embodiment 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. And a memory protection function set.

なお、CPU5に具備されるBP51の数は1つ以上必要であり、CPU5に具備されるメモリ保護機能組の組数は1組以上必要である。   The number of BPs 51 provided in the CPU 5 is required to be one or more, and the number of sets of memory protection functions provided in the CPU 5 is required to be 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 in 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, when the CPU 5 accesses the set address, an interrupt for notifying the CPU 5 that the CPU 5 has accessed the set address (hereinafter referred to as “BP interrupt”) Generate 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 can not operate the BP 51, that is, when the BP 51 can not 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 the CPU 5 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 the memory address accessed by the CPU 5 is within the 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" is generated.

本実施の形態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 can not be used, the above-described functions of the first MPU 52 and the second MPU 53 are used to detect that the CPU 5 has accessed a specific memory address. For example, when detecting that the CPU 5 has accessed an address A, the CPU 5 sets the first MPU 52 in the range from the top 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 the range up to the end of the possible memory space. Thereafter, the CPU 5 enables 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 enables 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 in accordance with 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 by ECUs, such as CAN, CAN FD, FlexRay, Ethernet (registered trademark). In the first embodiment, although the case where the present invention is applied to the ECU 1 controlling the motor 11 is exemplified, the present invention is not limited to this, and an ECU controlling another control target other than the motor 11 The present invention is also applicable to this case. For example, when a converter is used as the drive circuit 10 and the control target is changed from the motor 11 to the LED, the control process is performed in a short cycle as in the drive control of the motor 11 also for illuminance control of the LED. The configuration of the external communication function 9 is not particularly limited, and, for example, a configuration used by combining the above-described communication methods or a configuration using a plurality of the same communication methods can be considered. Furthermore, when wiring can be added to the ECU 1, for example, various serial communications such as UART and SPI, general purpose digital input / output (GPIO), etc. provided in the microcomputer 3 should be applied as the external communication function 9. Can.

続いて、RAM6に設けられる制御プログラム拡張部60について、図3を参照しながら説明する。図3は、本発明の実施の形態1におけるRAM6に設けられる制御プログラム拡張部60を示すブロック図である。   Subsequently, the control program expansion unit 60 provided in the RAM 6 will be described with reference to FIG. FIG. 3 is a block diagram showing a control program expansion unit 60 provided in the RAM 6 in the first embodiment 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 extension unit 60 provided in the RAM 6 includes an extension 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 area 624, and an extended program storage unit 63 having a program storage area 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 start address of a subroutine to be described later. Here, the subroutine is a processing unit of a program that extends the control program 70 and ends the processing with a return instruction that returns the processing to the calling side, and means, for example, a processing unit called a function in C language It is.

サブルーチン開始アドレス記憶変数611に記憶される有効なアドレスは、例えばプログラム記憶領域631に記憶されるサブルーチンの開始アドレス、ROM7に記憶されるサブルーチンの開始アドレス等である。   The valid addresses stored in the subroutine start address storage variable 611 are, for example, the start address of the subroutine stored in the program storage area 631, the start address of the subroutine 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, as a first argument, first argument information necessary to execute a command corresponding to the identification number. The second argument storage array 623 stores second argument information necessary for executing a command corresponding to the identification number as a second argument. The command execution result storage area 624 stores the result of execution of the command corresponding to the identification number.

ここで、上述のコマンドの一例について、図4を参照しながら説明する。図4は、本発明の実施の形態1におけるCPU5が実行する拡張プログラムのコマンドの定義の一例を示す表である。   Here, an example of the above-mentioned command will be described with reference to FIG. FIG. 4 is a table showing an example of definition of a command of the extension program 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 numbers. Also, 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 definition of the command shown in FIG.

識別番号記憶配列621、第1引数記憶配列622および第2引数記憶配列623を一組の記憶配列として、複数組の記憶配列をコマンド記憶部62に記憶することで、複数のコマンドをコマンド記憶部62に記憶することができる。なお、図3では、前記一組の記憶配列を個々の配列を用いて例示しているが、プログラムの実装の形態としては、例えばC言語で定義可能な構造体、C++言語で定義可能なクラス等に識別番号記憶配列621、第1引数記憶配列622および第2引数記憶配列623の各要素を定義し、その構造体、クラス等の配列を用いてもよい。   A plurality of sets of storage arrays are stored in the command storage unit 62 as 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, whereby a plurality of commands are stored in the command storage unit. 62 can be stored. Although FIG. 3 exemplifies the set of storage arrays using individual arrays, the form of program implementation may be, for example, a structure definable in C language, a class definable in C ++ language 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 as etc., and an array such as its structure or class may be used.

続いて、ROM7に記憶される制御プログラム70について、図5を参照しながら説明する。図5は、本発明の実施の形態1におけるROM7に記憶される制御プログラム70を示すブロック図である。   Subsequently, the control program 70 stored in the ROM 7 will be described with reference to FIG. FIG. 5 is a block diagram showing control program 70 stored in 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 control program 70 is stored in the ROM 7, and the CPU 5 reads out 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 cycle control process 72 for periodically controlling the motor 11 which is an example of the control object, and an external communication function 9. 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 a 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 means for the CPU 5 to read the sensor voltage value, for example, means for using an A / D conversion function provided in the microcomputer 3 or a protocol of SENT or PSI 5 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 S105, the CPU 5 reads correspondence necessity information indicating necessity of correspondence to the specification of the cycle control processing 72, and determines the correspondence necessity information. 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 one of the two or more types of specifications.

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

ステップS105において、CPU5は、対応要否情報が、対応が不要であることを示す「0」であるか否かを判定する。CPU5は、対応要否情報が「0」であると判定した場合には、処理がステップS103へと進む。一方、CPU5は、対応要否情報が「0」でないと判定した場合には、処理がステップS106へと進む。   In step S105, the CPU 5 determines whether the correspondence necessity information is “0” indicating that the correspondence is unnecessary. When the CPU 5 determines that the correspondence necessity information is “0”, the process proceeds to step S103. On the other hand, when the CPU 5 determines that the response 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 a 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 process 72, and the correspondence necessity information is “depending on whether the value is High level or Low level. It is determined whether it is 0 ".

ステップ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 the correction in step S102 or the sensor voltage value after the 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. The CPU 5 outputs, for example, a control amount corresponding to PWM (Pulse Width Modulation) control to the I / O 4. The drive circuit 10 drives the motor 11 in accordance with 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 failure when the failure of the cycle control process 72 of the control program 70 shown in FIG. 6 occurs will be described. Here, as an example of the problem of the cycle control process 72 shown in FIG. 6, the CPU 5 determines in step S105 that it is necessary to cope with the specification of the cycle control process 72, and the step S106 should be executed. Suppose that the reverse determination is made and step S106 is not performed. In this case, since the control amount is calculated in step S103 without the sensor voltage value being additionally corrected in step S106, as a result, when the integrated test is performed for the control program 70, the result that the required performance is not satisfied Become.

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

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

・項目(1):ステップS104でI/O4に出力された制御量が設計範囲内であること
・項目(2):ステップS103で算出された制御量が設計範囲内であること
・項目(3):ステップS102で補正されたセンサ電圧値が設計範囲内であること
Item (1): The control amount output to 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 items (1) to (3) described above, the program storage area 631 of the extension program storage unit 63 of the RAM 6 stores the extension program shown in FIG. It is memorized. Also, the start address of the extended program is stored by using the external communication function 9 and XCP.

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

図8および図9に示されるNは、制御プログラム拡張部60をRAM6に記憶する際に0に設定される。制御プログラム拡張部60をRAM6に記憶する際に、コマンド実行結果記憶領域624には、図9に示すコマンドの実行結果が未だ記憶されていないことを示す、例えば0または255等の初期値が記憶される。   N shown in FIGS. 8 and 9 is set to 0 when storing the control program expansion unit 60 in the RAM 6. When storing the control program expansion unit 60 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. 9 is not stored yet. Be done.

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

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 BP51 in the execution address to be accessed when executing step S101, that is, the execution address of step S101. When the BP 51 is disposed at an address accessible by the CPU 5, this setting is performed using the external communication function 9 and the XCP. If BP 51 is not located at an address accessible by CPU 5 and it is necessary to implement this setting using a dedicated instruction of CPU 5 etc., this setting is implemented by adding a user-defined command to XCP. can do.

このように、アクセス検知機能としてのBP51は、CPU5が、周期制御処理72を構成する一連の処理であるステップS101〜S106の中で複数の予め決められる特定処理を実行する際にアクセスする実行アドレスに、CPU5がアクセスしたことを検知して、割り込みを発生させる。   As described above, the BP 51 as the access detection function is an execution address to be accessed when the CPU 5 executes a plurality of predetermined specific processes in steps S101 to S106, which is a series of processes constituting the cycle control process 72. 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 to the execution address of the specific process. By thus setting the BP 51 as the access detection function, the BP 51 detects that the CPU accesses the 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. The specific method of setting the address range is the same as the method for generating the above-described MPU interrupt. By setting the first MPU 52 and the second MPU 53 as the access detection function in this manner, the first MPU 52 and the second MPU 53 recognize that the CPU accesses the execution address when the execution address accessed by the CPU 5 is out of the address range. Detect and generate an interrupt.

なお、BP51が設定されるステップS101〜ステップS104のそれぞれの実行アドレスは、例えば、制御プログラム70をPC上のデバッガで読み込み、処理とアドレスとの対応を表示することで取得可能である。   The execution address of each of steps S101 to S104 where BP 51 is set can be acquired, for example, by 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 in the case where a BP interrupt is generated each time each of steps S101 to S104 of the cycle control process 72 shown in FIG. 6 will be described.

上述のとおり、制御プログラム拡張部60がRAM6に記憶され、BP51の機能が有効化された後、CPU5がステップS101を実行すれば、第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 S101, a 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 an interrupt process shown in FIG. Here, interrupt processing executed when a BP interrupt occurs will be described with reference to FIG. FIG. 7 is a flowchart showing the BP interrupt processing 74 of the control program 70 executed by the CPU 5 in the first embodiment of the present invention. The interrupt process is executed each time a plurality of predetermined identification processes are individually executed in steps S101 to S106, which are a series of processes constituting the cycle control process 72, as described later.

図7に示す割り込み処理は、発生した割り込みに応答して、周期制御処理72で特定処理の実行後以降の処理を中断し、第1拡張プログラムまたは第2拡張プログラムを実行し、当該実行後に、周期制御処理72で特定処理の実行後以降の処理を再開するように、CPU5に対して動作させる。   In the interrupt processing shown in FIG. 7, in response to the generated interrupt, the periodic control processing 72 interrupts the processing after execution of the specific processing, executes the first expansion program or the second expansion 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 is applicable 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 is generated and the execution of the interrupt processing is started, the CPU 5 reads out the start address of the subroutine stored in the subroutine start address storage variable 611 in step S201, The process proceeds to step S202.

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

CPU5がサブルーチン開始アドレス記憶変数611に記憶されるサブルーチンの開始アドレスが有効であるか無効であるかを判定する手段としては、例えば、以下の手段が考えられる。すなわち、CPU5は、開始アドレスがゼロであれば無効であると判定し、開始アドレスがゼロ以外であれば有効であると判定する。   As means for determining whether the start address of the subroutine stored in the subroutine start address storage variable 611 is valid or invalid, the CPU 5 may consider, for example, the following means. That is, the CPU 5 determines that the start address is invalid if it 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によって初期化されて、無効なアドレスを記憶する。   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 S101. 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 processing, 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 execution of the subroutine.

ここで、割り込み処理で呼び出されるサブルーチンについて、図8を参照しながら説明する。図8は、本発明の実施の形態1におけるCPU5が実行する制御プログラム70の割り込み処理で呼び出されるサブルーチンを示すフローチャートである。   Here, the subroutine called in the interrupt processing 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 extended program shown in FIG. 8, that is, the first extended 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 to be executed next to the specific process in the cycle control process 72. The CPU 5 is operated to set the access detection function so that the access detection function detects that it has been done.

割り込み処理でサブルーチンが呼び出されると、拡張プログラム記憶部63のプログラム記憶領域631に記憶される拡張プログラム、すなわち図8に示すサブルーチンが実行される。ステップS301において、CPU5は、コマンド記憶部62の識別番号記憶配列621に記憶される要素Nを読み出し、処理がステップS302へと進む。   When the subroutine is called in the interrupt processing, 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 the command corresponding to the element N read out in step S301 is an end command. If it is determined that the command is an end command, the process ends, and 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 out in step S301 is executed, the process returns to step S301, and the processes in step S301 and subsequent steps are executed again.

ここで、図8に示すサブルーチンで実行されるコマンドについて、図9を参照しながら説明する。図9は、本発明の実施の形態1におけるCPU5が実行する制御プログラム70の割り込み処理で呼び出されるサブルーチンのコマンドの定義の一例を示す表である。   Here, 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 a command definition of a subroutine called in the interrupt processing 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 and 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 And are stored respectively. Further, 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に記憶する。   Referring back to FIG. 7, when the subroutine is called in the interrupt processing, initially N = 0, so in the subroutine shown in FIG. 8, N = 1 in step S302, and N = 0 in step S304. The command is executed. In this case, as can be seen from FIG. 9, the CPU 5 reads out the sensor voltage value obtained in step S101 and stores it as first data in the command execution result storage area 624.

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 instructing the end of the process, in the subroutine, the processes after step S301 are continuously executed. 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 to generate a BP interrupt after the CPU 5 executes step S102 shown in FIG. 6, the CPU 5 sets BP51 in 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, in the subroutine, the processes after step S301 are subsequently executed. In the subroutine, in step S302, N = 3, and in step S303, it is determined that the command corresponding to N = 2 is the end command, and the process ends.

この場合、サブルーチンが終了となり、処理が図7に示す割り込み処理に返され、さらに割り込み処理が終了となり、処理が図6に示す周期制御処理72のステップS101の実行の完了地点に戻る。なお、サブルーチンの終了時において、識別番号記憶配列621に記憶される要素Nの値そのものは、上述したとおり、N=3になっている。   In this case, the subroutine ends, the process returns to the interrupt process shown in FIG. 7, and the interrupt process ends, and the process returns to the completion point of the execution of step S101 of the cycle control process 72 shown in FIG. At the end of the subroutine, the value itself 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に記憶する。   Thus, in response to the interrupt generated by the BP 51 as the access detection function, the CPU 5 interrupts the processing after the execution of step S101 in the cycle control processing 72. In addition, the CPU 5 stores the processing result of step S101 in the command execution result storage area 624 according to the extension program by executing the interrupt processing.

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

図6に戻り、CPU5は、ステップS102を実行した後、第2BP割り込みが発生すると、図7に示す割り込み処理を再度実行する。この場合、ステップS203でサブルーチンが呼び出され、そのサブルーチンが再度実行される。   Returning to FIG. 6, after the execution of step S102, when the second BP interrupt is generated, the CPU 5 executes the interrupt processing 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 the subroutine is called in the 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 as second data in the command execution result storage area 624.

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, in the subroutine, the processes after step S301 are subsequently executed. 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 to generate a BP interrupt after the CPU 5 executes step S103 shown in FIG. 6, the CPU 5 sets BP51 in 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, in the subroutine, the processes after step S301 are subsequently executed. 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 ends, the process returns to the interrupt process shown in FIG. 7, and the interrupt process ends, and the process returns to the completion point of the execution of step S102 of the cycle control process 72 shown in FIG. At the end of the subroutine, the value itself 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, in response to the interrupt generated by the BP 51 as the access detection function, the CPU 5 interrupts the process after the execution of step S102 in the cycle control process 72. Further, the CPU 5 stores the processing result of step S 102 in the command execution result storage area 624 according to the extended program by executing the interrupt processing.

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

図6に戻り、CPU5は、ステップS103を実行した後、第3BP割り込みが発生すると、図7に示す割り込み処理を再度実行する。この場合、ステップS203でサブルーチンが呼び出され、そのサブルーチンが再度実行される。   Returning to FIG. 6, when the third BP interrupt occurs after the execution of step S103, the CPU 5 executes the interrupt processing 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 the subroutine is called in the interrupt processing, N = 6 at the end of the previous subroutine. Therefore, in the present subroutine, N = 7 in step S302, and corresponds to N = 6 in step S304. The command is executed. In this case, the CPU 5 reads out the control amount calculated in step S103 and stores it as third data in the command execution result storage area 624.

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, in the subroutine, the processes after step S301 are subsequently executed. In the subroutine, N = 8 in step S302, and the command corresponding to N = 7 is executed in step S304. In this case, in order to generate a BP interrupt after the CPU 5 executes step S104 shown in FIG. 6, the CPU 5 sets BP51 in the 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, in the subroutine, the processes after step S301 are subsequently executed. 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 ends, the process returns to the interrupt process shown in FIG. 7, and the interrupt process ends, and the process returns to the completion point of the execution of step S103 of the cycle control process 72 shown in FIG. At the end of the subroutine, the value itself 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に記憶する。   Thus, in response to the interrupt generated by the BP 51 as the access detection function, the CPU 5 interrupts the processing after the execution of step S103 in the cycle control processing 72. 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 such that the BP 51 detects that the CPU 5 has accessed the execution address of the step S104, which is the next specific process to be executed after the step S103 in the cycle control process 72. Further, the CPU 5 ends the interrupt processing, and restarts the processing after the execution of step S103 in the cycle control processing 72.

図6に戻り、CPU5は、ステップS104を実行した後、第4BP割り込みが発生すると、図7に示す割り込み処理を再度実行する。この場合、ステップS203でサブルーチンが呼び出され、そのサブルーチンが再度実行される。   Returning to FIG. 6, when the fourth BP interrupt is generated after the execution of step S104, the CPU 5 executes the interrupt processing shown in FIG. 7 again. 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 the subroutine is called in the interrupt processing, N = 9 at the end of the previous subroutine, so in the present subroutine, N = 10 in step S302, and corresponds to N = 9 in step S304. The command is executed. In this case, the CPU 5 reads out the control amount output in step S104 and stores it as fourth data in the command execution result storage area 624.

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, in the subroutine, the processes after step S301 are subsequently executed. 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 BP 51 to zero.

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

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

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

CPU5は、周期制御処理72を構成する一連の処理の中での特定処理であるステップS101〜S104をすべて実行し、さらに、周期制御処理72の最後の処理であるステップS104を実行したので、周期制御処理72が終了となる。   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 the step S104 which is the last process of the cycle control process 72. 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, since no new BP interrupt occurs after the occurrence of the fourth BP interrupt, the cycle control process 72 shown in FIG. 6 ends without executing the interrupt process. Therefore, the first data, the second data, the third data, and the fourth data are stored in the command execution result storage area 624 as data after execution of a series of commands corresponding to N = 0 to 11 described above. By reading data stored in the command execution result storage area 624 using the external communication function 9 and XCP, the results of execution of each of steps S101, S102, S103 and S104 are subjected to period 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, only the data stored in the static variable whose address is known can be acquired by the XCP. , And the data temporarily held in the CPU register can not be acquired. However, according to the configuration of the ECU 1 in the first embodiment, an automatic command temporarily used in the period control process 72 of the control program 70 is defined by defining the command to be executed by the CPU 5 and the command for acquiring the stack frame. It is possible to obtain variables and data temporarily held in the CPU register.

上述のN=0〜11に対応する一連のコマンド実行後のデータをコマンド実行結果記憶領域624から取得することで、上述の項目(1)〜(3)を確認することができる。その結果、ステップS104でI/O4に出力された制御量、ステップS103で算出された制御量およびステップS102で補正されたセンサ電圧値が、それぞれ設計範囲内ではないことが分かる。つまり、ステップS101で取得されたセンサ電圧値が設計どおりに補正されていないことを推定することができる。   The above items (1) to (3) can be confirmed by acquiring data after execution of a series of commands corresponding to the above N = 0 to 11 from the command execution result storage area 624. As a result, it is understood 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 period control processing 72 shown in FIG. Check.

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

上述の項目(4)〜(6)の確認を効率良く行うために、RAM6の拡張プログラム記憶部63のプログラム記憶領域631には、上述の図8に示す拡張プログラムが記憶される。また、その拡張プログラムの開始アドレスは、外部通信機能9とXCPを利用するなどして記憶される。   In order to efficiently check the items (4) to (6) described above, the program storage area 631 of the program storage unit 63 of the RAM 6 stores the extension program shown in FIG. Also, the start address of the extended 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を設定する。   In each of the identification number storage array 621 of the command storage unit 62, the first argument storage array 622, and the second argument storage array 623, an identification number shown in FIG. 10 described later, a first argument, and a second argument Are associated and stored. Further, in order to generate a BP interrupt after the CPU 5 executes step S102 shown in FIG. 6, the CPU 5 sets BP51 at 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, a 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 the execution of the subroutine.

ステップS203でのサブルーチンの呼び出しによって、図8に示すサブルーチンが実行される。このサブルーチンでは、図10に示すコマンドが実行される。図10は、本発明の実施の形態1におけるCPU5が実行する制御プログラム70の割り込み処理で呼び出されるサブルーチンのコマンドの定義の一例を示す表である。   The subroutine shown in FIG. 8 is executed by calling the subroutine at step S203. In this subroutine, the commands shown in FIG. 10 are executed. FIG. 10 is a table showing an example of a command definition of a subroutine called in the interrupt processing 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 and 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 And are stored respectively. Further, in FIG. 10, the meaning of the command corresponding to the element N is also shown.

サブルーチンにおいて、図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 processing is returned to the calling side's interrupt processing. At this time, the CPU 5 places the read-out correspondence information read out above in the command execution result storage area 624 as the first data immediately before the completion point of the execution of step S102, ie, the start of the execution of step S105. Remember.

上述したとおり、図8に示すサブルーチンの終了によって、図7に示す割り込み処理に処理が返され、さらに、割り込み処理が終了となり、CPU5は、ステップS102の実行の完了地点に復帰する。その後、CPU5は、ステップS105を実行する。   As described above, when the subroutine shown in FIG. 8 is completed, the process is returned to the interrupt process shown in FIG. 7, and the interrupt process is completed, and the CPU 5 returns to the execution completion point 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 place where the step S106 is to be performed is The reverse determination is performed, and the case where step S106 is not performed is considered. Therefore, in step S105, the CPU 5 determines that the correspondence necessity information is “0” indicating that the correspondence is unnecessary, and executes step S103 without executing step S106.

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

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

上述の項目(1)〜(6)の確認結果から、不具合の原因は、センサ電圧値の追加補正が未実施であることによる可能性があることが分かる。   From the confirmation results of the above items (1) to (6), it can be understood that the cause of the failure may be that the additional correction of the sensor voltage value is not 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) can not be confirmed directly. Therefore, even if it is confirmed that the sensor voltage value after correction before execution of step S103 is out of the design range, direct evidence that the reason is due to non-execution of step S106 can not be obtained.

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

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

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

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

また、CPU5は、図8に示す拡張プログラムを実行させることで、周期制御処理72で特定処理の次に実行される次の特定処理の実行アドレスにCPU5がアクセスしたことをBP51が検知するように、BP51を設定する。その後、CPU5は、拡張プログラムの実行後に、周期制御処理72で特定処理の実行後以降の処理を再開する。   Further, by causing the CPU 5 to execute the extension program shown in FIG. 8, the BP 51 detects that the CPU 5 has accessed the execution address of the next specific process to be executed next to the specific process in the cycle control process 72. , BP 51 is set. After that, the CPU 5 resumes 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 the first embodiment, after the cause of the failure of the cycle control process 72 of the control program 70 is estimated, the failure is corrected, and the result of the cycle control process 72 after the correction is confirmed.

上述の修正の確認を効率良く実施するために、RAM6の拡張プログラム記憶部63のプログラム記憶領域631には、後述する図11に示す拡張プログラム、すなわち、第2拡張プログラムが記憶される。また、その拡張プログラムの開始アドレスは、外部通信機能9とXCPを利用するなどして記憶される。   In order to efficiently check the correction described above, the program storage area 631 of the expansion program storage unit 63 of the RAM 6 stores an expansion program shown in FIG. 11 described later, that is, a second expansion program. Also, the start address of the extended 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 to 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 validated, if the CPU 5 executes step S102, a BP interrupt occurs immediately before the CPU 5 executes step S105.

BP割り込みが発生すると、CPU5は、図7に示す割り込み処理を実行する。CPU5は、割り込み処理において、サブルーチン開始アドレス記憶変数611に記憶される開始アドレスに対応する図11に示すサブルーチンを呼び出し、そのサブルーチンの実行を開始する。   When a BP interrupt occurs, the CPU 5 executes an interrupt process shown in FIG. In the interrupt processing, 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 the execution of the subroutine.

ここで、割り込み処理で呼び出されるサブルーチンについて、図11を参照しながら説明する。図11は、本発明の実施の形態1におけるCPU5が実行する制御プログラム70の割り込み処理で呼び出されるサブルーチンを示すフローチャートである。   Here, the subroutine called in the interrupt processing will be described with reference to FIG. FIG. 11 is a flowchart showing a subroutine called in the interrupt processing 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 expansion program shown in FIG. 11, that is, the second expansion program causes the CPU 5 to execute post-correction processing after correcting the processing that is the cause of the failure occurring in the cycle control processing 72. The post-correction process corresponds to steps S105N and S106 shown in FIG.

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

ここで、ステップS105Nの判定処理では、対応要否情報が「1」である場合には、対応が不要であると判定され、対応要否情報が、「1」でない、すなわち「0」である場合には、対応が必要であると判定されるように構成されている。つまり、ステップS105Nは、周期制御処理72で発生する不具合の原因である図6に示すステップS105を修正している。具体的には、ステップS105Nの判定論理は、ステップS105の判定論理の逆となるように修正されている。   Here, in the determination processing of step S105N, when the correspondence necessity information is “1”, it is determined that the correspondence is not necessary, and the correspondence necessity information is not “1”, that is, “0”. In this case, it is configured to be determined that a response is necessary. That is, step S105N corrects step S105 shown in FIG. 6 which is the cause of the problem occurring in the cycle control process 72. Specifically, the determination logic in step S105N is corrected 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, when 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 returns to the interrupt process shown in FIG. 7, and the interrupt process ends, and the process returns to the completion point of the execution of step S102 shown in FIG. Thereafter, although the CPU 5 executes the determination of step S105, this determination is not correctly performed due to the above-described failure. 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 expansion program shown in FIG. 11 to execute the post-correction process after correcting the process that is the cause of the occurrence of the failure in the cycle control process 72. After that, the CPU 5 resumes the processing after the execution of the specific processing in the cycle control processing 72 after the execution of the extension program. That is, according to the subroutine shown in FIG. 11, the CPU 5 executes the steps S105N and S106 to perform the additional correction of the sensor voltage value. 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, storing the extended program shown in FIG. 11 in the RAM 6 and carrying out an integration test on the control program 70 eliminates the problem that the required performance is not satisfied without changing the cycle control process 72 of the control program 70. You can confirm that. That is, when confirming the result of the defect correction of the control program 70, it is not necessary to use the hook function necessary for the on-target bypassing.

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

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

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

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割り込み処理。   Reference Signs List 1 in-vehicle control unit (ECU), 2 input circuits, 3 microcomputers, 4 I / O, 5 CPU, 6 RAM, 7 ROM, 8 timers, 9 external communication function, 10 drive circuits, 11 motors, 12 external communication lines, 51 Breakpoint function, 52 first memory protection function, 53 second memory protection function, 60 control program extension unit, 61 extended program start address storage unit, 611 subroutine start address storage variable, 62 command storage unit, 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 unit 631 program storage area 70 control program 71 initialization process 72 cycle control process 73 XCP process 74 BP interrupt processing, 75 MPU interrupt processing .

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

Claims (3)

制御対象を周期的に制御するための周期制御処理と、前記周期制御処理を構成する一連の処理の中で複数の予め決められる特定処理が個別に実行されるたびに実行される割り込み処理とを含む制御プログラムを記憶するROMと、
拡張プログラムとして第1拡張プログラムおよび第2拡張プログラムを記憶するRAMと、
前記制御プログラムおよび前記拡張プログラムを実行するCPUと、
を備え、
前記CPUは、
前記特定処理を実行する際にアクセスする実行アドレスにアクセスしたことを検知して、割り込みを発生させるアクセス検知機能を備え、
前記アクセス検知機能によって発生した前記割り込みに応答して前記割り込み処理を実行させることで、前記周期制御処理で前記特定処理の実行後以降の処理を中断し、前記第1拡張プログラムまたは前記第2拡張プログラムを実行し、当該実行後に、前記周期制御処理で前記特定処理の実行後以降の処理を再開し、
前記第1拡張プログラムを実行させることで、前記特定処理の処理結果を前記RAMに記憶させるとともに、前記周期制御処理で前記特定処理の次に実行される次の特定処理の実行アドレスに前記CPUがアクセスしたことを前記アクセス検知機能が検知するように、前記アクセス検知機能を設定し、
前記第2拡張プログラムを実行させることで、前記周期制御処理で不具合が発生する原因である処理を修正した後の修正後処理を実行する
車載制御装置。
A cycle control process for periodically controlling a control target, and an interrupt process which is executed each time a plurality of predetermined specific processes among the series of processes constituting the cycle control process are individually executed A ROM storing a control program including the
A RAM storing a first expansion program and a second expansion program as an expansion program;
A CPU that executes the control program and the extension program;
Equipped with
The CPU is
An access detection function is provided which detects an access to an execution address to be accessed when executing the specific processing, and generates an interrupt.
By executing the interrupt processing in response to the interrupt generated by the access detection function, processing after the execution of the specific processing is interrupted in the periodic control processing, and the first extension program or the second extension program is executed. The program is executed, and after the execution, processing after the execution of the specific processing is resumed in the periodic control processing,
By executing the first extension program, the processing result of the specific process is stored in the RAM, and the CPU executes the next specific process execution address next to the specific process in the periodic control process. Setting the access detection function so that the access detection function detects that the access has been made;
An in-vehicle control device that executes a post-correction process after correcting a process that is a cause of 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 accesses the execution address and generates the interrupt.
前記アクセス検知機能は、第1メモリ保護機能および第2メモリ保護機能によって構成され、
前記CPUは、前記第1メモリ保護機能および前記第2メモリ保護機能を、前記実行アドレスに基づいたアドレス範囲に設定し、
前記第1メモリ保護機能および前記第2メモリ保護機能は、前記CPUがアクセスした前記実行アドレスが前記アドレス範囲外であることをもって、前記実行アドレスに前記CPUがアクセスしたことを検知して、前記割り込みを発生させる
請求項1に記載の車載制御装置。
The access detection function includes a first memory protection function and a second memory protection function.
The CPU sets the first memory protection function and the second memory protection function in an address range 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 based on the fact that the execution address accessed by the CPU is out of the address range, and the interrupt is generated. The on-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 JP6463445B1 (en) 2019-02-06
JP2019087118A true 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)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022071165A1 (en) 2020-09-29 2022-04-07 日東電工株式会社 Optical member, manufacturing method therefor, and light distribution element

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4571462B2 (en) * 2004-09-07 2010-10-27 ルネサスエレクトロニクス株式会社 Microcomputer
JP4661854B2 (en) * 2007-11-09 2011-03-30 株式会社デンソー Inspection system and program
WO2013073009A1 (en) * 2011-11-15 2013-05-23 トヨタ自動車株式会社 Microcomputer system and monitoring microcomputer

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022071165A1 (en) 2020-09-29 2022-04-07 日東電工株式会社 Optical member, manufacturing method therefor, and light distribution element

Also Published As

Publication number Publication date
JP6463445B1 (en) 2019-02-06

Similar Documents

Publication Publication Date Title
US20180137022A1 (en) Arithmetic operation device and virtual development environment apparatus
JP2008009721A (en) Evaluation system and evaluation method thereof
CN111090915A (en) Automatic driving simulation method, device and storage medium
JP6723941B2 (en) Control device and control program updating method
JP6463445B1 (en) In-vehicle control device
JP2018041402A (en) Electronic control device
JP5982845B2 (en) Trace control apparatus and trace control method
CN112835598A (en) Automobile ECU (electronic control Unit) flashing method and system and computer readable storage medium
JP6870234B2 (en) Control device, control system and control method
JP6813513B2 (en) Methods and devices for protecting the program counter structure of the processor system and methods and devices for monitoring the processing of interruption requests.
CN105785824B (en) Method and system for transmitting memory size parameters to Linux kernel
JP2007304972A (en) Microprocessor system
JP2005092520A (en) Duplication controller system and equalization method thereof
JP2007058450A (en) Semiconductor integrated circuit
JP4747683B2 (en) On-vehicle electronic control system, fault diagnosis method thereof, and on-vehicle electronic control device
CN116643998B (en) AUTOSAR RTM-based test method and device
CN113485284B (en) Message data processing method, device, equipment and storage medium
JP6505482B2 (en) Electronic control unit
JP6761280B2 (en) Data retention device and data retention system
JP6784581B2 (en) Anomaly detection method for electronic control devices for automobiles and DMA controllers
JP2010102446A (en) Automatic software test device
JP2009282849A (en) Microcomputer
KR101856065B1 (en) Apparatus and method for testing on board diagnosis
JP2015102453A (en) Vehicle data storage device
JP2013105388A (en) Interruption circuit and interruption method

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