JP5942904B2 - Processing equipment - Google Patents
Processing equipment Download PDFInfo
- Publication number
- JP5942904B2 JP5942904B2 JP2013057095A JP2013057095A JP5942904B2 JP 5942904 B2 JP5942904 B2 JP 5942904B2 JP 2013057095 A JP2013057095 A JP 2013057095A JP 2013057095 A JP2013057095 A JP 2013057095A JP 5942904 B2 JP5942904 B2 JP 5942904B2
- Authority
- JP
- Japan
- Prior art keywords
- data
- initialization
- unit
- initialized
- cpu
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000012545 processing Methods 0.000 title claims description 55
- 238000000034 method Methods 0.000 claims description 54
- 230000000052 comparative effect Effects 0.000 description 16
- 230000005764 inhibitory process Effects 0.000 description 5
- 239000000446 fuel Substances 0.000 description 4
- 230000004043 responsiveness Effects 0.000 description 4
- 230000005856 abnormality Effects 0.000 description 3
- 230000005540 biological transmission Effects 0.000 description 3
- 238000004891 communication Methods 0.000 description 3
- 238000002347 injection Methods 0.000 description 3
- 239000007924 injection Substances 0.000 description 3
- 230000004044 response Effects 0.000 description 3
- 230000007423 decrease Effects 0.000 description 2
- 230000006866 deterioration Effects 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 239000002826 coolant Substances 0.000 description 1
- 238000012937 correction Methods 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 238000003745 diagnosis Methods 0.000 description 1
- 230000002401 inhibitory effect Effects 0.000 description 1
- 230000007257 malfunction Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
Images
Landscapes
- Memory System (AREA)
Description
本発明は、優先度が設けられる複数のタスクを並行して処理するマルチタスク方式の処理装置であって、データ領域に記憶された複数のデータの初期化を行う処理装置に関する。 The present invention relates to a multitasking processing apparatus that processes a plurality of tasks with priorities in parallel, and initializes a plurality of data stored in a data area.
通常、処理装置は、演算部と記憶部とを備えて構成されている。また、処理装置では、何らかの理由によって、記憶部における複数のデータが記憶されたデータ領域全体を初期化することがある。このように、データ領域の全体を初期化する場合、データ領域全体の整合性を保つために、他のタスク(優先度が高いタスク)が実行されて、初期化途中のデータ領域が参照されないようにする必要がある。つまり、データ領域の初期化途中は、このデータ領域からデータが読み出されたり、このデータ領域にデータが書き込まれたりしないようにする必要がある。 Usually, the processing device is configured to include a calculation unit and a storage unit. In addition, the processing device may initialize the entire data area in which a plurality of data is stored in the storage unit for some reason. In this way, when initializing the entire data area, other tasks (high priority tasks) are executed so that the data area being initialized is not referred to in order to maintain consistency of the entire data area. It is necessary to. In other words, during the initialization of the data area, it is necessary to prevent data from being read from or written to this data area.
そこで、特許文献1に開示されているように、CPUのリセット後、RAMへの初期値設定が終了するまでの期間、外部割り込み端子への入力を禁止することが考えられる。つまり、データ領域の全体を初期化している間は、他のタスクの割り込みを禁止することが考えられる。
Therefore, as disclosed in
上述のように、他のタスクの割り込みを禁止することで、他のタスクが実行されて、初期化途中のデータ領域が参照されないようにすることができる。しかしながら、データ領域の全体を初期化している間は、他のタスクの割り込みが禁止されるので、初期化すべきデータの量に比例して割り込み禁止時間が長くなり、リアルタイム応答性が低下するという問題がある。 As described above, by prohibiting interruption of other tasks, it is possible to prevent other tasks from being executed and to refer to the data area being initialized. However, while the entire data area is being initialized, interrupts of other tasks are prohibited, so the interrupt prohibition time increases in proportion to the amount of data to be initialized, and the real-time responsiveness decreases. There is.
本発明は、上記問題点に鑑みなされたものであり、リアルタイム応答性が低下することを抑制できる処理装置を提供することを目的とする。 The present invention has been made in view of the above problems, and an object of the present invention is to provide a processing apparatus capable of suppressing a reduction in real-time responsiveness.
上記目的を達成するために本発明は、
演算部(11)と記憶部(12)とを備え、優先度が設けられる複数のタスクを並行して処理するマルチタスク方式の処理装置(10)であって、
記憶部は、複数のデータが記憶されたデータ領域を備え、
演算部は、複数のタスクのうちの一つとして、複数のデータの少なくとも一つを初期化単位とした初期化を繰り返し行うことで、データ領域に記憶された全データを初期化するものであり、
各初期化単位での初期化を行う際に、タスクの割り込みを禁止する禁止手段(S40)と、
禁止手段にてタスクの割り込みが禁止された後に、初期化単位での初期化を行う第1単位初期化手段(50)と、
第1単位初期化手段による各初期化単位での初期化が終了した後に、禁止手段にて禁止していたタスクの割り込みの禁止を解除する解除手段(S60)と、を備えることを特徴とする。
In order to achieve the above object, the present invention provides:
A multi-task processing device (10) that includes a calculation unit (11) and a storage unit (12), and processes a plurality of tasks provided with priority in parallel.
The storage unit includes a data area in which a plurality of data is stored,
The computation unit initializes all data stored in the data area by repeatedly performing initialization using at least one of a plurality of data as an initialization unit as one of a plurality of tasks. ,
A prohibition means (S40) for prohibiting interruption of a task when performing initialization in each initialization unit;
A first unit initialization unit (50) for performing initialization in units of initialization after the interruption of a task is prohibited by the prohibition unit;
And release means (S60) for releasing the prohibition of the interrupt of the task prohibited by the prohibiting means after the initialization in each initialization unit by the first unit initializing means is completed. .
このように、本発明は、データ領域に記憶された複数のデータを初期化する場合、初期化単位での初期化を繰り返し行うことで、データ領域に記憶された全てのデータを初期化する。また、本発明は、データ領域に記憶された複数のデータを初期化する場合、タスクの割り込みを禁止する。しかしながら、本発明は、各初期化単位での初期化が終了した後に、割り込みの禁止を解除する。よって、本発明は、データ領域に記憶された複数のデータを初期化する場合、割り込みの禁止、初期化単位での初期化、割り込み禁止の解除を繰り返し行うことで、データ領域に記憶された全てのデータを初期化する。つまり、本発明は、データ領域に記憶された全てのデータを初期化している間、ずっと割り込みを禁止するものではない。このように、本発明は、各初期化単位での初期化が終わるたびに、割り込みの禁止を解除するので、長時間割り込み禁止が継続することを防止でき、リアルタイム応答性の低下を抑制できる。 As described above, according to the present invention, when a plurality of data stored in the data area is initialized, all data stored in the data area is initialized by repeatedly performing initialization in units of initialization. Further, the present invention prohibits task interruption when initializing a plurality of data stored in the data area. However, the present invention cancels the prohibition of interrupts after the initialization in each initialization unit is completed. Therefore, in the present invention, when initializing a plurality of data stored in the data area, all of the data stored in the data area is repeatedly performed by repeatedly disabling interrupts, initializing in units of initialization, and canceling the prohibition of interrupts. Initialize the data. In other words, the present invention does not prohibit interrupts while initializing all data stored in the data area. As described above, according to the present invention, since the prohibition of the interrupt is released every time the initialization in each initialization unit is completed, it is possible to prevent the prohibition of the interrupt from continuing for a long time and to suppress the deterioration of the real-time responsiveness.
以下、本発明の実施形態を図に基づいて説明する。本実施形態は、本発明である処理装置をECU100に設けられたマイコン10に適用している。なお、ECUは、Electronic Control Unitの略である。
Hereinafter, embodiments of the present invention will be described with reference to the drawings. In the present embodiment, the processing apparatus according to the present invention is applied to a
図1に示すように、ECU100は、要部として、マイコン10、出力IF20、入力IF30を備えて構成されている。また、ECU100は、センサ200及び制御対象300などの外部装置と電気的に接続されている。そして、ECU100は、入力IF30を介して、センサ200からの検出信号を取得することができる。また、ECU100は、出力IF20を介して、制御対象300に対して制御信号を出力することができる。なお、ECU100は、センサ200のかわりに、ECU100以外のECUから信号を取得するものであってもよい。また、制御対象300は、モータなどのアクチュエータや、ECU100以外のECUなどを採用することができる。
As shown in FIG. 1, the ECU 100 includes a
このECU100は、例えば、車両の搭載機器を電子的に制御する各種の電子制御装置に適用することができる。また、電子制御装置が制御対象とする車両の搭載機器は、エンジン、変速機、ブレーキ等のパワートレイン系機器、エアコン、シート、ドアロック等のボディ系機器、ナビ、ETC、ラジオ等の情報系機器、及びエアバック等のセイフティ系機器などである。 The ECU 100 can be applied to, for example, various electronic control devices that electronically control onboard equipment. In addition, vehicle-mounted devices that are controlled by the electronic control device include powertrain devices such as engines, transmissions, and brakes, body devices such as air conditioners, seats, and door locks, and information systems such as navigation, ETC, and radio. Equipment and safety equipment such as airbags.
図1に示すように、マイコン10は、要部として、CPU11、記憶部12を備えて構成されている。なお、マイコン10は、浮動小数点演算を行うFPU13を備えていてもよい。つまり、マイコン10は、浮動小数点演算を行う場合、FPU13を備えて構成される。このFPU13は、本発明の特許請求の範囲における演算部に相当する。また、FPUは、Floating Point number processing Unitの略である。
As shown in FIG. 1, the
CPU10は、本発明の特許請求の範囲における演算部に相当する。CPU11は、記憶部12に記憶されたオペレーティングシステム(以下、OS)用のプログラムや各種データを読み出して所定の演算を実行するものであり、演算結果を一時的に記憶部12に記憶しつつ演算を行うことで、各種処理を実行する。なお、CPUは、Central Processing Unitの略である。
The
本実施形態においては、OSとして、複数のタスクを並行して処理するとともに、リアルタイムにタスクスケジュールを行うリアルタイムOS(以下、RTOS)を採用している。このRTOSは、処理をリアルタイムに実行することを重視して設計されている。そのため、記憶部20や、図示しない周辺回路(A/D、タイマ、バッファなど)などのリソース管理などにおいても、時間制約を守ることが重要視される。
In the present embodiment, a real-time OS (hereinafter, RTOS) that processes a plurality of tasks in parallel and performs a task schedule in real time is employed as the OS. This RTOS is designed with emphasis on executing processing in real time. For this reason, it is important to observe time constraints in the resource management of the
複数のタスクは、予め優先度が設定されている。CPU11は、この優先度に基づいて、タスクの切り換えを行う。つまり、タスクの切り換えは、予め設定されたタスク優先度に基づいて行われ、実行可能状態なタスクのうち最も高い優先度のタスクが実行される。従って、マイコン10は、優先度が設けられた複数のタスクを並行して処理するマルチタスク方式の処理装置と称することができる。
Priorities are set in advance for a plurality of tasks. The
さらに、図5に示すように、マイコン10は、初期化中フラグ11aと更新フラグ11bを有し、この二つのフラグにおけるデータを管理する。つまり、CPU11は、後ほど説明するデータ領域12aが初期化中であることを示す初期化中情報と、データ領域12aが初期化中でないことを示す非初期化情報とのいずれかがセットされる初期化中フラグ11aを備えている。初期化中フラグ11aは、データ領域12aに対して一つ設けられている。本実施形態では、初期化中情報として1、非初期化情報として0を採用している。しかしながら、本発明はこれに限定されるものではない。このように、初期化中フラグ11aを設けることによって、CPU11は、データ領域12aが初期化中であるか否かを把握(認識)することができる。
Furthermore, as shown in FIG. 5, the
また、CPU11は、後ほど説明する初期化単位毎に設けられ、各初期化単位が初期化済みであることを示す初期化済情報と、各初期化単位が初期化済みでないことを示す未初期化情報とのいずれかがセットされる更新フラグ11bを備えている。つまり、更新フラグ11bは、初期化単位毎に一つ設けられている。言い換えると、更新フラグ11bは、各初期化単位に含まれるデータに対して一つ設けられている。
Further, the
例えば、一つのデータを初期化単位とする場合、各データに対して一つの更新フラグ11bが設けられる。また、二つのデータを初期化単位とする場合、二つのデータに対して一つの更新フラグ11bが設けられる。よって、初期化が終了した初期化単位に含まれるデータに対応する更新フラグとは、初期化が終了したデータに対応した更新フラグを示す。なお、各更新フラグ11bは、データ領域12aの各データのデータ番号に対応して設けられていると称することもできる。 For example, when one data is used as an initialization unit, one update flag 11b is provided for each data. When two data are used as initialization units, one update flag 11b is provided for the two data. Therefore, the update flag corresponding to the data included in the initialization unit that has been initialized indicates the update flag corresponding to the data that has been initialized. Each update flag 11b can also be referred to as being provided corresponding to the data number of each data in the data area 12a.
本実施形態では、初期化済情報として1、未初期化情報として0を採用している。しかしながら、本発明はこれに限定されるものではない。このように、更新フラグ11bを設けることによって、CPU11は、各初期化単位のデータが初期化済みであるか否かを把握することができる。また、一部のデータだけが初期化されていないという状態を回避できる。
In this embodiment, 1 is adopted as the initialized information and 0 is adopted as the uninitialized information. However, the present invention is not limited to this. Thus, by providing the update flag 11b, the
なお、CPU11は、例えば、記憶部12からデータを読み出す読み出し処理、記憶部12にデータを書き込む書き込み処理、記憶部12のデータ領域の初期化を行う初期化処理、割り込みを禁止する禁止処理、禁止を解除する解除処理などの処理を実行する。このCPU11の処理動作に関しては、後ほど詳しく説明する。
Note that the
記憶部12は、ROM、RAM、レジスタを備えて構成されている。この記憶部12は、例えば、ROM、RAM、レジスタを一つのアドレス空間として一括管理されている。記憶部12は、上述のように、RTOS用のプログラムや各種データや、演算処理の際のデータが記憶される。なお、ROMは、Read Only Memoryの略であり、RAMは、Random Access Memoryである。 The storage unit 12 includes a ROM, a RAM, and a register. The storage unit 12 is collectively managed with, for example, ROM, RAM, and registers as one address space. As described above, the storage unit 12 stores RTOS programs, various data, and data used in arithmetic processing. Note that ROM is an abbreviation for Read Only Memory, and RAM is Random Access Memory.
また、図5に示すように、記憶部12の一部には、複数のデータが記憶されたデータ領域12aが設けられている。言い換えると、記憶部12は、まとまったデータ領域12aが確保されている。このデータ領域12aには、データ番号1〜NまでのN個のデータが記憶されている。Nは、2以上の自然数である。なお、データ領域12aには、例えば、あるタスクで利用する纏まった複数のデータ、又は、一体で処理するべき複数のデータが記憶されている。また、データ領域12aに記憶されている複数のデータとして、データサイズが大きく、全てを初期化するのに時間がかかるデータを採用すると、本発明の効果が顕著になる。
Further, as shown in FIG. 5, a part of the storage unit 12 is provided with a data area 12a in which a plurality of data is stored. In other words, the storage unit 12 has a unified data area 12a. In this data area 12a, N pieces of data with
なお、データ領域12aに記憶されている複数のデータとしては、自動コード生成で作ったプログラムの中間データ(浮動小数点)、外部記憶装置のバッファデータ(制御用学習値)、ダイアグ検出時のフリーズフレームデータなど採用することができる。これらのデータは、データサイズが大きく、全てを初期化するのに時間がかかるという特徴がある。 The plurality of data stored in the data area 12a includes intermediate data (floating point) of a program created by automatic code generation, buffer data (control learning value) of an external storage device, and freeze frame when detecting a diagnosis. Data can be used. These data are characterized in that the data size is large and it takes time to initialize all of them.
なお、浮動小数点演算で非数が発生した場合、後続の演算結果が全て非数になるため、全データ初期化が必要である。よって、中間データを採用する場合、CPU11は、浮動小数点演算で非数の発生を検出したときに、後ほど説明する図2に示すフローチャートの処理を開始する。また、バッファデータを採用する場合、CPU11は、バッファデータの異常(上下限範囲外など)を検出した時、又はECU100の外部装置からデータをリセットする指示があったときに、後ほど説明する図2に示すフローチャートの処理を開始する。さらに、フリーズフレームデータを採用する場合、CPU11は、ECU100の外部装置からデータをクリアする指示があったときに、後ほど説明する図2に示すフローチャートの処理を開始する。
Note that when a non-number occurs in a floating-point operation, all subsequent calculation results become non-number, and all data must be initialized. Therefore, when the intermediate data is adopted, the
また、図5に示すように、記憶部12の一部(例えば、ROM)には、データ領域12aの各データの初期値が記憶された初期値テーブル12bが設けられている。つまり、初期値テーブル12bには、データ領域12aの各データの夫々に対応する複数の初期値データが記憶されている。 As shown in FIG. 5, a part of the storage unit 12 (for example, a ROM) is provided with an initial value table 12 b in which initial values of each data in the data area 12 a are stored. That is, the initial value table 12b stores a plurality of initial value data corresponding to each data in the data area 12a.
ここで、図2〜図7を用いて、マイコン10におけるCPU11の処理動作に関して説明する。CPU11は、データ領域12aに記憶されている全データの初期化を実行することを示す初期化条件が成立した場合、図2のフローチャートで示す初期化処理を実行する。なお、上述のように、データ領域12aに記憶されているデータの異常を検出した場合や、外部装置からの初期化指示を受けた場合に、初期化条件が成立したとみなすことができる。つまり、CPU11は、複数のタスクのうちの一つとして、データ領域12aに記憶されている複数のデータの初期化処理を行う。
Here, the processing operation of the
ステップS10では、更新フラグ11bの全要素に0をセットする(第1更新手段)。CPU11は、データ領域12aに記憶された全データの初期化を開始する際に、全ての更新フラグ11bに0をセットする。言い換えると、CPU11は、初期化条件が成立した場合、後ほど説明するデータ初期化ループを実行する前に、全ての更新フラグ11bに0をセットする。これは、データ領域12aに記憶されている各データが初期化済みであるか否かを把握できるようにするためである。
In step S10, 0 is set to all the elements of the update flag 11b (first update means). When starting initialization of all data stored in the data area 12a, the
ステップS20では、初期化中フラグ11aに1をセットする(第2更新手段)。CPU11は、データ領域12aに記憶された全データの初期化を開始する際に、初期化中フラグ11aに1をセットする。言い換えると、CPU11は、初期化条件が成立した場合、後ほど説明するデータ初期化ループを実行する前に、初期化中フラグ11aに1をセットする。これは、データ領域12aが初期化中であるか否かを把握できるようにするためである。よって、CPU11は、初期化中フラグ11aの値を確認することで、データ領域12aが初期化中であるか否かを把握することができる。
In step S20, 1 is set to the in-initialization flag 11a (second updating means). When starting the initialization of all data stored in the data area 12a, the
このように、CPU11は、初期化条件が成立した場合、まず、全ての更新フラグ11bに0をセットすると共に、初期化中フラグ11aに1をセットする。その後、CPU11は、ステップS30以降の処理を実行する。
As described above, when the initialization condition is satisfied, the
ステップS30からS70では、データ初期化ループを実行する。CPU11は、データ領域12aのデータのうちの少なくとも一つのデータを初期化単位として、初期化単位での初期化を繰り返し行なうことで、データ領域に記憶された全データを初期化する(データ初期化ループ手段)。つまり、CPU11は、データ領域12aの全データの初期化が完了するまで、ステップS40からステップS60の処理を繰り返し実行する。
In steps S30 to S70, a data initialization loop is executed. The
言い換えると、CPU11は、データ領域12aに記憶されたデータを複数に分割して、分割された各データ(又は、各データ群)を順番に初期化することで、データ領域12aに記憶された全てのデータを初期化する。CPU11は、データ領域12aに記憶された複数のデータを、少なくとも一つのデータを含む初期化単位に分割して、分割されたデータ毎に順番に初期化することで、データ領域12aに記憶された全てのデータを初期化すると言い換えることもできる。また、初期化単位は、CPU11が一度に初期化する単位と称することもできる。なお、ステップS30は、データ初期化ループの開始を示すループ端であり、ステップS70は、データ初期化ループの終了を示すループ端である。
In other words, the
また、本実施形態では、一例として、図5に示すように、一つのデータを初期化単位としている。つまり、本実施形態のCPU11は、各データ番号に対応するデータを初期化単位として、データ領域12aに記憶された全てのデータを初期化する。詳述すると、データ領域12aには、データ番号1からNまでの複数のデータが記憶されている。CPU11は、各データ番号のデータを初期化単位として、単位初期化処理をN回行うことで、データ領域12aに記憶された全てのデータを初期化する。
In this embodiment, as an example, as shown in FIG. 5, one data is used as an initialization unit. That is, the
しかしながら、初期化単位としては、少なくとも一つのデータが含まれていればよい。よって、二つ以上のデータを初期化単位とすることもできる。ただし、データ領域12aに記憶されている全てのデータを一つの初期化単位にすることはできない。 However, the initialization unit only needs to include at least one piece of data. Therefore, two or more data can be used as an initialization unit. However, all data stored in the data area 12a cannot be made into one initialization unit.
データ初期化ループでは、まずステップS40の処理を実行する。このステップS40では、割り込み禁止を開始する(禁止手段)。CPU11は、各初期化単位での初期化を行う際に、タスクの割り込みを禁止する。つまり、CPU11は、ステップS50での処理を実行する前に、データ領域12aに記憶されている複数のデータの初期化処理である本タスクよりも、優先度が高いタスクの割り込みを禁止する。
In the data initialization loop, first, the process of step S40 is executed. In step S40, interrupt inhibition is started (inhibiting means). The
ステップS50では、単一データ初期化処理を実行する(第1単位初期化手段)。CPU11は、ステップS40でタスクの割り込みが禁止された後に、初期化単位での初期化を行う。なお、ステップS50は、初期化単位での初期化を行う処理である。しかしながら、本実施形態では、一つのデータを初期化単位としているため、単一データ初期化処理と記載している。
In step S50, single data initialization processing is executed (first unit initialization means). The
この単一データ初期化処理に関しては、図3のフローチャートを用いて説明する。図3のステップS51では、初期化対象データの更新フラグを判定する。CPU11は、初期化対象データに対応する更新フラグ11bに0がセットされていると判定した場合、初期化が必要であるとみなしてステップS52へ進む。CPU11は、初期化対象データに対応する更新フラグ11bに1がセットされていると判定した場合、初期化の必要がないとみなして、図3のフローチャートに示す処理を終了する。なお、初期化対象データとは、データ領域12aに記憶されている複数のデータのうちの一つであり、今回の単一データ初期化処理で初期化の対象となっているデータである。
This single data initialization process will be described with reference to the flowchart of FIG. In step S51 of FIG. 3, the update flag of the initialization target data is determined. If the
このように、CPU11は、初期化対象データに対応する更新フラグ11bに1がセットされていた場合、後ほど説明するステップS52からステップS54の処理は実行しない。ステップS10で全ての更新フラグ11bに0をセットしたにもかかわらず、初期化対象データに対応する更新フラグ11bに1がセットされているのは、初期化対象データが初期化される前に更新されているためである。後ほど詳しく説明するが、CPU11は、初期化対象データを初期化する前に、他のタスクを実行して、このタスクを実行することによって、初期化対象データを更新することができる。よって、ここでは、初期値よりも、初期化する前に他のタスクを実行している間に更新された値を優先するために、ステップS52からステップS54の処理は実行しないようにする。なお、この点に関しては、後ほど図7を用いて説明する。
As described above, when 1 is set in the update flag 11b corresponding to the initialization target data, the
なお、CPU11は、ループカウンタなどを使うことによって、データ領域12aに記憶されている複数のデータの中から、今回の初期化対象である初期化対象データを把握(特定)することができる。つまり、CPU11は、ループカウンタなどを使うことによって、各単一データ初期化処理で初期化を行うデータ(又は、データ番号)を把握することができる。
Note that the
ステップS52では、初期値を読み出す。CPU11は、初期値テーブル12bから初期化対象データに対応する初期値データを読み出す。ステップS53では、初期値を書き込む。CPU11は、ステップS52で読み出した初期値データを書き込む。つまり、CPU11は、初期化対象データを、ステップS52で読み出した初期値データに書き換える(更新する)。これによって、今回の初期化対象である初期化対象データを初期化することができる。
In step S52, an initial value is read. The
ステップS54では、更新フラグ11bに1をセットする(第1更新手段)。CPU11は、単一データ初期化処理での初期化が終了した初期化対象データに対応する更新フラグ11bに1をセットする。言い換えると、CPU11は、初期化が終了したデータのデータ番号に対応する更新フラグ11bに1をセットする。また、CPU11は、単一データ初期化処理での初期化が終了した初期化単位に対応する更新フラグに1をセットするとも言い換えることができる。
In step S54, 1 is set in the update flag 11b (first update means). The
例えば、図5において、今回の単一データ初期化処理での対象が、データ番号3のデータであった場合、データ番号3のデータの初期化が終了すると、データ番号3に対応する更新フラグ11bに1をセットする。よって、図5は、データ番号1〜3のデータは初期化済みであり、データ番号4〜Nのデータは初期化済みでないことを示している。なお、図5におけるデータ領域12aには、図面を分かりやすくするために、○(マル)と×(バツ)を図示している。○は、初期化済みであることを示しており、×は、未初期化であることを示している。
For example, in FIG. 5, when the target of the current single data initialization process is data of
このように、CPU11は、上述のステップS10で全ての更新フラグ11bに0をセットすると共に、ステップS54で初期化が終了したデータに対応する更新フラグ11bに1をセットする。これによって、CPU11は、各更新フラグ11bを確認することで、各更新フラグ11bに対応するデータが初期化済みであるか否かを把握することができる。つまり、CPU11は、データ領域12aに記憶されている各データが初期化済みであるか否かを把握することができる。なお、ステップS54での処理が終了すると、図2に示すフローチャートのステップS60に戻る。
In this way, the
ステップS60では、割り込み禁止を終了する(解除手段)。CPU11は、ステップS50での単一データ初期化処理での初期化が終了した後に、ステップS40で禁止していたタスクの割り込みの禁止を解除する。なお、CPU11は、割り込み禁止状態でステップS50を実行するので、データの初期化と更新フラグ11bの操作の途中で、より優先度が高いタスクを実行して、データ領域12aにアクセスすることを抑制できる。つまり、CPU11がより優先度が高いタスクを実行することによって、データ領域12aからデータが読み出したり、データ領域12aにデータが書き込んだりするのを抑制できる。
In step S60, the interrupt prohibition is ended (cancellation means). After completing the initialization in the single data initialization process in step S50, the
このように、CPU11は、データ初期化ループの内側で、割り込み禁止状態にした後、単一データ初期化処理を呼び出し、単一データ初期化処理が終了すると、割り込み許可状態に戻す。つまり、本発明は、単一データ初期化処理を行っている間だけ、割り込み禁止状態が維持され、次のデータの初期化を行う前に割り込みが可能となる。
As described above, the
CPU11は、このように、初期化単位での初期化を繰り返し行って、データ領域12aの全データの初期化が完了すると、ステップS80での処理を実行する。ステップS80では、初期化中フラグ11aに、非初期化情報である0をセットする(第2更新手段)。
As described above, the
このように、マイコン10は、データ領域12aに記憶された複数のデータを初期化する場合、初期化単位での初期化を繰り返し行うことで、データ領域12aに記憶された全てのデータを初期化する。また、マイコン10は、データ領域12aに記憶された複数のデータを初期化する場合、タスクの割り込みを禁止する。しかしながら、マイコン10は、各初期化単位での初期化が終了した後に、割り込みの禁止を解除する。よって、本発明は、データ領域12aに記憶された複数のデータを初期化する場合、割り込みの禁止、初期化単位での初期化、割り込み禁止の解除を繰り返し行うことで、データ領域12aに記憶された全てのデータを初期化する。
Thus, when initializing a plurality of data stored in the data area 12a, the
つまり、マイコン10は、データ領域12aに記憶された全てのデータを初期化している間、ずっと割り込みを禁止するものではない。このように、マイコン10は、各初期化単位での初期化が終わるたびに、割り込みの禁止を解除するので、長時間割り込み禁止が継続することを防止でき、リアルタイム応答性の低下を抑制できる。
In other words, the
ここで、このマイコン10の効果に関して、比較例のマイコンと比較しつつ説明する。比較例のマイコンは、CPU、記憶部などを備えて構成されており、以下比較例マイコンと称する。また、比較例マイコンは、データ領域12aと同様のデータ領域を備えている。そして、比較例マイコンのCPUは、マイコン10と同様に、データ領域に記憶されている全データの初期化を実行することを示す初期化条件が成立した場合、図8のフローチャートで示す初期化処理を実行する。
Here, the effect of the
ステップS300では、割り込み禁止を開始する。比較例マイコンのCPUは、各初期化単位での初期化を行う前に、タスクの割り込みを禁止する。 In step S300, interrupt inhibition is started. The CPU of the comparative example microcomputer prohibits task interruption before initialization in each initialization unit.
ステップS310からS330では、データ初期化ループを実行する。比較例マイコンのCPUは、データ領域のデータのうちの少なくとも一つのデータを初期化単位として、初期化単位での初期化を繰り返し行なうことで、データ領域に記憶された全データを初期化する。つまり、比較例マイコンのCPUは、データ領域の全データの初期化が終了するまで、ステップS310からS330の処理を実行する。 In steps S310 to S330, a data initialization loop is executed. The CPU of the comparative example microcomputer initializes all data stored in the data area by repeatedly performing initialization in the initialization unit using at least one of the data in the data area as an initialization unit. That is, the CPU of the comparative example microcomputer executes steps S310 to S330 until the initialization of all data in the data area is completed.
そして、ステップS340では、割り込み禁止を終了する。比較例マイコンのCPUは、データ領域の全データの初期化が終了した後に、初めてステップS300で禁止していたタスクの割り込みの禁止を解除する。 In step S340, the interrupt prohibition ends. The CPU of the comparative example microcomputer cancels the prohibition of the task interrupt that has been prohibited in step S300 for the first time after the initialization of all the data in the data area is completed.
よって、比較例マイコンは、図9に示すように、タイミングt1からタイミングt2の間で、データ領域に記憶されている複数のデータを初期化する場合、タイミングt1からタイミングt2の全期間でタスクの割り込みを禁止する。 Therefore, as shown in FIG. 9, the comparative example microcomputer initializes a plurality of data stored in the data area between the timing t1 and the timing t2, during the entire period from the timing t1 to the timing t2. Disable interrupts.
これに対して、マイコン10は、図4に示すように、タイミングt1からタイミングt2の間で、データ領域12aに記憶された複数のデータを初期化する場合、各初期化単位の初期化が終了するたびに割り込み禁止を解除する。よって、マイコン10は、タイミングt1からタイミングt2の間であっても、タスクの割り込みが可能となる。このように、マイコン10は、比較例マイコンに比べて、長時間割り込み禁止が継続することを防止でき、リアルタイム応答性の低下を抑制できる。つまり、マイコン10は、初期化中の割り込み禁止期間を全データではなく、各初期化単位に含まれるデータの初期化中に限定することにより、リアルタイム応答性の低下を抑制できる。
On the other hand, as shown in FIG. 4, when the
よって、例えば、初期化対象のデータとして中間データを採用した場合、この中間データを初期化している途中でも通常通りの演算が可能となる。また、初期化対象のデータとしてバッファデータを採用した場合、このバッファデータを初期化している途中でも通常通りの制御が可能となる。また、初期化対象のデータとしてフリーズフレームデータを採用した場合、このフリーズフレームデータを初期化している途中でもデータ領域12aへの書き込みが可能となる。 Therefore, for example, when intermediate data is adopted as data to be initialized, normal calculation can be performed even while the intermediate data is being initialized. In addition, when buffer data is adopted as the data to be initialized, normal control can be performed even while the buffer data is being initialized. In addition, when freeze frame data is employed as the data to be initialized, writing to the data area 12a is possible even while the freeze frame data is being initialized.
また、上述のように、比較例のマイコンの場合、初期化すべきデータの量に比例して割り込み禁止時間が長くなり、リアルタイム応答性が低下するという問題がある。さらに、このマイコンは、例えば、車両のエンジンを電子的に制御する電子制御装置(以下、エンジンECU)に適用することも考えられる。エンジンECUは、エンジン回転センサのパルス発生数がエンジン回転30°あたり1個である場合、エンジンが毎分6000回転のときは1/(6000/60)/(360/30)=830[μs]毎にパルス入力処理を行う必要がある。しかしながら、比較例のマイコンは、初期化以外の処理が動作しないよう割り込み禁止にしてしまう。よって、比較例のマイコンでは、初期化に数百μsかかるような量のデータを初期化する場合、パルス入力処理が間に合わず、ひいてはエンジン制御が誤動作する可能性がある。 Further, as described above, in the case of the microcomputer of the comparative example, there is a problem that the interrupt prohibition time becomes longer in proportion to the amount of data to be initialized and the real-time response is lowered. Furthermore, this microcomputer may be applied to, for example, an electronic control device (hereinafter referred to as an engine ECU) that electronically controls a vehicle engine. When the number of pulses generated by the engine rotation sensor is one per 30 ° of engine rotation, the engine ECU is 1 / (6000/60) / (360/30) = 830 [μs] when the engine is 6000 revolutions per minute. It is necessary to perform pulse input processing every time. However, the microcomputer of the comparative example prohibits interrupts so that processing other than initialization does not operate. Therefore, in the microcomputer of the comparative example, when initializing the amount of data that takes several hundreds μs for initialization, the pulse input processing may not be in time, and engine control may malfunction.
これに対して、マイコン10は、データ領域12aに記憶された複数のデータを初期化する場合であっても、各初期化単位の初期化が終了するたびに割り込み禁止を解除する。よって、マイコン10では、エンジンECUに適用して、初期化に数百μsかかるような量のデータを初期化する場合であっても、パルス入力処理が間に合わず、エンジン制御が誤動作することを抑制できる。
On the other hand, even when the
また、従来技術ではないが、初期化が実行中かどうかを示す状態変数を設け、CPUは、記憶部にアクセスする前(データアクセスの前)にその状態変数を確認し、初期化中の場合はデータ領域への読み書きを行わずに延期するという方法も考えられる。しかしこの方法では、初期化実行中は必要なデータの読み書きができないため、通常の制御の実行ができなくなるという制約が生じる。 Although not a prior art, a state variable indicating whether initialization is in progress is provided, and the CPU confirms the state variable before accessing the storage unit (before data access), and the initialization is in progress. It is also possible to postpone without reading / writing data areas. However, this method has a restriction that normal control cannot be executed because necessary data cannot be read and written during the initialization.
例えば、ガソリンエンジン制御装置では、燃料噴射量や点火タイミングを補正するための学習値が外部記憶装置のバッファの役割を持つデータ領域に格納されている場合がある。データ領域初期化中に、学習値を読み出せないからといって点火装置や噴燃料射装置の制御を延期すると、エンジンが停止してしまう。 For example, in a gasoline engine control device, a learning value for correcting the fuel injection amount and the ignition timing may be stored in a data area serving as a buffer of an external storage device. If the control of the ignition device or the fuel injection device is postponed just because the learning value cannot be read during the data area initialization, the engine stops.
また、一般的に、マイコンは、自身が搭載されている制御装置内部のデータを、通信手段を通じて制御装置の外部装置に定期的に送信する場合がある。定期的に送信するデータの一例としては、エンジン制御装置における、エンジン冷却水温や空燃比補正用学習値などをあげることができる。この送信すべきデータが初期化中のデータ領域に記憶されていた場合、初期化が終わるまでデータの送信を止めることになる。よって、このデータを定期的に受信する外部装置は、タイムアウトとみなして、通信異常と判定する可能性がある。 In general, the microcomputer may periodically transmit data inside the control device on which the microcomputer is mounted to an external device of the control device through communication means. As an example of data to be transmitted periodically, the engine coolant temperature, the learning value for air-fuel ratio correction, and the like in the engine control device can be given. If the data to be transmitted is stored in the data area being initialized, data transmission is stopped until the initialization is completed. Therefore, an external device that periodically receives this data may consider it as a timeout and determine a communication error.
これに対して、マイコン10は、データ領域12aに記憶されている複数のデータを初期化する場合であっても、各初期化単位の初期化が終了するたびに割り込み禁止を解除する。つまり、マイコン10は、データ領域12aに記憶されている複数のデータを初期化する場合であっても、データ領域12aへのデータの書き込み、データ領域12aからのデータの読み込みが行える。
On the other hand, even when the
よって、マイコン10は、上述のような燃料噴射量や点火タイミングを補正するための学習値であるデータや、送信すべきデータなどがデータ領域12aに記憶されていた場合であっても、上述のような不具合が発生することを抑制できる。つまり、マイコン10は、データ領域12aに記憶されている学習値であるデータを初期化する場合であっても、初期化対象である全データの初期化が終わるまで点火装置や噴燃料射装置の制御を延期する必要がなく、エンジンが停止してしまうことを抑制できる。また、マイコン10は、データ領域12aに記憶されている送信すべきデータを初期化する場合であっても、初期化対象である全データの初期化が終わるまでデータの送信を止める必要がなく、外部装置から通信異常と判定されることを抑制できる。このように、マイコン10は、初期化実行中に必要なデータの読み書きができなくなったり、通常の制御の実行ができなくなるという不具合を抑制できる。
Therefore, even if the data which is the learning value for correcting the fuel injection amount and the ignition timing as described above, the data to be transmitted, and the like are stored in the data area 12a, the
上述のように、CPU11は、タスクの割り込みの禁止を解除している間、初期化処理のタスクよりも優先度が高いタスクの割り込みを行ない、このタスクの処理を行うことによってデータ領域12aからデータを読み出すことが可能である。また、CPU11は、タスクの割り込みの禁止を解除している間、初期化処理のタスクよりも優先度が高いタスクの割り込みを行ない、このタスクの処理を行うことによってデータ領域12aへのデータの書き込みが可能である。
As described above, the
ここで、このように、初期化中にタスクの割り込みを行った場合の処理に関して説明する。まず、図6を用いて、CPU11の読み出し処理に関して説明する。図6は、読み出し要求処理のフローチャートである。CPU11は、データの読み出し要求があると、図6のフローチャートで示す処理を実行する。この読み出し要求とは、データ領域12aからデータを読み出すことを示す要求である。
Here, processing in the case where a task interrupt is performed during initialization will be described. First, the reading process of the
ステップS110では、初期化中フラグ11aを判定する。CPU11は、初期化中フラグ11aに0がセットされているか、1がセットされているかを判定する。これは、データ領域12aが初期化中であるか否か、すなわち、ステップS10以降の処理が実行されている途中であるか否かを判定するためである。そして、CPU11は、初期化中フラグ11aに0がセットされていると判定した場合、データ領域12aは初期化中でないとみなしてステップS160に進む。一方、CPU11は、初期化中フラグ11aに1がセットされていると判定した場合、データ領域12aは初期化中であるとみなしてステップS120に進む。
In step S110, the in-initialization flag 11a is determined. The
ステップS120では、読み出し対象データの更新フラグを判定する。CPU11は、読み出し対象データに対応する更新フラグ11bに0がセットされていた場合、データ領域12aは初期化中であるが、まだ、読み出し対象データは初期化されていないとみなしてステップS130へ進む。一方、CPU11は、読み出し対象データに対応する更新フラグ11bに1がセットされていた場合、データ領域12aは初期化中であり、既に、読み出し対象データは初期化されているとみなしてステップS160に進む。なお、読み出し対象データは、本発明の特許請求の範囲における対象データに相当する。本実施形態では、読み出し対象データとして、データ領域12aに記憶されている複数のデータのうちの一つのデータを採用する。
In step S120, the update flag of the read target data is determined. If the update flag 11b corresponding to the read target data is set to 0, the
なお、ステップS130からS150での処理は、上述のステップS40からS60での処理と同様である。つまり、ステップS130〜S150では、CPU11は、割り込み禁止を開始してから、単一データ(ここでは、読み出し対象データ)の初期化を行い、その後、割り込み禁止を終了する。そして、ステップS160では、値を読み出す。このとき、CPU11は、データ領域12aから読み出し対象データを読み出す。
Note that the processing in steps S130 to S150 is the same as the processing in steps S40 to S60 described above. That is, in steps S130 to S150, the
つまり、CPU11は、データ領域12aの初期化中にタスクの割り込みを行い、読み出し対象データを読み出す際に、タスクの割り込みを禁止する(第2禁止手段)。そして、CPU11は、タスクの割り込みが禁止されている間に、読み出し対象データの初期化を行う(第2単位初期化手段)。そして、CPU11は、読み出し対象データの初期化が終了した後に、第2禁止手段にて禁止していたタスクの割り込みの禁止を解除する(第2解除手段)。さらに、CPU11は、タスクの割り込みの禁止を解除すると、読み出し対象データを読み出す(読み出し手段)。これによって、割り込み処理中に読み出し対象データを読み出す際に、より優先度が高いタスクの割り込みを禁止でき、データ領域12aを保護することができる。
That is, the
このように、CPU11は、初期化中フラグ11aに1がセットされており、且つ読み出し対象データに対応する更新フラグ11bに0がセットされていた場合、読み出し対象データの初期化を行う(第2単位初期化手段)。このとき、CPU11は、読み出し対象データが含まれる初期化単位の初期化を行う。そして、CPU11は、初期化がなされた後の読み出し対象データを読み出す(読み出し手段)。
In this way, when the initialization flag 11a is set to 1 and the update flag 11b corresponding to the read target data is set to 0, the
例えば、図5に示す例において、データ番号2のデータが読み出し対象データであった場合、CPU11は、データ番号2のデータは既に初期化済みであるため、このデータを読み出す。一方、データ番号Nのデータが読み出し対象データであった場合、CPU11は、データ番号Nのデータは未初期化であるため、このデータを初期化してから読み出す。なお、CPU11は、ステップS120とステップS160の処理を実行した後、又はステップS120からS160の処理を実行した後、図2のステップS30に戻ることになる。
For example, in the example shown in FIG. 5, when the data with the
このように、CPU11は、高優先度のタスクを実行することによって、初期化中のデータ領域12aからデータを読み出す際に、読み出し対象データが未初期化であると、読み出し対象データを初期化してから読み出すようにする。初期化中フラグ11aに1がセットされているということは(ステップS110で1と判定した場合)、データ領域12aに記憶されているデータの初期化が必要ということを示している。よって、上述のように、初期化がなされた後の読み出し対象データを読み出すことで、初期化の必要があるデータを、初期化せずに読み出すことを抑制できる。
As described above, the
これに対して、データ領域12aが初期化中でない場合、及び、読み出し対象データが既に初期化されていた場合は、読み出し対象データを再度初期化する必要がない。よって、CPU11は、ステップS110で0がセットされていると判定した場合、ステップS120〜S150の処理を行うことなく、ステップS160を行い、読み出し対象データを読み出す。また、CPU11は、ステップS120で1がセットされていると判定した場合、ステップS130〜S150の処理を行うことなく、ステップS160へ進んで読み出し対象データを読み出す。
On the other hand, when the data area 12a is not being initialized and when the read target data has already been initialized, it is not necessary to reinitialize the read target data. Therefore, when the
次に、図7を用いて、CPU11の書き込み処理に関して説明する。図7は、書き込み要求処理のフローチャートである。CPU11は、データの書き込み要求があると、図7のフローチャートで示す処理を実行する。この書き込み要求とは、データ領域12aにおける所定のデータ番号のデータを、別のデータで書き換えることを示す要求である。言い換えると、データ領域12aにおける所定のデータ番号のデータを、別のデータで更新することを示す要求である。なお、データ領域12aに対して書き込むデータを書き込みデータとも称する。また、本実施形態では、書き込みデータとして一つのデータを採用する。
Next, the writing process of the
ステップS210では、初期化中フラグ11aを判定する。CPU11は、初期化中フラグ11aに0がセットされているか、1がセットされているかを判定する。これは、データ領域12aが初期化中であるか否か、すなわち、ステップS10以降の処理が実行されている途中であるか否かを判定するためである。そして、CPU11は、初期化中フラグ11aに0がセットされていると判定した場合、データ領域12aは初期化中でないとみなしてステップS220に進む。一方、CPU11は、初期化中フラグ11aに1がセットされていると判定した場合、データ領域12aは初期化中であるとみなしてステップS230に進む。
In step S210, the in-initialization flag 11a is determined. The
ステップS220では、値を更新する。言い換えると、所定のデータ番号のデータを、書き込みデータに書き換える。つまり、CPU11は、データ領域12aが初期化中でないため、特別な処理はせずに、データ領域12aに書き込みデータを書き込む。
In step S220, the value is updated. In other words, data with a predetermined data number is rewritten to write data. That is, since the data area 12a is not being initialized, the
一方、ステップS230では、割り込み禁止を開始する(第3禁止手段)。このように、CPU11は、データ領域12aの初期化中にタスクの割り込みを行い、このタスクを実行することによってデータを書き込む際、まず、タスクの割り込みを禁止する。
On the other hand, in step S230, interrupt inhibition is started (third inhibition means). In this way, the
ステップS240では、書き込みデータの正しさをチェックする(チェック手段)。つまり、CPU11は、データ領域12aにデータを書き込む際に、初期化中フラグに1がセットされていた場合、書き込みデータの正しさをチェックする。これは、正しくないデータをデータ領域12aに書き込むことを抑制するためである。また、CPU11は、ステップS230で割り込みを禁止している間に、データの正しさチェックを行う。そして、CPU11は、データが正しいと判定した場合はステップS250へ進み、データが正しくないと判定した場合はステップS260へ進む。なお、この正しさチェックに関しては、後ほど説明する。
In step S240, the correctness of the write data is checked (check means). That is, when writing data to the data area 12a, the
ステップS250では、値を更新する(書き込み手段)。CPU11は、書き込みデータが正しいと判断した場合は、正しいと判断された書き込みデータをデータ領域12aに書き込む。これによって、正しいデータをデータ領域12aに書き込むことができる。なお、CPU11は、ステップS230で割り込みを禁止している間に、書き込みデータを書き込む。
In step S250, the value is updated (writing means). When the
なお、ステップS250では、複数のデータを初期化単位とする場合、初期化単位における一部のデータのみを更新することもありうる。つまり、初期化単位における一部のデータのみを、正しいと判断された書き込みデータに書き換えることもありうる。このような場合、初期化単位に含まれる複数のデータのうち、書き込みデータで更新されるデータ以外のデータは、初期値に書き換えると好ましい。言い換えると、初期化単位に含まれる複数のデータにおいて、書き込みデータに対応するデータ以外のデータは、初期値に書き換えると好ましい。 In step S250, when a plurality of data is used as an initialization unit, only a part of the data in the initialization unit may be updated. That is, only a part of the data in the initialization unit may be rewritten with the write data determined to be correct. In such a case, it is preferable that data other than the data updated by the write data among the plurality of data included in the initialization unit is rewritten to the initial value. In other words, in a plurality of data included in the initialization unit, data other than data corresponding to the write data is preferably rewritten to the initial value.
ステップS260では、単一データの初期化を行う(書き込み手段)。CPU11は、書き込みデータが正しくないと判断した場合は、データ領域12aに正しくないデータが書き込まれることを抑制するために、データ領域12aにおける、書き込みデータに対応するデータを初期化する。このとき、CPU11は、書き込みデータに対応するデータを含む初期化単位での初期化を行う。これによって、書き込もうとしているデータが正しくない場合であっても、正しくないデータが書き込まれることを抑制することができる。なお、CPU11は、ステップS230で割り込みを禁止している間に、データの初期化を行う。
In step S260, single data is initialized (writing means). When the
このステップS260での処理は、上述のステップS50と同様である。ただし、ステップS50では、ループカウンタなどで特定された初期化対象データを含む初期化単位での初期化を行うのに対して、ステップS260では、書き込みデータに対応するデータを含む初期化単位での初期化を行う。 The processing in step S260 is the same as that in step S50 described above. However, in step S50, initialization is performed in an initialization unit including initialization target data specified by a loop counter or the like, whereas in step S260, initialization in an initialization unit including data corresponding to write data is performed. Perform initialization.
ステップS270では、更新フラグ11bに1をセットする。CPU11は、初期化中であるデータ領域12aにおいて、まだ初期化されてないデータが、更新されたことを記録するために、更新フラグ11bに1をセットする。
In step S270, 1 is set to the update flag 11b. The
ステップS280では、割り込み禁止を終了する(第3解除手段)。CPU11は、ステップS260での初期化、又はステップS250での書き込みが終了した後に、ステップS230で禁止していたタスクの割り込みの禁止を解除する。
In step S280, the interrupt prohibition is ended (third canceling means). After completing the initialization in step S260 or the writing in step S250, the
なお、CPU11は、ステップS280の処理を実行した後、図2のステップS30に戻ることになる。また、CPU11は、ステップS280を実行した後に、図2のフローチャートに戻った場合、ステップS260で初期化したデータ、又はステップS250で書き込んだデータを初期化対象データとすることもありうる。このような場合、CPU11は、上述のステップS51の判定で、更新フラグ11bに1がセットされていると判定することになる。よって、CPU11は、上述のように、ステップS51で更新フラグ11bに1がセットされていると判定した場合はステップS52からS54の処理は実行せずに、ステップS260で初期化したデータ、又はステップS250で書き込んだデータを優先する。
The
例えば、図5に示す例において、データ番号Nのデータが書き込み対象のデータであった場合、CPU11は、データ番号Nのデータを初期化するか、又は、書き込みデータに更新する。そして、CPU11は、更新フラグ11bに1をセットする。
For example, in the example illustrated in FIG. 5, when the data with the data number N is the data to be written, the
このように、マイコン10は、データ領域12aの初期化中にデータを書き込む場合、まず、割り込み禁止の状態にしてから、ステップS260での初期化、又はステップS250での書き込みを行う。これによって、ステップS260での初期化、又はステップS250での書き込みを行う際に、より優先度が高いタスクの割り込みを禁止でき、データ領域12aを保護することができる。
As described above, when writing data during initialization of the data area 12a, the
なお、ステップS230での正しさチェック方法はいくつか考えられる。ここで、正しさチェック方法の一例を説明する。 Several correctness checking methods in step S230 are conceivable. Here, an example of the correctness check method will be described.
まず、マイコン10がFPU13を備えており、データ領域12aに複数のデータとして浮動小数点数が記憶されている場合に関して説明する。この場合、FPU13は、書き込みデータが非数の場合に正しくないと判断し、書き込みデータが非数でない場合に正しいと判断する(チェック手段)。
First, the case where the
別の方法としては、CPU11は、書き込みデータが所定の範囲内でない場合に正しくないと判断し、書き込みデータが所定の範囲内である場合に正しいと判断する(チェック手段)。このようにしても、書き込みデータが正しいか否かを判断することができる。
As another method, the
なお、本実施形態においては、データ領域12aを初期化する際に、初期値テーブル12bに記憶された初期値データで初期化する例を採用した。しかしながら、本発明はこれに限定されるものではない。データ領域12aにおける全てのデータの初期値が同じデータ(例えば、0などの固定初期値)の場合、この固定初期値で初期化するようにしてもよい。このように、固定初期値で初期化することによって、初期値テーブル12bを設ける必要がない。よって、初期化に要する処理時間を低減できると共に、初期値テーブル12bの分だけ記憶部12の使用量を削減することができる。 In the present embodiment, when the data area 12a is initialized, an example of initializing with the initial value data stored in the initial value table 12b is employed. However, the present invention is not limited to this. When the initial values of all the data in the data area 12a are the same data (for example, a fixed initial value such as 0), initialization may be performed with this fixed initial value. Thus, it is not necessary to provide the initial value table 12b by initializing with the fixed initial value. Therefore, the processing time required for initialization can be reduced, and the amount of use of the storage unit 12 can be reduced by the amount of the initial value table 12b.
以上、本発明の好ましい実施形態について説明した。しかしながら、本発明は、上述した実施形態に何ら制限されることはなく、本発明の趣旨を逸脱しない範囲において、種々の変形が可能である。 The preferred embodiments of the present invention have been described above. However, the present invention is not limited to the embodiments described above, and various modifications can be made without departing from the spirit of the present invention.
10 マイコン、11 CPU、11a 初期化中フラグ、11b 更新フラグ、12 記憶部、12a データ領域、12b 初期値テーブル、13 FPU、20 出力IF、30 入力IF、100 ECU、200 センサ、300 制御対象 10 microcomputer, 11 CPU, 11a initialization flag, 11b update flag, 12 storage unit, 12a data area, 12b initial value table, 13 FPU, 20 output IF, 30 input IF, 100 ECU, 200 sensor, 300
Claims (6)
前記記憶部は、複数のデータが記憶されたデータ領域を備え、
前記演算部は、複数の前記タスクのうちの一つとして、複数の前記データの少なくとも一つを初期化単位とした初期化を繰り返し行うことで、前記データ領域に記憶された全データを初期化するものであり、
各初期化単位での初期化を行う際に、前記タスクの割り込みを禁止する禁止手段(S40)と、
前記禁止手段にて前記タスクの割り込みが禁止された後に、前記初期化単位での初期化を行う第1単位初期化手段(S50)と、
前記第1単位初期化手段による各初期化単位での初期化が終了した後に、前記禁止手段にて禁止していた前記タスクの割り込みの禁止を解除する解除手段(S60)と、を備えることを特徴とする処理装置。 A multi-task processing device (10) that includes a calculation unit (11) and a storage unit (12), and processes a plurality of tasks provided with priority in parallel.
The storage unit includes a data area in which a plurality of data is stored,
The calculation unit initializes all data stored in the data area by repeatedly performing initialization using at least one of the plurality of data as an initialization unit as one of the plurality of tasks. Is what
Prohibiting means (S40) for prohibiting interruption of the task when performing initialization in each initialization unit;
First unit initialization means (S50) for performing initialization in the initialization unit after interruption of the task is prohibited by the prohibition means;
Release means (S60) for canceling the prohibition of the interrupt of the task that has been prohibited by the prohibition means after the initialization in each initialization unit by the first unit initialization means has been completed. Characteristic processing device.
初期化単位毎に設けられ、各初期化単位に含まれる前記データが初期化済みであることを示す初期化済情報と、各初期化単位に含まれる前記データが初期化済みでないことを示す未初期化情報とのいずれかがセットされる更新フラグ(11b)と、を備え、
前記演算部は、
前記データ領域に記憶された全データの初期化を開始する際に、全ての前記更新フラグに未初期化情報をセットすると共に、前記第1単位初期化手段による初期化が終了した前記初期化単位に含まれる前記データに対応する前記更新フラグに初期化済情報をセットする第1更新手段(S10,S54)と、
前記データ領域に記憶された全データの初期化を開始する際に、前記初期化中フラグに初期化中情報をセットすると共に、全データの初期化が終了すると前記初期化中フラグに非初期化情報をセットする第2更新手段(S20,S80)と、
を備えることを特徴とする請求項1に記載の処理装置。 An initializing flag (11a) in which one of initialization information indicating that the data area is being initialized and non-initialization information indicating that the data area is not being initialized is set;
Provided for each initialization unit, initialized information indicating that the data included in each initialization unit has been initialized, and not indicating that the data included in each initialization unit has not been initialized. An update flag (11b) in which any of the initialization information is set,
The computing unit is
When the initialization of all data stored in the data area is started, uninitialized information is set in all the update flags, and the initialization unit in which the initialization by the first unit initialization unit is completed First update means (S10, S54) for setting initialized information in the update flag corresponding to the data included in
When the initialization of all data stored in the data area is started, the in-initialization information is set in the in-initialization flag, and when the initialization of all the data is completed, the in-initialization flag is not initialized. Second update means (S20, S80) for setting information;
The processing apparatus according to claim 1, further comprising:
前記解除手段によって前記タスクの割り込みの禁止が解除されている間、前記初期化処理の前記タスクよりも優先度が高い前記タスクの割り込みを行ない、該タスクの処理を行うことによって前記データ領域から前記データの読み出しが可能であり、
前記データ領域から読み出し対象である対象データを読み出す際に、初期化中情報がセットされており、且つ前記対象データに対応する前記更新フラグに未初期化情報がセットされていた場合、前記対象データが含まれる初期化単位の初期化を行う第2単位初期化手段(S140)と、
前記第2単位初期化手段にて初期化がなされた後の前記対象データを読み出す読み出し手段(S160)と、
を備えることを特徴とする請求項2に記載の処理装置。 The computing unit is
While the prohibition of the interrupt of the task is canceled by the canceling means, the task having a higher priority than the task of the initialization process is interrupted, and the task is processed from the data area. Data can be read
When reading target data to be read from the data area, information during initialization is set, and uninitialized information is set in the update flag corresponding to the target data, the target data Second unit initialization means (S140) for initializing an initialization unit including
Reading means (S160) for reading out the target data after being initialized by the second unit initialization means;
The processing apparatus according to claim 2, further comprising:
前記解除手段によって前記タスクの割り込みの禁止が解除されている間、前記初期化処理の前記タスクよりも優先度が高い前記タスクの割り込みを行ない、該タスクの処理を行うことによって前記データ領域へのデータの書き込みが可能であり、
前記データ領域にデータを書き込む際に、初期化中情報がセットされていた場合、書き込むデータの正しさをチェックするチェック手段(S240)と、
前記チェック手段にて書き込むデータが正しくないと判断された場合は、該データに対応する前記データ領域中の前記データが含まれる初期化単位の初期化を行い、前記チェック手段にて書き込むデータが正しいと判断された場合は、該データを前記データ領域に書き込む書き込み手段(S250,S260)と、
を備えることを特徴とする請求項2又は3に記載の処理装置。 The computing unit is
While the prohibition of the interrupt of the task is canceled by the canceling means, the task having a higher priority than the task of the initialization process is interrupted, and the task is processed to the data area. Data can be written,
Checking means (S240) for checking the correctness of the data to be written if the information being initialized is set when the data is written to the data area;
When it is determined that the data written by the check means is not correct, the initialization unit including the data in the data area corresponding to the data is initialized, and the data written by the check means is correct If it is determined, the writing means (S250, S260) for writing the data to the data area,
The processing apparatus according to claim 2, further comprising:
前記チェック手段は、書き込むデータが非数の場合に正しくないと判断し、書き込むデータが非数でない場合に正しいと判断することを特徴とする請求項4に記載の処理装置。 In the data area, a floating point number is stored as the data,
5. The processing apparatus according to claim 4, wherein the check unit determines that the data to be written is not correct when the data to be written is non-numeric, and determines that the data to be written is correct when the data to be written is not a non-number.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2013057095A JP5942904B2 (en) | 2013-03-19 | 2013-03-19 | Processing equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2013057095A JP5942904B2 (en) | 2013-03-19 | 2013-03-19 | Processing equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2014182633A JP2014182633A (en) | 2014-09-29 |
JP5942904B2 true JP5942904B2 (en) | 2016-06-29 |
Family
ID=51701279
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2013057095A Active JP5942904B2 (en) | 2013-03-19 | 2013-03-19 | Processing equipment |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP5942904B2 (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2021029320A (en) * | 2019-08-19 | 2021-03-01 | 株式会社ユニバーサルエンターテインメント | Game machine |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPS63170758A (en) * | 1987-01-09 | 1988-07-14 | Toshiba Corp | Main storage initial write processing system |
JP2000293391A (en) * | 1999-04-07 | 2000-10-20 | Mitsubishi Electric Corp | Method and device for large-scale memory system management |
US8307198B2 (en) * | 2009-11-24 | 2012-11-06 | Advanced Micro Devices, Inc. | Distributed multi-core memory initialization |
-
2013
- 2013-03-19 JP JP2013057095A patent/JP5942904B2/en active Active
Also Published As
Publication number | Publication date |
---|---|
JP2014182633A (en) | 2014-09-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108351840B (en) | Vehicle control device | |
US20150134083A1 (en) | Controller and process monitoring method | |
JP2002278779A (en) | Processing performing device and program | |
JP5962697B2 (en) | Electronic control unit | |
JP5533789B2 (en) | In-vehicle electronic control unit | |
JP6723941B2 (en) | Control device and control program updating method | |
JP5942904B2 (en) | Processing equipment | |
JP2011008702A (en) | Fault processor | |
KR20160045699A (en) | Handling time intensive instructions | |
JP6512087B2 (en) | Vehicle control device | |
US20180068501A1 (en) | Multiprocessor system and vehicle control system | |
JP6838234B2 (en) | Vehicle control device | |
JP6183251B2 (en) | Electronic control unit | |
JP2019036322A (en) | Vehicle controller | |
JP5434942B2 (en) | Control device | |
JP6138308B1 (en) | In-vehicle control device and ROM for in-vehicle control device | |
US9710313B2 (en) | Method and system for ensuring integrity of critical data | |
JP7476638B2 (en) | Multiprocessor Systems | |
JP2017204083A (en) | Memory protection system | |
CN108073489B (en) | Method for ensuring operation of calculator | |
CN109358903B (en) | Data access device and access error notification method | |
CN107710162B (en) | Electronic control device and stack using method | |
JP2011100416A (en) | In-vehicle electronic controller and memory control method | |
JP6466269B2 (en) | Electronic control device and stack area usage monitoring method | |
JP7259666B2 (en) | In-vehicle control device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20150520 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20160418 |
|
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: 20160426 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20160509 |
|
R151 | Written notification of patent or utility model registration |
Ref document number: 5942904 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R151 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
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 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |