JPH09305395A - Electronic equipment - Google Patents

Electronic equipment

Info

Publication number
JPH09305395A
JPH09305395A JP8123114A JP12311496A JPH09305395A JP H09305395 A JPH09305395 A JP H09305395A JP 8123114 A JP8123114 A JP 8123114A JP 12311496 A JP12311496 A JP 12311496A JP H09305395 A JPH09305395 A JP H09305395A
Authority
JP
Japan
Prior art keywords
data
program
rewriting
area
flash memory
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP8123114A
Other languages
Japanese (ja)
Inventor
Shigeru Sasaki
茂 佐々木
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.)
Tamura Electric Works Ltd
Original Assignee
Tamura Electric Works Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tamura Electric Works Ltd filed Critical Tamura Electric Works Ltd
Priority to JP8123114A priority Critical patent/JPH09305395A/en
Publication of JPH09305395A publication Critical patent/JPH09305395A/en
Pending legal-status Critical Current

Links

Landscapes

  • Debugging And Monitoring (AREA)
  • Stored Programmes (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)

Abstract

PROBLEM TO BE SOLVED: To modify data in a flash memory while mounting the memory on a printed board, etc., as it is. SOLUTION: This equipment is equipped with a data rewritable nonvolatile memory 3 which has a 1st area wherein a rewriting program rewriting program data and function setting data are stored and a 2nd area where the program data and function setting data are transferred and stored and a personal computer 10 which sends modified data of the program data and function setting data. Once the personal computer 10 is connected, a CPU 2 is actuated to execute the rewriting program in the 1st area; and the program data and function setting data in the flash memory 1 are transferred to the 2nd area, and the flash memory 1 is erased and also rewritten according to the modified data from the personal computer 10.

Description

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

【0001】[0001]

【発明の属する技術分野】本発明は、電気的書き込み及
び消去が可能なフラッシュメモリ内のプログラムデータ
や機能設定データ等の書き換えを可能にする電子機器に
関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to an electronic device capable of rewriting program data, function setting data, etc. in a flash memory that can be electrically written and erased.

【0002】[0002]

【従来の技術】ROM等のメモリは電源が断となっても
記憶したデータが保持できることからプログラム等のデ
ータを保持するのに適している。しかし、ROMは、プ
ログラム等の変更が生じた場合、これを電気的な消去し
て新たなデータを書き込むことが不可能であるため、新
たにデータが書き込まれたROMと交換を行う必要があ
る。このため、近年は各種の電子機器にはフラッシュメ
モリが多用されている。このフラッシュメモリはROM
と同様、電源が供給されなくなってもデータを保持する
ことが可能な不揮発性メモリであるため、本電子機器を
制御するCPUのプログラムや本電子機器の機能設定デ
ータ等、停電時のバックアップが必要なデータの格納に
好適である。また、フラッシュメモリはROMと異なっ
てデータの電気的な消去や書き換えが可能なメモリであ
り、プログラムデータや機能設定データの変更時に新た
なデータに書き換えることができる。
2. Description of the Related Art A memory such as a ROM is suitable for holding data such as a program since it can hold stored data even when the power is turned off. However, when a change in a program or the like occurs, it is impossible to electrically erase the program and write new data. Therefore, the ROM needs to be replaced with a ROM in which data is newly written. . For this reason, in recent years, flash memories are frequently used in various electronic devices. This flash memory is ROM
Similar to the above, it is a non-volatile memory that can retain data even when power is not supplied. It is suitable for storing various data. Further, unlike a ROM, a flash memory is a memory in which data can be electrically erased and rewritten, and can be rewritten with new data when program data or function setting data is changed.

【0003】[0003]

【発明が解決しようとする課題】しかしこのようなフラ
ッシュメモリにおいても、プログラムデータ等を変更す
る場合は、通常はソケット等を介して装着されているプ
リント基板から取り外してデータを書き換えているが、
近年のフラッシュメモリは面実装タイプのものが多く、
このようなタイプのフラッシュメモリはプリント基板に
直接ハンダ付けされているため、プログラムデータ等の
変更が困難となっている。従って本発明は、フラッシュ
メモリのデータの書き換えを行う場合、フラッシュメモ
リをプリント基板等から取り外すことなく書き換え可能
にすることを目的とする。
However, even in such a flash memory, when changing program data or the like, the data is normally rewritten by removing it from the printed circuit board mounted through a socket or the like.
In recent years, many flash memories are surface mount type,
Since the flash memory of this type is directly soldered to the printed circuit board, it is difficult to change the program data and the like. Therefore, an object of the present invention is to make it possible to rewrite data in a flash memory without removing the flash memory from a printed circuit board or the like.

【0004】[0004]

【課題を解決するための手段】このような課題を解決す
るために本発明は、データの書き換えを行う書き換えプ
ログラムを格納する第1のエリアと,データが転送され
て格納される第2のエリアとを有しデータの書き換えが
可能な揮発性メモリ(SRAM)と、上記データの変更
データを送信する外部装置と備え、制御手段は所定の条
件により起動されCPUに第1のエリアの書き換えプロ
グラムを実行させて不揮発性メモリ(例えばフラッシュ
メモリ)のデータを第2のエリアに転送し、転送終了後
に不揮発性メモリを消去すると共に、外部装置からの変
更データに基づいて不揮発性メモリの書き換えを行うよ
うにしたものである。また、外部装置はSRAMの第1
のエリアに格納される上記書き換えプログラムを有し、
かつ不揮発性メモリに、外部装置からの書き換えプログ
ラムを受信して第1のエリアに転送する転送プログラム
を格納するようにしたものである。
In order to solve such a problem, the present invention provides a first area for storing a rewriting program for rewriting data and a second area for storing and transferring data. A rewritable volatile memory (SRAM) and an external device for transmitting the changed data of the data, and the control means is activated under a predetermined condition to cause the CPU to execute the rewriting program of the first area. Transfer the data of the non-volatile memory (for example, flash memory) to the second area by executing it, erase the non-volatile memory after the transfer is completed, and rewrite the non-volatile memory based on the changed data from the external device. It is the one. The external device is the first SRAM.
Has the above rewriting program stored in the area
Moreover, the transfer program for receiving the rewriting program from the external device and transferring it to the first area is stored in the non-volatile memory.

【0005】また、書き換えプログラムとこの書き換え
プログラムをSRAMの第1のエリアに転送する転送プ
ログラムを不揮発性メモリに格納するものである。ま
た、不揮発性メモリを複数のブロック単位に構成し、デ
ータの部分書き換えを可能にしたものである。また、表
示手段と、不揮発性メモリのデータ書き換えの正否をチ
ェックするチェック手段と、チェック手段のチェック結
果がエラーとなる場合に表示手段にエラー表示を行う手
段とを設けたものである。また、不揮発性メモリのデー
タ書き換えの終了後CPUの処理を不揮発性メモリのプ
ログラム実行処理に復帰させるリスタート手段を設けた
ものである。
The rewriting program and a transfer program for transferring the rewriting program to the first area of the SRAM are stored in a non-volatile memory. Also, the nonvolatile memory is configured in units of a plurality of blocks to enable partial rewriting of data. Further, a display unit, a check unit for checking whether data rewriting of the nonvolatile memory is correct or not, and a unit for displaying an error on the display unit when a check result of the check unit indicates an error are provided. Further, a restart means is provided for returning the processing of the CPU to the program execution processing of the nonvolatile memory after the data rewriting of the nonvolatile memory is completed.

【0006】[0006]

【発明の実施の形態】以下、本発明について図面を参照
して説明する。図1は本発明に係る電子機器の要部構成
を示すブロック図である。同図において、1はプログラ
ムデータや本電子機器の機能設定データ等のデータが格
納され電気的に書込消去が可能な不揮発性メモリである
フラッシュメモリである。なお、フラッシュメモリ1に
代えて揮発性メモリであるSRAMを電池等によりバッ
クアップし不揮発性メモリとして用いるようにしても良
い。また、2はフラッシュメモリ1内のプログラムを実
行して所定の機能動作を行うCPU、3はフラッシュメ
モリ1内のデータの変更時にこれらのデータを一時的に
格納する揮発性メモリであるSRAM、4はCPU2か
らのアドレス出力を受けてフラッシュメモリ1及びSR
AM3の何れか一方を選択するアドレスデコーダであ
る。
DESCRIPTION OF THE PREFERRED EMBODIMENTS The present invention will be described below with reference to the drawings. FIG. 1 is a block diagram illustrating a main configuration of an electronic device according to the present invention. In the figure, reference numeral 1 is a flash memory which is a nonvolatile memory in which data such as program data and function setting data of the present electronic device is stored and which can be electrically written and erased. Instead of the flash memory 1, an SRAM which is a volatile memory may be backed up by a battery or the like and used as a non-volatile memory. Further, 2 is a CPU that executes a program in the flash memory 1 to perform a predetermined functional operation, 3 is a volatile memory that temporarily stores these data when the data in the flash memory 1 is changed, 4 Receives the address output from the CPU 2 and the flash memory 1 and SR
It is an address decoder that selects either one of AM3.

【0007】また、5はプログラムデータ等の書き換え
を開始するためのスタートキー、6はCPU2のポート
P3からの定期的な出力が無くなると後述のリセット回
路を作動させてリセット信号を出力させるウォッチドッ
グ回路、7はパワーオン信号またはウォッチドッグ回路
6からの出力によりCPU2のリセット端子にリセット
信号を与えてリセットするリセット回路、8は表示手段
である。
Reference numeral 5 is a start key for starting the rewriting of program data and the like, and 6 is a watchdog for operating a reset circuit described later to output a reset signal when the periodic output from the port P3 of the CPU 2 is lost. A circuit, 7 is a reset circuit for applying a reset signal to the reset terminal of the CPU 2 for resetting by a power-on signal or an output from the watchdog circuit 6, and 8 is a display means.

【0008】なお、図1において、10は本電子機器の
CPU2に対しプログラムの変更データ等を送信するパ
ソコン、ABはアドレスバス、DBはデータバスであ
る。ここで、パソコン10とCPU2間はRS−232
C信号線9により接続され、CPU2はパソコン10か
ら送られてくるRS−232C信号による書換データを
ポートP2を介して受信する。また、受信した書換デー
タのチェックの結果がNGとなる場合は、ポートP2か
らRS−232C信号により再送データを送信する。
In FIG. 1, reference numeral 10 is a personal computer for transmitting program change data and the like to the CPU 2 of the electronic apparatus, AB is an address bus, and DB is a data bus. Here, RS-232 is provided between the personal computer 10 and the CPU 2.
Connected by the C signal line 9, the CPU 2 receives the rewriting data by the RS-232C signal sent from the personal computer 10 through the port P2. When the check result of the received rewrite data is NG, the retransmitted data is transmitted from the port P2 by the RS-232C signal.

【0009】以上のように構成された本電子機器におい
て、フラッシュメモリ1に格納されているデータの変更
が生じた場合はパソコン10をCPU2に接続すると共
に、スタートキー5を押下する。すると、CPU2はこ
れを検出してフラッシュメモリ1内の後述する転送プロ
グラムを実行して、フラッシュメモリ1内の書き換えプ
ログラムをSRAM3に転送し、転送終了後はSRAM
3の書き換えプログラムを実行する。
In the electronic device constructed as described above, when the data stored in the flash memory 1 is changed, the personal computer 10 is connected to the CPU 2 and the start key 5 is pressed. Then, the CPU 2 detects this and executes a transfer program to be described later in the flash memory 1 to transfer the rewriting program in the flash memory 1 to the SRAM 3 and, after the transfer is completed, to the SRAM.
The rewriting program of No. 3 is executed.

【0010】こうしてCPU2は以降はSRAM3に転
送された書き換えプログラムを実行することによってフ
ラッシュメモリ1のデータの書き換えを行う。即ち、C
PU2はパソコン10からの書き換えデータを受信する
と、CPU2はフラッシュメモリ1内のその書き換えデ
ータに該当するセクタのデータをSRAM3に転送し、
SRAM3上で該当部分を受信データに書き換えるデー
タ編集処理を行う。そしてデータ編集が終了すると、フ
ラッシュメモリ1の該当セクタのデータを消去し、SR
AM3の編集データを該当セクタに書き込む処理を行
う。なお、フラッシュメモリ1の消去時及びデータ書き
換え時にはフラッシュメモリ1のBUSY端子から出力
されるビジー信号を確認しながらデータの書き換え等を
行う。
In this way, the CPU 2 thereafter rewrites the data in the flash memory 1 by executing the rewriting program transferred to the SRAM 3. That is, C
When the PU 2 receives the rewrite data from the personal computer 10, the CPU 2 transfers the data of the sector corresponding to the rewrite data in the flash memory 1 to the SRAM 3,
A data editing process is performed on the SRAM 3 to rewrite the corresponding portion with the received data. When the data editing is completed, the data in the corresponding sector of the flash memory 1 is erased,
A process of writing the edit data of AM3 to the corresponding sector is performed. At the time of erasing and data rewriting of the flash memory 1, data rewriting and the like are performed while checking the busy signal output from the BUSY terminal of the flash memory 1.

【0011】このようにしてSRAM3に転送された書
き換えプログラムの実行によりフラッシュメモリ1のデ
ータの書き換えが行われ、書き換えが終了するとCPU
2はフラッシュメモリ1のプログラムを実行する通常処
理に復帰する。このように、CPU2はSRAM3の書
き換えプログラムを実行することによりフラッシュメモ
リ1のデータを書き換えるため、フラッシュメモリ1を
装着されているプリント基板等から取り外すことなくデ
ータを書き換えることが可能になる。また、この間CP
U2のプログラム実行動作は停止せず、従って速やかに
フラッシュメモリ1のデータを書き換えることが可能に
なる。
By executing the rewriting program transferred to the SRAM 3 in this way, the data in the flash memory 1 is rewritten, and when the rewriting is completed, the CPU
2 returns to the normal processing for executing the program of the flash memory 1. In this way, the CPU 2 rewrites the data of the flash memory 1 by executing the rewriting program of the SRAM 3, so that the data can be rewritten without removing the flash memory 1 from the printed circuit board or the like on which the flash memory 1 is mounted. Also during this period CP
The program execution operation of U2 is not stopped, so that the data in the flash memory 1 can be rewritten quickly.

【0012】図2は、フラッシュメモリ1及びSRAM
3の構成を示す図である。フラッシュメモリ1は同図
(a)に示すように各セクタに分割されており、セクタ
「0」には本電子機器の機能設定データが格納され、セ
クタ「1」〜セクタ「n−1」にはプログラムデータが
格納される。また、セクタ「n」には、パワーオン時の
初期処理を行うイニシャルプログラムPG1及びデータ
の書き換えを行うための第1の書き換えプログラムPG
2が格納されこのセクタは保護エリア(書き換え不可能
なエリア)と呼ばれる。
FIG. 2 shows a flash memory 1 and an SRAM.
It is a figure which shows the structure of 3. The flash memory 1 is divided into each sector as shown in FIG. 1A, the sector “0” stores the function setting data of the electronic device, and the sectors “1” to “n−1” are stored. Stores program data. Further, in the sector “n”, the initial program PG1 for performing initial processing at power-on and the first rewriting program PG for rewriting data.
2 is stored and this sector is called a protected area (non-rewritable area).

【0013】保護エリアに格納される第1の書き換えプ
ログラムPG2は、スタートキー5の押下等を検出して
書き換え処理に移行する書き換え開始プログラムPG3
と、フラッシュメモリ1内の保護エリアに格納されてい
るプログラムをSRAM3に転送する第1の転送プログ
ラムPG4と、CPU2をSRAM3のプログラムの処
理に移行させる処理移行プログラムPG5と、パソコン
10からの書き換えデータを受信してその正否をチェッ
クするチェック用プログラムPG6と、フラッシュメモ
リ1の他のセクタのデータをSRAM3に転送する第2
の転送プログラムPG7と、パソコン10から受信した
書き換えデータをSRAM3上で編集しフラッシュメモ
リ1に書き込む編集プログラムPG8と、フラッシュメ
モリ1への書き換えが終了した時に表示手段8に対し終
了表示やエラー表示を行うエラー処理プログラムPG9
と、書き換え終了時に次の処理を再開させるリスタート
処理プログラムPG10とから構成されている。
The first rewriting program PG2 stored in the protected area is a rewriting start program PG3 that detects the depression of the start key 5 and shifts to rewriting processing.
A first transfer program PG4 for transferring a program stored in a protected area in the flash memory 1 to the SRAM 3, a processing transfer program PG5 for transferring the CPU 2 to the processing of the program in the SRAM 3, and rewriting data from the personal computer 10. And a second program for transferring the data of another sector of the flash memory 1 to the SRAM 3.
Transfer program PG7 and the rewriting data received from the personal computer 10 are edited on the SRAM3 and written to the flash memory 1, and an end display and an error display are given to the display means 8 when the rewriting to the flash memory 1 is completed. Error processing program PG9 to be executed
And a restart processing program PG10 for restarting the next processing at the end of rewriting.

【0014】このうち、第1の転送プログラムPG4に
よってSRAM3に転送されるプログラムとしては、チ
ェック用プログラムPG6、第2の転送プログラムPG
7、編集プログラムPG8、エラー処理プログラムPG
9及びリスタート処理プログラムPG10があり、これ
らを第2の書き換えプログラムPG11と称する。一
方、SRAM3の構成は図2(b)に示すように、フラ
ッシュメモリ1から転送された第2の書き換えプログラ
ムPG11が格納されるプログラム領域(第1のエリ
ア)と、フラッシュメモリ1の保護エリア以外の他のセ
クタ領域からの転送データが格納されるデータ領域(第
2のエリア)とからなる。
Among these, the programs transferred to the SRAM 3 by the first transfer program PG4 are a check program PG6 and a second transfer program PG.
7, editing program PG8, error processing program PG
9 and a restart processing program PG10, which are referred to as a second rewriting program PG11. On the other hand, as shown in FIG. 2B, the configuration of the SRAM 3 is other than a program area (first area) in which the second rewrite program PG11 transferred from the flash memory 1 is stored and a protection area of the flash memory 1. And a data area (second area) in which transfer data from another sector area is stored.

【0015】次に図3のフローチャートを参照して本電
子機器のデータ書き換え動作を具体的に説明する。ま
ず、フラッシュメモリ1のデータ書き換えを行う場合、
パソコン10上で書き換えデータを作成した後、CPU
2とRS−232C信号線9により接続し、スタートキ
ー5を押下する。すると、フラッシュメモリ1のプログ
ラムを実行して通常処理を行っているCPU2は、ステ
ップS1でスタートキー5の検出判断を行い、スタート
キー5の押下を検出すると、通常処理を中断してフラッ
シュメモリ1内の保護エリアの書き換え開始プログラム
PG3を実行しステップS2でパソコン10との接続の
有無を判断する。
Next, the data rewriting operation of the present electronic device will be specifically described with reference to the flowchart of FIG. First, when rewriting the data in the flash memory 1,
After creating rewrite data on the personal computer 10, CPU
2 and the RS-232C signal line 9 are connected, and the start key 5 is pressed. Then, the CPU 2 executing the program of the flash memory 1 and performing the normal process makes a determination of the detection of the start key 5 in step S1. When the depression of the start key 5 is detected, the normal process is interrupted and the flash memory 1 The protected area rewrite start program PG3 therein is executed, and it is determined in step S2 whether or not there is a connection with the personal computer 10.

【0016】ここでパソコン10との接続が検出される
と、CPU2は保護エリアの第1の転送プログラムPG
4を実行し、ステップS3で第2の書き換えプログラム
PG11をSRAM3のプログラム領域に転送する。そ
の後、ステップS4で保護エリアの処理移行プログラム
PG5を実行することにより、CPU2はSRAM3に
転送されている第2の書き換えプログラムPG11の実
行を開始する。
When the connection with the personal computer 10 is detected, the CPU 2 causes the first transfer program PG in the protected area to be detected.
4 is executed, and the second rewrite program PG11 is transferred to the program area of the SRAM 3 in step S3. After that, the CPU 2 starts executing the second rewriting program PG11 transferred to the SRAM 3 by executing the protected area processing shift program PG5 in step S4.

【0017】この場合CPU2は、まず第2の書き換え
プログラムPG11中のチェック用プログラムPG6を
実行することによりRS−232C信号線9を介しパソ
コン10に受信レディ信号をステップS5で送信する。
この受信レディ信号の送信に対しパソコン10では書き
換えデータを送信してくる。パソコン10側から送信さ
れるこの書き換えデータは、書き換えデータそのもの
と、その書き換えデータのアドレス(フラッシュメモリ
1のアドレス)を含むデータである。このように構成す
ることによって、パソコン10ではフラッシュメモリ1
のデータ書換時に全てのデータを送信せずに変更データ
のみを送信できるため、データの送信時間を短縮でき
る。また、本装置においても書き換えデータの受信時間
が短縮されると共に、変更データのみを書き換えるだけ
で良く、従ってデータの書換時間を短縮できる。
In this case, the CPU 2 first executes the checking program PG6 in the second rewriting program PG11 to transmit a reception ready signal to the personal computer 10 via the RS-232C signal line 9 in step S5.
In response to the transmission of the reception ready signal, the personal computer 10 transmits rewrite data. The rewrite data transmitted from the personal computer 10 is data including the rewrite data itself and the address of the rewrite data (the address of the flash memory 1). With this configuration, the personal computer 10 can store the flash memory 1
When the data is rewritten, only the changed data can be transmitted without transmitting all the data, so that the data transmission time can be reduced. Also in the present apparatus, the reception time of the rewritten data is shortened, and only the changed data need be rewritten. Therefore, the data rewriting time can be reduced.

