【0001】[0001]
【発明の属する技術分野】本発明は、データの更新が中
断された場合にも不揮発性メモリに更新される前のデー
タを保持する不揮発性メモリ装置、データを保持するた
めのデータ更新方法、データ更新プログラム及びそのデ
ータ更新プログラムが記録されたコンピュータ読み取り
可能な記録媒体に関するものである。BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a non-volatile memory device that holds data before being updated in a non-volatile memory even when the data update is interrupted, a data updating method for holding the data, and a data updating method. The present invention relates to a computer-readable recording medium in which an update program and its data update program are recorded.
【0002】[0002]
【従来の技術】CPU(Central Processing Unit)を内蔵し
たIC(Integrated Circuit)カードは、これまで磁気カー
ドが利用されてきた分野で、磁気カードを置き替えるも
のとして利用が進みつつある。このようなICカードで
は、例えばキャッシングやクレジットの機能を提供する
接触型又は非接触型のものや、出札に利用される非接触
型のものが代表的である。2. Description of the Related Art IC (Integrated Circuit) cards with a built-in CPU (Central Processing Unit) are being used as replacements for magnetic cards in fields where magnetic cards have been used so far. Typical of such IC cards are, for example, a contact type or non-contact type that provides functions of cashing and credit, and a non-contact type that is used for issuing cards.
【0003】また、ヨーロッパなどで利用されているGS
M(Global System for Mobile Communications)方式の
携帯電話機(Mobile Subscriber)では、加入者の識別情
報や電話番号などを携帯電話機の端末(Mobile Equipmen
t)とは独立して管理するために、SIM(Subscriber Iden
tity Module)と呼ばれるCPUを内蔵したICカードが用い
られている。第3世代の携帯電話機でも、UIM(User Id
entity Module)と呼ばれるCPUを内蔵したICカードが用
いられる。SIMやUIMでは、クレジットカードサイズより
も小型のプラグイン型が用いられることが多く、SIMやU
IMは、通常端末に取り外し可能に装着される。加入者
は、これまで利用していた端末から取り外したSIM又はU
IMを次に利用する端末に装着することによって、次の端
末でこれまでの端末と同じ電話番号を使用することがで
きる。GS used in Europe and the like
In an M (Global System for Mobile Communications) type mobile phone (Mobile Subscriber), the identification information and telephone number of the subscriber are stored in the mobile phone terminal (Mobile Equipmen
SIM) (Subscriber Iden
IC card with a built-in CPU called tity Module) is used. UIM (User Id
entity module) is used IC card with a built-in CPU called. SIM and UIM often use a plug-in type smaller than a credit card size.
The IM is usually removably attached to the terminal. Subscriber can use SIM or U removed from the terminal
By mounting the IM on the next terminal, the next terminal can use the same telephone number as the previous terminal.
【0004】SIMによって提供される多くの機能は電話
サービスに特化されているが、UIMでは、磁気カードを
置き替えるICカードと同様に、電子商取引の決済などに
利用されることも期待されている。Many of the functions provided by SIM are specialized for telephone services, but UIM is also expected to be used for payment of electronic commerce, as with IC cards that replace magnetic cards. There is.
【0005】ここで、図1に一般的なICカードの構成を
示す。FIG. 1 shows the structure of a general IC card.
【0006】図1に示すように、このICカード100
は、I/O(Input/Output)インタフェース101を介して
リーダライタ装置102と接続されている。リーダライ
タ装置102は、ICカード100のCPU103との間で
データを送受信する。リーダライタ装置102は、ICカ
ード100にデータを送信するだけでなく、電力も供給
する。非接触型ICカードであれば、電力の供給は搬送波
を用いて無線で行われる。また、携帯電話機の端末に装
着されるICカードであれば、電力は端末からICカードに
供給される。供給された電力は、リーダライタ装置10
2との通信や、CPU100が、ROM(Read-Only Memory)1
04やRAM(Random Access Memory)105との間でプロ
グラムやデータの読み出し又は書き込みを行うためなど
に利用される。As shown in FIG. 1, this IC card 100
Is connected to the reader / writer device 102 via an I / O (Input / Output) interface 101. The reader / writer device 102 transmits / receives data to / from the CPU 103 of the IC card 100. The reader / writer device 102 not only transmits data to the IC card 100, but also supplies electric power. In the case of a contactless IC card, power is supplied wirelessly using a carrier wave. Further, in the case of an IC card attached to a mobile phone terminal, power is supplied from the terminal to the IC card. The supplied power is the reader / writer device 10
2 and communication between the CPU 100 and the ROM (Read-Only Memory) 1
04 and RAM (Random Access Memory) 105 are used to read or write programs and data.
【0007】もちろん、携帯や取り外しのために、ICカ
ードには電力が供給されないことがある。また、ICカー
ドに記憶される情報には、例えば決済口座の残高のよう
に、継続的に利用されるものの、随時更新される情報が
通常含まれる。このため、ICカードには、電気的に書き
換え可能なEEPROM(Electrically Erasable Programmab
le ROM)などの不揮発性メモリが欠かせない。Of course, power may not be supplied to the IC card for portability or removal. Further, the information stored in the IC card usually includes information that is continuously used but is updated at any time, such as the balance of a settlement account. For this reason, an electrically rewritable EEPROM (Electrically Erasable Programmab
Le ROM) and other non-volatile memory is essential.
【0008】図1の例であれば、残高などの情報は、EE
PROM106に書き込まれることになる。EEPROM106に
既に書き込まれていたデータが更新される場合、図2に
示すように、CPU103は、EEPROM106のデータが更
新される更新対象領域201から更新される前の更新前
データを読み出し()、読み出された更新前データを
RAM105に書き込む。CPU103は、RAM105に書き
込まれた更新前データを更新する()。また、EEPROM
106から更新前データが読み出されると、CPU103
は、更新対象領域201のデータを消去する()。CP
U103は、更新対象領域201のデータが消去されて
から、RAM105に記憶されている更新後のデータを更
新対象領域201に書き込む。In the example of FIG. 1, the information such as the balance is EE.
It will be written in the PROM 106. When the data already written in the EEPROM 106 is updated, as shown in FIG. 2, the CPU 103 reads out the pre-updated data from the update target area 201 in which the data of the EEPROM 106 is updated () and reads it. The data before update issued
Write to RAM105. The CPU 103 updates the pre-update data written in the RAM 105 (). Also, EEPROM
When the pre-update data is read from 106, the CPU 103
Deletes the data in the update target area 201 (). CP
The U 103 writes the updated data stored in the RAM 105 to the update target area 201 after the data in the update target area 201 is erased.
【0009】EEPROMのような不揮発性メモリでは、その
物理的特性のため、データの更新には、上述のような更
新手順が必要となる。A nonvolatile memory such as an EEPROM requires the above-described update procedure for updating data because of its physical characteristics.
【0010】ところで、リーダライタ装置や携帯電話機
の端末から電力が供給されている場合でも、リーダライ
タ装置との接続が意図せず途切れたり、携帯電話機の端
末が落下した衝撃で携帯電話機の端末からバッテリが外
れたりすることによって、電源が突然遮断されることが
ある。電源が遮断されるのが上述のような更新手順の途
中でなければ、電源が遮断されても、リーダライタ装置
と接続されていない場合などと同じく、データは維持さ
れる。By the way, even when power is supplied from the reader / writer device or the mobile phone terminal, the connection with the reader / writer device is unintentionally interrupted, or the mobile phone terminal is dropped by the impact of dropping the mobile phone terminal. The power may be cut off suddenly due to the battery being removed. Unless the power is shut off during the updating procedure as described above, the data is maintained even when the power is shut off, as in the case where the power is shut off and the reader / writer device is not connected.
【0011】しかしながら、上述のような更新手順の途
中で電源が意図せず遮断されると、データが喪失してし
まう恐れがある。例えば更新対象領域201のデータが
消去されてから消去済みの更新対象領域201に更新後
データが書き込まれるまでに、電源が遮断されると、揮
発性のRAM201に記憶されたデータは喪失してしま
う。However, if the power supply is unintentionally cut off during the updating procedure as described above, data may be lost. For example, if the power is cut off after the data in the update target area 201 is erased until the updated data is written in the erased update target area 201, the data stored in the volatile RAM 201 will be lost. .
【0012】不慮の事態によってデータの書き換え途中
にデータが欠損することを避けるため、例えば特開平9
−179787号公報に記載された携帯可能情報記憶媒
体では、書き換え前の情報が、不揮発性メモリに確保さ
れたバックアップ領域に複写される。バックアップ領域
に複写された書き換え前の情報は、書き換えが正常に行
われるまで有効な情報として維持される。書き換えに異
常があれば、バックアップ領域に複写された書き換え前
の情報が元の領域に書き込まれる。In order to avoid data loss during data rewriting due to an unforeseen situation, for example, Japanese Unexamined Patent Publication No.
In the portable information storage medium described in Japanese Patent Publication No. 179787, the information before rewriting is copied to the backup area secured in the nonvolatile memory. The information before rewriting copied to the backup area is maintained as valid information until rewriting is normally performed. If the rewriting is abnormal, the information before rewriting copied in the backup area is written in the original area.
【0013】また、特開平2000−357216号公
報に記載されたICカードでは、同じデータが不揮発性
メモリに確保された2つの記憶領域にそれぞれ書き込ま
れる。このデータに対する更新は、2つの記憶領域につ
いて交互に行われる。一方の記憶領域に記憶されたデー
タの更新が失敗したとしても、他方の記憶領域には、そ
の更新の前のデータが残っている。Further, in the IC card described in Japanese Patent Laid-Open No. 2000-357216, the same data is written in two storage areas secured in the non-volatile memory. The update of this data is performed alternately for the two storage areas. Even if the update of the data stored in one storage area fails, the data before the update remains in the other storage area.
【0014】これらの公報に記載されているように、更
新前データが不揮発性メモリの別の領域に記憶されてい
る場合、更新前データが消去されてから更新後データが
書き込まれるまでに、電源が遮断されたとしても、更新
前データは失われない。As described in these publications, when the pre-update data is stored in another area of the non-volatile memory, the power supply is changed from the deletion of the pre-update data to the writing of the post-update data. Even if is blocked, the pre-update data is not lost.
【0015】[0015]
【発明が解決しようとする課題】但し、更新後データ
は、電源の遮断によって、やはり失われてしまう。この
ため、電源の遮断があると、電源再投入後に単独でデー
タの更新を再開することができなかった。However, the updated data is still lost due to the power interruption. For this reason, if the power is cut off, the data update cannot be restarted independently after the power is turned on again.
【0016】この問題は、電子商取引などでは、取引当
事者同士の同意があって、データが更新されることもあ
るので、取引当事者の一方で更新されたデータが失わ
れ、取引当事者同士の情報に不整合が生じるのは、取引
上特に大きな問題となる。[0016] This problem is that in electronic commerce, etc., the data may be updated due to the agreement between the trading parties, so the updated data is lost on the one side of the trading party and the information on the trading party is lost. The occurrence of inconsistency is a particularly serious problem in transactions.
【0017】また、ICカードだけでなく、著作権保護機
能付きのメモリカードであるSD(Secure Digital)メモリ
カードなど、不揮発性メモリを備えたその他の不揮発性
メモリ装置でも、この問題は同様に発生する。Further, not only the IC card but also other non-volatile memory devices having non-volatile memory such as SD (Secure Digital) memory card which is a memory card with a copyright protection function, the same problem occurs. To do.
【0018】本発明は、上述のような従来の技術におけ
る課題を鑑みてなされたものであり、電源の遮断があっ
ても、電源再投入後にデータの更新や維持を必要に応じ
て行うことが可能な不揮発性メモリ装置、データ更新方
法、データ更新プログラム及びそのプログラムが記録さ
れたコンピュータ読み取り可能な記録媒体を提供するこ
とを目的とするものである。The present invention has been made in view of the above-mentioned problems in the prior art, and even if the power is cut off, the data can be updated or maintained as needed after the power is turned on again. It is an object of the present invention to provide a possible nonvolatile memory device, a data updating method, a data updating program, and a computer-readable recording medium having the program recorded therein.
【0019】[0019]
【課題を解決するための手段】上述の目的を達成するた
めに、本発明は、以下の手段を採用している。To achieve the above object, the present invention employs the following means.
【0020】本発明では、不揮発性メモリに既に書き込
まれていたデータが更新される場合、更新対象領域に対
する消去が行われてから、更新された後の更新後データ
が更新対象領域に書き込まれる。According to the present invention, when the data already written in the non-volatile memory is updated, the updated data after being updated is written in the update target area after erasing the update target area.
【0021】データの更新のために、不揮発性メモリの
更新対象領域とは異なる領域に、更新用データ記憶領域
が確保される。更新データ書き込み手段は、更新対象領
域に対する消去の前に、更新される前の更新前データ及
び更新前データを更新後データに更新するのに必要な更
新用データを更新対象領域に書き込む。更新用データ
は、例えば更新前データの更新部分である更新データを
含む。In order to update the data, the update data storage area is secured in an area different from the update target area of the non-volatile memory. The update data writing means writes the pre-update data before update and the update data necessary for updating the pre-update data to the post-update data in the update target area before erasing the update target area. The update data includes, for example, update data that is an update portion of the pre-update data.
【0022】状態フラグ設定手段は、不揮発性メモリに
記憶される状態フラグを設定する。この状態フラグは、
更新対象領域に対する更新後データの書き込み途中であ
るか否かを表す。例えば更新後データが更新対象領域に
書き込まれると、状態フラグ設定手段は、状態フラグの
設定を、更新後データの書き込み途中であるという設定
から、更新後データの書き込み途中でないという設定に
変更する。The status flag setting means sets a status flag stored in the non-volatile memory. This status flag is
It indicates whether or not the post-update data is being written to the update target area. For example, when the updated data is written in the update target area, the state flag setting means changes the setting of the state flag from the setting that the updated data is being written to the setting that the updated data is not being written.
【0023】更新後データの書き込み途中に、意図しな
い電源遮断などがあり、データの更新が中断されたとす
ると、状態フラグは、不揮発性メモリに記憶されている
ので、電源が再投入されるのに伴って不揮発性メモリ装
置が起動する際には、更新後データの書き込み途中に設
定されたままである。If the power supply is unintentionally cut off during the writing of the post-update data and the data update is interrupted, the status flag is stored in the non-volatile memory, and therefore the power is turned on again. Accordingly, when the nonvolatile memory device is activated, it remains set during the writing of the updated data.
【0024】更新再開決定手段は、不揮発性メモリが起
動する際、状態フラグの設定が更新後データの書き込み
の途中であることを検出した場合、例えば外部からの指
示に従って、更新用データ記憶領域の更新前データ及び
更新用データを用いて更新対象領域に対する更新後デー
タの書き込みを再開するか、更新用データ記憶領域の更
新前データを更新対象領域に書き込むかを決定する。When the non-volatile memory is activated, when the update restart determination means detects that the setting of the status flag is in the middle of writing the updated data, for example, according to an instruction from the outside, the update data storage area of the update data storage area is It is determined whether the writing of the updated data to the update target area is restarted using the pre-update data and the update data, or whether the pre-update data in the update data storage area is written to the update target area.
【0025】更新後データも更新前データも、不揮発性
メモリに確保された更新用データ記憶領域に記憶された
データから得られるので、必要に応じて更新後データか
更新前データのいずれかを更新対象領域に書き込むこと
ができる。更新再開決定手段が外部からの指示に従う場
合には、この指示が与えられるまで不用意な書き込みが
行われることもなく、指示があれば、それに従い、更新
前データ及び更新後データのいずれのデータが書き込ま
れる。Since both the post-update data and the pre-update data are obtained from the data stored in the update data storage area secured in the non-volatile memory, either the post-update data or the pre-update data is updated as necessary. You can write to the target area. When the update resumption determining means follows an external instruction, careless writing is not performed until this instruction is given, and if there is an instruction, either the pre-update data or the post-update data can be used. Is written.
【0026】このような不揮発性メモリ装置に、不揮発
性メモリだけでなく、揮発性メモリも備えてもよい。こ
の揮発性メモリは、更新前データ及び更新用データを一
時的に記憶するために用いられる。そして、更新用デー
タ書き込み手段は、揮発性メモリに記憶された更新前デ
ータ及び更新用データを更新用データ記憶領域に複写す
る。Such a non-volatile memory device may include not only the non-volatile memory but also a volatile memory. This volatile memory is used to temporarily store the pre-update data and the update data. Then, the update data writing means copies the pre-update data and the update data stored in the volatile memory to the update data storage area.
【0027】この場合、例えば更新データの書き込み要
求がある度に、不揮発性メモリに確保された更新用デー
タ記憶領域に書き込みを行う必要がなくなる。更新前デ
ータや更新データ又は更新用データが所定量以上、揮発
性メモリに蓄積された後、揮発性メモリから不揮発性メ
モリの更新用データ記憶領域に更新前データ及び更新用
データを複写すればよい。In this case, for example, it is not necessary to write to the update data storage area secured in the non-volatile memory every time there is a request to write update data. After a predetermined amount or more of pre-update data, update data, or update data is accumulated in the volatile memory, the pre-update data and the update data may be copied from the volatile memory to the update data storage area of the nonvolatile memory. .
【0028】これによって不揮発性メモリに確保された
更新用データ記憶領域に対する書き込み回数を低減する
ことができ、データ更新時間の短縮を図ることができ
る。また、書き込み回数が減少すれば、不揮発性メモリ
の使用寿命も長くなる。As a result, the number of times of writing to the update data storage area secured in the non-volatile memory can be reduced, and the data update time can be shortened. In addition, if the number of writings is reduced, the useful life of the nonvolatile memory is extended.
【0029】また、更新用データ書き込み手段は、更新
用データ記憶領域に更新後データの書き込み種別を書き
込むようにしてもよい。状態フラグ設定手段は、更新後
データの書き込み種別も状態フラグに設定する。更新再
開決定手段は、更新用データ記憶領域の書き込み種別が
状態フラグに設定された書き込み種別と対応する更新後
データについてのみ、書き込みを再開することを決定す
る。Further, the update data writing means may write the write type of the updated data in the update data storage area. The status flag setting means also sets the write type of the updated data in the status flag. The update restart determining means determines to restart the write only for the updated data corresponding to the write type set in the status flag as the write type of the update data storage area.
【0030】書き込み種別を対象となるデータに合わせ
て適当に設定すれば、全ての更新用データについて書き
込みを再開する必要がない場合でも、必要なデータにつ
いてのみ書き込みを再開することができる。By appropriately setting the write type according to the target data, even if it is not necessary to restart writing for all update data, it is possible to restart writing only for necessary data.
【0031】この場合に、更新用データ書き込み手段
は、更新用データ記憶領域に、状態フラグに設定された
書き込み種別に対応する更新用データのみを書き込むよ
うにしてもよい。これによって、更新用データ記憶領域
に対する不必要な書き込みも回避することができる。In this case, the update data writing means may write only the update data corresponding to the write type set in the status flag in the update data storage area. As a result, unnecessary writing to the update data storage area can be avoided.
【0032】また、更新用データ書き込み手段は、更新
用データ記憶領域の基準位置からの更新前データ又は更
新用データのオフセットも更新用データ記憶領域に書き
込むようにしてもよい。この場合、更新用データ書き込
み手段は、オフセットに基づいて、更新前データ及び更
新用データの更新用データ記憶領域への書き込み開始位
置を定める。Further, the update data writing means may write the offset of the pre-update data or the update data from the reference position of the update data storage area in the update data storage area. In this case, the update data writing unit determines the write start position of the pre-update data and the update data to the update data storage area based on the offset.
【0033】これによって、不揮発性メモリに確保され
た更新用データ記憶領域の特定の箇所だけに更新用デー
タが多数回書き込まれる問題が回避される。その結果、
不揮発性メモリを最大限の期間利用することができる。As a result, it is possible to avoid the problem that the update data is written many times only in a specific portion of the update data storage area secured in the non-volatile memory. as a result,
The non-volatile memory can be used for the maximum period.
【0034】本発明は、電気通信回線などを介して個別
に流通するデータ更新プログラムとして提供されること
もある。このデータ更新プログラムは、不揮発性メモリ
を制御するCPUなどを備えた制御装置と協働し、この制
御装置を、上述の不揮発性メモリ装置として機能させ
る。例えばこの制御装置がデータ更新プログラムに従っ
て不揮発性メモリに対する制御を行ったり、不揮発性メ
モリ装置が動作したりすると、本発明は、データ更新方
法として実施される。また、データ更新プログラムは、
CD-ROMなどのコンピュータ読み取り可能な記録媒体に記
録された状態で流通することもある。The present invention may be provided as a data update program that is individually distributed via a telecommunication line or the like. The data update program cooperates with a control device that includes a CPU that controls the non-volatile memory, and causes the control device to function as the non-volatile memory device described above. For example, when the control device controls the non-volatile memory according to the data updating program or the non-volatile memory device operates, the present invention is implemented as a data updating method. Also, the data update program is
It may be distributed as recorded on a computer-readable recording medium such as a CD-ROM.
【0035】[0035]
【発明の実施の形態】以下、添付図面を参照して本発明
の実施の形態につき説明する。以下の実施の形態では、
本発明は、データ更新プログラムとして提供される。DETAILED DESCRIPTION OF THE INVENTION Embodiments of the present invention will be described below with reference to the accompanying drawings. In the following embodiments,
The present invention is provided as a data update program.
【0036】このデータ更新プログラムは、例えばCPU
を内蔵したICカードや拡張されたSDメモリカード(以
下、SDXと記載する)に本発明の機能を実現させるプロ
グラムである。This data update program is, for example, a CPU
It is a program that realizes the functions of the present invention in an IC card having a built-in or an expanded SD memory card (hereinafter, referred to as SDX).
【0037】SDXは、SDメモリカードのソフトウェアと
ハードウェアの構成をICカードと同等の構成に拡張した
ものである。SDXでは、電子商取引などに利用されるた
めに、OS(Operating System)や各種のアプリケーション
が利用するライブラリも用意される。SDX is an extension of the software and hardware configuration of an SD memory card to a configuration equivalent to that of an IC card. In SDX, a library used by the OS (Operating System) and various applications is also prepared for use in electronic commerce.
【0038】もっとも、SDXの基本的なハードウェア構
成は、図1に示されたCPUを内蔵したICカードの構成と
同様であるので、以下では、このICカードに内蔵された
CPUが、データ更新プログラムを実行するものとして説
明する。(実施の形態1)CPUがデータ更新プログラムを実行す
ると、ICカードのハードウェアとデータ更新プログラム
が協働することによって、このICカードを本発明が適用
された不揮発性メモリ装置として機能させる。However, since the basic hardware structure of the SDX is similar to that of the IC card containing the CPU shown in FIG. 1, it will be described below as a built-in IC card.
It is assumed that the CPU executes the data update program. (Embodiment 1) When the CPU executes the data update program, the hardware of the IC card and the data update program work together to cause the IC card to function as a nonvolatile memory device to which the present invention is applied.
【0039】図3に示すように、不揮発性メモリ装置
は、不揮発性メモリ301を備える。不揮発性メモリ3
01には、EEPROMを用いることができる。EEPROMやフラ
ッシュメモリでは、既述した通り、データの更新は、既
に書き込まれていたデータが更新される更新対象領域3
02に対して消去が行われてから、更新された後の更新
後データが更新対象領域302に書き込まれることによ
って行われる。As shown in FIG. 3, the non-volatile memory device includes a non-volatile memory 301. Non-volatile memory 3
An EEPROM can be used for 01. As described above, in the EEPROM or the flash memory, the data update is performed in the update target area 3 where the already written data is updated.
This is performed by writing the updated data after being erased to 02 to the update target area 302 after the erase.
【0040】更新用データ書き込み手段305は、更新
される前の更新前データ及び更新前データを更新後デー
タに更新するのに必要な更新用データを不揮発性メモリ
301の更新対象領域302とは異なる領域に確保され
た更新用データ記憶領域に書き込む。The update data writing means 305 differs from the update target area 302 of the non-volatile memory 301 in the pre-update data and the update data necessary for updating the pre-update data to the post-update data. Write to the update data storage area secured in the area.
【0041】この不揮発性メモリ301には、データが
格納されるデータ格納領域303とは別に、不揮発性メ
モリ301の制御のためのワーク領域304が確保され
ており、更新用データ記憶領域として、このワーク領域
304が用いられる。In the non-volatile memory 301, a work area 304 for controlling the non-volatile memory 301 is secured in addition to a data storage area 303 in which data is stored. This work area 304 is used as an update data storage area. The work area 304 is used.
【0042】更新用データは、図3に示すように、例え
ば更新前データの更新部分である更新データや各データ
のデータサイズなどの管理情報を含む。As shown in FIG. 3, the update data includes, for example, update data which is an update portion of the pre-update data and management information such as the data size of each data.
【0043】状態フラグ設定手段306は、不揮発性メ
モリ301のワーク領域304に記憶される状態フラグ
に値を設定する。状態フラグの値には、例えば更新対象
領域302に対する更新後データの書き込みの途中であ
ることを表す値(以下、書き込み中と記載)と、更新対
象領域302に対する更新後データの書き込みの途中で
ないことを表す値(以下、未処理と記載)とが用意され
る。The state flag setting means 306 sets a value in the state flag stored in the work area 304 of the non-volatile memory 301. As the value of the state flag, for example, a value indicating that the post-update data is being written to the update target area 302 (hereinafter referred to as writing) and that the post-update data is not being written to the update target area 302 And a value (hereinafter, described as unprocessed) that represents
【0044】状態フラグは、更新前データと更新用デー
タとの組毎に用意される必要はない。例えば電子商取引
における一つの項目について複数の内部データが発生す
る場合、複数の内部データに対応する一連の組を単位と
して状態フラグが用意されてもよい。The status flag does not have to be prepared for each set of pre-update data and update data. For example, when a plurality of internal data is generated for one item in electronic commerce, the status flag may be prepared in units of a series of sets corresponding to the plurality of internal data.
【0045】更新再開決定手段307は、起動の後、状
態フラグの設定が書き込み中であることを検出した場
合、ワーク領域304の更新前データ及び更新用データ
を用いて前記更新対象領域に対する更新後データの書き
込みを再開するかワーク領域304の更新前データを更
新対象領域302に書き込むかを決定する。After the start-up, the update restart determining means 307 uses the pre-update data and the update data in the work area 304 to detect the post-update of the update target area when it detects that the status flag is being written. It is determined whether data writing is restarted or pre-update data in the work area 304 is written in the update target area 302.
【0046】更新用データのワーク領域への複写や状態
フラグの設定などに伴う、不揮発性メモリへの書き込み
(消去を含む)、不揮発性メモリからの読み出しの制御
は、データ更新プログラムを用いる場合、ICカードのCP
U103が行うことになる。また、CPU103は、この制
御を行うことによって、実施の形態1におけるデータ更
新方法を実行することにもなる。When a data update program is used, control of writing (including erasing) to the non-volatile memory and reading from the non-volatile memory accompanying copying of update data to the work area, setting of a status flag, etc. IC card CP
U103 will do it. Further, the CPU 103 also executes the data updating method according to the first embodiment by performing this control.
【0047】図4はこの実施の形態1におけるデータ更
新方法を説明するためのフローチャートであり、データ
更新の中断がない場合の手順を表す。FIG. 4 is a flow chart for explaining the data updating method according to the first embodiment, and shows a procedure when there is no interruption of data updating.
【0048】図4に示すように、データ更新の必要な書
き込み要求があると、CPU103は、更新用データ書き
込み手段305として動作し、更新前データを更新対象
領域302からワーク領域304に複写する(S10
1)。すなわち、CPU103は、更新対象領域302か
ら更新前データを読み出し、読み出された更新前データ
をワーク領域304に書き込む制御を行う。As shown in FIG. 4, when there is a write request that requires data update, the CPU 103 operates as the update data writing means 305 and copies the pre-update data from the update target area 302 to the work area 304 ( S10
1). That is, the CPU 103 performs control to read the pre-update data from the update target area 302 and write the read pre-update data in the work area 304.
【0049】また、CPU103は、書き込み要求に伴っ
て入力された更新データを含む更新用データもワーク領
域304に書き込む(S102)。The CPU 103 also writes update data including the update data input in response to the write request to the work area 304 (S102).
【0050】ワーク領域304に更新前データ及び更新
用データを書き込むと、CPU103は、状態フラグ設定
手段305として動作し、状態フラグを書き込み中に設
定する(S103)。また、CPU103は、更新対象領
域302にあるデータを消去し、更新対象領域302を
書き込み可能な状態にする。When the pre-update data and the update data are written in the work area 304, the CPU 103 operates as the status flag setting means 305 and sets the status flag to "in writing" (S103). Further, the CPU 103 erases the data in the update target area 302, and puts the update target area 302 in a writable state.
【0051】状態フラグを書き込み中に設定すると、CP
U103は、更新前データ及び更新用データを用いて生
成された更新後データを更新対象領域302に書き込む
制御を、その状態フラグに対応する全ての更新後データ
が更新対象領域302に書き込まれるまで繰り返す(S
104)。If the status flag is set during writing, CP
The U 103 repeats the control of writing the post-update data generated using the pre-update data and the update data to the update target area 302 until all the post-update data corresponding to the status flag are written to the update target area 302. (S
104).
【0052】この際、CPU103は、更新用データの管
理情報を参照してワーク領域304から更新前データと
更新データとを適宜読み出すことによって更新後データ
を生成する。At this time, the CPU 103 refers to the management information of the update data and appropriately reads the pre-update data and the update data from the work area 304 to generate the post-update data.
【0053】状態フラグに対応する全ての更新後データ
が更新対象領域302に書き込まれると、CPU103
は、状態フラグ設定手段305として動作し、状態フラ
グを未処理に設定する(S105)。状態フラグが未処
理に設定されると、ワーク領域304に記憶された更新
用データは適時消去される。When all the updated data corresponding to the status flags are written in the update target area 302, the CPU 103
Operates as the state flag setting means 305 and sets the state flag to unprocessed (S105). When the status flag is set to unprocessed, the update data stored in the work area 304 is erased at appropriate times.
【0054】通常このようにデータの更新は行われる。
更新後データを更新対象領域302に書き込んでいる途
中に、意図しない電源遮断が起こっても、更新前データ
と更新データとを含む更新用データがワーク領域304
に残っているから、更新前データも更新後データも喪失
しない。電源が再投入されれば、更新前データか更新後
データを更新対象領域302に書き込むことができる。
すなわち、データ更新の途中で電源遮断などがあって
も、ICカードがその次に起動する際、データの更新を再
開するかデータを更新しないで更新前データを維持する
かを選択することができる。Data is normally updated in this manner.
Even if the power is cut off unintentionally while the post-update data is being written in the update target area 302, the update data including the pre-update data and the update data is stored in the work area 304.
The data before update and the data after update are not lost. When the power is turned on again, the pre-update data or the post-update data can be written in the update target area 302.
That is, even if the power is cut off during the data update, when the IC card is activated next time, it is possible to select whether to restart the data update or keep the pre-update data without updating the data. .
【0055】図5はこの実施の形態1におけるデータ更
新方法を説明するための他のフローチャートであり、デ
ータ更新の中断後、データの更新再開又は維持を行う手
順を示す。FIG. 5 is another flow chart for explaining the data updating method according to the first embodiment, and shows a procedure for resuming or maintaining data updating after interruption of data updating.
【0056】電源投入に伴う起動の際、CPU103は、
更新再開決定手段307として動作し、図5に示すよう
に、状態フラグが書き込み中であるか否かを検出する
(S201)。状態フラグの設定を検出することによっ
て、その起動の前のデータ更新が正常に行われたか否か
が判断される。At the time of starting when the power is turned on, the CPU 103
It operates as the update restart determining means 307, and as shown in FIG. 5, detects whether or not the status flag is being written (S201). By detecting the setting of the status flag, it is judged whether or not the data update before the activation is normally performed.
【0057】状態フラグが書き込み中ではなく未処理で
あることを検出した場合、その起動の前のデータ更新は
正常に行われることを意味するので、CPU103は、更
新再開決定手段307としての動作を終了し、データの
更新の再開も更新前データの維持も行われない。When it is detected that the status flag is not being written and is unprocessed, it means that the data update before the activation is normally performed. Therefore, the CPU 103 executes the operation as the update restart determination means 307. The update is not completed and the pre-update data is not restarted.
【0058】一方、状態フラグが書き込み中であること
を検出した場合、その起動の前のデータ更新は異常によ
って完了していないことを意味するので、CPU103
は、継続して更新再開決定手段307として動作し、外
部からの指示に従い、データの更新を再開するか否かを
決定する(S202)。On the other hand, when it is detected that the status flag is being written, it means that the data update before the activation is not completed due to an abnormality, and therefore the CPU 103
Continuously operates as the update restart determining unit 307, and determines whether to restart the data update according to an instruction from the outside (S202).
【0059】データの更新を再開することを決定した場
合、CPU103は、ワーク領域304の更新前データ及
び更新用データを用いて生成した更新後データを更新対
象領域302に書き込む(S203)。When it is decided to restart the data update, the CPU 103 writes the post-update data generated using the pre-update data and the update data in the work area 304 into the update target area 302 (S203).
【0060】一方、データの更新を再開しないことを決
定した場合、CPU103は、ワーク領域304の更新前
データを更新対象領域302に書き込む(S204)。On the other hand, when it is decided not to restart the data update, the CPU 103 writes the pre-update data in the work area 304 into the update target area 302 (S204).
【0061】更新後データ又は更新前データの更新対象
領域302への書き込みが行われると、CPU103は、
状態フラグ設定手段306として動作し、状態フラグを
未処理に設定する(S205)。When the post-update data or the pre-update data is written in the update target area 302, the CPU 103
It operates as the state flag setting means 306 and sets the state flag to unprocessed (S205).
【0062】以上のように、この実施の形態1では、状
態フラグが書き込み中であることを検出した場合、外部
からの指示に従い、データの更新を再開するか否かが決
定されるため、この指示が与えられるまで更新対象領域
に不用意な書き込みが行われることもなく、指示があれ
ば、更新前データ及び更新後データのいずれのデータも
書き込むことができる。(実施の形態2)実施の形態2における不揮発性メモリ
装置は、図6に示すように、不揮発性メモリ301だけ
でなく、RAMなどの揮発性メモリ601も備える。この
揮発性メモリ601にはワーク領域602が確保され、
このワーク領域602は更新前データ及び更新用データ
を一時的に記憶するために用いられる。As described above, in the first embodiment, when it is detected that the status flag is being written, whether or not to restart the data update is determined according to an instruction from the outside. Inadvertent writing is not performed in the update target area until the instruction is given, and both the pre-update data and the post-update data can be written if the instruction is given. (Second Embodiment) As shown in FIG. 6, the non-volatile memory device according to the second embodiment includes not only the non-volatile memory 301 but also a volatile memory 601 such as a RAM. A work area 602 is secured in this volatile memory 601,
The work area 602 is used to temporarily store the pre-update data and the update data.
【0063】この場合に、不揮発性メモリ装置の更新用
データ書き込み手段305は、揮発性メモリ601のワ
ーク領域602に記憶された更新前データ及び更新用デ
ータを不揮発性メモリ301のワーク領域304に複写
する。In this case, the update data writing means 305 of the non-volatile memory device copies the pre-update data and the update data stored in the work area 602 of the volatile memory 601 to the work area 304 of the non-volatile memory 301. To do.
【0064】この実施の形態2では、ICカードに内蔵さ
れたCPU103は、データ更新プログラムに従って、揮
発性メモリ601への書き込みや揮発性メモリ601か
らの読み出しの制御も行う。この制御を行うことによっ
て、CPU103は、実施の形態2におけるデータ更新方
法を実行することにもなる。In the second embodiment, the CPU 103 built in the IC card also controls writing to the volatile memory 601 and reading from the volatile memory 601 according to the data update program. By performing this control, the CPU 103 also executes the data updating method according to the second embodiment.
【0065】図7はこの実施の形態2におけるデータ更
新方法を説明するためのフローチャートであり、データ
更新の中断がない場合の手順を表す。FIG. 7 is a flow chart for explaining the data updating method according to the second embodiment, and shows a procedure when there is no interruption of data updating.
【0066】図7に示すように、データ更新の必要な書
き込み要求があると、CPU103は、更新用データ書き
込み手段305として動作し、更新前データを更新用対
象領域302からワーク領域602に複写する(S70
1)。As shown in FIG. 7, when there is a write request that requires data update, the CPU 103 operates as the update data writing means 305 and copies the pre-update data from the update target area 302 to the work area 602. (S70
1).
【0067】また、CPU103は、書き込み要求に伴っ
て入力された更新データを含む更新用データもワーク領
域602に書き込む(S702)。The CPU 103 also writes the update data including the update data input in response to the write request in the work area 602 (S702).
【0068】続いて、CPU103は、状態フラグ設定手
段306として動作し、揮発性メモリ601に記憶され
る状態フラグを書き込み中に設定する(S703)。Subsequently, the CPU 103 operates as the status flag setting means 306 and sets the status flag stored in the volatile memory 601 to "writing" (S703).
【0069】そして、CPU103は、揮発性メモリ60
1のワーク領域602に書き込まれた更新用データを不
揮発性メモリ301に確保されたワーク領域304に複
写する(S704)。この後、CPU103は、揮発性メ
モリ601に記憶された状態フラグも不揮発性メモリ3
01に複写する。Then, the CPU 103 uses the volatile memory 60.
The update data written in the first work area 602 is copied to the work area 304 secured in the nonvolatile memory 301 (S704). After that, the CPU 103 also stores the status flag stored in the volatile memory 601 in the nonvolatile memory 3 as well.
Copy to 01.
【0070】この後の手順は、実施の形態1で説明した
手順S104、S105と同様である。また、データ更
新の中断後、データの更新再開又は維持を行う手順も、
実施の形態1で説明した手順201〜205と同様に行
われる。Subsequent steps are the same as steps S104 and S105 described in the first embodiment. In addition, the procedure to restart or maintain the data update after the data update is interrupted,
The procedure is similar to steps 201 to 205 described in the first embodiment.
【0071】このように、揮発性メモリ601に更新前
データ及び更新用データを一時的に記憶しておく場合、
書き込み要求がある度に、ワーク領域304に更新用デ
ータを書き込む必要がなくなる。すなわち、手順S70
1から手順S702までが繰り返されて、ワーク領域6
02に更新前データや更新データ又は更新用データが所
定量以上蓄積されてから、手順S703以降を行うよう
にしてもよい。In this way, when the pre-update data and the update data are temporarily stored in the volatile memory 601,
It is not necessary to write the update data to the work area 304 every time there is a write request. That is, step S70
1 to step S702 are repeated, and the work area 6
It is also possible to perform step S703 and subsequent steps after the pre-update data, the update data, or the update data has been accumulated in 02 in a predetermined amount or more.
【0072】この場合、不揮発性メモリ301に確保さ
れたワーク領域304に対する書き込み回数が減るか
ら、全体としてデータ更新の高速化を図ることが可能と
なる。更新データについては通常サイズが小さいことか
ら特に有効である。(実施の形態3)実施の形態1で既述した通り、状態フ
ラグは、更新前データと更新用データの一連の組を単位
として用意されることがある。図8に示す例では、N個
の組に対して1つの状態フラグが対応付けられている。In this case, since the number of times of writing to the work area 304 secured in the non-volatile memory 301 is reduced, it is possible to speed up the data update as a whole. Update data is particularly effective because it is usually small in size. (Third Embodiment) As described in the first embodiment, the status flag may be prepared in units of a series of sets of pre-update data and update data. In the example shown in FIG. 8, one status flag is associated with N sets.
【0073】ところで、一連の組には、データ更新の再
開が必ずしも必要ないデータが含まれることもある。例
えば電子商取引などにおいて時期の異なる複数のトラン
ザクションで共用されるデータは、データ更新の再開の
必要性が高いが、1回のトランザクションでしか利用さ
ない一時的なデータに対するデータ更新の再開の必要性
は少ない。このような場合には、必要なデータについて
のみデータ更新の再開又は維持が行い得るようにすれば
十分である。By the way, a series of sets may include data that does not necessarily need to be restarted. For example, data shared by multiple transactions at different times in e-commerce has a high need to restart data updating, but it is necessary to restart data updating for temporary data used only in one transaction. Is few. In such a case, it is sufficient that the data update can be restarted or maintained only for necessary data.
【0074】このために、状態フラグに設定される値に
書き込み種別が含まれるようにしてもよい。ここで、不
揮発性メモリ装置の基本的な構成は、実施の形態1と同
様であるが、不揮発性メモリ装置の状態フラグ設定手段
306は、状態フラグの値に、書き込み種別として絶対
書き込み又は通常書き込みを設定するものとする。絶対
書き込みは、例えばデータ更新の再開又は維持の選択に
対する必要なことが予め知られているデータのみの書き
込みを表す。通常書き込みは、全てのデータの書き込み
を表す。この場合、状態フラグに、未処理、書き込み
中、絶対書き込み、通常書き込みという4つの値を用意
してもよいし、未処理、絶対書き込み、通常書き込みと
いう3つの値を用意してもよい。状態フラグに未処理、
絶対書き込み、通常書き込みの3つの値を用意した場
合、絶対書き込み又は通常書き込みは、書き込み中であ
ることも表す。以下では、状態フラグに3つの値が用意
されているものとする。For this purpose, the value set in the status flag may include the write type. Here, the basic configuration of the non-volatile memory device is the same as that of the first embodiment, but the state flag setting means 306 of the non-volatile memory device uses the value of the state flag as absolute writing or normal writing as the writing type. Shall be set. Absolute writing refers, for example, to writing only the data that is known in advance to be necessary for selecting whether to restart or maintain the data update. Normal writing represents writing of all data. In this case, four values of unprocessed, writing, absolute write, and normal write may be prepared for the state flag, or three values of unprocessed, absolute write, and normal write may be prepared. Unprocessed in status flag,
When three values of absolute writing and normal writing are prepared, absolute writing and normal writing also indicate that writing is in progress. Below, it is assumed that three values are prepared for the status flag.
【0075】また、更新用データ書き込み手段305
は、ワーク領域304に書き込み種別も書き込む。書き
込み種別は、更新用データの管理情報の一つとして扱わ
れる。管理情報には、この他、更新前データのサイズ、
更新データのサイズ、更新前データの更新位置が含まれ
る。Also, the update data writing means 305
Also writes the write type to the work area 304. The write type is treated as one of management information of update data. In addition to this, the management information includes the size of the data before update,
The size of the update data and the update position of the pre-update data are included.
【0076】この実施の形態3では、データ更新プログ
ラムは、このような不揮発性メモリ装置としてICカード
を機能させる。また、ICカードのCPU103は、実施の
形態3におけるデータ更新方法を実行することにもな
る。In the third embodiment, the data update program causes the IC card to function as such a non-volatile memory device. Further, the CPU 103 of the IC card also executes the data updating method according to the third embodiment.
【0077】図9はこの実施の形態3におけるデータ更
新方法を説明するためのフローチャートであり、データ
更新の中断がない場合の手順を表す。FIG. 9 is a flow chart for explaining the data updating method according to the third embodiment, and shows a procedure when there is no interruption of data updating.
【0078】図9に示すように、データ更新の必要な書
き込み要求があると、CPU103は、実施の形態1と同
様に、更新用データ書き込み手段305として動作し、
更新前データを更新用対象領域302からワーク領域3
04に複写する(S101)。As shown in FIG. 9, when there is a write request that requires data update, the CPU 103 operates as the update data writing means 305, as in the first embodiment.
Pre-update data from update target area 302 to work area 3
04 is copied (S101).
【0079】また、CPU103は、書き込み要求に伴っ
て入力された更新データを含む更新用データもワーク領
域304に書き込む(S901)。この更新用データに
は、絶対書き込みか通常書き込みを表す書き込み種別が
含まれる。The CPU 103 also writes update data including the update data input in response to the write request to the work area 304 (S901). The update data includes a write type indicating absolute write or normal write.
【0080】ワーク領域304に更新前データ及び更新
用データを書き込むと、CPU103は、状態フラグ設定
手段305として動作し、状態フラグに書き込み種別を
設定する(S902)。また、CPU103は、更新対象
領域302にあるデータを消去し、更新対象領域302
を書き込み可能な状態にする。When the pre-update data and the update data are written in the work area 304, the CPU 103 operates as the state flag setting means 305 and sets the write type in the state flag (S902). Further, the CPU 103 erases the data in the update target area 302,
To make it writable.
【0081】この後、実施の形態1と同様に手順S10
4が行われ、手順S104が完了すれば、手順S105
が行われる。意図しない電源の遮断があり、手順S10
5が行われなかった場合、ICカードがその次に起動する
際、データの更新を再開するかデータを更新しないで更
新前データを維持するかを選択することができる。Thereafter, the procedure S10 is performed as in the first embodiment.
4 is performed, and if step S104 is completed, step S105
Is done. There is an unintended power interruption, and the procedure S10
If step 5 is not performed, when the IC card is activated next time, it is possible to restart the data update or select whether to maintain the pre-update data without updating the data.
【0082】図10はこの実施の形態3におけるデータ
更新方法を説明するための他のフローチャートであり、
データ更新の中断後、データの更新再開又は維持を行う
手順を示す。FIG. 10 is another flow chart for explaining the data updating method according to the third embodiment.
A procedure for resuming or maintaining the data after the interruption of the data update is shown.
【0083】電源投入に伴う起動の際、CPU103は、
更新再開決定手段307として動作し、図10に示すよ
うに、状態フラグが書き込み種別であるか否かを検出す
る(S1001)。例えば状態フラグが未処理でなけれ
ば、状態フラグは書き込み種別であると検出される。At the time of starting when the power is turned on, the CPU 103
It operates as the update restart determination means 307, and as shown in FIG. 10, detects whether the status flag is the write type (S1001). For example, if the status flag is not unprocessed, the status flag is detected as the write type.
【0084】状態フラグが未処理であることを検出した
場合、その起動の前のデータ更新は正常に行われていた
ことを意味するので、実施の形態1と同様に、CPU10
3は、更新再開決定手段307としての動作を終了し、
データの更新の再開も更新前データの維持も行われな
い。When it is detected that the status flag is unprocessed, it means that the data update before the activation is normally performed. Therefore, as in the first embodiment, the CPU 10
3 terminates the operation as the update restart determination means 307,
Data update is not restarted and pre-update data is not maintained.
【0085】一方、状態フラグが書き込み種別であるこ
とを検出した場合、その起動の前のデータ更新は異常に
よって完了していないことを意味するので、CPU103
は、継続して更新再開決定手段307として動作し、実
施の形態1と同様に、外部からの指示に従い、データの
更新を再開するか否かを決定する(S202)。On the other hand, when it is detected that the status flag is the write type, it means that the data update before the activation is not completed due to an abnormality, so that the CPU 103
Continuously operates as the update restart determining unit 307, and determines whether to restart the update of data according to an external instruction, as in the first embodiment (S202).
【0086】データの更新を再開することを決定した場
合、CPU103は、ワーク領域304の書き込み種別が
状態フラグに設定された書き込み種別と対応する更新後
データのみを更新対象領域302に書き込む(S100
2)。状態フラグに設定された書き込み種別が絶対書き
込みであれば、更新用データに絶対書き込みという書き
込み種別が書き込まれたものについてのみ、更新後デー
タが生成され、それらが更新対象領域302に書き込ま
れる。更新用データに通常書き込みという書き込み種別
が書き込まれたものの更新後データは生成されない。一
方、状態フラグに設定された書き込み種別が通常書き込
みであれば、更新用データに絶対書き込みという書き込
み種別が書き込まれたものも含め全てについて、更新後
データが生成され、それらが更新対象領域302に書き
込まれる。When it is decided to restart the data update, the CPU 103 writes only the updated data corresponding to the write type set in the status flag as the write type of the work area 304 to the update target area 302 (S100).
2). If the write type set in the status flag is absolute write, the updated data is generated only for the update data in which the write type of absolute write is written, and these are written in the update target area 302. Although the write type of normal write is written in the update data, the updated data is not generated. On the other hand, if the write type set in the status flag is normal write, updated data is generated for all the update data including the write type of absolute write, and these are updated in the update target area 302. Written.
【0087】また、データの更新を再開しないことを決
定した場合、CPU103は、ワーク領域304の更新前
データを更新対象領域302に書き込む(S204)。If it is decided not to restart the data update, the CPU 103 writes the pre-update data in the work area 304 into the update target area 302 (S204).
【0088】更新後データ又は更新前データの更新対象
領域302への書き込みが行われると、CPU103は、
状態フラグ設定手段306として動作し、状態フラグを
未処理に設定する(S205)。When the post-update data or the pre-update data is written in the update target area 302, the CPU 103
It operates as the state flag setting means 306 and sets the state flag to unprocessed (S205).
【0089】このように、実施の形態3では、必要なデ
ータについてのみ選択にデータの更新を再開することが
できる。As described above, in the third embodiment, the data update can be selectively restarted only for the necessary data.
【0090】なお、この実施の形態3では、全ての更新
用データをワーク領域604に書き込んだが、これに限
られるものではない。状態フラグに設定された書き込み
種別に対応するもののみ、ワーク領域604に更新用デ
ータを書き込むようにしてもよい。In the third embodiment, all update data is written in the work area 604, but the present invention is not limited to this. The update data may be written in the work area 604 only for the type corresponding to the write type set in the status flag.
【0091】また、実施の形態2のように揮発性メモリ
601が用いられる場合でも、実施の形態3の内容は基
本的に変わらない。この場合、状態フラグ設定手段30
6は、揮発性メモリ601のワーク領域602に記憶さ
れる状態フラグに書き込み種別又は未処理を設定し、ワ
ーク領域304に記憶すればよい。Even if the volatile memory 601 is used as in the second embodiment, the contents of the third embodiment are basically the same. In this case, the status flag setting means 30
6 may set the writing type or unprocessed to the status flag stored in the work area 602 of the volatile memory 601, and store it in the work area 304.
【0092】また、各実施の形態において、更新用デー
タ書き込み手段305は、ワーク領域304の基準位置
からの更新前データ又は更新用データのオフセットもワ
ーク領域304に書き込むようにしてもよい。この場
合、更新用データ書き込み手段305は、オフセットに
基づいて、更新前データ及び更新用データのワーク領域
304への書き込み開始位置を定める。オフセットは、
例えば状態フラグや管理情報の個数と同様に、更新前デ
ータと更新用データの一連の組に対応して、ワーク領域
304に書き込まれる。In each embodiment, the update data writing unit 305 may also write the offset of the pre-update data or the update data from the reference position of the work area 304 in the work area 304. In this case, the update data writing unit 305 determines the write start position of the pre-update data and the update data in the work area 304 based on the offset. The offset is
For example, like the number of status flags and the number of pieces of management information, they are written in the work area 304 corresponding to a series of sets of pre-update data and update data.
【0093】これによって、既に書き込まれている更新
前データ及び更新用データの後、オフセットで示された
位置に次の更新前データ及び更新後データが書き込まれ
る。また、書き込みタイミングごとにオフセットの値を
変化させる。例えば一連のデータをワーク領域304に
書き込む場合に、ワーク領域304の開始位置からのオ
フセットをはじめは0にしておき、オフセットで示され
た位置に1番目のデータが書き込まれたら、オフセット
は所定量増分される。2番目のデータは、増分されたオ
フセットで示される位置に書き込まれ、2番目のデータ
が書き込まれると、さらにオフセットが所定量だけ増分
される。このように、オフセットで示された位置に更新
前データ及び更新後データが次々と書き込まれる結果、
更新前データ及び更新用データがワーク領域304に渡
って満遍なく書き込まれることになり、ワーク領域の特
定の箇所だけに更新用データが多数回書き込まれるのを
回避することができる。従って、不揮発性メモリを最大
限の期間利用することができる。As a result, after the pre-update data and the update data which have already been written, the next pre-update data and the post-update data are written at the position indicated by the offset. Further, the offset value is changed for each write timing. For example, when writing a series of data to the work area 304, the offset from the start position of the work area 304 is initially set to 0, and if the first data is written at the position indicated by the offset, the offset is a predetermined amount. Incremented. The second data is written at the position indicated by the incremented offset, and when the second data is written, the offset is further incremented by a predetermined amount. In this way, as a result of the pre-update data and the post-update data being written one after another at the position indicated by the offset
Since the pre-update data and the update data are evenly written over the work area 304, it is possible to prevent the update data from being written many times only at a specific portion of the work area. Therefore, the non-volatile memory can be used for the maximum period.
【0094】なお、データ更新プログラムを専用の回路
で実現し、不揮発性メモリ装置を構成することも可能で
ある。また、データ更新プログラムは、ICカードなどの
ROMや書き換え可能な不揮発性メモリに記憶されるが、
データ更新プログラム単体が電気通信回線などを介して
流通することもある。さらに、データ更新プログラム
は、CD-ROMなどのコンピュータ読み取り可能な記録媒体
に記録された状態で流通することもある。It is also possible to realize the data update program by a dedicated circuit to configure a non-volatile memory device. In addition, the data update program
Stored in ROM or rewritable non-volatile memory,
The data update program itself may be distributed via a telecommunication line or the like. Further, the data update program may be distributed in a state of being recorded in a computer-readable recording medium such as a CD-ROM.
【0095】[0095]
【発明の効果】以上説明した通り、本発明では、更新後
データも更新前データも、不揮発性メモリの更新用デー
タ記憶領域に書き込まれており、装置が起動する際に更
新後データか更新前データのいずれかを更新対象領域に
書き込むかを決定する。このため、データの更新が意図
しない電源遮断などによって中断されたとしても、必要
に応じてデータの更新を再開することも、元のデータに
戻すこともできる。As described above, according to the present invention, both the post-update data and the pre-update data are written in the update data storage area of the non-volatile memory. Decide whether any of the data will be written to the update target area. Therefore, even if the data update is interrupted due to an unintended power shutdown, the data update can be restarted or restored to the original data as needed.
【0096】また、揮発性メモリに記憶された更新前デ
ータ及び更新用データを更新用データ記憶領域に複写す
るようにすれば、不揮発性メモリの更新用データ記憶領
域に対する書き込み回数を低減することができ、データ
更新時間の短縮を図ることができる。また、書き込み回
数が減少すれば、不揮発性メモリの使用寿命も長くな
る。If the pre-update data and the update data stored in the volatile memory are copied to the update data storage area, the number of times of writing to the update data storage area of the nonvolatile memory can be reduced. Therefore, the data update time can be shortened. In addition, if the number of writings is reduced, the useful life of the nonvolatile memory is extended.
【0097】また、更新用データ記憶領域に更新後デー
タの書き込み種別を書き込み、状態フラグに書き込み種
別も設定するようにすれば、全ての更新用データについ
て書き込みを再開する必要がない場合でも、必要なデー
タについてのみ書き込みを再開することができる。Further, if the write type of the updated data is written in the update data storage area and the write type is also set in the status flag, it is necessary even if it is not necessary to restart writing for all the update data. Writing can be resumed only for the appropriate data.
【0098】また、更新用データ記憶領域の基準位置か
らの更新前データ又は更新用データのオフセットに基づ
いて、更新前データ及び更新用データの書き込み開始位
置を決定すれば、更新用データ記憶領域の特定の箇所だ
けに更新用データが多数回書き込まれる問題が回避され
る。If the write start position of the pre-update data and the update data is determined based on the offset of the pre-update data or the update data from the reference position of the update data storage area, The problem that the update data is written many times only in a specific location is avoided.
【図1】 ICカードの概略構成を示す図FIG. 1 is a diagram showing a schematic configuration of an IC card.
【図2】 データを更新する従来の手順を説明するため
の図FIG. 2 is a diagram for explaining a conventional procedure for updating data.
【図3】 実施の形態1における不揮発性メモリ装置の
概略構成を示す図FIG. 3 is a diagram showing a schematic configuration of a nonvolatile memory device according to the first embodiment.
【図4】 実施の形態1におけるデータ更新方法を説明
するためのフローチャートFIG. 4 is a flowchart for explaining a data updating method according to the first embodiment.
【図5】 実施の形態1におけるデータ更新方法を説明
するための他のフローチャートFIG. 5 is another flowchart for explaining the data updating method according to the first embodiment.
【図6】 実施の形態2における不揮発性メモリ装置の
概略構成を示す図FIG. 6 is a diagram showing a schematic configuration of a nonvolatile memory device according to a second embodiment.
【図7】 実施の形態2におけるデータ更新方法を説明
するためのフローチャートFIG. 7 is a flowchart for explaining a data updating method according to the second embodiment.
【図8】 更新用データと状態フラグを具体的に説明す
るための図FIG. 8 is a diagram for specifically explaining update data and status flags.
【図9】 実施の形態3におけるデータ更新方法を説明
するためのフローチャートFIG. 9 is a flowchart for explaining a data updating method according to the third embodiment.
【図10】 実施の形態3におけるデータ更新方法を説
明するための他のフローチャートFIG. 10 is another flowchart for explaining the data updating method according to the third embodiment.
106 EEPROM301 不揮発性メモリ302 更新対象領域303 データ格納領域304 ワーク領域305 更新用データ書き込み手段306 状態フラグ設定手段307 更新再開決定手段106 EEPROM301 non-volatile memory302 Update target area303 data storage area304 work area305 Update data writing means306 Status flag setting means307 Resuming renewal decision means
フロントページの続き (72)発明者 中部 太志 東広島市鏡山3丁目10番18号株式会社松下 電器情報システム広島研究所内Fターム(参考) 5B018 GA04 HA03 HA40 KA12 MA24 NA06 QA05 QA15 5B035 AA11 BB09 CA11 CA29 CA31 5B082 DE06Continued front page (72) Inventor Taishi Nakabe 3-10-18 Kagamiyama, Higashihiroshima-shi Matsushita Co., Ltd. Electric Appliance Information System Hiroshima LaboratoryF term (reference) 5B018 GA04 HA03 HA40 KA12 MA24 NA06 QA05 QA15 5B035 AA11 BB09 CA11 CA29 CA31 5B082 DE06
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2002014150AJP2003216511A (en) | 2002-01-23 | 2002-01-23 | Nonvolatile memory device, data update method, data update program, and computer-readable recording medium on which the program is recorded |
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2002014150AJP2003216511A (en) | 2002-01-23 | 2002-01-23 | Nonvolatile memory device, data update method, data update program, and computer-readable recording medium on which the program is recorded |
| Publication Number | Publication Date |
|---|---|
| JP2003216511Atrue JP2003216511A (en) | 2003-07-31 |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2002014150APendingJP2003216511A (en) | 2002-01-23 | 2002-01-23 | Nonvolatile memory device, data update method, data update program, and computer-readable recording medium on which the program is recorded |
| Country | Link |
|---|---|
| JP (1) | JP2003216511A (en) |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2005524133A (en)* | 2002-04-16 | 2005-08-11 | アエスカ エス.ア. | How to change memory card data in a transaction |
| JP2005346566A (en)* | 2004-06-04 | 2005-12-15 | Matsushita Electric Ind Co Ltd | mobile phone |
| JP2006011818A (en)* | 2004-06-25 | 2006-01-12 | Toshiba Corp | Portable electronic device and method for controlling portable electronic device |
| JP2006276982A (en)* | 2005-03-28 | 2006-10-12 | Fujitsu Ltd | File management apparatus and file management method |
| JPWO2005041050A1 (en)* | 2003-10-27 | 2007-11-22 | 松下電器産業株式会社 | Recording medium, data processing apparatus, and data processing method |
| JP2008134945A (en)* | 2006-11-29 | 2008-06-12 | Dainippon Printing Co Ltd | Storage device, storage device program, and storage processing method |
| JP2009157756A (en)* | 2007-12-27 | 2009-07-16 | Toshiba Corp | Information processing apparatus and data recovery method |
| JP2009169747A (en)* | 2008-01-17 | 2009-07-30 | Toshiba Corp | Information processing apparatus and data recovery method |
| JP2009187079A (en)* | 2008-02-04 | 2009-08-20 | Toshiba Corp | Information processing apparatus and data recovery method |
| WO2010134300A1 (en)* | 2009-05-21 | 2010-11-25 | パナソニック株式会社 | Memory controller, nonvolatile storage device, accessing device, nonvolatile storage system, and method and program for writing data |
| JP2013003831A (en)* | 2011-06-16 | 2013-01-07 | Dainippon Printing Co Ltd | Ic chip, processing program for ic chip, and writing processing method in ic chip |
| CN102880561A (en)* | 2011-05-13 | 2013-01-16 | 株式会社东海理化电机制作所 | Flash memory device |
| JP2013092938A (en)* | 2011-10-26 | 2013-05-16 | Dainippon Printing Co Ltd | Ic chip, method of processing in the ic chip, processing program for the ic chip, and ic card and the like |
| JP2018120518A (en)* | 2017-01-27 | 2018-08-02 | 大日本印刷株式会社 | Electronic information storage medium, ic card, notification method and notification processing program |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2005524133A (en)* | 2002-04-16 | 2005-08-11 | アエスカ エス.ア. | How to change memory card data in a transaction |
| JP4731325B2 (en)* | 2003-10-27 | 2011-07-20 | パナソニック株式会社 | Recording medium, data processing apparatus, and data processing method |
| JPWO2005041050A1 (en)* | 2003-10-27 | 2007-11-22 | 松下電器産業株式会社 | Recording medium, data processing apparatus, and data processing method |
| JP2005346566A (en)* | 2004-06-04 | 2005-12-15 | Matsushita Electric Ind Co Ltd | mobile phone |
| JP2006011818A (en)* | 2004-06-25 | 2006-01-12 | Toshiba Corp | Portable electronic device and method for controlling portable electronic device |
| JP2006276982A (en)* | 2005-03-28 | 2006-10-12 | Fujitsu Ltd | File management apparatus and file management method |
| JP2008134945A (en)* | 2006-11-29 | 2008-06-12 | Dainippon Printing Co Ltd | Storage device, storage device program, and storage processing method |
| JP2009157756A (en)* | 2007-12-27 | 2009-07-16 | Toshiba Corp | Information processing apparatus and data recovery method |
| JP2009169747A (en)* | 2008-01-17 | 2009-07-30 | Toshiba Corp | Information processing apparatus and data recovery method |
| JP2009187079A (en)* | 2008-02-04 | 2009-08-20 | Toshiba Corp | Information processing apparatus and data recovery method |
| WO2010134300A1 (en)* | 2009-05-21 | 2010-11-25 | パナソニック株式会社 | Memory controller, nonvolatile storage device, accessing device, nonvolatile storage system, and method and program for writing data |
| US8688896B2 (en) | 2009-05-21 | 2014-04-01 | Panasonic Corporation | High speed writing mode in memory controller, nonvolatile storage device, accessing device, nonvolatile storage system, and method and program for writing data |
| CN102880561A (en)* | 2011-05-13 | 2013-01-16 | 株式会社东海理化电机制作所 | Flash memory device |
| US9465730B2 (en) | 2011-05-13 | 2016-10-11 | Kabushiki Kaisha Tokai Rika Denki Seisakusho | Flash memory device |
| JP2013003831A (en)* | 2011-06-16 | 2013-01-07 | Dainippon Printing Co Ltd | Ic chip, processing program for ic chip, and writing processing method in ic chip |
| JP2013092938A (en)* | 2011-10-26 | 2013-05-16 | Dainippon Printing Co Ltd | Ic chip, method of processing in the ic chip, processing program for the ic chip, and ic card and the like |
| JP2018120518A (en)* | 2017-01-27 | 2018-08-02 | 大日本印刷株式会社 | Electronic information storage medium, ic card, notification method and notification processing program |
| Publication | Publication Date | Title |
|---|---|---|
| JP4768237B2 (en) | Portable electronic device and method for controlling portable electronic device | |
| JP3709338B2 (en) | Mobile phone user setting information management method and user setting information management system | |
| JP2003216511A (en) | Nonvolatile memory device, data update method, data update program, and computer-readable recording medium on which the program is recorded | |
| JP4701618B2 (en) | Information processing apparatus, information processing method, and computer program | |
| KR100746198B1 (en) | Data storage device, data storage method, and recording medium thereof | |
| JP3376331B2 (en) | Storage method using flash memory and storage medium storing storage control program | |
| JP6233134B2 (en) | Electronic information storage medium, information processing method, and information processing program | |
| JP2000357216A (en) | IC card | |
| JP5341947B2 (en) | IC card, control method of IC card, and control method of portable electronic device | |
| JP4195822B2 (en) | IC card and IC card program | |
| JP2019049876A (en) | Electronic information storage medium, IC card, table management method using electronic information storage medium, and table management program | |
| WO2005026924A1 (en) | Data update system, data update device and external storage medium | |
| JP7322923B2 (en) | Secure element, transaction control method and device | |
| JP3863479B2 (en) | IC card | |
| JP2008305263A (en) | Nonvolatile semiconductor memory device and memory management method | |
| JP6915437B2 (en) | Update method and update program using electronic information storage medium, IC card, electronic information storage medium | |
| JP7068603B2 (en) | Update method and update program using electronic information storage medium, IC card, electronic information storage medium | |
| JP2017138763A (en) | Electronic information storage medium, data writing method, and data writing program | |
| JP2005025441A (en) | IC card application program update method | |
| JP5853590B2 (en) | IC chip, IC chip processing method, IC chip processing program, IC card, etc. | |
| JP2007206957A (en) | Ic card, information processing system, integrated circuit chip, and data processor | |
| JP5853559B2 (en) | IC chip, processing method in IC chip, IC chip processing program, and IC card | |
| JP6398656B2 (en) | IC card with display function and method for erasing or changing display data displayed on the display function | |
| CN117971116A (en) | Wear balancing method and device, storage control chip and SD card | |
| JPH08171621A (en) | IC card |