JP5942904B2 - Processing equipment - Google Patents

Processing equipment Download PDF

Info

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
Application number
JP2013057095A
Other languages
Japanese (ja)
Other versions
JP2014182633A (en
Inventor
政昭 玉腰
政昭 玉腰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Denso Corp
Original Assignee
Denso 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 Denso Corp filed Critical Denso Corp
Priority to JP2013057095A priority Critical patent/JP5942904B2/en
Publication of JP2014182633A publication Critical patent/JP2014182633A/en
Application granted granted Critical
Publication of JP5942904B2 publication Critical patent/JP5942904B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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 Patent Document 1, it is conceivable that input to the external interrupt terminal is prohibited after the CPU is reset until the initial value setting to the RAM is completed. In other words, while the entire data area is being initialized, it is conceivable to prohibit interruption of other tasks.

特開昭60−116862号公報JP-A-60-116862

上述のように、他のタスクの割り込みを禁止することで、他のタスクが実行されて、初期化途中のデータ領域が参照されないようにすることができる。しかしながら、データ領域の全体を初期化している間は、他のタスクの割り込みが禁止されるので、初期化すべきデータの量に比例して割り込み禁止時間が長くなり、リアルタイム応答性が低下するという問題がある。   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.

実施形態におけるECUの概略構成を示すブロック図である。It is a block diagram which shows schematic structure of ECU in embodiment. 実施形態におけるCPUの初期化処理を示すフローチャートである。It is a flowchart which shows the initialization process of CPU in embodiment. 実施形態におけるCPUの単位初期化処理を示すフローチャートである。It is a flowchart which shows the unit initialization process of CPU in embodiment. 実施形態における割り込み禁止と解除を示すイメージ図である。It is an image figure which shows interruption prohibition and cancellation | release in embodiment. 実施形態におけるデータ構造を示すイメージ図である。It is an image figure which shows the data structure in embodiment. 実施形態におけるCPUの読み出し処理を示すフローチャートである。It is a flowchart which shows the read-out process of CPU in embodiment. 実施形態におけるCPUの書き込み処理を示すフローチャートである。It is a flowchart which shows the write-in process of CPU in embodiment. 比較例におけるCPUの初期化処理を示フローチャートである。It is a flowchart which shows the initialization process of CPU in a comparative example. 比較例における割り込み禁止と解除を示す概念図である。It is a conceptual diagram which shows interruption prohibition and cancellation | release in a comparative example.

以下、本発明の実施形態を図に基づいて説明する。本実施形態は、本発明である処理装置を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 microcomputer 10 provided in the ECU 100. Note that ECU is an abbreviation for Electronic Control Unit.

図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 microcomputer 10, an output IF 20, and an input IF 30 as main parts. The ECU 100 is electrically connected to external devices such as the sensor 200 and the controlled object 300. The ECU 100 can acquire a detection signal from the sensor 200 via the input IF 30. Further, the ECU 100 can output a control signal to the controlled object 300 via the output IF 20. ECU 100 may acquire a signal from an ECU other than ECU 100 instead of sensor 200. Further, the control object 300 may employ an actuator such as a motor, an ECU other than the ECU 100, or the like.

この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 microcomputer 10 includes a CPU 11 and a storage unit 12 as main parts. Note that the microcomputer 10 may include an FPU 13 that performs floating-point arithmetic. That is, the microcomputer 10 is configured to include the FPU 13 when performing floating point arithmetic. The FPU 13 corresponds to a calculation unit in the claims of the present invention. FPU is an abbreviation for Floating Point number processing Unit.

CPU10は、本発明の特許請求の範囲における演算部に相当する。CPU11は、記憶部12に記憶されたオペレーティングシステム(以下、OS)用のプログラムや各種データを読み出して所定の演算を実行するものであり、演算結果を一時的に記憶部12に記憶しつつ演算を行うことで、各種処理を実行する。なお、CPUは、Central Processing Unitの略である。   The CPU 10 corresponds to the calculation unit in the claims of the present invention. The CPU 11 reads out an operating system (hereinafter referred to as OS) program and various data stored in the storage unit 12 and executes predetermined calculations. The CPU 11 performs calculation while temporarily storing the calculation results in the storage unit 12. By performing the above, various processes are executed. CPU is an abbreviation for Central Processing Unit.

本実施形態においては、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 storage unit 20 and peripheral circuits (A / D, timer, buffer, etc.) not shown.

複数のタスクは、予め優先度が設定されている。CPU11は、この優先度に基づいて、タスクの切り換えを行う。つまり、タスクの切り換えは、予め設定されたタスク優先度に基づいて行われ、実行可能状態なタスクのうち最も高い優先度のタスクが実行される。従って、マイコン10は、優先度が設けられた複数のタスクを並行して処理するマルチタスク方式の処理装置と称することができる。   Priorities are set in advance for a plurality of tasks. The CPU 11 switches tasks based on this priority. In other words, task switching is performed based on a preset task priority, and the task with the highest priority among the tasks in the executable state is executed. Therefore, the microcomputer 10 can be referred to as a multi-task processing device that processes a plurality of tasks with priorities in parallel.

さらに、図5に示すように、マイコン10は、初期化中フラグ11aと更新フラグ11bを有し、この二つのフラグにおけるデータを管理する。つまり、CPU11は、後ほど説明するデータ領域12aが初期化中であることを示す初期化中情報と、データ領域12aが初期化中でないことを示す非初期化情報とのいずれかがセットされる初期化中フラグ11aを備えている。初期化中フラグ11aは、データ領域12aに対して一つ設けられている。本実施形態では、初期化中情報として1、非初期化情報として0を採用している。しかしながら、本発明はこれに限定されるものではない。このように、初期化中フラグ11aを設けることによって、CPU11は、データ領域12aが初期化中であるか否かを把握(認識)することができる。   Furthermore, as shown in FIG. 5, the microcomputer 10 has an initialization flag 11a and an update flag 11b, and manages data in these two flags. In other words, the CPU 11 is an initial stage in which one of initialization information indicating that the data area 12a described later is being initialized and non-initialization information indicating that the data area 12a is not being initialized is set. An in-process flag 11a is provided. One initialization flag 11a is provided for the data area 12a. In the present embodiment, 1 is used as the in-initialization information and 0 is used as the non-initialization information. However, the present invention is not limited to this. Thus, by providing the initialization flag 11a, the CPU 11 can grasp (recognize) whether or not the data area 12a is being initialized.

また、CPU11は、後ほど説明する初期化単位毎に設けられ、各初期化単位が初期化済みであることを示す初期化済情報と、各初期化単位が初期化済みでないことを示す未初期化情報とのいずれかがセットされる更新フラグ11bを備えている。つまり、更新フラグ11bは、初期化単位毎に一つ設けられている。言い換えると、更新フラグ11bは、各初期化単位に含まれるデータに対して一つ設けられている。   Further, the CPU 11 is provided for each initialization unit to be described later, initialized information indicating that each initialization unit has been initialized, and uninitialized indicating that each initialization unit has not been initialized. An update flag 11b in which any of the information is set is provided. That is, one update flag 11b is provided for each initialization unit. In other words, one update flag 11b is provided for data included in each initialization unit.

例えば、一つのデータを初期化単位とする場合、各データに対して一つの更新フラグ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 CPU 11 can grasp whether or not the data of each initialization unit has been initialized. Further, it is possible to avoid a state in which only some data is not initialized.

なお、CPU11は、例えば、記憶部12からデータを読み出す読み出し処理、記憶部12にデータを書き込む書き込み処理、記憶部12のデータ領域の初期化を行う初期化処理、割り込みを禁止する禁止処理、禁止を解除する解除処理などの処理を実行する。このCPU11の処理動作に関しては、後ほど詳しく説明する。   Note that the CPU 11, for example, a read process for reading data from the storage unit 12, a write process for writing data to the storage unit 12, an initialization process for initializing the data area of the storage unit 12, a prohibition process for prohibiting interruption, Execute processing such as release processing to release. The processing operation of the CPU 11 will be described in detail later.

記憶部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 data numbers 1 to N are stored. N is a natural number of 2 or more. In the data area 12a, for example, a plurality of collected data used in a certain task or a plurality of data to be processed in an integrated manner is stored. In addition, when data having a large data size and taking time to initialize all of the data stored in the data area 12a is employed, the effect of the present invention becomes remarkable.

なお、データ領域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 CPU 11 starts the processing of the flowchart shown in FIG. 2 described later when the occurrence of a non-number is detected in the floating point calculation. Further, when the buffer data is adopted, the CPU 11 will be described later when detecting an abnormality of the buffer data (outside the upper / lower limit range) or when there is an instruction to reset the data from an external device of the ECU 100. The process of the flowchart shown in FIG. Further, when freeze frame data is employed, the CPU 11 starts the processing of the flowchart shown in FIG. 2 to be described later when there is an instruction to clear the data from an external device of the ECU 100.

また、図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 CPU 11 in the microcomputer 10 will be described with reference to FIGS. When the initialization condition indicating that the initialization of all data stored in the data area 12a is executed is established, the CPU 11 executes the initialization process shown in the flowchart of FIG. As described above, the initialization condition can be considered to be satisfied when an abnormality of data stored in the data area 12a is detected or when an initialization instruction is received from an external device. That is, the CPU 11 performs initialization processing of a plurality of data stored in the data area 12a as one of the plurality of tasks.

ステップ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 CPU 11 sets all update flags 11b to 0. In other words, when the initialization condition is satisfied, the CPU 11 sets all update flags 11b to 0 before executing a data initialization loop described later. This is to make it possible to grasp whether or not each data stored in the data area 12a has been initialized.

ステップ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 CPU 11 sets 1 to the in-initialization flag 11a. In other words, when the initialization condition is satisfied, the CPU 11 sets the initialization flag 11a to 1 before executing a data initialization loop described later. This is to make it possible to grasp whether or not the data area 12a is being initialized. Therefore, the CPU 11 can grasp whether or not the data area 12a is being initialized by checking the value of the initialization flag 11a.

このように、CPU11は、初期化条件が成立した場合、まず、全ての更新フラグ11bに0をセットすると共に、初期化中フラグ11aに1をセットする。その後、CPU11は、ステップS30以降の処理を実行する。   As described above, when the initialization condition is satisfied, the CPU 11 first sets 0 to all the update flags 11b and sets 1 to the in-initialization flag 11a. Thereafter, the CPU 11 executes the processing after step S30.

ステップS30からS70では、データ初期化ループを実行する。CPU11は、データ領域12aのデータのうちの少なくとも一つのデータを初期化単位として、初期化単位での初期化を繰り返し行なうことで、データ領域に記憶された全データを初期化する(データ初期化ループ手段)。つまり、CPU11は、データ領域12aの全データの初期化が完了するまで、ステップS40からステップS60の処理を繰り返し実行する。   In steps S30 to S70, a data initialization loop is executed. The CPU 11 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 12a as an initialization unit (data initialization). Loop means). That is, the CPU 11 repeatedly executes the processing from step S40 to step S60 until the initialization of all data in the data area 12a is completed.

言い換えると、CPU11は、データ領域12aに記憶されたデータを複数に分割して、分割された各データ(又は、各データ群)を順番に初期化することで、データ領域12aに記憶された全てのデータを初期化する。CPU11は、データ領域12aに記憶された複数のデータを、少なくとも一つのデータを含む初期化単位に分割して、分割されたデータ毎に順番に初期化することで、データ領域12aに記憶された全てのデータを初期化すると言い換えることもできる。また、初期化単位は、CPU11が一度に初期化する単位と称することもできる。なお、ステップS30は、データ初期化ループの開始を示すループ端であり、ステップS70は、データ初期化ループの終了を示すループ端である。   In other words, the CPU 11 divides the data stored in the data area 12a into a plurality of pieces, and initializes each divided data (or each data group) in order, so that all the data stored in the data area 12a is stored. Initialize the data. The CPU 11 divides a plurality of data stored in the data area 12a into initialization units including at least one data, and sequentially initializes each divided data to store the data in the data area 12a. In other words, all data is initialized. The initialization unit can also be referred to as a unit that the CPU 11 initializes at a time. Step S30 is a loop end indicating the start of the data initialization loop, and step S70 is a loop end indicating the end of the data initialization loop.

また、本実施形態では、一例として、図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 CPU 11 of the present embodiment initializes all data stored in the data area 12a with the data corresponding to each data number as an initialization unit. More specifically, the data area 12a stores a plurality of data with data numbers 1 to N. The CPU 11 initializes all data stored in the data area 12a by performing unit initialization processing N times with the data of each data number as an initialization unit.

しかしながら、初期化単位としては、少なくとも一つのデータが含まれていればよい。よって、二つ以上のデータを初期化単位とすることもできる。ただし、データ領域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 CPU 11 prohibits task interruption when performing initialization in each initialization unit. In other words, before executing the processing in step S50, the CPU 11 prohibits interruption of a task having a higher priority than this task, which is an initialization process for a plurality of data stored in the data area 12a.

ステップS50では、単一データ初期化処理を実行する(第1単位初期化手段)。CPU11は、ステップS40でタスクの割り込みが禁止された後に、初期化単位での初期化を行う。なお、ステップS50は、初期化単位での初期化を行う処理である。しかしながら、本実施形態では、一つのデータを初期化単位としているため、単一データ初期化処理と記載している。   In step S50, single data initialization processing is executed (first unit initialization means). The CPU 11 performs initialization in units of initialization after task interruption is prohibited in step S40. Step S50 is a process for performing initialization in units of initialization. However, in this embodiment, since one data is used as an initialization unit, it is described as a single data initialization process.

この単一データ初期化処理に関しては、図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 CPU 11 determines that 0 is set in the update flag 11b corresponding to the initialization target data, the CPU 11 regards that initialization is necessary and proceeds to step S52. If the CPU 11 determines that 1 is set in the update flag 11b corresponding to the initialization target data, the CPU 11 regards that there is no need for initialization and ends the processing shown in the flowchart of FIG. Note that the initialization target data is one of a plurality of data stored in the data area 12a, and is data to be initialized in the current single data initialization process.

このように、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 CPU 11 does not execute the processing from step S52 to step S54 described later. Even though all update flags 11b are set to 0 in step S10, the update flag 11b corresponding to the initialization target data is set to 1 because it is updated before the initialization target data is initialized. It is because it has been. As will be described in detail later, the CPU 11 can update the initialization target data by executing another task before initializing the initialization target data. Therefore, in this case, in order to give priority to the value updated while executing other tasks before the initialization, the processing from step S52 to step S54 is not executed. This point will be described later with reference to FIG.

なお、CPU11は、ループカウンタなどを使うことによって、データ領域12aに記憶されている複数のデータの中から、今回の初期化対象である初期化対象データを把握(特定)することができる。つまり、CPU11は、ループカウンタなどを使うことによって、各単一データ初期化処理で初期化を行うデータ(又は、データ番号)を把握することができる。   Note that the CPU 11 can grasp (specify) the initialization target data that is the current initialization target from among a plurality of data stored in the data area 12a by using a loop counter or the like. That is, the CPU 11 can grasp the data (or data number) to be initialized in each single data initialization process by using a loop counter or the like.

ステップS52では、初期値を読み出す。CPU11は、初期値テーブル12bから初期化対象データに対応する初期値データを読み出す。ステップS53では、初期値を書き込む。CPU11は、ステップS52で読み出した初期値データを書き込む。つまり、CPU11は、初期化対象データを、ステップS52で読み出した初期値データに書き換える(更新する)。これによって、今回の初期化対象である初期化対象データを初期化することができる。   In step S52, an initial value is read. The CPU 11 reads initial value data corresponding to the initialization target data from the initial value table 12b. In step S53, the initial value is written. The CPU 11 writes the initial value data read in step S52. That is, the CPU 11 rewrites (updates) the initialization target data to the initial value data read in step S52. As a result, the initialization target data that is the current initialization target can be initialized.

ステップ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 CPU 11 sets 1 to the update flag 11b corresponding to the initialization target data that has been initialized in the single data initialization process. In other words, the CPU 11 sets 1 to the update flag 11b corresponding to the data number of the data that has been initialized. In other words, the CPU 11 can also be described as setting 1 to the update flag corresponding to the initialization unit that has been initialized in the single data initialization process.

例えば、図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 data number 3, when the initialization of data of data number 3 is completed, the update flag 11b corresponding to data number 3 Set 1 to. Therefore, FIG. 5 shows that data numbers 1 to 3 have been initialized, and data numbers 4 to N have not been initialized. In the data area 12a in FIG. 5, ○ (maru) and x (cross) are shown for easy understanding of the drawing. ○ indicates that initialization has been completed, and x indicates that initialization has not been performed.

このように、CPU11は、上述のステップS10で全ての更新フラグ11bに0をセットすると共に、ステップS54で初期化が終了したデータに対応する更新フラグ11bに1をセットする。これによって、CPU11は、各更新フラグ11bを確認することで、各更新フラグ11bに対応するデータが初期化済みであるか否かを把握することができる。つまり、CPU11は、データ領域12aに記憶されている各データが初期化済みであるか否かを把握することができる。なお、ステップS54での処理が終了すると、図2に示すフローチャートのステップS60に戻る。   In this way, the CPU 11 sets 0 to all the update flags 11b in the above-described step S10, and sets 1 to the update flag 11b corresponding to the data that has been initialized in step S54. Thereby, the CPU 11 can grasp whether or not the data corresponding to each update flag 11b has been initialized by checking each update flag 11b. That is, the CPU 11 can grasp whether or not each data stored in the data area 12a has been initialized. When the process in step S54 is completed, the process returns to step S60 in the flowchart shown in FIG.

ステップ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 CPU 11 cancels the prohibition of the task interrupt that was prohibited in step S40. Since the CPU 11 executes step S50 in the interrupt disabled state, the CPU 11 is prevented from accessing the data area 12a by executing a task having a higher priority during the data initialization and update flag 11b operations. it can. That is, when the CPU 11 executes a task having a higher priority, it is possible to prevent data from being read from or written to the data area 12a.

このように、CPU11は、データ初期化ループの内側で、割り込み禁止状態にした後、単一データ初期化処理を呼び出し、単一データ初期化処理が終了すると、割り込み許可状態に戻す。つまり、本発明は、単一データ初期化処理を行っている間だけ、割り込み禁止状態が維持され、次のデータの初期化を行う前に割り込みが可能となる。   As described above, the CPU 11 calls the single data initialization process after setting the interrupt disabled state inside the data initialization loop, and returns to the interrupt enabled state when the single data initialization process is completed. In other words, according to the present invention, the interrupt disabled state is maintained only during the single data initialization process, and an interrupt is possible before the next data is initialized.

CPU11は、このように、初期化単位での初期化を繰り返し行って、データ領域12aの全データの初期化が完了すると、ステップS80での処理を実行する。ステップS80では、初期化中フラグ11aに、非初期化情報である0をセットする(第2更新手段)。   As described above, the CPU 11 repeatedly performs initialization in units of initialization, and when the initialization of all data in the data area 12a is completed, executes the processing in step S80. In step S80, 0 which is non-initialization information is set in the in-initialization flag 11a (second updating means).

このように、マイコン10は、データ領域12aに記憶された複数のデータを初期化する場合、初期化単位での初期化を繰り返し行うことで、データ領域12aに記憶された全てのデータを初期化する。また、マイコン10は、データ領域12aに記憶された複数のデータを初期化する場合、タスクの割り込みを禁止する。しかしながら、マイコン10は、各初期化単位での初期化が終了した後に、割り込みの禁止を解除する。よって、本発明は、データ領域12aに記憶された複数のデータを初期化する場合、割り込みの禁止、初期化単位での初期化、割り込み禁止の解除を繰り返し行うことで、データ領域12aに記憶された全てのデータを初期化する。   Thus, when initializing a plurality of data stored in the data area 12a, the microcomputer 10 initializes all data stored in the data area 12a by repeatedly performing initialization in units of initialization. To do. In addition, when initializing a plurality of data stored in the data area 12a, the microcomputer 10 prohibits task interruption. However, the microcomputer 10 cancels the prohibition of the interrupt after the initialization in each initialization unit is completed. Therefore, according to the present invention, when a plurality of data stored in the data area 12a is initialized, the interrupt is prohibited, the initialization in the initialization unit, and the interrupt prohibition are repeatedly performed, so that the data is stored in the data area 12a. Initialize all data.

つまり、マイコン10は、データ領域12aに記憶された全てのデータを初期化している間、ずっと割り込みを禁止するものではない。このように、マイコン10は、各初期化単位での初期化が終わるたびに、割り込みの禁止を解除するので、長時間割り込み禁止が継続することを防止でき、リアルタイム応答性の低下を抑制できる。   In other words, the microcomputer 10 does not prohibit interruption during the initialization of all the data stored in the data area 12a. As described above, the microcomputer 10 cancels the prohibition of the interrupt every time the initialization in each initialization unit is completed, so that the prohibition of the interrupt can be prevented from continuing for a long time and the deterioration of the real-time response can be suppressed.

ここで、このマイコン10の効果に関して、比較例のマイコンと比較しつつ説明する。比較例のマイコンは、CPU、記憶部などを備えて構成されており、以下比較例マイコンと称する。また、比較例マイコンは、データ領域12aと同様のデータ領域を備えている。そして、比較例マイコンのCPUは、マイコン10と同様に、データ領域に記憶されている全データの初期化を実行することを示す初期化条件が成立した場合、図8のフローチャートで示す初期化処理を実行する。   Here, the effect of the microcomputer 10 will be described in comparison with the microcomputer of the comparative example. The microcomputer of the comparative example includes a CPU, a storage unit, and the like, and is hereinafter referred to as a comparative example microcomputer. The comparative microcomputer has a data area similar to the data area 12a. When the initialization condition indicating that the CPU of the comparative example microcomputer executes the initialization of all the data stored in the data area is established as in the microcomputer 10, the initialization process shown in the flowchart of FIG. Execute.

ステップ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 microcomputer 10 initializes a plurality of data stored in the data area 12a between timing t1 and timing t2, initialization of each initialization unit is completed. Cancel the interrupt disable every time. Therefore, the microcomputer 10 can interrupt the task even between the timing t1 and the timing t2. As described above, the microcomputer 10 can prevent the interruption of interruption for a long time from continuing as compared with the comparative example microcomputer, and can suppress a decrease in real-time response. In other words, the microcomputer 10 can suppress a reduction in real-time responsiveness by limiting the interrupt prohibition period during initialization to initialization of data included in each initialization unit instead of all data.

よって、例えば、初期化対象のデータとして中間データを採用した場合、この中間データを初期化している途中でも通常通りの演算が可能となる。また、初期化対象のデータとしてバッファデータを採用した場合、このバッファデータを初期化している途中でも通常通りの制御が可能となる。また、初期化対象のデータとしてフリーズフレームデータを採用した場合、このフリーズフレームデータを初期化している途中でもデータ領域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 microcomputer 10 initializes a plurality of data stored in the data area 12a, the microcomputer 10 cancels the prohibition of interrupt every time initialization of each initialization unit is completed. Therefore, the microcomputer 10 is applied to the engine ECU, and even when the amount of data that takes several hundreds of μs to be initialized is initialized, the pulse input processing is not in time and the engine control is prevented from malfunctioning. it can.

また、従来技術ではないが、初期化が実行中かどうかを示す状態変数を設け、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 microcomputer 10 initializes a plurality of data stored in the data area 12a, the microcomputer 10 cancels the interrupt inhibition every time the initialization of each initialization unit is completed. That is, the microcomputer 10 can write data into the data area 12a and read data from the data area 12a even when initializing a plurality of data stored in the data area 12a.

よって、マイコン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 microcomputer 10 is configured as described above. It is possible to suppress the occurrence of such problems. That is, even when the microcomputer 10 initializes the data that is the learning value stored in the data area 12a, until the initialization of all the data to be initialized is completed, the microcomputer 10 It is not necessary to postpone the control, and the engine can be prevented from stopping. Further, even when the microcomputer 10 initializes the data to be transmitted stored in the data area 12a, it is not necessary to stop the data transmission until the initialization of all the data to be initialized is completed. It can suppress that it is determined as a communication abnormality from an external device. As described above, the microcomputer 10 can suppress the problem that it becomes impossible to read and write necessary data during the execution of the initialization, and the normal control cannot be executed.

上述のように、CPU11は、タスクの割り込みの禁止を解除している間、初期化処理のタスクよりも優先度が高いタスクの割り込みを行ない、このタスクの処理を行うことによってデータ領域12aからデータを読み出すことが可能である。また、CPU11は、タスクの割り込みの禁止を解除している間、初期化処理のタスクよりも優先度が高いタスクの割り込みを行ない、このタスクの処理を行うことによってデータ領域12aへのデータの書き込みが可能である。   As described above, the CPU 11 interrupts a task having a higher priority than the task of the initialization process while canceling the prohibition of the task interrupt, and performs data processing from the data area 12a by performing the processing of this task. Can be read out. In addition, while canceling the prohibition of task interruption, the CPU 11 interrupts a task having a higher priority than the task of the initialization process, and writes data to the data area 12a by performing this task processing. Is possible.

ここで、このように、初期化中にタスクの割り込みを行った場合の処理に関して説明する。まず、図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 CPU 11 will be described with reference to FIG. FIG. 6 is a flowchart of the read request process. When there is a data read request, the CPU 11 executes the processing shown in the flowchart of FIG. This read request is a request indicating reading data from the data area 12a.

ステップ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 CPU 11 determines whether 0 is set in the initialization flag 11a or 1 is set. This is to determine whether or not the data area 12a is being initialized, that is, whether or not the processing from step S10 is being executed. If the CPU 11 determines that 0 is set in the in-initialization flag 11a, the CPU 11 considers that the data area 12a is not being initialized, and proceeds to step S160. On the other hand, if the CPU 11 determines that 1 is set in the initialization flag 11a, the CPU 11 regards the data area 12a as being initialized and proceeds to step S120.

ステップ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 CPU 11 assumes that the data area 12a is being initialized, but has not yet initialized the read target data, and proceeds to step S130. . On the other hand, if 1 is set in the update flag 11b corresponding to the read target data, the CPU 11 assumes that the data area 12a is being initialized and that the read target data has already been initialized, and the process proceeds to step S160. move on. The read target data corresponds to the target data in the claims of the present invention. In the present embodiment, one data among a plurality of data stored in the data area 12a is adopted as the read target data.

なお、ステップ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 CPU 11 initializes single data (in this case, data to be read) after starting prohibition of interrupt, and thereafter ends interrupt prohibition. In step S160, the value is read out. At this time, the CPU 11 reads the read target data from the data area 12a.

つまり、CPU11は、データ領域12aの初期化中にタスクの割り込みを行い、読み出し対象データを読み出す際に、タスクの割り込みを禁止する(第2禁止手段)。そして、CPU11は、タスクの割り込みが禁止されている間に、読み出し対象データの初期化を行う(第2単位初期化手段)。そして、CPU11は、読み出し対象データの初期化が終了した後に、第2禁止手段にて禁止していたタスクの割り込みの禁止を解除する(第2解除手段)。さらに、CPU11は、タスクの割り込みの禁止を解除すると、読み出し対象データを読み出す(読み出し手段)。これによって、割り込み処理中に読み出し対象データを読み出す際に、より優先度が高いタスクの割り込みを禁止でき、データ領域12aを保護することができる。   That is, the CPU 11 interrupts the task during initialization of the data area 12a, and prohibits the task interrupt when reading the data to be read (second prohibiting means). Then, the CPU 11 initializes the data to be read while the task interrupt is prohibited (second unit initialization unit). Then, after the initialization of the read target data is completed, the CPU 11 cancels the prohibition of the task interrupt that has been prohibited by the second prohibiting unit (second canceling unit). Further, when the prohibition of task interruption is canceled, the CPU 11 reads data to be read (reading means). As a result, when the data to be read is read during the interrupt processing, it is possible to prohibit interruption of a task having a higher priority and to protect the data area 12a.

このように、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 CPU 11 initializes the read target data (second). Unit initialization means). At this time, the CPU 11 initializes the initialization unit including the read target data. Then, the CPU 11 reads the data to be read after the initialization (reading means).

例えば、図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 data number 2 is the data to be read, the CPU 11 reads out this data because the data with the data number 2 has already been initialized. On the other hand, when the data with the data number N is the read target data, the CPU 11 reads the data number N after initializing it because the data with the data number N has not been initialized yet. Note that the CPU 11 returns to step S30 in FIG. 2 after executing the processing of steps S120 and S160, or after executing the processing of steps S120 to S160.

