JP3805195B2 - Program rewriting apparatus and program rewriting method - Google Patents
Program rewriting apparatus and program rewriting method Download PDFInfo
- Publication number
- JP3805195B2 JP3805195B2 JP2000373709A JP2000373709A JP3805195B2 JP 3805195 B2 JP3805195 B2 JP 3805195B2 JP 2000373709 A JP2000373709 A JP 2000373709A JP 2000373709 A JP2000373709 A JP 2000373709A JP 3805195 B2 JP3805195 B2 JP 3805195B2
- Authority
- JP
- Japan
- Prior art keywords
- program
- rom
- control firmware
- host computer
- firmware
- 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.)
- Expired - Fee Related
Links
Images
Landscapes
- Stored Programmes (AREA)
Description
【0001】
【発明の属する技術分野】
本発明は、電子機器の動作を制御するファームウェアを記憶したマイコンシステムに、通信手段で接続されたホストコンピュータから別のファームウェアをダウンロードしてマイコンシステムのファームウェアを書き換えるプログラム書き換え装置及びプログラム書き換え方法に関する。
【0002】
【従来の技術】
電子機器の動作を制御するマイコンシステムは、制御プログラムであるファームウェアを格納したROMを有している。ファームウェアを変更するためにはROMを基板上から取り外し、別のファームウェアを格納したROMを再度実装する必要があり、工数がかかる問題があった。このため、特開平10−254694号公報には、ROMを基板上から取り外すことなくファームウェアを変更するプログラム書き換え装置が開示されている。
【0003】
このプログラム書き換え装置を図5に示すと、マイコンシステム10とホストコンピュータ30とは通信ケーブル41によって互いに接続されている。マイコンシステム10の各部の制御はCPU及び周辺ICを有するMPU11により行われる。MPU11にはバスラインによってフラッシュメモリ12、ドライバ13及びRAM14が接続されている。ドライバ13はホストコンピュータ30とファームウェアのデータや制御情報の受け渡しを行う。
【0004】
フラッシュメモリ12は不揮発性メモリから成っており、記憶内容を電気的に書き込み及び消去するとともに電源電圧の有無に関わらず記憶内容を保持する。フラッシュメモリ12には図6に示すように、スタートアッププログラム12a、予備プログラム12b及びダウンロードプログラム12cから成るファームウェアが記憶されている。
【0005】
スタートアッププログラム12aは、リセットによりマイコンシステム10が新たに起動された際の一連の手順が記されている。ダウンロードプログラム12cはRAM14にコピーされ、MPU11がRAM14に一時記憶されたプログラムを実行してマイコンシステム10の各部及び電子機器を制御する。予備プログラム12bはダウンロードプログラム12cが損傷した場合の予備のために、ダウンロードプログラム12cと同一の内容が記述されている。
【0006】
図7は、上記構成のデータ書き換え装置の動作を示すフローチャートである。ステップ#10ではフラッシュメモリ12に記憶されたダウンロードプログラム12cが正常か否かを確認する。正常な場合はステップ#11でダウンロードプログラム12cがRAM14にコピーされる。正常でない場合はステップ#12で予備プログラム12bがRAM14にコピーされる。RAM14に格納されたプログラムは実行プログラムとなり、ステップ#13で実行プログラムの先頭アドレスにポインタが設定される。
【0007】
RAM14に記憶された実行プログラムの実行によりホストコンピュータ30との通信が行われ、ステップ#14ではホストコンピュータ30からダウンロードプログラム12c用のデータをドライバ13で受信したか否かが判断される。受信しない場合はステップ#17に移行して通常の電子機器の制御処理がMPU11により行われる。受信があった場合はステップ#15で、RAM14に記憶された実行プログラムにより、フラッシュメモリ12に記憶されたダウンロードプログラム12cを消去する。
【0008】
そして、ステップ#16でホストコンピュータ30から受信したダウンロードプログラム12c用のデータをRAM14に記憶された実行プログラムによりフラッシュメモリ12に書き込む。そして、スタートアッププログラム12aを再起動して書き替えられたダウンロードプログラム12cをRAM14にコピーし、ステップ#17で新たな実行プログラムをMPU11により実行して電子機器の制御処理が行われる。このようにして、フラッシュメモリ12に記憶されている制御プログラム(12c)をホストコンピュータ30からオンラインで書き換えることができるようになっている。
【0009】
【発明が解決しようとする課題】
しかしながら上記の従来のプログラム書き換え装置によると、ダウンロードプログラム12cが損傷したときのためにフラッシュメモリ12内にダウンロードプログラム12cと同一の予備プログラム12bが配される。このため、使用頻度の少ない予備プログラム12bのためにフラッシュメモリ12から成るROMが大きな記憶容量を必要とし、プログラム書き換え装置のコストを高くする要因となっていた。
【0010】
また、一旦フラッシュメモリ12内のダウンロードプログラム12cをRAM14にコピーし、RAM14から通信プログラムや書き込みプログラム等を実行してフラッシュメモリ12内のダウンロードプログラム12cを書き換える必要がある。このため、RAM14は演算時の変数等の一時記憶だけでなくダウンロードプログラム12cの大きさのデータを全て一時記憶するために大きな記憶容量を必要としていた。
【0011】
本発明は、RAMやROMの記憶容量を削減できるプログラム書き換え装置及びプログラム書き換え方法を提供することを目的とする。
【0012】
【課題を解決するための手段】
上記目的を達成するために本発明のプログラム書き換え装置は、電子機器の動作を制御する制御用ファームウェアを記憶したマイコンシステムに、通信手段を介して接続されたホストコンピュータから別の制御用ファームウェアをダウンロードして前記マイコンシステムの制御用ファームウェアを書き換えるプログラム書き換え装置において、
前記マイコンシステムは、前記マイコンシステムを起動する起動プログラムと前記ホストコンピュータとの通信を行う通信プログラムとを有する起動用ファームウェアを記憶した第1ROMと、前記ホストコンピュータからダウンロードしたデータを一時記憶するRAMと、制御用ファームウェアを記憶する第2ROMとを備え、
第2ROMに記憶された制御用ファームウェアを消去するための消去プログラムと、第2ROMに制御用ファームウェアを書き込むための書き込みプログラムとを前記ホストコンピュータに配置し、前記ホストコンピュータから前記消去プログラムをダウンロードして第2ROMの制御用ファームウェアを消去した後、前記ホストコンピュータから前記書き込みプログラムをダウンロードして第2ROMに別の制御ファームウェアを書き込むことを特徴としている。
【0013】
この構成によると、制御用ファームウェアの書き換え時に第1ROMに記憶された起動用ファームウェアが実行されてマイコンシステムの立ち上げを行うとともにホストコンピュータと通信可能になる。これにより、ホストコンピュータから書き換え用の制御用ファームウェアがダウンロードされてRAMに記憶される。そして、第2ROM内の制御用ファームウェアが消去され、RAMから新たな制御用ファームウェアがコピーされる。
また、ホストコンピュータから制御用ファームウェアの消去プログラムがダウンロードされてRAMに記憶され、第2ROM内の制御用ファームウェアが消去プログラムにより消去される。その後、ホストコンピュータから制御用ファームウェアの書き込みプログラムがダウンロードされてRAMに記憶され、書き込みプログラムにより第2ROM内に制御用ファームウェアの書き込みが行われる。
【0014】
また本発明は、上記構成のプログラム書き換え装置において、前記ホストコンピュータから制御用ファームウェアを分割したブロック毎にダウンロードして前記RAMに記憶するとともに、前記RAMから第2ROMに前記ブロック毎に制御用ファームウェアを書き込み、前記RAMに記憶された制御用ファームウェアの前記ブロックは次にダウンロードされる前記ブロックにより順次上書きされることを特徴としている。
【0015】
この構成によると、制御用ファームウェアを分割して一部がRAMにダウンロードされると第2ROMに該一部が書き込まれ、次の一部がダウンロードしてRAMに上書きされると第2ROMに該一部が書き込まれる。この動作が繰り返し行われて第2ROMの制御用ファームウェアが書き換えられる。
【0019】
また本発明は、上記構成のプログラム書き換え装置において、第2ROM内に当初記憶された初期バージョンの制御用ファームウェアを、前記起動用ファームウェア内に含んだことを特徴としている。この構成によると、第2ROMに記憶された新たな制御用ファームウェアを消去することにより、元の制御用ファームウェアの動作を起動用ファームウェアにより実行することができる。
【0020】
また本発明は、上記構成のプログラム書き換え装置において、第1ROMは部分的に消去、書き込み可能な不揮発性メモリから成り、第2ROMを第1ROMと兼用したことを特徴としている。この構成によると、不揮発性メモリから成る第1ROMには起動用ファームウェアと制御用ファームウェアとが記憶され、起動用ファームウェアを残して制御用ファームウェアの書き換えが行われる。
【0021】
また本発明は、上記構成のプログラム書き換え装置において、第1ROMはマスクROM、PROM、フラッシュメモリのいずれかから成ることことを特徴としている。
【0022】
また本発明のプログラム書換え方法は、電子機器の動作を制御する制御用ファームウェアを記憶したマイコンシステムに、通信手段を介して接続されたホストコンピュータから別の制御用ファームウェアをダウンロードして前記マイコンシステムの制御用ファームウェアを書き換えるプログラム書き換え方法において、
前記マイコンシステムは、前記マイコンシステムを起動する起動プログラムと前記ホストコンピュータとの通信を行う通信プログラムとを有する起動用ファームウェアを記憶した第1ROMと、前記ホストコンピュータからダウンロードしたデータを一時記憶するRAMと、制御用ファームウェアを記憶する第2ROMと、を備え、
第2ROMに記憶された制御用ファームウェアを消去するための消去プログラムと、第2ROMに制御用ファームウェアを書き込むための書き込みプログラムとを前記ホストコンピュータに配置し、前記ホストコンピュータから前記消去プログラムをダウンロードして第2ROMの制御用ファームウェアを消去した後、前記ホストコンピュータから前記書き込みプログラムをダウンロードして第2ROMに別の制御ファームウェアを書き込むことを特徴としている。
【0024】
また本発明は、上記構成のプログラム書換え方法において、前記ホストコンピュータから制御用ファームウェアを分割したブロック毎にダウンロードして前記RAMに記憶するとともに、前記RAMから第2ROMに前記ブロック毎に制御用ファームウェアを書き込み、前記RAMに記憶された制御用ファームウェアの前記ブロックは次にダウンロードされる前記ブロックにより順次上書きされることを特徴としている。
【0025】
【発明の実施の形態】
以下に本発明の実施形態を図面を参照して説明する。図1は第1実施形態のプログラム書き換え装置の構成を示すブロック図である。プログラム書き換え装置はマイコンシステム1とホストコンピュータ2とが通信ケーブル3によって互いに接続されている。
【0026】
マイコンシステム1は通信インターフェース6を介してホストコンピュータ2とデータの送受信を行う。マイコンシステム1の各部の制御はCPU4により行われる。CPU4にはバスラインによって第1、第2ROM7、8、RAM14及び通信インターフェース6が接続されている。
【0027】
第1、第2ROM7、8はマスクROM、PROMまたはフラッシュメモリ等の不揮発性メモリから成っており、記憶内容を電気的に書き込み及び消去するとともに電源電圧の有無に関わらず記憶内容を保持する。第1ROM7には、リセットによりマイコンシステム10が新たに起動された際の一連の手順が記された起動プログラム及びホストコンピュータ2と通信を行うための通信プログラム等から成る起動用ファームウェアが記憶されている。起動プログラムには第2ROM8を認識するための認識プログラムが含まれている。
【0028】
第2ROM8には、マイコンシステム1に接続される電子機器を制御する制御プログラムから成る制御用ファームウェアが記憶されている。RAM14は制御プログラム等の実行時の演算結果等を一時記憶するとともに、ホストコンピュータ2から通信インターフェース6を介してダウンロードしたデータを一時記憶するようになっている。
【0029】
ホストコンピュータ2には、第2ROM8の記憶内容を消去する消去プログラム21、第2ROM8にファームウェアの書き込みを行う書き込みプログラム22及び所定の制御プログラムから成るファームウェアデータ23が格納されている。
【0030】
マイコンシステム1が起動されると、図2のフローチャートが実行される。まずステップ#61で第1ROM7の起動用ファームウェアが実行される。これにより、起動プログラム及び通信プログラムが実行され、マイコンシステム1を立ち上げて、ホストコンピュータ2との通信を可能にするとともに認識プログラムにより第2ROM8の認識が行われる。
【0031】
次にステップ#62で、第2ROM8内の制御用ファームウェアが正常か否かが判断される。制御用ファームウェアが有効に機能する場合は、ステップ#63に移行して第2ROM8内の制御用ファームウェアが実行され、マイコンシステム1に接続された電子機器の制御が行われる。
【0032】
ステップ#62で制御用ファームウェアが有効に機能していないと判断すると、ステップ#64に移行して、後述する制御用ファームウェアの書き換え処理が行われる。第2ROM8内の制御用ファームウェアの書き換えが終了すると、ステップ#63に移行して第2ROM8内の書き換えられた制御用ファームウェアが実行される。
【0033】
書き換え処理は、制御用ファームウェアの機能追加やバグフィックス等によるバージョンアップ時にホストコンピュータ2からの指示により実行され、第2ROM8内の制御用ファームウェアの書き換えが行われる。また、上記のように第2ROM8内の制御用ファームウェアが正常に動作していない場合にも実行される。
【0034】
図3は書き換え処理のフローチャートを示している。同図において、Aはマイコンシステム1の動作を示し、Bはホストコンピュータ2の動作を示している。まず、ステップ#51でホストコンピュータ2から第2ROM8に記憶された制御用プログラムのバージョン番号の送信命令が出され、ステップ#21でマイコンシステム1からバージョン番号が送信される。これにより、ホストコンピュータ2は、制御用プログラムのバージョン番号を取得する。
【0035】
次に、ステップ#52では、ホストコンピュータ2から消去プログラム21が送信され、マイコンシステム1は通信インターフェース6を介してこれを受信する(ステップ#22)。ステップ#23で消去プログラム21がRAM5にダウンロードされ、ステップ#24でRAM5から消去プログラム21が実行される。これにより、第2ROM8内の制御用ファームウェアが消去される。
【0036】
ステップ#25では制御用ファームウェアの消去が正常に行われた否かが判断され、消去の成功または失敗がホストコンピュータ2に通知される(ステップ#26、#27)。消去に失敗した場合はマイコンシステム1の書き込み処理を終了し、通知を受けたホストコンピュータ2もステップ#53で通知内容を判断して書き込み処理を終了する。
【0037】
消去が正常な場合は、ステップ#54でホストコンピュータ2からリセットコードが送信される。マイコンシステム1はリセットコードを受信するとステップ#28でシステムをリセットし、第1ROM7内の起動用ファームウェアが実行される。
【0038】
従って、前述の図2のフローチャートが実行され、ステップ#64(図2参照)で書き込み処理が呼出される。この時、制御用ファームウェアの消去が終了しているため、フラグの設定によりホストコンピュータ2の処理はステップ#55にジャンプする。
【0039】
ステップ#55では、ホストコンピュータ2から書き込みプログラム22及び制御用ファームウェアのファームウェアデータ23が送信される。マイコンシステム1はステップ#29で書き込みプログラム22及び制御用ファームウェアのファームウェアデータ23を受信し、ステップ#30でRAM5にダウンロードする。
【0040】
ステップ#32では、RAM5から書き込みプログラム22が実行され、RAM5上の制御用ファームウェアが第2ROM8に書き込まれる。この時、ファームウェアデータ23はホストコンピュータ2から分割されたブロック毎に送信され、制御用ファームウェアの一のブロックをRAM5にダウンロードして第2ROM8に書き込むようになっている。
【0041】
そして、一のブロックの書き込みが終了すると次のブロックがRAM5にダウンロードされ、第2ROM8に書き込まれる。この動作を順次行って、制御用ファームウェアの全部が書き込まれる。ダウンロードを分割して行って並行して第2ROM8に書き込みを行うことで、ファームウェアデータ23のダウンロードに必要なRAM5の記憶容量を一ブロック分だけ確保すればよく、RAM5の記憶容量を削減することができるようになっている。
【0042】
第2ROM8への新たな制御用ファームウェアの書き込みが終了すると、ステップ#33で書き込みが正常に行われた否かが判断され、消去の成功または失敗がホストコンピュータ2に通知される(ステップ#34、#35)。消去に失敗した場合はマイコンシステム1の書き込み処理を終了し、通知を受けたホストコンピュータ2もステップ#56で通知内容を判断して書き込み処理を終了する。これにより、制御用ファームウェアが正しく書き換えられなかったことをホストコンピュータが検知し、書き込み処理の再実行等の対応策を行うことができる。
【0043】
書き込みが正常な場合は、ステップ#57でホストコンピュータ2からリセットコードが送信される。マイコンシステム1はリセットコードを受信するとステップ#36でシステムをリセットし、第1ROM7内の起動用ファームウェアが実行される。そして、前述の図2のフローチャートから書き込み処理が呼出され、フラグの設定によりホストコンピュータ2の処理はステップ#58にジャンプする。
【0044】
ステップ#58ではホストコンピュータ2から第2ROM8に記憶された制御用プログラムのバージョン番号の送信命令が出され、ステップ#37でマイコンシステム1からバージョン番号が送信される。これにより、ホストコンピュータ2は、制御用プログラムのバージョン番号を取得し、バージョンが更新されたことを確認して終了する。
【0045】
本実施形態のプログラム書き換え装置によると、起動用ファームウェアが通信プログラムを有することによって、マイコンシステム1に接続された電子機器を制御する制御用ファームウェアに損傷等があってもホストコンピュータ2からダウンロードすることにより修復することができる。このため、従来のような予備プログラム12b(図6参照)をマイコンシステム1内に設ける必要がなく、第1、第2ROM7、8の記憶容量を削減することができる。
【0046】
また、第1、第2ROM7、8に制御用ファームウェアの消去プログラムや書き込みプログラムを記憶させずホストコンピュータ2からダウンロードして実行する。このため、第1、第2ROM7、8の記憶容量をより削減することができる。更に、第2ROM8には制御用ファームウェアのみを記憶して通信プログラムや起動用プログラムを記憶させないので更に記憶容量削減を図ることができる。
【0047】
また、第2ROM8の消去終了後に、書き込みプログラム22をダウンロードしているので、RAM5に消去プログラム21と書き込みプログラム22とが同時に記憶されず、RAM5の記憶容量を削減することができる。また、ファームウェアデータ23がホストコンピュータ2から分割されたブロック毎に送信され、制御用ファームウェアの一のブロックがRAM5にダウンロードして第2ROM8に書き込まれる。一のブロックの書き込みが終了すると次のブロックがRAM5にダウンロードされ、第2ROM8に書き込まれる。この動作を順次行って、制御用ファームウェアの全部が書き込まれる。これにより、制御用ファームウェアのダウンロードとRAM5から第2ROM8への書き込みとが並行して行われる。従って、RAM5は分割してダウンロードされるファームウェアデータ22と書き込みプログラム23の容量を確保すればよく、RAM5の記憶容量をより削減することができる。
【0048】
尚、予備プログラム12b(図6参照)を設けていないので、CPU4からアクセスする制御プログラムのアドレスを一定にするために制御プログラムをRAM5にコピーしなくても、第2ROM8から実行することができる。このため、制御用ファームウェア実行時には、RAM5は演算結果等の一時記憶ができる容量があればよく、上記のように分割してファームウェアデータをダウンロードする際に必要な容量で提供可能である。
【0049】
また、第2ROM8として種類の異なる不揮発性メモリを使用したマイコンシステム1に対して、第2ROM8を操作する消去プログラム及び書き込みプログラムの変更を要するが、電子機器を制御する制御用プログラムを変更する必要はない。第2ROM8には制御プログラムのみから成る制御用ファームウェアが記憶されているため、ファームウェアデータ23をそのまま使用して制御用ファームウェアの書き換えを容易に行うことができる。
【0050】
また、制御用ファームウェアの書き換え処理の最中に、マイコンシステム1及びホストコンピュータ2への電源供給が遮断されると、ROM5の記憶内容が消滅する。この場合に、第2ROM8の内容が消去されていても、第1ROM7の記憶内容は消去されないため第1ROM7に記憶された起動用ファームウェアを実行して制御用ファームウェアをダウンロードすることにより容易に復旧することができる。
【0051】
次に、第2実施形態のプログラム書き換え装置を図面を参照して説明する。本実施形態のプログラム書き換え装置の構成は前述の図1に示す第1実施形態と同様である。第1実施形態と異なる点は、第1ROM7に記憶された起動用ファームウェア内に、第2ROM8に当初記憶された制御プログラムを有している点である。
【0052】
図4は本実施形態のプログラム書き換え装置の動作を示すフローチャートである。マイコンシステム1が起動されると、まずステップ#71で第1ROM7の起動用ファームウェアが実行される。これにより、起動プログラム及び通信プログラム実行され、マイコンシステム1を立ち上げて、ホストコンピュータ2との通信を可能にするとともに認識プログラムにより第2ROM8の認識が行われる。
【0053】
次にステップ#72で、第2ROM8が正常に認識されたか否か及び第2ROM8内の制御用ファームウェアが正常か否かが判断される。第2ROM8が正常に認識されて制御用ファームウェアが有効に機能する場合は、ステップ#73に移行して第2ROM8内の制御用ファームウェアが実行され、マイコンシステム1に接続された電子機器の制御が行われる。
【0054】
ステップ#72で制御用ファームウェアが有効に機能していないと判断すると、ステップ#74に移行して、第1ROM7に記憶された制御プログラムが実行される。これにより、電子機器の制御が行われる。
【0055】
また、前述の図3と同様の書き換え処理を行うことによって、ホストコンピュータ2からの指示により第2ROM8内の制御用ファームウェアの書き換えが行われる。この時、ステップ#53で制御用ファームウェアの消去が成功したことを確認して書き換え処理を終了してもよい。このようにすると、マイコンシステム1は第1ROM7内の初期バージョンの制御プログラムによって電子機器を制御し、制御動作を容易に初期状態に戻すことができる。
【0056】
本実施形態によると、第1ROM7に制御プログラムが記憶されるため、第2ROM8を認識できないときにも電子機器の制御を行うことができる。また、制御プログラムの分だけ第1実施形態よりも第1ROM7の記憶容量を多く必要とするが、消去プログラム及び書き込みプログラムを記憶しないので従来よりも記憶容量を削減することができる。
【0057】
尚、第1、第2実施形態において、第1、第2ROM7、8を別の不揮発性メモリにより構成しているが、第1ROM7として部分的に消去及び書き込みが可能な不揮発性メモリを使用する場合には、第1ROM7の一領域に制御用ファームウェアを記憶して第2ROM8を第1ROM7と兼用してもよい。
【0058】
【発明の効果】
本発明によると、第1ROMに記憶された起動用ファームウェアが通信プログラムを有するので、マイコンシステムに接続された電子機器を制御する制御用ファームウェアに損傷等があってもホストコンピュータからダウンロードすることによって修復することが可能である。このため、従来のような予備プログラムをマイコンシステム内に設ける必要がなく、第1、第2ROMの記憶容量を削減することができる。
【0059】
また、第1、第2ROMに制御用ファームウェアの消去プログラムや書き込みプログラムを記憶させずホストコンピュータからダウンロードして実行するので、第1、第2ROMの記憶容量をより削減することができる。更に、第2ROMには制御用ファームウェアのみを記憶して通信プログラムや起動用プログラムを記憶させないので更に記憶容量削減を図ることができる。
【0060】
また、第2ROMの消去終了後に、書き込みプログラムをダウンロードしているので、RAMに消去プログラムと書き込みプログラムとを同時に記憶されず、RAMの記憶容量を削減することができる。また、ファームウェアデータがホストコンピュータから分割されたブロック毎に送信され、制御用ファームウェアの一のブロックがRAMにダウンロードして第2ROMに書き込まれる。一のブロックの書き込みが終了すると次のブロックがRAMにダウンロードされ、第2ROMに書き込まれる。この動作を順次行って、制御用ファームウェアの全部が書き込まれる。これにより、制御用ファームウェアのダウンロードとRAMから第2ROMへの書き込みとが並行して行われるので、RAMは分割してダウンロードされるファームウェアデータと書き込みプログラムの容量を確保すればよく、RAMの記憶容量をより削減することができる。
【0061】
また、第2ROMとして異なる不揮発性メモリを使用した場合に、第2ROMを操作する消去プログラム及び書き込みプログラムの変更を要するが、電子機器を制御する制御用プログラムを変更する必要はない。第2ROMには制御プログラムのみから成る制御用ファームウェアを記憶されるので、ファームウェアデータをそのまま使用して制御用ファームウェアの書き換えを容易に行うことができる。
【0062】
また、第1ROMに記憶された起動用ファームウェアがホストコンピュータと通信を行う通信プログラムを有しており第1ROMの記憶内容は消去されないので、制御用ファームウェアの書き換え処理の最中にマイコンシステム及びホストコンピュータへの電源供給が遮断されても、第1ROMに記憶された起動用ファームウェアを実行して制御用ファームウェアをダウンロードすることにより容易に復旧することができる。
【0063】
また本発明によると、第1ROMに制御プログラムを記憶することにより、電子機器の制御動作を容易に初期状態に戻すことができるとともに、第2ROMを認識できないときにも電子機器の制御を行うことができる。また、制御プログラムの分だけ記憶容量を多く必要とするが、消去プログラム及び書き込みプログラムを記憶しないので従来よりも記憶容量を削減することができる。
【図面の簡単な説明】
【図1】 本発明の第1実施形態のプログラム書き換え装置の構成を示すブロック図である。
【図2】 本発明の第1実施形態のプログラム書き換え装置の動作を示すフローチャートである。
【図3】 本発明の第1実施形態のプログラム書き換え装置の書き換え処理の動作を示すフローチャートである。
【図4】 本発明の第2実施形態のプログラム書き換え装置の動作を示すフローチャートである。
【図5】 従来のプログラム書き換え装置の構成を示すブロック図である。
【図6】 従来のプログラム書き換え装置のROMを示すメモリマップである。
【図7】 従来のプログラム書き換え装置の動作を示すフローチャートである。
【符号の説明】
1、10 マイコンシステム
2、30 ホストコンピュータ
3、41 通信ケーブル
4 CPU
5、14 RAM
6 通信インターフェース
7 第1ROM
8 第2ROM
11 MPU
12 フラッシュメモリ
13 ドライバ
21 消去プログラム
22 書き込みプログラム
23 ファームウェアデータ[0001]
BACKGROUND OF THE INVENTION
The present invention relates to a program rewriting apparatus and a program rewriting method for downloading another firmware from a host computer connected by communication means to a microcomputer system storing firmware for controlling the operation of an electronic device and rewriting the firmware of the microcomputer system.
[0002]
[Prior art]
A microcomputer system that controls the operation of an electronic device has a ROM that stores firmware as a control program. In order to change the firmware, it is necessary to remove the ROM from the board and re-install a ROM storing another firmware, which has a problem of man-hours. For this reason, Japanese Patent Laid-Open No. 10-254694 discloses a program rewriting device that changes firmware without removing the ROM from the substrate.
[0003]
When this program rewriting apparatus is shown in FIG. 5, the
[0004]
The
[0005]
The startup program 12a describes a series of procedures when the
[0006]
FIG. 7 is a flowchart showing the operation of the data rewriting apparatus having the above configuration. In
[0007]
Communication with the
[0008]
In
[0009]
[Problems to be solved by the invention]
However, according to the above-described conventional program rewriting device, the spare program 12b identical to the
[0010]
Further, it is necessary to copy the
[0011]
An object of this invention is to provide the program rewriting apparatus and program rewriting method which can reduce the storage capacity of RAM and ROM.
[0012]
[Means for Solving the Problems]
In order to achieve the above object, the program rewriting apparatus of the present invention downloads another control firmware from a host computer connected via communication means to a microcomputer system storing control firmware for controlling the operation of an electronic device. In the program rewriting apparatus for rewriting the control firmware of the microcomputer system,
The microcomputer system includes a first ROM storing a startup firmware having a startup program for starting the microcomputer system and a communication program for communicating with the host computer, and a RAM for temporarily storing data downloaded from the host computer; A second ROM for storing control firmware;
An erasing program for erasing the control firmware stored in the second ROM and a writing program for writing the control firmware in the second ROM are arranged in the host computer, and the erasing program is downloaded from the host computer After erasing the control firmware in the second ROM, download the write program from the host computer and write another control firmware in the second ROMIt is characterized by that.
[0013]
According to this configuration, when the control firmware is rewritten, the startup firmware stored in the first ROM is executed to start up the microcomputer system and to communicate with the host computer. As a result, rewrite control firmware is downloaded from the host computer and stored in the RAM. Then, the control firmware in the second ROM is erased, and new control firmware is copied from the RAM.
In addition, a control firmware erase program is downloaded from the host computer and stored in the RAM, and the control firmware in the second ROM is erased by the erase program. Thereafter, a control firmware write program is downloaded from the host computer and stored in the RAM, and the control firmware is written into the second ROM by the write program.
[0014]
The present invention also provides a program rewriting apparatus having the above-described configuration.The control firmware is downloaded from the host computer for each divided block and stored in the RAM, and the control firmware is written from the RAM to the second ROM for each block, and the control firmware stored in the RAM is stored in the RAM. Blocks are overwritten sequentially by the next downloaded blockIt is characterized by that.
[0015]
According to this configuration, when the control firmware is divided and a part is downloaded to the RAM, the part is written to the second ROM, and when the next part is downloaded and overwritten to the RAM, the part is written to the second ROM. Part is written. This operation is repeated to rewrite the second ROM control firmware.
[0019]
The present invention also provides a program rewriting apparatus having the above-described configuration.An initial version of the control firmware initially stored in the second ROM is included in the boot firmware.It is characterized by that. According to this configuration, the operation of the original control firmware can be executed by the startup firmware by deleting the new control firmware stored in the second ROM.
[0020]
According to the present invention, in the program rewriting device configured as described above, the first ROM is composed of a nonvolatile memory that can be partially erased and written, and the second ROM is also used as the first ROM. According to this configuration, the boot firmware and the control firmware are stored in the first ROM composed of the nonvolatile memory, and the control firmware is rewritten while leaving the boot firmware.
[0021]
According to the present invention, in the program rewriting apparatus configured as described above, the first ROM is composed of any one of a mask ROM, a PROM, and a flash memory.
[0022]
Further, the program rewriting method of the present invention downloads another control firmware from a host computer connected via a communication means to a microcomputer system storing control firmware for controlling the operation of an electronic device. In a program rewriting method for rewriting control firmware,
The microcomputer system includes a first ROM storing a startup firmware having a startup program for starting the microcomputer system and a communication program for communicating with the host computer, and a RAM for temporarily storing data downloaded from the host computer; A second ROM for storing control firmware,
An erasing program for erasing the control firmware stored in the second ROM, and a writing program for writing the control firmware in the second ROM;Is placed in the host computer, the erasure program is downloaded from the host computer and the control firmware in the second ROM is erased, then the write program is downloaded from the host computer and another control firmware is written into the second ROM.It is characterized by that.
[0024]
The present invention also provides a program rewriting method having the above-described configuration,The control firmware is downloaded from the host computer for each divided block and stored in the RAM, and the control firmware is written from the RAM to the second ROM for each block, and the control firmware stored in the RAM is stored in the RAM. Blocks are overwritten sequentially by the next downloaded blockIt is characterized by that.
[0025]
DETAILED DESCRIPTION OF THE INVENTION
Embodiments of the present invention will be described below with reference to the drawings. FIG. 1 is a block diagram showing the configuration of the program rewriting apparatus of the first embodiment. In the program rewriting apparatus, a microcomputer system 1 and a
[0026]
The microcomputer system 1 transmits and receives data to and from the
[0027]
The first and
[0028]
The
[0029]
The
[0030]
When the microcomputer system 1 is activated, the flowchart of FIG. 2 is executed. First, in step # 61, the startup firmware of the
[0031]
Next, at
[0032]
If it is determined in
[0033]
The rewriting process is executed in accordance with an instruction from the
[0034]
FIG. 3 shows a flowchart of the rewriting process. In the figure, A shows the operation of the microcomputer system 1 and B shows the operation of the
[0035]
Next, in
[0036]
In
[0037]
If the erasure is normal, a reset code is transmitted from the
[0038]
Therefore, the above-described flowchart of FIG. 2 is executed, and the writing process is called in step # 64 (see FIG. 2). At this time, since the control firmware has been erased, the processing of the
[0039]
In
[0040]
In
[0041]
When the writing of one block is completed, the next block is downloaded to the RAM 5 and written to the
[0042]
When the writing of the new control firmware to the
[0043]
If the writing is normal, a reset code is transmitted from the
[0044]
In
[0045]
According to the program rewriting apparatus of this embodiment, even if there is damage or the like in the control firmware that controls the electronic device connected to the microcomputer system 1 because the startup firmware has a communication program, it is downloaded from the
[0046]
The first and
[0047]
Further, since the
[0048]
Since the spare program 12b (see FIG. 6) is not provided, the control program can be executed from the
[0049]
Further, for the microcomputer system 1 using different types of nonvolatile memories as the
[0050]
Further, if the power supply to the microcomputer system 1 and the
[0051]
Next, the program rewriting apparatus of 2nd Embodiment is demonstrated with reference to drawings. The configuration of the program rewriting apparatus of this embodiment is the same as that of the first embodiment shown in FIG. The difference from the first embodiment is that the start-up firmware stored in the
[0052]
FIG. 4 is a flowchart showing the operation of the program rewriting apparatus of this embodiment. When the microcomputer system 1 is activated, first, the activation firmware in the
[0053]
Next, in
[0054]
If it is determined in
[0055]
Further, by performing the rewriting process similar to that in FIG. 3 described above, the control firmware in the
[0056]
According to the present embodiment, since the control program is stored in the
[0057]
In the first and second embodiments, the first and
[0058]
【The invention's effect】
According to the present invention, since the startup firmware stored in the first ROM has a communication program, even if the control firmware for controlling the electronic device connected to the microcomputer system is damaged, it is repaired by downloading it from the host computer. Is possible. For this reason, it is not necessary to provide a conventional spare program in the microcomputer system, and the storage capacity of the first and second ROMs can be reduced.
[0059]
In addition, since the control firmware erasure program and the write program are not stored in the first and second ROMs but downloaded from the host computer and executed, the storage capacity of the first and second ROMs can be further reduced. Furthermore, since only the control firmware is stored in the second ROM and no communication program or startup program is stored, the storage capacity can be further reduced.
[0060]
In addition, since the writing program is downloaded after the erasing of the second ROM is completed, the erasing program and the writing program are not stored in the RAM at the same time, and the storage capacity of the RAM can be reduced. Also,Firmware data is transmitted from the host computer for each divided block, and one block of control firmware is downloaded to the RAM and written to the second ROM. When the writing of one block is completed, the next block is downloaded to the RAM and written to the second ROM. By sequentially performing this operation, all of the control firmware is written. ThisSince downloading of control firmware and writing from the RAM to the second ROM are performed in parallel, the RAM only needs to secure the capacity of the firmware data to be downloaded and the writing program, thereby further reducing the storage capacity of the RAM. can do.
[0061]
Further, when a different nonvolatile memory is used as the second ROM, it is necessary to change the erasing program and the writing program for operating the second ROM, but it is not necessary to change the control program for controlling the electronic device. Since the second ROM stores the control firmware consisting only of the control program, the firmware can be easily rewritten using the firmware data as it is.
[0062]
In addition, since the startup firmware stored in the first ROM has a communication program for communicating with the host computer and the stored contents of the first ROM are not erased, the microcomputer system and the host computer are in the process of rewriting the control firmware. Even if the power supply to is cut off, it can be easily recovered by executing the startup firmware stored in the first ROM and downloading the control firmware.
[0063]
According to the present invention, the control program of the electronic device can be easily returned to the initial state by storing the control program in the first ROM, and the electronic device can be controlled even when the second ROM cannot be recognized. it can. Further, although a large storage capacity is required for the control program, the storage capacity can be reduced as compared with the conventional case because the erase program and the write program are not stored.
[Brief description of the drawings]
FIG. 1 is a block diagram showing a configuration of a program rewriting apparatus according to a first embodiment of the present invention.
FIG. 2 is a flowchart showing an operation of the program rewriting apparatus according to the first embodiment of the present invention.
FIG. 3 is a flowchart showing an operation of rewriting processing of the program rewriting apparatus according to the first embodiment of the present invention.
FIG. 4 is a flowchart showing an operation of the program rewriting apparatus according to the second embodiment of the present invention.
FIG. 5 is a block diagram showing a configuration of a conventional program rewriting apparatus.
FIG. 6 is a memory map showing a ROM of a conventional program rewriting device.
FIG. 7 is a flowchart showing the operation of a conventional program rewriting apparatus.
[Explanation of symbols]
1, 10 Microcomputer system
2, 30 Host computer
3, 41 Communication cable
4 CPU
5, 14 RAM
6 Communication interface
7 First ROM
8 Second ROM
11 MPU
12 Flash memory
13 Drivers
21 Erase program
22 Writing program
23 Firmware data
Claims (7)
前記マイコンシステムは、前記マイコンシステムを起動する起動プログラムと前記ホストコンピュータとの通信を行う通信プログラムとを有する起動用ファームウェアを記憶した第1ROMと、前記ホストコンピュータからダウンロードしたデータを一時記憶するRAMと、制御用ファームウェアを記憶する第2ROMとを備え、
第2ROMに記憶された制御用ファームウェアを消去するための消去プログラムと、第2ROMに制御用ファームウェアを書き込むための書き込みプログラムとを前記ホストコンピュータに配置し、前記ホストコンピュータから前記消去プログラムをダウンロードして第2ROMの制御用ファームウェアを消去した後、前記ホストコンピュータから前記書き込みプログラムをダウンロードして第2ROMに別の制御ファームウェアを書き込むことを特徴とするプログラム書き換え装置。In a program rewriting apparatus for downloading another control firmware from a host computer connected via a communication means to a microcomputer system storing control firmware for controlling the operation of an electronic device and rewriting the control firmware for the microcomputer system ,
The microcomputer system includes a first ROM storing a startup firmware having a startup program for starting the microcomputer system and a communication program for communicating with the host computer, and a RAM for temporarily storing data downloaded from the host computer; A second ROM for storing control firmware;
An erasing program for erasing the control firmware stored in the second ROM and a writing program for writing the control firmware in the second ROM are arranged in the host computer, and the erasing program is downloaded from the host computer A program rewriting device , wherein after the control firmware in the second ROM is erased, the write program is downloaded from the host computer and another control firmware is written into the second ROM .
前記マイコンシステムは、前記マイコンシステムを起動する起動プログラムと前記ホストコンピュータとの通信を行う通信プログラムとを有する起動用ファームウェアを記憶した第1ROMと、前記ホストコンピュータからダウンロードしたデータを一時記憶するRAMと、制御用ファームウェアを記憶する第2ROMと、を備え、
第2ROMに記憶された制御用ファームウェアを消去するための消去プログラムと、第2ROMに制御用ファームウェアを書き込むための書き込みプログラムとを前記ホストコンピュータに配置し、前記ホストコンピュータから前記消去プログラムをダウンロードして第2ROMの制御用ファームウェアを消去した後、前記ホストコンピュータから前記書き込みプログラムをダウンロードして第2ROMに別の制御ファームウェアを書き込むことを特徴とするプログラム書き換え方法。In a program rewriting method of downloading another control firmware from a host computer connected via communication means to a microcomputer system storing control firmware for controlling the operation of an electronic device and rewriting the control firmware of the microcomputer system ,
The microcomputer system includes a first ROM storing a startup firmware having a startup program for starting the microcomputer system and a communication program for communicating with the host computer, and a RAM for temporarily storing data downloaded from the host computer; A second ROM for storing control firmware,
An erasing program for erasing the control firmware stored in the second ROM and a writing program for writing the control firmware in the second ROM are arranged in the host computer, and the erasing program is downloaded from the host computer A program rewriting method , comprising: erasing control firmware in a second ROM, downloading the write program from the host computer, and writing another control firmware in the second ROM .
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2000373709A JP3805195B2 (en) | 2000-12-08 | 2000-12-08 | Program rewriting apparatus and program rewriting method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2000373709A JP3805195B2 (en) | 2000-12-08 | 2000-12-08 | Program rewriting apparatus and program rewriting method |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2002175193A JP2002175193A (en) | 2002-06-21 |
JP3805195B2 true JP3805195B2 (en) | 2006-08-02 |
Family
ID=18843028
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2000373709A Expired - Fee Related JP3805195B2 (en) | 2000-12-08 | 2000-12-08 | Program rewriting apparatus and program rewriting method |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP3805195B2 (en) |
Families Citing this family (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP2383903B1 (en) * | 2003-07-17 | 2018-03-14 | e-distribuzione S.p.A. | Method and system for remote updates of meters for metering the consumption of electricity, water or gas |
JP2006039206A (en) | 2004-07-27 | 2006-02-09 | Canon Inc | Ciphering device and deciphering device |
JP2007133602A (en) * | 2005-11-09 | 2007-05-31 | Fujitsu Ten Ltd | Information processing system and onboard equipment |
JP4973270B2 (en) * | 2007-03-27 | 2012-07-11 | 株式会社ニコン | Camera accessory equipment and camera system |
JP4591486B2 (en) * | 2007-08-23 | 2010-12-01 | ソニー株式会社 | Information processing apparatus, information processing method, and computer program |
JP2013092978A (en) * | 2011-10-27 | 2013-05-16 | Denso Corp | Electronic control unit and memory rewriting method |
CN102790833A (en) * | 2012-08-29 | 2012-11-21 | 上海酷宇通讯技术有限公司 | ROM (Read Only Memory) space saving method for functional mobile phone |
CN111399888B (en) | 2020-03-11 | 2023-06-16 | 北京百度网讯科技有限公司 | Audio processing chip processing method and device and electronic equipment |
-
2000
- 2000-12-08 JP JP2000373709A patent/JP3805195B2/en not_active Expired - Fee Related
Also Published As
Publication number | Publication date |
---|---|
JP2002175193A (en) | 2002-06-21 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP3838840B2 (en) | Computer | |
WO2022007656A1 (en) | Bootloader software updating method and apparatus, embedded controller, and storage medium | |
JP2000357095A (en) | Method and device for downloading software to embedded system | |
JP4480815B2 (en) | Memory rewriting method and computer system | |
JP6543122B2 (en) | INFORMATION PROCESSING APPARATUS, METHOD OF INITIALIZING NONVOLATILE STORAGE DEVICE BY THE INFORMATION PROCESSING APPARATUS, AND PROGRAM | |
JP3805195B2 (en) | Program rewriting apparatus and program rewriting method | |
JP3830867B2 (en) | Single-chip microcomputer and its boot area switching method | |
KR101601751B1 (en) | Ecu of vehicle and boot software re-programming method thereof | |
JP2005284902A (en) | Terminal device, control method and control program thereof, host device, control method and control program thereof, and method, system, and program for remote updating | |
JP2001331379A (en) | Method and device for rewriting flash memory update program | |
CN114996717A (en) | Upgrade program design method for preventing error erasure | |
JP2004192329A (en) | Program rewriting method and terminal device | |
JP2019008693A (en) | Vehicle-purpose electronic control unit | |
JP2001344156A (en) | Device with flash memory and data rewriting method | |
JPH1063497A (en) | Program updating method | |
JP5158883B2 (en) | Firmware update method and firmware update apparatus | |
KR20090021695A (en) | System for roll back of flash memory and method there of | |
JPH11282690A (en) | Method for writing control program, information processor and information processing system | |
JP7491765B2 (en) | Firmware update system and firmware update method | |
CN118092373A (en) | OTA rollback control method of vehicle-mounted controller based on partition downloading technology | |
JP6782654B2 (en) | In-vehicle control device and program update software | |
JPH10228373A (en) | Control method for rewritable rom | |
JPH07146837A (en) | Computer peripheral device and program update control method for the same | |
CN117608627A (en) | Method for upgrading firmware, electronic device and storage medium | |
JP2004054818A (en) | Program execution apparatus |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20051219 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20060110 |
|
A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20060223 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20060322 |
|
A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20060405 |
|
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: 20060509 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20060509 |
|
R150 | Certificate of patent or registration of utility model |
Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20100519 Year of fee payment: 4 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20110519 Year of fee payment: 5 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20110519 Year of fee payment: 5 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20120519 Year of fee payment: 6 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20120519 Year of fee payment: 6 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20130519 Year of fee payment: 7 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20140519 Year of fee payment: 8 |
|
LAPS | Cancellation because of no payment of annual fees |