JP2003015942A - Method of writing data into memory, data write processing program and data write device - Google Patents

Method of writing data into memory, data write processing program and data write device

Info

Publication number
JP2003015942A
JP2003015942A JP2001201675A JP2001201675A JP2003015942A JP 2003015942 A JP2003015942 A JP 2003015942A JP 2001201675 A JP2001201675 A JP 2001201675A JP 2001201675 A JP2001201675 A JP 2001201675A JP 2003015942 A JP2003015942 A JP 2003015942A
Authority
JP
Japan
Prior art keywords
data
area
memory
writing
written
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
JP2001201675A
Other languages
Japanese (ja)
Inventor
Taku Koreki
卓 是木
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.)
Casio Computer Co Ltd
Original Assignee
Casio Computer Co 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 Casio Computer Co Ltd filed Critical Casio Computer Co Ltd
Priority to JP2001201675A priority Critical patent/JP2003015942A/en
Publication of JP2003015942A publication Critical patent/JP2003015942A/en
Pending legal-status Critical Current

Links

Landscapes

  • Read Only Memory (AREA)

Abstract

PROBLEM TO BE SOLVED: To improve write processing speed and processing efficiency and to contribute in longer life of memory. SOLUTION: Parameters to be stored in a sector n in a flash ROM are brought together in one block, and the data size SIZE of the parameter block for which the parameters are brought together in one block is calculated (step S1). Besides, in the sector n, by the processing in steps S4 to S8, a balance check is made to find whether or not a memory area has a blank area equivalent to the parameter size SIZE. In addition, if the determination result in the step 8 is NO and the blank area size is equal to or more than the parameter size SIZE, it is meant that an area, in the sector n, equivalent from an address indicated by adrs to the parameter size SIZE is in a blank state and is write enabled. In this case, thus, an address that a variable for address adrs indicates in the sector n is determined as a writing start address for the parameter (step S9).

Description

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

【0001】[0001]

【発明の属する技術分野】TECHNICAL FIELD OF THE INVENTION

【0002】本発明は、フラッシュメモリ等のメモリに
データを書き込むためのデータ書き込み方法、データ書
き込み処理プログラム及びデータ書き込み装置に関す
る。
The present invention relates to a data writing method, a data writing processing program and a data writing device for writing data in a memory such as a flash memory.

【0003】[0003]

【従来の技術】[Prior art]

【0004】データの書き込み及び読み出しが自由にで
き、しかも電気的に内容の消去が可能で、電源を切って
もデータが保存されるメモリとして、フラッシュメモリ
等が用いられている。従来、このフラッシュメモリに対
するデータの書き込みは、セクタ単位で行われ、データ
を書き込むべきセクタを消去処理した後、該消去処理し
たセクタにデータを書き込むことにより行われる。
A flash memory or the like is used as a memory in which data can be freely written and read, contents can be electrically erased, and data is saved even when the power is turned off. Conventionally, data writing to this flash memory is performed in sector units, and is performed by erasing a sector in which data should be written and then writing data to the erased sector.

【0005】[0005]

【発明が解決しようとする課題】[Problems to be Solved by the Invention]

【0006】このように、書き込み時にセクタ単位での
消去を行うと、書き込みに時間がかかってしまう不利が
生ずるとともに、小さなデータ量のパラメータ等を書き
込む場合にもセクタ単位での消去処理がなされることと
なり、処理的にも非効率となる。さらに、フラッシュメ
モリ等は消去回数には限りがあるため、書き換え頻度の
増加に伴い寿命が短期化してしまう不利も生ずる。
As described above, if the data is erased in the sector unit at the time of writing, there is a disadvantage that the writing takes time, and the erase process is performed in the sector unit even when a parameter having a small data amount is written. This is inefficient in terms of processing. Further, since the flash memory and the like have a limited number of erasures, there is a disadvantage that the life is shortened as the rewriting frequency increases.

【0007】本発明は、このような従来の課題に鑑みて
なされたものであり、書き込み処理速度及び処理効率の
向上、及びメモリの長寿命化に寄与することのできるメ
モリへのデータ書き込み方法、データ書き込み処理プロ
グラム及びデータ書き込み装置を提供することを目的と
するものである。
The present invention has been made in view of such conventional problems, and a method of writing data to a memory, which can contribute to improvement of write processing speed and processing efficiency, and extension of memory life, It is an object to provide a data writing processing program and a data writing device.

【0008】[0008]

【課題を解決するための手段】[Means for Solving the Problems]

【0009】前記課題を解決するために請求項1記載の
発明にあっては、メモリへのデータ書き込み方法であっ
て、前記メモリの消去単位領域内のデータを順次読み出
して書き込み可能な状態にあるか否かを判断する状態判
断工程と、この状態判断工程で書き込み可能な状態であ
ると判断された領域がメモリに書き込むべきデータを書
き込むのに十分な領域であるか否かを判断する容量判断
工程と、この容量判断工程でメモリに書き込むべきデー
タを書き込むのに十分な領域であると判断された領域に
データを書き込むデータ書込工程とを含む。
In order to solve the above-mentioned problems, a first aspect of the present invention is a method of writing data to a memory, wherein data in an erase unit area of the memory is sequentially read and writable. A state determination step for determining whether or not the state, and a capacity determination for determining whether or not the area determined to be writable in the state determination step is an area sufficient for writing data to be written in the memory And a data writing step of writing data in an area determined to be an area sufficient for writing data to be written in the memory in the capacity determining step.

【0010】したがって、メモリが書き込み可能な状態
にあると判断され、この判断された領域がメモリに書き
込むべきデータを書き込むのに十分な領域であると判断
されると、当該領域にデータを書き込む。したがって、
メモリに対する消去処理を伴うことなく、書き込みが開
始が可能となる。よって、書き込み処理速度が向上する
とともに、小さなデータ量のパラメータ等を書き込む場
合に書き込み処理を効率的に行うことができる。さら
に、メモリの消去処理頻度を低下させて、メモリの長寿
命化に寄与することも可能となる。
Therefore, if it is determined that the memory is in a writable state and the determined area is an area sufficient for writing the data to be written in the memory, the data is written in the area. Therefore,
Writing can be started without erasing the memory. Therefore, the write processing speed is improved, and the write processing can be efficiently performed when a parameter having a small data amount is written. Further, it is possible to reduce the frequency of the erasing process of the memory and contribute to prolonging the life of the memory.

【0011】また、請求項2記載の発明にあっては、前
記メモリに書き込むべきデータのデータ量を算出する算
出工程を含み、前記容量判断工程では、前記メモリの消
去単位領域内の任意のアドレスから前記データ量に相当
するアドレスまでの領域が前記状態判断工程で書き込み
可能な状態にあると判断されたか否かを判断し、前記デ
ータ書込工程では、前記容量判断工程で書き込み可能な
状態にあると判断された任意のアドレスから前記データ
量に相当するアドレスまでの領域にデータを書き込む。
In the invention according to claim 2, the method further comprises a calculation step of calculating a data amount of data to be written in the memory, and in the capacity determination step, an arbitrary address in an erase unit area of the memory is included. To the address corresponding to the data amount, it is determined whether or not it is determined in the state determining step that the area is writable, and in the data writing step, the capacity determining step is set to the writable state. Data is written in an area from an arbitrary address determined to be present to an address corresponding to the data amount.

【0012】したがって、メモリの任意のアドレスから
記憶させるべきデータのデータ量に相当するアドレスま
での領域が書き込み可能な状態にあると、前記任意のア
ドレスが前記データの書き込み開始アドレスとして決定
される。これにより、メモリに対する消去処理を伴うこ
となく、書き込みが開始が可能となる。
Therefore, when the area from the arbitrary address of the memory to the address corresponding to the data amount of the data to be stored is in the writable state, the arbitrary address is determined as the write start address of the data. As a result, writing can be started without erasing the memory.

【0013】また、請求項3記載の発明にあっては、前
記容量判断工程で、前記メモリの消去単位領域内におい
て前記状態判断工程で書き込み可能な状態であると判断
された領域がメモリに書き込むべきデータを書き込むの
に十分な領域でないと判断された場合、当該消去単位領
域を消去処理する消去工程を更に含み、前記データ書込
工程では、この消去処理された消去単位領域の先頭アド
レスからデータを書き込む。
According to another aspect of the invention, in the capacity determining step, an area which is determined to be writable in the state determining step in the erase unit area of the memory is written in the memory. If it is determined that the erase unit area is not sufficient for writing the data, the erase unit area is further erased. In the data writing step, the data is written from the start address of the erase unit area that has been erased. Write.

【0014】したがって、メモリの消去単位領域内にお
いて、書き込み可能な状態であると判断された領域がメ
モリに書き込むべきデータを書き込むのに十分な領域で
ないと判断された場合にのみ、当該消去単位領域の消去
処理がなされる。よって、消去単位領域の消去処理回数
を可及的に少なくすることができ、これによりメモリの
長寿命化に寄与することが可能となる。
Therefore, in the erase unit area of the memory, only when it is determined that the area determined to be in the writable state is not an area sufficient for writing the data to be written in the memory, the erase unit area is determined. Is erased. Therefore, it is possible to reduce the number of times of erasing processing of the erasing unit area as much as possible, which can contribute to prolonging the life of the memory.

【0015】また、請求項4記載の発明にあっては、メ
モリへのデータ書き込み処理をコンピュータに実行させ
るアドレス決定処理プログラムであって、前記メモリの
消去単位領域内のデータを順次読み出して書き込み可能
な状態にあるか否かを判断する状態判断手順と、この状
態判断手順で書き込み可能な状態であると判断された領
域がメモリに書き込むべきデータを書き込むのに十分な
領域であるか否かを判断する容量判断手順と、この容量
判断手順でメモリに書き込むべきデータを書き込むのに
十分な領域であると判断された領域にデータを書き込む
データ書込手順とをコンピュータに実行させる。
According to another aspect of the present invention, there is provided an address determination processing program for causing a computer to execute a data writing process to a memory, wherein data in an erase unit area of the memory can be sequentially read and written. State determination procedure for determining whether or not the state is writable, and whether or not the area determined to be writable in this state determination procedure is an area sufficient for writing the data to be written in the memory. The computer is caused to execute a capacity determination procedure for determining and a data writing procedure for writing data in an area determined to be an area sufficient for writing data to be written in the memory in the capacity determination procedure.

【0016】また、請求項5記載の発明にあっては、前
記メモリに書き込むべきデータのデータ量を算出する算
出手順を実行させ、前記容量判断手順では、前記メモリ
の消去単位領域内の任意のアドレスから前記データ量に
相当するアドレスまでの領域が前記状態判断手順で書き
込み可能な状態にあると判断されたか否かを判断し、前
記データ書込手順では、前記容量判断手順で書き込み可
能な状態にあると判断された任意のアドレスから前記デ
ータ量に相当するアドレスまでの領域にデータを書き込
む。
Further, in the invention according to claim 5, a calculation procedure for calculating a data amount of data to be written in the memory is executed, and in the capacity determination procedure, an arbitrary erase unit area in the memory is selected. It is determined whether or not the area from the address to the address corresponding to the data amount is determined to be writable in the state determination procedure, and in the data writing procedure, the writable state is determined in the capacity determination procedure. Data is written in an area from an arbitrary address determined to be in the area up to an address corresponding to the data amount.

【0017】また、請求項6記載の発明にあっては、前
記容量判断手順で、前記メモリの消去単位領域内におい
て前記状態判断手順で書き込み可能な状態であると判断
された領域がメモリに書き込むべきデータを書き込むの
に十分な領域でないと判断された場合、当該消去単位領
域を消去処理する消去手順を更に実行させ、前記データ
書込手順では、この消去処理された消去単位領域の先頭
アドレスからデータを書き込む。
According to another aspect of the invention, in the capacity determining procedure, an area determined to be writable in the erase determining unit area of the memory in the state determining procedure is written in the memory. If it is determined that the area is not enough to write the data to be written, the erasing procedure for erasing the erasing unit area is further executed, and in the data writing procedure, from the top address of the erasing processed area. Write the data.

【0018】したがって、コンピュータがこれら請求項
4乃至6に記載するプログラムに従って処理を実行する
ことで、請求項1乃至3に記載する発明と同様の効果を
得ることが可能となる。
Therefore, when the computer executes the processing in accordance with the programs described in claims 4 to 6, it is possible to obtain the same effect as that of the invention described in claims 1 to 3.

【0019】また、請求項7記載の発明にあっては、メ
モリへのデータ書き込み装置であって、前記メモリの消
去単位領域内のデータを順次読み出して書き込み可能な
状態にあるか否かを判断する状態判断手段と、この状態
判断手段で書き込み可能な状態であると判断された領域
がメモリに書き込むべきデータを書き込むのに十分な領
域であるか否かを判断する容量判断手段と、この容量判
断手段でメモリに書き込むべきデータを書き込むのに十
分な領域であると判断された領域にデータを書き込むデ
ータ書込手段とを備える。
Further, according to the present invention, in the data writing device for the memory, it is judged whether or not the data in the erase unit area of the memory is sequentially read and is in a writable state. State determining means, a capacity determining means for determining whether or not the area determined to be writable by the state determining means is an area sufficient for writing the data to be written in the memory, and the capacity determining means. Data writing means for writing data to an area determined to be sufficient for writing data to be written in the memory by the determination means.

【0020】また、請求項8記載の発明にあっては、前
記メモリに書き込むべきデータのデータ量を算出する算
出手段を備え、前記容量判断手段は、前記メモリの消去
単位領域内の任意のアドレスから前記データ量に相当す
るアドレスまでの領域が前記状態判断手段で書き込み可
能な状態にあると判断されたか否かを判断し、前記デー
タ書込手段では、前記容量判断手段で書き込み可能な状
態にあると判断された任意のアドレスから前記データ量
に相当するアドレスまでの領域にデータを書き込む。
According to the present invention, there is provided a calculating means for calculating the data amount of the data to be written in the memory, and the capacity judging means is any address in the erase unit area of the memory. To the address corresponding to the data amount, it is determined whether or not the state determining means determines that the state is writable, and the data writing means changes the state to the writable state by the capacity determining means. Data is written in an area from an arbitrary address determined to be present to an address corresponding to the data amount.

【0021】また、請求項9記載の発明にあっては、前
記容量判断手段で、前記メモリの消去単位領域内におい
て前記状態判断手段で書き込み可能な状態であると判断
された領域がメモリに書き込むべきデータを書き込むの
に十分な領域でないと判断された場合、当該消去単位領
域を消去処理する消去手段を更に備え、前記データ書込
手段は、この消去処理された消去単位領域の先頭アドレ
スからデータを書き込む。
Further, in the invention according to claim 9, an area which is judged by the capacity judging means to be writable by the state judging means in the erase unit area of the memory is written in the memory. If it is determined that the erase unit area is not enough to write the data, the erase unit erases the erase unit area. Write.

【0022】したがって、請求項7乃至9記載の発明に
よれば、データ書き込み装置として請求項1乃至3記載
の発明と同様の効果を得ることが可能となる。
Therefore, according to the invention described in claims 7 to 9, it is possible to obtain the same effect as that of the invention described in claims 1 to 3 as a data writing device.

【0023】[0023]

【発明の実施の形態】DETAILED DESCRIPTION OF THE INVENTION

