[go: up one dir, main page]

JP7501726B2 - Electronic clock, method, and program - Google Patents

Electronic clock, method, and program Download PDF

Info

Publication number
JP7501726B2
JP7501726B2 JP2023077016A JP2023077016A JP7501726B2 JP 7501726 B2 JP7501726 B2 JP 7501726B2 JP 2023077016 A JP2023077016 A JP 2023077016A JP 2023077016 A JP2023077016 A JP 2023077016A JP 7501726 B2 JP7501726 B2 JP 7501726B2
Authority
JP
Japan
Prior art keywords
area
cpu
0xff
address space
memory area
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.)
Active
Application number
JP2023077016A
Other languages
Japanese (ja)
Other versions
JP2023090881A (en
Inventor
晃洋 黒羽
佑樹 尾下
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
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
Priority claimed from JP2022000782A external-priority patent/JP7279824B2/en
Application filed by Casio Computer Co Ltd filed Critical Casio Computer Co Ltd
Priority to JP2023077016A priority Critical patent/JP7501726B2/en
Publication of JP2023090881A publication Critical patent/JP2023090881A/en
Application granted granted Critical
Publication of JP7501726B2 publication Critical patent/JP7501726B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Stored Programmes (AREA)

Description

本発明は、電子時計、方法、およびプログラムに関する。 The present invention relates to an electronic watch, a method , and a program .

近年、電子機器の発売後に不具合を修正させるため、または機能や性能を向上させるために、ユーザが電子機器のプログラムをアップデート可能なものが各種実用化されている。このような電子機器は、例えばインターネットに接続可能であり、ネットワーク経由でプログラムをアップデート(更新)する場合がある。 In recent years, various electronic devices have been put into practical use that allow users to update the programs of electronic devices in order to correct defects or improve functions and performance after the electronic devices are released. Such electronic devices can be connected to the Internet, for example, and programs can be updated via the network.

特許文献1には、制御ソフトウェアを更新する方法が開示されている。特許文献1の要約書には、「無線端末装置は自装置の運用に係る現用の制御ソフトウェアのバージョン情報を網側に接続するソフトウェア供給装置に通知し、ソフトウェア供給装置は通知されたバージョン情報を自己が蓄積管理する最新のバージョン情報と比較して更新の必要性有無を判定すると共に、更新が必要な場合は通知されたバージョンの改訂用に適合する新しい制御ソフトウェアを無線端末装置にダウンロードする。」と記載されている。 Patent document 1 discloses a method for updating control software. The abstract of patent document 1 states that "The wireless terminal device notifies a software supply device connected to the network side of version information of the current control software related to the operation of the device itself, and the software supply device compares the notified version information with the latest version information stored and managed by itself to determine whether an update is necessary, and if an update is necessary, downloads new control software that is compatible with the notified version revision to the wireless terminal device."

特開2001-078258号公報JP 2001-078258 A

電子時計では、ファームウェアの記憶領域を2つ持つことで、一方の記憶領域のファームウェアの書き換えを中断しても、他方の記憶領域のファームウェアから正常に起動可能となる。但し、このような機能を実現するためには、電子時計のプロセッサは、どちらの記憶領域が使用領域であるかを把握する必要がある。例えば、ファームウェアのヘッダ部分が書き換えられたのちに、電圧降下などにより時計LSI(Large-Scale Integration)がリセットされたならば、ヘッダ部分のバージョン情報を読み出すだけは、書き換えが成功したかどうかが判別できず、どちらの記憶領域が使用領域であるか把握できず、ひいては、記憶領域の消去を適切に実行することができない。 In an electronic watch, by having two firmware storage areas, even if the rewriting of the firmware in one storage area is interrupted, it is possible to normally start from the firmware in the other storage area. However, in order to realize such a function, the processor of the electronic watch needs to know which storage area is the area in use. For example, if the clock LSI (Large-Scale Integration) is reset due to a voltage drop or the like after the header part of the firmware is rewritten, it is not possible to determine whether the rewriting was successful or not just by reading the version information in the header part, and it is not possible to know which storage area is the area in use, and ultimately it is not possible to erase the storage area appropriately .

そこで、本発明は、記憶領域の消去を適切に実行する電子時計、方法、およびプログラムを提供することを課題とする。 SUMMARY OF THE PRESENT EMBODIMENTS An object of the present invention is to provide an electronic watch, method, and program that properly erases a memory area .

本発明は、上記目的を達成するため、
所定の時間間隔おきに所定の角度だけ回動する指針と、
被書き込み対象が書き込まれる2つの記憶領域を有する記憶部と、
制御部と、
を備える電子時計であって、
前記制御部は、
前記2つの記憶領域のうちの何れかの記憶領域を、被フォーマット領域、又は、次回に前記被書き込み対象が書き込まれる領域である書き込み領域であると判定し、
ユーザが時刻を確認していない可能性が高い時間帯に、前記電子時計が通常モードである場合に、判定した前記被フォーマット領域、又は、前記書き込み領域を消去する未使用領域消去処理を実行する、
ことを特徴とする電子時計である。
In order to achieve the above object, the present invention provides
A pointer that rotates by a predetermined angle at a predetermined time interval;
A storage unit having two storage areas into which objects to be written are written;
A control unit;
An electronic watch comprising:
The control unit is
determining that one of the two storage areas is a format area or a write area into which the write target will be written next time;
executing an unused area erasure process for erasing the determined formatted area or the write area when the electronic watch is in a normal mode during a time period when it is highly likely that the user is not checking the time;
The electronic watch is characterized by the above.

本実施形態における電子時計の概略を示す構成図である。1 is a diagram showing an outline of the configuration of an electronic timepiece according to an embodiment of the present invention; オールクリア後のGPS処理を示すフローチャートである。13 is a flowchart showing a GPS process after all-clear; 秒針の運針とGPSフラッシュ未使用領域決定処理とを示すタイミングチャートである。11 is a timing chart showing the movement of the second hand and the GPS flash unused area determination process. 第1の実施形態における記憶領域0,1の構成を示す図である。FIG. 2 is a diagram illustrating the configuration of memory areas 0 and 1 in the first embodiment. 領域の使用と未使用の決定処理を示すフローチャート(その1)である。11 is a flowchart (part 1) showing a process of determining whether an area is used or unused. 領域の使用と未使用の決定処理を示すフローチャート(その2)である。13 is a flowchart (part 2) showing a process for determining whether an area is used or unused. 未使用領域の消去処理を示すフローチャートである。13 is a flowchart showing an erasing process of an unused area. 消去済みの領域の書き換え処理を示すフローチャートである。13 is a flowchart showing a process of rewriting an erased area. 第2の実施形態における記憶領域0,1の構成を示す図である。FIG. 13 is a diagram illustrating the configuration of memory areas 0 and 1 in the second embodiment. 領域の使用と未使用の決定処理を示すフローチャート(その1)である。11 is a flowchart (part 1) showing a process of determining whether an area is used or unused. 領域の使用と未使用の決定処理を示すフローチャート(その2)である。13 is a flowchart (part 2) showing a process for determining whether an area is used or unused. 未使用領域の消去処理を示すフローチャートである。13 is a flowchart showing an erasing process of an unused area. 消去済みの領域の書き換え処理を示すフローチャートである。13 is a flowchart showing a process of rewriting an erased area. 第3の実施形態における記憶領域0,1の構成を示す図である。FIG. 13 is a diagram illustrating the configuration of memory areas 0 and 1 in the third embodiment. 消去済みの領域の書き換え処理を示すフローチャートである。13 is a flowchart showing a process of rewriting an erased area.

以降、本発明を実施するための形態を、各図を参照して詳細に説明する。
本実施形態の電子時計は、ファームウェアやデータを特定するバージョン情報を、ファームウェアやデータを書き込む記憶領域のフッタ部にコピーする。ファームウェアやデータのバージョン情報をフッタ部にコピーした場合、書き換えに失敗した場合を検知できる。
Hereinafter, embodiments of the present invention will be described in detail with reference to the accompanying drawings.
The electronic timepiece of this embodiment copies version information that identifies the firmware or data to the footer section of the storage area to which the firmware or data is written. If the version information of the firmware or data is copied to the footer section, it is possible to detect if the rewriting has failed.

更にファームウェアやデータのブロックサイズ情報をフッタ部に書き込んだ場合、消去すべきブロックサイズが明確になるので、消去時間と消去に伴う消費電力を削減することができる。 Furthermore, if firmware or data block size information is written to the footer, the block size to be erased becomes clear, making it possible to reduce the erasure time and power consumption associated with the erasure.

図1は、本実施形態における電子時計1の概略を示す構成図である。
電子時計1は、特には限られないが、例えば腕に装着するためのバンドを備えた腕時計型の電子時計である。この電子時計1は、時計LSIであるマイクロコンピュータ2、操作部31、表示部32、電源部33、電池34を含んで構成される。電子時計1は更に、通信部4とアンテナ41、GPS(Global Positioning System)部5とアンテナ51、フラッシュメモリ6、振動子7を含んで構成される。なお、図ではアンテナ41,51を“ANT”と記載している。
FIG. 1 is a schematic diagram showing the configuration of an electronic timepiece 1 according to this embodiment.
The electronic watch 1 is not particularly limited, but may be, for example, a wristwatch-type electronic watch equipped with a band for wearing on the arm. This electronic watch 1 comprises a microcomputer 2, which is a watch LSI, an operation unit 31, a display unit 32, a power supply unit 33, and a battery 34. The electronic watch 1 further comprises a communication unit 4 and an antenna 41, a GPS (Global Positioning System) unit 5 and an antenna 51, a flash memory 6, and a vibrator 7. In the drawings, the antennas 41 and 51 are written as "ANT".

操作部31は、例えばリュウズやボタンであり、ユーザの操作情報をマイクロコンピュータ2に伝達する。表示部32は、例えば文字盤と指針などであり、マイクロコンピュータ2の指示により現在時刻を含む各種情報を表示する。電池34と電源部33は、この電子時計1に電力を供給する。 The operation unit 31 is, for example, a crown or a button, and transmits user operation information to the microcomputer 2. The display unit 32 is, for example, a dial and hands, and displays various information including the current time according to instructions from the microcomputer 2. The battery 34 and power supply unit 33 supply power to the electronic watch 1.

電源部33は、例えば、電圧変換回路である。電源部33は、電子時計1内の各部の動作電圧で電力を供給する。電池34としては、例えば、ボタン型乾電池などの一次電池が用いられる。または電池34として、ソーラパネルと二次電池の組合せが用いられてもよい。 The power supply unit 33 is, for example, a voltage conversion circuit. The power supply unit 33 supplies power at the operating voltage of each part in the electronic watch 1. For example, a primary battery such as a button-type dry cell is used as the battery 34. Alternatively, a combination of a solar panel and a secondary battery may be used as the battery 34.

通信部4は、例えばBluetooth(登録商標) Low Energyに準拠した無線通信により、アンテナ41、を介して外部と通信する。これにより電子時計1は、新たなファームウェアを外部から受信する。 The communication unit 4 communicates with the outside world via the antenna 41, for example, by wireless communication compliant with Bluetooth (registered trademark) Low Energy. This allows the electronic watch 1 to receive new firmware from the outside world.

GPS部5は、GPS受信ICで構成されており、GPS衛星から送信される極超短波の衛星信号をアンテナ51によって受信し、現在位置や現在時刻を計測するものである。このGPS受信ICは、CPU(Central Processing Unit)52とRAM(Random Access Memory)53とを備える。CPU52は、後記するフラッシュメモリ6の記憶領域0(61)および記憶領域1(62)をRAM53に読み込んで実行する第1のプロセッサである。 The GPS section 5 is made up of a GPS receiving IC, and receives ultra-high frequency satellite signals transmitted from GPS satellites by means of an antenna 51, and measures the current position and the current time. This GPS receiving IC comprises a CPU (Central Processing Unit) 52 and a RAM (Random Access Memory) 53. The CPU 52 is a first processor that reads memory area 0 (61) and memory area 1 (62) of the flash memory 6 (described below) into the RAM 53 and executes them.

フラッシュメモリ6は、情報を読み出しおよび書き込み可能に記憶する不揮発性の半導体メモリである。このフラッシュメモリ6には、記憶領域0(61)および記憶領域1(62)を含んでいる。記憶領域0(61)および記憶領域1(62)は、CPU52がRAM53が読み込んで参照するためのデータが記憶される。 Flash memory 6 is a non-volatile semiconductor memory that stores information in a readable and writable manner. This flash memory 6 includes memory area 0 (61) and memory area 1 (62). Memory area 0 (61) and memory area 1 (62) store data that is read and referenced by the CPU 52 through the RAM 53.

フラッシュメモリ6の1回の消去単位は4Kbytesであり、これをブロックと呼ぶ。それ以上のサイズ消去するときには、4Kbytesのブロックの消去を繰り返す。フラッシュメモリ6の指定されたブロックを消去すると、そのブロックのデータは全て0xFFとなる。 The unit of data that can be erased from the flash memory 6 at one time is 4Kbytes, which is called a block. When erasing a larger size, erasing 4Kbyte blocks is repeated. When a specified block of the flash memory 6 is erased, all of the data in that block becomes 0xFF.

フラッシュメモリ6の消去済みのアドレス空間には、データを書き込むことができる。フラッシュメモリ6の1回の書き込み単位は256Bytesなので、それ以上のサイズのデータを書き込むときには、256Bytes単位の書き込みと読み込みと確認(ベリファイ)を繰り返すとよい。 Data can be written to the erased address space of the flash memory 6. The flash memory 6 writes data in units of 256 bytes at a time, so when writing data larger than this size, it is a good idea to repeatedly write, read, and verify in units of 256 bytes.

CPU21は、電子時計1を統括制御する第2のプロセッサである。CPU21の処理能力は、CPU52の処理能力よりも低い。またCPU21の動作保証電圧の下限は、CPU52の動作保証電圧の下限よりも低い。電源電圧の低下によりCPU52が動作しなくなった後でも、CPU21は動作することができる。 CPU 21 is a second processor that controls electronic watch 1. The processing power of CPU 21 is lower than that of CPU 52. The lower limit of the guaranteed operating voltage of CPU 21 is also lower than the lower limit of the guaranteed operating voltage of CPU 52. CPU 21 can continue to operate even after CPU 52 stops operating due to a drop in the power supply voltage.

振動子7は、例えば、水晶振動子であり、後記する発振回路25と組み合わされて固有の周波数信号を生成する。
マイクロコンピュータ2は、CPU21、RAM22を含んで構成される。マイクロコンピュータ2は更に、発振回路25、分周回路26、計時回路27を含んで構成され、外付けのROM(Read Only Memory)23に接続されている。
The oscillator 7 is, for example, a quartz oscillator, and generates a signal with a specific frequency in combination with an oscillation circuit 25 described later.
The microcomputer 2 includes a CPU 21 and a RAM 22. The microcomputer 2 further includes an oscillator circuit 25, a frequency divider circuit 26, and a timer circuit 27, and is connected to an external Read Only Memory (ROM) 23.

CPU21は、RAM22をワーク領域としてROM23やフラッシュメモリ6に記憶されたプログラムによる各種演算処理を行い、電子時計1の全体動作を統括制御するものである。RAM22は電源バックアップされているため、次回の起動時に参照する情報を好適に記憶できる。次回の起動時にCPU21が参照する情報は、RAM22に記憶される。このCPU21は、記憶領域0,1の特定アドレス空間にプログラムまたはデータとこのプログラムまたはこのデータを特定する特定情報とを書き込み、この記憶領域の特定アドレス空間とは異なるアドレス空間に特定情報を書き込む。 The CPU 21 uses the RAM 22 as a work area to carry out various calculation processes using programs stored in the ROM 23 and flash memory 6, and generally controls the overall operation of the electronic watch 1. The RAM 22 has a power backup, so it can conveniently store information to be referenced at the next startup. The information to be referenced by the CPU 21 at the next startup is stored in the RAM 22. The CPU 21 writes a program or data and specific information identifying this program or this data in a specific address space in memory areas 0 and 1, and writes the specific information in an address space different from the specific address space in this memory area.

発振回路25は、振動子7と組み合わされて固有の周波数信号を生成して分周回路26に出力する。発振回路25としては、例えば、水晶発振回路が用いられる。
分周回路26は、発振回路25から入力された信号をCPU21や計時回路27が利用する各種周波数の信号に分周して出力する。
The oscillator circuit 25 is combined with the vibrator 7 to generate a specific frequency signal and output it to the frequency divider circuit 26. As the oscillator circuit 25, for example, a crystal oscillator circuit is used.
The frequency divider circuit 26 divides the signal input from the oscillator circuit 25 into signals of various frequencies used by the CPU 21 and the timer circuit 27 and outputs the divided signals.

計時回路27は、分周回路26から入力された所定の周波数信号の回数を計数し、初期時刻に加算してゆくことで現在時刻を計数するカウンタ回路である。計時回路27により計数される現在時刻は、CPU21により読み出されて時刻表示に用いられる。この時刻の計数は、ソフトウェア的に制御されてもよい。また、振動子7、発振回路25、分周回路26、及び計時回路27により時刻を計数する計時部が構成されてもよい。 The timer circuit 27 is a counter circuit that counts the number of times a predetermined frequency signal is input from the divider circuit 26 and counts the current time by adding it to the initial time. The current time counted by the timer circuit 27 is read by the CPU 21 and used to display the time. This time counting may be controlled by software. Also, the vibrator 7, the oscillator circuit 25, the divider circuit 26, and the timer circuit 27 may form a timer unit that counts the time.

図2は、オールクリア後のGPS処理を示すフローチャートである。
ユーザが電子時計1をオールクリア(AC)したならば、この電子時計1のCPU21は、GPSフラッシュ未使用領域決定処理(図5・図6参照)を実行する(ステップS10)。オールクリアは、電池34が切れた場合や、プログラムが暴走した場合に行われる。
FIG. 2 is a flowchart showing the GPS processing after all-clear.
When the user performs an all-clear (AC) on the electronic watch 1, the CPU 21 of the electronic watch 1 executes the GPS flash unused area determination process (see FIGS. 5 and 6) (step S10). An all-clear is performed when the battery 34 runs out or the program goes out of control.

CPU21は、この未使用領域決定処理が成功したか否かを判定する(ステップS11)。処理に成功したと判定したならば(Yes)、CPU21は、ステップS14の処理に進む。処理に失敗したと判定したならば(No)、CPU21は、ステップS12の処理に進む。 The CPU 21 determines whether or not the unused area determination process was successful (step S11). If it is determined that the process was successful (Yes), the CPU 21 proceeds to the process of step S14. If it is determined that the process was unsuccessful (No), the CPU 21 proceeds to the process of step S12.

ステップS12において、CPU21は、現在のモードが通常モードであるか否かを判定する(ステップS12)。ここで通常モードとは、電子時計1が時刻を計時するモードのことをいう。CPU21は、現在のモードが通常モードではないと判定したならば(No)、この判定処理を繰り返す。CPU21は、現在のモードが通常モードであると判定したならば(Yes)、ステップS13の処理に進む。 In step S12, the CPU 21 determines whether the current mode is the normal mode (step S12). Here, normal mode refers to a mode in which the electronic watch 1 keeps time. If the CPU 21 determines that the current mode is not the normal mode (No), it repeats this determination process. If the CPU 21 determines that the current mode is the normal mode (Yes), it proceeds to the process of step S13.

ステップS13において、CPU21は、ホームタイム(HT)の秒が55秒であるか否かを判定する。CPU21は、ホームタイムの秒が55秒ではなかったならば(No)、ステップS12の処理に戻り、ホームタイムの秒が55秒であったならば(Yes)、ステップS10の処理に戻る。 In step S13, the CPU 21 determines whether the seconds of the home time (HT) are 55 seconds. If the seconds of the home time are not 55 seconds (No), the CPU 21 returns to the process of step S12, and if the seconds of the home time are 55 seconds (Yes), the CPU 21 returns to the process of step S10.

つまりCPU21は、現在のモードが通常モードではないか、またはホームタイムの秒が55秒でなかったならば(No)、ステップS12の処理に戻り、ステップS12,S13の判定を繰り返す。CPU21は、現在のモードが通常モードであり、かつホームタイムの秒が55秒であったならば(Yes)、ステップS10の処理に戻り、未使用領域決定処理を再び実行する。 In other words, if the current mode is not the normal mode or the home time seconds are not 55 seconds (No), the CPU 21 returns to the process of step S12 and repeats the judgments of steps S12 and S13. If the current mode is the normal mode and the home time seconds are 55 seconds (Yes), the CPU 21 returns to the process of step S10 and executes the unused area determination process again.

本実施形態では、ステップS12,S13の判定処理により、未使用領域決定処理が再び実行されるタイミングは、秒針が55秒を示していたときに限定される。つまり、未使用領域決定処理のタイミングと秒針の運針タイミングとをずらし、秒針の運針が止まっていると考えられる場合を狙って、未使用領域の消去を行っている。これにより、電子時計1は、ユーザに正確な時刻を表示できる。 In this embodiment, the timing for executing the unused area determination process again is limited to when the second hand indicates 55 seconds, as determined by the judgment processes in steps S12 and S13. In other words, the timing of the unused area determination process is shifted from the timing of the second hand movement, and the unused area is erased when it is considered that the second hand is not moving. This allows the electronic watch 1 to display the correct time to the user.

ステップS14において、CPU21は、現在のモードが通常モードであるか否かを判定する。CPU21は、現在のモードが通常モードではないと判定したならば(No)、ステップS17の処理に進む。CPU21は、現在のモードが通常モードであると判定したならば(Yes)、ステップS15の処理に進む。 In step S14, the CPU 21 determines whether the current mode is the normal mode. If the CPU 21 determines that the current mode is not the normal mode (No), the CPU 21 proceeds to the process of step S17. If the CPU 21 determines that the current mode is the normal mode (Yes), the CPU 21 proceeds to the process of step S15.

ステップS15において、CPU21は、ホームタイム(HT)の時刻が午前2時~5時であるか否かを判定する。この時刻を判別する理由は、この時間帯はユーザが時刻を確認していない可能性が高いからである。CPU21は、ホームタイム(HT)の時刻が午前2時~5時ならば(Yes)、更に分秒が30分50秒であるか否かを判定する(ステップS16)。CPU21は、ホームタイム(HT)の分秒が30分50秒ならば、ステップS19に進み、GPSフラッシュの未使用領域消去処理を実行する。ステップS16を判定する理由は、同時間帯に自動的に行われる標準電波受信等の処理と重なるのを避けるためである。ステップS16において、CPU21は、ホームタイム(HT)の分秒が30分50秒ではないならば、ステップS14の処理に戻る。 In step S15, the CPU 21 determines whether the time of the home time (HT) is between 2:00 and 5:00 a.m. The reason for determining this time is that it is highly likely that the user will not check the time during this time period. If the time of the home time (HT) is between 2:00 and 5:00 a.m. (Yes), the CPU 21 further determines whether the minutes and seconds are 30 minutes and 50 seconds (step S16). If the minutes and seconds of the home time (HT) are 30 minutes and 50 seconds, the CPU 21 proceeds to step S19 and executes the process of erasing unused areas of the GPS flash. The reason for determining step S16 is to avoid overlapping with the process of standard radio wave reception and the like that is automatically performed during the same time period. In step S16, if the minutes and seconds of the home time (HT) are not 30 minutes and 50 seconds, the CPU 21 returns to the process of step S14.

つまりCPU21は、ホームタイム(HT)の時刻が午前2時~5時ではないか、または分秒が30分50秒ではないならば、ステップS14の処理に戻る。CPU21は、ホームタイム(HT)の時刻が午前2時~5時であり、かつ分秒が30分50秒であったならば、GPSフラッシュの未使用領域消去処理を実行する(ステップS19)。 That is, if the home time (HT) is not between 2:00 and 5:00 a.m., or if the minutes and seconds are not 30 minutes and 50 seconds, the CPU 21 returns to the process of step S14. If the home time (HT) is between 2:00 and 5:00 a.m., and the minutes and seconds are 30 minutes and 50 seconds, the CPU 21 executes the process of erasing the unused area of the GPS flash (step S19).

またCPU21は、ステップS17において、現在のモードがストップウオッチモードであるか否かを判定する。CPU21は、現在のモードがストップウオッチモードではないと判定したならば(No)、ステップS14の処理に戻る。 The CPU 21 also determines in step S17 whether the current mode is the stopwatch mode. If the CPU 21 determines that the current mode is not the stopwatch mode (No), it returns to the processing of step S14.

更にCPU21は、現在のモードがストップウオッチモードであると判定したならば(Yes)、秒針停止から1分経過したか否かを判定する(ステップS18)。CPU21は、この判定条件が成立したならば、ステップS19に進み、GPSフラッシュの未使用領域消去処理(図7参照)を実行する。ステップS18を判定する理由は、秒針停止中の処理なら消去中の運針停止が目立たないためと、1分経過していれば、ユーザの操作がないものと想定されるためである。 If the CPU 21 determines that the current mode is the stopwatch mode (Yes), it further determines whether one minute has passed since the second hand stopped (step S18). If this determination condition is met, the CPU 21 proceeds to step S19 and executes the process of erasing unused areas of the GPS flash (see FIG. 7). The reason for determining step S18 is that if the process is performed while the second hand is stopped, the stoppage of the hand movement during erasure is not noticeable, and if one minute has passed, it is assumed that no user operation has been performed.

その後、ステップS20において、CPU21は、記憶領域の消去が成功したか否かを判定する。CPU21は、記憶領域の消去が成功したならば(Yes)、図2の処理を終了し、記憶領域の消去が失敗したならば(No)、ステップS14の処理に戻る。 Then, in step S20, the CPU 21 determines whether the erasure of the memory area was successful. If the erasure of the memory area was successful (Yes), the CPU 21 ends the process of FIG. 2, and if the erasure of the memory area was unsuccessful (No), the CPU 21 returns to the process of step S14.

電子時計1では、消去と書き換えとを連続して行うことは消費電流の関係から極めて困難である。消去中は、時計LSI(マイクロコンピュータ2)とGPSマイコン(CPU52)の通信中に運針タイミングが来てしまう可能性があるため、消去が完了まで運針を停止しており、ユーザに時刻を表示できなかった。 In the electronic watch 1, it is extremely difficult to perform erasing and rewriting consecutively due to the current consumption. During erasing, there is a possibility that the timing for moving the hands may occur during communication between the watch LSI (microcomputer 2) and the GPS microcomputer (CPU 52), so the hands are stopped until erasing is complete, and the time cannot be displayed to the user.

図2のGPS処理により、電子時計1は、深夜の時間帯や、秒針が止まって一定時間が経過した場合等の、秒針の運針が止まっていると考えられる場合を狙って未使用領域の消去を行う。そのため、電子時計1は、運針タイミングを避けて未使用領域を消去し、ユーザに正確な時刻を表示できる。 By using the GPS processing in Figure 2, the electronic watch 1 erases unused areas when it is believed that the second hand is not moving, such as late at night or when a certain amount of time has passed since the second hand stopped moving. Therefore, the electronic watch 1 erases unused areas while avoiding the timing of the second hand moving, and can display the correct time to the user.

図3は、秒針の運針とGPSフラッシュ未使用領域決定処理とを示すタイミングチャートである。 Figure 3 is a timing chart showing the movement of the second hand and the process of determining unused areas of the GPS flash.

図3の上側は、秒針の運針タイミングを示しており、秒の値が12の倍数のときに運針する。GPSフラッシュの未使用領域決定処理の開始タイミングは、55秒であり、平均の処理時間は3秒である。よって、未使用領域決定処理の実行と秒針の運針とが重複することはない。 The upper part of Figure 3 shows the timing of the second hand movement, which moves when the second value is a multiple of 12. The GPS flash unused area determination process starts at 55 seconds, and the average processing time is 3 seconds. Therefore, the execution of the unused area determination process and the movement of the second hand do not overlap.

《第1の実施形態》
図4は、第1の実施形態における記憶領域0,1の構成を示す図である。
記憶領域0には、参照データテーブルと地図データとが記憶されている。
First Embodiment
FIG. 4 is a diagram showing the configuration of storage areas 0 and 1 in the first embodiment.
In the memory area 0, a reference data table and map data are stored.

参照データテーブルは、アドレス空間0x100000~0x10FFFFのうち上位のアドレス空間0x100000~(0x100002+X1)に記憶されている。参照データテーブルは、ヘッダ部分の2バイトのバージョン情報と、それ以降のX1 Bytesの本体とで構成される。ここで、バージョン情報は、0x01,0x00である。バージョン情報は、消去済みであるか否かを判定するため、0xFF,0xFF以外の値が付与されている。CPU21は、このバージョン情報の値により参照データテーブルのバージョンを特定する。 The reference data table is stored in the upper address space 0x100000-(0x100002+X1) of the address space 0x100000-0x10FFFF. The reference data table is made up of 2 bytes of version information in the header and X1 bytes of the main body that follows. Here, the version information is 0x01, 0x00. A value other than 0xFF, 0xFF is assigned to the version information to determine whether it has been erased or not. The CPU 21 identifies the version of the reference data table from the value of this version information.

参照データテーブルの本体以降は、リザーブ領域(Reserved)であり、アドレス空間 (0x100003+X1)~0x10FFFFに記憶されている。リザーブ領域は全て0xFFである。このリザーブ領域により、バージョン間のサイズの相違を吸収可能である。 The area following the main body of the reference data table is a reserved area, which is stored in the address space from (0x100003+X1) to 0x10FFFF. The entire reserved area is 0xFF. This reserved area makes it possible to absorb size differences between versions.

地図データは、アドレス空間0x110000~0x1FFFFBのうち上位のアドレス空間0x110000~(0x110002+Y1)に記憶されている。地図データは、ヘッダ部分の2バイトのバージョン情報と、それ以降のY1 Bytesの本体とで構成される。ここで、バージョン情報は、0x03,0x00である。バージョン情報は、消去済みであるか否かを判定するため、0xFF,0xFF以外の値が付与されている。CPU21は、このバージョン情報の値により地図データのバージョンを特定する。 Map data is stored in the upper address space 0x110000-(0x110002+Y1) of the address space 0x110000-0x1FFFFB. Map data consists of 2 bytes of version information in the header, followed by Y1 bytes of the main body. Here, the version information is 0x03, 0x00. A value other than 0xFF, 0xFF is assigned to the version information to determine whether it has been erased or not. The CPU 21 identifies the version of the map data from the value of this version information.

地図データの本体以降は、リザーブ領域(Reserved)であり、アドレス空間 (0x110003+Y1)~0x1FFFFBに記憶されている。リザーブ領域は全て0xFFである。リザーブ領域により、バージョン間のサイズの相違を吸収可能である。
つまり参照データテーブルと地図データとが記憶される特定アドレス空間は、アドレス空間0x100000~0x1FFFFBである。
The area following the map data body is a reserved area, stored in the address space from (0x110003+Y1) to 0x1FFFFB. The reserved area is all 0xFF. The reserved area makes it possible to absorb size differences between versions.
That is, the specific address space in which the reference data table and map data are stored is the address space 0x100000 to 0x1FFFFB.

記憶領域0のアドレス空間0x1FFFFC~0x1FFFFDには、参照データテーブルのバージョン情報が記憶される。記憶領域0のアドレス空間0x1FFFFE~0x1FFFFFには、地図データのバージョン情報が記憶される。これらアドレス空間0x1FFFFC~0x1FFFFFは、記憶領域0のフッタであり、参照データテーブルや地図データを記憶する特定アドレス空間とは異なるアドレス空間である。 In the address space 0x1FFFFC to 0x1FFFFD of memory area 0, version information for reference data tables is stored. In the address space 0x1FFFFE to 0x1FFFFF of memory area 0, version information for map data is stored. This address space 0x1FFFFC to 0x1FFFFF is the footer of memory area 0, and is a different address space from the specific address spaces that store reference data tables and map data.

記憶領域1には、記憶領域0と同様に参照データテーブルと地図データとが記憶されており、フッタに参照データテーブルのバージョン情報と地図データのバージョン情報とがコピーされている。
参照データテーブルは、アドレス空間0x200000~0x20FFFFのうち上位のアドレス空間0x200000~(0x200002+X2)に記憶されている。参照データテーブルは、ヘッダ部分の2バイトのバージョン情報と、それ以降のX2 Bytesの本体とで構成される。ここで、バージョン情報は、0x02,0x00である。バージョン情報は、消去済みであるか否かを判定するため、0xFF,0xFF以外の値が付与されている。CPU21は、このバージョン情報の値により参照データテーブルのバージョンを特定する。
In the memory area 1, similar to the memory area 0, a reference data table and map data are stored, and the version information of the reference data table and the version information of the map data are copied to the footer.
The reference data table is stored in the upper address space 0x200000-(0x200002+X2) of the address space 0x200000-0x20FFFF. The reference data table is composed of 2 bytes of version information in the header and X2 bytes of the main body following that. Here, the version information is 0x02, 0x00. A value other than 0xFF, 0xFF is assigned to the version information to determine whether it has been erased or not. The CPU 21 identifies the version of the reference data table from the value of this version information.

参照データテーブルの本体以降は、リザーブ領域(Reserved)であり、アドレス空間 (0x200003+X1)~0x20FFFFに記憶されている。リザーブ領域は全て0xFFである。このリザーブ領域により、バージョン間のサイズの相違を吸収可能である。 The area following the main body of the reference data table is a reserved area, which is stored in the address space from (0x200003+X1) to 0x20FFFF. The entire reserved area is 0xFF. This reserved area makes it possible to absorb size differences between versions.

地図データは、アドレス空間0x210000~0x2FFFFBのうち上位のアドレス空間0x210000~(0x210002+Y2)に記憶されている。地図データは、ヘッダ部分の2バイトのバージョン情報と、それ以降のY2 Bytesの本体とで構成される。ここで、バージョン情報は、0x04,0x00である。バージョン情報は、消去済みであるか否かを判定するため、0xFF,0xFF以外の値が付与されている。CPU21は、このバージョン情報の値により地図データのバージョンを特定する。 Map data is stored in the upper address space 0x210000-(0x210002+Y2) of the address space 0x210000-0x2FFFFB. Map data consists of 2 bytes of version information in the header, followed by Y2 bytes of the main body. Here, the version information is 0x04, 0x00. A value other than 0xFF, 0xFF is assigned to the version information to determine whether it has been erased or not. The CPU 21 identifies the version of the map data from the value of this version information.

地図データの本体以降は、リザーブ領域(Reserved)であり、アドレス空間 (0x210003+Y2)~0x2FFFFBに記憶されている。リザーブ領域は全て0xFFである。リザーブ領域により、バージョン間のサイズの相違を吸収可能である。
つまり参照データテーブルと地図データとが記憶される特定アドレス空間は、アドレス空間0x200000~0x2FFFFBである。
The area following the map data body is a reserved area, stored in the address space from (0x210003+Y2) to 0x2FFFFB. The reserved area is all 0xFF. The reserved area makes it possible to absorb size differences between versions.
That is, the specific address space in which the reference data table and map data are stored is the address space 0x200000 to 0x2FFFFB.

記憶領域0のアドレス空間0x2FFFFC~0x2FFFFDには、参照データテーブルのバージョン情報が記憶される。記憶領域0のアドレス空間0x2FFFFE~0x2FFFFFには、地図データのバージョン情報が記憶される。これらアドレス空間0x2FFFFC~0x2FFFFFは、記憶領域0のフッタであり、参照データテーブルや地図データを記憶する特定アドレス空間とは異なるアドレス空間である。 In the address space 0x2FFFFC to 0x2FFFFD of memory area 0, version information for reference data tables is stored. In the address space 0x2FFFFE to 0x2FFFFF of memory area 0, version information for map data is stored. This address space 0x2FFFFC to 0x2FFFFF is the footer of memory area 0, and is a different address space from the specific address spaces that store reference data tables and map data.

第1の実施形態の電子時計1は、記憶領域0,1のうち最初に書き換えるヘッダ部分と最後に書き換えるフッタ部分に共通したバージョン情報を持っている。これらヘッダ部分とフッタ部分とは、256Bytes以上離れており書き込みブロックが異なるため、書き込みのタイミングが異なる。 The electronic watch 1 of the first embodiment has common version information in the header section, which is the first to be rewritten, and the footer section, which is the last to be rewritten, in memory areas 0 and 1. These header and footer sections are separated by 256 bytes or more and are in different write blocks, so the write timing is different.

書き換え途中で失敗してマイクロコンピュータ2にリセットが掛かった場合、ヘッダ部分とフッタ部分のバージョン情報が異なるため、書き換えの失敗を判断できる。消去途中で失敗してマイクロコンピュータ2にリセットが掛かった場合も同様にヘッダ部分とフッタ部分のバージョン情報が異なるため、消去の失敗を判断できる。 If a rewrite fails midway and the microcomputer 2 is reset, the version information in the header and footer parts will differ, making it possible to determine that the rewrite failed. Similarly, if an erase fails midway and the microcomputer 2 is reset, the version information in the header and footer parts will differ, making it possible to determine that the erase failed.

図5と図6は、記憶領域の使用と未使用の決定処理を示すフローチャートである。
CPU21は、記憶領域0の参照データテーブルのバージョン情報を読み出し(ステップS30)、バージョン情報が0xFF,0xFFであるか否かを判定する(ステップS31)。CPU21は、バージョン情報が0xFF,0xFFでないならば(No)、ステップS32の処理に進み、バージョン情報が0xFF,0xFFならば(Yes)、ステップS36の処理に進む。
5 and 6 are flow charts showing a process for determining whether a storage area is in use or unused.
The CPU 21 reads the version information of the reference data table in the memory area 0 (step S30), and judges whether the version information is 0xFF, 0xFF (step S31). If the version information is not 0xFF, 0xFF (No), the CPU 21 proceeds to the process of step S32, and if the version information is 0xFF, 0xFF (Yes), the CPU 21 proceeds to the process of step S36.

ステップS32において、CPU21は、記憶領域0の地図データのバージョン情報を読み出し、読み出したバージョン情報が0xFF,0xFFであるか否かを判定する(ステップS33)。CPU21は、バージョン情報が0xFF,0xFFでないならば(No)、ステップS34の処理に進み、バージョン情報が0xFF,0xFFならば(Yes)、ステップS36の処理に進む。ここで、ステップS36の処理に進む理由は、記憶領域0は書き換えに失敗していると判断できるためである。記憶領域1が有効であるか否かを判定しないことにより、消費電力を抑えることができる。 In step S32, the CPU 21 reads the version information of the map data in memory area 0, and determines whether the read version information is 0xFF, 0xFF (step S33). If the version information is not 0xFF, 0xFF (No), the CPU 21 proceeds to processing of step S34, and if the version information is 0xFF, 0xFF (Yes), the CPU 21 proceeds to processing of step S36. The reason for proceeding to processing of step S36 here is that it can be determined that rewriting of memory area 0 has failed. By not determining whether memory area 1 is valid, power consumption can be reduced.

つまりCPU21は、参照データテーブルのバージョン情報または地図データのバージョン情報のうちいずれかが0xFF,0xFFならば(Yes)、記憶領域0が未使用であると判定してステップS36の処理に進む。またCPU21は、両バージョン情報がいずれも0xFF,0xFFではなかったならば(No)、ステップS34の処理に進む。 In other words, if either the version information of the reference data table or the version information of the map data is 0xFF, 0xFF (Yes), the CPU 21 determines that memory area 0 is unused and proceeds to processing in step S36. If neither of the version information is 0xFF, 0xFF (No), the CPU 21 proceeds to processing in step S34.

ステップS34において、CPU21は、記憶領域0のフッタ部分に記憶されていた両バージョン情報を読み出す。CPU21は、読み出した両バージョン情報と、参照データテーブルおよび地図データのヘッダ部分に記憶されていた両バージョン情報とを比較する(ステップS35)。CPU21は、両バージョン情報が一致しなかったならば(No)、ステップS36の処理に進む。またCPU21は、両バージョン情報が一致したならば(Yes)、図6のステップS40の処理に進む。 In step S34, the CPU 21 reads both pieces of version information stored in the footer portion of memory area 0. The CPU 21 compares both pieces of version information that have been read with both pieces of version information stored in the header portion of the reference data table and the map data (step S35). If the two pieces of version information do not match (No), the CPU 21 proceeds to processing of step S36. If the two pieces of version information match (Yes), the CPU 21 proceeds to processing of step S40 in FIG. 6.

なお、記憶領域0のどこかで書き換えが失敗した場合、ヘッダのバージョン情報と、フッタのバージョン情報とが一致しなくなる。そのため、ヘッダのバージョン情報と、フッタのバージョン情報を比較することにより、書き換えが失敗したか否かを判断できる。 If the rewrite fails somewhere in memory area 0, the version information in the header and the version information in the footer will no longer match. Therefore, by comparing the version information in the header and the version information in the footer, it is possible to determine whether the rewrite has failed or not.

ステップS36において、CPU21は、記憶領域1のフッタのバージョン情報を読み出して、使用すべき地図データのバージョンを確定すると共に、記憶領域1の地図データを使用することを確定する(ステップS37)。これによりCPU21は、記憶領域1に地図データが正しく書き込まれていることを判定する。
例えばRAM22上の使用先を示す変数に記憶領域1の識別子を代入し、RAM22上のバージョン変数に、使用すべき地図データのバージョンを代入するとよい。これによりCPU52は、使用先を示す変数の識別子に基づき、記憶領域0,1のいずれかに書き込まれた地図データを読み出す。
In step S36, the CPU 21 reads the version information in the footer of the memory area 1 to determine the version of the map data to be used, and determines that the map data in the memory area 1 will be used (step S37). As a result, the CPU 21 determines that the map data has been correctly written in the memory area 1.
For example, the identifier of memory area 1 may be substituted for a variable indicating the destination of use on the RAM 22, and the version of the map data to be used may be substituted for a version variable on the RAM 22. In this way, the CPU 52 reads out the map data written in either memory area 0 or 1, based on the identifier of the variable indicating the destination of use.

更にCPU21は、記憶領域0の消去フラグをセットし(ステップS38)、GPS電源をオフすると(ステップS39)、この処理から図2の処理に戻る。消去フラグは、例えばRAM22に配置される。これにより、CPU21は、正しく書き込まれていない記憶領域を消去する。 The CPU 21 then sets the erase flag for memory area 0 (step S38), turns off the GPS power (step S39), and returns to the process in FIG. 2. The erase flag is placed in, for example, the RAM 22. This causes the CPU 21 to erase the memory area that has not been written to correctly.

図6のステップS40において、CPU21は、記憶領域1の参照データテーブルのバージョン情報を読み出し、バージョン情報が0xFF,0xFFであるか否かを判定する(ステップS41)。CPU21は、バージョン情報が0xFF,0xFFでないならば(No)、ステップS42の処理に進み、バージョン情報が0xFF,0xFFならば(Yes)、ステップS47の処理に進む。 In step S40 of FIG. 6, the CPU 21 reads the version information of the reference data table in memory area 1 and determines whether the version information is 0xFF, 0xFF (step S41). If the version information is not 0xFF, 0xFF (No), the CPU 21 proceeds to processing of step S42, and if the version information is 0xFF, 0xFF (Yes), the CPU 21 proceeds to processing of step S47.

ステップS42において、CPU21は、記憶領域1の地図データのバージョン情報を読み出し、読み出したバージョン情報が0xFF,0xFFであるか否かを判定する(ステップS43)。CPU21は、バージョン情報が0xFF,0xFFでないならば、ステップS44の処理に進み、バージョン情報が0xFF,0xFFならば(Yes)、ステップS47の処理に進む。 In step S42, the CPU 21 reads the version information of the map data in the memory area 1, and determines whether the read version information is 0xFF, 0xFF (step S43). If the version information is not 0xFF, 0xFF, the CPU 21 proceeds to processing in step S44, and if the version information is 0xFF, 0xFF (Yes), the CPU 21 proceeds to processing in step S47.

つまりCPU21は、参照データテーブルのバージョン情報または地図データのバージョン情報のうちいずれかが0xFF,0xFFならば(Yes)、記憶領域1が未使用であると判定してステップS47の処理に進む。またCPU21は、両バージョン情報がいずれも0xFF,0xFFではなかったならば(No)、ステップS44の処理に進む。 In other words, if either the version information of the reference data table or the version information of the map data is 0xFF, 0xFF (Yes), the CPU 21 determines that memory area 1 is unused and proceeds to processing in step S47. If neither version information is 0xFF, 0xFF (No), the CPU 21 proceeds to processing in step S44.

ステップS44において、CPU21は、記憶領域1のフッタ部分に記憶されていた両バージョン情報を読み出す。CPU21は、読み出した両バージョン情報と、参照データテーブルおよび地図データのヘッダ部分に記憶されていた両バージョン情報とを比較する(ステップS45)。CPU21は、両バージョン情報が一致しなかったならば(No)、ステップS47の処理に進む。またCPU21は、両バージョン情報が一致したならば(Yes)、ステップS46の処理に進む。このとき、記憶領域0と記憶領域1の両方に正しくデータが記憶されている。そのため、2つの記憶領域のバージョンを比較して、新しいバージョンが記憶されている方を使用する。 In step S44, the CPU 21 reads out both pieces of version information stored in the footer portion of memory area 1. The CPU 21 compares both pieces of version information that have been read out with both pieces of version information stored in the header portion of the reference data table and the map data (step S45). If the two pieces of version information do not match (No), the CPU 21 proceeds to processing of step S47. If the two pieces of version information match (Yes), the CPU 21 proceeds to processing of step S46. At this time, data is correctly stored in both memory area 0 and memory area 1. Therefore, the versions in the two memory areas are compared, and the one with the newer version stored is used.

ステップS46において、CPU21は、記憶領域0のバージョン情報と記憶領域1のバージョン情報とを比較して、記憶領域1のバージョン情報が最新であるか否かを判定する。CPU21は、記憶領域1のバージョン情報が最新ならば(Yes)、図5のステップS36の処理に進み、記憶領域1のバージョン情報が最新でないならば(No)、ステップS47の処理に進む。 In step S46, the CPU 21 compares the version information of memory area 0 with the version information of memory area 1 to determine whether the version information of memory area 1 is the latest. If the version information of memory area 1 is the latest (Yes), the CPU 21 proceeds to the processing of step S36 in FIG. 5, and if the version information of memory area 1 is not the latest (No), the CPU 21 proceeds to the processing of step S47.

ステップS47において、CPU21は、使用すべき地図データのバージョンを確定すると共に、記憶領域0の地図データを使用することを確定する。これによりCPU21は、記憶領域0に地図データが正しく書き込まれていることを判定する。
CPU21は、例えばRAM22上の使用先を示す変数に記憶領域0の識別子を代入し、RAM22上のバージョン変数に、使用すべき地図データのバージョンを代入するとよい。
In step S47, the CPU 21 determines the version of the map data to be used, and determines to use the map data in the memory area 0. In this way, the CPU 21 determines that the map data has been written correctly in the memory area 0.
For example, the CPU 21 may assign the identifier of the memory area 0 to a variable on the RAM 22 indicating the use destination, and assign the version of the map data to be used to a version variable on the RAM 22 .

更にCPU21は、記憶領域1の消去フラグをセットし(ステップS48)、GPS電源をオフすると(ステップS49)、この処理から図2の処理に戻る。 The CPU 21 then sets the erase flag in memory area 1 (step S48), turns off the GPS power (step S49), and returns to the process in FIG. 2.

図7は、未使用領域の消去処理を示すフローチャートである。
GPSフラッシュの未使用領域消去処理は、図2のステップS19で呼び出される。
FIG. 7 is a flowchart showing the process of erasing unused areas.
The unused area erasing process of the GPS flash is called in step S19 of FIG.

CPU21は、記憶領域0の消去フラグがセットされていれば(ステップS50→Yes)、記憶領域0を消去して(ステップS51)、この消去フラグをクリアする(ステップS52)。CPU21は、記憶領域0の消去フラグがセットされていなければ(ステップS50→No)、ステップS53の処理に進む。 If the erase flag for memory area 0 is set (step S50→Yes), the CPU 21 erases memory area 0 (step S51) and clears the erase flag (step S52). If the erase flag for memory area 0 is not set (step S50→No), the CPU 21 proceeds to the process of step S53.

CPU21は、記憶領域1の消去フラグがセットされていれば(ステップS53→Yes)、記憶領域1を消去して(ステップS54)、この消去フラグをクリアする(ステップS55)。これによりCPU21は、図7の処理を終了する。 If the erase flag for memory area 1 is set (step S53 → Yes), the CPU 21 erases memory area 1 (step S54) and clears the erase flag (step S55). This causes the CPU 21 to end the process of FIG. 7.

CPU21は、記憶領域1の消去フラグがセットされていなければ(ステップS53→No)、図7の処理を終了する。
CPU21がGPSフラッシュの未使用領域消去処理を実行することで、記憶領域0,1のうちいずれかが消去され、新たなデータやファームウェアで書き換え可能な状態となる。
If the erase flag for the memory area 1 is not set (step S53: No), the CPU 21 ends the process of FIG.
When the CPU 21 executes the unused area erasure process of the GPS flash, either memory area 0 or 1 is erased, and becomes available for rewriting with new data or firmware.

図8は、消去済みの領域の書き換え処理を示すフローチャートである。
この書き換え処理は、例えばユーザによる書き換え指示の操作によって実行される。
FIG. 8 is a flowchart showing the process of rewriting an erased area.
This rewriting process is executed, for example, by a user's operation to issue a rewriting instruction.

CPU21は、記憶領域1を使用しているか否かを判定し(ステップS60)、更に記憶領域0の消去フラグがクリアされているか否かを判定する(ステップS61)。
CPU21は、記憶領域1が使用されており(ステップS60→Yes)、かつ記憶領域0の消去フラグがクリアされていたならば(ステップS61→Yes)、記憶領域0に参照データテーブルと地図データを書き込む(ステップS62)。ここでCPU21は、ステップS62を実行することにより、記憶領域0の特定アドレス空間にデータを書き込む第1書込手段として機能する。
CPU21は更に、記憶領域0のフッタにバージョン情報を書き込み(ステップS63)、ステップS64の処理に進む。ここでCPU21は、ステップS63を実行することにより、記憶領域0の特定アドレス空間とは異なるアドレス空間に、データを特定する特定情報と同一の特定情報を書き込む第2書込手段として機能する。
The CPU 21 determines whether or not the memory area 1 is being used (step S60), and further determines whether or not the erase flag for the memory area 0 is cleared (step S61).
If memory area 1 is being used (step S60→Yes) and the erase flag for memory area 0 is cleared (step S61→Yes), the CPU 21 writes the reference data table and map data to memory area 0 (step S62). By executing step S62, the CPU 21 functions as a first writing unit that writes data to a specific address space in memory area 0.
The CPU 21 further writes version information to the footer of the memory area 0 (step S63), and proceeds to the process of step S64. Here, by executing step S63, the CPU 21 functions as a second writing unit that writes the same specific information as the specific information that identifies the data to an address space different from the specific address space of the memory area 0.

CPU21は、記憶領域1が使用されていないか(ステップS60→No)、または記憶領域0の消去フラグがクリアされていなかったならば(ステップS61→No)、ステップS64の処理に進む。 If memory area 1 is not in use (step S60 → No) or the erase flag for memory area 0 has not been cleared (step S61 → No), the CPU 21 proceeds to processing of step S64.

CPU21は、記憶領域0を使用しているか否かを判定し(ステップS64)、更に記憶領域1の消去フラグがクリアされているか否かを判定する(ステップS65)。
CPU21は、記憶領域0が使用されており(ステップS64→Yes)、かつ記憶領域1の消去フラグがクリアされていたならば(ステップS65→Yes)、記憶領域1に参照データテーブルと地図データを書き込む(ステップS66)。ここでCPU21は、ステップS66を実行することにより、記憶領域1の特定アドレス空間にデータを書き込む第1書込手段として機能する。
CPU21は更に、記憶領域1のフッタにバージョン情報を書き込み(ステップS67)、図8の処理を終了する。ここでCPU21は、ステップS67を実行することにより、記憶領域0の特定アドレス空間とは異なるアドレス空間に、データを特定する特定情報と同一の特定情報を書き込む第2書込手段として機能する。
The CPU 21 determines whether or not the memory area 0 is being used (step S64), and further determines whether or not the erase flag for the memory area 1 is cleared (step S65).
If memory area 0 is being used (step S64→Yes) and the erase flag for memory area 1 is cleared (step S65→Yes), the CPU 21 writes the reference data table and map data to memory area 1 (step S66). By executing step S66, the CPU 21 functions as a first writing unit that writes data to a specific address space in memory area 1.
The CPU 21 further writes the version information in the footer of the storage area 1 (step S67), and ends the process in Fig. 8. By executing step S67, the CPU 21 functions as a second writing unit that writes the same specific information as the specific information that identifies the data in an address space different from the specific address space of the storage area 0.

CPU21は、記憶領域0が使用されていないか(ステップS64→No)、または記憶領域1の消去フラグがクリアされていなかったならば(ステップS65→No)、図8の処理を終了する。 If memory area 0 is not in use (step S64 → No) or the erase flag for memory area 1 has not been cleared (step S65 → No), the CPU 21 ends the process of FIG. 8.

第1の実施形態の電子時計1のCPU21は、最初に書き換えるヘッダ部分と最後に書き換えるフッタ部分に共通したバージョン情報を書き込んでいる。書き換え途中に電圧降下などが発生してマイクロコンピュータ2がリセットされ、この書き換えが失敗した場合、ヘッダ部分のバージョン情報は、フッタ部分のバージョン情報と相違する。そのため、CPU21は、書き換えに失敗したことを判断可能である。 The CPU 21 of the electronic watch 1 of the first embodiment writes common version information to the header section, which is the first section to be rewritten, and the footer section, which is the last section to be rewritten. If a voltage drop or the like occurs during the rewrite and the microcomputer 2 is reset, causing the rewrite to fail, the version information in the header section will differ from the version information in the footer section. Therefore, the CPU 21 can determine that the rewrite has failed.

《変形例1》
本実施形態では図4に示したように、記憶領域0には、アドレス空間0x100000~0x100001とアドレス空間0x110000~0x110001に、それぞれバージョン情報を記憶している。更に両バージョン情報をアドレス空間0x1FFFFC~0x1FFFFDとアドレス空間0x1FFFFE~0x1FFFFFとにコピーしてある。
<<Variation 1>>
4, in this embodiment, version information is stored in the address space 0x100000-0x100001 and the address space 0x110000-0x110001 in the memory area 0. Furthermore, both pieces of version information are copied to the address space 0x1FFFFC-0x1FFFFD and the address space 0x1FFFFE-0x1FFFFF.

しかし、アドレス空間0x100000~0x100001に記憶されたバージョン情報のみを、対応するアドレス空間0x1FFFFE~0x1FFFFFにコピーしてもよい。このように、2面の記憶領域が複数のデータで構成される場合、代表データのバージョン情報をフッタにコピーしてもよい。
なお、記憶領域1も同様である。
However, only the version information stored in the address space 0x100000-0x100001 may be copied to the corresponding address space 0x1FFFFE-0x1FFFFF. In this way, when the storage areas on two sides are made up of multiple pieces of data, the version information of the representative data may be copied to the footer.
The same applies to memory area 1.

《変形例2》
記憶領域0のアドレス空間0x100000~0x100001に参照データテーブルのバージョン情報が記憶されているとき、参照データテーブルの領域のフッタに相当するアドレス空間0x10FFFE~0x10FFFFにこのバージョン情報をコピーしてもよい。
<<Variation 2>>
When version information of the reference data table is stored in the address space 0x100000-0x100001 of memory area 0, this version information may be copied to the address space 0x10FFFE-0x10FFFF, which corresponds to the footer of the reference data table area.

同様に記憶領域0のアドレス空間0x110000~0x110001に地図データのバージョン情報が記憶されているとき、地図データの領域のフッタに相当するアドレス空間0x1FFFFE~0x1FFFFFにこのバージョン情報をコピーしてもよい。 Similarly, when map data version information is stored in the address space 0x110000-0x110001 of memory area 0, this version information may be copied to the address space 0x1FFFFE-0x1FFFFF, which corresponds to the footer of the map data area.

このように、各データを記憶する各領域のフッタに、バージョン情報をコピーしてもよい。
なお、記憶領域1も同様である。
In this way, the version information may be copied to the footer of each area in which each data is stored.
The same applies to memory area 1.

《第1の実施形態の効果》
記憶領域のフッタにバージョン情報のコピーを記憶し、ヘッダ部分とフッタ部分のバージョン情報を比較することにより、書き換えが成功したか否かを判断できる。
Effects of the First Embodiment
A copy of the version information is stored in the footer of the storage area, and by comparing the version information in the header and footer, it is possible to determine whether the rewriting has been successful.

《第2の実施形態》
第1の実施形態の電子時計1は、各記憶領域のヘッダ部分にデータのバージョン情報と本体を書き込んだのち、各記憶領域のフッタ部分にバージョン情報をコピーしている。
Second Embodiment
The electronic watch 1 of the first embodiment writes the version information and main body of the data in the header section of each storage area, and then copies the version information to the footer section of each storage area.

これに対して第2の実施形態の電子時計1は、各記憶領域のフッタ部分に、データの容量情報を保存している。これにより、データが書き込まれている範囲をCPU21が判断でき、データが書き込まれている範囲のみを消去することで消去時間を短縮し消費電力を低減させることが可能である。これにより、時計に搭載されるボタン電池の寿命を延ばすことができる。 In contrast, the electronic watch 1 of the second embodiment stores data capacity information in the footer of each storage area. This allows the CPU 21 to determine the range in which data has been written, and by erasing only the range in which data has been written, it is possible to shorten the erasure time and reduce power consumption. This makes it possible to extend the life of the button battery installed in the watch.

図9は、第2の実施形態における記憶領域0,1の構成を示す図である。
記憶領域0には、参照データテーブルと地図データとが記憶されている。
FIG. 9 is a diagram showing the configuration of memory areas 0 and 1 in the second embodiment.
In the memory area 0, a reference data table and map data are stored.

参照データテーブルは、アドレス空間0x100000~0x10FFFFのうち上位のアドレス空間0x100000~(0x100002+X1)に記憶される。参照データテーブルは、ヘッダ部分の2バイトのバージョン情報と、それ以降のX1 Bytesの本体とで構成される。ここで、バージョン情報には、0x01,0x00の値が付与されている。バージョン情報は、消去済みであるか否かを判定するため、0xFF,0xFF以外の値が付与されている。 The reference data table is stored in the upper address space 0x100000-(0x100002+X1) of the address space 0x100000-0x10FFFF. The reference data table is made up of 2 bytes of version information in the header, followed by X1 bytes of main body data. Here, the version information is given values of 0x01 and 0x00. A value other than 0xFF and 0xFF is given to the version information to determine whether it has been erased or not.

参照データテーブルの本体以降は、リザーブ領域(Reserved)であり、アドレス空間 (0x100003+X1)~0x10FFFFに記憶されている。リザーブ領域は全て0xFFである。このリザーブ領域により、バージョン間のサイズの相違を吸収可能である。 The area following the main body of the reference data table is a reserved area, which is stored in the address space from (0x100003+X1) to 0x10FFFF. The entire reserved area is 0xFF. This reserved area makes it possible to absorb size differences between versions.

地図データは、アドレス空間0x110000~0x1FFFFBのうち上位のアドレス空間0x110000~(0x110002+Y1)に記憶されている。地図データは、ヘッダ部分の2バイトのバージョン情報と、それ以降のY1 Bytesの本体とで構成される。ここで、バージョン情報には、0x03,0x00の値が付与されている。バージョン情報は、消去済みであるか否かを判定するため、0xFF,0xFF以外の値が付与されている。 Map data is stored in the upper address space 0x110000-(0x110002+Y1) of the address space 0x110000-0x1FFFFB. Map data consists of 2 bytes of version information in the header, followed by Y1 bytes of the main body. Here, the version information is assigned values of 0x03 and 0x00. A value other than 0xFF and 0xFF is assigned to the version information to determine whether it has been erased or not.

地図データの本体以降は、リザーブ領域(Reserved)であり、アドレス空間 (0x110003+Y1)~0x1FFFFBに記憶されている。リザーブ領域は全て0xFFである。リザーブ領域により、バージョン間のサイズの相違を吸収可能である。
つまり参照データテーブルと地図データとが記憶される特定アドレス空間は、アドレス空間0x100000~0x1FFFFBである。
記憶領域0のフッタであるアドレス空間0x1FFFFC~0x1FFFFFには、地図データの容量情報である(0x010002+Y1)が記憶される。アドレス空間0x1FFFFC~0x1FFFFFは、記憶領域0のフッタであり、参照データテーブルや地図データを記憶する特定アドレス空間とは異なるアドレス空間である。
The area following the map data body is a reserved area, stored in the address space from (0x110003+Y1) to 0x1FFFFB. The reserved area is all 0xFF. The reserved area makes it possible to absorb size differences between versions.
That is, the specific address space in which the reference data table and map data are stored is the address space 0x100000 to 0x1FFFFB.
Map data capacity information (0x010002+Y1) is stored in the address space 0x1FFFFC to 0x1FFFFF, which is the footer of memory area 0. The address space 0x1FFFFC to 0x1FFFFF is the footer of memory area 0, and is an address space different from the specific address space that stores the reference data table and map data.

記憶領域1には、記憶領域0と同様に参照データテーブルと地図データとが記憶されており、フッタに地図データの容量情報が記憶される。
参照データテーブルは、アドレス空間0x200000~0x20FFFFのうち上位のアドレス空間0x200000~(0x200002+X2)に記憶されている。参照データテーブルは、ヘッダ部分の2バイトのバージョン情報と、それ以降のX2 Bytesの本体とで構成される。ここで、バージョン情報は、0x02,0x00である。バージョン情報は、消去済みであるか否かを判定するため、0xFF,0xFF以外の値が付与されている。CPU21は、このバージョン情報の値により参照データテーブルのバージョンを特定する。
In the memory area 1, similar to the memory area 0, a reference data table and map data are stored, and capacity information of the map data is stored in the footer.
The reference data table is stored in the upper address space 0x200000-(0x200002+X2) of the address space 0x200000-0x20FFFF. The reference data table is composed of 2 bytes of version information in the header and X2 bytes of the main body following that. Here, the version information is 0x02, 0x00. A value other than 0xFF, 0xFF is assigned to the version information to determine whether it has been erased or not. The CPU 21 identifies the version of the reference data table from the value of this version information.

参照データテーブルの本体以降は、リザーブ領域(Reserved)であり、アドレス空間 (0x200003+X1)~0x20FFFFに記憶されている。リザーブ領域は全て0xFFである。このリザーブ領域により、バージョン間のサイズの相違を吸収可能である。 The area following the main body of the reference data table is a reserved area, which is stored in the address space from (0x200003+X1) to 0x20FFFF. The entire reserved area is 0xFF. This reserved area makes it possible to absorb size differences between versions.

地図データは、アドレス空間0x210000~0x2FFFFBのうち上位のアドレス空間0x210000~(0x210002+Y2)に記憶されている。地図データは、ヘッダ部分の2バイトのバージョン情報と、それ以降のY2 Bytesの本体とで構成される。ここで、バージョン情報は、0x04,0x00である。バージョン情報は、消去済みであるか否かを判定するため、0xFF,0xFF以外の値が付与されている。CPU21は、このバージョン情報の値により地図データのバージョンを特定する。 Map data is stored in the upper address space 0x210000-(0x210002+Y2) of the address space 0x210000-0x2FFFFB. Map data consists of 2 bytes of version information in the header, followed by Y2 bytes of the main body. Here, the version information is 0x04, 0x00. A value other than 0xFF, 0xFF is assigned to the version information to determine whether it has been erased or not. The CPU 21 identifies the version of the map data from the value of this version information.

地図データの本体以降は、リザーブ領域(Reserved)であり、アドレス空間 (0x210003+Y2)~0x2FFFFBに記憶されている。リザーブ領域は全て0xFFである。リザーブ領域により、バージョン間のサイズの相違を吸収可能である。
つまり参照データテーブルと地図データとが記憶される特定アドレス空間は、アドレス空間0x200000~0x2FFFFBである。
The area following the map data body is a reserved area, stored in the address space from (0x210003+Y2) to 0x2FFFFB. The reserved area is all 0xFF. The reserved area makes it possible to absorb size differences between versions.
That is, the specific address space in which the reference data table and map data are stored is the address space 0x200000 to 0x2FFFFB.

記憶領域1のフッタであるアドレス空間0x2FFFFC~0x2FFFFFには、地図データの容量情報である(0x010002+Y2)が記憶される。アドレス空間0x1FFFFC~0x1FFFFFは、記憶領域1のフッタであり、参照データテーブルや地図データを記憶する特定アドレス空間とは異なるアドレス空間である。 The address space 0x2FFFFC to 0x2FFFFF, which is the footer of memory area 1, stores the map data capacity information (0x010002+Y2). The address space 0x1FFFFC to 0x1FFFFF is the footer of memory area 1, and is an address space that is different from the specific address space that stores the reference data table and map data.

記憶領域0,1においてフッタが最後に書き込まれるため、書き換え途中で失敗してマイクロコンピュータ2にリセットが掛かった場合、フッタ部分の容量情報が0xFF,0xFF,0xFF,0xFFとなるため、書き換えの失敗を判断できる。消去途中で失敗してマイクロコンピュータ2にリセットが掛かった場合、ヘッダ部分のパージョン情報が0xFF,0xFFになるため、消去の失敗を判断できる。 In memory areas 0 and 1, the footer is written last, so if a rewrite fails midway and the microcomputer 2 is reset, the capacity information in the footer will be 0xFF, 0xFF, 0xFF, 0xFF, so it is possible to determine that the rewrite has failed. If an erase fails midway and the microcomputer 2 is reset, the version information in the header will be 0xFF, 0xFF, so it is possible to determine that the erase has failed.

図10と図11は、記憶領域の利用と未使用の決定処理を示すフローチャートである。
CPU21は、記憶領域0の参照データテーブルのバージョン情報を読み出し(ステップS70)、バージョン情報が0xFF,0xFFであるか否かを判定する(ステップS71)。CPU21は、バージョン情報が0xFF,0xFFでないならば(No)、ステップS72の処理に進み、バージョン情報が0xFF,0xFFならば(Yes)、ステップS76の処理に進む。
10 and 11 are flow charts showing a process for determining whether a storage area is used or unused.
The CPU 21 reads the version information of the reference data table in the memory area 0 (step S70), and judges whether the version information is 0xFF, 0xFF (step S71). If the version information is not 0xFF, 0xFF (No), the CPU 21 proceeds to the process of step S72, and if the version information is 0xFF, 0xFF (Yes), the CPU 21 proceeds to the process of step S76.

ステップS72において、CPU21は、記憶領域0の地図データのバージョン情報を読み出し、読み出したバージョン情報が0xFF,0xFFであるか否かを判定する(ステップS73)。CPU21は、バージョン情報が0xFF,0xFFでないならば、ステップS74の処理に進み、バージョン情報が0xFF,0xFFならば(Yes)、ステップS76の処理に進む。ここで、ステップS76の処理に進む理由は、記憶領域0は書き換えに失敗していると判断できるためである。記憶領域1が有効であるか否かを判定しないことにより、消費電力を抑えることができる。 In step S72, the CPU 21 reads the version information of the map data in memory area 0, and determines whether the read version information is 0xFF, 0xFF (step S73). If the version information is not 0xFF, 0xFF, the CPU 21 proceeds to processing of step S74, and if the version information is 0xFF, 0xFF (Yes), the CPU 21 proceeds to processing of step S76. The reason for proceeding to processing of step S76 here is that it can be determined that rewriting of memory area 0 has failed. By not determining whether memory area 1 is valid, power consumption can be reduced.

つまりCPU21は、参照データテーブルのバージョン情報または地図データのバージョン情報のうちいずれかが0xFF,0xFFならば(Yes)、記憶領域0が未使用であると判定してステップS76の処理に進む。またCPU21は、両バージョン情報がいずれも0xFF,0xFFではなかったならば(No)、ステップS74の処理に進む。 In other words, if either the version information of the reference data table or the version information of the map data is 0xFF, 0xFF (Yes), the CPU 21 determines that memory area 0 is unused and proceeds to processing in step S76. If neither of the version information is 0xFF, 0xFF (No), the CPU 21 proceeds to processing in step S74.

ステップS76において、CPU21は、記憶領域0のフッタの地図容量情報を読み出し、ステップS77の処理に進む。 In step S76, the CPU 21 reads the map capacity information in the footer of memory area 0 and proceeds to processing in step S77.

ステップS74において、CPU21は、記憶領域0のフッタ部分に記憶されていた地図容量情報を読み出し、0xFF,0xFF,0xFF,0xFFと比較する(ステップS75)。CPU21は、地図容量情報が0xFF,0xFF,0xFF,0xFFと一致しなかったならば(No)、ステップS77の処理に進む。またCPU21は、地図容量情報が0xFF,0xFF,0xFF,0xFFと一致したならば(Yes)、図11のステップS82の処理に進む。 In step S74, the CPU 21 reads the map capacity information stored in the footer portion of memory area 0 and compares it with 0xFF, 0xFF, 0xFF, 0xFF (step S75). If the map capacity information does not match 0xFF, 0xFF, 0xFF, 0xFF (No), the CPU 21 proceeds to processing of step S77. If the map capacity information matches 0xFF, 0xFF, 0xFF, 0xFF (Yes), the CPU 21 proceeds to processing of step S82 in FIG. 11.

なお、記憶領域0のどこかで書き換えが失敗した場合、地図容量情報は書き込まれなくなり、消去直後の状態0xFF,0xFF,0xFF,0xFFとなる。そのため、地図容量情報と0xFF,0xFF,0xFF,0xFFとを比較することにより、書き換えが失敗したか否かを判断できる。 If the rewrite fails anywhere in memory area 0, the map capacity information will not be written and will be in the state it was in immediately after erasure: 0xFF, 0xFF, 0xFF, 0xFF. Therefore, by comparing the map capacity information with 0xFF, 0xFF, 0xFF, 0xFF, it is possible to determine whether the rewrite has failed or not.

ステップS77において、CPU21は、記憶領域1の参照データテーブルおよび地図データのバージョン情報を読み出す。CPU21は、記憶領域1のフッタの地図容量情報を読み出す(ステップS78)。CPU21は、記憶領域1の地図データを使用することを確定すると共に、使用すべき地図データのバージョンを確定する(ステップS79)。これによりCPU21は、記憶領域1に地図データが正しく書き込まれていることを判定する。
CPU21は、例えばRAM22上の使用先を示す変数に記憶領域1の識別子を代入し、RAM22上のバージョン変数に、使用すべき地図データのバージョンを代入するとよい。
In step S77, the CPU 21 reads the version information of the reference data table and map data in the memory area 1. The CPU 21 reads the map capacity information in the footer of the memory area 1 (step S78). The CPU 21 determines that the map data in the memory area 1 will be used, and determines the version of the map data to be used (step S79). This enables the CPU 21 to determine that the map data has been correctly written in the memory area 1.
The CPU 21 may, for example, assign the identifier of the storage area 1 to a variable on the RAM 22 indicating the use destination, and assign the version of the map data to be used to a version variable on the RAM 22 .

更にCPU21は、記憶領域0の消去フラグをセットし(ステップS80)、GPS電源をオフすると(ステップS81)、図2の処理に戻る。消去フラグは、例えばRAM22に配置される。 The CPU 21 then sets the deletion flag in memory area 0 (step S80), turns off the GPS power (step S81), and returns to the process in FIG. 2. The deletion flag is stored in, for example, the RAM 22.

図11のステップS82において、CPU21は、記憶領域1の参照データテーブルのバージョン情報を読み出し、バージョン情報が0xFF,0xFFであるか否かを判定する(ステップS83)。CPU21は、バージョン情報が0xFF,0xFFでないならば(No)、ステップS84の処理に進み、バージョン情報が0xFF,0xFFならば(Yes)、ステップS89の処理に進む。 In step S82 of FIG. 11, the CPU 21 reads the version information of the reference data table in memory area 1, and determines whether the version information is 0xFF, 0xFF (step S83). If the version information is not 0xFF, 0xFF (No), the CPU 21 proceeds to processing of step S84, and if the version information is 0xFF, 0xFF (Yes), the CPU 21 proceeds to processing of step S89.

ステップS84において、CPU21は、記憶領域1の地図データのバージョン情報を読み出し、読み出したバージョン情報が0xFF,0xFFであるか否かを判定する(ステップS85)。CPU21は、バージョン情報が0xFF,0xFFでないならば、ステップS86の処理に進み、バージョン情報が0xFF,0xFFならば(Yes)、ステップS89の処理に進む。 In step S84, the CPU 21 reads the version information of the map data in the memory area 1, and determines whether the read version information is 0xFF, 0xFF (step S85). If the version information is not 0xFF, 0xFF, the CPU 21 proceeds to processing in step S86, and if the version information is 0xFF, 0xFF (Yes), the CPU 21 proceeds to processing in step S89.

つまりCPU21は、参照データテーブルのバージョン情報または地図データのバージョン情報のうちいずれかが0xFF,0xFFならば(Yes)、記憶領域1が未使用であると判定してステップS89の処理に進む。またCPU21は、両バージョン情報がいずれも0xFF,0xFFではなかったならば(No)、ステップS86の処理に進む。 In other words, if either the version information of the reference data table or the version information of the map data is 0xFF, 0xFF (Yes), the CPU 21 determines that memory area 1 is unused and proceeds to processing in step S89. If neither version information is 0xFF, 0xFF (No), the CPU 21 proceeds to processing in step S86.

ステップS89において、CPU21は、記憶領域1のフッタ部分に記憶されていた地図容量情報を読み出し、ステップS90の処理に進む。 In step S89, the CPU 21 reads the map capacity information stored in the footer portion of memory area 1 and proceeds to processing in step S90.

ステップS86において、CPU21は、記憶領域1のフッタ部分に記憶されていた地図容量情報を読み出し、0xFF,0xFF,0xFF,0xFFと比較する(ステップS87)。CPU21は、地図容量情報が0xFF,0xFF,0xFF,0xFFと一致しなかったならば(No)、ステップS90の処理に進む。またCPU21は、地図容量情報が0xFF,0xFF,0xFF,0xFFと一致したならば(Yes)、ステップS88の処理に進む。このとき、記憶領域0と記憶領域1の両方に正しくデータが記憶されている。そのため、2つの記憶領域のバージョンを比較して、新しいバージョンが記憶されている方を使用する。 In step S86, the CPU 21 reads the map capacity information stored in the footer portion of memory area 1 and compares it with 0xFF, 0xFF, 0xFF, 0xFF (step S87). If the map capacity information does not match 0xFF, 0xFF, 0xFF, 0xFF (No), the CPU 21 proceeds to the process of step S90. If the map capacity information matches 0xFF, 0xFF, 0xFF, 0xFF (Yes), the CPU 21 proceeds to the process of step S88. At this time, data is correctly stored in both memory area 0 and memory area 1. Therefore, the versions of the two memory areas are compared and the one with the newer version stored is used.

ステップS88において、CPU21は、記憶領域0のバージョン情報と記憶領域1のバージョン情報とを比較し、記憶領域1のバージョン情報が最新であるか否かを判定する。CPU21は、記憶領域1のバージョン情報が最新ならば(Yes)、図10のステップS77の処理に進み、記憶領域1のバージョン情報が最新でないならば(No)、ステップS90の処理に進む。 In step S88, the CPU 21 compares the version information of memory area 0 with the version information of memory area 1, and determines whether the version information of memory area 1 is the latest. If the version information of memory area 1 is the latest (Yes), the CPU 21 proceeds to the processing of step S77 in FIG. 10, and if the version information of memory area 1 is not the latest (No), the CPU 21 proceeds to the processing of step S90.

ステップS90において、CPU21は、記憶領域0の地図データを使用することを確定し、かつ使用すべき地図データのバージョンを確定する。これによりCPU21は、記憶領域0に地図データが正しく書き込まれていることを判定する。
CPU21は、例えばRAM22上の使用先を示す変数に記憶領域0の識別子を代入し、RAM22上のバージョン変数に、使用すべき地図データのバージョンを代入するとよい。
In step S90, the CPU 21 determines that the map data in the memory area 0 will be used, and determines the version of the map data to be used. In this way, the CPU 21 determines that the map data has been correctly written in the memory area 0.
For example, the CPU 21 may assign the identifier of the memory area 0 to a variable on the RAM 22 indicating the use destination, and assign the version of the map data to be used to a version variable on the RAM 22 .

更にCPU21は、記憶領域1の消去フラグをセットし(ステップS91)、GPS電源をオフすると(ステップS92)、この処理から図2の処理に戻る。 The CPU 21 then sets the erase flag in memory area 1 (step S91), turns off the GPS power (step S92), and returns to the process in FIG. 2.

図12は、未使用領域の消去処理を示すフローチャートである。
GPSフラッシュの未使用領域消去処理は、図2のステップS19で呼び出される。
FIG. 12 is a flowchart showing the process of erasing an unused area.
The unused area erasing process of the GPS flash is called in step S19 of FIG.

CPU21は、記憶領域0の消去フラグがセットされていれば(ステップS100→Yes)、記憶領域0のフッタに記憶された地図容量を読み取り(ステップS101)、消去すべきブロックサイズを算出する。ここで消去すべきブロックサイズは、参照データテーブルのブロックサイズと、地図容量を1ブロックの容量で除算した値との和である。CPU21は、記憶領域0の先頭から所定ブロックを消去し(ステップS102)、記憶領域0のフッタのブロックを消去し(ステップS103)、この消去フラグをクリアする(ステップS104)。CPU21は、記憶領域0の消去フラグがセットされていなければ(ステップS100→No)、ステップS105の処理に進む。 If the erase flag for memory area 0 is set (step S100→Yes), the CPU 21 reads the map capacity stored in the footer of memory area 0 (step S101) and calculates the block size to be erased. The block size to be erased here is the sum of the block size of the reference data table and the map capacity divided by the capacity of one block. The CPU 21 erases a predetermined block from the beginning of memory area 0 (step S102), erases the block in the footer of memory area 0 (step S103), and clears the erase flag (step S104). If the erase flag for memory area 0 is not set (step S100→No), the CPU 21 proceeds to the process of step S105.

CPU21は、記憶領域1の消去フラグがセットされていれば(ステップS105→Yes)、記憶領域1のフッタに記憶された地図容量を読み取り(ステップS106)、消去すべきブロックサイズを算出する。ここで消去すべきブロックサイズは、参照データテーブルのブロックサイズと、地図容量を1ブロックの容量(4Kbytes)で除算した値との和である。CPU21は、記憶領域1の先頭から所定ブロックを消去し(ステップS107)、記憶領域1のフッタのブロックを消去し(ステップS108)、この消去フラグをクリアする(ステップS109)。これによりCPU21は、図12の処理を終了する。 If the erase flag for memory area 1 is set (step S105 → Yes), the CPU 21 reads the map capacity stored in the footer of memory area 1 (step S106) and calculates the block size to be erased. The block size to be erased here is the sum of the block size of the reference data table and the map capacity divided by the capacity of one block (4 Kbytes). The CPU 21 erases a predetermined block from the beginning of memory area 1 (step S107), erases the block in the footer of memory area 1 (step S108), and clears the erase flag (step S109). This causes the CPU 21 to end the processing of FIG. 12.

CPU21は、記憶領域1の消去フラグがセットされていなければ(ステップS105→No)、図12の処理を終了する。
CPU21がGPSフラッシュの未使用領域消去処理を実行することで、記憶領域0,1のうちいずれかが消去され、新たなデータやファームウェアで書き換え可能な状態となる。
If the erase flag for the memory area 1 is not set (step S105: No), the CPU 21 ends the process of FIG.
When the CPU 21 executes the unused area erasure process of the GPS flash, either memory area 0 or 1 is erased, and becomes available for rewriting with new data or firmware.

図13は、消去済みの領域の書き換え処理を示すフローチャートである。
この書き換え処理は、例えばユーザによる書き換え指示の操作によって実行される。
FIG. 13 is a flowchart showing the process of rewriting an erased area.
This rewriting process is executed, for example, by a user's operation to issue a rewriting instruction.

CPU21は、記憶領域1を使用しているか否かを判定し(ステップS120)、更に記憶領域0の消去フラグがクリアされているか否かを判定する(ステップS121)。
CPU21は、記憶領域1が使用されており(ステップS120→Yes)、かつ記憶領域0の消去フラグがクリアされていたならば(ステップS121→Yes)、記憶領域0に参照データテーブルと地図データを書き込む(ステップS122)。ここでCPU21は、ステップS122を実行することにより、記憶領域0の特定アドレス空間にデータを書き込む第1書込手段として機能する。
CPU21は更に、記憶領域0のフッタに地図容量情報を書き込み(ステップS123)、ステップS124の処理に進む。ここでCPU21は、ステップS123を実行することにより、記憶領域0の特定アドレス空間とは異なるアドレス空間にデータの容量を示す容量情報を書き込む第2書込手段として機能する。
The CPU 21 determines whether or not the memory area 1 is being used (step S120), and further determines whether or not the erase flag for the memory area 0 is cleared (step S121).
If memory area 1 is being used (step S120→Yes) and the erase flag for memory area 0 is cleared (step S121→Yes), the CPU 21 writes the reference data table and map data to memory area 0 (step S122). By executing step S122, the CPU 21 functions as a first writing unit that writes data to a specific address space in memory area 0.
The CPU 21 further writes map capacity information to the footer of the memory area 0 (step S123), and proceeds to the process of step S124. Here, by executing step S123, the CPU 21 functions as a second writing unit that writes capacity information indicating the capacity of data to an address space different from the specific address space of the memory area 0.

CPU21は、記憶領域1が使用されていないか(ステップS120→No)、または記憶領域0の消去フラグがクリアされていなかったならば(ステップS121→No)、ステップS124の処理に進む。 If memory area 1 is not in use (step S120 → No) or the erase flag for memory area 0 has not been cleared (step S121 → No), the CPU 21 proceeds to processing of step S124.

ステップS124においてCPU21は、記憶領域0を使用しているか否かを判定し、更に記憶領域1の消去フラグがクリアされているか否かを判定する(ステップS125)。
CPU21は、記憶領域0が使用されており(ステップS124→Yes)、かつ記憶領域1の消去フラグがクリアされていたならば(ステップS125→Yes)、記憶領域1に参照データテーブルと地図データを書き込む(ステップS126)。ここでCPU21は、ステップS126を実行することにより、記憶領域1の特定アドレス空間にデータを書き込む第1書込手段として機能する。
CPU21は更に、記憶領域1のフッタに地図容量情報を書き込み(ステップS127)、図13の処理を終了する。ここでCPU21は、ステップS127を実行することにより、記憶領域1の特定アドレス空間とは異なるアドレス空間にデータの容量を示す容量情報を書き込む第2書込手段として機能する。
In step S124, the CPU 21 determines whether or not the memory area 0 is being used, and further determines whether or not the erase flag for the memory area 1 is cleared (step S125).
If memory area 0 is being used (step S124→Yes) and the erase flag for memory area 1 is cleared (step S125→Yes), the CPU 21 writes the reference data table and map data to memory area 1 (step S126). By executing step S126, the CPU 21 functions as a first writing unit that writes data to a specific address space in memory area 1.
The CPU 21 further writes the map capacity information in the footer of the memory area 1 (step S127), and ends the processing in Fig. 13. Here, by executing step S127, the CPU 21 functions as a second writing unit that writes capacity information indicating the capacity of data in an address space different from the specific address space of the memory area 1.

CPU21は、記憶領域0が使用されていないか(ステップS124→No)、または記憶領域1の消去フラグがクリアされていなかったならば(ステップS125→No)、図13の処理を終了する。 If memory area 0 is not in use (step S124 → No) or the erase flag for memory area 1 has not been cleared (step S125 → No), the CPU 21 ends the processing of FIG. 13.

《第2の実施形態の効果》
記憶領域のフッタに0xFF,0xFF,…以外のデータを記憶し、フッタ部分に0xFF,0xFF,…以外のデータが記憶されているか確認することにより、書き換えが成功したか否かを判断できる。
Effects of the Second Embodiment
By storing data other than 0xFF, 0xFF, ... in the footer of the storage area and checking whether data other than 0xFF, 0xFF, ... is stored in the footer portion, it is possible to determine whether the rewrite was successful or not.

《第3の実施形態》
第3の実施形態の電子時計1は、各記憶領域のフッタ部分に電源電圧情報を保存している。
CPU21がフラッシュメモリの書き換えに失敗する主たる理由は、電池34の容量低下に伴い、電源電圧が降下して、CPU21が動作できなくなることである。よって、フラッシュメモリを書き換える際の電源電圧情報を記憶しておくことで、フラッシュメモリの書き換え失敗の要因を解析することができる。
Third Embodiment
The electronic watch 1 of the third embodiment stores power supply voltage information in the footer portion of each storage area.
The main reason why the CPU 21 fails to rewrite the flash memory is that the power supply voltage drops with a decrease in the capacity of the battery 34, making it impossible for the CPU 21 to operate. Therefore, by storing information about the power supply voltage when rewriting the flash memory, it is possible to analyze the cause of the failure to rewrite the flash memory.

図14は、第3の実施形態における記憶領域0,1の構成を示す図である。
記憶領域0には、参照データテーブルと地図データとが記憶されている。
FIG. 14 is a diagram showing the configuration of memory areas 0 and 1 in the third embodiment.
In the memory area 0, a reference data table and map data are stored.

参照データテーブルは、アドレス空間0x100000~0x10FFFFのうち上位のアドレス空間0x100000~(0x100002+X1)に記憶されている。参照データテーブルは、ヘッダ部分の2バイトのバージョン情報と、それ以降のX1 Bytesの本体とで構成される。ここで、バージョン情報には、0x01,0x00の値が付与されている。バージョン情報は、消去済みであるか否かを判定するため、0xFF,0xFF以外の値が付与されている。 The reference data table is stored in the upper address space 0x100000-(0x100002+X1) of the address space 0x100000-0x10FFFF. The reference data table is made up of 2 bytes of version information in the header, followed by X1 bytes of the main body. Here, the version information is given values of 0x01 and 0x00. A value other than 0xFF and 0xFF is given to the version information to determine whether it has been erased or not.

参照データテーブルの本体以降は、リザーブ領域(Reserved)であり、アドレス空間 (0x100003+X1)~0x10FFFFに記憶されている。リザーブ領域は全て0xFFである。このリザーブ領域により、バージョン間のサイズの相違を吸収可能である。 The area following the main body of the reference data table is a reserved area, which is stored in the address space from (0x100003+X1) to 0x10FFFF. The entire reserved area is 0xFF. This reserved area makes it possible to absorb size differences between versions.

地図データは、アドレス空間0x110000~0x1FFFF9のうち上位のアドレス空間0x110000~(0x110002+Y1)に記憶されている。地図データは、ヘッダ部分の2バイトのバージョン情報と、それ以降のY1 Bytesの本体とで構成される。ここで、バージョン情報には、0x03,0x00の値が付与されている。バージョン情報は、消去済みであるか否かを判定するため、0xFF,0xFF以外の値が付与されている。 Map data is stored in the upper address space 0x110000-(0x110002+Y1) of the address space 0x110000-0x1FFFF9. Map data consists of 2 bytes of version information in the header, followed by Y1 bytes of the main body. Here, the version information is assigned values of 0x03 and 0x00. A value other than 0xFF and 0xFF is assigned to the version information to determine whether it has been erased or not.

地図データの本体以降は、リザーブ領域(Reserved)であり、アドレス空間 (0x110003+Y1)~0x1FFFF9に記憶されている。リザーブ領域は全て0xFFである。リザーブ領域により、バージョン間のサイズの相違を吸収可能である。
つまり参照データテーブルと地図データとが記憶される特定アドレス空間は、アドレス空間0x100000~0x1FFFF9である。
記憶領域0のアドレス空間0x1FFFFA~0x1FFFFBには、書込前の電源電圧情報が記憶される。アドレス空間0x1FFFFC~0x1FFFFDには、参照データテーブルのバージョン情報が記憶される。記憶領域0のアドレス空間0x1FFFFE~0x1FFFFFには、地図データのバージョン情報が記憶される。これらアドレス空間0x1FFFFA~0x1FFFFFは、記憶領域0のフッタであり、参照データテーブルや地図データを記憶する特定アドレス空間とは異なるアドレス空間である。
The area following the map data body is a reserved area, stored in the address space from (0x110003+Y1) to 0x1FFFF9. The reserved area is all 0xFF. The reserved area makes it possible to absorb size differences between versions.
That is, the specific address space in which the reference data table and map data are stored is the address space 0x100000 to 0x1FFFF9.
The address space 0x1FFFFA to 0x1FFFFB of memory area 0 stores power supply voltage information before writing. The address space 0x1FFFFC to 0x1FFFFD stores version information of the reference data table. The address space 0x1FFFFE to 0x1FFFFF of memory area 0 stores version information of the map data. This address space 0x1FFFFA to 0x1FFFFF is the footer of memory area 0, and is a different address space from the specific address space that stores the reference data table and map data.

記憶領域1には、記憶領域0と同様に参照データテーブルと地図データとが記憶されている。
参照データテーブルは、アドレス空間0x200000~0x20FFFFのうち上位のアドレス空間0x200000~(0x200002+X2)に記憶されている。参照データテーブルは、ヘッダ部分の2バイトのバージョン情報と、それ以降のX2 Bytesの本体とで構成される。ここで、バージョン情報は、0x02,0x00である。バージョン情報は、消去済みであるか否かを判定するため、0xFF,0xFF以外の値が付与されている。CPU21は、このバージョン情報の値により参照データテーブルのバージョンを特定する。
In the memory area 1, similar to the memory area 0, a reference data table and map data are stored.
The reference data table is stored in the upper address space 0x200000-(0x200002+X2) of the address space 0x200000-0x20FFFF. The reference data table is composed of 2 bytes of version information in the header and X2 bytes of the main body following that. Here, the version information is 0x02, 0x00. A value other than 0xFF, 0xFF is assigned to the version information to determine whether it has been erased or not. The CPU 21 identifies the version of the reference data table from the value of this version information.

参照データテーブルの本体以降は、リザーブ領域(Reserved)であり、アドレス空間 (0x200003+X1)~0x20FFFFに記憶されている。リザーブ領域は全て0xFFである。このリザーブ領域により、バージョン間のサイズの相違を吸収可能である。 The area following the main body of the reference data table is a reserved area, which is stored in the address space from (0x200003+X1) to 0x20FFFF. The entire reserved area is 0xFF. This reserved area makes it possible to absorb size differences between versions.

地図データは、アドレス空間0x210000~0x2FFFF9のうち上位のアドレス空間0x210000~(0x210002+Y2)に記憶されている。地図データは、ヘッダ部分の2バイトのバージョン情報と、それ以降のY2 Bytesの本体とで構成される。ここで、バージョン情報は、0x04,0x00である。バージョン情報は、消去済みであるか否かを判定するため、0xFF,0xFF以外の値が付与されている。CPU21は、このバージョン情報の値により地図データのバージョンを特定する。 Map data is stored in the upper address space 0x210000-(0x210002+Y2) of the address space 0x210000-0x2FFFF9. Map data consists of 2 bytes of version information in the header, followed by Y2 bytes of the main body. Here, the version information is 0x04, 0x00. A value other than 0xFF, 0xFF is assigned to the version information to determine whether it has been erased or not. The CPU 21 identifies the version of the map data from the value of this version information.

地図データの本体以降は、リザーブ領域(Reserved)であり、アドレス空間 (0x210003+Y2)~0x2FFFF9に記憶されている。リザーブ領域は全て0xFFである。リザーブ領域により、バージョン間のサイズの相違を吸収可能である。
つまり参照データテーブルと地図データとが記憶される特定アドレス空間は、アドレス空間0x200000~0x2FFFF9である。
The area following the map data body is a reserved area, stored in the address space from (0x210003+Y2) to 0x2FFFF9. The reserved area is all 0xFF. The reserved area makes it possible to absorb size differences between versions.
That is, the specific address space in which the reference data table and map data are stored is the address space 0x200000 to 0x2FFFF9.

記憶領域1のアドレス空間0x2FFFFA~0x2FFFFBには、書込前の電源電圧情報が記憶される。アドレス空間0x2FFFFC~0x2FFFFDには、参照データテーブルのバージョン情報が記憶される。記憶領域1のアドレス空間0x2FFFFE~0x2FFFFFには、地図データのバージョン情報が記憶される。これらアドレス空間0x2FFFFA~0x2FFFFFは、記憶領域1のフッタであり、参照データテーブルや地図データを記憶する特定アドレス空間とは異なるアドレス空間である。 The address space 0x2FFFFA to 0x2FFFFB of memory area 1 stores the power supply voltage information before writing. The address space 0x2FFFFC to 0x2FFFFD stores version information of the reference data table. The address space 0x2FFFFE to 0x2FFFFF of memory area 1 stores version information of the map data. This address space 0x2FFFFA to 0x2FFFFF is the footer of memory area 1, and is a different address space from the specific address spaces that store the reference data table and map data.

図15は、消去済みの領域の書き換え処理を示すフローチャートである。
この書き換え処理は、例えばユーザによる書き換え指示の操作によって実行される。
FIG. 15 is a flowchart showing the process of rewriting an erased area.
This rewriting process is executed, for example, by a user's operation to issue a rewriting instruction.

CPU21は、記憶領域1を使用しているか否かを判定し(ステップS130)、更に記憶領域0の消去フラグがクリアされているか否かを判定する(ステップS131)。
CPU21は、記憶領域1が使用されており(ステップS130→Yes)、かつ記憶領域0の消去フラグがクリアされていたならば(ステップS131→Yes)、記憶領域0のフッタに電圧センサ211で検知した電源電圧情報を書き込む(ステップS132)。CPU21は更に、記憶領域0に参照データテーブルと地図データを書き込み(ステップS133)、フッタにバージョン情報を追記し(ステップS134)、ステップS135の処理に進む。
The CPU 21 determines whether or not the memory area 1 is being used (step S130), and further determines whether or not the erase flag for the memory area 0 is cleared (step S131).
If memory area 1 is being used (step S130→Yes) and the erase flag for memory area 0 has been cleared (step S131→Yes), the CPU 21 writes power supply voltage information detected by the voltage sensor 211 to the footer of memory area 0 (step S132). The CPU 21 further writes a reference data table and map data to memory area 0 (step S133), adds version information to the footer (step S134), and proceeds to the process of step S135.

CPU21は、記憶領域1が使用されていないか(ステップS130→No)、または記憶領域0の消去フラグがクリアされていなかったならば(ステップS131→No)、ステップS135の処理に進む。 If memory area 1 is not in use (step S130 → No) or the erase flag for memory area 0 has not been cleared (step S131 → No), the CPU 21 proceeds to processing of step S135.

ステップS135において、CPU21は、記憶領域0を使用しているか否かを判定し、更に記憶領域1の消去フラグがクリアされているか否かを判定する(ステップS136)。
CPU21は、記憶領域0が使用されており(ステップS135→Yes)、かつ記憶領域1の消去フラグがクリアされていたならば(ステップS136→Yes)、記憶領域1のフッタに電圧センサ211で検知した電源電圧情報を書き込む(ステップS137)。CPU21は更に、記憶領域1に参照データテーブルと地図データを書き込み(ステップS138)、フッタにバージョン情報を追記し(ステップS139)、図15の処理を終了する。
In step S135, the CPU 21 determines whether or not the memory area 0 is being used, and further determines whether or not the erasure flag for the memory area 1 is cleared (step S136).
If memory area 0 is being used (step S135→Yes) and the deletion flag of memory area 1 has been cleared (step S136→Yes), the CPU 21 writes the power supply voltage information detected by the voltage sensor 211 to the footer of memory area 1 (step S137). The CPU 21 further writes the reference data table and map data to memory area 1 (step S138), adds version information to the footer (step S139), and ends the processing of FIG.

CPU21は、記憶領域0が使用されていないか(ステップS135→No)、または記憶領域1の消去フラグがクリアされていなかったならば(ステップS136→No)、図15の処理を終了する。 If memory area 0 is not in use (step S135 → No) or the erase flag for memory area 1 has not been cleared (step S136 → No), the CPU 21 ends the processing of FIG. 15.

(変形例)
本発明は、上記実施形態に限定されることなく、本発明の趣旨を逸脱しない範囲で、変更実施が可能であり、例えば、次の(a)~(h)のようなものがある。
(Modification)
The present invention is not limited to the above-described embodiment, and modifications can be made without departing from the spirit of the present invention. For example, the following modifications are possible:

(a) 記憶領域に書き込まれる情報は、参照データテーブルや地図データに限定されず、GPS部5のCPU52が読み込んで参照するためのデータや、GPS部5のCPU52が読み込んで実行するためのファームウェア(プログラム)であってもよい。 (a) The information written to the memory area is not limited to reference data tables and map data, but may be data to be read and referenced by the CPU 52 of the GPS unit 5, or firmware (programs) to be read and executed by the CPU 52 of the GPS unit 5.

(b) 記憶領域のフッタに記憶される情報は、バージョン情報のコピーに限定されない。例えばデータ本体のチェックサム値やCRC(Cyclic Redundancy Check)値など、データ本体を識別可能な他の情報が記憶されてもよい。
(c) バージョン情報は、必ずしも記憶領域の先頭に記憶されていなくてもよく、最初の書き込み動作で書き込まれるメモリ空間に記憶されていればよい。例えば、記憶領域のうち所定のオフセット(0x000080など)で示されるアドレス空間に記憶されていてもよい。
(b) The information stored in the footer of the storage area is not limited to a copy of the version information. For example, other information capable of identifying the data body, such as a checksum value or a CRC (Cyclic Redundancy Check) value of the data body, may be stored.
(c) The version information does not necessarily have to be stored at the beginning of the storage area, but may be stored in a memory space to which the version information is written in the first write operation. For example, the version information may be stored in an address space indicated by a predetermined offset (e.g., 0x000080) in the storage area.

(d) 記憶領域にデータやソフトウェアプログラムを書き込んだのち、記憶領域のフッタに書き込み日時や、データやソフトウェアプログラムの入手先などのアップデートに係る情報を書き込んでもよい。これにより、不具合が発生した場合に、アップデートに係る情報を特定可能である。
(e) 記憶領域のフッタのサイズは、フラッシュメモリの消去単位以下であればよく、限定されない。
(f) フラッシュメモリに書き込まれる情報は、CPU52が参照するデータやCPU52が実行するファームウェア(プログラム)に限定されない。CPU21が参照するデータやCPU21が実行するファームウェア(プログラム)であってもよい。
(g) 記憶領域の使用と未使用の決定処理を実行する主体は、CPU21に限られず、CPU52が実行してもよい。
(h) CPU21が読み込んで実行するためのプログラムまたはCPU21が読み込んで参照するためのデータを、CPU21自身がフラッシュメモリに書き込んでもよい。
(d) After writing data or software programs to the storage area, information related to the update, such as the writing date and time and the source of the data or software programs, may be written to the footer of the storage area. This makes it possible to identify the information related to the update in the event of a malfunction.
(e) The size of the footer of the storage area is not limited as long as it is equal to or smaller than the erase unit of the flash memory.
(f) Information written to the flash memory is not limited to data referenced by the CPU 52 or firmware (programs) executed by the CPU 52. It may be data referenced by the CPU 21 or firmware (programs) executed by the CPU 21.
(g) The entity that executes the process of determining whether a storage area is in use or unused is not limited to the CPU 21, and may be the CPU 52.
(h) Programs that the CPU 21 reads and executes, or data that the CPU 21 reads and references, may be written into the flash memory by the CPU 21 itself.

以下に、この出願の願書に最初に添付した特許請求の範囲に記載した発明を付記する。付記に記載した請求項の項番は、この出願の願書に最初に添付した特許請求の範囲の通りである。
〔付記〕
The inventions described in the claims originally attached to this application are set forth below. The claim numbers in the appended claims are the same as those in the claims originally attached to this application.
[Additional Notes]

《請求項1》
プログラムまたはデータを記憶する記憶領域を有するメモリと、
前記記憶領域の特定アドレス空間に前記プログラムまたは前記データと当該プログラムまたは当該データを特定する特定情報とを書き込み、当該記憶領域の前記特定アドレス空間とは異なるアドレス空間に当該特定情報を書き込むプロセッサと、
を備えることを特徴とするデータ管理装置。
《請求項2》
前記メモリは、前記プログラムまたは前記データを記憶する記憶領域を複数含んでおり、
前記プロセッサは、各前記記憶領域の特定アドレス空間の前記プログラムまたは前記データに含まれる特定情報と各前記記憶領域の前記異なるアドレス空間に含まれる特定情報とを照合して、前記データまたは前記プログラムが正しく書き込まれているか否かを判定すると共に、正しく書き込まれていない記憶領域を消去する、
ことを特徴とする請求項1に記載のデータ管理装置。
《請求項3》
前記メモリは、前記プログラムまたは前記データを記憶する記憶領域を複数含んでおり、
前記プロセッサは、各前記記憶領域の前記特定アドレス空間の前記プログラムまたは前記データに含まれる特定情報と各前記記憶領域の前記異なるアドレス空間の特定情報とを照合して、前記データまたは前記プログラムが正しく書き込まれているか否かを判定すると共に、正しく書き込まれている記憶領域に記憶されたプログラムまたはデータを使用する、
ことを特徴とする請求項1又は2に記載のデータ管理装置。
《請求項4》
プログラムまたはデータを記憶する記憶領域を有するメモリと、
前記記憶領域の特定アドレス空間に新たなプログラムまたはデータを書き込み、当該プログラムまたは当該データの容量を示す容量情報を当該記憶領域の前記特定アドレス空間とは異なるアドレス空間に書き込むプロセッサと、
を備えることを特徴とするデータ管理装置。
《請求項5》
前記プロセッサは、前記記憶領域の前記異なるアドレス空間に記憶された前記容量情報に基づき、当該記憶領域を消去する、
ことを特徴とする請求項4に記載のデータ管理装置。
《請求項6》
第1のプロセッサと、
前記第1のプロセッサが読み込んで実行するためのプログラムまたは前記第1のプロセッサが読み込んで参照するためのデータを記憶する記憶領域を有するメモリと、
前記記憶領域の特定アドレス空間に前記プログラムまたは前記データを書き込み、当該プログラムまたは当該データを特定する特定情報を当該記憶領域の前記特定アドレス空間とは異なるアドレス空間に書き込む第2のプロセッサと、
を備えることを特徴とするデータ管理装置。
《請求項7》
前記メモリは、前記プログラムまたは前記データを記憶する記憶領域を複数含んでおり、
前記第2のプロセッサは、各前記記憶領域の前記特定アドレス空間の前記プログラムまたは前記データに含まれる特定情報と各前記記憶領域の前記異なるアドレス空間の特定情報とを照合して、前記データまたは前記プログラムが正しく書き込まれているか否かを判定すると共に、正しく書き込まれている記憶領域に記憶されたプログラムまたはデータを前記第1のプロセッサに使用させる、
ことを特徴とする請求項6に記載のデータ管理装置。
《請求項8》
前記メモリは、前記プログラムまたは前記データを記憶する記憶領域を複数含んでおり、
前記第1のプロセッサは、各前記記憶領域の前記特定アドレス空間の前記プログラムまたは前記データに含まれる特定情報と各前記記憶領域の前記異なるアドレス空間の特定情報とを照合して、前記データまたは前記プログラムが正しく書き込まれているか否かを判定すると共に、正しく書き込まれている記憶領域に記憶されたプログラムまたはデータを読み込む、
ことを特徴とする請求項6に記載のデータ管理装置。
《請求項9》
電源を供給する電池と、
前記電源の電圧を検知する電圧センサと、を備え、
前記第2のプロセッサは、前記プログラムまたは前記データを特定する特定情報と共に、前記電圧センサで検知した電源電圧情報を前記記憶領域の前記異なるアドレス空間に書き込む、
ことを特徴とする請求項6ないし8のうちいずれか1項に記載のデータ管理装置。
《請求項10》
第1のプロセッサと、
前記第1のプロセッサが読み込んで実行するためのプログラムまたは前記第1のプロセッサが読み込んで参照するためのデータを記憶する記憶領域を有するメモリと、
前記記憶領域の特定アドレス空間に新たなプログラムまたはデータを書き込み、当該プログラムまたは当該データの容量を示す容量情報を当該記憶領域の前記特定アドレス空間とは異なるアドレス空間に書き込む第2のプロセッサと、
を備えることを特徴とするデータ管理装置。
《請求項11》
前記第2のプロセッサは、前記記憶領域の前記異なるアドレス空間に記憶された前記容量情報に基づき、当該記憶領域を消去する、
ことを特徴とする請求項10に記載のデータ管理装置。
《請求項12》
請求項1ないし11のうちいずれか1項に記載のデータ管理装置と、
時刻を計数する計時部と、
前記計時部が計数する前記時刻を表示する表示部と、
を備えることを特徴とする電子時計。
《請求項13》
記憶領域の特定アドレス空間にデータまたはプログラムを特定する特定情報が記憶されると共に、前記記憶領域の前記特定アドレス空間とは異なるアドレス空間に前記特定情報と同一の特定情報が記憶されており、
前記記憶領域の前記特定アドレス空間の特定情報と前記記憶領域の前記異なるアドレス空間の特定情報とを照合して、前記データまたは前記プログラムが正しく書き込まれているか否かを判定する、
ことを特徴とするデータ管理方法。
《請求項14》
記憶領域の特定アドレス空間にデータまたはプログラムが記憶されると共に、前記記憶領域の前記特定アドレス空間とは異なるアドレス空間に前記データまたは前記プログラムの容量を示す容量情報が記憶されており、
前記記憶領域の前記異なるアドレス空間に記憶された前記容量情報に基づき、当該記憶領域を消去する、
ことを特徴とするデータ管理方法。
《請求項15》
記憶領域の特定アドレス空間にデータまたはプログラムを書き込む第1書込手段、
前記記憶領域の前記特定アドレス空間とは異なるアドレス空間に、前記データまたは前記プログラムを特定する特定情報と同一の特定情報を書き込む第2書込手段、
前記記憶領域の前記特定アドレス空間の特定情報と前記記憶領域の前記異なるアドレス空間の特定情報とを照合して、前記データまたは前記プログラムが正しく書き込まれているか否かを判定する判定手段、
としてコンピュータを機能させるためのデータ管理プログラム。
《請求項16》
記憶領域の特定アドレス空間にデータまたはプログラムを書き込む第1書込手段、
前記記憶領域の前記特定アドレス空間とは異なるアドレス空間に前記データまたは前記プログラムの容量を示す容量情報を書き込む第2書込手段、
前記記憶領域の前記異なるアドレス空間に記憶された前記容量情報に基づき、当該記憶領域を消去する消去手段、
としてコンピュータを機能させるためのデータ管理プログラム。
<<Claim 1>>
A memory having a storage area for storing a program or data;
a processor that writes the program or the data and specific information that identifies the program or the data in a specific address space of the storage area, and writes the specific information in an address space different from the specific address space of the storage area;
A data management device comprising:
<<Claim 2>>
the memory includes a plurality of storage areas for storing the programs or the data;
the processor compares specific information included in the program or data in a specific address space of each of the storage areas with specific information included in the different address space of each of the storage areas to determine whether the data or the program has been written correctly, and erases the storage area where the data or the program has not been written correctly;
2. The data management device according to claim 1.
<<Claim 3>>
the memory includes a plurality of storage areas for storing the programs or the data;
the processor compares specific information included in the program or data in the specific address space of each of the storage areas with specific information in the different address space of each of the storage areas to determine whether the data or the program has been correctly written, and uses the program or data stored in the storage area in which the data or the program has been correctly written;
3. The data management device according to claim 1 or 2.
<<Claim 4>>
A memory having a storage area for storing a program or data;
a processor that writes new programs or data into a specific address space of the storage area, and writes capacity information indicating a capacity of the programs or data into an address space different from the specific address space of the storage area;
A data management device comprising:
<Claim 5>
The processor erases the storage area based on the capacity information stored in the different address space of the storage area.
5. The data management device according to claim 4.
<Claim 6>
A first processor;
a memory having a storage area for storing a program to be read and executed by the first processor or data to be read and referenced by the first processor;
a second processor that writes the program or the data into a specific address space of the storage area, and writes specific information that identifies the program or the data into an address space different from the specific address space of the storage area;
A data management device comprising:
<<Claim 7>>
the memory includes a plurality of storage areas for storing the programs or the data;
the second processor compares specific information included in the program or the data in the specific address space of each of the storage areas with specific information in the different address space of each of the storage areas to determine whether the data or the program has been correctly written, and causes the first processor to use the program or data stored in the storage area that has been correctly written;
7. The data management device according to claim 6.
<Claim 8>
the memory includes a plurality of storage areas for storing the programs or the data;
the first processor compares specific information included in the program or the data in the specific address space of each of the storage areas with specific information in the different address space of each of the storage areas to determine whether the data or the program has been correctly written, and reads the program or data stored in the storage area in which the data or the program has been correctly written;
7. The data management device according to claim 6.
<Claim 9>
A battery for supplying power;
a voltage sensor that detects a voltage of the power supply;
the second processor writes, together with identification information for identifying the program or the data, information on the power supply voltage detected by the voltage sensor into the different address space of the storage area;
9. The data management device according to claim 6, wherein the data management device is a data management device.
<Claim 10>
A first processor;
a memory having a storage area for storing a program to be read and executed by the first processor or data to be read and referenced by the first processor;
a second processor that writes a new program or data into a specific address space of the storage area, and writes capacity information indicating a capacity of the program or data into an address space different from the specific address space of the storage area;
A data management device comprising:
<<Claim 11>>
the second processor erases the storage area based on the capacity information stored in the different address space of the storage area;
11. The data management device according to claim 10.
<Claim 12>
A data management device according to any one of claims 1 to 11;
A timekeeping unit that counts time;
a display unit that displays the time counted by the timer unit;
An electronic watch comprising:
<Claim 13>
specific information for identifying data or a program is stored in a specific address space of a storage area, and specific information identical to the specific information is stored in an address space different from the specific address space of the storage area,
comparing the specific information of the specific address space of the storage area with the specific information of the different address space of the storage area to determine whether the data or the program has been correctly written;
A data management method comprising:
<Claim 14>
data or a program is stored in a specific address space of a storage area, and capacity information indicating a capacity of the data or the program is stored in an address space different from the specific address space of the storage area,
erasing the storage area based on the capacity information stored in the different address space of the storage area;
A data management method comprising:
<Claim 15>
a first writing means for writing data or a program into a specific address space of the storage area;
a second writing means for writing, into an address space different from the specific address space of the storage area, specific information identical to the specific information for identifying the data or the program;
a determination means for determining whether or not the data or the program has been correctly written by comparing specific information of the specific address space of the storage area with specific information of the different address space of the storage area;
A data management program that allows a computer to function as a
<Claim 16>
a first writing means for writing data or a program into a specific address space of the storage area;
a second writing means for writing capacity information indicating a capacity of the data or the program to an address space different from the specific address space of the storage area;
an erasing means for erasing the storage area based on the capacity information stored in the different address space of the storage area;
A data management program that allows a computer to function as a

1 電子時計 (データ管理装置)
2 マイクロコンピュータ
21 CPU (第2のプロセッサ)
22 RAM
23 ROM
25 発振回路
26 分周回路
27 計時回路
31 操作部
32 表示部
33 電源部
34 電池
4 通信部
41 アンテナ
5 GPS部
51 アンテナ
52 CPU (第1のプロセッサ)
53 RAM
6 フラッシュメモリ
61 領域0
62 領域1
7 振動子
1. Electronic clock (data management device)
2 Microcomputer 21 CPU (second processor)
22 RAM
23 ROM
25 Oscillator circuit 26 Divider circuit 27 Timer circuit 31 Operation unit 32 Display unit 33 Power supply unit 34 Battery 4 Communication unit 41 Antenna 5 GPS unit 51 Antenna 52 CPU (first processor)
53 RAM
6 Flash memory 61 Area 0
62 Area 1
7. Transducer

Claims (7)

所定の時間間隔おきに所定の角度だけ回動する指針と、A pointer that rotates by a predetermined angle at a predetermined time interval;
被書き込み対象が書き込まれる2つの記憶領域を有する記憶部と、A storage unit having two storage areas into which objects to be written are written;
制御部と、A control unit;
を備える電子時計であって、An electronic watch comprising:
前記制御部は、The control unit is
前記2つの記憶領域のうちの何れかの記憶領域を、被フォーマット領域、又は、次回に前記被書き込み対象が書き込まれる領域である書き込み領域であると判定し、determining that one of the two storage areas is a format area or a write area into which the write target will be written next time;
ユーザが時刻を確認していない可能性が高い時間帯に、前記電子時計が通常モードである場合に、判定した前記被フォーマット領域、又は、前記書き込み領域を消去する未使用領域消去処理を実行する、executing an unused area erasure process for erasing the determined formatted area or the write area when the electronic watch is in a normal mode during a time period when it is highly likely that the user is not checking the time;
ことを特徴とする電子時計。An electronic watch characterized by:
前記制御部は、The control unit is
前記時間帯のうちの標準電波受信の処理が行われている時間帯を避けて、前記未使用領域消去処理を実行する、and executing the unused area erasure process during a time period other than the time period during which standard time radio wave reception is being performed.
ことを特徴とする請求項1に記載の電子時計。2. The electronic watch according to claim 1,
前記制御部は、The control unit is
前記電子時計がストップウォッチモードであり、かつ、前記指針が停止後所定の時間が経過した場合に、前記未使用領域消去処理を実行する、executes the unused area erasure process when the electronic timepiece is in a stopwatch mode and a predetermined time has elapsed since the hands stopped.
ことを特徴とする請求項1に記載の電子時計。2. The electronic watch according to claim 1,
前記被書き込み対象とは、地図データである、The object to be written is map data.
ことを特徴とする請求項1に記載の電子時計。2. The electronic watch according to claim 1,
前記制御部は、The control unit is
前記被フォーマット領域と判定された記憶領域をフォーマットし次回に前記被書き込み対象が書き込まれる領域として設定する、formatting the storage area determined to be the formatted area and setting it as an area into which the write target will be written next time;
ことを特徴とする請求項1に記載の電子時計。2. The electronic watch according to claim 1,
所定の時間間隔おきに所定の角度だけ回動する指針と、A pointer that rotates by a predetermined angle at a predetermined time interval;
被書き込み対象が書き込まれる2つの記憶領域を有する記憶部と、A storage unit having two storage areas into which objects to be written are written;
を備える電子時計が実行する方法であって、A method executed by an electronic watch comprising:
前記2つの記憶領域のうちの何れかの記憶領域を、被フォーマット領域、又は、次回に前記被書き込み対象が書き込まれる領域である書き込み領域であると判定し、determining that one of the two storage areas is a format area or a write area into which the write target will be written next time;
ユーザが時刻を確認していない可能性が高い時間帯に、前記電子時計が通常モードである場合に、判定した前記被フォーマット領域、又は、前記書き込み領域を消去する未使用領域消去処理を実行する、executing an unused area erasure process for erasing the determined formatted area or the write area when the electronic watch is in a normal mode during a time period when it is highly likely that the user is not checking the time;
ことを特徴とする方法。A method comprising:
所定の時間間隔おきに所定の角度だけ回動する指針と、A pointer that rotates by a predetermined angle at a predetermined time interval;
被書き込み対象が書き込まれる2つの記憶領域を有する記憶部と、A storage unit having two storage areas into which objects to be written are written;
を備える電子時計のコンピュータによって、By the electronic clock computer having
前記2つの記憶領域のうちの何れかの記憶領域を、被フォーマット領域、又は、次回に前記被書き込み対象が書き込まれる領域である書き込み領域であると判定させ、determining that one of the two storage areas is a format area or a write area into which the object to be written will be written next time;
ユーザが時刻を確認していない可能性が高い時間帯に、前記電子時計が通常モードである場合に、判定した前記被フォーマット領域、又は、前記書き込み領域を消去する未使用領域消去処理を実行させる、executing an unused area erasure process for erasing the determined formatted area or the write area when the electronic watch is in a normal mode during a time period when it is highly likely that the user is not checking the time;
ことを特徴とするプログラム。A program characterized by:
JP2023077016A 2022-01-06 2023-05-09 Electronic clock, method, and program Active JP7501726B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2023077016A JP7501726B2 (en) 2022-01-06 2023-05-09 Electronic clock, method, and program

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2022000782A JP7279824B2 (en) 2017-09-04 2022-01-06 ELECTRONIC CLOCK, REGION DETERMINATION METHOD, AND PROGRAM
JP2023077016A JP7501726B2 (en) 2022-01-06 2023-05-09 Electronic clock, method, and program

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
JP2022000782A Division JP7279824B2 (en) 2017-09-04 2022-01-06 ELECTRONIC CLOCK, REGION DETERMINATION METHOD, AND PROGRAM

Publications (2)

Publication Number Publication Date
JP2023090881A JP2023090881A (en) 2023-06-29
JP7501726B2 true JP7501726B2 (en) 2024-06-18

Family

ID=80352152

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2023077016A Active JP7501726B2 (en) 2022-01-06 2023-05-09 Electronic clock, method, and program

Country Status (1)

Country Link
JP (1) JP7501726B2 (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011519446A (en) 2008-03-25 2011-07-07 クゥアルコム・インコーポレイテッド Apparatus and method for widget update scheduling
JP2011164827A (en) 2010-02-08 2011-08-25 Nippon Avionics Co Ltd Electronic apparatus including flash memory and method for updating program stored in flash memory
JP2015175808A (en) 2014-03-18 2015-10-05 セイコーエプソン株式会社 Radio clock and reception control method
JP2016121877A (en) 2014-12-24 2016-07-07 シチズンホールディングス株式会社 Electronic apparatus
JP2016200508A (en) 2015-04-10 2016-12-01 セイコーエプソン株式会社 Communication system, electronic timekeeper, and communication device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011519446A (en) 2008-03-25 2011-07-07 クゥアルコム・インコーポレイテッド Apparatus and method for widget update scheduling
JP2011164827A (en) 2010-02-08 2011-08-25 Nippon Avionics Co Ltd Electronic apparatus including flash memory and method for updating program stored in flash memory
JP2015175808A (en) 2014-03-18 2015-10-05 セイコーエプソン株式会社 Radio clock and reception control method
JP2016121877A (en) 2014-12-24 2016-07-07 シチズンホールディングス株式会社 Electronic apparatus
JP2016200508A (en) 2015-04-10 2016-12-01 セイコーエプソン株式会社 Communication system, electronic timekeeper, and communication device

Also Published As

Publication number Publication date
JP2023090881A (en) 2023-06-29

Similar Documents

Publication Publication Date Title
KR100613541B1 (en) Generator and electric device using the same
US20230063308A1 (en) Electronic timepiece and information acquisition method
JP2022003571A (en) Data management equipment, electronic clocks, data management methods, and data management programs
JP7501726B2 (en) Electronic clock, method, and program
JP7279824B2 (en) ELECTRONIC CLOCK, REGION DETERMINATION METHOD, AND PROGRAM
JP4680686B2 (en) Storage medium for computer terminal
US20110246702A1 (en) Management Of Configuration Data Using Persistent Memories Requiring Block-Wise Erase Before Rewriting
JP6903968B2 (en) Electronic devices, electronic clocks, program writing methods, and programs
JP2003084993A (en) Processing device and debug device with flash memory
JP6466224B2 (en) Analog electronic timepiece and analog electronic timepiece control method
CN110133987B (en) Timing measurement device, electronic timepiece, timing measurement method, and storage medium storing program
JP5374415B2 (en) GPS reception clock
JP5633125B2 (en) Information processing method, information processing apparatus, and program
CN111026441A (en) Electronic device, information processing method, and storage medium storing information processing program
US11703812B2 (en) Timepiece, control method for change of time, and storage medium
WO2017043026A1 (en) Control method and communication device employing same
US12259745B2 (en) Real-time clock module
JP2004054421A (en) Memory, information processor, storage method and information processing method
US20240427408A1 (en) Method for managing hibernation of an embedded system
JP7006090B2 (en) Satellite radio wave receiver, electronic clock, date and time information acquisition control method and program
JP2001311786A (en) Rtc device
JP6958201B2 (en) Wireless communication devices, electronic clocks, wireless communication methods, and programs
JP6866712B2 (en) Electronic clock, reception operation control method and program
JP2020017315A (en) Control method and communication device using the same
JP2005115614A (en) Data processor and method

Legal Events

Date Code Title Description
A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20230607

A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20230607

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20240507

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20240520

R150 Certificate of patent or registration of utility model

Ref document number: 7501726

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150