このように、CPU11は、高優先度のタスクを実行することによって、初期化中のデータ領域12aからデータを読み出す際に、読み出し対象データが未初期化であると、読み出し対象データを初期化してから読み出すようにする。初期化中フラグ11aに1がセットされているということは(ステップS110で1と判定した場合)、データ領域12aに記憶されているデータの初期化が必要ということを示している。よって、上述のように、初期化がなされた後の読み出し対象データを読み出すことで、初期化の必要があるデータを、初期化せずに読み出すことを抑制できる。   As described above, the CPU 11 initializes the read target data if the read target data is uninitialized when the data is read from the data area 12a being initialized by executing the high priority task. Read from. The fact that 1 is being set in the in-initialization flag 11a (when it is determined to be 1 in step S110) indicates that the data stored in the data area 12a needs to be initialized. Therefore, as described above, by reading the read target data after being initialized, it is possible to suppress reading of data that needs to be initialized without being initialized.

これに対して、データ領域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 CPU 11 determines that 0 is set in step S110, the CPU 11 performs step S160 without performing the processes of steps S120 to S150, and reads the read target data. If the CPU 11 determines that 1 is set in step S120, the CPU 11 proceeds to step S160 and reads the read target data without performing the processes in steps S130 to S150.

次に、図7を用いて、CPU11の書き込み処理に関して説明する。図7は、書き込み要求処理のフローチャートである。CPU11は、データの書き込み要求があると、図7のフローチャートで示す処理を実行する。この書き込み要求とは、データ領域12aにおける所定のデータ番号のデータを、別のデータで書き換えることを示す要求である。言い換えると、データ領域12aにおける所定のデータ番号のデータを、別のデータで更新することを示す要求である。なお、データ領域12aに対して書き込むデータを書き込みデータとも称する。また、本実施形態では、書き込みデータとして一つのデータを採用する。   Next, the writing process of the CPU 11 will be described with reference to FIG. FIG. 7 is a flowchart of the write request process. When there is a data write request, the CPU 11 executes the process shown in the flowchart of FIG. The write request is a request indicating that data of a predetermined data number in the data area 12a is rewritten with another data. In other words, it is a request indicating that data of a predetermined data number in the data area 12a is updated with other data. Note that data to be written to the data area 12a is also referred to as write data. In the present embodiment, one data is adopted as the write data.

ステップ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 CPU 11 determines whether 0 is set in the initialization flag 11a or 1 is set. This is to determine whether or not the data area 12a is being initialized, that is, whether or not the processing from step S10 is being executed. If the CPU 11 determines that 0 is set in the initialization flag 11a, the CPU 11 considers that the data area 12a is not being initialized and proceeds to step S220. On the other hand, if the CPU 11 determines that 1 is set in the initialization flag 11a, the CPU 11 considers that the data area 12a is being initialized and proceeds to step S230.

ステップ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 CPU 11 writes the write data to the data area 12a without performing any special processing.

一方、ステップS230では、割り込み禁止を開始する(第3禁止手段)。このように、CPU11は、データ領域12aの初期化中にタスクの割り込みを行い、このタスクを実行することによってデータを書き込む際、まず、タスクの割り込みを禁止する。   On the other hand, in step S230, interrupt inhibition is started (third inhibition means). In this way, the CPU 11 interrupts a task during the initialization of the data area 12a, and when writing data by executing this task, first, the task interrupt is prohibited.

ステップ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 CPU 11 checks the correctness of the write data when the initialization flag is set to 1. This is to prevent incorrect data from being written to the data area 12a. Further, the CPU 11 checks the correctness of the data while prohibiting the interruption in step S230. If the CPU 11 determines that the data is correct, the process proceeds to step S250. If the CPU 11 determines that the data is not correct, the process proceeds to step S260. This correctness check will be described later.

ステップS250では、値を更新する(書き込み手段)。CPU11は、書き込みデータが正しいと判断した場合は、正しいと判断された書き込みデータをデータ領域12aに書き込む。これによって、正しいデータをデータ領域12aに書き込むことができる。なお、CPU11は、ステップS230で割り込みを禁止している間に、書き込みデータを書き込む。   In step S250, the value is updated (writing means). When the CPU 11 determines that the write data is correct, the CPU 11 writes the write data determined to be correct to the data area 12a. Thereby, correct data can be written in the data area 12a. Note that the CPU 11 writes the write data while interrupts are prohibited in step S230.

なお、ステップ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 CPU 11 determines that the write data is not correct, the CPU 11 initializes data corresponding to the write data in the data area 12a in order to prevent incorrect data from being written to the data area 12a. At this time, the CPU 11 performs initialization in an initialization unit including data corresponding to the write data. As a result, even when the data to be written is not correct, it is possible to prevent incorrect data from being written. Note that the CPU 11 initializes data while interrupts are prohibited in step S230.

このステップ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 CPU 11 sets 1 in the update flag 11b in order to record that the data that has not yet been initialized has been updated in the data area 12a being initialized.

ステップ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 CPU 11 cancels the prohibition of the task interrupt prohibited in step S230.