【0024】以下、本発明の実施の形態を図に従って説
明する。図1は、本発明の一実施の形態に係るメモリへ
のデータ書き込み方法が用いられる装置の概略構成を示
すブロック図である。すなわち、この装置はフラッシュ
ROM3(フラッシュメモリ)に記憶されるパラメータ
に基づいて、CPU1がその他の周辺機器を制御する機
能を有している。フラッシュROM3は、データバス4
及びアドレスバス5を介してCPU1に接続され、CP
U1には、同様にデータバス4及びアドレスバス5を介
してRAM2に接続されている。
Embodiments of the present invention will be described below with reference to the drawings. FIG. 1 is a block diagram showing a schematic configuration of an apparatus in which a method of writing data in a memory according to an embodiment of the present invention is used. That is, this device has a function of allowing the CPU 1 to control other peripheral devices based on the parameters stored in the flash ROM 3 (flash memory). The flash ROM 3 has a data bus 4
And the CPU 1 via the address bus 5 and CP
Similarly, U1 is connected to the RAM 2 via the data bus 4 and the address bus 5.

【0025】図2は、全メモリ領域におけるフラッシュ
ROM3領域の割り当て、及びフラッシュROM3内の
構成を示す説明図である。図に示すように、本実施の形
態に係る装置は、RAM2のメモリ領域(RAM領域2
1)とフラッシュROM3のメモリ領域(フラッシュR
OM領域31)とを合わせたメモリ領域を全メモリ領域
10として使用するものである。フラッシュROM領域
31は、セクタ(消去単位)0〜セクタnの複数の領域
で構成されており、各セクタは数キロバイトのデータ領
域が割り当てられている。
FIG. 2 is an explanatory diagram showing the allocation of the flash ROM 3 area in the entire memory area and the configuration in the flash ROM 3. As shown in the figure, the device according to the present embodiment has a memory area of the RAM 2 (RAM area 2
1) and the memory area of the flash ROM 3 (flash R
A memory area including the OM area 31) is used as the entire memory area 10. The flash ROM area 31 is composed of a plurality of areas (sectors (erasure units) 0 to n), and each sector is assigned a data area of several kilobytes.

【0026】また、セクタ0〜セクタnにおいて、セク
タnが本実施の形態における書き込み対象のデータであ
るパラメータを記憶させるべきセクタである。なお、こ
のセクタnは初期時全ての領域が空き領域となっている
が、データ書き込みが行われるにつれてアドレスが付さ
れたデータ書き込み領域「ブロック」が次々とセクタn
上に形成されていく。
Further, in the sectors 0 to n, the sector n is the sector in which the parameter which is the data to be written in this embodiment is to be stored. In the sector n, all areas are empty at the initial stage, but as the data writing is performed, the data writing areas “blocks” to which addresses are added are sequentially added to the sectors n.
Formed on top.

【0027】以上の構成に係る本実施の形態において、
CPU1は内部ROMに記憶されているデータ書き込み
処理プログラムに基づき、図3のフローチャートに示す
処理を実行する。すなわち、CPU1はフラッシュRO
M3のセクタnに記憶させるべきパラメータを1ブロッ
クにまとめ、この1ブロックにまとめたパラメータブロ
ックのデーサイズ(以下、パラメータサイズという)S
IZEを算出する(ステップS1)。更に、アドレス用
変数adrsの初期値として、セクタnの先頭アドレス
TOP_ADRSを設定する(ステップS2)。
In the present embodiment having the above configuration,
The CPU 1 executes the processing shown in the flowchart of FIG. 3 based on the data writing processing program stored in the internal ROM. That is, the CPU 1 uses the flash RO
The parameters to be stored in the sector n of M3 are grouped into one block, and the data size of the parameter block grouped into this one block (hereinafter referred to as parameter size) S
Ize is calculated (step S1). Further, the head address TOP_ADRS of the sector n is set as the initial value of the address variable adrs (step S2).

【0028】また、前述のようにパラメータはセクタn
に格納するので、アドレス用変数adrsにパラメータ
サイズSIZEを加算したアドレス値adrs+SIZ
Eが、セクタnの末尾アドレスBOTTOM_ADRS
を超えないか否かを判断する(ステップS3)。このス
テップS3での判断の結果、adrs+SIZE<BO
TTOM_ADRSであって、adrs+SIZEのア
ドレス値がBOTTOM_ADRSを超えないならば、
パラメータの書き込みをadrsから開始してもパラメ
ータの書き込み終了アドレスがBOTTOM_ADRS
に到達しないということである。よって、この場合には
セクタnにおいて、adrsからパラメータサイズSI
ZE分だけメモリ領域が空いているか否かのブランクチ
ェックを行う。
As described above, the parameter is the sector n.
Address value adrs + SIZE, which is obtained by adding the parameter size SIZE to the address variable adrs.
E is the end address BOTTOM_ADRS of sector n
It is determined whether or not (step S3). As a result of the determination in step S3, adrs + SIZE <BO
If TTOM_ADRS and the address value of adrs + SIZE does not exceed BOTTOM_ADRS,
Even if the parameter writing is started from adrs, the parameter writing end address is BOTTOM_ADRS.
Is not reached. Therefore, in this case, in sector n, from adrs to parameter size SI
A blank check is performed to see if the memory area is empty by ZE.

【0029】すなわち、先ずループ用変数iに初期値
「0」を代入する(ステップS4)。次に、adrs+
i番地の1バイトデータを読み出して0xffと比較す
ることにより、当該adrs+i番地の領域が空き状態
(8ビット全てが「1」の状態)であるか否かを判断す
る(ステップS5)。このステップS5での判断の結
果、adrs+i≠0xffであって、adrs+i番
地の領域が空き状態にない場合には、adrsにSIZ
Eの値を加算して、次回サーチする領域のアドレスを示
すアドレス用変数adrsの値を更新する(ステップS
6)。しかる後に、前述したステップS3からの処理を
繰り返す。
That is, first, the initial value "0" is assigned to the loop variable i (step S4). Next, adrs +
By reading the 1-byte data at the address i and comparing it with 0xff, it is determined whether or not the area at the address adrs + i is empty (all 8 bits are "1") (step S5). As a result of the determination in step S5, if adrs + i ≠ 0xff and the area at the address adrs + i is not in the empty state, the SIZ is added to the adrs.
The value of E is added to update the value of the address variable adrs indicating the address of the area to be searched next time (step S
6). After that, the processing from step S3 described above is repeated.

【0030】また、ステップS5での判断の結果、ad
rs+i=0xffであって、adrs+i番地の領域
が空き状態にある場合には、ループ用変数iの値に基づ
く空き領域のサイズがパラメータサイズSIZEよりも
小さいか否かを判断する(ステップS8)。i<SIZ
Eであって、ループ用変数iの値に基づく空き領域のサ
イズがパラメータサイズSIZEよりも小さい場合に
は、ループ用変数iの値をインクリメントした後(ステ
ップS7)、ステップS5からの処理を再度実行する。
As a result of the judgment in step S5,
When rs + i = 0xff and the area at the address adrs + i is empty, it is determined whether the size of the empty area based on the value of the loop variable i is smaller than the parameter size SIZE (step S8). i <SIZ
If E and the size of the empty area based on the value of the loop variable i is smaller than the parameter size SIZE, the value of the loop variable i is incremented (step S7), and then the processing from step S5 is performed again. Run.

【0031】そして、ステップS8での判断結果がNO
であって、空き領域のサイズがパラメータサイズSIZ
E以上になると、セクタnにおいてadrsが示すアド
レスからパラメータサイズSIZEに相当する領域が空
き状態であって、書き込み可能であることを意味する。
したがって、この場合には、セクタnにおいてアドレス
用変数adrsが示すアドレスを、パラメータの書き込
み開始アドレスとして決定する(ステップS9)。
Then, the determination result in step S8 is NO.
And the size of the empty area is the parameter size SIZ.
When it is equal to or more than E, it means that the area corresponding to the parameter size SIZE from the address indicated by adrs in the sector n is in an empty state and writable.
Therefore, in this case, the address indicated by the address variable adrs in the sector n is determined as the parameter write start address (step S9).

【0032】これにより、セクタnに対する消去処理を
伴うことなく、書き込みが開始可能となる。よって、パ
ラメータの書き込み処理速度が向上するとともに、小さ
なデータ量からなるパラメータを書き込む場合に書き込
み処理を効率的に行うことができる。さらに、セクタn
ひいてはフラッシュROM3の消去処理頻度を低下させ
て、フラッシュROM3の長寿命化に寄与することも可
能となる。
As a result, writing can be started without erasing the sector n. Therefore, the writing speed of the parameter is improved, and the writing process can be efficiently performed when writing the parameter having a small data amount. Furthermore, sector n
As a result, it is possible to reduce the frequency of erasing processing of the flash ROM 3 and contribute to prolonging the life of the flash ROM 3.

【0033】しかも、本実施の形態においては、ステッ
プS7でループ用変数iの値をインクリメントさせ、ス
テップS5でこのインクリメントさせた番地の1バイト
データ、つまりパラメータサイズSIZE分だけ1バイ
トデータが順次「0xff」の状態にあるか否かを判断
する。したがって、SIZEに対応する容量のブロック
が書き込み可能な状態にあるか否かを確実に検出するこ
とができる。よって、何らかの影響や原因でブロック内
のある領域が0xff以外の状態(書き込み不可能な状
態)になっており、それにも拘わらず、書き込み処理を
行ってしまい、書き込み不良が発生する事態を確実に回
避することができる。
Moreover, in the present embodiment, the value of the loop variable i is incremented in step S7, and the 1-byte data of the incremented address in step S5, that is, the 1-byte data corresponding to the parameter size SIZE is sequentially read. It is determined whether or not the state is “0xff”. Therefore, it is possible to reliably detect whether or not the block having the capacity corresponding to the SIZE is in the writable state. Therefore, a certain area in the block is in a state other than 0xff (unwritable state) due to some influence or cause, and nevertheless, the writing process is performed and the writing failure is surely caused. It can be avoided.

【0034】一方、ステップS3での判断結果がNOで
あって、アドレス用変数adrsに書き込むデータサイ
ズSIZEを加算したアドレス値adrs+SIZE
が、セクタnの末尾アドレスBOTTOM_ADRSを
超えている場合には、セクタnの領域を消去処理する
(ステップS10)。しかる後に、セクタnの先頭アド
レスであるTOP_ADRSを、パラメータの書き込み
開始アドレスとして決定する(ステップS11)。した
がって、セクタnにパラメータサイズ分の空き領域がな
い場合にのみ、当該セクタnを消去処理がなされる。よ
って、セクタnの消去処理回数を可及的に少なくするこ
とができ、これによりフラッシュROM3の長寿命化に
寄与することが可能となる。
On the other hand, the determination result in step S3 is NO, and the address value adrs + SIZE obtained by adding the data size SIZE to be written to the address variable adrs is added.
If the end address BOTTOM_ADRS of sector n is exceeded, the area of sector n is erased (step S10). Thereafter, TOP_ADRS, which is the start address of sector n, is determined as the parameter write start address (step S11). Therefore, the erasing process is performed on the sector n only when the sector n does not have a free area for the parameter size. Therefore, the number of times of erasing processing of the sector n can be reduced as much as possible, which can contribute to prolonging the life of the flash ROM 3.

【0035】なお、本実施の形態においては、セクタn
内で空き領域をサーチする際に、ステップS6での処理
により、書き込むパラメータサイズSIZE毎にサーチ
するアドレス(サーチエリア)を変化させて、間欠的に
サーチを行うようにしたが、単純にアドレス値の小さい
方からその値を1ずつ変化させて連続的にサーチするよ
うにし、書き込むパラメータサイズSIZE分の空き領
域が検出(カウント)された時点でサーチをストップさ
せるようにしてもよい。つまり、図3のステップS3を
「adrs+i<BOTTOM_ADRS」、ステップ
S6を「adrs+i→adrs」としてもよい。ま
た、本実施の形態においてメモリに書き込むべきデータ
のデータ量が可変的である場合を示したが、可変でなく
固定であってもよく、同様の作用効果を奏することがで
きる。
In this embodiment, sector n
When searching for an empty area in the area, the address (search area) to be searched is changed for each parameter size SIZE to be written by the processing in step S6, and the search is performed intermittently. The value may be changed one by one from the smaller one, and the search may be performed continuously, and the search may be stopped at the time when an empty area corresponding to the parameter size SIZE to be written is detected (counted). That is, step S3 of FIG. 3 may be set to “adrs + i <BOTTOM_ADRS”, and step S6 may be set to “adrs + i → adrs”. Further, although the case where the data amount of the data to be written to the memory is variable has been described in the present embodiment, the data amount may be fixed instead of being variable, and similar operational effects can be obtained.

【0036】[0036]

【発明の効果】【The invention's effect】

【0037】以上説明したように本発明によれば、メモ
リが書き込み可能な状態にあると判断され、この判断さ
れた領域がメモリに書き込むべきデータを書き込むのに
十分な領域であると判断されると、当該領域にデータを
書き込むことから、メモリに対する消去処理を伴うこと
なく、書き込みが開始が可能となる。よって、書き込み
処理速度が向上するとともに、小さなデータ量のパラメ
ータ等を書き込む場合に書き込み処理を効率的に行うこ
とができる。さらに、メモリの消去処理頻度を低下させ
て、メモリの長寿命化に寄与することも可能となる。
As described above, according to the present invention, it is determined that the memory is in the writable state, and the determined area is determined to be an area sufficient for writing the data to be written in the memory. Then, since data is written in the area, writing can be started without erasing the memory. Therefore, the write processing speed is improved, and the write processing can be efficiently performed when a parameter having a small data amount is written. Further, it is possible to reduce the frequency of the erasing process of the memory and contribute to prolonging the life of the memory.

【0038】また、メモリの消去単位領域内において、
書き込み可能な状態であると判断された領域がメモリに
書き込むべきデータを書き込むのに十分な領域でないと
判断された場合にのみ、当該消去単位領域の消去処理を
行うようにしたことから、消去単位領域の消去処理回数
を可及的に少なくしてメモリの長寿命化に寄与しつつ、
確実なデータ記憶が可能となる。
In the erase unit area of the memory,
Only when it is determined that the area that is determined to be writable is not sufficient to write the data that should be written to the memory, the erase unit area is erased. While contributing to the long life of the memory by reducing the number of times the area is erased,
Reliable data storage becomes possible.

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

【図1】本発明の一実施の形態に係る装置の概略構成を
示すブロック図である。
FIG. 1 is a block diagram showing a schematic configuration of an apparatus according to an embodiment of the present invention.

【図2】全メモリ領域におけるフラッシュROM領域の
割り当て、及びフラッシュROM内の構成を示す説明図
である。
FIG. 2 is an explanatory diagram showing allocation of a flash ROM area in the entire memory area and a configuration in the flash ROM.

【図3】本実施の形態におけるCPUの処理手順を示す
フローチャートである。
FIG. 3 is a flowchart showing a processing procedure of a CPU in the present embodiment.

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

1 CPU 2 RAM 3 フラッシュROM 4 データバス 5 アドレスバス 1 CPU 2 RAM 3 Flash ROM 4 data bus 5 address bus

Claims (9)

【特許請求の範囲】[Claims] 【請求項1】 メモリへのデータ書き込み方法であっ
て、 前記メモリの消去単位領域内のデータを順次読み出して
書き込み可能な状態にあるか否かを判断する状態判断工
程と、 この状態判断工程で書き込み可能な状態であると判断さ
れた領域がメモリに書き込むべきデータを書き込むのに
十分な領域であるか否かを判断する容量判断工程と、 この容量判断工程でメモリに書き込むべきデータを書き
込むのに十分な領域であると判断された領域にデータを
書き込むデータ書込工程とを含むことを特徴とするメモ
リへのデータ書き込み方法。
1. A method of writing data to a memory, comprising: a state determining step of sequentially reading data in an erase unit area of the memory to determine whether or not the state is writable; and a state determining step. A capacity determining step of determining whether or not the area determined to be writable is a sufficient area for writing the data to be written in the memory, and the data to be written in the memory is written in the capacity determining step. And a data writing step of writing data in an area determined to be a sufficient area.
【請求項2】 前記メモリに書き込むべきデータのデー
タ量を算出する算出工程を含み、前記容量判断工程で
は、前記メモリの消去単位領域内の任意のアドレスから
前記データ量に相当するアドレスまでの領域が前記状態
判断工程で書き込み可能な状態にあると判断されたか否
かを判断し、前記データ書込工程では、前記容量判断工
程で書き込み可能な状態にあると判断された任意のアド
レスから前記データ量に相当するアドレスまでの領域に
データを書き込むことを特徴とする請求項1記載のメモ
リへのデータ書き込み方法。
2. A step of calculating a data amount of data to be written in the memory, wherein in the capacity determining step, an area from an arbitrary address in an erase unit area of the memory to an address corresponding to the data amount is included. Is determined to be in a writable state in the state determining step, and in the data writing step, the data is written from an arbitrary address determined to be writable in the capacity determining step. 2. The method for writing data to a memory according to claim 1, wherein the data is written in an area up to an address corresponding to the amount.
【請求項3】 前記容量判断工程で、前記メモリの消去
単位領域内において前記状態判断工程で書き込み可能な
状態であると判断された領域がメモリに書き込むべきデ
ータを書き込むのに十分な領域でないと判断された場
合、当該消去単位領域を消去処理する消去工程を更に含
み、 前記データ書込工程では、この消去処理された消去単位
領域の先頭アドレスからデータを書き込むことを特徴と
する請求項1又は2記載のメモリへのデータ書き込み方
法。
3. The area determined to be writable in the state determining step in the erase unit area of the memory in the capacity determining step is not an area sufficient to write data to be written in the memory. The method further comprising an erasing step of erasing the erasing unit area when the determination is made, and in the data writing step, the data is written from a head address of the erasing unit area subjected to the erasing processing. 2. A method for writing data to the memory described in 2.
【請求項4】 メモリへのデータ書き込み処理をコンピ
ュータに実行させるアドレス決定処理プログラムであっ
て、 前記メモリの消去単位領域内のデータを順次読み出して
書き込み可能な状態にあるか否かを判断する状態判断手
順と、 この状態判断手順で書き込み可能な状態であると判断さ
れた領域がメモリに書き込むべきデータを書き込むのに
十分な領域であるか否かを判断する容量判断手順と、 この容量判断手順でメモリに書き込むべきデータを書き
込むのに十分な領域であると判断された領域にデータを
書き込むデータ書込手順とをコンピュータに実行させる
ことを特徴とするデータ書き込み処理プログラム。
4. An address determination processing program for causing a computer to execute a data writing process to a memory, a state of determining whether or not data in an erase unit area of the memory is sequentially read and is in a writable state. The determination procedure, the capacity determination procedure for determining whether or not the area determined to be writable in this state determination procedure is an area sufficient for writing the data to be written in the memory, and the capacity determination procedure A data write processing program for causing a computer to execute a data write procedure for writing data in an area determined to be an area sufficient for writing data to be written in the memory.
【請求項5】 前記メモリに書き込むべきデータのデー
タ量を算出する算出手順を実行させ、前記容量判断手順
では、前記メモリの消去単位領域内の任意のアドレスか
ら前記データ量に相当するアドレスまでの領域が前記状
態判断手順で書き込み可能な状態にあると判断されたか
否かを判断し、前記データ書込手順では、前記容量判断
手順で書き込み可能な状態にあると判断された任意のア
ドレスから前記データ量に相当するアドレスまでの領域
にデータを書き込むことを特徴とする請求項4記載のデ
ータ書き込み処理プログラム。
5. A calculation procedure for calculating a data amount of data to be written in the memory is executed, and in the capacity determination procedure, from an arbitrary address in an erase unit area of the memory to an address corresponding to the data amount. In the data write procedure, it is determined whether or not the area is determined to be in the writable state in the state determination procedure. The data write processing program according to claim 4, wherein the data is written in an area up to an address corresponding to the amount of data.
【請求項6】 前記容量判断手順で、前記メモリの消去
単位領域内において前記状態判断手順で書き込み可能な
状態であると判断された領域がメモリに書き込むべきデ
ータを書き込むのに十分な領域でないと判断された場
合、当該消去単位領域を消去処理する消去手順を更に実
行させ、 前記データ書込手順では、この消去処理された消去単位
領域の先頭アドレスからデータを書き込むことを特徴と
する請求項4又は5記載のデータ書き込み処理プログラ
ム。
6. The area determined to be writable by the state determining procedure in the erase unit area of the memory in the capacity determining procedure is not an area sufficient to write data to be written in the memory. 5. When it is determined, an erasing procedure for erasing the erasing unit area is further executed, and in the data writing procedure, data is written from the start address of the erasing processing erased area. Alternatively, the data write processing program according to item 5.
【請求項7】 メモリへのデータ書き込み装置であっ
て、 前記メモリの消去単位領域内のデータを順次読み出して
書き込み可能な状態にあるか否かを判断する状態判断手
段と、 この状態判断手段で書き込み可能な状態であると判断さ
れた領域がメモリに書き込むべきデータを書き込むのに
十分な領域であるか否かを判断する容量判断手段と、 この容量判断手段でメモリに書き込むべきデータを書き
込むのに十分な領域であると判断された領域にデータを
書き込むデータ書込手段とを備えることを特徴とするデ
ータ書き込み装置。
7. A device for writing data to a memory, comprising: a state determination means for sequentially reading data in an erase unit area of the memory to determine whether or not it is in a writable state, and the state determination means. A capacity determining means for determining whether or not the area determined to be writable is a sufficient area for writing the data to be written in the memory, and the capacity determining means for writing the data to be written in the memory. And a data writing unit that writes data in an area determined to be a sufficient area.
【請求項8】 前記メモリに書き込むべきデータのデー
タ量を算出する算出手段を備え、前記容量判断手段は、
前記メモリの消去単位領域内の任意のアドレスから前記
データ量に相当するアドレスまでの領域が前記状態判断
手段で書き込み可能な状態にあると判断されたか否かを
判断し、前記データ書込手段では、前記容量判断手段で
書き込み可能な状態にあると判断された任意のアドレス
から前記データ量に相当するアドレスまでの領域にデー
タを書き込むことを特徴とする請求項7記載のデータ書
き込み装置。
8. A calculation means for calculating a data amount of data to be written in the memory, wherein the capacity judgment means is
It is determined whether the area from an arbitrary address in the erase unit area of the memory to an address corresponding to the data amount is determined to be writable by the status determining means. 8. The data writing device according to claim 7, wherein data is written in an area from an arbitrary address determined to be writable by the capacity determination unit to an address corresponding to the data amount.
【請求項9】 前記容量判断手段で、前記メモリの消去
単位領域内において前記状態判断手段で書き込み可能な
状態であると判断された領域がメモリに書き込むべきデ
ータを書き込むのに十分な領域でないと判断された場
合、当該消去単位領域を消去処理する消去手段を更に備
え、 前記データ書込手段は、この消去処理された消去単位領
域の先頭アドレスからデータを書き込むことを特徴とす
る請求項7又は8記載のデータ書き込み装置。
9. The area determined by the capacity determination means to be writable by the state determination means in the erase unit area of the memory is not an area sufficient for writing data to be written in the memory. 8. The method according to claim 7, further comprising erasing means for erasing the erasing unit area, when the determination is made, wherein the data writing means writes data from a head address of the erasing processing erased area. 8. The data writing device according to item 8.
JP2001201675A 2001-07-03 2001-07-03 Method of writing data into memory, data write processing program and data write device Pending JP2003015942A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2001201675A JP2003015942A (en) 2001-07-03 2001-07-03 Method of writing data into memory, data write processing program and data write device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2001201675A JP2003015942A (en) 2001-07-03 2001-07-03 Method of writing data into memory, data write processing program and data write device

Publications (1)

Publication Number Publication Date
JP2003015942A true JP2003015942A (en) 2003-01-17

Family

ID=19038594

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2001201675A Pending JP2003015942A (en) 2001-07-03 2001-07-03 Method of writing data into memory, data write processing program and data write device

Country Status (1)

Country Link
JP (1) JP2003015942A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006107379A (en) * 2004-10-08 2006-04-20 Sony Corp Information processor, information processing method and computer program
JP2008310793A (en) * 2007-05-14 2008-12-25 Buffalo Inc Storage device
CN102646452A (en) * 2011-02-22 2012-08-22 原相科技股份有限公司 Programmable memory and writing and reading method thereof

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006107379A (en) * 2004-10-08 2006-04-20 Sony Corp Information processor, information processing method and computer program
JP4715155B2 (en) * 2004-10-08 2011-07-06 ソニー株式会社 Information processing apparatus, information processing method, and computer program
JP2008310793A (en) * 2007-05-14 2008-12-25 Buffalo Inc Storage device
CN102646452A (en) * 2011-02-22 2012-08-22 原相科技股份有限公司 Programmable memory and writing and reading method thereof

Similar Documents

Publication Publication Date Title
US7298649B2 (en) Nonvolatile memory card
EP0544252A2 (en) Data management system for programming-limited type semiconductor memory and IC memory card having the data management system
KR20080096228A (en) Flash memory device and flash memory system
CN102890656A (en) Method for improving service life of FLASH
US20090083475A1 (en) Apparatus and method for updating firmware stored in a memory
JP2008033801A (en) Memory data management device
JP2004295865A (en) Automatic booting system and automatic booting method
JP2000222292A (en) Data managing method utilizing flash memory
CN113568579A (en) Memory, data storage method and data reading method
JP2003058417A (en) Storage device
JPH113287A (en) Storage device and storage area management method used for the device
JP2003015942A (en) Method of writing data into memory, data write processing program and data write device
JP4594944B2 (en) Memory control device
JP4826232B2 (en) Information processing apparatus and boot program rewriting method
CN113918485B (en) Method, device, equipment and storage medium for preventing flash memory data from being lost
JP2000243093A (en) Data storing method for flash memory and data reading out method from flash memory
JPH09259046A (en) Method for storing data in flash memory and method for reading data out of flash memory
KR100479170B1 (en) Access control device for memory and method thereof
JP4334331B2 (en) Flash memory access control method
US20050068842A1 (en) Electronic device, nonvolatile memory and method of overwriting data in nonvolatile memory
JPH07296591A (en) Electronic equipment
JP2003140979A (en) Recording method to eeprom
JP2001318824A (en) System for managing data of flash memory and recording medium with its program recorded
JP2003337757A (en) Memory controller, flash memory system, and controlling method for the same
JP2007317078A (en) Nonvolatile memory, memory controller, nonvolatile storage device, and nonvolatile storage system