【0018】CPU2はパソコン10からの書き換えデ
ータをステップS6で受信する。そして受信した書き換
えデータが正しいか否かをステップS7でそのデータの
チェックサム演算を行って判断する。ここでステップS
7の判断の結果、正規な書き換えデータが受信できない
と判断される場合はステップS8でパソコン10に対し
再送要求を行ってステップS6へ戻る。そして、パソコ
ン10から再送される書き換えデータを受信する。ま
た、ステップS7の判断の結果、正規な書き換えデータ
が受信できれば、ステップS9へ移行し、その受信デー
タが書き換えデータの送信を示す終了コードではないこ
とを確認のうえ、CPU2はSRAM3に転送されてい
る第2の転送プログラムPG7を実行する。
The CPU 2 receives the rewriting data from the personal computer 10 in step S6. Then, in step S7, it is determined whether or not the received rewrite data is correct by performing a checksum calculation of the data. Here step S
As a result of the determination in step 7, if it is determined that the regular rewriting data cannot be received, a resend request is sent to the personal computer 10 in step S8, and the process returns to step S6. Then, the rewriting data retransmitted from the personal computer 10 is received. If the rewrite data can be received as a result of the determination in step S7, the process proceeds to step S9, and after confirming that the received data is not the end code indicating the transmission of the rewrite data, the CPU 2 transfers it to the SRAM 3. The second transfer program PG7 is executed.

【0019】そしてこの第2の転送プログラムPG7の
実行により、受信データの該当アドレスに相当するフラ
ッシュメモリ1のセクタの全データをステップS10で
SRAM3のデータ領域に転送する。その後CPU2は
編集プログラムPG8を実行することによりステップS
11でSRAM3のデータ領域の該当データを、受信し
た書き換えデータに書き換えるデータ編集処理を行い、
かつステップS12でフラッシュメモリ1の該当セクタ
にデータ「00」または「FF」H(16進)を書き込
むことにより消去する。さらに、消去した該当セクタに
対しステップS13でSRAM3のデータ領域の編集デ
ータを転送して書き込む。
By executing the second transfer program PG7, all the data of the sector of the flash memory 1 corresponding to the corresponding address of the received data is transferred to the data area of the SRAM 3 in step S10. Thereafter, the CPU 2 executes the editing program PG8 to execute step S.
At 11, a data editing process is performed in which the corresponding data in the data area of the SRAM 3 is rewritten to the received rewriting data.
Further, in step S12, the data "00" or "FF" H (hexadecimal) is written in the corresponding sector of the flash memory 1 to erase it. Further, in step S13, the edit data in the data area of the SRAM 3 is transferred and written in the erased corresponding sector.

【0020】その後、SRAM3に転送されているエラ
ー処理プログラムPG9を実行し、フラッシュメモリ1
へデータが正常に書き込まれたか否かをそのデータのチ
ェックサム演算を行うことによりチェックする。即ち、
フラッシュメモリ1の該当セクタの消去前のチェックサ
ムと、新たに該当セクタに書き込まれた編集データのチ
ェックサム演算結果との比較照合を行い、チェックサム
エラーが発生すれば、SRAM3の別途領域にエラーフ
ラグをセットする。このようにしてフラッシュメモリ1
の1つのセクタに対するデータの部分書換が行われる。
After that, the error processing program PG9 transferred to the SRAM 3 is executed, and the flash memory 1
It is checked whether or not the data has been normally written by performing a checksum operation on the data. That is,
The checksum of the corresponding sector in the flash memory 1 before erasing is compared with the checksum calculation result of the edited data newly written in the corresponding sector. If a checksum error occurs, the error is stored in a separate area of the SRAM 3. Set a flag. Thus, the flash memory 1
Is partially rewritten to one of the sectors.

【0021】その後、CPU2はステップS5に戻って
SRAM3のチェック用プログラムPG6を再度実行す
ることにより、パソコン10側から送信される次のセク
タに関する書き換えデータの受信及び受信データのチェ
ックを行う。そして、第2の転送プログラムPG7の再
実行により、受信データの該当アドレスに相当するフラ
ッシュメモリのセクタのデータをステップS10でSR
AM3のデータ領域に転送し、編集プログラムPG8を
再実行することでステップS11〜S13のデータ書き
換え処理を同様に行いデータ書き込みエラー等も同様に
チェックする。
After that, the CPU 2 returns to step S5 and executes the checking program PG6 of the SRAM 3 again to receive the rewriting data regarding the next sector transmitted from the personal computer 10 side and check the received data. Then, by re-executing the second transfer program PG7, the data of the sector of the flash memory corresponding to the corresponding address of the received data is SR-processed in step S10.
By transferring the data to the data area of AM3 and re-executing the editing program PG8, the data rewriting process of steps S11 to S13 is similarly performed, and the data writing error and the like are also checked.

【0022】このようにして、SRAM3の書き換えプ
ログラムPG11を実行することによりフラッシュメモ
リ1の各セクタのデータがパソコン10側から送信され
るデータに順次書き換えられる。そして、パソコン10
側からデータ書き換えの終了を示す終了コードが送信さ
れ、ステップS9の「終了コード」が「Y」と判定され
ると、CPU2は上記エラー処理プログラムPG9を実
行し、SRAM3の別途領域に書き込みエラーフラグが
セットされているか否かを判断する。そしてエラーフラ
グがセットされていれば表示手段8にエラー表示を行
い、エラーフラグがセットされていなければ、表示手段
8に書き込み終了表示を行う(ステップS14)。な
お、表示手段8としては、LEDやLCDの他にトーン
発生手段がある。また、こうした書き込みエラー時には
エラー信号をパソコン10側に送信してパソコン10に
もエラー表示を行う。その後CPU2は、SRAM3に
転送されているリスタート処理プログラムPG10を実
行することにより、ステップS15で通常処理に復帰す
る。
In this way, by executing the rewriting program PG11 of the SRAM 3, the data of each sector of the flash memory 1 is sequentially rewritten into the data transmitted from the personal computer 10 side. And the personal computer 10
When the end code indicating the end of data rewriting is transmitted from the side and the "end code" in step S9 is determined to be "Y", the CPU 2 executes the error processing program PG9, and writes the error flag in a separate area of the SRAM3. It is determined whether or not is set. If the error flag is set, an error display is displayed on the display means 8, and if the error flag is not set, a write end display is displayed on the display means 8 (step S14). As the display means 8, there is a tone generating means in addition to the LED and LCD. Further, when such a writing error occurs, an error signal is transmitted to the personal computer 10 side to display an error on the personal computer 10. After that, the CPU 2 executes the restart processing program PG10 transferred to the SRAM 3 to return to the normal processing in step S15.

【0023】なお、書き込み処理の終了後の上記リスタ
ート処理PG10としては、本実施の形態のように通常
処理に復帰させる方法の他に、CPU2がプログラムの
実行中に定期的に行っているフォッチドッグ回路6への
アクセスを停止することにより、ウオッチドック回路6
からリセット回路7に起動をかけてCPU2をリセット
させ、フラッシュメモリ1のプログラムに復帰させる方
法がある。この場合、CPU2はフラッシュメモリ1の
イニシャルプログラムから実行し、その後各セクタのプ
ログラムを実行する。また、書き込み処理の終了後にC
PU2を待機状態させ、本電子機器の電源のオフ→オン
に基づくパワーオンリセットによりリセット回路7から
CPU2をリセットさせ、CPU2をフラッシュメモリ
1のプログラムに復帰させる方法もある。
As the restart process PG10 after the writing process is completed, in addition to the method of returning to the normal process as in the present embodiment, the Foch dog which the CPU 2 regularly performs during the execution of the program. By stopping access to the circuit 6, the watchdog circuit 6
There is a method of activating the reset circuit 7 to reset the CPU 2 and restore the program of the flash memory 1. In this case, the CPU 2 executes the initial program of the flash memory 1 and then executes the program of each sector. After the writing process is completed, C
There is also a method of putting the PU 2 in a standby state, resetting the CPU 2 from the reset circuit 7 by a power-on reset based on turning off the power of the electronic device, and returning the CPU 2 to the program of the flash memory 1.

【0024】また、書き換えプログラムの起動方法とし
ては、スタートキー5の押下の他に、CPU2がパソコ
ン10との接続を検出したときに直ちにその書き換えプ
ログラムをSRAM3に転送し実行する方法と、パソコ
ン10等の外部装置から「書き換えプログラム転送」コ
マンドを受信したときにその書き換えプログラムをSR
AM3に転送し実行する方法とがある。
As a method of activating the rewriting program, in addition to pressing the start key 5, a method of immediately transferring and executing the rewriting program to the SRAM 3 when the CPU 2 detects the connection with the personal computer 10, When a "rewrite program transfer" command is received from an external device such as
There is a method of transferring to the AM3 and executing it.

【0025】また、本実施の形態では、書き換えプログ
ラムは常時フラッシュメモリ1の書き換え不可能な保護
エリアに格納されているが、書き換え可能な他のセクタ
に格納しておいても良く、またパソコン10等の外部装
置からSRAM3に送信して格納させるようにしても良
く、要はフラッシュメモリ1のデータ書き換え時にその
書き換えプログラムがSRAM3に格納されていれば良
い。従って、書き換えプログラムのSRAM3への格納
時点はフラッシュメモリの書き換え時以外にイニシャル
時であっても良い。なお、書き換えプログラムのSRA
M3への格納時にもこのデータについてチェックサム演
算を行い、エラーが発生すれば再度フラッシュメモリ1
の書き換えプログラムをSRAM3にロードする。ま
た、本実施の形態ではフラッシュメモリ1の各セクタ毎
にデータの書き換えを行っているが、SRAM3の容量
をフラッシュメモリ1の容量より大きくすればフラッシ
ュメモリ1の全てのデータを一括して書き換えることも
可能である。
Further, in the present embodiment, the rewriting program is always stored in the non-rewritable protected area of the flash memory 1, but it may be stored in another rewritable sector, and the personal computer 10 An external device such as the above may be transmitted to and stored in the SRAM 3, and the point is that the rewriting program is stored in the SRAM 3 when rewriting the data in the flash memory 1. Therefore, the rewriting program may be stored in the SRAM 3 at the initial time other than the rewriting time of the flash memory. The rewriting program SRA
When data is stored in M3, a checksum operation is performed on this data.
Is loaded into the SRAM 3. In the present embodiment, data is rewritten for each sector of the flash memory 1. However, if the capacity of the SRAM 3 is made larger than the capacity of the flash memory 1, all data in the flash memory 1 can be rewritten collectively. Is also possible.

【0026】[0026]

