JP3497066B2 - Data write / read method in flash memory and storage device using flash memory - Google Patents

Data write / read method in flash memory and storage device using flash memory

Info

Publication number
JP3497066B2
JP3497066B2 JP26993397A JP26993397A JP3497066B2 JP 3497066 B2 JP3497066 B2 JP 3497066B2 JP 26993397 A JP26993397 A JP 26993397A JP 26993397 A JP26993397 A JP 26993397A JP 3497066 B2 JP3497066 B2 JP 3497066B2
Authority
JP
Japan
Prior art keywords
block
data
magic
written
flash 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.)
Expired - Fee Related
Application number
JP26993397A
Other languages
Japanese (ja)
Other versions
JPH10177527A (en
Inventor
洋一 小柳
俊幸 清水
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fujitsu Ltd
Original Assignee
Fujitsu Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP26993397A priority Critical patent/JP3497066B2/en
Publication of JPH10177527A publication Critical patent/JPH10177527A/en
Application granted granted Critical
Publication of JP3497066B2 publication Critical patent/JP3497066B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Landscapes

  • Power Sources (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)
  • Read Only Memory (AREA)

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【発明の属する技術分野】パソコン、ワークステーショ
ン、汎用計算機、スーパーコンピュータ、携帯端末、携
帯電話等を含むコンピュータ、通信機器の内部で、電源
を切っても記憶内容が消えることがないフラッシュメモ
リが多用されるようになってきている。本発明は上記し
たフラッシュメモリにおけるデータの書き込み/読み出
し方法およびフラッシュメモリを用いた記憶装置に関
し、特に本発明は、書き込み途中で突然の電源断が発生
しても記憶内容が失われることがないフラッシュメモリ
におけるデータの書き込み/読み出し方法およびフラッ
シュメモリを用いた記憶装置に関するものである。
BACKGROUND OF THE INVENTION A flash memory that does not lose its stored contents even when the power is turned off is frequently used inside computers, communication devices, such as personal computers, workstations, general-purpose computers, supercomputers, mobile terminals, and mobile phones. Is becoming popular. The present invention relates to a method of writing / reading data in a flash memory and a storage device using the flash memory, and in particular, the present invention does not lose the stored contents even if a sudden power failure occurs during writing. The present invention relates to a data writing / reading method in a memory and a storage device using a flash memory.

【0002】[0002]

【従来の技術】フラッシュメモリは、それ自身、電源を
切っても記憶が消えない性質を持つメモリデバイスであ
り、従来から携帯電話などの小型電子機器の内部設定値
の記憶や、固定ディスク装置に置き換えて使用できる半
導体ディスク等に応用されている。上記した従来のフラ
ッシュメモリの応用においては、フラッシュメモリへの
データの書き込み途中における突然の電源断の発生につ
いては考慮されておらず、最悪の場合にはそれまでにフ
ラッシュメモリに書き込んだ設定値が失われて装置が起
動しないなどの影響を及ぼす可能性があった。
2. Description of the Related Art A flash memory is a memory device that has the property of not losing its memory even when the power is turned off. It has been conventionally used for storing internal setting values of small electronic devices such as mobile phones and fixed disk devices. It is applied to semiconductor disks that can be used by replacing them. The application of the conventional flash memory described above does not take into consideration the occurrence of sudden power failure while writing data to the flash memory.In the worst case, the set value written in the flash memory up to that point It could be lost and the device could not start.

【0003】[0003]

【発明が解決しようとする課題】フラッシュメモリへの
データの書き込みは、通常、チップ全体または全体をい
くつかの部分に分割したブロック単位に消去したのち、
1バイト毎のデータを書き込んでいく。このため、フラ
ッシュメモリのデータを更新する際に、消去を行った直
後またはデータを書き込んでいる最中に電源断が発生す
ると、更新前のデータは消去されたが新しいデータが書
き込まれずに装置が停止することとなる。したがって
次に装置を起動してデータを読もうとした時に一貫性が
失われて情報が失われるしまう。本発明は上記した従来
技術の問題点を考慮してなされたものであって、その目
的とするところは、データ更新中に電源断になっても、
情報が失われたり不正な値になってしまうことがないフ
ラッシュメモリにおけるデータの書き込み/読み出し方
法およびフラッシュメモリを用いた記憶装置を提供する
ことである。
Writing data to a flash memory is usually performed by erasing the entire chip or a block unit in which the whole is divided into several parts,
Data is written for each byte. Therefore, when updating the data in the flash memory, if power is cut off immediately after erasing data or while data is being written, the data before updating will be erased but new data will not be written to the device. It will be stopped. Therefore ,
The next time you boot the device and try to read the data, it will be inconsistent and information will be lost. The present invention has been made in consideration of the above-mentioned problems of the prior art, and an object of the present invention is to cut off the power during data update,
It is an object of the present invention to provide a data writing / reading method in a flash memory and a storage device using the flash memory in which information is not lost or becomes an illegal value.

【0004】[0004]

【課題を解決するための手段】図1は本発明の原理図で
ある。同図は原理動作を示すため、一つのデータ単位を
扱う記憶装置として構成されている。同図において、1
はフラッシュメモリであり、フラッシュメモリ1はブロ
ック0とブロック1の2つのブロックから構成されてお
り、フラッシュメモリ1の各ブロック0,1には、デー
タの書き込み順序を示すシーケンシャル・ナンバと、デ
ータが有効であるか否かを管理するためのマジック・ナ
ンバと、実際のデータが書き込まれる。2はフラッシュ
メモリを消去したり、フラッシュメモリに、データ、シ
ーケンシャル・ナンバ、マジック・ナンバを書き込む消
去・書き込み手段、3はマジック・ナンバが正しい値で
あるか否かを調べるマジック・ナンバ検査手段である。
FIG. 1 shows the principle of the present invention. Since the figure shows the principle operation, it is configured as a storage device that handles one data unit. In the figure, 1
Is a flash memory, and the flash memory 1 is composed of two blocks, a block 0 and a block 1. Each block 0, 1 of the flash memory 1 has a sequential number indicating a data writing order and data. A magic number for managing whether it is valid and actual data are written. 2 is an erasing / writing means for erasing the flash memory and writing data, a sequential number and a magic number in the flash memory, and 3 is a magic number checking means for checking whether or not the magic number is a correct value. is there.

【0005】4,4’,6はセレクタ手段であり、セレ
クタ手段4,4’はマジック・ナンバ検査手段3により
マジック・ナンバが正しいと判断された場合には、フラ
ッシュメモリ1から読み出されたシーケンシャル・ナン
バを選択して出力し、マジック・ナンバが正しくない場
合、”0”を選択して出力する。セレクタ手段6は、後
述する比較手段5の比較結果に基づき、上記セレクタ手
段4,4’が出力するシーケンシャル・ナンバの値の大
きい方のフラッシュメモリ1のブロックからデータを読
み出す。
Reference numerals 4, 4 ', 6 are selector means, and the selector means 4, 4'are read from the flash memory 1 when the magic number checking means 3 determines that the magic number is correct. Sequential number is selected and output. If the magic number is incorrect, "0" is selected and output. The selector means 6 reads data from the block of the flash memory 1 having the larger sequential number value output by the selector means 4, 4 ', based on the comparison result of the comparison means 5 described later.

【0006】5は比較手段であり、比較手段5はセレク
タ手段4,4’の出力を比較する。そして、その比較結
果に基づき次のようにしてフラッシュメモリ1からのデ
ータの読み出し、消去、書き込みが行われる。 データの読み出し時、セレクタ手段4,4’が出力
するシーケンシャル・ナンバの内、シーケンシャル・ナ
ンバが大きい方のフラッシュメモリ1のブロックをセレ
クタ手段6により選択し、そのブロックからデータを読
み出す。 データの書き込み時、セレクタ手段4,4’が出力
するシーケンシャル・ナンバの内、シーケンシャル・ナ
ンバが小さい方のフラッシュメモリ1のブロックを消去
してデータを書き込む。また、ブロック0,1のシーケ
ンシャルナンバの内、大きい方のシーケンシャルナンバ
の値を+1して、データを書き込んだブロックにシーケ
ンシャルナンバの値を書き込む。
Reference numeral 5 is a comparison means, and the comparison means 5 compares the outputs of the selector means 4 and 4 '. Then, based on the comparison result, reading, erasing and writing of data from the flash memory 1 are performed as follows. When reading data, the selector means 6 selects a block of the flash memory 1 having a larger sequential number among the sequential numbers output by the selector means 4 and 4 ′, and the data is read from the block. When writing data, the block of the flash memory 1 having the smaller sequential number among the sequential numbers output by the selector means 4 and 4'is erased and the data is written. Also, of the sequential numbers of blocks 0 and 1, the value of the larger sequential number is incremented by 1, and the value of the sequential number is written in the block in which the data has been written.

【0007】次に、本発明により〔書き込み〕、〔読み
出し〕を繰り返して行ったときの動作を説明する。な
お、初期状態では、フラッシュメモリ1の値は全て0xFF
である。また、マジック・ナンバの値は任意の特定値を
用いることができるが、ここでは、0x12345678(32bit)
とする。シーケンシャル番号は、4バイト(32bit) で表
される整数でヘッダに書き込まれものとする。次に図2
〜図7により、本発明において、書き込み、読み出しを
繰り返して行う場合の動作を説明する。
Next, the operation when the [writing] and [reading] are repeated according to the present invention will be described. In the initial state, all values in flash memory 1 are 0xFF.
Is. Also, the magic number value can be any specific value, but here, 0x12345678 (32bit)
And The sequential number is an integer represented by 4 bytes (32 bits) and is written in the header. Next in FIG.
7A to 7C, the operation of the present invention when writing and reading are repeated will be described.

【0008】(a) データAの書き込み 初期状態においては、図2に示すように、フラッシュメ
モリ1のそれぞれのブロックのマジックナンバはどちら
も0xFFFFFFFFであり、正しい値ではない。マジックナン
バの値が正しくない時、図1にセレクタ手段4,4’
は”0”を選択する。すなわち、シーケンシャルナンバ
は”0”と見なされる。このようにすれば、”0”より
小さい値はないので、データの書き込み時、マジックナ
ンバの正しくない方のブロックが消去され、データが書
き込まれることとなる(図1に示すようにシーケンシャ
ルナンバの値の小さい方のブロックにデータが書き込ま
れるため)。また、データの読み出し時には、マジック
ナンバの正しい方のブロックからデータが読み出される
こととなる(図1に示すようにシーケンシャルナンバの
大きい方のブロックからデータが読み出されるため)。
(A) In the initial state of writing the data A, as shown in FIG. 2, the magic number of each block of the flash memory 1 is 0xFFFFFFFF, which is not a correct value. When the value of the magic number is incorrect, the selector means 4, 4'shown in FIG.
Selects "0". That is, the sequential number is regarded as "0". By doing this, from "0"
Since there is no small value, when writing data, the block with the incorrect magic number is erased and the data is written (data is written to the block with the smaller sequential number value as shown in FIG. 1). Because). Further, at the time of reading the data, the data is read from the block having the correct magic number (because the data is read from the block having the larger sequential number as shown in FIG. 1).

【0009】最初は、マジックナンバが両ブロックとも
正しくないので、どちらも0と見なされ、比較の結果は
どちらでもよいが、ここではデータを書き込むブロック
として、ブロック0を選択するとする。ブロック0が選
択されると、図2に示すように、消去・書き込み手段2
はブロック0を消去し、データAを書き込む。ついで、
ブロック0,1のシーケンシャルナンバの内、大きい方
の値0を+1して1を得て、ブロック0のシーケンシャ
ルナンバに1を書き込む。最後にマジックナンバ0x1234
5678をブロック0に書き込む。
At first, both blocks are regarded as 0 because the magic numbers are not correct in both blocks, and the result of the comparison may be either, but here it is assumed that block 0 is selected as the block to write data. When the block 0 is selected, as shown in FIG.
Erases block 0 and writes data A. Then,
Of the sequential numbers of blocks 0 and 1, the larger value 0 is incremented by 1 to obtain 1, and 1 is written to the sequential number of block 0. Finally the magic number 0x1234
Write 5678 to block 0.

【0010】(b) データの読み出し 図3に示すように、ブロック0のマジックナンバは正し
いので、セレクタ手段4を介してブロック0のシーケン
シャルナンバは1と読み出される。また、ブロック1の
マジックナンバは正しくないので、セレクタ手段4’に
よりブロック1のシーケンシャル番号は0とみなされ
る。比較手段5はこれらを比較し、セレクタ手段6が、
シーケンシャルナンバの値の大きい方のブロック0を選
択し、ブロック0に書き込まれたデータAが読み出され
る。
(B) Data reading As shown in FIG. 3, since the magic number of the block 0 is correct, the sequential number of the block 0 is read as 1 through the selector means 4. Further, since the magic number of the block 1 is incorrect, the sequential number of the block 1 is regarded as 0 by the selector means 4 '. The comparison means 5 compares these, and the selector means 6
The block 0 having the larger sequential number is selected, and the data A written in the block 0 is read.

【0011】(c) データBの書き込み(データA→Bへ
の内容更新) 図3に示すようにフラッシュメモリ1のブロック0にデ
ータAが書き込まれた状態からフラッシュメモリ1の内
容をデータBに更新する場合は、図4に示すようにシー
ケンシャルナンバが0と見なされるブロック1に新たな
データBが書き込まれ、ブロック1のシーケンシャルナ
ンバに2が設定される。すなわち、次のようにしてデー
タBが書き込まれる。ブロック0のマジックナンバは正
しいので、ブロック0のシーケンシャルナンバは1と読
み出され、また、ブロック1のマジックナンバは正しく
ないので、0と見なされる。比較手段5はこれらを比較
して、図4に示すように、シーケンシャルナンバの値の
小さい方のブロックであるブロック1を選択し、ブロッ
ク1を消去してデータBを書き込む。ついで、ブロック
0,1のシーケンシャルナンバの内、大きい方の値1に
1を加えて2を得て、ブロック1のシーケンシャルナン
バに2を書き込む。最後にブロック1にマジックナンバ
0x12345678を書き込む。
(C) Writing of data B (update of contents from data A to B) As shown in FIG. 3, the contents of flash memory 1 are changed to data B from the state in which data A is written in block 0 of flash memory 1. When updating, as shown in FIG. 4, new data B is written in the block 1 whose sequential number is regarded as 0, and 2 is set in the sequential number of the block 1. That is, the data B is written as follows. Since the magic number of block 0 is correct, the sequential number of block 0 is read as 1, and since the magic number of block 1 is incorrect, it is regarded as 0. As shown in FIG. 4, the comparing means 5 compares these and selects the block 1 which is the block having the smaller sequential number value, erases the block 1 and writes the data B. Then, of the sequential numbers of blocks 0 and 1, 1 is added to the larger value 1 to obtain 2, and 2 is written to the sequential number of block 1. Finally in block 1 magic number
Write 0x12345678.

【0012】(d) データの読み出し 図4に示すデータA,Bが書き込まれたフラッシュメモ
リ1からのデータの読み出しは次のように行われる。図
5に示すように、ブロック0のマジックナンバは正しい
ので、シーケンシャルナンバは1と読み出される。ま
た、ブロック1のマジックナンバも正しいので、ブロッ
ク1のシーケンシャル番号は2と読み出される。比較手
段5はこれらを比較して、シーケンシャルナンバの値の
大きい方のブロック1が選択され、ブロック1に書き込
まれたデータBが読み出される。すなわち、新たに書き
込まれたデータBが読み出され、データがA→Bに更新
されたように読み出される。ここで、データBの書き込
中に電源断になると、更新データBの書き込みは中断
されデータBは書き込みが不完全となるが、ブロック0
のデータAが残っており、データが消えてしまうことが
ない。
(D) Reading of data Reading of data from the flash memory 1 in which the data A and B shown in FIG. 4 are written is performed as follows. As shown in FIG. 5, since the magic number of block 0 is correct, the sequential number is read as 1. Since the magic number of block 1 is also correct, the sequential number of block 1 is read as 2. The comparison means 5 compares these and selects the block 1 having the larger sequential number value, and the data B written in the block 1 is read. That is, the newly written data B is read, and the data is read as if updated from A to B. Here, write data B
If the power is cut off during the operation, the writing of the update data B is interrupted and the writing of the data B is incomplete, but the block 0
The data A of No. remains, and the data will not disappear.

【0013】(e) データCの書き込み(データB→Cへ
の内容更新) 図5に示すようにフラッシュメモリ1のブロック0,1
にそれぞれデータA,Bが書き込まれた状態からフラッ
シュメモリ1の内容をデータCに更新する場合は、図6
に示すようにシーケンシャルナンバが1と見なされるブ
ロック0に新たなデータCが書き込まれ、ブロック0の
シーケンシャルナンバに3が設定される。すなわち、次
のようにしてデータCが書き込まれる。ブロック0のマ
ジックナンバは正しいので、ブロック0のシーケンシャ
ルナンバは1と読み出され、また、ブロック1のマジッ
クナンバは正しいので、2と読み出される。比較手段5
はこれらを比較して、図6に示すように、シーケンシャ
ルナンバの値の小さい方のブロックであるブロック0を
選択し、ブロック0を消去してデータCを書き込む。つ
いで、ブロック0,1のシーケンシャルナンバの内、大
きい方の値2に1を加えて3を得て、ブロック0のシー
ケンシャルナンバに3を書き込む。最後にブロック0に
マジックナンバ0x12345678を書き込む。
(E) Writing of data C (update of contents from data B to C) As shown in FIG. 5, blocks 0 and 1 of the flash memory 1
When the contents of the flash memory 1 are updated to the data C from the state in which the data A and B are respectively written in FIG.
As shown in (1), new data C is written in the block 0 whose sequential number is regarded as 1, and 3 is set in the sequential number of the block 0. That is, the data C is written as follows. Since the magic number of block 0 is correct, the sequential number of block 0 is read as 1, and since the magic number of block 1 is correct, it is read as 2. Comparison means 5
6, these are compared and, as shown in FIG. 6, block 0, which is the block having the smaller sequential number value, is selected, block 0 is erased, and data C is written. Next, of the sequential numbers of blocks 0 and 1, 1 is added to the larger value 2 to obtain 3, and 3 is written to the sequential number of block 0. Finally, write the magic number 0x12345678 in block 0.

【0014】(f) データの読み出し 図6に示すデータB,Cが書き込まれたフラッシュメモ
リ1からのデータの読み出しは次のように行われる。図
7に示すように、ブロック0のマジックナンバは正しい
ので、シーケンシャルナンバは3と読み出される。ま
た、ブロック1のマジックナンバも正しいので、ブロッ
ク1のシーケンシャル番号は2と読み出される。比較手
段5はこれらを比較して、シーケンシャルナンバの値の
大きい方のブロック0が選択され、ブロック9に書き込
まれたデータCが読み出される。すなわち、新たに書き
込まれたデータCが読み出され、データがB→Cに更新
されたように読み出される。
(F) Reading of Data Reading of data from the flash memory 1 in which the data B and C shown in FIG. 6 are written is performed as follows. As shown in FIG. 7, since the magic number of block 0 is correct, the sequential number is read as 3. Since the magic number of block 1 is also correct, the sequential number of block 1 is read as 2. The comparing means 5 compares these and selects the block 0 having the larger sequential number value, and the data C written in the block 9 is read. That is, the newly written data C is read, and the data is read as if it was updated from B to C.

【0015】以上の操作を繰り返すことで、常に更新さ
れたデータが正しく読み出される。以上の過程のどこか
の操作で、突然の電源断などで処理が不完全のままにな
ってしまった場合、上記したように、2つのブロックの
内の一方しか消去/書き込み操作をしておらず、しか
も、マジックナンバおよびシーケンシャルナンバによ
り、それぞれのブロックのデータのどちらが正しいもの
で、かつ新しいものかを管理しているので、データが失
われたり内容が破壊されてしまうことがない。例えば、
図6において、データCを書き込んだのち、シーケンシ
ャルナンバを書き込んでいるときに電源断が発生した場
合であっても、マジックナンバは最後に書き込まれるの
で、マジックナンバが正しい値にならずそのデータが正
しいものと認識されることがない。
By repeating the above operation, the updated data is always read correctly. If the processing remains incomplete due to a sudden power failure or the like due to some operation in the above process, only one of the two blocks must be erased / written as described above. Moreover, since the magic number and the sequential number manage which of the data in each block is correct and new, the data is not lost or the contents are not destroyed. For example,
In FIG. 6, even if a power failure occurs while writing the sequential number after writing the data C, the magic number is written last, so the magic number does not become the correct value and the data is It is never recognized as correct.

