JP2012146340A - Electronic device and storage method - Google Patents

Electronic device and storage method Download PDF

Info

Publication number
JP2012146340A
JP2012146340A JP2012106234A JP2012106234A JP2012146340A JP 2012146340 A JP2012146340 A JP 2012146340A JP 2012106234 A JP2012106234 A JP 2012106234A JP 2012106234 A JP2012106234 A JP 2012106234A JP 2012146340 A JP2012146340 A JP 2012146340A
Authority
JP
Japan
Prior art keywords
data
block
flash memory
storage
blocks
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
Application number
JP2012106234A
Other languages
Japanese (ja)
Inventor
Yukio Ueno
幸男 上野
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.)
Kyocera Corp
Original Assignee
Kyocera Corp
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 Kyocera Corp filed Critical Kyocera Corp
Priority to JP2012106234A priority Critical patent/JP2012146340A/en
Publication of JP2012146340A publication Critical patent/JP2012146340A/en
Pending legal-status Critical Current

Links

Abstract

PROBLEM TO BE SOLVED: To provide an electronic device capable of reducing costs by using an inexpensive flash memory, quickly performing processing, and prolonging the lifetime of the flash memory.SOLUTION: A map number of one of n data blocks is set as a rewrite candidate number. A candidate block determination process that determines whether or not there are multiple storage blocks having the rewrite candidate number as their map numbers on a flash memory, is performed. If it is determined that there are multiple storage blocks whose map numbers match with the rewrite candidate number on the flash memory during the candidate block determination process, a storage block whose update date is the oldest among the corresponding storage blocks is determined as a rewrite block, and the corresponding data block on a RAM is written on the storage block.

Description

本発明は、アプリケーションによる処理に必要な運用データを読み書き可能なフラッシュメモリと、このフラッシュメモリへの前記運用データの読み書きを管理するメモリドライバと、前記メモリドライバを介して前記運用データにアクセスしてアプリケーションを実行する制御部とを備える電子機器および記憶方法に関する。   The present invention provides a flash memory that can read and write operational data necessary for processing by an application, a memory driver that manages the reading and writing of the operational data to the flash memory, and the operational data accessed via the memory driver. The present invention relates to an electronic device including a control unit that executes an application and a storage method.

これまで、アプリケーションによる処理に必要な運用データを保存するフラッシュメモリに対して、効率よくデータの書き込みを行うことができる電子機器として、前記フラッシュメモリは、セクタ単位毎にデータをアクセスする複数のデータユニットと、該データユニットに記憶されているデータのエントリ情報を記憶するデータ管理ユニットとを備えた構成とし、さらに、メモリドライバを介して前記フラッシュメモリにアクセスする制御部は、前記フラッシュメモリ上のデータユニットのいずれかにデータを書き込む場合に、前記データ管理ユニットに記憶されているエントリ情報を参照して得られる各データユニットの空きサイズに基づいて、該データを書き込むデータユニットを選択してデータの書き込みを行うようにしたものが提案されている(例えば、特許文献1参照)。   Until now, as an electronic device that can efficiently write data to a flash memory that stores operation data necessary for processing by an application, the flash memory has a plurality of data that access data for each sector. And a data management unit for storing entry information of data stored in the data unit, and a controller that accesses the flash memory via a memory driver is provided on the flash memory. When writing data to any of the data units, the data unit to which the data is written is selected based on the free size of each data unit obtained by referring to the entry information stored in the data management unit. The one that was to write Are plan (e.g., see Patent Document 1).

また、フラッシュメモリを使用する電子機器では、データのリード・ライト回数が特定のセクタ等に偏ってデバイス寿命の低下を招くことが無いように、データのリード・ライト回数を全セクタに均等化するウエアレベリングが必要になる。   Also, in electronic devices that use flash memory, the number of data reads / writes is equalized to all sectors so that the number of data reads / writes does not deviate to a specific sector, etc. Wear leveling is required.

そこで、上記特許文献1では、前記フラッシュメモリ内には予めスペアユニットを設定しておき、前記制御部は、前記データ管理ユニットと前記データユニットとのそれぞれの消去回数のうち最大消去回数と最小消去回数を求め、最大消去回数と最小消去回数との差が所定のしきい値を超えている場合に、最小消去回数のデータユニットまたはデータ管理ユニットの有効セクタ等を前記スペアユニットにコピーし、コピー元のデータユニット内またはデータ管理ユニット内を消去して、新たなスペアユニットとするウエアレベリングを実行することを提案している。   Therefore, in Patent Document 1, a spare unit is set in advance in the flash memory, and the control unit determines the maximum erase count and the minimum erase count among the erase counts of the data management unit and the data unit. When the difference between the maximum erase count and the minimum erase count exceeds a predetermined threshold value, the data sector of the minimum erase count or the valid sector of the data management unit is copied to the spare unit and copied. It has been proposed to execute wear leveling by erasing the original data unit or the data management unit as a new spare unit.

特開2005−275722号公報JP 2005-275722 A

ところが、上記特許文献1に示されたフラッシュメモリの運用法は、同一アドレスにビット‘0’を上書き可能な機能を備えた高機能なフラッシュメモリでないと実現できない。換言すれば、同一アドレスにビット‘0’を上書きできない低コストのフラッシュメモリを搭載する電子機器では、特許文献1のような運用ができず、高機能なフラッシュメモリに変更しなければならないために、コストアップを招くという問題が生じた。   However, the operation method of the flash memory disclosed in Patent Document 1 cannot be realized unless it is a high-function flash memory having a function capable of overwriting the bit “0” at the same address. In other words, an electronic device equipped with a low-cost flash memory that cannot overwrite bit “0” at the same address cannot be operated as in Patent Document 1, and must be changed to a high-function flash memory. The problem of incurring cost increases occurred.

また、ウエアレベリングの実行のために、制御部は、フラッシュメモリ上の全てのデータユニット及びデータ管理ユニットにおけるデータ消去回数を記録し、更に、最大消去回数と最小消去回数との差が所定のしきい値を超えるか否かを評価する演算処理が頻繁に必要となり、ウエアレベリングのために制御部への負担が大きくなって、処理の遅延が生じる虞もあった。   In order to execute wear leveling, the control unit records the number of times data is erased in all data units and data management units on the flash memory, and the difference between the maximum number of erases and the minimum number of erases is predetermined. Arithmetic processing for evaluating whether or not the threshold value is exceeded is frequently required, and the burden on the control unit increases due to wear leveling, which may cause processing delay.

また、一般的に、RAM(ランダム・アクセス・メモリ)と比較してフラッシュメモリは動作速度が遅いため、アプリケーションの実行時に、その都度、フラッシュメモリ上の運用データにアクセスする運用法では、処理の高速化が難しいという問題が生じると同時
に、フラッシュメモリへのアクセス頻度の増加によりフラッシュメモリの寿命が低下するという問題も生じた。
In general, flash memory operates at a slower speed than RAM (random access memory). Therefore, in the operation method of accessing operation data on the flash memory each time an application is executed, the processing method is At the same time, there is a problem that it is difficult to increase the speed, and at the same time, there is a problem that the life of the flash memory is reduced due to an increase in the frequency of access to the flash memory.

そこで、本発明の目的は上記課題を解消することに係り、同一アドレスにビット‘0’を上書きできない低コストのフラッシュメモリを搭載する電子機器であっても、フラッシュメモリに対して効率よくデータの書き込みを行うことができ、低コストのフラッシュメモリの使用によるコスト低減を図ることができ、更には、制御部に負担をかけずにフラッシュメモリへのウエアレベリングを実行でき、かつ、アプリケーション実行に伴うフラッシュメモリへのアクセス頻度を下げて、処理の高速化や、フラッシュメモリの寿命延長を図ることもできる電子機器を提供することである。   Therefore, an object of the present invention is to solve the above-described problem, and even in an electronic device equipped with a low-cost flash memory that cannot overwrite bit “0” at the same address, data can be efficiently stored in the flash memory. It is possible to perform writing, and it is possible to reduce the cost by using a low-cost flash memory. Further, it is possible to execute wear leveling to the flash memory without imposing a burden on the control unit, and to accompany application execution. An object of the present invention is to provide an electronic device capable of reducing the frequency of access to the flash memory to increase the processing speed and extend the life of the flash memory.

本発明に係る電子機器は、運用データを読み書き可能な記憶手段であるフラッシュメモリ及びRAMと、これらの各記憶手段への前記運用データの読み書きを管理するメモリドライバと、前記メモリドライバを介して前記記憶手段の運用データにアクセスし、前記運用データを、データサイズが前記フラッシュメモリ上でのデータの読み書きの最小単位となる記憶ブロックサイズ以下となるn個のデータブロックに分割し、分割した各データブロックに、マップ番号を割り付け、RAM上の更新されたデータブロックを前記フラッシュメモリに書き込む制御部と、備え、前記制御部は、前記n個のデータブロックのマップ番号を書き換え候補番号に設定して、該書き換え候補番号をマップ番号として持つ記憶ブロックがフラッシュメモリ上に複数存在するか否かを判定する候補ブロック判定処理を実施し、前記候補ブロック判定処理で、書き換え候補番号に一致するマップ番号の記憶ブロックが前記フラッシュメモリ上に複数存在すると判定された時には、該当する複数個の記憶ブロックの内から、更新日時が最も古い記憶ブロックを書き込みブロックに決定して、該記憶ブロックにRAM上の該当データブロックを書き込むことを特徴とする。   The electronic apparatus according to the present invention includes a flash memory and a RAM that are storage means capable of reading and writing operation data, a memory driver that manages reading and writing of the operation data to and from each of the storage means, and the memory driver via the memory driver. The operation data of the storage means is accessed, and the operation data is divided into n data blocks whose data size is equal to or smaller than the storage block size that is the minimum unit for reading and writing data on the flash memory, and each divided data A control unit that assigns a map number to the block and writes an updated data block in the RAM to the flash memory, and the control unit sets the map number of the n data blocks as a rewrite candidate number. A storage block having the rewrite candidate number as a map number is stored on the flash memory. When the candidate block determination process for determining whether or not the number exists, and when it is determined in the candidate block determination process that there are a plurality of storage blocks having a map number matching the rewrite candidate number in the flash memory, Among the plurality of storage blocks, the storage block having the oldest update date is determined as a write block, and the corresponding data block on the RAM is written to the storage block.

本発明に係るデータの記憶方法は、運用データを読み書き可能な記憶手段であるフラッシュメモリ及びRAMと、これらの各記憶手段への前記運用データの読み書きを管理するメモリドライバと、前記メモリドライバを介して前記記憶手段の運用データにアクセスし、RAM上の更新された後記データブロックを前記フラッシュメモリに書き込む制御部と、を備える電子機器におけるデータの記憶方法であって、前記運用データを、データサイズが前記フラッシュメモリ上でのデータの読み書きの最小単位となる記憶ブロックサイズ以下となるn個のデータブロックに分割するステップと、分割した各データブロックに、マップ番号を割り付けるステップと、前記n個のデータブロックのマップ番号を書き換え候補番号に設定して、該書き換え候補番号をマップ番号として持つ記憶ブロックがフラッシュメモリ上に複数存在するか否かを判定する候補ブロック判定処理を実施するステップと、前記候補ブロック判定処理で、書き換え候補番号に一致するマップ番号の記憶ブロックが前記フラッシュメモリ上に複数存在すると判定された時には、該当する複数個の記憶ブロックの内から、更新日時が最も古い記憶ブロックを書き込みブロックに決定して、該記憶ブロックにRAM上の該当データブロックを書き込むステップと、を備えるデータの記憶方法。   A data storage method according to the present invention includes a flash memory and a RAM, which are storage means capable of reading and writing operation data, a memory driver that manages reading and writing of the operation data to and from each storage means, and the memory driver. A storage unit for accessing the operation data of the storage means and writing an updated postscript data block on the RAM to the flash memory. Is divided into n data blocks having a storage block size equal to or smaller than the minimum unit for reading and writing data on the flash memory, a step of assigning a map number to each of the divided data blocks, Set the map number of the data block as the rewrite candidate number, and A step of executing candidate block determination processing for determining whether or not there are a plurality of storage blocks having candidate numbers as map numbers in the flash memory, and storing map numbers that match the rewrite candidate numbers in the candidate block determination processing When it is determined that there are a plurality of blocks on the flash memory, the storage block with the oldest update date is determined as a writing block from the corresponding storage blocks, and the corresponding data on the RAM is stored in the storage block. And a step of writing a block.

本発明に係る電子機器では、フラッシュメモリへのデータの書き込みは、フラッシュメモリを構成している記憶ブロック単位で単純にデータの消去・書き込みを行うだけで良いため、同一アドレスにビット‘0’を上書きできない低コストのフラッシュメモリを搭載する電子機器であっても、フラッシュメモリに対して効率よくデータの書き込みを行うことができ、低コストのフラッシュメモリの使用によるコスト低減を図ることができる。   In the electronic device according to the present invention, data can be written to the flash memory simply by erasing and writing the data in units of storage blocks constituting the flash memory. Therefore, the bit “0” is set to the same address. Even an electronic device equipped with a low-cost flash memory that cannot be overwritten can efficiently write data to the flash memory, and the cost can be reduced by using the low-cost flash memory.

本発明に係る電子機器の一実施の形態の概略構成を示すブロック図である。It is a block diagram which shows schematic structure of one Embodiment of the electronic device which concerns on this invention. 図1に示した電子機器に搭載されるフラッシュメモリの構成説明図である。FIG. 2 is a configuration explanatory diagram of a flash memory mounted on the electronic device illustrated in FIG. 1. 図2に示したフラッシュメモリの各記憶ブロックへのデータ書き込み方法を示すフローチャートである。3 is a flowchart showing a method of writing data to each storage block of the flash memory shown in FIG. 図3に示したデータ書き込み方法でフラッシュメモリ上の各記憶ブロックのデータが更新される態様の説明図である。It is explanatory drawing of the aspect by which the data of each storage block on a flash memory are updated by the data writing method shown in FIG.

以下、本発明に係る電子機器の好適な実施の形態について、図面を参照して詳細に説明する。   DESCRIPTION OF EXEMPLARY EMBODIMENTS Hereinafter, preferred embodiments of an electronic device according to the invention will be described in detail with reference to the drawings.

図1は本発明に係る電子機器の一実施の形態の概略構成を示すブロック図、図2は図1に示した電子機器に搭載されるフラッシュメモリの構成説明図、図3は図2に示したフラッシュメモリの各記憶ブロックへのデータ書き込み方法を示すフローチャート、図4は図3に示したデータ書き込み方法でフラッシュメモリ上の各記憶ブロックのデータが更新される態様の説明図である。   FIG. 1 is a block diagram showing a schematic configuration of an embodiment of an electronic device according to the present invention, FIG. 2 is a diagram for explaining the configuration of a flash memory mounted on the electronic device shown in FIG. 1, and FIG. 3 is shown in FIG. FIG. 4 is an explanatory diagram of a mode in which data in each storage block on the flash memory is updated by the data writing method shown in FIG. 3.

この一実施の形態の電子機器1は、メールの送受信機能やメモ機能などを有した多機能型の携帯電話機であって、図1に示すように、通話やその他のアプリケーションによる処理に必要な運用データ3(図2参照)を読み書き可能な記憶手段であるフラッシュメモリ5及びRAM(ランダム・アクセス・メモリ)6と、アプリケーションプログラムやその他の固定データを記憶したROM(リード・オンリー・メモリ)7と、記憶手段5,6への運用データ3の読み書きやROM7からのデータの読み出しを管理するメモリドライバ9と、メモリドライバ9を介して各記憶手段5,6の運用データ3にアクセスしてアプリケーションを実行する制御部11と、この制御部11と各記憶手段5〜7との間のデータ通路、あるいは制御部11と後述の無線部19との間のデータ通路となるデータバス12と、アプリケーションの処理状況等を表示する液晶ディスプレイによる表示部13と、運用データ3の入力やアプリケーションへの処理命令を入力するための各種の入力キーを備えたキー操作部15と、音声の入出力を行うマイク/スピーカ17と、アプリケーションの処理に応じてデータを無線通信により送受信する無線部19と、を備えた構成とされている。   The electronic device 1 according to the embodiment is a multi-function mobile phone having a mail transmission / reception function, a memo function, and the like. As shown in FIG. Flash memory 5 and RAM (Random Access Memory) 6 which are storage means capable of reading and writing data 3 (see FIG. 2); ROM (Read Only Memory) 7 storing application programs and other fixed data; A memory driver 9 that manages the reading / writing of the operation data 3 to / from the storage means 5 and 6 and the reading of the data from the ROM 7, and accesses the operation data 3 of each storage means 5 and 6 via the memory driver 9 to The control unit 11 to be executed, the data path between the control unit 11 and each storage means 5 to 7, or the control unit 11 and the rear A data bus 12 serving as a data path to and from the wireless unit 19, a display unit 13 by a liquid crystal display for displaying the processing status of the application, and various types for inputting operation data 3 and processing commands to the application The key operation unit 15 includes input keys, a microphone / speaker 17 that inputs and outputs audio, and a wireless unit 19 that transmits and receives data by wireless communication according to application processing. .

本実施の形態の場合、運用データ3は、図4(a)に示すように、電話による通話処理時の音量やネゴシエーションなどに対する設定値を規定の順序で書き込んだデータ列である設定値データ21と、電話による通話処理に必要な電話帳データを書き込んだ電話帳データ23と、メール機能を使ったSMS(ショートメッセージサービス)用の設定データを書き込んだデータ列であるSMSデータ25とから構成されている。   In the case of the present embodiment, as shown in FIG. 4A, the operation data 3 is set value data 21 which is a data string in which setting values for volume, negotiation, etc. at the time of telephone call processing are written in a prescribed order. Phone book data 23 in which phone book data necessary for telephone call processing is written, and SMS data 25 which is a data string in which setting data for SMS (short message service) using the mail function is written. ing.

この運用データ3において、設定値データ21のデータサイズは3kバイト、電話帳データ23のデータサイズは7kバイト、SMSデータ25のデータサイズは6kバイトであり、運用データ3を連続するデータ列で表示するなら、16kバイトサイズのデータマップで表示される。   In this operational data 3, the data size of the setting value data 21 is 3 kbytes, the data size of the telephone book data 23 is 7 kbytes, the data size of the SMS data 25 is 6 kbytes, and the operational data 3 is displayed as a continuous data string. If so, it is displayed in a 16 kbyte data map.

本実施の形態では、フラッシュメモリ5には、データの読み書きの最小単位となるブロックサイズが8kバイトの記憶ブロックを複数備えた構成のものが使用されている。   In the present embodiment, the flash memory 5 is configured to have a plurality of storage blocks having a block size of 8 kbytes, which is the minimum unit for reading and writing data.

本実施の形態では、運用データ3は、データサイズがフラッシュメモリ5のブロックサイズ以下となる設定値データ21,電話帳データ23,SMSデータ25の3個のデータブロック(データマップ)に分割して、データブロック単位で取り扱う。また、分割した各データブロックの先頭には、マップ番号Mi及びフラッシュ更新カウンタ値Fiの2つのフラグ値を割り付けてデータブロック相互を識別可能に構成する。   In the present embodiment, the operation data 3 is divided into three data blocks (data map) of setting value data 21, telephone book data 23, and SMS data 25 whose data size is equal to or smaller than the block size of the flash memory 5. , Handled in units of data blocks. In addition, two flag values of a map number Mi and a flash update counter value Fi are assigned to the head of each divided data block so that the data blocks can be distinguished from each other.

フラッシュメモリ5は、図2に示すように、運用データ3の分割数3に相応する3個の
記憶ブロック31,32,33に、スペア用の2個の記憶ブロック34,35を追加した、合計5個の記憶ブロック31,32,33,34,35を有するものを使用している。
As shown in FIG. 2, the flash memory 5 has a total of two storage blocks 34, 35 added to three storage blocks 31, 32, 33 corresponding to the division number 3 of the operation data 3. The one having five storage blocks 31, 32, 33, 34, and 35 is used.

各記憶ブロック31,32,33,34,35は、前述したようにデータサイズが8kバイトの記憶ブロックで、図2は、運用データ3を構成する3個のデータブロック21,23,25が、3個の記憶ブロックに書き込まれた状態を示している。   Each of the storage blocks 31, 32, 33, 34, and 35 is a storage block having a data size of 8 kbytes as described above. FIG. 2 shows three data blocks 21, 23, and 25 that constitute the operational data 3. A state in which data is written in three storage blocks is shown.

各ブロックデータ21,23,25に付与するマップ番号Mi及びフラッシュ更新カウンタ値Fiの2つのフラグ値は、それぞれ8バイトで表示されるデータで、フラッシュメモリ5の8kバイトの記憶ブロックに書き込む際には、8kバイトの記憶ブロックの先頭の16バイトに書き込まれる。従って、運用データ3の分割された各データ21,23,25は、フラッシュメモリ5の8kバイトの記憶ブロックに書き込まれる時には、記憶ブロック先頭から16バイトオフセットした位置から書き込まれる。   The two flag values of the map number Mi and the flash update counter value Fi given to each block data 21, 23, 25 are data displayed in 8 bytes, respectively, and are written when writing to the 8 kbyte storage block of the flash memory 5. Is written in the first 16 bytes of the 8 kbyte storage block. Accordingly, when the divided data 21, 23, 25 of the operational data 3 are written in the 8 kbyte storage block of the flash memory 5, they are written from the position offset by 16 bytes from the head of the storage block.

マップ番号Miは、分割されたデータ種を示すもので、本実施の形態の場合は、運用データ3を3つのデータに分割したことから、設定値データ21のマップ番号Miは1(=0001h)に、電話帳データ23のマップ番号Miは2(=0002h)に、SMSデータ25のマップ番号Miは3(=0003h)に設定される。   The map number Mi indicates the divided data type. In the present embodiment, since the operation data 3 is divided into three data, the map number Mi of the set value data 21 is 1 (= 0001h). Further, the map number Mi of the phone book data 23 is set to 2 (= 0002h), and the map number Mi of the SMS data 25 is set to 3 (= 0003h).

フラッシュ更新カウンタ値Fiは、8バイトを使った計数値で、0001hから始まり、データが更新されるたびにカウンタ値を1インクリメントした値になり、FFFFhまで到達すると、次は、初期値である0001hに戻される。   The flash update counter value Fi is a count value using 8 bytes, starts from 0001h, becomes a value obtained by incrementing the counter value by 1 every time data is updated, and when it reaches FFFFh, the next is the initial value 0001h. Returned to

本実施の形態の電子機器1では、機器の電源投入時には、フラッシュメモリ5から各データブロック21,23,25の最新データをRAM6に読み込み、以後のアプリケーション処理時の運用データ3の読み書きはRAM6上に展開されている各データブロック21,23,25に対して実行する。   In the electronic device 1 of the present embodiment, when the device is turned on, the latest data of each data block 21, 23, 25 is read from the flash memory 5 into the RAM 6, and the operation data 3 is read / written on the RAM 6 during the subsequent application processing. This is executed for each data block 21, 23, 25 developed in the above.

データブロック21,23,25を読み込むRAM6には、各データブロック毎に、アプリケーションからのアクセスによるデータ更新の有無を識別可能にするRAM更新カウンタが準備される。RAM更新カウンタは、フラッシュメモリ5の各記憶ブロックに付けるフラッシュ更新カウンタ値Fiと同様に例えば8バイトを使った計数値で示し、電源投入でフラッシュメモリ5からRAM6にコピーされた各設定値データ21,23,25の初期状態では、いずれもRAM更新カウンタ値は、0000hから始まる。そして、各データブロック毎に、1バイトの書き込みが発生する都度、カウンタ値を1インクリメントした値になり、FFFFhまで到達すると、次は、初期値である0000hに戻される。   In the RAM 6 for reading the data blocks 21, 23, and 25, a RAM update counter that makes it possible to identify the presence or absence of data update due to access from an application is prepared for each data block. The RAM update counter is indicated by a count value using, for example, 8 bytes like the flash update counter value Fi attached to each storage block of the flash memory 5, and each set value data 21 copied from the flash memory 5 to the RAM 6 when the power is turned on. , 23, 25, the RAM update counter value starts from 0000h. For each data block, every time 1 byte is written, the counter value is incremented by 1. When the value reaches FFFFh, the initial value is reset to 0000h.

一方、電子機器1において、電源投入された後は、例えば電源オフ時、又は電池の消尽時、又は電話モードの待機状態時に、RAM6上の更新されたデータブロックをフラッシュメモリ5に書き込む。   On the other hand, after the power is turned on in the electronic device 1, the updated data block on the RAM 6 is written into the flash memory 5 when the power is turned off, the battery is exhausted, or the telephone mode is in a standby state, for example.

RAM6上の更新されたデータブロックは、RAM更新カウンタ値が0000h以外の値となっていることで判別され、ひとつのデータブロックを書き込むときで、RAM更新カウンタ値が0000h以外のものが複数存在していた場合には、RAM更新カウンタ値が最大のものがフラッシュメモリ5に書き込まれる。フラッシュメモリ5への書き込みが終了したデータブロックは、RAM更新カウンタ値が0000hに戻される。   The updated data block on the RAM 6 is determined by the RAM update counter value being a value other than 0000h, and when a single data block is written, there are a plurality of RAM update counter values other than 0000h. If so, the one with the largest RAM update counter value is written into the flash memory 5. The RAM update counter value of the data block that has been written to the flash memory 5 is returned to 0000h.

本実施の形態の電子機器1では、RAM6上の更新されたデータブロックをフラッシュメモリ5に書き込む処理は、図3に示す手順で実行される。   In the electronic device 1 according to the present embodiment, the process of writing the updated data block on the RAM 6 to the flash memory 5 is executed according to the procedure shown in FIG.

即ち、電源オフ時、又は電池の消尽時、又は電話モードの待機状態時などのデータ更新するタイミングが訪れると、制御部11がメモリドライバ9に更新するデータブロックのマップ番号を通知する(ステップS101)。これにより、一連の、データ更新処理が開始される。   That is, when the data update timing such as when the power is turned off, when the battery is exhausted, or in the telephone mode standby state comes, the control unit 11 notifies the memory driver 9 of the map number of the data block to be updated (step S101). ). Thereby, a series of data update processing is started.

更新するデータブロックのマップ番号が通知されたメモリドライバ9は、まず、フラッシュメモリ5上のデータが記録されている全ての記憶ブロックのマップ番号Miとフラッシュ更新カウンタ値Fiを取得する(ステップS111)。次に、取得した記憶ブロックの情報から、マップ番号Mi及びフラッシュ更新カウンタ値Fiが記録されていないスペア用の記憶ブロック(未使用状態の記憶ブロック)が残存しているか否かを判定する(ステップS112)。   The memory driver 9 notified of the map number of the data block to be updated first acquires the map number Mi and the flash update counter value Fi of all the storage blocks in which the data on the flash memory 5 are recorded (step S111). . Next, it is determined from the acquired storage block information whether or not a spare storage block (unused storage block) in which the map number Mi and the flash update counter value Fi are not recorded remains (Step S1). S112).

例えば、フラッシュメモリ5上で記憶ブロック使用状況が図4(a)の状態にあって、ステップS112の判定処理で未使用状態の記憶ブロックが有ると判定された時には、ステップS113に移行して、その未使用記憶ブロックの一つを、更新データを書き込む記憶ブロックに決定する。   For example, when the storage block usage status is in the state of FIG. 4A on the flash memory 5 and it is determined in the determination process in step S112 that there is an unused storage block, the process proceeds to step S113. One of the unused storage blocks is determined as a storage block to which update data is written.

上記ステップS111〜S113までの流れは、RAM6上の更新されたデータブロックをフラッシュメモリ5に書き込むデータ更新の際には、フラッシュメモリ5上の未使用の記憶ブロックを優先して、書き込みブロックに選定することを意味している。   In the flow from the above steps S111 to S113, when updating the data block in which the updated data block on the RAM 6 is written to the flash memory 5, the unused storage block on the flash memory 5 is preferentially selected as the write block. Is meant to do.

ステップS113により書き込みブロックが決定されたら、ステップS121に移行する。   If a writing block is determined by step S113, it will transfer to step S121.

一方、フラッシュメモリ5上でブロック使用状況が図4(b)の状態にあって、ステップS112の判定処理で未使用状態の記憶ブロックが無いと判定された時には、ステップS114に進む。   On the other hand, when the block usage status is in the state of FIG. 4B on the flash memory 5 and it is determined in the determination process in step S112 that there is no unused storage block, the process proceeds to step S114.

このステップS114では、運用データ3を分割した3個のデータブロック21,23,25をマップ番号順に並べた時に更新すべきデータブロックの次の順位に位置するデータブロックのマップ番号を書き換え候補番号に設定する。   In this step S114, the map number of the data block positioned next to the data block to be updated when the three data blocks 21, 23, 25 obtained by dividing the operational data 3 are arranged in the map number order is used as the rewrite candidate number. Set.

このステップS114のおける処理を具体例で説明する。   The process in step S114 will be described using a specific example.

図4(b)に示すフラッシュメモリ5の使用状況で、ステップS101で通知された更新データのマップ番号が1であったとする。   Assume that the map number of the update data notified in step S101 is 1 in the usage status of the flash memory 5 shown in FIG.

本実施の形態の場合、マップ番号は、1,2,3の3種類で、ステップS101で通知された更新データはマップ番号1が付与されている設定値データ21であり、更新すべきデータブロック21の次の順位に位置するデータブロック22のマップ番号は2である。   In the case of the present embodiment, there are three types of map numbers 1, 2, and 3, and the update data notified in step S101 is the set value data 21 to which map number 1 is assigned, and the data block to be updated The map number of the data block 22 located in the next rank of 21 is 2.

そこで、ステップS114では、書き換え候補番号として‘2’が設定される。   Therefore, in step S114, '2' is set as the rewrite candidate number.

換言すると、運用データ3を分割した複数個のデータブロックに、連続番号でマップ番号が付与される場合は、ステップS101で通知されたマップ番号値に+1した番号が、ステップS114で設定する書き換え候補番号となる。   In other words, when a map number is assigned to a plurality of data blocks obtained by dividing the operational data 3, a number obtained by adding 1 to the map number value notified in step S101 is a rewriting candidate set in step S114. Number.

ステップS114において書き換え候補番号が設定されたら、ステップS115に移行して、その書き換え候補番号をマップ番号として持つ記憶ブロックがフラッシュメモリ5上に複数存在するか否かを判定する候補ブロック判定処理を実施する。   If a rewrite candidate number is set in step S114, the process proceeds to step S115, and candidate block determination processing is performed to determine whether or not there are a plurality of storage blocks having the rewrite candidate number as a map number on the flash memory 5. To do.

具体例で説明すると、次のようになる。   A specific example will be described as follows.

図4(b)に示すフラッシュメモリ5の使用状況で、ステップS101で通知された更新データのマップ番号が‘1’で、ステップS114では書き換え候補番号として‘2’が設定された場合で説明する。   In the usage situation of the flash memory 5 shown in FIG. 4B, the case where the update data map number notified in step S101 is “1” and “2” is set as the rewrite candidate number in step S114 will be described. .

図4(b)に示したフラッシュメモリ5の使用状況で、書き換え候補番号の‘2’をマップ番号として持つ記憶ブロックは、フラッシュメモリ5上の記憶ブロック32,34,35の3つである。従って、この場合は、ステップS115では、‘該当する複数の記憶ブロックが有る’と判定することになる。   In the usage state of the flash memory 5 shown in FIG. 4B, there are three storage blocks 32, 34, and 35 on the flash memory 5 having the rewrite candidate number “2” as a map number. Therefore, in this case, in step S115, it is determined that “there are a plurality of corresponding storage blocks”.

もう一つ、別の例を挙げて、説明する。   I will explain another example.

図4(b)に示すフラッシュメモリ5の使用状況で、ステップS101で通知された更
新データのマップ番号が‘2’で、ステップS114では書き換え候補番号として‘3’が設定された場合で説明する。
In the usage situation of the flash memory 5 shown in FIG. 4B, the case is described where the map number of the update data notified in step S101 is “2” and “3” is set as the rewrite candidate number in step S114. .

図4(b)に示したフラッシュメモリ5の使用状況で、書き換え候補番号の‘3’をマップ番号として持つ記憶ブロックは、フラッシュメモリ5上の記憶ブロック33の1つだけである。従って、この場合は、ステップS115では、‘該当する複数の記憶ブロックが無い’と判定することになる。   In the usage state of the flash memory 5 shown in FIG. 4B, only one storage block 33 on the flash memory 5 has the rewrite candidate number “3” as the map number. Therefore, in this case, in step S115, it is determined that “there are no corresponding storage blocks”.

ステップS115で‘該当する複数の記憶ブロックが無い’と判定したときには、次のステップS116に進んで、それまでの書き換え候補番号に+1して、書き換え候補番号を次の順位のマップ番号1に更新して、ステップS115に戻る。   When it is determined in step S115 that “there are no corresponding storage blocks”, the process proceeds to the next step S116, and the rewrite candidate number is incremented by 1 and the rewrite candidate number is updated to map number 1 of the next rank. Then, the process returns to step S115.

書き換え候補番号は、1,2,3の3つのマップ番号値の並び順を順に移行するため、それまでの書き換え候補番号が3の場合、更新すると、1に戻る。   Since the rewrite candidate number sequentially shifts the arrangement order of the three map number values 1, 2, and 3, when the rewrite candidate number so far is 3, when it is updated, it returns to 1.

ステップS116で書き換え候補番号が‘1’に更新されて、ステップS115に戻ると、図4(b)に示したフラッシュメモリ5の使用状況で、書き換え候補番号の‘1’をマップ番号として持つ記憶ブロックは、フラッシュメモリ5上の記憶ブロック31の1つだけである。従って、この場合も、ステップS115では、‘該当する複数の記憶ブロックが無い’と判定し、ステップS116に移行する。ステップS116では、書き換え候補番号が‘2’に更新されて、ステップS115に戻ると、図4(b)に示したフラッシュメモリ5の使用状況で、書き換え候補番号の‘2’をマップ番号として持つ記憶ブロックは、フラッシュメモリ5上の記憶ブロック32,34,35の3つである。従って、この場合は、ステップS115では‘該当する複数の記憶ブロックが有る’と判定して、次のステップS117に進む。   When the rewrite candidate number is updated to “1” in step S116 and the process returns to step S115, the storage having the rewrite candidate number “1” as the map number in the usage state of the flash memory 5 shown in FIG. 4B. There is only one block of the storage block 31 on the flash memory 5. Therefore, also in this case, in step S115, it is determined that “there are no corresponding storage blocks”, and the process proceeds to step S116. In step S116, the rewrite candidate number is updated to “2”. When the process returns to step S115, the rewrite candidate number “2” is held as the map number in the usage state of the flash memory 5 shown in FIG. The storage blocks are three storage blocks 32, 34, and 35 on the flash memory 5. Accordingly, in this case, in step S115, it is determined that “there are a plurality of corresponding storage blocks”, and the process proceeds to the next step S117.

即ち、本実施の形態の処理では、ステップS115の候補ブロック判定処理で該当する複数個の記憶ブロックが存在しないと判定された時には、書き換え候補番号にマップ番号が一致する複数個の記憶ブロックが存在すると判定されるまで、書き換え候補番号を次の順位のマップ番号に更新するステップS116と、候補ブロック判定処理を実施するステップS115とが繰り返されることになる。   That is, in the process of the present embodiment, when it is determined in the candidate block determination process in step S115 that there are no corresponding storage blocks, there are a plurality of storage blocks whose map numbers match the rewrite candidate numbers. Until it is determined, step S116 for updating the rewrite candidate number to the map number of the next rank and step S115 for executing the candidate block determination process are repeated.

ステップS117では、該当する同一マップ番号の複数個の記憶ブロックの内、更新日時が最も古い記憶ブロックを書き込みブロックに決定する。   In step S117, among the plurality of storage blocks having the same map number, the storage block with the oldest update date is determined as the writing block.

具体的には、書き換え候補番号が2で、ステップS115において記憶ブロック32,34,35の3つが該当記憶ブロックであると判定されて、ステップS117に進んだ場合、これらの3つの記憶ブロックの内、フラッシュ更新カウンタ値Fiの一番小さい記憶ブロック32を、更新データを書き込むブロックに決定して、次のステップS118に進む。   Specifically, when the rewrite candidate number is 2 and it is determined in step S115 that three storage blocks 32, 34, and 35 are the corresponding storage blocks and the process proceeds to step S117, among these three storage blocks. The storage block 32 having the smallest flash update counter value Fi is determined as a block in which update data is written, and the process proceeds to the next step S118.

ステップS118ではステップS117で決定された記憶ブロックに対してデータの消去を行い、次のステップS121では、図4(c)の記憶ブロック32あるいは図4(d)の記憶ブロック32に示すように、該当するフラッシュメモリ5の記憶ブロックに対して、ステップS101で通知されたRAM6上のデータブロックをコピーする。   In step S118, data is erased from the storage block determined in step S117. In the next step S121, as shown in the storage block 32 of FIG. 4C or the storage block 32 of FIG. The data block on the RAM 6 notified in step S101 is copied to the corresponding storage block of the flash memory 5.

次いで、フラッシュメモリ5上に存在する同一マップ番号の記憶ブロックの中で最新の記憶ブロックとなるように、フラッシュ更新カウンタ値Fiを更新し(ステップS123)、マップ番号Miを書き込み(ステップS124)、必要が有れば、後処理を実施して(ステップS125)、一連の処理が終了する。   Next, the flash update counter value Fi is updated (step S123) and the map number Mi is written (step S124) so that it becomes the latest storage block among the storage blocks of the same map number existing on the flash memory 5. If necessary, post-processing is performed (step S125), and a series of processing ends.

ステップS125で実施する後処理とは、フラッシュメモリ5へのデータ更新で、データを更新した記憶ブロックのフラッシュ更新カウンタ値Fiが初期値に更新される場合は、更新した記憶ブロックと同一のマップ番号を持つ他の記憶ブロックのデータを消去する処理である。   The post-processing executed in step S125 is the same map number as the updated storage block when the flash update counter value Fi of the storage block whose data has been updated is updated to the initial value in the data update to the flash memory 5. Is a process of erasing data in another storage block having.

以上に説明した一実施の形態の電子機器1では、フラッシュメモリ5へのデータの書き込みは、フラッシュメモリ5を構成している記憶ブロック単位で単純にデータの消去・書き込みを行うだけで良いため、同一アドレスにビット‘0’を上書きできない低コストのフラッシュメモリを搭載する電子機器1であっても、フラッシュメモリ5に対して効率よくデータの書き込みを行うことができ、低コストのフラッシュメモリ5の使用によるコスト低減を図ることができる。   In the electronic device 1 according to the embodiment described above, data can be written into the flash memory 5 simply by erasing and writing data in units of storage blocks constituting the flash memory 5. Even in an electronic device 1 equipped with a low-cost flash memory that cannot overwrite bit “0” at the same address, data can be efficiently written to the flash memory 5. Cost reduction due to use can be achieved.

また、通常、アプリケーション実行時における運用データ3へのアクセスは、機器の電源投入時にフラッシュメモリ5からRAM6にコピーされた運用データ3に対して行うため、アプリケーション実行に伴うフラッシュメモリ5へのアクセス頻度を下げて、処理の高速化や、フラッシュメモリ5の寿命延長を図ることもできる。   In addition, since the operation data 3 is normally accessed when the application is executed with respect to the operation data 3 copied from the flash memory 5 to the RAM 6 when the device is turned on, the frequency of access to the flash memory 5 associated with the execution of the application The processing speed can be increased and the life of the flash memory 5 can be extended.

また、本実施の形態の電子機器1では、フラッシュメモリ5として、運用データ3を構成する3つのデータ記憶ブロック21,23,25に相応する3個の記憶ブロック31,32,33に、スペア用の2個の記憶ブロック34,35を追加した、合計5個の記憶ブロックを有するものを使用しており、RAM6上の更新されたデータブロックをフラッシュメモリ5に書き込むデータ更新の際には、図3のステップS111〜S113にも示したように、未使用の記憶ブロックを優先して、書き込みブロックに選定する。   Further, in the electronic device 1 of the present embodiment, as the flash memory 5, three storage blocks 31, 32, 33 corresponding to the three data storage blocks 21, 23, 25 constituting the operation data 3 are used as spares. The two storage blocks 34 and 35 are added, and a storage block having a total of five storage blocks is used. When updating data to write the updated data block on the RAM 6 to the flash memory 5, As shown in Steps S111 to S113 in FIG. 3, an unused storage block is preferentially selected as a writing block.

そのため、フラッシュメモリ5の各記憶ブロック31〜35へのデータのリード・ライト回数が、スペア用の記憶ブロックの存在比率に相応して緩和され、スペア用の記憶ブロックへのデータの読み書き分が、フラッシュメモリ5の各記憶ブロックへのデータのリード・ライト回数を均等化するウエアレベリングとしての効力を発揮するため、フラッシュメモリ5の寿命延長を図ることができる。   Therefore, the number of data reads / writes to the storage blocks 31 to 35 of the flash memory 5 is alleviated according to the ratio of the spare storage blocks, and the amount of data read / written to the spare storage blocks is Since the effect of the wear leveling that equalizes the number of times data is read / written to each storage block of the flash memory 5 is exhibited, the life of the flash memory 5 can be extended.

また、本実施の形態の電子機器1では、RAM6上の更新されたデータブロックをフラッシュメモリ5に書き込むデータ更新の際に、フラッシュメモリ5上に未使用の記憶ブロックが存在していない時には、図3のステップS114〜S116にも示したように、3個のデータブロック21,23,25をマップ番号順に並べた時に更新すべきデータブロックの次の順位に位置するデータブロックのマップ番号を書き換え候補番号に設定して、該書き換え候補番号をマップ番号として持つ記憶ブロックがフラッシュメモリ5上に複数存在するか否かを判定する候補ブロック判定処理を実施し、もしも、その候補ブロック判定処理で該当する複数個の記憶ブロックが存在しないと判定された時には、書き換え候補番号にマップ番号が一致する複数個の記憶ブロックが存在すると判定されるまで、書き換え候補番号を次の順位のマップ番号に更新して同様の判定処理を繰り返す。   Further, in the electronic apparatus 1 of the present embodiment, when data is updated by writing the updated data block on the RAM 6 to the flash memory 5, when there is no unused storage block on the flash memory 5, As shown in Steps S114 to S116 of FIG. 3, when the three data blocks 21, 23, and 25 are arranged in the order of map numbers, the map number of the data block located at the next rank of the data block to be updated is rewritten as a candidate. A candidate block determination process for determining whether or not there are a plurality of storage blocks having the rewrite candidate number as a map number in the flash memory 5 is performed. When it is determined that a plurality of storage blocks do not exist, a map whose map number matches the rewrite candidate number. Until number of storage blocks is determined to be present, and repeats the same determination processing updates the rewrite candidate number to the map number of the next rank.

そして、図3のステップS117〜S121に示すように、候補ブロック判定処理で、書き換え候補番号に一致するマップ番号の記憶ブロックが複数存在すると判定された時には、該当する複数個の記憶ブロックの内、更新日時が最も古い記憶ブロックを書き込みブロックに決定して、その記憶ブロックにRAM6上で該当データブロックを書き込む。   Then, as shown in steps S117 to S121 of FIG. 3, when it is determined in the candidate block determination process that there are a plurality of storage blocks having a map number matching the rewrite candidate number, among the corresponding storage blocks, The storage block with the oldest update date / time is determined as the write block, and the corresponding data block is written in the storage block on the RAM 6.

そのため、データ更新されるフラッシュメモリ5上の記憶ブロックは、更新すべきデータブロックのマップ番号と異なるマップ番号を持ち、且つ、前回の更新時がより古いものが優先されることになり、フラッシュメモリ5の各記憶ブロックへのデータのリード・ライト回数を均等化するウエアレベリングを効率良く実施することが可能になり、フラッシュメモリ5の寿命延長を図ることができる。   For this reason, the storage block on the flash memory 5 in which data is updated has a map number different from the map number of the data block to be updated, and the one having the older update time is given priority. Thus, it is possible to efficiently implement wear leveling that equalizes the number of times data is read and written to each storage block, and the life of the flash memory 5 can be extended.

また、データ更新するフラッシュメモリ5上の記憶ブロックの決定処理は、更新すべきデータブロックのマップ番号をインクリメントして生成される書き換え候補番号に一致するマップ番号の記憶ブロックが複数存在するか否かを調べ、存在している場合にその複数個の記憶ブロックの中からデータ更新日時が一番古い記憶ブロックを選択するもので、記
憶ブロックの決定のための制御処理(演算処理)としては、マップ番号の照合と、フラッシュ更新カウンタ値の比較だけで良く、簡単に実現できる。従って、制御部11に負担をかけずにフラッシュメモリ5へのウエアレベリングを実行でき、処理の高速化や、フラッシュメモリ5の寿命延長を図ることができる。
In addition, the determination process of the storage block on the flash memory 5 for updating data is performed by checking whether or not there are a plurality of storage blocks having a map number matching the rewrite candidate number generated by incrementing the map number of the data block to be updated. If there is a memory block, the storage block with the oldest data update date / time is selected from the plurality of storage blocks, and the control processing (arithmetic processing) for determining the storage block is a map. It can be realized simply by comparing the number and comparing the flash update counter value. Accordingly, wear leveling to the flash memory 5 can be executed without imposing a burden on the control unit 11, and the processing speed can be increased and the life of the flash memory 5 can be extended.

また、本実施の形態の電子機器1では、図3にステップS125に示すように、一連の処理の最後に後処理が設定されていて、フラッシュメモリ5へのデータ更新で、データを更新した記憶ブロックのフラッシュ更新カウンタ値が初期値に更新される場合は、更新した記憶ブロックと同一のマップ番号を持つ他の記憶ブロックのデータを消去する。   Further, in the electronic device 1 of the present embodiment, as shown in step S125 in FIG. 3, post-processing is set at the end of a series of processing, and data is updated by updating the data in the flash memory 5. When the flash update counter value of the block is updated to the initial value, the data in another storage block having the same map number as the updated storage block is erased.

例えば、フラッシュメモリ5上の記憶ブロックに書き込まれるフラッシュ更新カウンタ値が、0001h〜FFFFhまでの変数で、前回のカウンタ値がFFFFhであった場合に、次の更新時のカウンタ値は初期値である0001hに戻すが、カウンタ値0001hを書き込んだ時には、同じマップ番号で、それ以外のカウンタ値が書き込まれている全ての記憶ブロックは、データを消去して、スペア用の記憶ブロック扱いにする。これにより、フラッシュ更新カウンタ値の大小と、更新時の新旧との相関が崩れることを防止でき、フラッシュメモリ5へのデータの読み書きの信頼性を向上させることができる。   For example, when the flash update counter value written in the storage block on the flash memory 5 is a variable from 0001h to FFFFh and the previous counter value is FFFFh, the counter value at the next update is an initial value. However, when the counter value 0001h is written, all the storage blocks having the same map number and other counter values are erased and treated as spare storage blocks. Thereby, it is possible to prevent the correlation between the magnitude of the flash update counter value and the old and new at the time of update from being lost, and to improve the reliability of reading and writing data to the flash memory 5.

なお、本発明に係る電子機器は、上記実施の形態に示した携帯電話機に限らない。本発明は、例えば、モバイルパソコン、ノート型パソコン、デジタルカメラなどを始めとして、アプリケーションによる処理に必要な運用データを読み書き可能な記憶手段としてフラッシュメモリを具備した構成をなす各種の電子機器に応用可能である。   Note that the electronic device according to the present invention is not limited to the mobile phone described in the above embodiment. The present invention can be applied to, for example, mobile electronic devices such as mobile personal computers, notebook personal computers, digital cameras, and the like, and various electronic devices that have a flash memory as a storage means that can read and write operational data necessary for processing by applications. It is.

また、アプリケーションによる処理に必要な運用データの分割数は、上記実施の形態に限定するものではなく、運用データのデータサイズや、フラッシュメモリのブロックサイズなどから適宜に設計変更することができる。   Further, the number of divisions of operational data necessary for processing by an application is not limited to the above embodiment, and the design can be appropriately changed from the data size of operational data, the block size of the flash memory, and the like.

また、フラッシュメモリに装備するブロックサイズや記憶ブロック数、スペア用の記憶ブロックの数量等も、運用データの分割数や分割された各データブロックのデータサイズに応じて、適宜に設計変更することが可能である。   In addition, the block size and the number of storage blocks equipped in the flash memory, the number of spare storage blocks, etc. can be appropriately changed according to the number of divisions of operation data and the data size of each divided data block. Is possible.

1 電子機器
3 運用データ
5 フラッシュメモリ(記憶手段)
6 RAM(ランダム・アクセス・メモリ)(記憶手段)
7 ROM(リード・オンリー・メモリ)
9 メモリドライバ
11 制御部
12 データバス
13 表示部
15 キー操作部
17 マイク/スピーカ
19 無線部
21,23,25 データブロック
31〜35 記憶ブロック
Mi マップ番号(フラグ値)
Fi フラッシュ更新カウンタ値(フラグ値)
1 Electronic equipment 3 Operation data 5 Flash memory (storage means)
6 RAM (Random Access Memory) (memory means)
7 ROM (Read Only Memory)
DESCRIPTION OF SYMBOLS 9 Memory driver 11 Control part 12 Data bus 13 Display part 15 Key operation part 17 Microphone / speaker 19 Radio | wireless part 21,23,25 Data block 31-35 Storage block Mi Map number (flag value)
Fi flash update counter value (flag value)