【発明の効果】以上説明したように本発明によれば、デ
ータの書き換えが可能なSRAMと、プログラムデータ
等の変更データを送信する外部装置と備え、制御手段は
所定の条件により起動されCPUにSRAMの第1のエ
リアの書き換えプログラムを実行させて不揮発性メモリ
のデータをSRAMの第2のエリアに転送しかつ不揮発
性メモリの消去を行うと共に、外部装置からの変更デー
タに基づいて不揮発性メモリの書き換えを行うようにし
たので、不揮発性メモリのデータを変更する場合例えば
不揮発性メモリであるフラッシュメモリ等をプリント基
板等に装着したままデータを書き換えることができる。
また、データを書き換える場合に全てのデータを書き換
えずに変更データの部分についてのみ書き換えれば良い
ことからデータの書き換え効率を向上できる。
As described above, according to the present invention, the data rewritable SRAM and the external device for transmitting the change data such as the program data are provided, and the control means is activated by a predetermined condition to the CPU. The rewriting program of the first area of the SRAM is executed to transfer the data of the non-volatile memory to the second area of the SRAM, the non-volatile memory is erased, and the non-volatile memory based on the changed data from the external device. Since the rewriting is performed, the data can be rewritten while the data in the non-volatile memory is changed, for example, with the flash memory, which is the non-volatile memory, mounted on the printed circuit board or the like.
Further, when rewriting data, it is only necessary to rewrite only the changed data portion without rewriting all the data, so the data rewriting efficiency can be improved.

【0027】また、外部装置はSRAMの第1のエリア
に格納される上記書き換えプログラムを有し、かつ不揮
発性メモリに、外部装置からの書き換えプログラムを受
信して第1のエリアに転送する転送プログラムを格納す
るので、書き換えプログラムのSRAM内の常駐を不要
にすることができる。また、書き換えプログラムとこの
書き換えプログラムをSRAMの第1のエリアに転送す
る転送プログラムを不揮発性メモリに格納するので、外
部装置を用いずに直ちにデータの書き換えが可能にな
る。また、不揮発性メモリのデータ書き換えの正否をチ
ェックし、チェック結果がエラーとなる場合に表示手段
にエラー表示を行うので、データの書き換えの正否を的
確に認識できる。
Further, the external device has the rewriting program stored in the first area of the SRAM, and the transfer program for receiving the rewriting program from the external device in the non-volatile memory and transferring the rewriting program to the first area. Is stored, it is not necessary to make the rewriting program resident in the SRAM. Further, since the rewriting program and the transfer program for transferring the rewriting program to the first area of the SRAM are stored in the nonvolatile memory, the data can be rewritten immediately without using an external device. In addition, the correctness of the data rewriting of the nonvolatile memory is checked, and an error is displayed on the display means when the check result indicates an error. Therefore, the correctness of the data rewriting can be accurately recognized.

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

【図1】 本発明の電子機器の構成を示すブロック図で
ある。
FIG. 1 is a block diagram illustrating a configuration of an electronic device of the present invention.

【図2】 電子機器を構成するフラッシュメモリ及びS
RAMの構成を示す図である。
FIG. 2 is a diagram showing a flash memory and an S constituting an electronic device
FIG. 2 is a diagram illustrating a configuration of a RAM.

【図3】 電子機器のCPUのデータ書き換え動作を示
すフローチャートである。
FIG. 3 is a flowchart illustrating a data rewriting operation of a CPU of the electronic device.

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

1…フラッシュメモリ、2…CPU、3…SRAM、4
…アドレスデコーダ、5…スタートキー、6…ウォッチ
ドッグ回路、7…リセット回路、8…表示手段、9…R
S−232C信号線、10…パソコン。
1 ... Flash memory, 2 ... CPU, 3 ... SRAM, 4
... address decoder, 5 ... start key, 6 ... watchdog circuit, 7 ... reset circuit, 8 ... display means, 9 ... R
S-232C signal line, 10 ... PC.

Claims (6)

【特許請求の範囲】[Claims] 【請求項1】 データが格納されると共に、データの書
き換えが可能な不揮発性メモリと、前記不揮発性メモリ
をアクセスして所定の処理を行うCPUとからなる電子
機器において、 データの書き換えを行う書き換えプログラムを格納する
第1のエリアと,前記データが転送されて格納される第
2のエリアとを有しデータの書き換えが可能な揮発性メ
モリと、前記データの変更データを送信する外部装置
と、所定の条件により起動され前記CPUに第1のエリ
アの書き換えプログラムを実行させて不揮発性メモリの
データを第2のエリアに転送しかつ不揮発性メモリの消
去を行うと共に、前記変更データに基づいて前記不揮発
性メモリの書き換えを行う制御手段とを備えたことを特
徴とする電子機器。
1. A rewriting device for rewriting data in an electronic device comprising a non-volatile memory that stores data and can rewrite the data, and a CPU that accesses the non-volatile memory and performs a predetermined process. A rewritable volatile memory having a first area for storing a program and a second area for transferring and storing the data; and an external device for transmitting change data of the data, The CPU is activated under a predetermined condition to cause the CPU to execute the rewriting program of the first area to transfer the data of the non-volatile memory to the second area and erase the non-volatile memory, and based on the change data, An electronic device comprising: a control unit that rewrites a nonvolatile memory.
【請求項2】 請求項1において、 前記外部装置は前記揮発性メモリの第1のエリアに格納
される前記書き換えプログラムを有し、かつ前記不揮発
性メモリに前記外部装置からの書き換えプログラムを受
信して第1のエリアに転送する転送プログラムを格納す
ることを特徴とする電子機器。
2. The external device according to claim 1, wherein the external device has the rewrite program stored in a first area of the volatile memory, and receives the rewrite program from the external device in the nonvolatile memory. An electronic device for storing a transfer program for transferring data to a first area.
【請求項3】 請求項1において、 前記書き換えプログラムと,この書き換えプログラムを
前記揮発性メモリの第1のエリアに転送する転送プログ
ラムとを前記不揮発性メモリに格納することを特徴とす
る電子機器。
3. The electronic apparatus according to claim 1, wherein the rewriting program and a transfer program for transferring the rewriting program to a first area of the volatile memory are stored in the nonvolatile memory.
【請求項4】 請求項1ないし請求項3の何れかの請求
項において、 前記不揮発性メモリは複数のブロック単位で構成され、
データの部分書き換えを可能にしたことを特徴とする電
子機器。
4. The non-volatile memory according to claim 1, wherein the nonvolatile memory includes a plurality of blocks.
An electronic device characterized in that data can be partially rewritten.
【請求項5】 請求項1ないし請求項4の何れかの請求
項において、 表示手段と、前記不揮発性メモリのデータ書き換えの正
否をチェックするチェック手段と、チェック手段のチェ
ック結果がエラーとなる場合に表示手段にエラー表示を
行う手段とを備えたことを特徴とする電子機器。
5. The display device according to claim 1, wherein said display means, a check means for checking whether or not data rewriting of said nonvolatile memory is correct, and a check result of said check means result in an error. Means for displaying an error on the display means.
【請求項6】 請求項1ないし請求項5の何れかの請求
項において、 前記不揮発性メモリのデータ書き換えの終了後前記CP
Uの処理を前記不揮発性メモリのプログラム実行処理に
復帰させるリスタート手段を備えたことを特徴とする電
子機器。
6. The non-volatile memory according to claim 1, further comprising:
An electronic device comprising restart means for returning the process of U to the program execution process of the nonvolatile memory.
JP8123114A 1996-05-17 1996-05-17 Electronic equipment Pending JPH09305395A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP8123114A JPH09305395A (en) 1996-05-17 1996-05-17 Electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP8123114A JPH09305395A (en) 1996-05-17 1996-05-17 Electronic equipment

Publications (1)

Publication Number Publication Date
JPH09305395A true JPH09305395A (en) 1997-11-28

Family

ID=14852533

Family Applications (1)

Application Number Title Priority Date Filing Date
JP8123114A Pending JPH09305395A (en) 1996-05-17 1996-05-17 Electronic equipment

Country Status (1)

Country Link
JP (1) JPH09305395A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002297563A (en) * 2001-03-30 2002-10-11 Hitachi Ltd Microcomputer and data processing apparatus
JP2007008609A (en) * 2005-06-28 2007-01-18 Hitachi Ltd Elevator control device
JP2007249645A (en) * 2006-03-16 2007-09-27 Sanmei Electric Co Ltd Program change method
JP2010170579A (en) * 2010-04-19 2010-08-05 Renesas Technology Corp Data processor
JP2012079175A (en) * 2010-10-04 2012-04-19 Nec Corp Disk array device and firmware update method for the same

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002297563A (en) * 2001-03-30 2002-10-11 Hitachi Ltd Microcomputer and data processing apparatus
JP2007008609A (en) * 2005-06-28 2007-01-18 Hitachi Ltd Elevator control device
JP2007249645A (en) * 2006-03-16 2007-09-27 Sanmei Electric Co Ltd Program change method
JP2010170579A (en) * 2010-04-19 2010-08-05 Renesas Technology Corp Data processor
JP2012079175A (en) * 2010-10-04 2012-04-19 Nec Corp Disk array device and firmware update method for the same
US8713553B2 (en) 2010-10-04 2014-04-29 Nec Corporation Disk array apparatus and firmware update method therefor

Similar Documents

Publication Publication Date Title
US6601132B2 (en) Nonvolatile memory and method of writing data thereto
JP5173818B2 (en) Initializing flash storage via embedded controller
JP4534498B2 (en) Semiconductor device and its startup processing method
JP2007213571A (en) Method for starting system using direct memory access in novel memory architecture
JP2990181B1 (en) Flash memory, microcomputer having flash memory, and method of storing program in flash memory
US6745278B2 (en) Computer capable of rewriting an area of a non-volatile memory with a boot program during self mode operation of the computer
US5933595A (en) Computer apparatus having electrically rewritable nonvolatile memory, and nonvolatile semiconductor memory
JP3212960B2 (en) Data management method using flash memory
JP2000065899A (en) Semiconductor device, and its data rewriting method
JP2000099405A (en) Electronic equipment having flash memory
JPH09305395A (en) Electronic equipment
WO2001020541A1 (en) Entertainment device, data processing device and portable storage device
JP2002175193A (en) Device and method for rewriting program
JP2001022571A (en) Electronic equipment and rewriting method for control program of the equipment
JPH1011279A (en) Electronic appliance
JP2001344156A (en) Device with flash memory and data rewriting method
JPH09305394A (en) Electronic equipment
JP2005128613A (en) Image forming device
JP2001147863A (en) Flash memory rewrite device
JP4608174B2 (en) Entertainment device, information processing device, and portable storage device
JPH07122084A (en) Electronic device
JP3582432B2 (en) Communication terminal device and communication terminal device reset processing method
JP3281858B2 (en) Microcomputer evaluation device
JP2023020590A (en) Information processing apparatus and monitoring method
JP3131844B2 (en) Terminal device and memory dump transfer method for terminal device