なお、CPU11は、ステップS280の処理を実行した後、図2のステップS30に戻ることになる。また、CPU11は、ステップS280を実行した後に、図2のフローチャートに戻った場合、ステップS260で初期化したデータ、又はステップS250で書き込んだデータを初期化対象データとすることもありうる。このような場合、CPU11は、上述のステップS51の判定で、更新フラグ11bに1がセットされていると判定することになる。よって、CPU11は、上述のように、ステップS51で更新フラグ11bに1がセットされていると判定した場合はステップS52からS54の処理は実行せずに、ステップS260で初期化したデータ、又はステップS250で書き込んだデータを優先する。   The CPU 11 returns to step S30 in FIG. 2 after executing the process of step S280. Further, when the CPU 11 returns to the flowchart of FIG. 2 after executing step S280, the data initialized in step S260 or the data written in step S250 may be set as the initialization target data. In such a case, the CPU 11 determines that 1 is set in the update flag 11b in the determination in step S51 described above. Therefore, as described above, when the CPU 11 determines that 1 is set in the update flag 11b in step S51, the CPU 11 does not execute the processing of steps S52 to S54, but the data initialized in step S260 or the step The data written in S250 is prioritized.

例えば、図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 CPU 11 initializes the data with the data number N or updates it to the write data. Then, the CPU 11 sets 1 to the update flag 11b.

このように、マイコン10は、データ領域12aの初期化中にデータを書き込む場合、まず、割り込み禁止の状態にしてから、ステップS260での初期化、又はステップS250での書き込みを行う。これによって、ステップS260での初期化、又はステップS250での書き込みを行う際に、より優先度が高いタスクの割り込みを禁止でき、データ領域12aを保護することができる。   As described above, when writing data during initialization of the data area 12a, the microcomputer 10 first sets the interrupt disabled state, and then performs initialization in step S260 or writing in step S250. As a result, when initialization is performed in step S260 or writing is performed in step S250, interruption of a task with a higher priority can be prohibited, and the data area 12a can be protected.

なお、ステップ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 microcomputer 10 includes the FPU 13 and a floating point number is stored as a plurality of data in the data area 12a will be described. In this case, the FPU 13 determines that the write data is not correct when the write data is non-numeric, and determines that the write data is correct when the write data is not non-number (check means).

別の方法としては、CPU11は、書き込みデータが所定の範囲内でない場合に正しくないと判断し、書き込みデータが所定の範囲内である場合に正しいと判断する(チェック手段)。このようにしても、書き込みデータが正しいか否かを判断することができる。   As another method, the CPU 11 determines that the write data is not correct when the write data is not within the predetermined range, and determines that the write data is correct when the write data is within the predetermined range (check unit). Even in this way, it is possible to determine whether or not the write data is correct.

なお、本実施形態においては、データ領域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)

演算部(11)と記憶部(12)とを備え、優先度が設けられる複数のタスクを並行して処理するマルチタスク方式の処理装置(10)であって、
前記記憶部は、複数のデータが記憶されたデータ領域を備え、
前記演算部は、複数の前記タスクのうちの一つとして、複数の前記データの少なくとも一つを初期化単位とした初期化を繰り返し行うことで、前記データ領域に記憶された全データを初期化するものであり、
各初期化単位での初期化を行う際に、前記タスクの割り込みを禁止する禁止手段(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.
前記データ領域が初期化中であることを示す初期化中情報と、前記データ領域が初期化中でないことを示す非初期化情報とのいずれかがセットされる初期化中フラグ(11a)と、
初期化単位毎に設けられ、各初期化単位に含まれる前記データが初期化済みであることを示す初期化済情報と、各初期化単位に含まれる前記データが初期化済みでないことを示す未初期化情報とのいずれかがセットされる更新フラグ(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.
前記チェック手段は、書き込むデータが所定の範囲内でない場合に正しくないと判断し、書き込むデータが所定の範囲内である場合に正しいと判断することを特徴とする請求項4に記載の処理装置。   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 not within a predetermined range, and determines that the data to be written is correct when the data to be written is within the predetermined range.
JP2013057095A 2013-03-19 2013-03-19 Processing equipment Active JP5942904B2 (en)

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)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2021029320A (en) * 2019-08-19 2021-03-01 株式会社ユニバーサルエンターテインメント Game machine

Family Cites Families (3)

* Cited by examiner, † Cited by third party
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

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
JP5533789B2 (en) In-vehicle electronic control unit
JP6723941B2 (en) Control device and control program updating method
CN108885570B (en) Vehicle control device
JP5962697B2 (en) Electronic control unit
JP5942904B2 (en) Processing equipment
JP2011008702A (en) Fault processor
KR20160045699A (en) Handling time intensive instructions
US10269194B2 (en) Multiprocessor system and vehicle control system
JP6512087B2 (en) Vehicle control device
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
JP2017204083A (en) Memory protection system
CN108073489B (en) Method for ensuring operation of calculator
CN109358903B (en) Data access device and access error notification method
WO2017002939A1 (en) Electronic control device and stack usage method
US9710313B2 (en) Method and system for ensuring integrity of critical data
JP6466269B2 (en) Electronic control device and stack area usage monitoring method
JP7322734B2 (en) Control device
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