JP5821788B2 - Electronic control unit - Google Patents
Electronic control unit Download PDFInfo
- Publication number
- JP5821788B2 JP5821788B2 JP2012139908A JP2012139908A JP5821788B2 JP 5821788 B2 JP5821788 B2 JP 5821788B2 JP 2012139908 A JP2012139908 A JP 2012139908A JP 2012139908 A JP2012139908 A JP 2012139908A JP 5821788 B2 JP5821788 B2 JP 5821788B2
- Authority
- JP
- Japan
- Prior art keywords
- control program
- program
- nonvolatile memory
- termination
- information
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Landscapes
- Stored Programmes (AREA)
Description
本発明は、制御プログラムと埋め込みコードとが書き込まれた不揮発性メモリと、外部装置から送られてくる制御プログラムを保存する保存部と、書換プログラムにしたがって、不揮発性メモリに書き込まれた制御プログラムを、保存部に保存された制御プログラムに書き換えるCPUと、を備える電子制御装置に関するものである。 The present invention relates to a nonvolatile memory in which a control program and an embedded code are written, a storage unit for storing a control program sent from an external device, and a control program written in the nonvolatile memory in accordance with the rewriting program. The present invention relates to an electronic control device including a CPU that rewrites a control program stored in a storage unit.
従来、例えば特許文献1に示されるように、通常時には内蔵プログラム及び内蔵データに基づく制御処理を実行することにより所定の制御対象を制御し、外部装置からの書き換え指令があった場合には、内蔵プログラム又は内蔵データを外部装置から送信される新たなプログラム又はデータに書き換えるための書換処理を実行する電子制御装置が提案されている。 Conventionally, for example, as shown in Patent Document 1, a predetermined control target is controlled by executing a control process based on a built-in program and built-in data in a normal state, and when there is a rewrite command from an external device, There has been proposed an electronic control device that executes a rewriting process for rewriting a program or built-in data with a new program or data transmitted from an external device.
特許文献1に示される電子制御装置では、メモリ領域に、上記した内蔵プログラム及び内蔵データが書き込まれている。通常、メモリ領域のサイズは、上記した内蔵プログラムと内臓データそれぞれのサイズの和よりも大きく、その空き領域には、エラーを通知する埋め込みコードが書き込まれている。 In the electronic control device disclosed in Patent Document 1, the above-described built-in program and built-in data are written in the memory area. Usually, the size of the memory area is larger than the sum of the sizes of the built-in program and the built-in data, and an embedded code for notifying an error is written in the empty area.
これに対して、特許文献1に示される電子制御装置は、内蔵プログラムや内蔵データのサイズ、及び、新たに書き換えられるプログラムやデータのサイズそれぞれに関する情報を有していない。そのため、書換処理を実行する際、新たに書き込まれるプログラムやデータを確実にメモリ領域に書き込むために、メモリ領域に書き込まれた、内蔵プログラムや内蔵データだけではなく、埋め込みコードも全て消去しなくてはならなかった。 On the other hand, the electronic control device disclosed in Patent Document 1 does not have information on the size of the built-in program and the built-in data, and the size of the newly rewritten program and data. Therefore, when executing rewrite processing, not only the built-in program and built-in data written to the memory area but also all embedded codes must be erased in order to reliably write the newly written program and data to the memory area. I didn't.
埋め込みコードは、エラーを通知するためのコードであり、各アドレスに書き込まれる埋め込みコードは、全て同一である。このように、埋め込みコードは、書き込まれるアドレスには依存しない。したがって、書換処理の際には、新たに書き換えられるプログラムやデータのサイズを確保する分だけの埋め込みコードを消去すればよい。しかしながら、上記したように、特許文献1に示される電子制御装置は、新たに書き換えられるプログラムやデータのサイズそれぞれに関する情報を有していない。そのため、新たに書き込まれるプログラムやデータを確実にメモリ領域に書き込むためには、埋め込みコードの全てを消去しなくてはならず、余分に埋め込みコードが消去されることとなる。この結果、消去時間が余分にかかった。また、新たにプログラムやデータを書き込んだ際、余ったアドレスに埋め込みコードを書き込まなくてはならなくなるが、その書き込み時間が余分にかかった。このように、余分な埋め込みコードの消去と書き込みの分、書き換えに時間がかかる、という問題があった。 The embedded code is a code for notifying an error, and the embedded code written in each address is the same. Thus, the embedded code does not depend on the address to be written. Therefore, in the rewriting process, it is only necessary to delete the embedded code as much as the size of the newly rewritten program or data is secured. However, as described above, the electronic control device disclosed in Patent Document 1 does not have information regarding the size of a newly rewritten program or data. Therefore, in order to reliably write a newly written program or data to the memory area, all of the embedded code must be erased, and the embedded code is erased extra. As a result, it took extra time to erase. In addition, when a new program or data is written, it is necessary to write an embedded code at a surplus address, but the writing time is excessive. As described above, there is a problem that rewriting takes time for erasing and writing of an extra embedded code.
これに対して、内蔵プログラムや内蔵データのサイズ、及び、新たに書き換えられるプログラムやデータのサイズそれぞれに関する情報をスキャンした後、必要な分、埋め込みコードを増減する、という方法も考えられる。しかしながら、そのスキャンの時間分、書き換えに時間がかかる、という問題があった。 On the other hand, a method of increasing / decreasing the number of embedded codes as necessary after scanning information on the size of the built-in program or built-in data and the size of the newly rewritten program or data can be considered. However, there is a problem that rewriting takes time for the scanning time.
そこで、本発明は上記問題点に鑑み、書換時間の短縮された電子制御装置を提供することを目的とする。 In view of the above problems, an object of the present invention is to provide an electronic control device with a shortened rewrite time.
上記した目的を達成するために、本発明は、第1制御プログラム及び埋め込みコードが書き込まれた不揮発性メモリ(50)と、外部装置から送られてくる第2制御プログラムを保存する保存部(30)と、書換プログラムにしたがって、不揮発性メモリに書き込まれた第1制御プログラムを、保存部に保存された第2制御プログラムに書き換えるCPU(70)と、を有する電子制御装置であって、不揮発性メモリには、第1制御プログラムと埋め込みコードの他に、第1制御プログラムの終端アドレスを示す第1終端情報が書き込まれ、保存部には、第2制御プログラムの他に、第2制御プログラムの終端アドレスを示す第2終端情報が保存され、書換プログラムは、不揮発性メモリ若しくは保存部に記憶され、不揮発性メモリにおける、第1終端情報と第2終端情報それぞれが格納される情報アドレス、及び、第1制御プログラム及び第2制御プログラムそれぞれの先頭アドレスは固定されており、書換プログラムには、第1制御プログラム、及び、第1終端情報を消去する消去プログラムと、第1終端情報、及び、第2終端情報それぞれに基づいて、第2制御プログラムの終端アドレスが、第1制御プログラムの終端アドレスと同一か否かを判定する判定プログラムと、該判定プログラムにて、両者の終端アドレスが同一の場合、第2制御プログラムと第2終端情報とを不揮発性メモリに書き込みし、両者の終端アドレスが異なる場合、埋め込みコードを増減して、第2制御プログラムと第2終端情報とを不揮発性メモリに書き込む書き込みプログラムと、が含まれていることを特徴とする。 In order to achieve the above object, the present invention provides a nonvolatile memory (50) in which a first control program and an embedded code are written, and a storage unit (30) for storing a second control program sent from an external device. ) And a CPU (70) for rewriting the first control program written in the nonvolatile memory into the second control program stored in the storage unit according to the rewriting program, In addition to the first control program and the embedded code, first end information indicating the end address of the first control program is written in the memory, and in addition to the second control program, the second control program is stored in the storage unit. Second end information indicating the end address is stored, and the rewrite program is stored in the non-volatile memory or storage unit. The information address where each of the first termination information and the second termination information is stored, and the first address of each of the first control program and the second control program are fixed, and the rewrite program includes the first control program, and Based on the erase program for erasing the first termination information, the first termination information, and the second termination information, it is determined whether the termination address of the second control program is the same as the termination address of the first control program. If the end address of both is the same in the determination program and the determination program, the second control program and the second end information are written to the nonvolatile memory. If the end addresses are different, the embedded code is increased or decreased. And a writing program for writing the second control program and the second termination information into the nonvolatile memory. And wherein the door.
このように本発明によれば、第1終端情報と第2終端情報それぞれに基づいて、第2制御プログラムを書き込むのに必要な分だけ埋め込みコードを増減する。これによれば、書き換えの際に、埋め込みコードの全てを消去する構成、及び、書き換えるデータのサイズをスキャンする構成それぞれと比べて、書換時間が短縮される。 As described above, according to the present invention, the number of embedded codes is increased or decreased by an amount necessary for writing the second control program based on the first termination information and the second termination information. According to this, at the time of rewriting, the rewriting time is shortened compared to the configuration in which all of the embedded code is erased and the configuration in which the size of data to be rewritten is scanned.
なお、本発明では、埋め込みコードを増減する、と表現しているように、埋め込みコードの増大も記している。これは、第2制御プログラムを書き換えるのに余分な埋め込みコードを消去したために生じる操作ではなく、CPU(70)の処理に依るものである。複数のアドレスに記憶されたデータをブロックとすると、CPU(70)は、このブロックを1単位(以下、ブロック単位と示す)として、不揮発性メモリ(50)に書き込まれたデータを消去する。新たに書き込まれる制御プログラムのサイズがブロック単位だけでは表されない場合、ある一つのブロックに、制御プログラムの一部が書き込まれる。この場合、そのブロックにおける制御プログラムの書き込まれていないアドレスが空きとなるので、この空いたアドレスに埋め込みコードを書き込む必要が生じる。この空いたアドレスを埋めるために、埋め込みコードを増大する、という操作が必要となるのである。ちなみに、第1制御プログラムよりも第2制御プログラムの方がデータサイズが小さい場合においても、空いたアドレスが生じる。そのため、この場合においても、空いたアドレスに埋め込みコードを書き込まなくてはならず、埋め込みコードを増大する、という操作が必要となる。 In the present invention, an increase in the number of embedded codes is also described as expressing that the number of embedded codes is increased or decreased. This is not an operation caused by erasing an extra embedded code to rewrite the second control program, but depends on the processing of the CPU (70). If the data stored at a plurality of addresses is a block, the CPU (70) erases the data written in the nonvolatile memory (50) with this block as one unit (hereinafter referred to as a block unit). When the size of a newly written control program is not expressed in units of blocks, a part of the control program is written in one block. In this case, since an address in which the control program is not written in that block becomes empty, it becomes necessary to write an embedded code in this empty address. In order to fill this vacant address, an operation of increasing the embed code is necessary. Incidentally, an empty address is generated even when the data size of the second control program is smaller than that of the first control program. Therefore, even in this case, it is necessary to write an embedded code at a vacant address, and an operation of increasing the embedded code is required.
ちなみに、第1終端情報は、第1制御プログラムの終端アドレス、若しくは、第1制御プログラムのデータサイズであり、第2終端情報は、第2制御プログラムの終端アドレス、若しくは、第2制御プログラムのデータサイズである。 Incidentally, the first end information is the end address of the first control program or the data size of the first control program, and the second end information is the end address of the second control program or the data of the second control program. Size.
以下、本発明の実施の形態を図に基づいて説明する。
(第1実施形態)
図1〜図9に基づいて、本実施形態に係る電子制御装置を説明する。図1に示すように、電子制御装置100は、要部として、送受信コントローラ10と、揮発性メモリ30と、不揮発性メモリ50と、CPU70と、を有する。
Hereinafter, embodiments of the present invention will be described with reference to the drawings.
(First embodiment)
The electronic control device according to the present embodiment will be described based on FIGS. As shown in FIG. 1, the
送受信コントローラ10は、外部装置90とのデータの送受信を行うものである。送受信コントローラ10を介して外部装置90から送られてきたデータは、CPU70にて受信されるとともに、揮発性メモリ30に一時的に記憶(保存)される。
The transmission /
揮発性メモリ30は、送受信コントローラ10を介して外部装置90から送られてくる制御プログラム、及び、終端情報を一時的に記憶するものである。具体的に言えば、揮発性メモリ30は、RAMであり、特許請求の範囲に記載の保存部に相当する。本実施形態では、外部装置90から送られてくる書換プログラムも、揮発性メモリ30に記憶される。
The
不揮発性メモリ50は、制御プログラム、埋め込みコード、及び、終端情報を記憶するものである。具体的に言えば、不揮発性メモリ50は、フラッシュメモリである。不揮発性メモリ50における、終端情報が格納される情報アドレス、及び、制御プログラムの先頭アドレスは固定されている。
The
終端情報は、制御プログラムの終端アドレスを示すデータであり、制御プログラムの終端アドレス、若しくは、制御プログラムのデータサイズである。終端情報が、制御プログラムのデータサイズである場合、CPU70は終端情報を読み込むことで、制御プログラムのデータサイズを判定する。これとは異なり、終端情報が、制御プログラムの終端アドレスである場合、上記したように、制御プログラムの先頭アドレスは固定されているので、CPU70は先頭アドレスと終端アドレスとを読み込むことで、制御プログラムのデータサイズを判定する。なお、埋め込みコードは、そのコードをCPU70が読み込んだ際に、エラーを通知するものである。
The end information is data indicating the end address of the control program, and is the end address of the control program or the data size of the control program. When the termination information is the data size of the control program, the
CPU70は、通常動作時において、不揮発性メモリ50に書き込まれた制御プログラムにしたがって動作し、書換動作時において、不揮発性メモリ50に書き込まれたデータ(制御プログラム、埋め込みコード、終端情報)を書き換えるものである。
The
外部装置90は、書換プログラム、制御プログラム、及び、終端情報を電子制御装置100に送信するものである。外部装置90は、先ず、書換プログラムを電子制御装置100に送信し、次に、終端情報を電子制御装置100に送信し、最後に、制御プログラムを電子制御装置100に送信する。したがって、揮発性メモリ50には、書換プログラム、終端情報、及び、制御プログラムが記憶される。
The
次に、不揮発性メモリ50に書き込まれたデータの書換である書換処理について、図2〜図9に基づいて説明する。その説明を簡便とするために、以下においては、不揮発性メモリ50に記憶されていた制御プログラムを第1制御プログラム、書き換えのために、外部装置90から送られてくる制御プログラムを第2制御プログラムと示す。また、第1制御プログラムの終端情報を第1終端情報、第2制御プログラムの終端情報を第2終端情報と示す。なお、図6〜図8では、空き領域(何もデータが書き込まれていないアドレス)をドットハッチングで示している。
Next, a rewriting process that is a rewriting of data written in the
図2及び図5に示すように、書換処理が行われる前の状態では、不揮発性メモリ50に、第1終端情報、第1制御プログラム、及び、埋め込みコードが書き込まれている。これに対して、揮発性メモリ30には、書換処理に関するデータは記憶されておらず、CPU70は、通常動作状態となっている。外部装置90から書換プログラムが送信され、書換プログラムが、揮発性メモリ30に記憶され、それがCPU70にて読み込まれると、CPU70は通常動作状態から書換動作状態へと移行する。
As shown in FIGS. 2 and 5, the first termination information, the first control program, and the embedded code are written in the
書換プログラムには、消去プログラム、判定プログラム、及び、書き込みプログラムが含まれており、CPU70は、これらのプログラムに従って書換処理を行う。消去プログラムは、第1制御プログラム、及び、第1終端情報を消去する指令を含む。判定プログラムは、第1終端情報、及び、第2終端情報それぞれに基づいて、第2制御プログラムの終端アドレスが、第1制御プログラムの終端アドレスと同一か否かを判定する指令を含む。書き込みプログラムは、判定プログラムにて、両者の終端アドレスが同一の場合、第2制御プログラムと第2終端情報とを不揮発性メモリ50に書き込みし、両者の終端アドレスが異なる場合、埋め込みコードを増減して、第2制御プログラムと第2終端情報とを不揮発性メモリ50に書き込む指令を含む。なお、判定プログラムは、第2制御プログラムの不揮発性メモリ50への書き込み後、不揮発性メモリ50に空き領域があるか否かを判定する指令も含んでいる。
The rewrite program includes an erase program, a determination program, and a write program, and the
ちなみに、揮発性メモリ30のメモリサイズは、書換処理時に必要となるデータのサイズよりも小さい。そのため、書換処理時に必要となるデータを、その利用時に、揮発性メモリ30に順次記憶させる必要がある。しかしながら、この点に関しては、第2終端情報が必要となるタイミング(後述する第1読み出し処理S20)において、書換プログラムと共に第2終端情報が揮発性メモリ30に記憶されていれば良く、本実施形態に係る電子制御装置100を説明する上において、特に問題となる点ではない。そのため、説明を簡便とするために、書換処理において、書換処理時に必要となるデータの全てが揮発性メモリ30に記憶されているとする(図2参照)。
Incidentally, the memory size of the
CPU70は、書換処理において、図3及び図4に示す処理を行い、不揮発性メモリ50に記憶されるデータを、図5〜図9のように書き換える。
In the rewriting process, the
CPU70は、図6に示すように、書換処理の始まりにおいて、先ず、第1制御プログラムを消去する。以上が、第1消去処理S10である。
As shown in FIG. 6, the
第1消去処理S10後、CPU70は、不揮発性メモリ50の情報アドレスに記憶された第1終端情報を読み出すと共に、揮発性メモリ30から第2終端情報を読み出す。以上が第1読み出し処理S20である。
After the first erasing process S <b> 10, the
第1読み出し処理S20後、CPU70は、第1終端情報と第2終端情報それぞれに基づいて、第2制御プログラムの終端アドレスが、第1制御プログラムの終端アドレスと同一か否かを判定する。具体的に言えば、第2制御プログラムが、第1制御プログラムよりもデータサイズが大きいか否かを判定する。以上が第1判定処理S30である。
After the first read process S20, the
第1判定処理S30にて、第2制御プログラムが、第1制御プログラムよりもデータサイズが大きいと判定された場合、CPU70は、図7に示すように、埋め込みコードを、第2制御プログラムを書き込むのに必要な分、消去する。以上が第2消去処理S40である。第2消去処理S40後、CPU70は、図4に示す処理S50へと移行する。
When it is determined in the first determination process S30 that the second control program has a data size larger than that of the first control program, the
これとは反対に、第1判定処理S30にて、第2制御プログラムが、第1制御プログラムよりもデータサイズが小さいと判定された場合、CPU70は、第2消去処理S40を行わずに、図4に示す処理S50へと移行する。
On the contrary, if it is determined in the first determination process S30 that the second control program has a smaller data size than the first control program, the
処理S30若しくは処理S40後、CPU70は、不揮発性メモリ50の情報アドレスに記憶された第1終端情報を消去する。以上が第3消去処理S50である。
After the process S30 or the process S40, the
第3消去処理S50後、CPU70は、揮発性メモリ30に記憶された第2終端情報を読み出して、情報アドレスに書き込む。以上が第1書き込み処理S60である。
After the third erasing process S50, the
第1書き込み処理S60後、CPU70は、図8に示すように、揮発性メモリ30に記憶された第2制御プログラムを読み出して、不揮発性メモリ50に書き込む。以上が第2書き込み処理S70である。
After the first write process S60, the
第2書き込み処理S70後、CPU70は、不揮発性メモリ50に空き領域があるか否かを判定する。以上が第2判定処理S80である。
After the second write process S70, the
第2判定処理S80にて、図8に示すように、不揮発性メモリ50に空き領域があると判定された場合、CPU70は、図9に示すように、空き領域に、埋め込みコードを書き込む。以上が第3書き込み処理S90である。第3書き込み処理S90後、CPU70は、書換処理を終了する。
In the second determination process S80, when it is determined that there is a free area in the
これとは反対に、第2判定処理S80にて、不揮発性メモリ50に空き領域がないと判定された場合、CPU70は、第3書き込み処理S90を行わずに、書換処理を終了する。
On the other hand, if it is determined in the second determination process S80 that there is no free space in the
以上の処理を経ることで、不揮発性メモリ50の書換が終了となる。なお、処理S10,S50は、消去プログラムにしたがって行われ、処理S20,S30,S80は、判定プログラムにしたがって行われ、処理S40,S60,S70,S90は、書き込みプログラムにしたがって行われる。
Through the above processing, rewriting of the
次に、本実施形態に係る電子制御装置100の作用効果を説明する。上記したように、第1終端情報と第2終端情報それぞれに基づいて、第2制御プログラムを書き込むのに必要な分だけ埋め込みコードを増減する。これによれば、書き換えの際に、埋め込みコードの全てを消去する構成、及び、書き換えるデータのサイズをスキャンする構成それぞれと比べて、書換時間が短縮される。
Next, functions and effects of the
なお、本実施形態では、処理S80、S90にて、不揮発性メモリ50に空き領域があるか否かを判定し、ある場合、空き領域に、埋め込みコードを書き込んでいる。これは、第2消去処理S40にて、第2制御プログラムを書き換えるのに余分な埋め込みコードを消去したために生じる操作だけではなく、CPU70の処理に依るものである。複数のアドレスに記憶されたデータをブロックとすると、CPU70は、このブロックを1単位(以下、ブロック単位と示す)として、不揮発性メモリ50に書き込まれたデータを消去する。新たに書き込まれる第2制御プログラムのサイズがブロック単位だけでは表されない場合、ある一つのブロックに、第2制御プログラムの一部が書き込まれる。この場合、そのブロックにおける第2制御プログラムの書き込まれていないアドレスが空きとなるので、この空いたアドレスに埋め込みコードを書き込む必要が生じる。この空いたアドレスを埋めるために、処理S80、S90にて、不揮発性メモリ50に空き領域があるか否かを判定し、ある場合、空き領域に、埋め込みコードを書き込む、という操作が必要となるのである。ちなみに、第1制御プログラムよりも第2制御プログラムの方がデータサイズが小さい場合においても、空き領域が生じる。そのため、この場合においても、空き領域に埋め込みコードを書き込まなくてはならず、埋め込みコードを増大する、という操作が必要となる。
In the present embodiment, it is determined in steps S80 and S90 whether or not there is an empty area in the
また、本実施形態では、図7に、第2消去処理S40を経ることで、当初不揮発性メモリ50に記憶された埋め込みコードの一部が消去された状態の不揮発性メモリ50の状態を示した。これに対して、図10に、第2消去処理S40を経ずに、当初不揮発性メモリ50に記憶された埋め込みコードが消去されず、そのまま残っている状態の不揮発性メモリ50を示す。第2制御プログラムが、第1制御プログラムよりもデータサイズが小さい場合、CPU70は、図11に示すように、第2終端情報と第2制御プログラムとを不揮発性メモリ50に書き込んだ後、不揮発性メモリ50に空き領域があるか否かを判定する。そして、CPU70は、不揮発性メモリ50に空き領域があると判定した場合、図12に示すように、空き領域に、埋め込みコードを書き込む。この空き領域は、第1制御プログラムと第2制御プログラムとのデータサイズの差によって生じたものであり、上記した、CPU70の処理に依るものではない。なお、説明の都合上、図6と図10とを区別して表記したが、図6と図10とは、実質的に同一の図面である。図6は、第1消去処理S10直後の不揮発性メモリ50に書き込まれたデータを示し、図10は、第2消去処理S40が行われずに、第3消去処理S50が行われる直前の不揮発性メモリ50に書き込まれたデータを示している。
Further, in the present embodiment, FIG. 7 shows the state of the
以上、本発明の好ましい実施形態について説明したが、本発明は上記した実施形態になんら制限されることなく、本発明の主旨を逸脱しない範囲において、種々変形して実施することが可能である。 The preferred embodiments of the present invention have been described above. However, the present invention is not limited to the above-described embodiments, and various modifications can be made without departing from the spirit of the present invention.
本実施形態では、制御プログラムと終端情報とが独立している例を示した。しかしながら、制御プログラムの中に、終端情報が含まれる構成を採用することもできる。この場合、CPU70は、図13に示すように、処理S10を行う前に、第1終端情報を読み出す第2読み出し処理S100を行う。そして、処理S10後、CPU70は、処理S20の代わりに、処理S110,S120を行う。すなわち、CPU70は、揮発性メモリ30の第2制御プログラムに含まれる第2終端情報を読み出す第3読み出し処理S110を行い、その読み出している間、第2制御プログラムの一部を、不揮発性メモリ50に書き込む処理をする第4書き込み処理S120を行う。第2終端情報を取得すると、CPU70は、処理S30へと移行し、第1実施形態で示した処理S30〜S90を行うことで、不揮発性メモリ50への書換処理を行う。このように、第2終端情報を読み出している際に、第2制御プログラムの一部が不揮発性メモリ50へ書き込まれるので、第1実施形態で示した書換処理と同等の早さにて、不揮発性メモリ50の書換が行われる。なお、第2書き込み処理S70においては、第4書き込み処理S120にて書き込みきれなかった第2制御プログラムの残りが、不揮発性メモリ50に書き込まれる。また、不揮発性メモリ50の情報アドレスには、制御プログラムに含まれる終端情報が書き込まれる。
In the present embodiment, an example is shown in which the control program and the termination information are independent. However, a configuration in which termination information is included in the control program can also be adopted. In this case, as shown in FIG. 13, the
本実施形態では、外部装置90から送られてくる書換プログラムが、揮発性メモリ30に記憶された例を示した。しかしながら、不揮発性メモリ50に記憶された書換プログラムが、揮発性メモリ30に記憶された構成を採用することもできる。
In the present embodiment, an example in which the rewriting program sent from the
30・・・揮発性メモリ
50・・・不揮発性メモリ
70・・・CPU
100・・・電子制御装置
30 ...
100 ... Electronic control device
Claims (2)
外部装置から送られてくる第2制御プログラムを保存する保存部(30)と、
書換プログラムにしたがって、前記不揮発性メモリに書き込まれた第1制御プログラムを、前記保存部に保存された第2制御プログラムに書き換えるCPU(70)と、を有する電子制御装置であって、
前記不揮発性メモリには、前記第1制御プログラムと前記埋め込みコードの他に、前記第1制御プログラムの終端アドレスを示す第1終端情報が書き込まれ、
前記保存部には、前記第2制御プログラムの他に、前記第2制御プログラムの終端アドレスを示す第2終端情報が保存され、
前記書換プログラムは、前記不揮発性メモリ若しくは前記保存部に記憶され、
前記不揮発性メモリにおける、前記第1終端情報と前記第2終端情報それぞれが格納される情報アドレス、及び、前記第1制御プログラム及び前記第2制御プログラムそれぞれの先頭アドレスは固定されており、
前記書換プログラムには、
前記第1制御プログラム、及び、前記第1終端情報を消去する消去プログラムと、
前記第1終端情報、及び、前記第2終端情報それぞれに基づいて、前記第2制御プログラムの終端アドレスが、前記第1制御プログラムの終端アドレスと同一か否かを判定する判定プログラムと、
該判定プログラムにて、両者の終端アドレスが同一の場合、前記第2制御プログラムと前記第2終端情報とを前記不揮発性メモリに書き込みし、両者の終端アドレスが異なる場合、前記埋め込みコードを増減して、前記第2制御プログラムと前記第2終端情報とを前記不揮発性メモリに書き込む書き込みプログラムと、が含まれていることを特徴とする電子制御装置。 A non-volatile memory (50) in which the first control program and the embedded code are written;
A storage unit (30) for storing the second control program sent from the external device;
A CPU (70) for rewriting a first control program written in the nonvolatile memory according to a rewrite program into a second control program stored in the storage unit;
In the nonvolatile memory, in addition to the first control program and the embedded code, first termination information indicating a termination address of the first control program is written,
The storage unit stores second termination information indicating a termination address of the second control program in addition to the second control program,
The rewrite program is stored in the nonvolatile memory or the storage unit,
In the non-volatile memory, information addresses where the first termination information and the second termination information are stored, respectively, and the first addresses of the first control program and the second control program are fixed,
The rewriting program includes
An erasing program for erasing the first control program and the first termination information;
A determination program for determining whether a termination address of the second control program is the same as a termination address of the first control program based on each of the first termination information and the second termination information;
In the determination program, when both end addresses are the same, the second control program and the second end information are written to the nonvolatile memory, and when the end addresses are different, the embedded code is increased or decreased. And a writing program for writing the second control program and the second termination information into the nonvolatile memory.
前記第2終端情報は、前記第2制御プログラムの終端アドレス、若しくは、前記第2制御プログラムのデータサイズであることを特徴とする請求項1に記載の電子制御装置。 The first termination information is a termination address of the first control program or a data size of the first control program.
The electronic control device according to claim 1, wherein the second termination information is a termination address of the second control program or a data size of the second control program.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2012139908A JP5821788B2 (en) | 2012-06-21 | 2012-06-21 | Electronic control unit |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2012139908A JP5821788B2 (en) | 2012-06-21 | 2012-06-21 | Electronic control unit |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JP2014006575A JP2014006575A (en) | 2014-01-16 |
| JP5821788B2 true JP5821788B2 (en) | 2015-11-24 |
Family
ID=50104265
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2012139908A Active JP5821788B2 (en) | 2012-06-21 | 2012-06-21 | Electronic control unit |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP5821788B2 (en) |
-
2012
- 2012-06-21 JP JP2012139908A patent/JP5821788B2/en active Active
Also Published As
| Publication number | Publication date |
|---|---|
| JP2014006575A (en) | 2014-01-16 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| JP4031190B2 (en) | MEMORY CARD, NONVOLATILE MEMORY, NONVOLATILE MEMORY DATA WRITE METHOD AND DATA WRITE DEVICE | |
| TWI436369B (en) | Methods for measuring usable lifespan and replacing an in-system programming code of a memory device, and data storage system using the same | |
| JP2018013837A (en) | Data rewriting device, data rewriting program | |
| CN105009096B (en) | Data storage device, data storage method, and vehicle-mounted control device | |
| JPWO2007000862A1 (en) | MEMORY CONTROLLER, NONVOLATILE MEMORY DEVICE, NONVOLATILE MEMORY SYSTEM, AND DATA WRITE METHOD | |
| JP4158526B2 (en) | Memory card and data writing method to memory | |
| CN111052075A (en) | Methods to improve the robustness of in-place firmware updates | |
| JP4843222B2 (en) | Semiconductor memory device control method, memory card, and host device | |
| JP5821788B2 (en) | Electronic control unit | |
| JP6636930B2 (en) | Microcomputer with built-in flash memory, method of writing data to flash memory built in microcontroller, and program for writing data to flash memory | |
| JP4997798B2 (en) | Nonvolatile semiconductor memory device and memory system | |
| US20110082995A1 (en) | Information processing apparatus | |
| JP5521477B2 (en) | Memory control device | |
| JP4602387B2 (en) | MEMORY CARD, NONVOLATILE MEMORY, NONVOLATILE MEMORY DATA WRITE METHOD AND DATA WRITE DEVICE | |
| US8954621B2 (en) | Peripheral, method of controlling peripheral, and firmware downloading system | |
| JP2013235530A (en) | Control device, storage device, and storage control method | |
| JP2014002478A (en) | Electronic controller | |
| JP2009223435A (en) | Data storage method and device, and program | |
| JP6334776B1 (en) | Electronic control unit | |
| JP2014071535A (en) | Memory management device, microcontroller and memory management method | |
| JP5976729B2 (en) | Electronics | |
| JP2015049722A (en) | Microcomputer and non-volatile memory block management method | |
| JP5939120B2 (en) | Flash memory data processing method and program for data processing | |
| JP4935101B2 (en) | Memory access method and apparatus | |
| JP2005276288A (en) | Lifetime management method of nonvolatile memory device |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20141024 |
|
| A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20150728 |
|
| 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: 20150908 |
|
| A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20150921 |
|
| R151 | Written notification of patent or utility model registration |
Ref document number: 5821788 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R151 |
|
| R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
| R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
| R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
| R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
| R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
| R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
| R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |