JP2020149428A - Electronic controller - Google Patents

Electronic controller Download PDF

Info

Publication number
JP2020149428A
JP2020149428A JP2019047054A JP2019047054A JP2020149428A JP 2020149428 A JP2020149428 A JP 2020149428A JP 2019047054 A JP2019047054 A JP 2019047054A JP 2019047054 A JP2019047054 A JP 2019047054A JP 2020149428 A JP2020149428 A JP 2020149428A
Authority
JP
Japan
Prior art keywords
status
unit
rewrite target
reading
target area
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2019047054A
Other languages
Japanese (ja)
Inventor
嗣豊 大▲崎▼
Tsugutoyo Osaki
嗣豊 大▲崎▼
央 鎌倉
Hiroshi Kamakura
央 鎌倉
享平 嶌田
Kyohei Shimada
享平 嶌田
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 JP2019047054A priority Critical patent/JP2020149428A/en
Publication of JP2020149428A publication Critical patent/JP2020149428A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Detection And Correction Of Errors (AREA)

Abstract

To provide an electronic controller which can prevent predetermined processing from being interrupted even if data stored in a rewrite target region has become unstable.SOLUTION: The electronic controller determines whether data stored in a rewrite target region is unstable when the data is read in the step S107. If in the step S107 the electronic controller determines that the data stored in the rewrite target region is unstable, in the step S131, the electronic controller determines whether reading of the status in the S105 has been executed. If in the step S131 the electronic controller determines that reading of the status in the S105 has been executed, first processing in the step 109 and steps after the step S109 is executed.SELECTED DRAWING: Figure 2

Description

本開示は、電子制御装置に関する。 The present disclosure relates to an electronic control unit.

下記特許文献1に開示された電子制御装置(以下、ECUと略称する。)は、電気的にデータの消去及び書き込みが可能なフラッシュメモリを備える。フラッシュメモリには、制御対象を制御するためのソフトウェアが格納される。下記特許文献1に開示されたフラッシュメモリは、データを消去した場合に、消去後のデータが「不定」になる。 The electronic control unit (hereinafter, abbreviated as ECU) disclosed in Patent Document 1 below includes a flash memory capable of electrically erasing and writing data. Software for controlling the control target is stored in the flash memory. In the flash memory disclosed in Patent Document 1 below, when the data is erased, the erased data becomes "indefinite".

ECUには、フラッシュメモリ内に格納されたソフトウェアを書き換える機能を備えたソフトウェア(以下、リプログソフトと称する。)があらかじめ搭載されている。ECUと通信可能な外部装置を車両に接続し、外部装置から車載LAN経由でリプログソフトへデータを送信すると、リプログソフトは、そのデータをフラッシュメモリ内の書き換え対象領域に書き込む。これにより、書き換え対象領域内のソフトウェアを書き換えることができる。 The ECU is preliminarily equipped with software having a function of rewriting the software stored in the flash memory (hereinafter referred to as reprog software). When an external device capable of communicating with the ECU is connected to the vehicle and data is transmitted from the external device to the riplog software via the in-vehicle LAN, the riplog software writes the data in the rewrite target area in the flash memory. As a result, the software in the rewrite target area can be rewritten.

特開2016−139305号公報Japanese Unexamined Patent Publication No. 2016-139305

リプログソフトでは、以下のような書き換え処理が実行される。まず、ECUの起動時に実行されるブート処理の中で、フラッシュメモリ内の書き換え対象領域に含まれるステータス格納領域からステータスを読み取る。次に、ステータス格納領域に書き換え完了を示すステータスが格納されているか否かをチェックする。 In the reprog software, the following rewriting process is executed. First, in the boot process executed when the ECU is started, the status is read from the status storage area included in the rewrite target area in the flash memory. Next, it is checked whether or not the status indicating the completion of rewriting is stored in the status storage area.

既に書き換え対象領域にデータが書き込まれている場合、ステータス格納領域から読み取られるステータスは、書き換え完了を示すステータスとなる。したがって、ステータス格納領域から書き換え完了を示すステータスを読み取ることができた場合には、外部装置から受信したデータの書き込みは行わない。 If data has already been written to the rewrite target area, the status read from the status storage area will be the status indicating the completion of rewriting. Therefore, when the status indicating the completion of rewriting can be read from the status storage area, the data received from the external device is not written.

書き換え対象領域に書き換え予定のデータがまだ書き込まれていない場合、ステータス格納領域から読み取られるステータスは、書き換え完了を示すステータスとは別のステータスとなる。したがって、ステータス格納領域から書き換え完了を示すステータスを読み取ることができなかった場合には、外部装置から受信したデータを書き換え対象領域に書き込む。 If the data to be rewritten has not yet been written in the rewrite target area, the status read from the status storage area is different from the status indicating the completion of rewriting. Therefore, when the status indicating the completion of rewriting cannot be read from the status storage area, the data received from the external device is written to the rewriting target area.

フラッシュメモリとしては、ECC機能付きフラッシュメモリが利用される。ECC機能付きフラッシュメモリの場合、フラッシュメモリの記憶領域に格納されているデータを読み取る際に1ビット又は2ビットのエラーが生じていれば、そのエラーの検出及び訂正を行うことができる。ただし、3ビット以上のエラーが生じている場合、又はデータが不定な状態にある場合には、例外が発生する。 As the flash memory, a flash memory with an ECC function is used. In the case of the flash memory with the ECC function, if a 1-bit or 2-bit error occurs when reading the data stored in the storage area of the flash memory, the error can be detected and corrected. However, an exception occurs when an error of 3 bits or more occurs or when the data is in an indefinite state.

そのため、上述のような書き換え処理が実行される際、ステータス格納領域に格納されたデータが不定な状態になっていると、ステータス格納領域からステータスを読み取ろうとしたときに例外が発生する。例外が発生した場合、上述の書き換え処理は中断され、例外処理が実行される。すなわち、ステータス格納領域に格納されたデータが不定な状態になっている場合には、実行したい第1処理(例えば、上述の書き換え処理。)は中断され、強制的に第2処理(例えば、上述の例外処理。)が実行される。そのため、第1処理を完了させることができず、上述の書き換え処理の場合であれば、書き換え対象領域へのデータの書き込みを完了させることができない。 Therefore, when the above-mentioned rewriting process is executed, if the data stored in the status storage area is in an indefinite state, an exception occurs when trying to read the status from the status storage area. When an exception occurs, the above-mentioned rewriting process is interrupted and the exception process is executed. That is, when the data stored in the status storage area is in an indefinite state, the first process to be executed (for example, the above-mentioned rewriting process) is interrupted, and the second process (for example, the above-mentioned rewrite process) is forcibly interrupted. Exception handling.) Is executed. Therefore, the first process cannot be completed, and in the case of the above-mentioned rewrite process, the writing of data to the rewrite target area cannot be completed.

また、例えば、例外処理が実行された際、ECUが再起動される構成を採用している場合には、再起動後のブート処理においても、ステータス格納領域からステータスを読み取ろうとする段階で例外が発生する。この場合、ECUは再起動を繰り返すだけとなり、書き換え対象領域へのデータの書き込みを完了させることができない。 Further, for example, when the ECU is restarted when the exception processing is executed, an exception occurs at the stage of reading the status from the status storage area even in the boot processing after the restart. appear. In this case, the ECU only repeats the restart, and the writing of the data to the rewrite target area cannot be completed.

本開示の一局面においては、書き換え対象領域に格納されたデータが不定な状態になっていても所期の処理が中断するのを抑制可能な電子制御装置を提供することが望ましい。 In one aspect of the present disclosure, it is desirable to provide an electronic control unit capable of suppressing interruption of the desired processing even if the data stored in the rewrite target area is in an indefinite state.

