JP2007041798A - Information processor and memory rewriting method for information processor - Google Patents
Information processor and memory rewriting method for information processor Download PDFInfo
- Publication number
- JP2007041798A JP2007041798A JP2005224456A JP2005224456A JP2007041798A JP 2007041798 A JP2007041798 A JP 2007041798A JP 2005224456 A JP2005224456 A JP 2005224456A JP 2005224456 A JP2005224456 A JP 2005224456A JP 2007041798 A JP2007041798 A JP 2007041798A
- Authority
- JP
- Japan
- Prior art keywords
- data
- rewriting
- backup area
- flag
- nonvolatile memory
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Landscapes
- Techniques For Improving Reliability Of Storages (AREA)
Abstract
Description
本発明は、プリンタ、スキャナ等の情報処理装置及び情報処理装置のメモリ書き換え方法に係り、特に情報処理装置の内部に設けられた不揮発性メモリの書き換え方法に関する。 The present invention relates to an information processing apparatus such as a printer and a scanner and a memory rewriting method of the information processing apparatus, and more particularly to a rewriting method of a nonvolatile memory provided in the information processing apparatus.
従来、情報処理装置としては、例えば、用紙に画像を記録する画像記録装置としてのプリンタや、用紙に記録された画像を読み取る画像読取装置としてのスキャナ等が知られている。これらの情報処理装置は、内部に設けられたCPUがファームウェアを実行することにより、ホストコンピュータとの通信を行いつつ、画像記録または画像読み取りを実行する。 Conventionally, as information processing apparatuses, for example, a printer as an image recording apparatus that records an image on a sheet, a scanner as an image reading apparatus that reads an image recorded on a sheet, and the like are known. These information processing apparatuses execute image recording or image reading while communicating with a host computer by a CPU provided therein executing firmware.
ファームウェアは、情報処理装置制御用の実行プログラムとこの実行プログラムが実行時に参照する参照値データ等から構成され、通常、フラッシュROMやEEPROMといった書き換え可能な不揮発性メモリに記憶されている。情報処理装置に新たな制御を加えて機能拡張を行う場合や、既存のファームウェアの不具合を解消する場合には、ホストコンピュータから書き換え用のデータを情報処理装置に送信し、不揮発性メモリ内のデータを書き換えることにより、ファームウェアの更新が行われる。 The firmware includes an execution program for controlling the information processing apparatus and reference value data that the execution program refers to at the time of execution, and is normally stored in a rewritable nonvolatile memory such as a flash ROM or an EEPROM. When adding new control to the information processing device to expand the function or to solve the problem of the existing firmware, the host computer sends rewrite data to the information processing device, and the data in the non-volatile memory The firmware is updated by rewriting.
ファームウェアの更新にあたっては、通常、書き換えにより書き換え前のデータが消去される。したがって、データの書き換え中に電源断が発生したり、通信エラー等が発生した場合には、誤ったデータが書き込まれてしまい、情報処理装置が動作不能に陥るといった問題がある。 When updating firmware, data before rewriting is usually erased by rewriting. Therefore, when a power interruption occurs during data rewriting or a communication error occurs, incorrect data is written, causing the information processing apparatus to become inoperable.
この問題を解決するために、特許文献1の記録装置では、書き換えが正常に行われたかどうかを判定し、書き換えが正常に終了されていない場合には、再度書き換えを実行するように構成されている。 In order to solve this problem, the recording apparatus of Patent Document 1 is configured to determine whether rewriting has been normally performed, and to perform rewriting again when rewriting has not been completed normally. Yes.
より具体的に説明すると、特許文献1の記録装置は、ユーザプログラム領域と、このユーザプログラム領域を書き換える書き換えプログラムを記憶するダウンロードプログラム領域を備えたフラッシュROMを備えている。記録装置は、ダウンロードモード(書き換えモード)においては、ホストコンピュータから受信する更新用データを用いて、RAM内に書き換え用のROMイメージを作成し、作成したROMイメージをRAMからフラッシュROMに転送してユーザプログラム領域の書き換えを実行する。書き換えが終了すると、ユーザプログラム領域のチェックサムを検証し、チェックサム値が正常でない場合には、再度フラッシュROM書き換えを再実行する。 More specifically, the recording apparatus of Patent Document 1 includes a flash ROM having a user program area and a download program area for storing a rewrite program for rewriting the user program area. In the download mode (rewrite mode), the recording device creates a rewrite ROM image in the RAM using update data received from the host computer, and transfers the created ROM image from the RAM to the flash ROM. Rewrite the user program area. When the rewriting is completed, the checksum of the user program area is verified. If the checksum value is not normal, the flash ROM rewriting is performed again.
また、ユーザプログラム領域の書き換え途中に電源断等により、書き換えが中断された場合には、起動時の処理において、ユーザプログラム領域のチェックサムが検証され、チェックサムが異常であれば、再度ホストコンピュータから更新用データを受信して、再度フラッシュROM書き換えを実行する。 In addition, when rewriting is interrupted due to power interruption or the like during rewriting of the user program area, the checksum of the user program area is verified in the process at startup, and if the checksum is abnormal, the host computer again The update data is received from, and the flash ROM is rewritten again.
ところで、特許文献1に記載の記録装置では、ホストコンピュータから受信した更新用データを基に揮発性メモリであるRAMにROMイメージを作成し、そして作成されたROMイメージでフラッシュROMを書き換える方式である。したがって、書き換え途中に電源断等が発生すると、再度ホストコンピュータからデータを再受信しなければ再書き換えを実行することができない。 By the way, the recording apparatus described in Patent Document 1 is a system in which a ROM image is created in a RAM, which is a volatile memory, based on update data received from a host computer, and the flash ROM is rewritten with the created ROM image. . Therefore, if a power interruption or the like occurs during rewriting, rewriting cannot be executed unless data is received again from the host computer.
そのため、情報処理装置の中には、不揮発性メモリ内のバックアップ領域に書き換え用データを一時的に作成し、この書き換え用データを用いて書き換え対象領域のデータを書き換えるように構成されたものもある。このように構成することにより、バックアップ領域から書き換え対象領域にデータを書き込む際に電源断等により書き込みが中断されても、電源再投入すればホストコンピュータから再度データを受信することなく、再書き込みを実行することができる。
しかしながら、バックアップ領域に書き換え用データを一時的に作成し、この書き換え用データを用いて書き換え対象領域のデータを書き換えるように構成した場合には、バックアップ領域に設定されたフラグによって、書き換え対象領域に正しくデータが書き込まれたかどうかを確認するが、電源断のタイミングによっては、このフラグに起因して書き換え対象領域が誤ったデータで書き換えられてしまう場合がある。 However, if the rewrite data is temporarily created in the backup area and the data in the rewrite target area is rewritten using this rewrite data, the rewrite target area is set by the flag set in the backup area. Whether or not the data has been correctly written is checked. Depending on the timing of power-off, the rewrite target area may be rewritten with incorrect data due to this flag.
図5を参照して具体的に説明すると、フラッシュROM内のデータ書き換えにおいては、情報処理装置が書き換えモードに移行した状態において、まず不揮発性メモリ(例えば、フラッシュROMやEEPROM)内にバックアップ領域を確保し、このバックアップ領域にホストコンピュータから受信した新規書き込みデータを書き込むとともに、フラッシュROMの書き換え対象領域に存在する書き換え後にも利用する必要な情報をこのバックアップ領域に書き込み、書き込み用データを生成する(ステップS101)。 Specifically, referring to FIG. 5, in the data rewriting in the flash ROM, the backup area is first set in the nonvolatile memory (for example, the flash ROM or the EEPROM) in a state where the information processing apparatus has shifted to the rewriting mode. The new write data received from the host computer is written to the backup area, and necessary information to be used after rewriting existing in the rewrite target area of the flash ROM is written to the backup area to generate write data ( Step S101).
そして、バックアップ領域に書き込み用データが生成されると、書き込み用データの末尾に書き換え対象領域への書き込み要を意味するバックアップフラグを書き込む(ステップS102)。 When write data is generated in the backup area, a backup flag indicating that writing to the rewrite target area is necessary is written at the end of the write data (step S102).
次に、書き換え対象領域のセクタを一括消去し(ステップS104)、バックアップ領域の書き込み用データを書き換え対象領域に書き込む(ステップS105)。そして、書き換え対象領域への書き換えが終了すると、バックアップ領域のデータを消去する(ステップS105)。この消去により、バックアップフラグも消去されて、書き換えが完了する。 Next, the sectors in the rewrite target area are collectively erased (step S104), and the write data in the backup area is written into the rewrite target area (step S105). When the rewriting to the rewriting target area is completed, the data in the backup area is deleted (step S105). By this erasure, the backup flag is also erased and the rewriting is completed.
ここで、ステップS105のデータ消去途中に電源断等により、処理が中断されてしまい、バックアップフラグが未だに消去されていない状態を考える。この状態は、バックアップ領域のデータは不完全なものであるにもかかわらず、バックアップフラグが存在するため、バックアップ領域全体としては、未だに書き換え対象領域にデータを書き込む必要があることを意味している。 Here, let us consider a state in which the processing is interrupted due to power interruption or the like during the data erasing in step S105, and the backup flag is not yet erased. This state means that although the backup area data is incomplete, the backup flag exists, so the entire backup area still needs to be written to the rewrite target area. .
このような状態で、情報処理装置が電源ON等により再起動されると、バックアップフラグの存在により、データの復旧処理が再開される(ステップS106)。 In this state, when the information processing apparatus is restarted by turning on the power or the like, the data recovery process is resumed due to the presence of the backup flag (step S106).
この場合には、未だに書き換え対象セクタにはデータが書き込まれていないと判断され、実質的にステップS104以降の処理が再開され、書き換え対象セクタが消去される(ステップS107)。そして、バックアップ領域に存在する消去途中であった不完全なデータが書き換え対象領域に書き込まれ(ステップS108)、結果として書き換え対象領域のデータが壊されファームウェアが不完全なものとなり、場合によってはユーザ単独では復旧不可能となってしまう。 In this case, it is determined that data has not yet been written in the rewrite target sector, and the processing after step S104 is substantially resumed to erase the rewrite target sector (step S107). Then, the incomplete data existing in the backup area that was being erased is written to the rewrite target area (step S108). As a result, the data in the rewrite target area is destroyed and the firmware becomes incomplete. It cannot be recovered by itself.
また、例えば、バックアップ領域に書き込まれるフラグがバックアップ領域のデータが書き込まれる領域を指定している場合に、上記のステップS105におけるバックアップ領域の消去途中に電源断等により書き換えが中断されたり、また、バックアップ領域のデータが書き込まれる領域を指定するフラグが書き込まれる途中に書き換えが中断したりすると、場合によってはフラグが中途半端に消去され、フラグが指定する書き換え対象領域が変更されてしまう場合も想定される。 Further, for example, when the flag written in the backup area designates an area in which the data in the backup area is written, rewriting is interrupted due to a power interruption or the like during the erasing of the backup area in the above step S105, If rewriting is interrupted in the middle of writing the flag that specifies the area to which the data in the backup area is written, the flag may be erased halfway and the rewriting target area specified by the flag may be changed. Is done.
これについて説明すると、フラッシュROMのセクタ消去においては、ある規則性を持ってセクタ内のデータが順次0に書き換えられ、そして全ビットが0となった後にランダムにビットが1となり、最終的に全ビットが1となる。したがって、消去途中でも、フラッシュROM内のビットは0と1が混在している状態が多々存在し、タイミングによっては、フラグがまれに解釈可能なフラグに書き換えられてしまう場合がある。 To explain this, in the sector erase of the flash ROM, the data in the sector is sequentially rewritten to 0 with a certain regularity, and after all the bits become 0, the bits are randomly 1 and finally all The bit becomes 1. Accordingly, there are many states in which 0 and 1 are mixed in the flash ROM even during erasure, and the flag may be rewritten to an interpretable flag depending on the timing.
このように、フラグが解釈可能なフラグに書き換えられて、フラグが指定する書き換え対象領域が変更されてしまうと、意図した書き換え対象領域は正しく書き換えられるが、意図せぬ領域が新たに書き換え対象領域として認識され、この領域に消去途中の不完全なデータが書き込まれて壊され、結果としてファームウェアが不完全なものとなってしまう。この場合にも、場合によってはユーザ単独では復旧が不可能となってしまう。 In this way, if the flag is rewritten to an interpretable flag and the rewrite target area specified by the flag is changed, the intended rewrite target area is correctly rewritten, but the unintended area is newly rewritten. And incomplete data in the middle of erasing is written and destroyed in this area, resulting in incomplete firmware. Even in this case, it may be impossible for the user alone to recover.
本発明は、上記を鑑みて為されたものであり、不揮発性メモリ内のバックアップ領域に書き換え用データを一時的に作成し、この書き換え用データを用いて書き換え対象領域のデータを書き換えるように構成した場合に電源断等により処理が中断されたとしても、正常に書き換えを完了することが可能な情報処理装置及び情報処理装置のメモリ書き換え方法を提供することを目的とする。 The present invention has been made in view of the above, and is configured to temporarily create rewrite data in a backup area in a nonvolatile memory and rewrite the data in the rewrite target area using this rewrite data. An object of the present invention is to provide an information processing apparatus and a memory rewriting method for the information processing apparatus that can complete rewriting normally even if the processing is interrupted due to power interruption or the like.
(1) ホストコンピュータとの間でデータを送受信するデータ送受信部と、
所定の動作を行う駆動部と、
複数のセクタを有し、該複数のセクタ内にファームウェアを記憶する不揮発性メモリと、
前記不揮発性メモリ内のファームウェアを実行することにより前記駆動部を制御するとともに、前記ホストコンピュータから送信されるデータを基に前記ファームウェアを書き換える制御部と、を備え、
前記制御部は、前記不揮発性メモリの書き換えを行うにあたり、前記ホストコンピュータから送信されたデータを基に前記不揮発性メモリ内のバックアップ領域に書き込み用データを生成し、前記バックアップ領域の信頼性を検証するための検証値及び前記不揮発性メモリの書き込み対象セクタを指定するフラグを前記バックアップ領域に書き込み、前記バックアップ領域に書き込まれた書き込み用データを前記フラグに指定された前記書き込み対象セクタに書き込むことにより前記不揮発性メモリの書き換えを実行し、そして前記バックアップ領域のデータを消去することを特徴とする情報処理装置。
(2) 前記制御部は、起動後、前記フラグの有無を判定し、前記フラグが存在する場合には、前記フラグの指定が所定の定義域であり且つ前記検証値を用いて前記バックアップ領域の信頼性が検証された場合にのみ、前記バックアップ領域に書き込まれた前記書き込み用データを前記フラグに指定された前記書き込み対象セクタに書き込むことにより前記不揮発性メモリの書き換えを実行することを特徴とする(1)に記載の情報処理装置。
(3) 前記検証値は、チェックサム方式で算出されるチェックサムであることを特徴とする(1)または(2)に記載の情報処理装置。
(4) 前記検証値は、CRC方式で算出されるCRC値であることを特徴とする(1)または2に記載の情報処理装置。
(5) 前記不揮発性メモリは、フラッシュROMであることを特徴とする(1)〜(4)の何れか一項に記載の情報処理装置。
(6) ホストコンピュータから送信されるデータを基に不揮発性メモリに記憶されたファームウェアを書き換える情報処理装置のメモリ書き換え方法であって、
前記不揮発性メモリの書き換えを行うにあたり、前記ホストコンピュータから送信されたデータを基に前記不揮発性メモリ内のバックアップ領域に書き込み用データを生成するステップと、
前記バックアップ領域の信頼性を検証するための検証値を算出し、前記バックアップ領域に書き込むステップと、
前記不揮発性メモリの書き込み対象セクタを指定するフラグを前記バックアップ領域に書き込むステップと、
前記バックアップ領域に書き込まれた書き込み用データを前記フラグに指定された前記書き込み対象セクタに書き込むことにより前記不揮発性メモリの書き換えるステップと、前記バックアップ領域のデータを消去するステップと、を備えたことを特徴とする情報処理装置のメモリ書き換え方法。
(7) 起動後、前記フラグの有無を判定するステップを備え、
前記フラグが存在する場合には、前記フラグの指定が所定の定義域であり且つ前記検証値を用いて前記バックアップ領域の信頼性が検証された場合にのみ、前記バックアップ領域に書き込まれた書き込み用データを前記フラグに指定された前記書き込み対象セクタに書き込むことにより前記不揮発性メモリの書き換えを実行することを特徴とする(6)に記載の情報処理装置のメモリ書き換え方法。
(8) 前記検証値は、チェックサム方式で算出されるチェックサムであることを特徴とする(6)または(7)に記載の情報処理装置のメモリ書き換え方法。
(9) 前記検証値は、CRC方式で算出されるCRC値であることを特徴とする(6)または(7)に記載の情報処理装置のメモリ書き換え方法。
(10) 前記不揮発性メモリは、フラッシュROMであることを特徴とする(6)〜(9)の何れか一項に記載の情報処理装置のメモリ書き換え方法。
(1) a data transmission / reception unit for transmitting / receiving data to / from a host computer;
A drive unit that performs a predetermined operation;
A non-volatile memory having a plurality of sectors and storing firmware in the plurality of sectors;
Controlling the drive unit by executing firmware in the nonvolatile memory, and a control unit for rewriting the firmware based on data transmitted from the host computer,
When rewriting the nonvolatile memory, the control unit generates data for writing in a backup area in the nonvolatile memory based on data transmitted from the host computer, and verifies the reliability of the backup area. By writing a verification value and a flag designating the write target sector of the nonvolatile memory in the backup area, and writing the write data written in the backup area into the write target sector designated by the flag An information processing apparatus that performs rewriting of the nonvolatile memory and erases data in the backup area.
(2) After starting, the control unit determines the presence or absence of the flag, and if the flag exists, the designation of the flag is a predetermined definition area and the verification value is used to specify the backup area. The nonvolatile memory is rewritten by writing the write data written in the backup area to the write target sector specified by the flag only when the reliability is verified. The information processing apparatus according to (1).
(3) The information processing apparatus according to (1) or (2), wherein the verification value is a checksum calculated by a checksum method.
(4) The information processing apparatus according to (1) or 2, wherein the verification value is a CRC value calculated by a CRC method.
(5) The information processing apparatus according to any one of (1) to (4), wherein the nonvolatile memory is a flash ROM.
(6) A memory rewriting method for an information processing apparatus for rewriting firmware stored in a nonvolatile memory based on data transmitted from a host computer,
When rewriting the nonvolatile memory, generating write data in a backup area in the nonvolatile memory based on data transmitted from the host computer;
Calculating a verification value for verifying the reliability of the backup area, and writing to the backup area;
Writing a flag designating a write target sector of the nonvolatile memory to the backup area;
The step of rewriting the nonvolatile memory by writing the data for writing written in the backup area to the write target sector designated by the flag, and the step of erasing the data in the backup area. A memory rewriting method for an information processing apparatus.
(7) comprising a step of determining the presence or absence of the flag after activation;
When the flag is present, the writing for writing in the backup area is performed only when the designation of the flag is a predetermined domain and the reliability of the backup area is verified using the verification value. The memory rewriting method for an information processing apparatus according to (6), wherein the nonvolatile memory is rewritten by writing data to the write target sector designated by the flag.
(8) The memory rewriting method for an information processing apparatus according to (6) or (7), wherein the verification value is a checksum calculated by a checksum method.
(9) The memory rewriting method for an information processing apparatus according to (6) or (7), wherein the verification value is a CRC value calculated by a CRC method.
(10) The memory rewriting method for an information processing apparatus according to any one of (6) to (9), wherein the nonvolatile memory is a flash ROM.
本発明の情報処理装置では、不揮発性メモリの書き換えを行うにあたり、ホストコンピュータから送信されたデータを基に不揮発性メモリ内のバックアップ領域に書き込み用データを生成する。このように構成することにより、バックアップ領域から書き換え対象領域にデータを書き込む際に電源断等により書き込みが中断されても、電源再投入すればホストコンピュータから再度データを受信することなく、再書き込みを実行することができる。 In the information processing apparatus of the present invention, when rewriting the nonvolatile memory, write data is generated in the backup area in the nonvolatile memory based on the data transmitted from the host computer. By configuring in this way, even if writing is interrupted due to power interruption or the like when writing data from the backup area to the rewrite target area, if data is turned on again, data can be rewritten without receiving data again from the host computer. Can be executed.
また、本発明の情報処理装置では、このとき不揮発性メモリの書き込み対象セクタを指定するフラグに加えてバックアップ領域の信頼性を検証するための検証値をバックアップ領域に書き込むように構成されている。したがって、電源断等により、メモリ書き換え処理が中断されてしまっても、検証値によりバックアップ領域のデータが不完全なものであることが判別可能である。したがって、誤ったデータにより不揮発性メモリを書き換えるといった不具合が発生することがなく、信頼性の高い不揮発性メモリの書き換えを行うことができる。 In addition, the information processing apparatus of the present invention is configured to write a verification value for verifying the reliability of the backup area to the backup area in addition to the flag designating the write target sector of the nonvolatile memory. Therefore, even if the memory rewriting process is interrupted due to power interruption or the like, it is possible to determine that the data in the backup area is incomplete based on the verification value. Therefore, the problem of rewriting the nonvolatile memory with erroneous data does not occur, and the highly reliable nonvolatile memory can be rewritten.
この検証値は、チェックサム方式で算出されるチェックサムまたはCRC方式で算出されるCRC値を好適に用いることができる。
また、この不揮発性メモリ書き換えは、フラッシュROMの書き換えにおいて特に好適に適用することができる。
As the verification value, a checksum calculated by the checksum method or a CRC value calculated by the CRC method can be suitably used.
In addition, this nonvolatile memory rewriting can be particularly suitably applied to flash ROM rewriting.
以下、図面を参照しながら、本発明にかかる情報処理装置及び情報処理装置のメモリ書き換え方法の実施形態を説明する。以下の説明では、情報処理装置の例として、プリンタを例に挙げて説明する。 Hereinafter, embodiments of an information processing apparatus and a memory rewriting method of the information processing apparatus according to the present invention will be described with reference to the drawings. In the following description, a printer is taken as an example of the information processing apparatus.
図1は、本実施形態のプリンタを示す模式的なブロック図であり、図2は、本実施形態のフラッシュROMの模式図であり、図3は、本実施形態のフラッシュROM書き換えの流れを示すフローチャートであり、図4は、本実施形態のフラッシュROM書き換えの効果を検証するための模式図である。 FIG. 1 is a schematic block diagram showing the printer of this embodiment, FIG. 2 is a schematic diagram of the flash ROM of this embodiment, and FIG. 3 shows the flow of rewriting the flash ROM of this embodiment. FIG. 4 is a flow chart, and FIG. 4 is a schematic diagram for verifying the effect of rewriting the flash ROM of this embodiment.
本実施形態のプリンタ10は、外部のホストコンピュータ20と通信可能に接続され、ホストコンピュータ20から送信される各種コマンドに応じて動作し、印刷や画像読み取りを実行する画像記録装置である。プリンタ10は、主として、CPU11、フラッシュROM12,RAM13、データ送受信部14,操作部15,EEPROM16、及び画像記録部17を有しており、それぞれは内部バス60により電気的に接続されている。なお、図1では、模式的に一つの内部バス60で各部が接続されているとして説明しているが、各部が機能する限りにおいて、他の構成で接続されていてもよい。
The
CPU11は、プリンタ10の制御中枢であって、フラッシュROM12に書き込まれたファームウェアを実行することにより、プリンタ10の各部の動作を制御する制御部を構成する。
The
フラッシュROM12は、複数のセクタを有し、電気的にデータを書き換え可能な不揮発性メモリである。このフラッシュROM12には、プリンタ制御用のファームウェアや、各種設定値等が記憶されている。フラッシュROM12は、データの消去時には、セクタ単位で一括してデータの消去が実行される。
The
RAM13は、プリンタ10における揮発性の記憶領域である。図1では、模式的に一つのRAM13が描かれているが用途に応じて複数のRAMチップが設けられていてもよい。このRAM13には、ホストコンピュータから受信したデータを一時的に保存する受信バッファ、展開された印刷データを一時的に保存する印刷バッファ、画像データを保存する画像バッファ等が設けられている。
The
データ送受信部14は、外部のホストコンピュータ20との通信を行う制御部である。ホストコンピュータ20から受信するデータ及びホストコンピュータ20へ送信されるデータは、すべてこのデータ送受信部を介して送受信される。
The data transmission /
操作部15は、プリンタ10の筐体に設置された紙送りスイッチ等のユーザインタフェースであり、この操作部15が操作されることにより、プリンタ10は、ユーザからの指示を受け取り、指示に応じて動作する。
The
EEPROM16は、1byte毎にデータを電気的に書き換え可能な不揮発性メモリである。このEEPROM16には、例えば、内部に電源断時にもカウンタ値を保持するための不揮発性メンテナンスカウンタが記憶されている。
The
画像記録部17は、紙送り機構,ヘッド駆動機構及びこれらを駆動するためのドライバ回路等から構成されている。画像記録部17は、ファームウェアに応じて送信されるCPU11からの各種指示及び印刷データに応じて、印刷を実行する。本実施形態では、この画像記録部17が所定の動作を行う駆動部を構成している。
The
次に、図2を参照しながら、フラッシュROM12について説明する。フラッシュROM12は、図2に示すように、例えば10個のセクタを有しており、各セクタには、ファームウェアまたは各種設定値等が記憶されている。本実施形態のフラッシュROM12では、このうちのセクタ10が汎用のデータ記憶領域として用意されており、フラッシュROMのデータ書き換え時には、このセクタ10がバックアップ領域12aとして機能する。
Next, the
バックアップ領域12aは、フラッシュROM12の書き換え時に、書き換え対象セクタに書き込まれる書き換え用データが一時的に作成されて保持される領域である。すなわち、本実施形態では、この書き換え用データを用いて書き換え対象セクタのデータを書き換えるように構成されている。このように構成することにより、バックアップ領域から書き換え対象セクタにデータを書き込む際に電源断等により書き込みが中断されても、電源を再投入すればホストコンピュータ20から再度データを受信することなく、再書き込みを実行することができる。
The
バックアップ領域12aには、そのデータの末尾にチェックサム21とバックアップフラグ22の2つが記憶される。
In the
チェックサム21は、バックアップ領域12aのデータの信頼性チェックに用いられる検証値である。このチェックサム21は、バックアップ領域12aに書き換え用データが作成された時点で算出されるものであり、バックアップ領域12aの先頭アドレスから最終アドレスまでをワード単位で加算して求められた和を反転させた値となっている。
The
バックアップフラグ22は、バックアップ領域12a書き換え用データが作成された時点で設定されるものであり、どのセクタにバックアップ領域12aのデータを書き込むべきかを示す値となっている。
The
なお、上記説明では、バックアップ領域12aは、フラッシュROM12に形成されるとしたが、別体のフラッシュROMやその他の不揮発性メモリが存在すれば、そちらにバックアップ領域12aを設けるようにしてもよい。
In the above description, the
次に、図3及び図4を参照して、本実施形態におけるフラッシュROMの書き換え処理の流れを説明する。 Next, the flow of rewriting processing of the flash ROM in the present embodiment will be described with reference to FIGS.
フラッシュROM12内のデータ書き換えにおいては、CPU11がフラッシュROM12またはフラッシュROM12からRAM13に書き込まれた書き換え用プログラムを実行することにより、フラッシュROM書き換えモードが起動し、このモード内で処理が行われる。
In the data rewrite in the
このフラッシュROM書き換えモードにおいては、図3及び図4に示すように、まずフラッシュROM12内にバックアップ領域12aを確保し、このバックアップ領域12aにホストコンピュータ20から受信した新規書き込みデータを書き込むとともに、フラッシュROM12の書き換え対象セクタに存在する書き換え後にも利用する必要な情報をこのバックアップ領域12aに書き込む。これによりバックアップ領域12aに書き込み用データが生成される(ステップS1)。
In this flash ROM rewrite mode, as shown in FIGS. 3 and 4, first, a
そして、バックアップ領域12aに書き込み用データが生成されると、バックアップ領域12aの先頭アドレスから最終アドレスまでをワード単位で加算し、これを反転した値がチェックサム21としてバックアップ領域12aに書き込まれる(ステップS2)。
When the write data is generated in the
そして、チェックサム21が求められると、次にはバックアップ領域12aに書き込まれた書き込み用データの末尾に書き換え対象セクタのセクタ番号を指定したバックアップフラグ22を書き込む(ステップS3)。
When the
次に、書き換え対象セクタのセクタを一括消去し(ステップS4)、バックアップ領域12aの書き込み用データを書き換え対象セクタに書き込む(ステップS5)。そして、書き換え対象セクタへの書き込みが終了すると、バックアップ領域12aのデータが消去される(ステップS6)。この消去が完了すると、バックアップフラグ22も消去されて、書き換えが完了する。
Next, the sectors of the sector to be rewritten are erased collectively (step S4), and the write data in the
ここで、ステップS6のデータ消去途中に電源断等により、処理が中断されてしまい、バックアップフラグ22が未だに消去されていない状態を考える。この状態は、バックアップ領域12aのデータは不完全なものであるにもかかわらず、バックアップフラグ22が存在するため、バックアップ領域12a全体としては、未だに書き換え対象セクタにデータを書き込む必要があることを意味している。
Here, let us consider a state in which the processing is interrupted due to power interruption or the like during the data erasing in step S6, and the
このような状態で、情報処理装置が電源ON等により再起動されると、バックアップフラグ22の有無及びチェックサム21が検証される。
In this state, when the information processing apparatus is restarted by turning on the power or the like, the presence / absence of the
まず、バックアップフラグ22が存在した場合には、このバックアップフラグ22が指定している書き換え対象セクタを特定する。ここで、バックアップフラグ22の指定が所定の定義域以外であれば、そのバックアップフラグ22は、無効とみなされデータの復旧処理は行われない。
First, when the
一方、バックアップフラグ22の指定が所定の定義域内であれば、バックアップ領域12aのデータを検証するために、バックアップ領域12aの先頭アドレスから最終アドレスまでをワード単位で加算し、バックアップ領域12aに記憶されているチェックサム21との和を求め0xFFFFとなるか確認される(図5,ステップS7)。
On the other hand, if the designation of the
ここで、0xFFFFとなれば、バックアップ領域12aのデータが正常であると判断されて、データの復旧処理が再開される。再開された場合には、ステップS4からステップS6までの処理が実行されることとなる。
Here, if 0xFFFF, it is determined that the data in the
しかしながら、ここでは、ステップS6のデータ消去途中に電源断等により、処理が中断されてしまい、バックアップフラグ22が未だに消去されていない状態となっている。したがって、求められた計算値とチェックサム21との照合は、極めて低い確率でしか0xFFFFにならず、この時点でバックアップ領域12aから書き換え対象セクタへのデータ書き込みは実行されない。よって、フラッシュROM12の記録データの破損を防ぐことができ、書き換え処理及びプリンタの処理システムの信頼性を高めることができる。また、ユーザ単独では復旧不可能となってしまうようにフラッシュROM12が書き換えられることもないので、ユーザの手間を未然に防ぐこともできる。
However, in this case, the processing is interrupted due to power interruption or the like during the data erasing in step S6, and the
ここで、電源断により、偶然にチェックサムと計算値とが一致する場合も考えられるが、その確率は、バックアップフラグ書き込み中の電源断の場合には0%、バックアップ領域消去中の電源断の場合では、0.000016%の確率である(チェックサム16ビットの場合)。これは、プリンタの使用期間内におけるフラッシュROM12の書き換え回数と比較すると十分に低い確率であり、実質的に誤書き換えを十分に防止できる。
Here, there may be a case where the checksum coincides with the calculated value by chance due to the power interruption, but the probability is 0% in the case of the power interruption during the writing of the backup flag, and the probability of the power interruption during the backup area erasing. In some cases, the probability is 0.000016% (in the case of a checksum of 16 bits). This is a sufficiently low probability as compared with the number of times of rewriting of the
なお、上記説明では、検証値の算出にチェックサム方式を用いたが、これに限られず、バックアップ領域12aの信頼性を確認できるものであればその他の方式を用いてもよい。チェックサム方式に代わるものとしては、例えばCRC方式が挙げられる。このCRC方式は、巡回的なアルゴリズム(生成多項式)を適用してバックアップ領域12aのデータからCRCコードと呼ばれる冗長データ(CRC値)を生成し、この冗長データの反転値を検証値としてもよい。この方式は、多ビット・エラーの検出精度が高いという特徴がある。この場合でも、基本的な処理の流れは、チェックサムを用いた場合と同様である。
In the above description, the checksum method is used for calculating the verification value. However, the present invention is not limited to this, and other methods may be used as long as the reliability of the
10 プリンタ
11 CPU
12 フラッシュROM
12a バックアップ領域
13 RAM
14 データ送受信部
15 操作部
16 EEPROM
17 画像記録部
20 ホストコンピュータ
21 チェックサム
22 バックアップフラグ
10
12 Flash ROM
14 Data transmission /
17
Claims (10)
所定の動作を行う駆動部と、
複数のセクタを有し、該複数のセクタ内にファームウェアを記憶する不揮発性メモリと、
前記不揮発性メモリ内のファームウェアを実行することにより前記駆動部を制御するとともに、前記ホストコンピュータから送信されるデータを基に前記ファームウェアを書き換える制御部と、を備え、
前記制御部は、前記不揮発性メモリの書き換えを行うにあたり、前記ホストコンピュータから送信されたデータを基に前記不揮発性メモリ内のバックアップ領域に書き込み用データを生成し、前記バックアップ領域の信頼性を検証するための検証値及び前記不揮発性メモリの書き込み対象セクタを指定するフラグを前記バックアップ領域に書き込み、前記バックアップ領域に書き込まれた書き込み用データを前記フラグに指定された前記書き込み対象セクタに書き込むことにより前記不揮発性メモリの書き換えを実行し、そして前記バックアップ領域のデータを消去することを特徴とする情報処理装置。 A data transmitter / receiver for transmitting / receiving data to / from the host computer;
A drive unit that performs a predetermined operation;
A non-volatile memory having a plurality of sectors and storing firmware in the plurality of sectors;
Controlling the drive unit by executing firmware in the nonvolatile memory, and a control unit for rewriting the firmware based on data transmitted from the host computer,
When rewriting the nonvolatile memory, the control unit generates data for writing in a backup area in the nonvolatile memory based on data transmitted from the host computer, and verifies the reliability of the backup area. By writing a verification value and a flag designating the write target sector of the nonvolatile memory in the backup area, and writing the write data written in the backup area into the write target sector designated by the flag An information processing apparatus that performs rewriting of the nonvolatile memory and erases data in the backup area.
前記不揮発性メモリの書き換えを行うにあたり、前記ホストコンピュータから送信されたデータを基に前記不揮発性メモリ内のバックアップ領域に書き込み用データを生成するステップと、
前記バックアップ領域の信頼性を検証するための検証値を算出し、前記バックアップ領域に書き込むステップと、
前記不揮発性メモリの書き込み対象セクタを指定するフラグを前記バックアップ領域に書き込むステップと、
前記バックアップ領域に書き込まれた書き込み用データを前記フラグに指定された前記書き込み対象セクタに書き込むことにより前記不揮発性メモリの書き換えるステップと、
前記バックアップ領域のデータを消去するステップと、
を備えたことを特徴とする情報処理装置のメモリ書き換え方法。 A memory rewriting method of an information processing apparatus for rewriting firmware stored in a nonvolatile memory based on data transmitted from a host computer,
When rewriting the nonvolatile memory, generating write data in a backup area in the nonvolatile memory based on data transmitted from the host computer;
Calculating a verification value for verifying the reliability of the backup area, and writing to the backup area;
Writing a flag designating a write target sector of the nonvolatile memory in the backup area;
Rewriting the nonvolatile memory by writing the write data written in the backup area to the write target sector designated by the flag;
Erasing data in the backup area;
A memory rewriting method for an information processing apparatus, comprising:
前記フラグが存在する場合には、前記フラグの指定が所定の定義域であり且つ前記検証値を用いて前記バックアップ領域の信頼性が検証された場合にのみ、前記バックアップ領域に書き込まれた書き込み用データを前記フラグに指定された前記書き込み対象セクタに書き込むことにより前記不揮発性メモリの書き換えを実行することを特徴とする請求項6に記載の情報処理装置のメモリ書き換え方法。 A step of determining the presence or absence of the flag after activation;
When the flag is present, the writing for writing in the backup area is performed only when the designation of the flag is a predetermined domain and the reliability of the backup area is verified using the verification value. 7. The memory rewriting method for an information processing apparatus according to claim 6, wherein rewriting of the nonvolatile memory is executed by writing data to the write target sector designated by the flag.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2005224456A JP2007041798A (en) | 2005-08-02 | 2005-08-02 | Information processor and memory rewriting method for information processor |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2005224456A JP2007041798A (en) | 2005-08-02 | 2005-08-02 | Information processor and memory rewriting method for information processor |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2007041798A true JP2007041798A (en) | 2007-02-15 |
Family
ID=37799723
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2005224456A Pending JP2007041798A (en) | 2005-08-02 | 2005-08-02 | Information processor and memory rewriting method for information processor |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2007041798A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2011215870A (en) * | 2010-03-31 | 2011-10-27 | Aisin Aw Co Ltd | Writing device, writing method and writing program |
JP2013114441A (en) * | 2011-11-29 | 2013-06-10 | Sony Corp | Non-volatile cache memory, processing method of non-volatile cache memory, and computer system |
CN115793995A (en) * | 2023-02-10 | 2023-03-14 | 力高(山东)新能源技术股份有限公司 | Pflash-only data storage method for traditional MCU |
-
2005
- 2005-08-02 JP JP2005224456A patent/JP2007041798A/en active Pending
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2011215870A (en) * | 2010-03-31 | 2011-10-27 | Aisin Aw Co Ltd | Writing device, writing method and writing program |
JP2013114441A (en) * | 2011-11-29 | 2013-06-10 | Sony Corp | Non-volatile cache memory, processing method of non-volatile cache memory, and computer system |
US9251057B2 (en) | 2011-11-29 | 2016-02-02 | Sony Corporation | Nonvolatile cache memory, processing method of nonvolatile cache memory, and computer system |
CN115793995A (en) * | 2023-02-10 | 2023-03-14 | 力高(山东)新能源技术股份有限公司 | Pflash-only data storage method for traditional MCU |
CN115793995B (en) * | 2023-02-10 | 2023-04-07 | 力高(山东)新能源技术股份有限公司 | Pflash-only data storage method for traditional MCU |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8683457B1 (en) | Updating firmware of an electronic device by storing a version identifier in a separate header | |
JP4480815B2 (en) | Memory rewriting method and computer system | |
JP2007287022A (en) | Information storage method for electronic control device | |
JP4866107B2 (en) | Nonvolatile memory device and write determination method thereof | |
JP2020160747A (en) | Information processing device, control method therefor, and program | |
JP2008504628A (en) | Safe flushing | |
JP6447469B2 (en) | Rewriting system | |
JP2007041798A (en) | Information processor and memory rewriting method for information processor | |
CN115145650A (en) | Information processing apparatus, storage medium, and information processing method | |
JP4802339B2 (en) | Nonvolatile memory update method | |
JP2012118904A (en) | Information processing apparatus | |
JP6708596B2 (en) | Electronic control device and control program verification method | |
JP4558393B2 (en) | Information processing device | |
JP4238930B2 (en) | Memory rewrite control system. | |
JP4062429B2 (en) | Memory rewrite control method and program for executing each step of memory rewrite control method | |
JP2007069514A (en) | Ink-jet recording device | |
JP2006139341A (en) | Nonvolatile memory system | |
JP2005128613A (en) | Image forming device | |
JP5862350B2 (en) | Flash memory writing device, flash memory writing control method, and program | |
JP2000132461A (en) | Information controller | |
JP2009238071A (en) | Built-in system | |
JP4131147B2 (en) | Determination method of flash memory in printer, program for causing computer to execute this method, recording medium recording this program, and printer including flash memory | |
JP2016062173A (en) | Electronic control apparatus | |
JP6638323B2 (en) | PRINTING APPARATUS AND PRINTING APPARATUS CONTROL METHOD | |
JP5552930B2 (en) | Information processing apparatus and rewriting method |