Claims (2)

運用データを読み書き可能な記憶手段であるフラッシュメモリ及びRAMと、これらの各記憶手段への前記運用データの読み書きを管理するメモリドライバと、前記メモリドライバを介して前記記憶手段の運用データにアクセスし、前記運用データを、データサイズが前記フラッシュメモリ上でのデータの読み書きの最小単位となる記憶ブロックサイズ以下となるn個のデータブロックに分割し、分割した各データブロックに、マップ番号を割り付け、RAM上の更新されたデータブロックを前記フラッシュメモリに書き込む制御部と、備え、
前記制御部は、
前記n個のデータブロックのマップ番号を書き換え候補番号に設定して、該書き換え候補番号をマップ番号として持つ記憶ブロックがフラッシュメモリ上に複数存在するか否かを判定する候補ブロック判定処理を実施し、
前記候補ブロック判定処理で、書き換え候補番号に一致するマップ番号の記憶ブロックが前記フラッシュメモリ上に複数存在すると判定された時には、該当する複数個の記憶ブロックの内から、更新日時が最も古い記憶ブロックを書き込みブロックに決定して、該記憶ブロックにRAM上の該当データブロックを書き込む
ことを特徴とする電子機器。
Flash memory and RAM that are storage means that can read and write operation data, a memory driver that manages reading and writing of the operation data to and from each of these storage means, and access to the operation data of the storage means via the memory driver , Dividing the operational data into n data blocks whose data size is equal to or smaller than a storage block size that is a minimum unit for reading and writing data on the flash memory, and assigning a map number to each divided data block; A controller that writes the updated data block on the RAM to the flash memory, and
The controller is
A candidate block determination process is performed in which the map number of the n data blocks is set as a rewrite candidate number, and it is determined whether or not there are a plurality of storage blocks having the rewrite candidate number as a map number on the flash memory. ,
When it is determined in the candidate block determination process that there are a plurality of storage blocks having a map number matching the rewrite candidate number in the flash memory, the storage block with the oldest update date and time is selected from the corresponding storage blocks. Is determined as a writing block, and the corresponding data block on the RAM is written to the storage block.
運用データを読み書き可能な記憶手段であるフラッシュメモリ及びRAMと、これらの各記憶手段への前記運用データの読み書きを管理するメモリドライバと、前記メモリドライバを介して前記記憶手段の運用データにアクセスし、RAM上の更新された後記データブロックを前記フラッシュメモリに書き込む制御部と、を備える電子機器におけるデータの記憶方法であって、
前記運用データを、データサイズが前記フラッシュメモリ上でのデータの読み書きの最小単位となる記憶ブロックサイズ以下となるn個のデータブロックに分割するステップと、
分割した各データブロックに、マップ番号を割り付けるステップと、
前記n個のデータブロックのマップ番号を書き換え候補番号に設定して、該書き換え候補番号をマップ番号として持つ記憶ブロックがフラッシュメモリ上に複数存在するか否かを判定する候補ブロック判定処理を実施するステップと、
前記候補ブロック判定処理で、書き換え候補番号に一致するマップ番号の記憶ブロックが前記フラッシュメモリ上に複数存在すると判定された時には、該当する複数個の記憶ブロックの内から、更新日時が最も古い記憶ブロックを書き込みブロックに決定して、該記憶ブロックにRAM上の該当データブロックを書き込むステップと、
を備えるデータの記憶方法。
Flash memory and RAM that are storage means that can read and write operation data, a memory driver that manages reading and writing of the operation data to and from each of these storage means, and access to the operation data of the storage means via the memory driver A method of storing data in an electronic device comprising: a control unit that writes an updated postscript data block on a RAM to the flash memory,
Dividing the operational data into n data blocks having a data size equal to or smaller than a storage block size that is a minimum unit for reading and writing data on the flash memory;
Assigning a map number to each divided data block;
A candidate block determination process is performed in which the map number of the n data blocks is set as a rewrite candidate number, and it is determined whether or not a plurality of storage blocks having the rewrite candidate number as a map number exist in the flash memory. Steps,
When it is determined in the candidate block determination process that there are a plurality of storage blocks having a map number matching the rewrite candidate number in the flash memory, the storage block with the oldest update date and time is selected from the corresponding storage blocks. And writing the corresponding data block on the RAM to the storage block;
A data storage method comprising:
JP2012106234A 2012-05-07 2012-05-07 Electronic device and storage method Pending JP2012146340A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2012106234A JP2012146340A (en) 2012-05-07 2012-05-07 Electronic device and storage method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2012106234A JP2012146340A (en) 2012-05-07 2012-05-07 Electronic device and storage method

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
JP2006353494A Division JP2008165446A (en) 2006-12-27 2006-12-27 Electronic device

Publications (1)

Publication Number Publication Date
JP2012146340A true JP2012146340A (en) 2012-08-02

Family

ID=46789780

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2012106234A Pending JP2012146340A (en) 2012-05-07 2012-05-07 Electronic device and storage method

Country Status (1)

Country Link
JP (1) JP2012146340A (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH11110300A (en) * 1997-09-30 1999-04-23 Sony Corp External storage device and device and method for data processing
JP2006018594A (en) * 2004-07-01 2006-01-19 Mitsubishi Electric Corp Information processor

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH11110300A (en) * 1997-09-30 1999-04-23 Sony Corp External storage device and device and method for data processing
JP2006018594A (en) * 2004-07-01 2006-01-19 Mitsubishi Electric Corp Information processor

Similar Documents

Publication Publication Date Title
US9612957B2 (en) Read disturb and data retention handling for NAND devices
US8572309B2 (en) Apparatus and method to protect metadata against unexpected power down
US20060069849A1 (en) Methods and apparatus to update information in a memory
US20120278532A1 (en) Dynamically configurable embedded flash memory for electronic devices
US8621169B2 (en) Method for address space layout randomization in execute-in-place code
JP2008192154A (en) Memory mapping method and memory mapping system
US20150261683A1 (en) Cache memory control in electronic device
US8615624B2 (en) Methods, apparatuses, and computer program products for enhancing memory erase functionality
US20200233610A1 (en) Data storage device and method for accessing logical-to-physical mapping table thereof
US8433843B2 (en) Method for protecting sensitive data on a storage device having wear leveling
JP2015001909A (en) Information processor, control circuit, control program, and control method
CN111158607A (en) Data erasing and writing operation processing method and system, electronic equipment and storage medium
US9971549B2 (en) Method of operating a memory device
WO2024055612A1 (en) Data storage method and apparatus for flash memory, and terminal device and storage medium
JP2012155561A (en) Information processor and writing control method
US11231873B2 (en) Apparatus and method for assigning velocities to write data
JP2012221025A (en) Backup notification system for data held by flash memory, and method and program for the same
CN112181275A (en) Data processor and data processing method
JP5983512B2 (en) Writing device
JP2012146340A (en) Electronic device and storage method
US11307795B2 (en) Electronic processing devices and memory control methods thereof
JP2008165446A (en) Electronic device
JP2010122771A5 (en)
CN112035378A (en) Method and system for quickly writing data into FLASH FLASH memory
JP2009134672A (en) Memory management method and portable terminal equipment

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20120530

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20130828

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20130910

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20140204