本開示の一局面における電子制御装置は、記憶部(13)と、読取部(11,S105)と、第1判定部(11,S107)と、第2判定部(11,S131)と、第1処理部(11,S109−S111,S113−S119,S125−S129)と、第2処理部(11,S141)と、を備える。記憶部は、データの消去及び書き込みが可能な記憶領域を備える不揮発性メモリによって構成され、当該記憶領域には書き換え対象となるデータが格納される書き換え対象領域(40)が含まれる。かつ当該書き換え対象領域には当該書き換え対象領域に格納されたデータの書き換えが完了しているか否かを判定するためのステータスが格納されるステータス格納領域(41)が含まれる。書き換え対象領域が初期状態にある場合及びデータ消去後の状態にある場合には、書き換え対象領域に格納されたデータが不定な状態になる。読取部は、ステータス格納領域からステータスを読み取る。第1判定部は、書き換え対象領域に格納されたデータが読み取られた際に、書き換え対象領域に格納されたデータが不定な状態になっているか否かを判定する。第2判定部は、書き換え対象領域に格納されたデータが不定な状態になっている、と第1判定部によって判定された場合に、読取部によるステータスの読み取りが実行されたか否かを判定する。第1処理部は、書き換え対象領域に格納されたデータが不定な状態にはなっていない、と第1判定部によって判定された場合、又は読取部によるステータスの読み取りが実行された、と第2判定部によって判定された場合に、第1処理を実行する。第2処理部は、読取部によるステータスの読み取りが実行されていない、と第2判定部によって判定された場合に、第2処理を実行する。 The electronic control unit in one aspect of the present disclosure includes a storage unit (13), a reading unit (11, S105), a first determination unit (11, S107), a second determination unit (11, S131), and a first. It includes one processing unit (11, S109-S111, S113-S119, S125-S129) and a second processing unit (11, S141). The storage unit is composed of a non-volatile memory having a storage area capable of erasing and writing data, and the storage area includes a rewrite target area (40) in which data to be rewritten is stored. In addition, the rewrite target area includes a status storage area (41) in which a status for determining whether or not the rewriting of the data stored in the rewrite target area is completed is stored. When the rewrite target area is in the initial state or in the state after data erasure, the data stored in the rewrite target area becomes an indefinite state. The reading unit reads the status from the status storage area. The first determination unit determines whether or not the data stored in the rewrite target area is in an indefinite state when the data stored in the rewrite target area is read. The second determination unit determines whether or not the status reading by the reading unit has been executed when the first determination unit determines that the data stored in the rewrite target area is in an indefinite state. .. The first processing unit determines that the data stored in the rewrite target area is not in an indefinite state by the first determination unit, or that the reading unit has read the status. When the determination is made by the determination unit, the first process is executed. The second processing unit executes the second processing when the second determination unit determines that the status reading by the reading unit has not been executed.

このように構成された電子制御装置によれば、書き換え対象領域に格納されたデータが不定な状態にはなっていない、と第1判定部によって判定された場合、第1処理部が第1処理を実行する。一方、書き換え対象領域に格納されたデータが不定な状態になっている、と第1判定部によって判定された場合には、更に第2判定部による判定が行われる。すなわち、第2判定部は、読取部によるステータスの読み取りが実行されたか否かを判定する。その際、読取部によるステータスの読み取りが実行された、と第2判定部によって判定された場合、第1処理部が第1処理を実行する。一方、読取部によるステータスの読み取りが実行されていない、と第2判定部によって判定された場合、第2処理部が第2処理を実行する。 According to the electronic control unit configured in this way, when the first determination unit determines that the data stored in the rewrite target area is not in an indefinite state, the first processing unit performs the first processing. To execute. On the other hand, when the first determination unit determines that the data stored in the rewrite target area is in an indefinite state, the second determination unit further determines. That is, the second determination unit determines whether or not the status reading by the reading unit has been executed. At that time, when the second determination unit determines that the status has been read by the reading unit, the first processing unit executes the first processing. On the other hand, when the second determination unit determines that the status reading by the reading unit has not been executed, the second processing unit executes the second processing.

したがって、書き換え対象領域に格納されたデータが不定な状態にはなっていなければ第1処理を実行し、書き換え対象領域に格納されたデータが不定な状態になっていれば第2処理を実行するように構成されていた技術とは異なり、書き換え対象領域に格納されたデータが不定な状態になっている場合でも、読取部がステータスを読み取った場合については、書き換え対象領域に格納されたデータが不定な状態にはなっていない場合と同様に、第1処理を実行させることができる。 Therefore, if the data stored in the rewrite target area is not in an indefinite state, the first process is executed, and if the data stored in the rewrite target area is in an indefinite state, the second process is executed. Unlike the technology configured as such, even if the data stored in the rewrite target area is in an indefinite state, if the reading unit reads the status, the data stored in the rewrite target area will be displayed. The first process can be executed as in the case where the state is not indefinite.

図1は実施形態のソフトウェア書き換えシステムを表す構成図である。FIG. 1 is a configuration diagram showing a software rewriting system of the embodiment. 図2は書き換え処理を表すフローチャートである。FIG. 2 is a flowchart showing the rewriting process. 図3はECCエラーに対する処理を表すフローチャートである。FIG. 3 is a flowchart showing processing for an ECC error. 図4は書き換えシーケンスの一例を説明するための説明図である。FIG. 4 is an explanatory diagram for explaining an example of the rewriting sequence.

次に、上述の電子制御装置について、例示的な実施形態を挙げて説明する。
[ソフトウェア書き換えシステム1及び電子制御装置の構成]
図1に示すように、ソフトウェア書き換えシステム1は、電子制御装置2(以下、ECU2と称する。)及び外部装置3を備える。ECUは「Electronic Control Unit」の略称である。ECU2と外部装置3は、それぞれが車載LAN5に接続されることによって互いに通信可能に構成されている。
Next, the above-mentioned electronic control unit will be described with reference to exemplary embodiments.
[Configuration of software rewriting system 1 and electronic control unit]
As shown in FIG. 1, the software rewriting system 1 includes an electronic control device 2 (hereinafter, referred to as ECU 2) and an external device 3. ECU is an abbreviation for "Electronic Control Unit". The ECU 2 and the external device 3 are configured to be able to communicate with each other by being connected to the vehicle-mounted LAN 5.

ECU2は、車両に搭載されている。ECU2は、例えば、車両のエンジンを制御するように構成される。ECU2は、車両に設けられた車載LAN5に常時接続されている。外部装置3は、例えば自動車整備工場等、車両の外部となる場所に設けられる。外部装置3は、車両に装備されたコネクタを介して車載LAN5に接続される。外部装置3は、当該外部装置3を書き換えツールとして機能させるためのソフトウェアが作動するように構成された装置である。外部装置3は、例えば汎用のパーソナルコンピュータ又は書き換えツールを作動させるための専用の装置によって構成される。 The ECU 2 is mounted on the vehicle. The ECU 2 is configured to control the engine of the vehicle, for example. The ECU 2 is always connected to the vehicle-mounted LAN 5 provided in the vehicle. The external device 3 is provided in a place outside the vehicle, such as an automobile maintenance shop. The external device 3 is connected to the vehicle-mounted LAN 5 via a connector provided in the vehicle. The external device 3 is a device configured to operate software for operating the external device 3 as a rewriting tool. The external device 3 is composed of, for example, a general-purpose personal computer or a dedicated device for operating a rewriting tool.

ECU2は、マイコン6、入出力回路7及び電源8等を備える。マイコン6は、入出力回路7を介してECU2による制御対象との間で制御信号や検知信号の入出力を実行する。電源8は、マイコン6に内蔵された各部に電力を供給する。マイコン6は、CPU11、RAM12、フラッシュメモリ13及びECC14等を備える。ECCは「error checking and correction」の略称である。 The ECU 2 includes a microcomputer 6, an input / output circuit 7, a power supply 8, and the like. The microcomputer 6 executes input / output of a control signal and a detection signal to and from a control target by the ECU 2 via an input / output circuit 7. The power supply 8 supplies electric power to each part built in the microcomputer 6. The microcomputer 6 includes a CPU 11, a RAM 12, a flash memory 13, an ECC 14, and the like. ECC is an abbreviation for "error checking and correction".

CPU11は、RAM12又はフラッシュメモリ13に格納されたプログラムに従って処理及び制御を実行する。RAM12は、通電時にデータを記憶可能な記憶装置である。RAM12には、CPU11による演算結果等が格納される。フラッシュメモリ13は、データの消去及び書き込みが可能な不揮発性の非遷移的実体的記録媒体である。フラッシュメモリ13には、CPU11が実行するプログラムやプログラムの実行時に参照されるデータ等が格納される。 The CPU 11 executes processing and control according to a program stored in the RAM 12 or the flash memory 13. The RAM 12 is a storage device capable of storing data when energized. The RAM 12 stores the calculation result and the like by the CPU 11. The flash memory 13 is a non-volatile non-transitional substantive recording medium capable of erasing and writing data. The flash memory 13 stores a program executed by the CPU 11 and data referred to when the program is executed.

本実施形態において、CPU11の内部には、キーワードチェックフラグ21を記憶可能な記憶領域(例えばレジスタに含まれる少なくとも1ビットの記憶領域。)が確保される。キーワードチェックフラグ21の使用方法については、後述する処理に関する説明の中で言及する。また、本実施形態の場合、フラッシュメモリ13としては、フラッシュメモリ13の記憶領域が初期状態(すなわち、記憶領域にまだデータが1度も書き込まれていない状態。)及び消去状態(すなわち、記憶領域に書き込まれたデータが消去された状態。)にある場合には、記憶領域に格納されたデータが不定な状態になるフラッシュメモリ13が用いられている。フラッシュメモリ13の記憶領域が不定な状態にある場合、その記憶領域に格納されたデータ中に含まれるビット値は「0」又は「1」のいずれとなるのかが「不定」となる。このような状態において、CPU11がフラッシュメモリ13の記憶領域からデータを読み出そうとすると、ECC14によってエラーが検出されて例外が発生する。 In the present embodiment, a storage area in which the keyword check flag 21 can be stored (for example, a storage area of at least 1 bit included in a register) is secured inside the CPU 11. The usage of the keyword check flag 21 will be described in the description of the process described later. Further, in the case of the present embodiment, as the flash memory 13, the storage area of the flash memory 13 is in an initial state (that is, a state in which data has never been written in the storage area) and an erased state (that is, a storage area). When the data written in is in the erased state), the flash memory 13 in which the data stored in the storage area is in an indefinite state is used. When the storage area of the flash memory 13 is in an indefinite state, it is "indefinite" whether the bit value contained in the data stored in the storage area is "0" or "1". In such a state, when the CPU 11 tries to read data from the storage area of the flash memory 13, an error is detected by the ECC 14 and an exception occurs.

