JP2015210669A - Program rewrite method - Google Patents
Program rewrite method Download PDFInfo
- Publication number
- JP2015210669A JP2015210669A JP2014091870A JP2014091870A JP2015210669A JP 2015210669 A JP2015210669 A JP 2015210669A JP 2014091870 A JP2014091870 A JP 2014091870A JP 2014091870 A JP2014091870 A JP 2014091870A JP 2015210669 A JP2015210669 A JP 2015210669A
- Authority
- JP
- Japan
- Prior art keywords
- program
- data
- verification
- check data
- written
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Landscapes
- Stored Programmes (AREA)
Abstract
Description
本発明は、記憶装置にプログラムや機器の動作に必要なデータが正常に書き込まれたか否かを検証する技術に関する。 The present invention relates to a technique for verifying whether a program and data necessary for operation of a device have been normally written in a storage device.
車両には、様々な制御装置が搭載される。これらの制御装置は、プログラムや機器の動作に必要なデータ等を格納する記憶装置を有し、その記憶装置に格納されたプログラム等の書き換えが行われる場合がある。 Various control devices are mounted on the vehicle. These control devices include a storage device that stores a program, data necessary for the operation of the device, and the like, and the program stored in the storage device may be rewritten.
記憶装置にデータが正常に書き込まれているか否かを判定する技術に関して、メインプログラムの末尾に、ロード完了マークを含ませておき、ダウンロードに際して、このロード完了マークをフラッシュメモリの特定の格納領域に格納する技術が知られている(例えば、特許文献1参照)。この技術では、メインプログラムが正しく格納されているか否かを判定する際に、フラッシュメモリ内のロード完了マーク格納領域にロード完了マークが格納され、かつメインプログラムエリアに対するサムチェックの結果が正常である場合に、正しく格納されていると判定する。 Regarding the technology for determining whether or not data has been normally written to the storage device, a load completion mark is included at the end of the main program, and this load completion mark is stored in a specific storage area of the flash memory when downloading. A storing technique is known (see, for example, Patent Document 1). In this technique, when determining whether or not the main program is correctly stored, the load completion mark is stored in the load completion mark storage area in the flash memory, and the result of the sum check for the main program area is normal. If it is determined that it is stored correctly.
また、車載制御装置に関して、電子制御装置内のデータの書き換えの際に、マスタ制御装置がまず、各車両のVINコード(車両識別コード)や制御プログラムのバージョン情報等を保持、管理している外部の管理センターから書き換え用のデータを無線通信によって取得する技術が知られている(例えば、特許文献2参照)。そして、該取得したデータを一時的にメモリ装置に格納するとともに該格納された書き換え用のデータの適正性を判断する。この結果、メモリ装置に格納されている書き換え用のデータが適正であることを条件に、同書き換え用のデータを用いて電子制御装置内のデータを書き換える。 In addition, regarding the in-vehicle control device, when rewriting data in the electronic control device, the master control device first holds and manages the VIN code (vehicle identification code) of each vehicle, the version information of the control program, etc. A technique for acquiring data for rewriting from a management center by wireless communication is known (for example, see Patent Document 2). Then, the acquired data is temporarily stored in the memory device and the suitability of the stored data for rewriting is determined. As a result, on the condition that the data for rewriting stored in the memory device is appropriate, the data in the electronic control device is rewritten using the data for rewriting.
ロード完了マーク、及びチェックサムを確認することによって正常に書き込まれたか否かを判定する方法では、ロード完了マーク以外の領域でチェックサムが偶然一致するデータ化けがあった場合でも正常に書き込まれたと誤判定される場合がある。 In the method of determining whether or not data has been written normally by checking the load completion mark and checksum, it is assumed that data has been written normally even if the checksum accidentally matches data in an area other than the load completion mark. There is a case where it is erroneously determined.
また、データの書き込みの途中でデータ化けが発生した状態で、書き込みが完了し、且つベリファイの途中で処理が中断した場合、ベリファイが正常に完了したことは書き込まれないため、次回の電源投入時に正常にデータが書き込まれたと誤判定される場合がある。 In addition, when data is garbled in the middle of data writing and writing is completed and processing is interrupted during verification, the fact that verification has been completed normally is not written. There are cases where it is erroneously determined that data has been written normally.
本発明の目的は、プログラムの書き換えからベリファイまで、正常に行われたか否かを判定することである。 An object of the present invention is to determine whether or not the program rewrite to verify has been performed normally.
開示の一実施例のプログラム書き換え方法は、
ツールから送信されるプログラムを受信し、
前記プログラムを記憶部に書き込む際に、該プログラムに埋め込まれたチェックデータA、及び該チェックデータAと同じデータであるチェックデータBのうち、チェックデータAを前記記憶部に書き込み、
前記プログラムを前記記憶部に書き込んだ後に、該プログラムが正常に書き込まれたか否かを検証するベリファイ処理の際に、前記ツールから検証用のプログラムを受信し、
前記検証用のプログラムに基づいて、前記記憶部に書き込んだプログラムを検証するとともに、前記検証用のプログラムに埋め込まれた前記チェックデータBを前記記憶部に書き込み、
前記記憶部に書き込まれているチェックデータAと、前記記憶部に書き込んだチェックデータBとを照合し、一致する場合に正常に書き込まれたことを前記ツールに通知する。
A program rewriting method according to an embodiment of the disclosure is as follows:
Receive the program sent from the tool,
When writing the program to the storage unit, the check data A embedded in the program and the check data B that is the same data as the check data A, the check data A is written to the storage unit,
After the program is written in the storage unit, a verification program is received from the tool during a verification process for verifying whether the program has been normally written,
Based on the verification program, the program written in the storage unit is verified, and the check data B embedded in the verification program is written in the storage unit,
The check data A written in the storage unit and the check data B written in the storage unit are collated, and if they match, the tool is notified of normal writing.
開示の実施例によれば、プログラムの書き換えからベリファイまで、正常に行われたか否かを判定することができる。 According to the disclosed embodiment, it is possible to determine whether or not the program rewriting to the verification has been normally performed.
次に、本発明を実施するための形態を、以下の実施例に基づき図面を参照しつつ説明する。以下で説明する実施例は一例に過ぎず、本発明が適用される実施の形態は、以下の実施例に限られない。
なお、実施例を説明するための全図において、同一機能を有するものは同一符号を用い、繰り返しの説明は省略する。
Next, the form for implementing this invention is demonstrated, referring drawings based on the following Examples. Examples described below are merely examples, and embodiments to which the present invention is applied are not limited to the following examples.
In all the drawings for explaining the embodiments, the same reference numerals are used for those having the same function, and repeated explanation is omitted.
<電子制御ユニット>
図1は、制御装置としての電子制御ユニット(ECU: Electronic Control Unit)100の一実施例を示す。
<Electronic control unit>
FIG. 1 shows an embodiment of an electronic control unit (ECU) 100 as a control device.
ECU100は、例えば車両等の移動体に搭載される。ECU100の一実施例は、車両に搭載され、CAN(Controller Area Network)等の車載ネットワークに接続される。ECU100は、情報系LAN、パワートレイン系LAN、ボディ系LAN等に接続できる。また、ECU100に、センサ、アクチュエータ等が実装されてもよい。複数のECU100によって、車載通信システムが構成される。
The ECU 100 is mounted on a moving body such as a vehicle. One embodiment of the ECU 100 is mounted on a vehicle and connected to an in-vehicle network such as a CAN (Controller Area Network). The ECU 100 can be connected to an information system LAN, a power train system LAN, a body system LAN, and the like. Further, a sensor, an actuator, or the like may be mounted on the
ECU100が搭載される車両には、外部機器接続用コネクタ300が搭載される。外部機器接続用コネクタ300は、データリンクコネクタ(DLC: Data Link Connector)を適用できる。ECU100と、外部機器接続用コネクタ300との間は、CAN等の相互接続された機器間のデータ転送に使われる規格にしたがった通信線50によって接続される。
An external
外部機器接続用コネクタ300には、車両の外部から、診断機などの様々なツールが接続される。ツールの一例は、ECU100の記憶装置に格納されているプログラムを書き換える書き換えツール200である。書き換えツール200と、外部機器接続用コネクタ300との間は、CAN等の相互接続された機器間のデータ転送に使われる規格にしたがった通信線50によって接続される。
Various tools such as a diagnostic machine are connected to the external
ECU100の一実施例では、外部機器接続用コネクタ300に書き換えツール200が接続される場合について説明する。
In one embodiment of the
<書き換えツール200>
書き換えツール200は、外部機器接続用コネクタ300を介して、ECU100と接続される。書き換えツール200は、インターフェース(I/F: interface)(図示なし)と、CPU(図示なし)と、メモリ(図示なし)とを有し、メモリには、ECU100の記憶装置に書き込むプログラム(以下、「書き換えプログラム」という)を格納する。
<
The
インターフェースは、ECU100へ通信線50を介してデータを送信する。例えば、インターフェースは、ECU100の記憶装置に格納される書き換えプログラムを通信線50へ送信する。また、インターフェースは、ECU100から、様々な応答等のデータを受信し、受信したデータをCPUに入力する。
The interface transmits data to the ECU 100 via the
CPUは、インターフェースと接続される。CPUは、書き換えプログラムの送信に先立ち、ECU100にパスワードの照合などのセキュリティアクセスを行い、ECU100から送信されるセキュリティアクセス応答を取得する。CPUは、ECU100から送信されるセキュリティアクセス応答を取得すると、ECU100へ書き込み対象となるアドレス範囲の消去を要求し、ECU100から送信される書き込み対象となるアドレス範囲の消去が完了したことを表す消去応答を取得する。消去を要求するアドレス範囲として、ベリファイの際にチェックデータBを書き込むアドレス範囲も指定される。CPUは、ECU100から送信される消去応答を取得すると、ECU100へ書き込みを要求する書き込み要求コマンド、及び書き換えプログラムを送信し、ECU100から送信される書き込みが完了したことを表す書き込み応答を取得する。CPUは、ECU100から送信される書き込み応答を取得すると、ECU100へ書き換えプログラムが正常に書き込まれたか否かを検証することを要求するベリファイ要求コマンド、及びベリファイプログラムを送信し、ECU100から送信されるベリファイが完了したことを表すベリファイ応答を取得する。
The CPU is connected to the interface. Prior to the transmission of the rewrite program, the CPU performs security access such as password verification to the
<ECU100>
ECU100は、マイコン(図示無し)、及びトランシーバ(図示無し)を備える。トランシーバは、通信線50に接続され、通信ドライバによる制御によって、通信回路からのメッセージ等のデータを通信線50に送信するとともに、通信線50からメッセージ等のデータを受信し、通信回路に入力する。トランシーバは、入力電圧、信号の振幅、及びECU100の省電力のためのスリープ、ウェイクアップの制御を行う。
<ECU100>
The
マイコンには、通信回路(図示なし)と、CPU(Central Processing Unit)(図示なし)と、フラッシュメモリ等の記憶装置(図示なし)が実装され、ECU100がマスタノードとして機能する場合には、トークンの送信と、スケジューリングの管理を行う。また、マイコンは、ECU100がマスタノードとして機能する場合、及びスレーブノードとして機能する場合に関わらず、データの送受信を行う。
The microcomputer is equipped with a communication circuit (not shown), a CPU (Central Processing Unit) (not shown), and a storage device (not shown) such as a flash memory, and when the
マイコンは、書き換えプログラムの送信に先立ち、書き換えツール200からのパスワードの照合等のセキュリティアクセスに応じて、セキュリティに関する処理を行い、セキュリティアクセス応答を送信する。マイコンにはセキュリティ情報が保持され、このセキュリティ情報に基づくセキュリティチェックを通過しなければプログラムの書き込みができないように設定される。これにより、不正なプログラムの書き込みを防止することができる。
Prior to the transmission of the rewriting program, the microcomputer performs a process related to security in accordance with security access such as password verification from the
マイコンは、書き換えツール200からの書き込み対象となるアドレス範囲の消去の要求に応じて、記憶装置の該当するアドレス範囲の消去を行い、該当するアドレス範囲の消去が完了したことを表す消去応答を送信する。マイコンは、書き換えツール200から送信される書き込みを要求する書き込み要求コマンド、及び書き換えプログラムを取得すると、記憶装置に書き換えプログラムを書き込み、書き込みが完了した場合に書き込み応答を送信する。
The microcomputer erases the corresponding address range of the storage device in response to a request for erasing the address range to be written from the
<書き込み処理>
図2は、書き換え処理の一実施例を示す。図2は、記憶装置の領域の一例を示す。記憶装置には、書き換え対象外領域と、書き換え対象領域が設けられ、さらに書き換え対象外領域は、書き換え処理プログラム等のプログラム等が格納される領域と、空き領域とに区分される。図2において、書き換える領域の範囲をハッチングにより表す。
<Write processing>
FIG. 2 shows an embodiment of the rewriting process. FIG. 2 shows an example of a storage device area. The storage device is provided with an area not to be rewritten and an area to be rewritten, and the area not to be rewritten is divided into an area in which a program such as a rewrite processing program is stored and an empty area. In FIG. 2, the range of the area to be rewritten is indicated by hatching.
書き換え対象領域には、プログラムの書き換えの際に、チェックデータAが書き込まれる領域が用意される。ここで、チェックデータAは、プログラムの書き換え処理が行われたことを検証するために使われる言語、文字、記号、及び各種のしるし等の識別情報を示す。また、チェックデータAは、言語、文字、記号、及び各種のしるしのうち、少なくとも2つが組み合わされた識別情報であってもよい。 In the rewrite target area, an area in which the check data A is written when the program is rewritten is prepared. Here, the check data A indicates identification information such as a language, characters, symbols, and various indicia used for verifying that the program rewriting process has been performed. The check data A may be identification information in which at least two of a language, characters, symbols, and various indicia are combined.
書き換え対象外領域には、プログラムの書き換えが正常に行われたことを検証するベリファイの際に、チェックデータBが書き込まれる領域が用意される。ここで、チェックデータBは、プログラムの書き換えが正常に行われたことを検証するために使われる言語、文字、記号、及び各種のしるし等の識別情報を示す。また、チェックデータBは、言語、文字、記号、及び各種のしるしのうち、少なくとも2つが組み合わされた識別情報であってもよい。チェックデータA、及びチェックデータBは同じ識別情報である。 In the area not to be rewritten, an area in which the check data B is written at the time of verifying that the program has been rewritten normally is prepared. Here, the check data B indicates identification information such as language, characters, symbols, and various indicia used for verifying that the program has been rewritten normally. The check data B may be identification information in which at least two of language, characters, symbols, and various indicia are combined. Check data A and check data B are the same identification information.
書き換えツールは、書き換えプログラムを最小のメモリアドレスから順にECU100へ送信する。ECU100のマイコンは、書き換えツールから送信される書き換えプログラムを送信される順に最小のメモリアドレスから矢印の方向に書き込み(図2の左から右の方向に書き込み、右端まで書き込んだら次の番地について左から右の方向に書き込み)を行い、チェックデータB(送信された書き換えプログラムの最後)の手前のワードまで書き換えたときに書き込み完了の書き込み応答を返す。つまり、書き込み処理では、チェックデータBは書き込まない。
The rewriting tool transmits the rewriting program to the
チェックデータA、及びチェックデータBは、予めプログラムに埋め込められ、その値は、プログラム毎に異ならせることができる。例えば、プログラムの書き換えが行われる前のチェックデータAの値、及びチェックデータBの値は「84963451h」であり、書き換えるプログラムではチェックデータAの値、及びチェックデータBの値は「32964754h」とする。この場合、プログラムの書き換えの開始後、チェックデータAを書き換えた時点では、チェックデータAは書き換えられたため「32964754h」であり、チェックデータBは書き換えられないため「84963451h」のままである。 Check data A and check data B are embedded in a program in advance, and the values can be different for each program. For example, the value of the check data A and the value of the check data B before the program is rewritten is “84963451h”, and the value of the check data A and the value of the check data B is “32964754h” in the program to be rewritten. . In this case, when the check data A is rewritten after the start of program rewriting, the check data A is “32964754h” because it is rewritten, and the check data B is “84963451h” because it is not rewritten.
プログラムの書き換えが終了した後、プログラムが正常に書き換えられたか否かを検証するためのベリファイが行われる。マイコンは、書き換えツール200から送信される書き換えプログラムが正常に書き込まれたか否かを検証することを要求するベリファイ要求コマンド、及びベリファイプログラムを取得すると、記憶装置に書き込んだ書き換えプログラムと、ベリファイプログラムとを照合し、書き換えプログラムが正常に書き込まれたか否かを検証し、ベリファイが完了した場合にはベリファイ応答を送信する。
After the rewriting of the program is completed, verification for verifying whether the program has been rewritten normally is performed. When the microcomputer acquires the verify request command for verifying whether or not the rewrite program transmitted from the
図3は、ベリファイの一実施例を示す。図3は、記憶装置の領域の一例を示す。記憶装置には、書き換え対象外領域と、書き換え対象領域が設けられ、さらに書き換え対象外領域は、書き換え処理プログラム等のプログラム等が格納される領域と、空き領域とに区分される。図3において、ベリファイが行われる領域の範囲をハッチングにより表す。ベリファイが行われる領域は、書き換え対象領域と同一である。さらに、チェックデータBが書き込まれる領域が書き換え対象領域とされる。 FIG. 3 shows an example of verification. FIG. 3 shows an example of a storage device area. The storage device is provided with an area not to be rewritten and an area to be rewritten, and the area not to be rewritten is divided into an area in which a program such as a rewrite processing program is stored and an empty area. In FIG. 3, the range of the area where the verification is performed is indicated by hatching. The area to be verified is the same as the rewrite target area. Further, an area where the check data B is written is set as a rewrite target area.
書き換えツールは、書き換えプログラムと同じベリファイプログラムを最小のメモリアドレスから順にECU100へ送信する。ECU100のマイコンは、書き換えツールから送信されるベリファイプログラムに基づいて、ベリファイプログラムが送信される順に最小のメモリアドレスから矢印の方向にベリファイを行い(図3の左から右の方向にベリファイを行い、右端まで書き込んだら次の番地について左から右の方向にベリファイを行う)、チェックデータB(送信されたプログラムの最後)の手前のワードまでベリファイを行った後、書き換えツールから送信されるチェックデータBを書き込む。なお、チェックデータBが格納される(含まれる)メモリブロックは、プログラムの書き込みの際に一旦消去されているため、改めて消去する必要はない。チェックデータBを書き込んだ後に、このチェックデータBと、既に書き込んであるチェックデータAが同じか否かを照合する。
The rewrite tool transmits the same verify program as the rewrite program to the
書き換えプログラムを書き込む処理ではチェックデータBは書き込まず、チェックデータBの手前のワードまで書き込んだときに、書き込み完了の書き込み応答を返す。この時点では、チェックデータAの値、及びチェックデータBの値が一致しないことによって、ベリファイが正常に終了していないことを認識できる。例えば、プログラムの書き換えが終了した時点で電源遮断があった場合には、チェックデータAは書き換えられているが、ベリファイの最後の時点で書き換えられるチェックデータBは書き換えられていない。したがって、次回の電源投入の際に、チェックデータAの値と、チェックデータBの値とが一致しないことによって、ベリファイが正常に行われていないことを認識できる。 In the process of writing the rewrite program, the check data B is not written, but when the word before the check data B is written, a write response indicating completion of writing is returned. At this time, it can be recognized that the verification has not been completed normally because the value of the check data A and the value of the check data B do not match. For example, when the power is shut off at the time when rewriting of the program is completed, the check data A is rewritten, but the check data B that is rewritten at the last time of verification is not rewritten. Therefore, when the power is turned on next time, the value of the check data A and the value of the check data B do not match, so that it can be recognized that the verification is not normally performed.
また、チェックデータAのサイズ、及びチェックデータBのサイズは、例えば、各々4バイト程度で済むため、車両プログラムを格納するメモリ容量を圧迫することなく、ベリファイが正常に行われたか否かを認識できる。 In addition, the size of check data A and check data B is about 4 bytes each, so it is recognized whether or not the verification has been performed normally without squeezing the memory capacity for storing the vehicle program. it can.
また、チェックデータを含む書き換え対象領域の全領域について、ベリファイを行うことができる。 In addition, verification can be performed on the entire rewrite target area including check data.
<ECU100の動作>
図4は、プログラム書き換えツール200を用いて、ECU100にプログラムを書き込む処理の一例を示す。
<Operation of ECU100>
FIG. 4 shows an example of processing for writing a program to the
ステップS402では、書き換えツール200からECU100に対して、パスワード照合等のセキュリティアクセスが行われる。
In step S402, the
ステップS404では、ECU100は、書き換えツール200からのセキュリティアクセスに対して、パスワードを照合し、一致した場合等に、書き換えツール200に対してプログラムの書き込みを許可するセキュリティアクセス応答を返す。
In step S404, the
ステップS406では、書き換えツール200は、ECU100からセキュリティアクセス応答を受信すると、ECU100に対して、書き込み対象のアドレス範囲を消去することを要求する消去要求コマンドを送信する。消去要求コマンドには、ベリファイの際に、チェックデータBを書き込む領域を表すアドレス範囲も指定される。
In step S406, when the
ステップS408では、ECU100は、書き換えツール200からの消去要求コマンドを受信すると、要求されたアドレス範囲のフラッシュメモリの消去を行う。
In step S408, when the
ステップS410では、ECU100は、要求されたアドレス範囲のフラッシュメモリの消去が完了した後、書き換えツール200に対して、消去が完了したことを通知する消去応答を送信する。
In step S410, after the flash memory in the requested address range is completely erased, the
ステップS412では、書き換えツール200は、ECU100から送信される消去応答を受信した後、ECU100に対して、書き込みを要求する書き込み要求コマンド、及び書き込みデータ(書き換えプログラム)を送信する。書き込み要求コマンドには、どのアドレスからどのサイズのデータを書き込むかを表す情報が付帯される。
In step S <b> 412, after receiving the erase response transmitted from the
ステップS414では、ECU100は、書き換えツール200から送信される書き込み要求コマンド、及び書き込みデータを受信すると、書き込み要求コマンドにしたがって、要求されたアドレス範囲にデータを書き込む。
In step S414, upon receiving the write request command and write data transmitted from the
ステップS416では、ECU100は、要求されたアドレス範囲にデータの書き込みが完了したら、書き込みが完了したことを通知する書き込み応答を返す。
In step S416, when the writing of data to the requested address range is completed, the
ステップS418では、書き換えツール200は、ECU100から送信される書き込み応答を受信すると、ECU100に対して、ベリファイ要求コマンド、及びベリファイデータ(ベリファイプログラム)を送信する。ベリファイ要求コマンドには、どのアドレスからどのサイズのデータについてベリファイを行うかを表す情報が付帯される。ベリファイデータは、ステップS412で書き換えツール200から送信された書き込みデータと同じである。
In step S418, upon receiving a write response transmitted from the
ステップS420では、ECU100は、ベリファイ要求コマンドにしたがって、ベリファイ要求コマンドに付帯されるアドレス範囲に書き込まれているデータと、書き換えツール200から送信されたベリファイデータとを照合する。
In step S420, the
ステップS422では、ECU100は、要求されたアドレス範囲のデータについてベリファイが完了した場合、書き換えツール200にベリファイが完了したことを通知するベリファイ応答を送信する。
In step S422, when the verification is completed for the data in the requested address range, the
図5、及び図6は、ECU100の動作の一実施例を示す。図5は、ECU100における書き換えプログラムの書き込み処理の一実施例を示す。つまり、図5は、図3のステップS414に対応する処理を示す。
5 and 6 show an embodiment of the operation of the
図5は、書き換えプログラムの送信に先立って、書き換えツール200からのパスワードの照合などのセキュリティアクセスに応じて、ECU100がセキュリティアクセス応答を送信した後の動作を示す。書き換えツール200は、書き換えプログラムを最小のメモリアドレスから順にECU100へ送信する。
FIG. 5 shows an operation after the
ステップS502では、ECU100のマイコンは、書き込み対象が最終アドレスであるか否かを判定する。
In step S502, the microcomputer of the
ステップS504では、ECU100のマイコンは、書き込み対象が最終アドレスであると判定した場合、書き換えツール200へ、書き込み完了の書き込み応答を返す。
In step S504, when the microcomputer of the
ステップS506では、ECU100のマイコンは、書き込み対象が最終アドレスでないと判定した場合、書き換えツール200から送信されてきたデータを記憶装置へ書き込む。その後、ステップS502からの処理が行われる。
In step S506, when the microcomputer of the
図6は、書き換えプログラムへの書き換えが終了した後、プログラムが正常に書き換えられたか否かを検証するベリファイ処理の動作を示す。書き換えツール200は、ベリファイプログラム(書き換えプログラム)を最小のメモリアドレスから順にECU100へ送信する。
FIG. 6 shows an operation of verify processing for verifying whether or not the program has been normally rewritten after rewriting to the rewrite program is completed. The
ステップS602では、ECU100のマイコンは、ベリファイ対象が最終アドレスであるか否かを判定する。
In step S602, the microcomputer of the
ステップS604では、ECU100のマイコンは、ベリファイ対象が最終アドレスであると判定した場合、書き換えツール200から送信されてきたデータ(チェックデータB)を書き込む。
In step S604, when the microcomputer of the
ステップS606では、ECU100のマイコンは、ステップS604で書き込んだチェックデータBと、既に書き込んであるチェックデータAとを照合する。
In step S606, the microcomputer of the
ステップS608では、ECU100のマイコンは、チェックデータBと、チェックデータAとの照合の結果、全てのデータが一致するか否かを判定する。
In step S608, the microcomputer of the
ステップS610では、ステップS608において、全てのデータが一致すると判定した場合、ECU100のマイコンは、正常にベリファイが終了したことを書き換えツール200へ通知する。
In step S610, if it is determined in step S608 that all the data match, the microcomputer of the
ステップS612では、ステップS608において、全てのデータが一致すると判定しない場合、ECU100のマイコンは、ベリファイが異常終了したことを書き換えツール200へ通知する。
In step S612, if it is not determined in step S608 that all the data match, the microcomputer of the
ステップS614では、ステップS602において、ベリファイ対象が最終アドレスでないと判定した場合、ECU100のマイコンは、書き換えツール200から送信されてきたデータと、記憶装置に書き込まれているデータとを照合する。
In step S614, when it is determined in step S602 that the verification target is not the final address, the microcomputer of the
ECU100の一実施例によれば、書き換えプログラムへの書き換え後のベリファイの際に、電源遮断等によってベリファイが中断したとしても、その識別用に特別な領域を設けることなく、次回の立ち上げの際にベリファイが中断したことを検出できる。
According to one embodiment of the
<本願発明の効果>
図7は、プログラムの書き換え処理の従来例(その1)を示す。図7は、記憶装置の領域の一例を示す。記憶装置には、書き換え対象外領域と、書き換え対象領域が設けられ、さらに書き換え対象外領域は、書き換え処理プログラム等のプログラム等が格納される領域と、空き領域とに区分される。図7において、書き換える領域の範囲をハッチングにより表す。従来例では、書き換える領域にチェックデータA、及びチェックデータBが書き込まれる領域が用意される。つまり、ECUのマイコンは、チェックデータB(送信されたプログラムの最後)まで書き込んだときに書き込み完了の書き込み応答を返す。この場合、書き換えの途中で電源遮断等によって書き換えが中断した場合、チェックデータAの値と、チェックデータBの値とが一致しないため、正常に書き換えが終了しなかったことは検証できる。逆に、チェックデータAの値と、チェックデータBの値とが一致する場合には、正常に書き換えが終了したと判定できる。なお、図7では、プログラムの書き換えの途中でデータ化けが発生した状態を示す。
<Effect of the present invention>
FIG. 7 shows a conventional example (part 1) of the program rewriting process. FIG. 7 shows an example of a storage device area. The storage device is provided with an area not to be rewritten and an area to be rewritten, and the area not to be rewritten is divided into an area in which a program such as a rewrite processing program is stored and an empty area. In FIG. 7, the range of the area to be rewritten is indicated by hatching. In the conventional example, an area in which check data A and check data B are written is prepared in an area to be rewritten. That is, the ECU microcomputer returns a write completion write response when writing up to check data B (the end of the transmitted program). In this case, when rewriting is interrupted due to power interruption or the like in the middle of rewriting, the value of check data A and the value of check data B do not match, so it can be verified that rewriting has not ended normally. On the contrary, when the value of the check data A matches the value of the check data B, it can be determined that the rewriting has been completed normally. FIG. 7 shows a state in which data corruption has occurred during program rewriting.
図8は、ベリファイの従来例(その1)を示す。図8に示されるように、ベリファイの途中で電源遮断等によってベリファイが中断した場合、データ化けの部分についてはベリファイが行われていないため、ECUのマイコンは、書き換えツールに異常が検出されたことを通知していない。ECUのみが電源遮断された場合には、その後は書き換えツールとの間の通信が成立しないため、書き換えツールは通信異常として、ベリファイが最後まで終了せずに中断したことを認識できる。書き換えツールによってベリファイが最後まで終了せずに中断したことを認識できた場合には、ECUの電源が再投入した後に、再度ベリファイを行うことが可能である。 FIG. 8 shows a conventional example (1) of verification. As shown in Fig. 8, when the verification is interrupted due to the power shutoff during the verification, because the verification is not performed for the data corruption part, the ECU microcomputer has detected an abnormality in the rewriting tool. Not notified. When only the ECU is turned off, communication with the rewriting tool is not established after that, so the rewriting tool can recognize that the verification has been interrupted without ending the verification as a communication error. If the rewriting tool can recognize that the verification has been interrupted without completing it, the verification can be performed again after the ECU power is turned on again.
しかし、ECUとともに書き換えツールの電源が遮断された場合には、その後に電源が投入されても、書き換えツールは前回のベリファイが正常に終了したか否かは認識できないため、前回のベリファイが正常に終了したと誤認識した場合には、書き込みにデータ化け等の異常があったことを認識できない。 However, if the power of the rewrite tool is cut off together with the ECU, even if the power is turned on after that, the rewrite tool cannot recognize whether or not the previous verify has been completed normally. If it is mistakenly recognized as being completed, it cannot be recognized that there was an abnormality such as garbled data in writing.
図9は、プログラムの書き換え処理の従来例(その2)を示す。図9は、記憶装置の領域の一例を示す。記憶装置には、書き換え対象外領域と書き換え対象領域が設けられ、さらに書き換え対象外領域は書き換え処理プログラム等のプログラム等が格納される領域と空き領域とに区分され、書き換え対象領域には書き換えステータスを書き込む領域が設けられる。図9において、書き換える領域の範囲をハッチングにより表す。 FIG. 9 shows a conventional example (part 2) of the program rewriting process. FIG. 9 shows an example of a storage device area. The storage device is provided with a non-rewrite area and a rewrite area, and the non-rewrite area is divided into an area where a program such as a rewrite processing program is stored and an empty area. An area for writing is provided. In FIG. 9, the range of the area to be rewritten is indicated by hatching.
書き換えステータスは、正常に書き換えができたか否かを確認するためのデータであり、予めプログラムに埋め込まれる。プログラムに埋め込まれるデータは書き換えが完了していないこと(以下、「書き換え未完了」という)を示す。ECUのマイコンは、プログラムの書き換えが終了し、続くベリファイも正常に終了した後に、書き換えステータスを書き換え完了を示すデータに書き換える。これにより、ベリファイが正常に終了しない限りは、書き換えステータスは「書き換え未完了」のままであるので、ECUは、次回の電源投入の際に、書き換えステータスを確認することによって正常に書き込まれているか否かを確実に判定できる。なお、図9では、プログラムの書き換えの途中でデータ化けが発生した状態を示す。 The rewrite status is data for confirming whether or not rewriting has been normally performed, and is embedded in the program in advance. The data embedded in the program indicates that rewriting has not been completed (hereinafter referred to as “rewriting incomplete”). The microcomputer of the ECU rewrites the rewrite status to data indicating completion of rewriting after the rewriting of the program is completed and the subsequent verification is normally completed. As a result, the rewrite status remains “incomplete rewrite” unless the verification is normally completed. Therefore, is the ECU written correctly by checking the rewrite status at the next power-on? Whether or not can be determined reliably. FIG. 9 shows a state in which data corruption has occurred during program rewriting.
図10は、ベリファイの従来例(その2)を示す。図10に示されるように、ベリファイの途中で電源遮断等によってベリファイが中断した場合、データ化けの部分についてはベリファイが行われていないため、ECUのマイコンは、書き換えツールに異常が検出されたことを通知していない。しかし、ベリファイが終了していないため書き換えステータスは「書き換え未完了」のままである。したがって、電源が再投入された場合には、ECUは、書き換えステータスの情報を用いて、ベリファイが正常に終了しなかったことを認識できる。 FIG. 10 shows a conventional example (part 2) of verification. As shown in FIG. 10, when the verification is interrupted during the verification due to the power shut-off etc., the verification of the data garbled part has not been performed. Not notified. However, since the verification has not been completed, the rewrite status remains “incomplete rewrite”. Therefore, when the power is turned on again, the ECU can recognize that the verification has not been completed normally by using the rewrite status information.
しかし、この手法では、書き換えステータスの書き込みの際に一旦書き込んだ書き換え未完了を、ベリファイの終了後に書き換え完了に書き換えるため、フラッシュメモリの特性上、書き換えステータスを書き込む領域を含む消去可能単位分のフラッシュメモリ(以下、「メモリブロック」という)を一旦消去しなければならない。仮に、書き換えステータスのデータ長が4バイトだとしても、メモリブロックは、一般的には、数KB-数十KBオーダであるため、書き換えステータスを書き込む領域として、数KB-数十KB確保しなければならない。コストの制約から、元々小容量のメモリ容量しか用意できないECUにとっては、本来の車両制御プログラムのメモリ容量を圧迫することになる。特に、メモリブロックのサイズが全フラッシュメモリサイズに対して大きい場合には、プログラムを格納する領域を圧迫する場合がある。この場合、ワンランク上のメモリサイズのフラッシュメモリを用意しなければならず、コストアップとなる。 However, this method rewrites the incomplete rewrite that was once written at the time of rewrite status write to the completion of rewrite after the end of verification. The memory (hereinafter referred to as “memory block”) must be erased once. Even if the data length of the rewrite status is 4 bytes, the memory block is generally on the order of several KB to several tens of KB, so several KB to several tens of KB must be secured as an area for writing the rewrite status. I must. Due to cost constraints, ECUs that originally have only a small memory capacity will put pressure on the memory capacity of the original vehicle control program. In particular, when the memory block size is larger than the total flash memory size, the area for storing the program may be compressed. In this case, it is necessary to prepare a flash memory having a higher memory size, which increases the cost.
また、ベリファイの終了後に書き換えられる書き換えステータスが正しく書き換えられたか否かを確認できない。 Further, it cannot be confirmed whether or not the rewrite status to be rewritten after the end of verification is correctly rewritten.
制御装置の一実施例によれば、プログラムの書き換えの際に、ベリファイの終了の際にチェックデータBを書き込む領域のデータが消去されるとともに、チェックデータAを書き込み、ベリファイの終了の際にチェックデータBを書き込むことによって、メモリブロックの消去の必要がないため、無駄な領域を確保する必要がない。 According to one embodiment of the control device, when the program is rewritten, the data in the area where the check data B is written at the end of the verification is erased, and the check data A is written and checked at the end of the verification. By writing data B, there is no need to erase the memory block, so there is no need to secure a useless area.
以上、本発明は特定の実施例を参照しながら説明されてきたが、各実施例は単なる例示に過ぎず、当業者は様々な変形例、修正例、代替例、置換例等を理解するであろう。説明の便宜上、本発明の実施例に従った装置は機能的なブロック図を用いて説明されたが、そのような装置はハードウェアで、ソフトウェアで又はそれらの組み合わせで実現されてもよい。本発明は上記実施例に限定されず、本発明の精神から逸脱することなく、様々な変形例、修正例、代替例、置換例等が包含される。 Although the present invention has been described above with reference to specific embodiments, each embodiment is merely an example, and those skilled in the art will understand various variations, modifications, alternatives, substitutions, and the like. I will. For convenience of explanation, an apparatus according to an embodiment of the present invention has been described using a functional block diagram, but such an apparatus may be implemented in hardware, software, or a combination thereof. The present invention is not limited to the above-described embodiments, and various variations, modifications, alternatives, substitutions, and the like are included without departing from the spirit of the present invention.
50 通信線
100 電子制御装置
200 書き換えツール
300 外部機器接続用コネクタ
50
Claims (1)
前記プログラムを記憶部に書き込む際に、該プログラムに埋め込まれたチェックデータA、及び該チェックデータAと同じデータであるチェックデータBのうち、チェックデータAを前記記憶部に書き込み、
前記プログラムを前記記憶部に書き込んだ後に、該プログラムが正常に書き込まれたか否かを検証するベリファイ処理の際に、前記ツールから検証用のプログラムを受信し、
前記検証用のプログラムに基づいて、前記記憶部に書き込んだプログラムを検証するとともに、前記検証用のプログラムに埋め込まれた前記チェックデータBを前記記憶部に書き込み、
前記記憶部に書き込まれているチェックデータAと、前記記憶部に書き込んだチェックデータBとを照合し、一致する場合に正常に書き込まれたことを前記ツールに通知する、プログラム書き換え方法。 Receive the program sent from the tool,
When writing the program to the storage unit, the check data A embedded in the program and the check data B that is the same data as the check data A, the check data A is written to the storage unit,
After the program is written in the storage unit, a verification program is received from the tool during a verification process for verifying whether the program has been normally written,
Based on the verification program, the program written in the storage unit is verified, and the check data B embedded in the verification program is written in the storage unit,
A method for rewriting a program, wherein the check data A written in the storage unit and the check data B written in the storage unit are collated, and if they match, the tool is notified of successful writing.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2014091870A JP6094523B2 (en) | 2014-04-25 | 2014-04-25 | Program rewriting method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2014091870A JP6094523B2 (en) | 2014-04-25 | 2014-04-25 | Program rewriting method |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2015210669A true JP2015210669A (en) | 2015-11-24 |
JP6094523B2 JP6094523B2 (en) | 2017-03-15 |
Family
ID=54612803
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2014091870A Active JP6094523B2 (en) | 2014-04-25 | 2014-04-25 | Program rewriting method |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP6094523B2 (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2018200599A (en) * | 2017-05-29 | 2018-12-20 | 矢崎総業株式会社 | Rewriting system, rewriting device, and computer |
JP2019101456A (en) * | 2017-11-28 | 2019-06-24 | 株式会社デンソー | Electronic control device and control device |
US10936236B2 (en) | 2017-04-12 | 2021-03-02 | Yazaki Corporation | Rewriting system, rewriting device and computer |
JP2021089643A (en) * | 2019-12-05 | 2021-06-10 | 株式会社ミツバ | Electronic control apparatus and electronic control method |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2000105694A (en) * | 1998-09-28 | 2000-04-11 | Nec Ic Microcomput Syst Ltd | Flash memory, microcomputer equipped with flash memory, and method for storing program in flash memory |
JP2009087107A (en) * | 2007-10-01 | 2009-04-23 | Hitachi Ltd | Control system for vehicle |
-
2014
- 2014-04-25 JP JP2014091870A patent/JP6094523B2/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2000105694A (en) * | 1998-09-28 | 2000-04-11 | Nec Ic Microcomput Syst Ltd | Flash memory, microcomputer equipped with flash memory, and method for storing program in flash memory |
JP2009087107A (en) * | 2007-10-01 | 2009-04-23 | Hitachi Ltd | Control system for vehicle |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US10936236B2 (en) | 2017-04-12 | 2021-03-02 | Yazaki Corporation | Rewriting system, rewriting device and computer |
JP2018200599A (en) * | 2017-05-29 | 2018-12-20 | 矢崎総業株式会社 | Rewriting system, rewriting device, and computer |
JP2019101456A (en) * | 2017-11-28 | 2019-06-24 | 株式会社デンソー | Electronic control device and control device |
JP2021089643A (en) * | 2019-12-05 | 2021-06-10 | 株式会社ミツバ | Electronic control apparatus and electronic control method |
Also Published As
Publication number | Publication date |
---|---|
JP6094523B2 (en) | 2017-03-15 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20200310782A1 (en) | Gateway device, in-vehicle network system, and firmware update method | |
CN109923518B (en) | Software update mechanism for safety critical systems | |
JP4980064B2 (en) | Method for differentially updating data stored in portable terminal from first data version to updated data version, portable terminal and computer program | |
US8290660B2 (en) | Data access to electronic control units | |
CN102934089B (en) | Error detection for files | |
US11842185B2 (en) | Gateway device, in-vehicle network system, and firmware update method | |
JP6094523B2 (en) | Program rewriting method | |
US11182485B2 (en) | In-vehicle apparatus for efficient reprogramming and controlling method thereof | |
US20150363187A1 (en) | Systems and methods for installing upgraded software on electronic devices | |
CN110809755A (en) | Electronic control system | |
CN103198270A (en) | Using a manifest to record presence of valid software and calibration | |
WO2020158377A1 (en) | Electronic control device and security verification method for electronic control device | |
JP2019109745A (en) | Automobile electronic controller | |
EP2709073B1 (en) | Electronic control unit of vehicle | |
CN111223517B (en) | EEPROM recovery method of slave device in PLC communication module | |
CN115454517B (en) | Method, system, storage medium, device and chip for multi-medium secure boot | |
JP5868563B1 (en) | Control device and unit for distributed control system | |
US20190163380A1 (en) | Rewriting checking device, rewriting checking method, and non-transitory computer readable medium for rewriting checking | |
CN101661399B (en) | Method for modular software removal | |
CN111984284B (en) | Data rewriting method and data rewriting system | |
JP2019061520A (en) | Electronic control device and control program verification method | |
KR20140072933A (en) | Method of storing vehicle identification number, apparatus performing the same and system perfroming the same | |
JP2007257386A (en) | Method and system for verifying data for vehicle electronic controller | |
US11068198B2 (en) | Data verification apparatus | |
JP2006139341A (en) | Nonvolatile memory system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20160613 |
|
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: 20170117 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20170130 |
|
R151 | Written notification of patent or utility model registration |
Ref document number: 6094523 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R151 |