【0016】 以上のように本発明は次のようにして前
記課題を解決する。 (1)ブロック毎に消去ができ、バイト毎に書き込みが
できるフラッシュメモリにおいて、フラッシュメモリを
2つのブロックに分割し、フラッシュメモリの各ブロッ
クに、データが有効であることを示す任意の特定値であ
るマジックナンバと、データの書き込み履歴を示すシー
ケンシャルナンバを書き込むヘッダ領域を設け、フラッ
シュメモリにデータ単位を書き込む際、2つのブロック
のヘッダ領域に格納されたマジックナンバを調べ、マジ
ックナンバがともに正しい値でないとき、第1のブロッ
クを選択してそのブロックを消去して書き込むべきデー
タ単位を第1のブロックに書き込み、ついで該ブロック
のヘッダ領域のシーケンシャル番号に1を書き込み、マ
ジックナンバの一方のみが正しい値のとき、マジックナ
ンバが正しい値でない方のブロックを選択して、該ブロ
ックを消去して、書き込むべきデータ単位を上記ブロッ
クに書き込み、ついで該ブロックのヘッダ領域のシーケ
ンシャル番号に、他方のブロックのヘッダ領域に記憶さ
れているシーケンシャル番号に1を加えた値を書き込
み、マジックナンバが共に正しい値のとき、両方のブロ
ックからシーケンシャルナンバを読み出して比較し、シ
ーケンシャルナンバの値が小さい方のブロックを選択
し、該ブロックを消去して書き込むべきデータ単位を書
き込み、ついで該ブロックのヘッダ領域のシーケンシャ
ル番号に、他方のブロックのヘッダ領域に記憶されてい
るシーケンシャル番号に1を加えた値を書き込み、最後
に、上記ブロックのヘッダ領域にマジックナンバを書き
込む。 (2)フラッシュメモリに格納されたデータ単位を読み
出す際、2つのブロックのヘッダ領域に格納されたマジ
ックナンバを調べ、マジックナンバの一方が正しい値で
あるとき、マジックナンバの正しい値であるブロックか
ら読み出し、 マジックナンバがともに正しい値のと
き、書き込み履歴を示すシーケンャルナンバの値の大き
いブロックから読み出す
As described above, the present invention solves the above problems as follows. (1) In the flash memory that can be erased for each block and written for each byte ,
It is divided into two blocks and each block of flash memory is
Is any specific value that indicates that the data is valid.
The magic number and the data write history.
A header area for writing the
Two blocks when writing a data unit to memory
Check the magic number stored in the header area of the
If the check numbers are not correct, the first block
Data to be erased and written to that block.
Data unit in the first block, then the block
Write 1 to the sequential number in the header area of
If only one of the Zick numbers has the correct value, the magic
Select the block whose number is not correct and select the block
Erase the block and set the data unit to be written to the block above.
To the header area of the block.
Stored in the header area of the other block.
Write the value obtained by adding 1 to the sequential number
If both magic numbers are correct, both blocks
Read out the sequential numbers from the
-Select the block with the smallest sequential number
Then, erase the block and write the data unit to be written.
Sequencing of the header area of the block
Stored in the header area of the other block
Write the value obtained by adding 1 to the sequential number
Write the magic number in the header area of the above block
Put in. (2) When reading the data unit stored in the flash memory, the magic numbers stored in the header areas of the two blocks are checked, and when one of the magic numbers has a correct value, the block with the correct magic number If the read and magic numbers are both correct
The value of the sequential number indicating the write history
Read from the block .

【0017】[0017]

【0018】[0018]

【発明の実施の形態】次に、計算機のシステムのシステ
ム制御装置において、システムの構成情報などのデータ
をフラッシュメモリにより設定する実施例について説明
する。なお、以下の説明では、ソフトウェアによりフラ
ッシュメモリの消去、書き込み操作に行う場合ついて説
明するが、本発明は、ハードウェアにより実現すること
もできる。
BEST MODE FOR CARRYING OUT THE INVENTION Next, an embodiment in which data such as system configuration information is set by a flash memory in a system controller of a computer system will be described. In the following description, the case where the flash memory is erased and written by software will be described, but the present invention can also be realized by hardware.

【0019】図8は本発明の実施例のシステムの構成を
示す図である。同図において、10は計算機システム、
11はホスト計算機であり、ホスト計算機11は計算機
システム10のシステム制御装置12内に設けられたホ
ストインタフェース12bを介して計算機システム10
と接続されている。計算機システム10において、12
はシステム制御装置であり、システム制御装置12はマ
イククロプロセッサ12aと、前記ホストインタフェー
ス12bと、前記システム構成情報等を記憶するフラッ
シュメモリ12cと、複数の演算装置13およびネット
ワーク装置14と接続される制御インタフェース12d
を備えている。演算装置13はネットワーク装置14を
介して相互に接続されており、演算装置13により各種
処理が行われる。また、15は、プリンタ、キーボー
ド、ディスプレイ、外部記憶装置等の各種I/O装置で
ある。
FIG. 8 is a diagram showing the configuration of the system according to the embodiment of the present invention. In the figure, 10 is a computer system,
Reference numeral 11 denotes a host computer, and the host computer 11 is connected to the computer system 10 via a host interface 12b provided in the system controller 12 of the computer system 10.
Connected with. In the computer system 10, 12
Is a system control device, and the system control device 12 is connected to a microprocessor 12a, the host interface 12b, a flash memory 12c for storing the system configuration information and the like, a plurality of arithmetic devices 13 and a network device 14. Control interface 12d
Is equipped with. The arithmetic devices 13 are connected to each other via a network device 14, and the arithmetic devices 13 perform various processes. Reference numeral 15 is various I / O devices such as a printer, a keyboard, a display, and an external storage device.

【0020】上記計算機システム10のシステム制御装
置12においては、計算機システム10の電源制御やエ
ラー監視などの機能を実現するため、システム構成要素
(演算装置13やI/O装置15)の数や種類を記憶し
ておかなければならない。システムの構成の変更や増設
の際には、この設定値は変更されるが、この情報が失わ
れるとシステム全体の起動/停止やエラー監視が不可能
となり、重大な支障をきたす。そこで、本実施例におい
ては、上記フラッシュメモリ12cを前記したようにブ
ロック0、ブロック1に分け、それぞれのブロックに交
互に上記システム構成要素の数や種類に関するデータを
書き込み、また、それぞれのブロックから交互に上記デ
ータを読み出す。
In the system controller 12 of the computer system 10, the number and types of system components (the arithmetic unit 13 and the I / O device 15) are provided in order to realize functions such as power supply control and error monitoring of the computer system 10. Must be remembered. Although this set value is changed when the system configuration is changed or the system is expanded, if this information is lost, it becomes impossible to start / stop the entire system and monitor the error, which causes a serious trouble. Therefore, in the present embodiment, the flash memory 12c is divided into the block 0 and the block 1 as described above, and the data regarding the number and type of the system constituent elements are alternately written into each block, and the respective blocks are also written. The above data is read alternately.

【0021】図9、図10は本実施例におけるデータの
書き込み/読み出し処理を示すフローチャートであり、
同図を参照しながら本実施例の処理を説明する。フラッ
シュメモリ12cに上記システム構成要素の数や種類に
関するデータを書き込む際、ホスト計算機11はシステ
ム制御装置12に対して設定データを書き込むコマンド
を発行し、上記システム構成要素の数や種類に関するデ
ータを送る。上記コマンドとデータはシステム制御装置
12のホストインタフェース12bで受信され、マイク
ロプロセッサ12aは上記データをフラッシュメモリ1
2cに書き込む。
FIG. 9 and FIG. 10 are flow charts showing the data write / read processing in this embodiment.
The processing of this embodiment will be described with reference to FIG. When writing the data regarding the number and types of the above-mentioned system components to the flash memory 12c, the host computer 11 issues a command for writing the setting data to the system controller 12, and sends the data regarding the number and the types of the above-mentioned system components. . The command and data are received by the host interface 12b of the system controller 12, and the microprocessor 12a stores the data in the flash memory 1
Write to 2c.

【0022】図9は上記データを書き込む際のフローチ
ャートである。データの書き込み時、まず、マイクロプ
ロセッサ12aは、フラッシュメモリ12cのブロック
0のマジックナンバを読み出してメモリ等の記憶領域ma
gic0に書き込む(図9のステップS1)。ついで、magi
c0に書き込まれたブロック0のマジックナンバが0x1234
5678であるか否かを確認する(ステップS2)。ブロッ
ク0のマジックナンバが正しい値であると(上記0x1234
5678に等しい)、ステップS4に進み、マイクロプロセ
ッサ12aは、ブロック0のシーケンシャルナンバを読
み出して、記憶領域seq0に書き込む。また、マジックナ
ンバが正しい値でない場合には(上記0x12345678に等し
くない)、記憶領域seq0に0を書き込み、ステップS5
に進む。ステップS5において、ブロック1のマジック
ナンバを読み出して、記憶領域magic1に書き込む。
FIG. 9 is a flowchart for writing the above data. When writing data, the microprocessor 12a first reads the magic number of the block 0 of the flash memory 12c and stores it in a storage area ma such as a memory.
Write to gic0 (step S1 in FIG. 9). Then, magi
The magic number of block 0 written in c0 is 0x1234
It is confirmed whether it is 5678 (step S2). If the magic number of block 0 is correct (0x1234 above)
(Equal to 5678), the microprocessor 12a reads the sequential number of the block 0 and writes it in the storage area seq0 in step S4. If the magic number is not a correct value (not equal to 0x12345678 above), 0 is written in the storage area seq0, and step S5 is executed.
Proceed to. In step S5, the magic number of block 1 is read and written in the storage area magic1.

【0023】ついで、magic1に書き込まれたブロック1
のマジックナンバが0x12345678であるか否かを確認する
(ステップS6)。ブロック1のマジックナンバが正し
い値であると(上記0x12345678に等しい)、ステップS
8に進み、マイクロプロセッサ12aはブロック1のシ
ーケンシャルナンバを読み出して、記憶領域seq1に書き
込む。また、マジックナンバが正しい値でない場合には
(上記0x12345678に等しくない)、記憶領域seq1に0を
書き込み、ステップS9に進む。ステップS9におい
て、マイクロプロセッサ12aはseq0とseq1の値を比較
し、seq0の値がseq1の値より小さい場合には、ブロック
0を消去して(ステップ10)、データをブロック0に
書き込む(ステップS11)。そして、ブロック1のシ
ーケンシャルナンバseq1の値に1を加えて、ブロック0
のシーケンシャルナンバ格納域に格納する(ステップS
12)。さらに、ブロック0のマジックナンバ格納域に
マジックナンバ(=0x12345678)を書き込み(ステップ
S13)処理を終了する。
Next, block 1 written in magic1
It is confirmed whether the magic number of is 0x12345678 (step S6). If the magic number of block 1 is correct (equal to 0x12345678 above), step S
In step 8, the microprocessor 12a reads the sequential number of block 1 and writes it in the storage area seq1. If the magic number is not a correct value (not equal to 0x12345678 above), 0 is written in the storage area seq1 and the process proceeds to step S9. In step S9, the microprocessor 12a compares the values of seq0 and seq1, and when the value of seq0 is smaller than the value of seq1, erases block 0 (step 10) and writes the data to block 0 (step S11). ). Then, add 1 to the value of the sequential number seq1 of block 1 to block 0
Sequential number storage area (step S
12). Further, the magic number (= 0x12345678) is written in the magic number storage area of the block 0 (step S13), and the process is terminated.

【0024】また、seq0の値がseq1の値より大きい場合
には、ブロック1を消去して(ステップ14)、データ
をブロック1に書き込む(ステップS15)。そして、
ブロック1のシーケンシャルナンバseq0の値に1を加え
て(ステップS16)、ブロック1のシーケンシャルナ
ンバ格納域に格納する。さらに、ブロック1のマジック
ナンバ格納域にマジックナンバ(=0x12345678)を書き
込み(ステップS17)、処理を終了する。上記のよう
にして、フラッシュメモリ12cにシステム構成要素の
数や種類に関するデータが書き込まれると、システムの
起動等の際、システム制御装置12のマイクロプロセッ
サ12aは、上記フラッシュメモリ12cに書き込まれ
たデータを読み出し、その情報等にしたがって演算装置
13等に制御インタフェース12dを介して制御信号等
を送出する。
If the value of seq0 is larger than the value of seq1, block 1 is erased (step 14) and data is written to block 1 (step S15). And
1 is added to the value of the sequential number seq0 of the block 1 (step S16) and the result is stored in the sequential number storage area of the block 1. Further, the magic number (= 0x12345678) is written in the magic number storage area of the block 1 (step S17), and the process is ended. When data relating to the number and types of system components is written in the flash memory 12c as described above, the microprocessor 12a of the system control device 12 causes the data written in the flash memory 12c when the system is started. Is read out and a control signal or the like is sent to the arithmetic unit 13 or the like via the control interface 12d in accordance with the information or the like.

【0025】図10はフラッシュメモリ12cに書き込
まれたデータを読み出す際の処理を示すフローチャート
である。データの読み出し時、まず、マイクロプロセッ
サ12aは、フラッシュメモリ12cのブロック0のマ
ジックナンバを読み出して記憶領域magic0に書き込む
(図10のステップS1)。ついで、magic0に書き込ま
れたブロック0のマジックナンバが0x12345678であるか
否かを確認する(ステップS2)。ブロック0のマジッ
クナンバが正しい値であると(上記0x12345678に等し
い)、ステップS4に進み、マイクロプロセッサ12a
は、ブロック0のシーケンシャルナンバを読み出して、
記憶領域seq0に書き込む。また、マジックナンバが正し
い値でない場合には(上記0x12345678に等しくない)、
マイクロプロセッサ12aの記憶領域seq0に0を書き込
み、ステップS5に進む。
FIG. 10 is a flow chart showing the processing when reading the data written in the flash memory 12c. When reading data, first, the microprocessor 12a reads the magic number of the block 0 of the flash memory 12c and writes it in the storage area magic0 (step S1 in FIG. 10). Then, it is confirmed whether or not the magic number of the block 0 written in magic0 is 0x12345678 (step S2). If the magic number of block 0 is a correct value (equal to 0x12345678 above), the process proceeds to step S4, and the microprocessor 12a
Reads the sequential number of block 0,
Write to storage area seq0. If the magic number is not correct (not equal to 0x12345678 above),
0 is written in the storage area seq0 of the microprocessor 12a, and the process proceeds to step S5.

【0026】ステップS5において、ブロック1のマジ
ックナンバを読み出して、記憶領域magic1に書き込む。
ついで、magic1に書き込まれたブロック1のマジックナ
ンバが0x12345678であるか否かを確認する(ステップS
6)。ブロック1のマジックナンバが正しい値であると
(上記0x12345678に等しい)、ステップS8に進み、マ
イクロプロセッサ12aはブロック1のシーケンシャル
ナンバを読み出して、記憶領域seq1に書き込む。また、
マジックナンバが正しい値でない場合には(上記0x1234
5678に等しくない)、記憶領域seq1に0を書き込み、ス
テップS9に進む。
In step S5, the magic number of block 1 is read and written in the storage area magic1.
Then, it is confirmed whether or not the magic number of block 1 written in magic1 is 0x12345678 (step S
6). If the magic number of block 1 is a correct value (equal to 0x12345678 above), the process proceeds to step S8, and the microprocessor 12a reads the sequential number of block 1 and writes it in the storage area seq1. Also,
If the magic number is not correct (0x1234 above)
(Not equal to 5678), 0 is written in the storage area seq1, and the process proceeds to step S9.

【0027】ステップS9において、マイクロプロセッ
サ12aはseq0とseq1の値を比較し、seq0の値がseq1の
値より小さい場合には、データをブロック1から読み出
す。(ステップS10)。また、seq0の値がseq1の値よ
り大きい場合には、データをブロック0から読み出す。
(ステップ11) 以上のように、マジックナンバによりデータの正さを確
認しながら、シーケンシャルナンバによりデータの更新
順序を確認し、フラッシュメモリの2つのブロックに交
互にデータを書き込むとともに、フラッシュメモリの2
つのブロックから交互にデータを読み出すことにより、
電源断になってもデータが失われたり、破壊されること
がない。
In step S9, the microprocessor 12a compares the values of seq0 and seq1, and if the value of seq0 is smaller than the value of seq1, reads the data from the block 1. (Step S10). If the value of seq0 is larger than the value of seq1, the data is read from block 0.
(Step 11) As described above, while confirming the correctness of the data by the magic number, the update order of the data is confirmed by the sequential number, the data is written alternately to the two blocks of the flash memory, and the data of the flash memory
By alternately reading data from one block,
Data will not be lost or destroyed even when the power is turned off.

【0028】[0028]

【発明の効果】以上説明したように本発明においては、
フラッシュメモリの各ブロックにデータが有効であるこ
とを示すマジックナンバと、データの書き込み履歴を示
すシーケンシャルナンバを示すヘッダ領域を設け、各ブ
ロックのマジックナンバと、シーケンシャルナンバを調
べ、一つの記憶すべきデータ単位をフラッシュメモリの
2つのブロックに交互に書き込み、データ読み出し時、
2つのブロックに格納されたデータ単位の内、正常に書
き込みが行われた最新のデータ単位を読み出すようにし
ているので、いかなるタイミングにおいても装置の電源
断によって情報が失われることがない。また、フラッシ
ュメモリのデータ更新中であった場合には、更新が失敗
するだけであり、以前に書き込まれた情報がなくなって
しまったり、あるいは不正な値になってしまうことがな
い。
As described above, in the present invention,
Each block of the flash memory is provided with a header area showing a magic number indicating that the data is valid and a sequential number indicating the writing history of the data, and the magic number and the sequential number of each block are checked and one memory should be stored. Alternately write data unit to two blocks of flash memory and read data
Of the data units stored in the two blocks, the latest data unit that has been normally written is read out, so that the information will not be lost due to the power-off of the device at any timing. Further, when the data in the flash memory is being updated, the update only fails, and the previously written information is not lost or has an incorrect value.

【図面の簡単な説明】[Brief description of drawings]

【図1】本発明の原理構成図である。FIG. 1 is a principle configuration diagram of the present invention.

【図2】本発明における書き込み/読み出し動作を説明
する図(その1)である。
FIG. 2 is a diagram (part 1) explaining a write / read operation according to the present invention.

【図3】本発明における書き込み/読み出し動作を説明
する図(その2)である。
FIG. 3 is a diagram (part 2) explaining a write / read operation in the present invention.

【図4】本発明における書き込み/読み出し動作を説明
する図(その3)である。
FIG. 4 is a diagram (part 3) explaining the write / read operation in the present invention.

【図5】本発明における書き込み/読み出し動作を説明
する図(その4)である。
FIG. 5 is a diagram (4) explaining the write / read operation in the present invention.

【図6】本発明における書き込み/読み出し動作を説明
する図(その5)である。
FIG. 6 is a diagram (No. 5) for explaining the write / read operation in the present invention.

【図7】本発明における書き込み/読み出し動作を説明
する図(その6)である。
FIG. 7 is a diagram (No. 6) for explaining the write / read operation in the present invention.

【図8】本発明の実施例のシステムの構成を示す図であ
る。
FIG. 8 is a diagram showing a configuration of a system according to an embodiment of the present invention.

【図9】本発明の実施例の書き込み/読み出し処理を示
す図(その1)である。
FIG. 9 is a diagram (No. 1) showing the write / read processing according to the embodiment of the present invention.

【図10】本発明の実施例の書き込み/読み出し処理を
示す図(その2)である。
FIG. 10 is a diagram (No. 2) showing the write / read processing of the embodiment of the present invention.

【符号の説明】[Explanation of symbols]

1 フラッシュメモリ 2 消去・書き込み手段 3 マジック・ナンバ検査手段 4,4’,6 セレクタ手段 5 比較手段 10 計算機システム 11 ホスト計算機 12 システム制御装置 12a マイククロプロセッサ 12b ホストインタフェース 12c フラッシュメモリ 12d 制御インタフェース 13 演算装置 14 ネットワーク装置 15 I/O装置 1 Flash memory 2 erasing / writing means 3 Magic number inspection means 4,4 ', 6 selector means 5 Comparison means 10 Computer system 11 Host computer 12 System controller 12a Microprocessor 12b host interface 12c flash memory 12d control interface 13 Arithmetic device 14 Network equipment 15 I / O device

───────────────────────────────────────────────────── フロントページの続き (56)参考文献 特開 平7−262099(JP,A) 特開 平5−143468(JP,A) 特開 平7−248978(JP,A) (58)調査した分野(Int.Cl.7,DB名) G06F 12/16 G11C 16/02 ─────────────────────────────────────────────────── ─── Continuation of the front page (56) Reference JP-A-7-262099 (JP, A) JP-A-5-143468 (JP, A) JP-A-7-248978 (JP, A) (58) Field (Int.Cl. 7 , DB name) G06F 12/16 G11C 16/02

Claims (4)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】 ブロック毎に消去ができ、バイト毎に書
き込みができるフラッシュメモリのデータ更新方法であ
って、 フラッシュメモリを2つのブロックに分割し、フラッシ
ュメモリの各ブロックに、データが有効であることを示
任意の特定値であるマジックナンバと、データの書き
込み履歴を示すシーケンシャルナンバを書き込むヘッダ
領域を設け、 フラッシュメモリにデータ単位を書き込む際、2つのブ
ロックのヘッダ領域に格納されたマジックナンバを調
べ、マジックナンバがともに正しい値でないとき、第1
のブロックを選択してそのブロックを消去して書き込む
べきデータ単位を第1のブロックに書き込み、ついで該
ブロックのヘッダ領域のシーケンシャル番号に1を書き
込み、 マジックナンバの一方のみが正しい値のとき、マジック
ナンバが正しい値でない方のブロックを選択して、該ブ
ロックを消去して、書き込むべきデータ単位を上記ブロ
ックに書き込み、ついで該ブロックのヘッダ領域のシー
ケンシャル番号に、他方のブロックのヘッダ領域に記憶
されているシーケンシャル番号に1を加えた値を書き込
み、 マジックナンバが共に正しい値のとき、両方のブロック
からシーケンシャルナンバを読み出して比較し、シーケ
ンシャルナンバの値が小さい方のブロックを選択し、該
ブロックを消去して書き込むべきデータ単位を書き込
み、ついで該ブロックのヘッダ領域のシーケンシャル番
号に、他方のブロックのヘッダ領域に記憶されているシ
ーケンシャル番号に1を加えた値を書き込み、 最後に、上記ブロックのヘッダ領域にマジックナンバを
書き込む ことを特徴とするフラッシュメモリのデータ更
新方法。
1. A method of updating data in a flash memory, which can be erased for each block and can be written for each byte, wherein the flash memory is divided into two blocks, and the data is valid for each block of the flash memory. Header that writes a magic number that is any specific value that indicates that, and a sequential number that indicates the write history of data
When a region is provided and a data unit is written to the flash memory, two blocks are written.
Adjust the magic number stored in the header area of the lock.
If the magic numbers are not correct, the first
Select a block and erase and write that block
The data unit to be written in the first block, and then
Write 1 to the sequential number in the header area of the block
If only one of the magic numbers has the correct value, the magic
Select the block whose number is not correct and select the block
Erase the lock and change the data unit to be written to the above
In the header area of the block.
Stored in the header area of the other block with the sequential number
Write the value obtained by adding 1 to the existing sequential number
If both magic numbers are correct, both blocks
Read out the sequential numbers from the
Select the block with the smallest
Erase block and write data unit to be written
Then, the sequential number of the header area of the block
Of the block stored in the header area of the other block.
Write the value that added 1 to the sequential number, and finally, add the magic number to the header area of the above block.
A method of updating data in a flash memory, which is characterized by writing .
【請求項2】 ブロック毎に消去ができ、バイト毎に書
き込みができるフラッシュメモリを用いた記憶装置であ
って、 フラッシュメモリを2つのブロックに分割し、フラッシ
ュメモリの各ブロックに、データが有効であることを示
任意の特定値であるマジックナンバと、データの書き
込み履歴を示すシーケンシャルナンバからなるヘッダ領
域を設け、 上記マジックナンバと、シーケンシャルナンバを調べ
て、一つの記憶すべきデータ単位を上記2つのブロック
に交互に書き込み2つのブロックに格納されたデータ
単位の内、正常に書き込みが行われた最新のデータ単位
を読み出す書き込み/読み出し手段を設け、上記書き込み/読み出し手段は、フラッシュメモリにデ
ータ単位を書き込む際、 2つのブロックのヘッダ領域に格納されたマジックナン
バを調べ、マジックナンバがともに正しい値でないと
き、第1のブロックを選択してそのブロックを消去して
書き込むべきデータ単位を第1のブロックに書き込み、
ついで該ブロックのヘッダ領域のシーケンシャル番号に
1を書き込み、 マジックナンバの一方のみが正しい値のとき、マジック
ナンバが正しい値でない方のブロックを選択して、該ブ
ロックを消去して、書き込むべきデータ単位を上記ブロ
ックに書き込み、ついで該ブロックのヘッダ領域のシー
ケンシャル番号に、他方のブロックのヘッダ領域に記憶
されているシーケンシャル番号に1を加えた値を書き込
み、 マジックナンバが共に正しい値のとき、両方のブロック
からシーケンシャルナンバを読み出して比較し、シーケ
ンシャルナンバの値が小さい方のブロックを選択し、該
ブロックを消去して書き込むべきデータ単位を書き込
み、ついで該ブロックのヘッダ領域のシーケンシャル番
号に、他方のブロックのヘッダ領域に記憶されているシ
ーケンシャル番号に1を加えた値を書き込み、 最後に、上記ブロックのヘッダ領域にマジックナンバを
書き込む ことを特徴とするフラッシュメモリを用いた記
憶装置。
2. A storage device using a flash memory that can be erased in each block and can be written in each byte, wherein the flash memory is divided into two blocks, and data is valid in each block of the flash memory. A header area consisting of a magic number, which is an arbitrary specific value indicating that there is, and a sequential number indicating a data write history is provided, and the magic number and the sequential number are checked to determine one data unit to be stored as the above-mentioned 2 Writing / reading means for alternately writing in one block and reading out the latest data unit that has been normally written among the data units stored in the two blocks is provided, and the writing / reading means writes data to the flash memory.
When writing the data unit, the magic number stored in the header area of the two blocks
Check the ba, and if the magic number is not the correct value
Select the first block and erase that block
Write the data unit to be written to the first block,
Then, in the sequential number of the header area of the block
When 1 is written and only one of the magic numbers has the correct value, the magic
Select the block whose number is not correct and select the block
Erase the lock and change the data unit to be written to the above
In the header area of the block.
Stored in the header area of the other block with the sequential number
Write the value obtained by adding 1 to the existing sequential number
If both magic numbers are correct, both blocks
Read out the sequential numbers from the
Select the block with the smallest
Erase block and write data unit to be written
Then, the sequential number of the header area of the block
Of the block stored in the header area of the other block.
Write the value that added 1 to the sequential number, and finally, add the magic number to the header area of the above block.
A storage device using a flash memory that is characterized by writing .
【請求項3】 上記書き込み/読み出し手段、フラッ
シュメモリに格納されたデータ単位を読み出す際、 2つのブロックのヘッダ領域に格納されたマジックナン
バを調べ、マジックナンバの一方が正しい値であると
き、マジックナンバの正しい値であるブロックから読み
出し、マジックナンバがともに正しい値のとき、書き込み履歴
を示すシーケンャルナンバの値 の大きいブロックから読
み出す ことを特徴とする請求項2のフラッシュメモリを
用いた記憶装置。
Wherein said write / read means, when reading the data units stored in the flash memory, examine the magic number which is stored in the header area of the two blocks, when one of the magic number is the correct value, Read from the block with the correct magic number, and when both magic numbers are correct, write history
Read from the block with the highest value
Storage device using a flash memory according to claim 2, characterized in that out look.
【請求項4】 ブロック毎に消去ができ、バイト毎に書
き込みができるフラッシュメモリのデータ書き込み/読
み出しプログラムを記録したコンピュータ読み取り可能
な記録媒体であって、 上記プログラムは、一つの記憶すべきデータ単位を2つ
に分割され、分割された各ブロックに、データが有効で
あることを示す任意の特定値であるマジックナンバと、
データの書き込み履歴を示すシーケンシャルナンバを
き込むヘッダ領域を備えたフラッシュメモリの各ブロッ
クにデータ単位を書き込む際、 2つのブロックのヘッダ領域に格納されたマジックナン
バを調べ、マジックナンバがともに正しい値でないと
き、第1のブロックを選択してそのブロックを消去して
書き込むべきデータ単位を第1のブロックに書き込み、
ついで該ブロックのヘッダ領域のシーケンシャル番号に
1を書き込み、 マジックナンバの一方のみが正しい値のとき、マジック
ナンバが正しい値でない方のブロックを選択して、該ブ
ロックを消去して、書き込むべきデータ単位を上記ブロ
ックに書き込み、ついで該ブロックのヘッダ領域のシー
ケンシャル番号に、他方のブロックのヘッダ領域に記憶
されているシーケンシャル番号に1を加えた値を書き込
み、 マジックナンバが共に正しい値のとき、両方のブロック
からシーケンシャルナンバを読み出して比較し、シーケ
ンシャルナンバの値が小さい方のブロックを選択し、該
ブロックを消去して書き込むべきデータ単位を書き込
み、ついで該ブロックのヘッダ領域のシーケンシャル番
号に、他方のブロックのヘッダ領域に記憶されているシ
ーケンシャル番号に1を加えた値を書き込み、 最後に、上記ブロックのヘッダ領域にマジックナンバを
書き込む ことを特徴とするフラッシュメモリのデータ書
き込み/読み出しプログラムを記録したコンピュータ読
み取り可能な記録媒体。
4. A computer-readable recording medium in which a data writing / reading program of a flash memory that can be erased in each block and written in each byte is recorded, and the program is one data unit to be stored. And a magic number, which is an arbitrary specific value indicating that the data is valid, in each of the divided blocks.
Write a sequential number indicating the write history of data
When writing a data unit to each block of the flash memory that has a header area to be embedded, the magic number stored in the header area of two blocks is written.
Check the ba, and if the magic number is not the correct value
Select the first block and erase that block
Write the data unit to be written to the first block,
Then, in the sequential number of the header area of the block
When 1 is written and only one of the magic numbers has the correct value, the magic
Select the block whose number is not correct and select the block
Erase the lock and change the data unit to be written to the above
In the header area of the block.
Stored in the header area of the other block with the sequential number
Write the value obtained by adding 1 to the existing sequential number
If both magic numbers are correct, both blocks
Read out the sequential numbers from the
Select the block with the smallest
Erase block and write data unit to be written
Then, the sequential number of the header area of the block
Of the block stored in the header area of the other block.
Write the value that added 1 to the sequential number, and finally, add the magic number to the header area of the above block.
Computer readable recording medium recording a data writing / reading program of the flash memory and writes.
JP26993397A 1996-10-16 1997-10-02 Data write / read method in flash memory and storage device using flash memory Expired - Fee Related JP3497066B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP26993397A JP3497066B2 (en) 1996-10-16 1997-10-02 Data write / read method in flash memory and storage device using flash memory

Applications Claiming Priority (3)

Application Number Priority Date Filing Date Title
JP27356496 1996-10-16
JP8-273564 1996-10-16
JP26993397A JP3497066B2 (en) 1996-10-16 1997-10-02 Data write / read method in flash memory and storage device using flash memory

Publications (2)

Publication Number Publication Date
JPH10177527A JPH10177527A (en) 1998-06-30
JP3497066B2 true JP3497066B2 (en) 2004-02-16

Family

ID=26548995

Family Applications (1)

Application Number Title Priority Date Filing Date
JP26993397A Expired - Fee Related JP3497066B2 (en) 1996-10-16 1997-10-02 Data write / read method in flash memory and storage device using flash memory

Country Status (1)

Country Link
JP (1) JP3497066B2 (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2990181B1 (en) * 1998-09-28 1999-12-13 日本電気アイシーマイコンシステム株式会社 Flash memory, microcomputer having flash memory, and method of storing program in flash memory
JP2001209543A (en) 2000-01-28 2001-08-03 Nec Ic Microcomput Syst Ltd Program rewriting method for flash microcomputer
JP3709338B2 (en) 2000-11-22 2005-10-26 日本電気株式会社 Mobile phone user setting information management method and user setting information management system
DE602004013120T2 (en) * 2004-03-10 2009-05-14 Sony Ericsson Mobile Communications Ab Automated backup storage in firmware upgrades

Also Published As

Publication number Publication date
JPH10177527A (en) 1998-06-30

Similar Documents

Publication Publication Date Title
US7840796B2 (en) Booting to a recovery/maintenance environment
US6671785B2 (en) Programming protection status indicators for flash memory
US6601132B2 (en) Nonvolatile memory and method of writing data thereto
JP2990181B1 (en) Flash memory, microcomputer having flash memory, and method of storing program in flash memory
JP4960364B2 (en) Hardware-assisted device configuration detection
JP2005122725A (en) Method and apparatus for smart memory pass-through communication
US8000153B2 (en) Enhanced erase for flash storage device
US20080016415A1 (en) Evaluation system and method
JP2002278783A (en) System for rewriting firmware
US5901311A (en) Access key protection for computer system data
US5818755A (en) Storage apparatus having a nonvolatile storage device capable of retaining data after an incomplete write operation and method of accessing same
JP3497066B2 (en) Data write / read method in flash memory and storage device using flash memory
US7590793B2 (en) Data access controlling method in flash memory and data access controlling program
US6604194B1 (en) Program updating method and apparatus for communication terminal system
JP2003196165A (en) Nonvolatile memory and data updating method therefor
JPH10124403A (en) Writing method for block deletion type flash memory
US5901285A (en) Hierarchical erasure key protection for computer system data
US8225051B2 (en) Access control method for a memory, memory controller for controlling access to the memory, and data processing apparatus
JP4031693B2 (en) Nonvolatile memory and data storage device having the same
KR100316584B1 (en) Flash Memory To Share With Booting And Main Operation Program In System And Upgrade Method In That Memory
JPH0935018A (en) Portable information recording medium and its access method
JP2002025281A (en) Control method for non-volatile memory, and control device for non-volatile memory
JP2003150458A (en) Fault detector, fault detecting method, program and program recording medium
JP2005056144A (en) Electronic apparatus loaded with flash memory, its memory data managing method, and program
JPH10283172A (en) Flash rom data rewrite system

Legal Events

Date Code Title Description
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20031118

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20081128

Year of fee payment: 5

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20081128

Year of fee payment: 5

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20091128

Year of fee payment: 6

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20101128

Year of fee payment: 7

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20101128

Year of fee payment: 7

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20111128

Year of fee payment: 8

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20111128

Year of fee payment: 8

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20121128

Year of fee payment: 9

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20121128

Year of fee payment: 9

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20131128

Year of fee payment: 10

LAPS Cancellation because of no payment of annual fees