フラッシュメモリ13には、リプログソフト30が記憶されている。リプログソフト30は、CPU11によってフラッシュメモリ13から読み出され、リプログソフト30を構成するプログラムに従ってCPU11が処理を実行することにより、リプログソフト30が機能するように構成されている。リプログソフト30は、ブート制御部31、通信制御部33及びフラッシュ制御部35等を備える。ブート制御部31は、ECU2の起動時に実行されるソフトウェア等によって構成される。通信制御部33は、外部装置3との通信を制御するためのソフトウェア等によって構成される。フラッシュ制御部35は、フラッシュメモリ13の記憶領域に対する消去や書き込みを制御するためのソフトウェア等によって構成される。 The reprog software 30 is stored in the flash memory 13. The riplog software 30 is read from the flash memory 13 by the CPU 11, and the riplog software 30 is configured to function when the CPU 11 executes processing according to a program constituting the riplog software 30. The replog software 30 includes a boot control unit 31, a communication control unit 33, a flash control unit 35, and the like. The boot control unit 31 is composed of software or the like that is executed when the ECU 2 is started. The communication control unit 33 is composed of software or the like for controlling communication with the external device 3. The flash control unit 35 includes software for controlling erasing and writing to the storage area of the flash memory 13.

フラッシュメモリ13の記憶領域には、書き換え対象領域40が確保されている。書き換え対象領域40には、キーワード格納領域41や書き込み可能領域43が含まれている。詳しくは後述するが、上述のリプログソフト30は、ECU2の起動時にキーワード格納領域41をチェックして、書き換え対象領域40に対する書き換え処理を実行する必要があるか否かを判定する。書き換え処理を実行する必要がないと判定された場合は、ECU2が通常モードで起動される。この場合、CPU11は、書き換え対象領域40に記憶されたプログラム等を読み出して、そのプログラムに従って処理を実行する。これにより、ECU2による通常の制御が実行される。 A rewrite target area 40 is secured in the storage area of the flash memory 13. The rewrite target area 40 includes a keyword storage area 41 and a writable area 43. As will be described in detail later, the above-mentioned reprog software 30 checks the keyword storage area 41 when the ECU 2 is started, and determines whether or not it is necessary to execute the rewriting process for the rewriting target area 40. If it is determined that it is not necessary to execute the rewriting process, the ECU 2 is started in the normal mode. In this case, the CPU 11 reads the program or the like stored in the rewrite target area 40 and executes the process according to the program. As a result, normal control by the ECU 2 is executed.

一方、書き換え処理を実行する必要があると判定された場合は、ECU2がリプログモードで起動される。この場合、CPU11は、外部装置3から伝送されてくる書き込みデータ51を書き換え対象領域40に書き込むための処理を実行する。これにより、ECU2が通常モードで起動される際に書き換え対象領域40から読み出されるプログラム等を更新することができる。外部装置3を用いて書き換え対象領域40内のソフトウェアを書き換えようとするユーザーは、例えば、書き込みデータ51が格納された非遷移的実態的記録媒体(例えば、USBメモリ等。)を外部装置3に接続し、外部装置3において所定の操作を行う。これにより、外部装置3とECU2とが協働してリプログ処理が実行され、書き換え対象領域40内のソフトウェアを書き換えることができる。 On the other hand, when it is determined that the rewriting process needs to be executed, the ECU 2 is started in the replog mode. In this case, the CPU 11 executes a process for writing the write data 51 transmitted from the external device 3 to the rewrite target area 40. As a result, it is possible to update the program or the like read from the rewrite target area 40 when the ECU 2 is started in the normal mode. A user who intends to rewrite the software in the rewrite target area 40 by using the external device 3 uses, for example, a non-transitional actual recording medium (for example, a USB memory or the like) in which the write data 51 is stored in the external device 3. Connect and perform a predetermined operation on the external device 3. As a result, the external device 3 and the ECU 2 cooperate to execute the reprog processing, and the software in the rewrite target area 40 can be rewritten.

[書き換え処理]
次に、ECU2において実行される書き換え処理について図2に基づいて説明する。この書き換え処理は、マイコン6によって実行される処理であり、より詳細にはCPU11によって実行される処理である。CPU11は、ECU2の起動時に書き換え処理を開始する。
[Rewriting process]
Next, the rewriting process executed in the ECU 2 will be described with reference to FIG. This rewriting process is a process executed by the microcomputer 6, and more specifically, a process executed by the CPU 11. The CPU 11 starts the rewriting process when the ECU 2 is started.

書き換え処理を開始すると、S101において、CPU11は、CPU11に内蔵されたリソース(例えばレジスタ等。)の初期化を行う。S103において、CPU11は、キーワードチェックフラグ21をオンにする。この書き換え処理を実行している時点では、CPU11のレジスタ以外のリソースは初期化されていない状態にあり、例えばRAM12やフラッシュ制御部35等は未初期化の状態にある。そのため、この書き換え処理で利用するキーワードチェックフラグ21は、S101において初期化が完了しているCPU11内部の記憶領域に確保される。 When the rewriting process is started, in S101, the CPU 11 initializes the resources (for example, registers and the like) built in the CPU 11. In S103, the CPU 11 turns on the keyword check flag 21. At the time of executing this rewriting process, resources other than the registers of the CPU 11 are in an uninitialized state, and for example, the RAM 12 and the flash control unit 35 are in an uninitialized state. Therefore, the keyword check flag 21 used in this rewriting process is secured in the storage area inside the CPU 11 that has been initialized in S101.

S105において、CPU11は、フラッシュメモリ13の書き換え対象領域40に含まれるキーワード格納領域41からキーワードを読み出す。ここで読み出されるキーワードは、書き換え対象領域40のステータスを表す情報であり、当該キーワードに基づいて、書き換え対象領域40の書き換えが完了しているか否か等の情報を得ることができる。 In S105, the CPU 11 reads a keyword from the keyword storage area 41 included in the rewrite target area 40 of the flash memory 13. The keyword read here is information indicating the status of the rewrite target area 40, and based on the keyword, information such as whether or not the rewrite of the rewrite target area 40 is completed can be obtained.

続いて、S107において、CPU11は、キーワード格納領域41が不定な状態にあるか否かを判定する。本実施形態の場合、キーワード格納領域41が不定な状態にある場合にS105を実行すると、ECC14によってエラーが検出されて例外が発生し、割り込み処理として実行される例外処理へと移行する。そこで、本実施形態では、S105を実行した際に例外が発生したか否かにより、キーワード格納領域41が不定な状態にあるか否かを判定する。 Subsequently, in S107, the CPU 11 determines whether or not the keyword storage area 41 is in an indefinite state. In the case of the present embodiment, if S105 is executed when the keyword storage area 41 is in an indefinite state, an error is detected by ECC14, an exception occurs, and the process shifts to exception processing executed as interrupt processing. Therefore, in the present embodiment, it is determined whether or not the keyword storage area 41 is in an indefinite state depending on whether or not an exception has occurred when S105 is executed.

すなわち、S105を実行した際に例外処理へと移行しなければ、S107においてキーワード格納領域41が不定な状態ではないと判定されたことになり、この場合はS109へと進む。また、S105を実行した際に例外処理へと移行すれば、S107においてキーワード格納領域41が不定な状態であると判定されたことになり、この場合は例外処理に含まれるS131へと進む。 That is, if the exception handling is not performed when S105 is executed, it is determined in S107 that the keyword storage area 41 is not in an indefinite state, and in this case, the process proceeds to S109. Further, if the exception handling is performed when S105 is executed, it means that the keyword storage area 41 is determined to be in an indefinite state in S107, and in this case, the process proceeds to S131 included in the exception handling.

フラッシュ制御部35の作動開始後は、フラッシュ制御部35を利用してフラッシュメモリ13の記憶領域が不定な状態にあるか否かを知ることができる。ただし、この書き換え処理を実行している時点では、上述の通り、フラッシュ制御部35は未初期化の状態にある。そのため、フラッシュ制御部35を利用してフラッシュメモリ13の記憶領域が不定な状態にあるか否かを知ることはできない。そのため、S105では、キーワード格納領域41が不定な状態にあるか否かを事前に判定することなく、キーワードの読み出しを実行する。その結果、キーワード格納領域41が不定な状態になければ例外は発生せず、キーワード格納領域41が不定な状態にあれば例外が発生する。 After the operation of the flash control unit 35 is started, it is possible to know whether or not the storage area of the flash memory 13 is in an indefinite state by using the flash control unit 35. However, at the time of executing this rewriting process, the flash control unit 35 is in an uninitialized state as described above. Therefore, it is not possible to know whether or not the storage area of the flash memory 13 is in an indefinite state by using the flash control unit 35. Therefore, in S105, the keyword is read out without determining in advance whether or not the keyword storage area 41 is in an indefinite state. As a result, an exception does not occur unless the keyword storage area 41 is in an indefinite state, and an exception occurs if the keyword storage area 41 is in an indefinite state.

S105を実行したことによって例外が発生しなければS107でNOと判定されたことになり、この場合、S109において、CPU11は、キーワードチェックフラグ21をオフにする。すなわち、キーワードチェックフラグ21は、S105の実行前にオンにされて、S105の実行後にオフにされる。このようなタイミングでキーワードチェックフラグ21のオンとオフを切り替える理由は、詳しくは後述する処理の中で明らかになるが、例外処理へ移行した際に、例外処理に移行した契機がS105を実行したことにあるか否かを例外処理の中で判定するためである。 If no exception is generated by executing S105, it means that NO is determined in S107. In this case, in S109, the CPU 11 turns off the keyword check flag 21. That is, the keyword check flag 21 is turned on before the execution of S105 and turned off after the execution of S105. The reason for switching the keyword check flag 21 on and off at such a timing will be clarified in detail in the processing described later, but when the exception handling was started, the opportunity to shift to the exception handling executed S105. This is to determine whether or not there is something in the exception handling.

S111において、CPU11は、キーワードの有無を判定する。S111では、S105において書き換え完了を示すキーワードを読み出すことができた場合に、キーワード有りと判定される。また、S111では、S105において書き換え完了を示すキーワードを読み出すことができていない場合に、キーワード無しと判定される。S105において書き換え完了を示すキーワードを読み出すことができていない場合としては、キーワード格納領域41からキーワードを読み出すことができたが、そのキーワードが書き換え完了を示すキーワードではなかった場合と、キーワード格納領域41が不定な状態になっていることが原因でキーワード格納領域41からキーワードを読み出すことができなかった場合とを考え得る。 In S111, the CPU 11 determines the presence or absence of the keyword. In S111, when the keyword indicating the completion of rewriting can be read in S105, it is determined that there is a keyword. Further, in S111, when the keyword indicating the completion of rewriting cannot be read in S105, it is determined that there is no keyword. In S105, when the keyword indicating the completion of rewriting could not be read, the keyword could be read from the keyword storage area 41, but the keyword was not the keyword indicating the completion of rewriting, and the keyword storage area 41 It is conceivable that the keyword could not be read from the keyword storage area 41 because of the indefinite state.

S111においてキーワード有りと判定された場合は、フラッシュメモリ13の書き換え対象領域40に適正なプログラム(例えば、最新版のプログラム。)が格納されている状態にある。そこで、この場合は、S113において、CPU11は、起動アドレスを取得する。S115において、CPU11は、通常起動のための設定を行う。S117において、CPU11は、ECCエラーをチェックする。以降はS119へ進み、通常起動へと移行する。これにより、S113において取得された起動アドレス以降に格納されたプログラムがCPU11によって実行され、ECU2による通常の制御が実行される。 When it is determined in S111 that there is a keyword, an appropriate program (for example, the latest version of the program) is stored in the rewrite target area 40 of the flash memory 13. Therefore, in this case, in S113, the CPU 11 acquires the start address. In S115, the CPU 11 makes settings for normal startup. In S117, the CPU 11 checks for an ECC error. After that, the process proceeds to S119, and the process proceeds to normal startup. As a result, the program stored after the start address acquired in S113 is executed by the CPU 11, and the normal control by the ECU 2 is executed.

一方、S111においてキーワード無しと判定された場合は、フラッシュメモリ13の書き換え対象領域40に適正なプログラムが格納されていない状態にある。このような状態の具体例としては、最新版のプログラムよりも古いプログラム(すなわち、書き換え対象となるプログラム。)が書き換え対象領域40に格納されている場合、あるいは書き換え対象領域40が消去状態とされて不定な状態になっている場合等を考え得る。 On the other hand, when it is determined in S111 that there is no keyword, an appropriate program is not stored in the rewrite target area 40 of the flash memory 13. As a specific example of such a state, a program older than the latest version of the program (that is, a program to be rewritten) is stored in the rewrite target area 40, or the rewrite target area 40 is set to the erased state. It is possible that the situation is indefinite.

そこで、この場合は、S125において、CPU11は、リプログ起動のための設定を行う。S127において、CPU11は、ECCエラーをチェックする。以降はS129へ進み、リプログ起動へと移行し、リプログソフト30に対応するプログラムがCPU11によって実行される。これにより、外部装置3とECU2とが協働してリプログ処理が実行され、書き換え対象領域40内のソフトウェアを書き換えることができる。 Therefore, in this case, in S125, the CPU 11 makes a setting for starting the replog. In S127, the CPU 11 checks for an ECC error. After that, the process proceeds to S129, the process proceeds to start the replog, and the program corresponding to the replog software 30 is executed by the CPU 11. As a result, the external device 3 and the ECU 2 cooperate to execute the reprog processing, and the software in the rewrite target area 40 can be rewritten.

S117又はS127においてECCエラーが発生した場合は、そのエラーを訂正可能か否かに応じて、所期の処理を継続するか否かの判定が分かれる。例えば、S127を実行した際、図3に示すように、S201においてECCエラーが発生した場合、S203において、CPU11は、エラー種別を判定する。 When an ECC error occurs in S117 or S127, the determination of whether or not to continue the expected processing is divided depending on whether or not the error can be corrected. For example, when S127 is executed, as shown in FIG. 3, if an ECC error occurs in S201, the CPU 11 determines the error type in S203.

エラー種別が1ビット又は2ビットエラーの場合、S205において、CPU11は、エラー情報を記録する。S207において、CPU11は、エラーの訂正が可能か否かを判定する。エラーの訂正が可能な場合は、S209へ進み、訂正されたデータに基づいてリプログ処理を継続する。一方、エラーの訂正が不可能な場合は、S211へ進み、リセット処理へと移行する。これにより、ECU2は再起動される。エラー種別が3ビット以上エラーの場合、S221において、ECCエラー例外が発生する。この場合もS211へ進み、リセット処理へと移行する。これにより、ECU2は再起動される。 When the error type is a 1-bit or 2-bit error, the CPU 11 records error information in S205. In S207, the CPU 11 determines whether or not the error can be corrected. If the error can be corrected, the process proceeds to S209, and the reprog processing is continued based on the corrected data. On the other hand, if the error cannot be corrected, the process proceeds to S211 and the process proceeds to the reset process. As a result, the ECU 2 is restarted. If the error type is 3 bits or more, an ECC error exception occurs in S221. In this case as well, the process proceeds to S211 and the process proceeds to the reset process. As a result, the ECU 2 is restarted.

S105を実行したことによって例外が発生すればS107でYESと判定されたことになり、S131へと進む。S131において、CPU11は、キーワードチェックフラグ21がオンかオフかを判定する。S131において、キーワードチェックフラグ21がオンの場合、S133において、CPU11は、エラー情報を消去する。S133を終えたら、例外処理から元の処理へと復帰する。これにより、S133からS109へと進むことになる。一方、S131において、キーワードチェックフラグ21がオフの場合は、S141へ進み、ECCエラー例外処理へと移行する。ECCエラー例外処理では、リセット処理が実行され、ECU2は再起動される。 If an exception occurs due to the execution of S105, it means that YES is determined in S107, and the process proceeds to S131. In S131, the CPU 11 determines whether the keyword check flag 21 is on or off. When the keyword check flag 21 is turned on in S131, the CPU 11 erases the error information in S133. After finishing S133, the exception handling returns to the original processing. As a result, the process proceeds from S133 to S109. On the other hand, in S131, when the keyword check flag 21 is off, the process proceeds to S141 and the process proceeds to ECC error exception handling. In the ECC error exception processing, the reset processing is executed and the ECU 2 is restarted.

S131及びS133は、キーワード格納領域41が不定な状態であることが原因で例外が発生した場合であっても、S105を実行したことが例外発生の契機となっている場合に限り、例外処理から元の処理へと復帰するために設けられた処理ステップである。キーワードチェックフラグ21は、S105を実行したことが例外発生の契機となっていることを判定するために設けられたフラグである。 In S131 and S133, even if an exception occurs due to the keyword storage area 41 being in an indefinite state, only when the execution of S105 triggers the occurrence of the exception, the exception handling is performed. This is a processing step provided to return to the original processing. The keyword check flag 21 is a flag provided for determining that the execution of S105 has triggered the occurrence of an exception.

キーワードチェックフラグ21と処理ステップS131及びS133を設けることにより、キーワード格納領域41からキーワードを読み出そうとした際に例外が発生しても元の処理へと復帰することができる。これにより、S111,S125及びS127を経て、リプログ起動へと移行し、書き換え対象領域40内のソフトウェアを書き換えることができる。また、S105を実行したこと以外が例外発生の契機となっている場合には、キーワードチェックフラグ21がオフになっているので、ECCエラー例外処理へと移行し、ECU2は再起動される。 By providing the keyword check flag 21 and the processing steps S131 and S133, it is possible to return to the original processing even if an exception occurs when trying to read the keyword from the keyword storage area 41. As a result, the software in the rewrite target area 40 can be rewritten by shifting to the start of the reprog via S111, S125 and S127. Further, when the exception is triggered by something other than the execution of S105, the keyword check flag 21 is turned off, so that the process shifts to ECC error exception handling and the ECU 2 is restarted.

次に、ソフトウェア書き換えシステム1における書き換えシーケンスの一例を、図4に基づいて説明する。以下に説明する書き換えシーケンスは、不定な状態になっているキーワード格納領域41からキーワードを読み出そうとして例外が発生した場合に、元の処理へと復帰してリプログ処理を継続する場合に該当する書き換えシーケンスである。 Next, an example of the rewriting sequence in the software rewriting system 1 will be described with reference to FIG. The rewriting sequence described below corresponds to the case where an exception occurs while trying to read a keyword from the keyword storage area 41 in an indefinite state, and the process returns to the original process to continue the reprog process. It is a rewrite sequence.

ユーザーは、書き込みデータ51が格納された非遷移的実体的記録媒体(例えばCDROMやメモリカード等。)を外部装置3に接続し、外部装置3に対して開始指令を与える操作を実行する。これにより、ECU2ではリプログソフト30が起動されて上述の書き換え処理が実行される。ECU2において書き換え処理が実行されると、ECU2では、マイコン6の初期化処理、ECC14の有効化及びキーワードチェックフラグ21のオン等が実行された後、キーワードチェックが実行される。 The user connects a non-transitional substantive recording medium (for example, a CDROM, a memory card, etc.) in which the write data 51 is stored to the external device 3, and executes an operation of giving a start command to the external device 3. As a result, the reprog software 30 is started in the ECU 2 and the above-mentioned rewriting process is executed. When the rewriting process is executed in the ECU 2, the ECU 2 executes the keyword check after the initialization process of the microcomputer 6, the activation of the ECC14, the on of the keyword check flag 21, and the like are executed.

キーワードチェックが実行された際、キーワード格納領域41が不定な状態になっていると、キーワード格納領域41を読み出した際に、ECCエラーによる例外が発生する。このとき、割り込み処理として実行される例外処理では、キーワードチェックフラグ21の確認が行われ、キーワードチェックフラグ21がオンの場合には、ECCエラー情報が消去される。そして、ここで発生したECCエラーは問題ないと考えられるため、元の処理(すなわち、リプログソフト30による書き換え処理。)へと復帰する。 If the keyword storage area 41 is in an indefinite state when the keyword check is executed, an exception due to an ECC error occurs when the keyword storage area 41 is read. At this time, in the exception processing executed as the interrupt processing, the keyword check flag 21 is confirmed, and when the keyword check flag 21 is on, the ECC error information is deleted. Then, since it is considered that there is no problem with the ECC error generated here, the process returns to the original process (that is, the rewrite process by the replog software 30).

これにより、ECU2では、リプログソフト30による書き換え処理が継続され、起動判定、起動モード設定及びECCエラーチェックなどが実行され、以降の起動処理へと進む。なお、キーワード格納領域41から読み出されたキーワードが書き換え完了を示すキーワードではない場合は、リプログソフト30によって書き換え対象領域40へのデータの書き込みが実行され、書き換え対象領域40に格納された制御プログラム等が更新される。 As a result, in the ECU 2, the rewriting process by the replog software 30 is continued, start determination, start mode setting, ECC error check, and the like are executed, and the process proceeds to the subsequent start process. If the keyword read from the keyword storage area 41 is not a keyword indicating the completion of rewriting, the reprolog software 30 executes writing of data to the rewrite target area 40, and the control program stored in the rewrite target area 40. Etc. are updated.

[効果]
上記ECU2によれば、書き換え対象領域40に格納されたデータが不定な状態にはなっていない、とS107によって判定された場合、CPU11はS109以降の処理を実行する。一方、書き換え対象領域40に格納されたデータが不定な状態になっている、とS107によって判定された場合には、更にS131による判定が行われる。S131では、S105が実行されたか否かを判定する。
[effect]
According to the ECU 2, when it is determined by S107 that the data stored in the rewrite target area 40 is not in an indefinite state, the CPU 11 executes the processes after S109. On the other hand, when it is determined by S107 that the data stored in the rewrite target area 40 is in an indefinite state, the determination by S131 is further performed. In S131, it is determined whether or not S105 has been executed.

S105が実行されたとS131によって判定された場合、元の処理へと復帰し、CPU11はS109以降の処理を実行する。一方、S105が実行されていないとS131によって判定された場合、CPU11はECCエラー例外処理を実行する。 When it is determined by S131 that S105 has been executed, the process returns to the original process, and the CPU 11 executes the processes after S109. On the other hand, when it is determined by S131 that S105 is not executed, the CPU 11 executes ECC error exception processing.

したがって、書き換え対象領域40に格納されたデータが不定な状態にはなっていなければ通常処理又はリプログ処理を実行し、書き換え対象領域40に格納されたデータが不定な状態になっていればECCエラー例外処理を実行するように構成されていた技術とは異なり、書き換え対象領域40に格納されたデータが不定な状態になっている場合でも、S105を実行した場合については、書き換え対象領域40に格納されたデータが不定な状態にはなっていない場合と同様に、通常処理又はリプログ処理を実行させることができる。 Therefore, if the data stored in the rewrite target area 40 is not in an indefinite state, normal processing or reprog processing is executed, and if the data stored in the rewrite target area 40 is in an indefinite state, an ECC error occurs. Unlike the technology configured to execute exception handling, even if the data stored in the rewrite target area 40 is in an indefinite state, when S105 is executed, it is stored in the rewrite target area 40. Normal processing or reprog processing can be executed as in the case where the data is not in an indefinite state.

また、本実施形態の場合、マイコン6は、書き換え対象領域40に格納されたデータが不定な状態にある場合に、当該書き換え対象領域40に格納されたデータが読み取られると、割り込み処理を発生させる。S107は、割り込み処理が発生したら、書き換え対象領域40に格納されたデータが不定な状態になっていると判定し、割り込み処理が発生しなかったら、書き換え対象領域40に格納されたデータが不定な状態にはなっていないと判定する。したがって、上述のような割り込み処理を利用して、書き換え対象領域40に格納されたデータが不定な状態になっているか否かを判定することができる。 Further, in the case of the present embodiment, the microcomputer 6 generates an interrupt process when the data stored in the rewrite target area 40 is read when the data stored in the rewrite target area 40 is in an indefinite state. .. S107 determines that the data stored in the rewrite target area 40 is in an indefinite state when the interrupt process occurs, and if the interrupt process does not occur, the data stored in the rewrite target area 40 is indefinite. It is determined that the state is not reached. Therefore, it is possible to determine whether or not the data stored in the rewrite target area 40 is in an indefinite state by using the interrupt processing as described above.

また、本実施形態の場合、S131では、キーワードチェックフラグ21に基づいて、S105が実行されたか否かを判定する。したがって、割り込み処理への移行後であっても、S105が実行されたか否かを簡便に判定することができる。 Further, in the case of the present embodiment, in S131, it is determined whether or not S105 has been executed based on the keyword check flag 21. Therefore, it can be easily determined whether or not S105 has been executed even after the transition to interrupt processing.

また、本実施形態の場合、キーワードチェックフラグ21は、CPU11の内部にある記憶領域によって構成されている。したがって、RAM12やフラッシュメモリ13の初期化が完了していない段階であっても、キーワードチェックフラグ21を利用した判定を適切に実施することができる。 Further, in the case of the present embodiment, the keyword check flag 21 is composed of a storage area inside the CPU 11. Therefore, even at the stage where the initialization of the RAM 12 and the flash memory 13 is not completed, the determination using the keyword check flag 21 can be appropriately performed.

なお、本実施形態において、フラッシュメモリ13は、本開示でいう記憶部に対応する。キーワード格納領域41は、本開示でいうステータス格納領域に対応する。S105を実行するCPU11は、本開示でいう読取部に対応する。S107を実行するCPU11は、本開示でいう第1判定部に対応する。S131を実行するCPU11は、本開示でいう第2判定部に対応する。S109−S111,S113−S119及びS125−S129を含む処理は、本開示でいう第1処理に対応する。S109−S111,S113−S119及びS125−S129を含む処理を実行するCPU11は、本開示でいう第1処理部に対応する。S141を含む処理は、本開示でいう第2処理に対応する。S141を含む処理を実行するCPU11は、本開示でいう第2処理部に対応する。ECC14は、本開示でいうECC部に対応する。キーワードチェックフラグ21を記憶するための記憶領域は、本開示でいうフラグ記憶部に対応する。S111は、本開示でいう第1処理に含まれる判定処理に対応する。S113−S119は、本開示でいう第1処理に含まれる通常処理に対応する。S125−S129は、本開示でいう第1処理に含まれる書き換え処理に対応する。 In the present embodiment, the flash memory 13 corresponds to the storage unit referred to in the present disclosure. The keyword storage area 41 corresponds to the status storage area referred to in the present disclosure. The CPU 11 that executes S105 corresponds to the reading unit referred to in the present disclosure. The CPU 11 that executes S107 corresponds to the first determination unit referred to in the present disclosure. The CPU 11 that executes S131 corresponds to the second determination unit referred to in the present disclosure. The process including S109-S111, S113-S119 and S125-S129 corresponds to the first process referred to in the present disclosure. The CPU 11 that executes the process including S109-S111, S113-S119, and S125-S129 corresponds to the first processing unit referred to in the present disclosure. The process including S141 corresponds to the second process referred to in the present disclosure. The CPU 11 that executes the process including S141 corresponds to the second process unit referred to in the present disclosure. ECC14 corresponds to the ECC part referred to in the present disclosure. The storage area for storing the keyword check flag 21 corresponds to the flag storage unit referred to in the present disclosure. S111 corresponds to the determination process included in the first process referred to in the present disclosure. S113-S119 corresponds to the normal process included in the first process referred to in the present disclosure. S125-S129 corresponds to the rewriting process included in the first process referred to in the present disclosure.

[他の実施形態]
以上、本開示の電子制御装置について、例示的な実施形態を挙げて説明したが、上述の実施形態は本開示の一態様として例示されるものにすぎない。すなわち、本開示は、上述の例示的な実施形態に限定されるものではなく、本開示の技術的思想を逸脱しない範囲内において、様々な形態で実施することができる。
[Other Embodiments]
Although the electronic control unit of the present disclosure has been described with reference to an exemplary embodiment, the above-described embodiment is merely exemplified as one aspect of the present disclosure. That is, the present disclosure is not limited to the above-mentioned exemplary embodiments, and can be implemented in various forms without departing from the technical idea of the present disclosure.

例えば、上記実施形態では、第1処理の一例として、キーワード格納領域41から読み取られたキーワードが適正なキーワードであるか否かを判定する判定処理と、判定処理においてキーワード格納領域41から読み取られたキーワードが適正なキーワードであると判定された場合に、書き換え対象領域40に格納されたプログラムに基づく処理を実行する通常処理と、判定処理においてキーワード格納領域41から読み取られたキーワードが適正なキーワードではないと判定された場合に、ECU2と通信可能な外部装置3から伝送されてくるデータを書き換え対象領域40に書き込む書き換え処理とが含まれる第1処理を例示したが、第1処理は、上述の例とは異なっていてもよい。 For example, in the above embodiment, as an example of the first process, a determination process for determining whether or not the keyword read from the keyword storage area 41 is an appropriate keyword, and a determination process for determining whether or not the keyword is read from the keyword storage area 41 in the determination process. When it is determined that the keyword is an appropriate keyword, the normal process that executes the process based on the program stored in the rewrite target area 40 and the keyword read from the keyword storage area 41 in the determination process are the appropriate keywords. Although the first process including the rewrite process of writing the data transmitted from the external device 3 capable of communicating with the ECU 2 to the rewrite target area 40 when it is determined that there is no such process is illustrated, the first process is described above. It may be different from the example.

一例を挙げれば、ECU2による通常の制御(例えば、エンジン制御。)に用いられるプログラムとして、最新版のプログラムと、最新版のプログラムよりも古いバージョンのプログラムを、それぞれフラッシュメモリ13に記憶するように構成してもよい。この場合、キーワードの読み取りに成功して適正なキーワードを読み取ることができた場合は、最新版のプログラムに基づく制御を実行する。一方、キーワードの読み取りに失敗した場合(すなわち、例外が発生した場合。)又はキーワードの読み取りには成功したが適正なキーワードではなかった場合は、古いバージョンのプログラムに基づく制御を実行する。すなわち、第1処理は、上述のリプログ処理の実行に代えて、古いバージョンのプログラムに基づく制御を実行するように構成されていてもよい。このように構成された場合でも、キーワードの読み取りに失敗した場合に、単に第2処理へ移行してしまうのを回避できるシステムとなる。 As an example, as a program used for normal control (for example, engine control) by the ECU 2, the latest version of the program and a program of a version older than the latest version of the program are stored in the flash memory 13, respectively. It may be configured. In this case, if the keyword is successfully read and the appropriate keyword can be read, the control based on the latest version of the program is executed. On the other hand, if the keyword reading fails (that is, an exception occurs), or if the keyword reading succeeds but is not a proper keyword, the control based on the old version of the program is executed. That is, the first process may be configured to execute control based on an older version of the program instead of executing the above-mentioned reprog process. Even if it is configured in this way, it is a system that can avoid simply shifting to the second process when the reading of the keyword fails.

更に一例を挙げれば、ECU2による通常の制御(例えば、エンジン制御。)に用いられるプログラムとして、全ての機能を実現可能なアプリケーション(以下、フルアプリとも称する。)と、必要最低限の機能を実現可能なアプリケーション(以下、ミニマムアプリとも称する。)を、それぞれフラッシュメモリ13に記憶するように構成してもよい。この場合、キーワードの読み取りに成功して適正なキーワードを読み取ることができた場合は、フルアプリに基づく制御を実行する。一方、キーワードの読み取りに失敗した場合(すなわち、例外が発生した場合。)又はキーワードの読み取りには成功したが適正なキーワードではなかった場合は、ミニマムアプリに基づく制御を実行する。すなわち、第1処理は、上述のリプログ処理の実行に代えて、ミニマムアプリに基づく制御を実行するように構成されていてもよい。このように構成された場合でも、キーワードの読み取りに失敗した場合に、単に第2処理へ移行してしまうのを回避できるシステムとなる。 To give a further example, as a program used for normal control by the ECU 2 (for example, engine control), an application that can realize all functions (hereinafter, also referred to as a full application) and the minimum necessary functions can be realized. Applications (hereinafter, also referred to as minimum applications) may be configured to be stored in the flash memory 13. In this case, if the keyword is successfully read and the appropriate keyword can be read, the control based on the full application is executed. On the other hand, if the keyword reading fails (that is, an exception occurs), or if the keyword reading succeeds but the keyword is not appropriate, control based on the minimum application is executed. That is, the first process may be configured to execute control based on the minimum application instead of executing the above-mentioned reprog process. Even if it is configured in this way, it is a system that can avoid simply shifting to the second process when the reading of the keyword fails.

また、上記実施形態では、キーワード格納領域41が不定な状態でS105を実行すると例外が発生するのを利用してS107での判定を行っていたが、マイコン6の機能として、キーワード格納領域41が不定な状態であるか否かを判定できる機能がある場合は、例外を発生させることなく、CPU11においてキーワード格納領域41が不定な状態であるか否かを判定するようにしてもよい。 Further, in the above embodiment, the determination in S107 is performed by utilizing the fact that an exception occurs when S105 is executed in a state where the keyword storage area 41 is indefinite, but the keyword storage area 41 is a function of the microcomputer 6. If there is a function that can determine whether or not the keyword storage area 41 is in an indefinite state, the CPU 11 may determine whether or not the keyword storage area 41 is in an indefinite state without causing an exception.

また、上記実施形態では言及していないが、フラッシュメモリ13及びECC14は、ECC付きフラッシュメモリとして構成されていてもよいし、フラッシュメモリとは別にECC回路が実装されていてもよい。あるいは、ECC回路相当の機能をCPU11がソフトウェア処理によって実現するように構成されていてもよい。 Further, although not mentioned in the above embodiment, the flash memory 13 and the ECC 14 may be configured as a flash memory with an ECC, or an ECC circuit may be mounted separately from the flash memory. Alternatively, the CPU 11 may be configured to realize a function equivalent to the ECC circuit by software processing.

本開示に記載のECU2及びその手法は、コンピュータプログラムにより具体化された一つ乃至は複数の機能を実行するようにプログラムされたプロセッサ及びメモリを構成することによって提供された専用コンピュータにより、実現されてもよい。あるいは、本開示に記載のECU2及びその手法は、一つ以上の専用ハードウェア論理回路によってプロセッサを構成することによって提供された専用コンピュータにより、実現されてもよい。若しくは、本開示に記載のECU2及びその手法は、一つ乃至は複数の機能を実行するようにプログラムされたプロセッサ及びメモリと一つ以上のハードウェア論理回路によって構成されたプロセッサとの組み合わせにより構成された一つ以上の専用コンピュータにより、実現されてもよい。また、コンピュータプログラムは、コンピュータにより実行されるインストラクションとして、コンピュータ読み取り可能な非遷移有形記録媒体に記憶されてもよい。ECU2に含まれる各部の機能を実現する手法には、必ずしもソフトウェアが含まれている必要はなく、その全部の機能が、一つあるいは複数のハードウェアを用いて実現されてもよい。 The ECU 2 and its method described in the present disclosure are realized by a dedicated computer provided by configuring a processor and memory programmed to perform one or more functions embodied by a computer program. You may. Alternatively, the ECU 2 and its method described in the present disclosure may be realized by a dedicated computer provided by configuring the processor with one or more dedicated hardware logic circuits. Alternatively, the ECU 2 and its method described in the present disclosure are configured by a combination of a processor and memory programmed to perform one or more functions and a processor composed of one or more hardware logic circuits. It may be realized by one or more dedicated computers. The computer program may also be stored on a computer-readable non-transitional tangible recording medium as an instruction executed by the computer. The method for realizing the functions of each part included in the ECU 2 does not necessarily include software, and all the functions may be realized by using one or a plurality of hardware.

上記実施形態における1つの構成要素が有する複数の機能を、複数の構成要素によって実現してもよい。上記実施形態における1つの構成要素が有する1つの機能を、複数の構成要素によって実現してもよい。また、複数の構成要素が有する複数の機能を、1つの構成要素によって実現してもよい。複数の構成要素によって実現される1つの機能を、1つの構成要素によって実現してもよい。上記実施形態の構成の一部を省略してもよい。 A plurality of functions possessed by one component in the above embodiment may be realized by a plurality of components. One function of one component in the above embodiment may be realized by a plurality of components. Further, a plurality of functions possessed by the plurality of components may be realized by one component. One function realized by a plurality of components may be realized by one component. A part of the configuration of the above embodiment may be omitted.

上述したECU2の他、当該ECU2を構成要素とするシステム、当該ECU2としてコンピュータを機能させるためのプログラム、このプログラムを記録した半導体メモリ等の非遷移的実態的記録媒体、ECU2において実行される処理方法など、種々の形態で本開示を実現することもできる。 In addition to the above-mentioned ECU 2, a system having the ECU 2 as a component, a program for operating a computer as the ECU 2, a non-transitional actual recording medium such as a semiconductor memory in which this program is recorded, and a processing method executed in the ECU 2. The present disclosure can also be realized in various forms such as.

[補足]
なお、以上説明した例示的な実施形態から明らかなように、本開示の電子制御装置は、更に以下に挙げるような構成を備えていてもよい。
[Supplement]
As is clear from the exemplary embodiments described above, the electronic control unit of the present disclosure may further include the following configurations.

(1)記憶領域に記憶されるデータ内に生じたエラーの検出及び訂正が可能なECC部を備え、読取部によってステータス格納領域からステータスを読み取る際に、ステータス格納領域に格納されたデータが不定な状態にあると、ECC部によってエラーが検出されて割り込み処理が発生するように構成されてもよい。第1判定部は、割り込み処理が発生したら、書き換え対象領域に格納されたデータが不定な状態になっていると判定し、割り込み処理が発生しなかったら、書き換え対象領域に格納されたデータが不定な状態にはなっていないと判定するように構成されていてもよい。 (1) It is equipped with an ECC unit that can detect and correct errors that occur in the data stored in the storage area, and when the reading unit reads the status from the status storage area, the data stored in the status storage area is indefinite. In this state, the ECC unit may be configured to detect an error and generate interrupt processing. When the interrupt processing occurs, the first determination unit determines that the data stored in the rewrite target area is in an indefinite state, and if the interrupt processing does not occur, the data stored in the rewrite target area is indefinite. It may be configured to determine that it is not in such a state.

(2)第2判定部は、割り込み処理の中で、読取部によるステータスの読み取りが実行されたか否かを判定するように構成されていてもよい。
(3)読取部によってステータス格納領域からステータスを読み取る場合と当該場合以外の場合とで、オンとオフとが切り替えられるフラグを記憶するフラグ記憶部を備えてもよい。第2判定部は、フラグ記憶部に記憶されたフラグに基づいて、読取部によるステータスの読み取りが実行されたか否かを判定するように構成されていてもよい。
(2) The second determination unit may be configured to determine whether or not the status reading by the reading unit has been executed in the interrupt processing.
(3) A flag storage unit that stores a flag that can be switched on and off may be provided depending on whether the status is read from the status storage area by the reading unit or other than that case. The second determination unit may be configured to determine whether or not the status reading by the reading unit has been executed based on the flag stored in the flag storage unit.

(4)CPUを備えるマイコンを有してもよい。フラグ記憶部は、CPUの内部にある記憶領域によって構成されていてもよい。
(5)第1処理部は、読取部によるステータスの読み取りが実行された、と第2判定部によって判定された場合に、割り込み処理を終了して元の処理へと復帰することにより、第1処理を実行するように構成されてもよい。第2処理部は、読取部によるステータスの読み取りが実行されていない、と第2判定部によって判定された場合に、割り込み処理を継続して第2処理を実行するように構成されていてもよい。
(4) A microcomputer provided with a CPU may be provided. The flag storage unit may be composed of a storage area inside the CPU.
(5) When the second determination unit determines that the status reading by the reading unit has been executed, the first processing unit ends the interrupt processing and returns to the original processing, so that the first processing unit first It may be configured to perform the process. The second processing unit may be configured to continue interrupt processing and execute the second processing when the second determination unit determines that the status reading by the reading unit has not been executed. ..

(6)第1処理部は、読取部によってステータス格納領域から読み取られたステータスが適正なステータスであるか否かを判定する判定処理と、判定処理において読取部によってステータス格納領域から読み取られたステータスが適正なステータスであると判定された場合に、書き換え対象領域に格納されたプログラムに基づく処理を実行する通常処理と、判定処理において読取部によってステータス格納領域から読み取られたステータスが適正なステータスではないと判定された場合に、電子制御装置と通信可能な外部装置から伝送されてくるデータを書き換え対象領域に書き込む書き換え処理とが含まれる第1処理を実行するように構成されていてもよい。 (6) The first processing unit has a determination process for determining whether or not the status read from the status storage area by the reading unit is an appropriate status, and a status read from the status storage area by the reading unit in the determination process. When is determined to be the appropriate status, the normal process that executes the process based on the program stored in the rewrite target area and the status read from the status storage area by the reading unit in the determination process are the appropriate status. When it is determined that the data is not present, the first process including the rewrite process of writing the data transmitted from the external device capable of communicating with the electronic control unit to the rewrite target area may be executed.

1…ソフトウェア書き換えシステム、2…ECU(電子制御装置)、3…外部装置、5…車載LAN、6…マイコン、7…入出力回路、8…電源、11…CPU、12…RAM、13…フラッシュメモリ、14…ECC、21…ステータスチェックフラグ、30…リプログソフト、31…ブート制御部、33…通信制御部、35…フラッシュ制御部、40…書き換え対象領域、41…ステータス格納領域、43…書き込み可能領域、51…書き込みデータ。 1 ... Software rewriting system, 2 ... ECU (electronic control device), 3 ... External device, 5 ... In-vehicle LAN, 6 ... Microcomputer, 7 ... Input / output circuit, 8 ... Power supply, 11 ... CPU, 12 ... RAM, 13 ... Flash Memory, 14 ... ECC, 21 ... Status check flag, 30 ... Replog software, 31 ... Boot control unit, 33 ... Communication control unit, 35 ... Flash control unit, 40 ... Rewrite target area, 41 ... Status storage area, 43 ... Write Possible area, 51 ... Write data.

Claims (7)

データの消去及び書き込みが可能な記憶領域を備える不揮発性メモリによって構成され、当該記憶領域には書き換え対象となるデータが格納される書き換え対象領域(40)が含まれ、かつ当該書き換え対象領域には当該書き換え対象領域に格納されたデータの書き換えが完了しているか否かを判定するためのステータスが格納されるステータス格納領域(41)が含まれ、前記書き換え対象領域が初期状態にある場合及びデータ消去後の状態にある場合には、前記書き換え対象領域に格納されたデータが不定な状態になる記憶部(13)と、
前記ステータス格納領域からステータスを読み取る読取部(11,S105)と、
前記書き換え対象領域に格納されたデータが読み取られた際に、前記書き換え対象領域に格納されたデータが不定な状態になっているか否かを判定する第1判定部(11,S107)と、
前記書き換え対象領域に格納されたデータが不定な状態になっている、と前記第1判定部によって判定された場合に、前記読取部によるステータスの読み取りが実行されたか否かを判定する第2判定部(11,S131)と、
前記書き換え対象領域に格納されたデータが不定な状態にはなっていない、と前記第1判定部によって判定された場合、又は前記読取部によるステータスの読み取りが実行された、と前記第2判定部によって判定された場合に、第1処理を実行する第1処理部(11,S109−S111,S113−S119,S125−S129)と、
前記読取部によるステータスの読み取りが実行されていない、と前記第2判定部によって判定された場合に、第2処理を実行する第2処理部(11,S141)と、
を備える電子制御装置。
It is composed of a non-volatile memory having a storage area capable of erasing and writing data, and the storage area includes a rewrite target area (40) in which data to be rewritten is stored, and the rewrite target area includes a rewrite target area (40). The status storage area (41) in which the status for determining whether or not the rewriting of the data stored in the rewrite target area is completed is stored is included, and the case where the rewrite target area is in the initial state and the data. A storage unit (13) in which the data stored in the rewrite target area is in an indefinite state when the data is in the erased state.
A reading unit (11, S105) that reads the status from the status storage area,
A first determination unit (11, S107) that determines whether or not the data stored in the rewrite target area is in an indefinite state when the data stored in the rewrite target area is read.
When the first determination unit determines that the data stored in the rewrite target area is in an indefinite state, the second determination determines whether or not the status reading by the reading unit has been executed. Part (11, S131) and
When the first determination unit determines that the data stored in the rewrite target area is not in an indefinite state, or when the reading unit has executed the reading of the status, the second determination unit The first processing unit (11, S109-S111, S113-S119, S125-S129) that executes the first processing when determined by
When it is determined by the second determination unit that the status reading by the reading unit has not been executed, the second processing unit (11, S141) that executes the second processing and
Electronic control unit equipped with.
請求項1に記載の電子制御装置であって、
前記記憶領域に記憶されるデータ内に生じたエラーの検出及び訂正が可能なECC部(14)を備え、前記読取部によって前記ステータス格納領域からステータスを読み取る際に、前記ステータス格納領域に格納されたデータが不定な状態にあると、前記ECC部によってエラーが検出されて割り込み処理が発生するように構成され、
前記第1判定部は、前記割り込み処理が発生したら、前記書き換え対象領域に格納されたデータが不定な状態になっていると判定し、前記割り込み処理が発生しなかったら、前記書き換え対象領域に格納されたデータが不定な状態にはなっていないと判定するように構成されている
電子制御装置。
The electronic control unit according to claim 1.
It is provided with an ECC unit (14) capable of detecting and correcting an error occurring in the data stored in the storage area, and is stored in the status storage area when the status is read from the status storage area by the reading unit. If the data is in an indefinite state, the ECC unit is configured to detect an error and generate interrupt processing.
When the interrupt process occurs, the first determination unit determines that the data stored in the rewrite target area is in an indefinite state, and if the interrupt process does not occur, stores the data in the rewrite target area. An electronic control unit that is configured to determine that the data is not in an indefinite state.
請求項2に記載の電子制御装置であって、
前記第2判定部は、前記割り込み処理の中で、前記読取部によるステータスの読み取りが実行されたか否かを判定するように構成されている
電子制御装置。
The electronic control unit according to claim 2.
The second determination unit is an electronic control unit configured to determine whether or not the status reading by the reading unit has been executed in the interrupt processing.
請求項3に記載の電子制御装置であって、
前記読取部によって前記ステータス格納領域からステータスを読み取る場合と当該場合以外の場合とで、オンとオフとが切り替えられるフラグを記憶するフラグ記憶部(21)を備え、
前記第2判定部は、前記フラグ記憶部に記憶されたフラグに基づいて、前記読取部によるステータスの読み取りが実行されたか否かを判定するように構成されている
電子制御装置。
The electronic control unit according to claim 3.
A flag storage unit (21) for storing a flag that can be switched on and off depending on whether the status is read from the status storage area by the reading unit or not.
The second determination unit is an electronic control unit configured to determine whether or not the status reading by the reading unit has been executed based on the flag stored in the flag storage unit.
請求項4に記載の電子制御装置であって、
CPU(11)を備えるマイコン(6)を有し、
前記フラグ記憶部は、前記CPUの内部にある記憶領域によって構成されている
電子制御装置。
The electronic control unit according to claim 4.
Having a microcomputer (6) equipped with a CPU (11)
The flag storage unit is an electronic control unit composed of a storage area inside the CPU.
請求項3から請求項5までのいずれか一項に記載の電子制御装置であって、
前記第1処理部は、前記読取部によるステータスの読み取りが実行された、と前記第2判定部によって判定された場合に、前記割り込み処理を終了して元の処理へと復帰することにより、前記第1処理を実行するように構成され、
前記第2処理部は、前記読取部によるステータスの読み取りが実行されていない、と前記第2判定部によって判定された場合に、前記割り込み処理を継続して前記第2処理を実行するように構成されている
電子制御装置。
The electronic control unit according to any one of claims 3 to 5.
When the second determination unit determines that the status reading by the reading unit has been executed, the first processing unit ends the interrupt processing and returns to the original processing. Configured to perform the first process,
The second processing unit is configured to continue the interrupt processing and execute the second processing when the second determination unit determines that the status reading by the reading unit has not been executed. Electronic control unit.
請求項1から請求項6までのいずれか一項に記載の電子制御装置であって、
前記第1処理部は、前記読取部によって前記ステータス格納領域から読み取られたステータスが適正なステータスであるか否かを判定する判定処理(S111)と、前記判定処理において前記読取部によって前記ステータス格納領域から読み取られたステータスが適正なステータスであると判定された場合に、前記書き換え対象領域に格納されたプログラムに基づく処理を実行する通常処理(S113−S119)と、前記判定処理において前記読取部によって前記ステータス格納領域から読み取られたステータスが適正なステータスではないと判定された場合に、前記電子制御装置と通信可能な外部装置から伝送されてくるデータを前記書き換え対象領域に書き込む書き換え処理(S125−S129)とが含まれる前記第1処理を実行するように構成されている
電子制御装置。
The electronic control unit according to any one of claims 1 to 6.
The first processing unit includes a determination process (S111) for determining whether or not the status read from the status storage area by the reading unit is an appropriate status, and the status storage by the reading unit in the determination process. When it is determined that the status read from the area is an appropriate status, a normal process (S113-S119) for executing a process based on the program stored in the rewrite target area and the reading unit in the determination process. When it is determined that the status read from the status storage area is not an appropriate status, data transmitted from an external device capable of communicating with the electronic control unit is written to the rewrite target area (S125). -S129) An electronic control unit configured to perform the first process.
JP2019047054A 2019-03-14 2019-03-14 Electronic controller Pending JP2020149428A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2019047054A JP2020149428A (en) 2019-03-14 2019-03-14 Electronic controller

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2019047054A JP2020149428A (en) 2019-03-14 2019-03-14 Electronic controller

Publications (1)

Publication Number Publication Date
JP2020149428A true JP2020149428A (en) 2020-09-17

Family

ID=72430556

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2019047054A Pending JP2020149428A (en) 2019-03-14 2019-03-14 Electronic controller

Country Status (1)

Country Link
JP (1) JP2020149428A (en)

Similar Documents

Publication Publication Date Title
KR101375992B1 (en) Handling errors during device bootup from a non-volatile memory
JP4868216B2 (en) Firmware update circuit and firmware update method
TWI515660B (en) Firmware variable update method
US6601132B2 (en) Nonvolatile memory and method of writing data thereto
TW201937367A (en) Method for managing system boot code memory, memory device and electronic system using the same
US20150199190A1 (en) System and method for updating firmware
US10977050B2 (en) Method for managing system boot code memory, memory device and electronic system using the same
JP2006323776A (en) Information processor
KR20060122064A (en) Electronic device and booting method thereof
CN105786545B (en) Breakpoint recovery method and system based on heterogeneous hybrid memory
US7096351B2 (en) Single-chip microcomputer and boot region switching method thereof
JP2005157528A (en) Memory device
CN111026417A (en) Embedded equipment upgrading method and embedded equipment
US7490321B2 (en) Method for updating firmware via determining program code
JP5084853B2 (en) Firmware update device, communication device, electronic device, firmware update system, firmware update method, and program
JP2002323902A (en) Electronic controller
JP6708596B2 (en) Electronic control device and control program verification method
JP2008251154A (en) Nonvolatile semiconductor memory device
JP2020149428A (en) Electronic controller
JP2019008693A (en) Vehicle-purpose electronic control unit
US11768669B2 (en) Installing application program code on a vehicle control system
JP2007041798A (en) Information processor and memory rewriting method for information processor
JP2001344156A (en) Device with flash memory and data rewriting method
KR102551737B1 (en) Bootloader System and Method Therefor
JP6699591B2 (en) Engine controller