JPH11327891A - Electronic equipment - Google Patents

Electronic equipment

Info

Publication number
JPH11327891A
JPH11327891A JP10138687A JP13868798A JPH11327891A JP H11327891 A JPH11327891 A JP H11327891A JP 10138687 A JP10138687 A JP 10138687A JP 13868798 A JP13868798 A JP 13868798A JP H11327891 A JPH11327891 A JP H11327891A
Authority
JP
Japan
Prior art keywords
program
rewriting
write
flag information
electronic device
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.)
Granted
Application number
JP10138687A
Other languages
Japanese (ja)
Other versions
JP4050824B2 (en
Inventor
Satoshi Fukuda
聡 福田
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.)
Panasonic System Solutions Japan Co Ltd
Original Assignee
Matsushita Graphic Communication Systems Inc
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 Matsushita Graphic Communication Systems Inc filed Critical Matsushita Graphic Communication Systems Inc
Priority to JP13868798A priority Critical patent/JP4050824B2/en
Publication of JPH11327891A publication Critical patent/JPH11327891A/en
Application granted granted Critical
Publication of JP4050824B2 publication Critical patent/JP4050824B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Landscapes

  • Stored Programmes (AREA)

Abstract

PROBLEM TO BE SOLVED: To prevent a system program from being erased or re-written by a misoperation and a malfunction. SOLUTION: It is judged whether the both of flags 'writing permission 1' and 'writing permission 2' are ON or not and an error is displayed so as to execute shift to power source OFF waiting unless the both are ON. In the meantime, when the both are ON, an output port signal is made to be a HIGH level and a writing permission signal (WR) is made to be effective. Then, the system program stored in a program flash memory 5 is erased. Then, the new system program is read from a personal computer 9 with a serial communication port (UART) and written in the program flash memory 5.

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 which operates according to a program stored in a flash memory. The present invention particularly relates to an electronic apparatus for preventing a program stored in a flash memory from being rewritten due to erroneous operation or erroneous operation.

【0002】[0002]

【従来の技術】近年、ノートパソコン、携帯情報端末
(PDA)等のような電子機器において、特開平7−8
4776号公報及び特開平10−11279号公報に開
示されているように、フラッシュメモリにシステムプロ
グラムを格納し、必要に応じて書き換えることが行われ
ている。
2. Description of the Related Art In recent years, electronic devices such as notebook personal computers, personal digital assistants (PDAs), etc.
As disclosed in Japanese Patent Application Laid-Open No. 4776 and Japanese Patent Application Laid-Open No. 10-11279, a system program is stored in a flash memory and rewritten as necessary.

【0003】フラッシュメモリは不揮発性メモリの一つ
であり、電源を切ってもデータが消えず、しかも書き換
えプログラムを実行して容易に書き換えが可能である。
この反面、誤操作により書き換えプログラムが実行さ
れ、システムプログラムが消去されてしまうと、電子機
器は正常に動作できなくなる。
A flash memory is one of non-volatile memories. Data is not erased even when the power is turned off, and can be easily rewritten by executing a rewriting program.
On the other hand, if the rewriting program is executed due to an erroneous operation and the system program is erased, the electronic device cannot operate normally.

【0004】従来、このような誤操作による消去、書き
換えを防止するため、特定のキーの押し下げながら電源
を入れることや、暗証番号を要求し、これらの条件を満
足した場合にのみ書き換えが行われるように、書き換え
プログラムに確認手順を設けることが行われている。
Conventionally, in order to prevent erasure and rewriting due to such erroneous operation, the power is turned on while a specific key is being depressed, a password is required, and rewriting is performed only when these conditions are satisfied. In some cases, a confirmation procedure is provided in a rewriting program.

【0005】[0005]

【発明が解決しようとする課題】しかし、電気的ノイズ
等の影響で書き換えプログラムが暴走した場合、誤って
書き込みモジュールが呼び出され、システムプログラム
が書き換えられてしまう可能性がある。
However, if the rewrite program runs away due to the influence of electrical noise or the like, the write module may be erroneously called and the system program may be rewritten.

【0006】また、正常に書き換えプログラムが実行さ
れている場合であっても、システムプログラム消去中や
書き込み中に電源を落とすと、電子機器が二度と立ち上
がらない。
Further, even when the rewriting program is normally executed, if the power is turned off during erasing or writing of the system program, the electronic device will not start up again.

【0007】本発明は、かかる点に鑑みてなされたもの
であり、第1にシステムプログラムが誤操作及び誤動作
により消去又は書き換えられるのを防止できる電子機器
を提供することを目的とする。
SUMMARY OF THE INVENTION The present invention has been made in view of the above points, and has as its first object to provide an electronic apparatus capable of preventing a system program from being erased or rewritten due to erroneous operation or erroneous operation.

【0008】本発明は、第2にシステムプログラムの消
去や書き換え中に誤って電源が落とされた場合でも復帰
可能な電子機器を提供することを目的とする。
A second object of the present invention is to provide an electronic device which can recover even if the power is accidentally turned off while erasing or rewriting a system program.

【0009】[0009]

【課題を解決するための手段】本発明は、上述の目的を
達成するため、以下の構成をとる。
The present invention has the following configuration to achieve the above object.

【0010】請求項1記載の電子機器に関する発明は、
プログラムを格納した不揮発性メモリと、前記プログラ
ムの書き換えを許可するフラグ情報を格納したメモリ
と、前記フラグ情報を書き換えるフラグ書き換え手段
と、前記フラグ情報に基づいて前記不揮発性メモリに対
するライト許可信号の有効/無効を制御するライト制御
手段と、前記ライト許可信号が有効な場合にプログラム
の書き換えを行う書き換え手段と、を具備する構成を採
る。
[0010] The invention relating to the electronic device according to claim 1 is as follows.
A non-volatile memory storing a program, a memory storing flag information for permitting rewriting of the program, a flag rewriting means for rewriting the flag information, and enabling a write permission signal for the non-volatile memory based on the flag information / Invalidation control means, and a rewriting means for rewriting a program when the write permission signal is valid.

【0011】この構成により、プログラムの書き換えを
開始すると、ライト制御手段は、フラグ情報が書き換え
許可を示しているか否か判断し、フラグ情報が書き換え
許可を示している場合にのみライト許可信号を有効とす
る。物理的な書き換えを行うライト許可信号の有効/無
効をフラグ情報に基づいて切り換えることにより、誤操
作及び誤動作によるプログラムを書き換えるのを防止で
きる。
With this configuration, when the rewriting of the program is started, the write control means determines whether or not the flag information indicates that rewriting is permitted, and activates the write permission signal only when the flag information indicates that rewriting is permitted. And By switching the validity / invalidity of the write permission signal for physically rewriting based on the flag information, it is possible to prevent the program from being rewritten due to erroneous operation or erroneous operation.

【0012】請求項2記載の発明は、請求項1記載の電
子機器の発明において、メモリは複数のフラグ情報を格
納し、前記複数のフラグ情報を書き換える条件は、所定
のプログラム書き換え手順で順次行われる操作に関連
し、ライト制御手段は前記複数のフラグ情報のいずれも
が書き換え許可を示す場合にライト許可信号を有効とす
る構成を採る。
According to a second aspect of the present invention, in the electronic apparatus of the first aspect, the memory stores a plurality of pieces of flag information, and the conditions for rewriting the plurality of pieces of flag information are sequentially stored in a predetermined program rewriting procedure. In connection with the operation to be performed, the write control means adopts a configuration in which the write permission signal is made valid when any of the plurality of flag information indicates rewrite permission.

【0013】この構成により、複数のフラグ情報の書き
換えは、プログラム書き換え手順で順次行われる操作、
例えば、電源を投入する際に所定のキーが押し下げられ
ていること、及び、暗証番号要求に対して正しい暗証番
号が入力されたこと等に関連して行われ、これらの操作
が正しく行われた場合にフラグ情報が書き換え許可にな
り、複数のフラグ情報のいずれもが書き換え許可を示す
場合にライト許可信号が有効になり、書き換え手段がプ
ログラムの書き換えを行う。従って、誤操作によるプロ
グラムの書き換えを防止することができる。また、請求
項1記載の発明と同様に、誤動作によりプログラムを書
き換えるのを防止できる。
[0013] With this configuration, the rewriting of the plurality of flag information can be performed sequentially by a program rewriting procedure.
For example, when the power is turned on, a predetermined key is depressed, and in response to the input of a correct password in response to the request for the password, the operation is performed. In this case, the flag information becomes rewrite-permitted, and when all of the plurality of flag information indicate rewrite permission, the write permission signal becomes valid, and the rewriting means rewrites the program. Therefore, rewriting of the program due to an erroneous operation can be prevented. Further, similarly to the first aspect, it is possible to prevent a program from being rewritten due to a malfunction.

【0014】請求項3記載の発明は、請求項1又は請求
項2記載の電子機器の発明において、ライト制御手段
は、プログラム書き換え手順の途中でフラグ情報の確認
を複数回行う構成を採る。
According to a third aspect of the present invention, there is provided the electronic device according to the first or second aspect, wherein the write control means checks the flag information a plurality of times during the program rewriting procedure.

【0015】この構成により、書き換え手順が異常に行
われ、一つのフラグ情報の確認を飛ばして書き換え手順
が進められたとしても、他のフラグ情報の確認でフラグ
情報が書き換え不可を示す場合、ライト制御手段はライ
ト許可信号を無効にする。従って、書き換え手段は書き
換えを行わないので、プログラムが書き換えられるのを
防止できる。
According to this configuration, even if the rewriting procedure is performed abnormally and the rewriting procedure proceeds without checking one piece of flag information, if the other flag information indicates that the rewriting procedure indicates that rewriting is not possible, the write The control means invalidates the write permission signal. Accordingly, since the rewriting means does not perform rewriting, it is possible to prevent the program from being rewritten.

【0016】請求項4記載の発明は、請求項1乃至請求
項3記載のいずれか記載の電子機器の発明において、不
揮発性メモリのプログラム格納領域に含まれる文字列情
報が所定の文字列と一致しない場合にプログラムの異常
として検知する検知手段を具備する構成を採る。
According to a fourth aspect of the present invention, in the electronic device according to any one of the first to third aspects, the character string information included in the program storage area of the nonvolatile memory matches the predetermined character string. If not, a configuration is provided that includes a detection unit that detects a program abnormality.

【0017】この構成により、プログラムの書き換え中
に誤って電源を切断したこと等によりプログラムに異常
があると、不揮発性メモリのプログラム格納領域に含ま
れる文字列情報が変わる。そこで、例えば電源投入後に
検知手段により不揮発性メモリのプログラム格納領域に
含まれる文字列情報が所定の文字列と一致するか否か調
べ、不一致の場合プログラムの異常として検知すること
ができる。これにより、オペレータはプログラムの書き
換えが正常に終了しなかったことを知ることができる。
With this configuration, if there is an abnormality in the program due to, for example, the power being cut off accidentally during rewriting of the program, the character string information included in the program storage area of the nonvolatile memory changes. Thus, for example, after the power is turned on, the detection unit checks whether or not the character string information included in the program storage area of the nonvolatile memory matches a predetermined character string. If the character string information does not match, it can be detected as a program abnormality. Thereby, the operator can know that the rewriting of the program has not been completed normally.

【0018】請求項5記載の発明は、請求項1乃至請求
項4記載のいずれか記載の電子機器の発明において、書
き込み手段は、不揮発性メモリのプログラム格納領域に
含まれる文字列情報が所定の文字列と一致する場合にフ
ラグ情報を不許可とする構成を採る。
According to a fifth aspect of the present invention, in the electronic device invention according to any one of the first to fourth aspects, the writing means stores the character string information contained in the program storage area of the nonvolatile memory in a predetermined manner. A configuration is adopted in which flag information is not permitted when it matches the character string.

【0019】この構成により、プログラムが正常な場合
に必ずフラグ情報は不許可を示すことになり、誤操作及
び誤動作によりプログラムが書き換えられるのを防止す
ることができる。
According to this configuration, when the program is normal, the flag information always indicates the non-permission, and it is possible to prevent the program from being rewritten due to erroneous operation or malfunction.

【0020】[0020]

【発明の実施の形態】以下、本発明の一実施の形態につ
いて図面を参照して説明する。
DESCRIPTION OF THE PREFERRED EMBODIMENTS One embodiment of the present invention will be described below with reference to the drawings.

【0021】図1は、本発明の実施の形態に係る電子機
器を示す概略構成図である。
FIG. 1 is a schematic configuration diagram showing an electronic apparatus according to an embodiment of the present invention.

【0022】CPU1は、電子機器の各部の制御を行う
演算処理回路である。シリアル通信ポート(UAR
T)、入力ポート1、出力ポート2、チップセレクト信
号端子CS1、CS2、CS3、アドレスバス端子(ア
ドレス)、データバス端子(データ)、リード信号端子
(RD)及びライト許可信号端子(WR)を備えてい
る。
The CPU 1 is an arithmetic processing circuit for controlling each part of the electronic device. Serial communication port (UAR
T), input port 1, output port 2, chip select signal terminals CS1, CS2, CS3, address bus terminal (address), data bus terminal (data), read signal terminal (RD), and write enable signal terminal (WR). Have.

【0023】CPU1のシリアル通信ポート(UAR
T)には、プログラムデータを転送するためのパーソナ
ルコンピュータ9が接続される。
The serial communication port (UAR) of the CPU 1
To T), a personal computer 9 for transferring program data is connected.

【0024】スタートキー2は、ファクシミリ送信動作
を開始するための操作キーであり、CPUの入力ポート
1に接続されている。
The start key 2 is an operation key for starting a facsimile transmission operation, and is connected to the input port 1 of the CPU.

【0025】リセット回路3は、電子機器のリセットを
行う回路である。リセット回路3は、電源スイッチ4が
オンされるとリセット信号をCPU1のリセット(RESE
T)端子に出力する。
The reset circuit 3 is a circuit for resetting an electronic device. When the power switch 4 is turned on, the reset circuit 3 sends a reset signal to the CPU 1 to reset (RESE).
Output to the T) terminal.

【0026】プログラム用フラッシュメモリ5は、プロ
グラム格納用の不揮発性メモリであり、システムプログ
ラム、消去プログラム、書き込みプログラム及びパワー
オンプログラムを含むプログラムを格納する。プログラ
ム用フラッシュメモリ5は、アドレスバス端子(アドレ
ス)、データバス端子(データ)、チップセレクト信号
(CS)、リード信号端子(RD)及びライト許可信号
端子(WR)を備えている。
The program flash memory 5 is a nonvolatile memory for storing programs, and stores programs including a system program, an erase program, a write program, and a power-on program. The program flash memory 5 includes an address bus terminal (address), a data bus terminal (data), a chip select signal (CS), a read signal terminal (RD), and a write enable signal terminal (WR).

【0027】SRAM6は、揮発性メモリであり、実行
するプログラムを一時的に格納すると共に、フラグを記
憶する。SRAM6は、アドレスバス端子(アドレ
ス)、データバス端子(データ)、チップセレクト信号
(CS)、リード信号端子(RD)及びライト許可信号
端子(WR)を備えている。
The SRAM 6 is a volatile memory that temporarily stores a program to be executed and also stores a flag. The SRAM 6 has an address bus terminal (address), a data bus terminal (data), a chip select signal (CS), a read signal terminal (RD), and a write enable signal terminal (WR).

【0028】データ用フラッシュメモリ7は、電子機器
が取り扱う、例えばファクス画像データのような画像デ
ータ等のデータを格納する不揮発性メモリである。デー
タ用フラッシュメモリ7は、アドレスバス端子(アドレ
ス)、データバス端子(データ)、チップセレクト信号
(CS)、リード信号端子(RD)及びライト許可信号
端子(WR)を備えている。
The data flash memory 7 is a non-volatile memory that stores data such as image data such as fax image data that is handled by the electronic device. The data flash memory 7 includes an address bus terminal (address), a data bus terminal (data), a chip select signal (CS), a read signal terminal (RD), and a write enable signal terminal (WR).

【0029】ゲート回路8は、ライト許可信号(WR)
の有効/無効の切替を行う。すなわち、ゲート回路8
は、出力ポート2からの信号がLOWレベルのときには、
CPU1のライト許可信号端子(WR)からのライト許
可信号(WR)を無効にし、出力ポート2の信号がHIGH
レベルの時はライト許可信号(WR)を有効とする。
The gate circuit 8 has a write enable signal (WR)
Is switched between valid and invalid. That is, the gate circuit 8
Is, when the signal from output port 2 is LOW level,
The write enable signal (WR) from the write enable signal terminal (WR) of the CPU 1 is invalidated, and the signal of the output port 2 becomes HIGH.
When the level is at the level, the write permission signal (WR) is made valid.

【0030】図2は、上記実施の形態に係るプログラム
用フラッシュメモリの格納エリアのアドレス配置を示す
模式図である。
FIG. 2 is a schematic diagram showing an address arrangement of a storage area of the program flash memory according to the above embodiment.

【0031】プログラム用フラッシュメモリ5のアドレ
スF80000hからアドレスFF0000hまでのエリア(以下、第
1エリアという)には、システムプログラムが格納され
ている。このシステムプログラム中には、システムプロ
グラムの初期化処理を行うリセット処理モジュールが含
まれている。システムプログラムの先頭及び最後にはユ
ニークパターン11がセットされている。ユニークパタ
ーンは、例えば「123456789」という任意の文
字列を用いることができる。
An area from address F80000h to address FF0000h of the program flash memory 5 (hereinafter referred to as a first area) stores a system program. This system program includes a reset processing module for performing initialization processing of the system program. A unique pattern 11 is set at the beginning and end of the system program. As the unique pattern, for example, an arbitrary character string “123456789” can be used.

【0032】プログラム用フラッシュメモリ5のアドレ
スFF0000hからアドレスFF8000hまでのエリア(以下、第
2エリアという)には、消去プログラム及び書き換えプ
ログラムが格納されている。また、プログラム用フラッ
シュメモリ5のアドレスFF8000h以降のエリア(以下、
第3エリアという)には、電源を入れたときに実行され
るパワーオンプログラムが格納されている。第2、第3
エリアには消去及び書き込みが行われないように保護が
かけられている。従って、プログラムの暴走及び誤操作
によって消去及び書き換えられることはない。
An area from address FF0000h to address FF8000h of the program flash memory 5 (hereinafter referred to as a second area) stores an erase program and a rewrite program. The area after address FF8000h of the program flash memory 5 (hereinafter, referred to as
The power-on program executed when the power is turned on is stored in the third area. Second, third
The area is protected from erasing and writing. Therefore, the program is not erased or rewritten due to runaway or erroneous operation of the program.

【0033】図3は、上記実施の形態に係る電子装置に
おけるシステムプログラムの書き換え動作を示すフロー
図である。
FIG. 3 is a flowchart showing an operation of rewriting a system program in the electronic device according to the above embodiment.

【0034】まず、通常動作について説明する。First, the normal operation will be described.

【0035】ステップ(以下、STという)301にお
いて、電源スイッチ4が入ると、パワーオンプログラム
が起動し、起動時処理を実行する。
In step (hereinafter referred to as ST) 301, when the power switch 4 is turned on, a power-on program is started, and a startup process is executed.

【0036】ST302において、電源をオンしたとき
にスタートキー2が押し下げられていたか否かを判定す
る。スタートキー2が押し下げられていない場合、ST
303に進む。ST303では、図2に示す第1エリア
に格納されたシステムプログラムの先頭及び最後が、ユ
ニークパターンに一致しているか否か判定する。ユニー
クパターンが一致し正常な場合には、ST304に進
む。
In ST302, it is determined whether or not the start key 2 has been depressed when the power was turned on. If the start key 2 is not depressed, ST
Go to 303. In ST303, it is determined whether the beginning and end of the system program stored in the first area shown in FIG. 2 match the unique pattern. If the unique patterns match and are normal, the process proceeds to ST304.

【0037】ST304では、SRAM6に記憶したラ
イト許可1及びライト許可2のフラグをオフする。ま
た、出力ポート2からの信号をLOWレベルとし、言い換
えれば出力ポート2からの信号をオフし、ライト許可信
号(WR)を無効とする。
In ST304, the write permission 1 and write permission 2 flags stored in the SRAM 6 are turned off. Further, the signal from the output port 2 is set to the LOW level, in other words, the signal from the output port 2 is turned off, and the write permission signal (WR) is invalidated.

【0038】ST305において、システムプログラム
のリセット処理、一般的にはパワーオン初期化処理を行
い、ST306において通常処理に移行する。
In ST305, a reset process of the system program, generally, a power-on initialization process is performed, and in ST306, the process shifts to a normal process.

【0039】上述のように通常使用時には、ライト許可
信号(WR)が常に無効となっているので、たとえシス
テムプログラムが暴走しても、プログラムが消去、書き
換えられることはない。
As described above, during normal use, the write enable signal (WR) is always invalid, so that even if the system program runs away, the program will not be erased or rewritten.

【0040】次に、システムプログラムの書き換え動作
について説明する。
Next, the rewriting operation of the system program will be described.

【0041】オペレータは、電源をオンするのと同時に
スタートキー2を押し下げる。
The operator depresses the start key 2 simultaneously with turning on the power.

【0042】ST302において、電源をオンしたとき
にスタートキー2が押し下げられていることを認識し、
ST307に進む。
In ST302, it is recognized that the start key 2 is depressed when the power is turned on.
Proceed to ST307.

【0043】ST307において、フラグ「ライト許可
1」をオンする。次いで、ST308において、暗証番
号入力を要求する。ST309において、暗証番号が正
常であるか否か判定する。暗証番号が異常である場合に
は、ST310において、エラーを表示し、ST311
において電源オフ待ちに移行する。一方、暗証番号が正
しい場合、ST312に進み、ライト許可2をオンす
る。
In ST307, the flag "write permission 1" is turned on. Next, in ST308, a request is made to input a personal identification number. In ST309, it is determined whether or not the password is normal. If the password is abnormal, an error is displayed in ST310 and ST311 is displayed.
The operation shifts to waiting for the power supply to stop. On the other hand, if the password is correct, the process proceeds to ST312, and write permission 2 is turned on.

【0044】ST313においては、フラグ「ライト許
可1」及び「ライト許可2」が両方オンか否か判断す
る。両者がオンでない場合、ST310に進み、エラー
を表示して電源オフ待ちに移行する。一方、両者がオン
の場合には、ST314に進み、出力ポートの信号をHI
GHレベルとして、ライト許可信号(WR)を有効にす
る。
In ST313, it is determined whether or not the flags "write permission 1" and "write permission 2" are both on. If both are not on, the process proceeds to ST310 to display an error and shift to power-off wait. On the other hand, if both are on, the process proceeds to ST314, where the signal of the output port is set to HI.
The write enable signal (WR) is made valid as the GH level.

【0045】ST315において、消去プログラム及び
書き換えプログラムをプログラム用フラッシュメモリ5
からSRAM6に転送する。フラッシュメモリは書き換
えや消去中にデータの読み出しができないので、フラッ
シュメモリ上にプログラムを置いたままでは消去や書き
換えを実行できないためである。
In ST315, the erase program and the rewrite program are stored in the program flash memory 5.
To the SRAM 6. This is because data cannot be read from the flash memory during rewriting or erasing, and thus erasing or rewriting cannot be performed while a program remains on the flash memory.

【0046】ST316において、SRAM6上の消去
プログラムを実行し、プログラム用フラッシュメモリ5
に格納したシステムプログラムを消去する。次に、ST
317において、SRAM6上の書き換えプログラムを
実行し、パーソナルコンピュータ9よりシリアル通信ポ
ート(UART)を介して、新しいシステムプログラム
を読み込み、プログラム用フラッシュメモリ5に書き込
む。ST316、317におけるプログラムの消去及び
書き込みは、ライト許可信号(WR)が有効であるとき
だけ行われる。
In ST316, the erase program on the SRAM 6 is executed, and the program flash memory 5 is executed.
Delete the system program stored in. Next, ST
At 317, the rewriting program on the SRAM 6 is executed, a new system program is read from the personal computer 9 via the serial communication port (UART), and written to the program flash memory 5. Erasing and writing of a program in ST316 and 317 are performed only when the write permission signal (WR) is valid.

【0047】次いで、ST318において、ライト許可
1及びライト許可2をオフし、また、出力ポートの信号
をLOWレベルとして、ライト許可信号(WR)を無効に
する。
Next, in ST318, the write permission 1 and the write permission 2 are turned off, and the signal of the output port is set to the LOW level to invalidate the write permission signal (WR).

【0048】ST319において、システムプログラム
のリセット処理を実行して、プログラム書き換え処理を
終了する。
In ST319, the system program is reset, and the program rewriting process ends.

【0049】上述のように、システムプログラムの書き
換え手順で順次行われる、電源オン及び暗証番号入力に
関連して複数のフラグを立てているので、フラグが両方
立っていない場合には、システムプログラムが書き換え
られることはなく、確実に誤操作によるプログラムの消
去及び書き換えを防止できる。
As described above, since a plurality of flags are set in relation to the power-on and the input of the personal identification number, which are sequentially performed in the rewriting procedure of the system program, if both the flags are not set, the system program is reset. The program is not rewritten, and erasure and rewriting of the program due to erroneous operation can be reliably prevented.

【0050】以下、プログラムの消去及び書き換えをさ
らに詳細に説明する。
Hereinafter, erasing and rewriting of the program will be described in more detail.

【0051】SRAM等の揮発性メモリは、プログラム
アドレスにプログラムデータを書き込むだけで書き込み
終了となる。しかし、フラッシュメモリは、所定の一連
の処理(シーケンス)でないと書き込みができないよう
に設計されている。従って、通常はこのシーケンスをモ
ジュール化し、モジュールコールという形でプログラム
の書き換えを行う。
In a volatile memory such as an SRAM, writing is completed only by writing program data to a program address. However, the flash memory is designed so that writing cannot be performed unless a predetermined series of processing (sequence) is performed. Therefore, normally, this sequence is modularized, and the program is rewritten in the form of a module call.

【0052】図4は、上記実施の形態に係る電子機器に
おける書き込みモジュールの動作を示すフロー図であ
る。
FIG. 4 is a flowchart showing the operation of the writing module in the electronic device according to the above embodiment.

【0053】本実施の形態では、プログラム用フラッシ
ュメモリ5は、アドレス1にコマンド1を書き込み、次
にアドレス2にコマンド2を書き込み、最後にアドレス
1にコマンド3を書き込む一連の処理を行わないと、デ
ータ書き込みができないように設計されている。
In this embodiment, the program flash memory 5 does not perform a series of processing for writing the command 1 at the address 1, then writing the command 2 at the address 2, and finally writing the command 3 at the address 1. It is designed so that data cannot be written.

【0054】ST401においては、ライト許可1及び
ライト許可2が両方オンか否か判断する。両者が両方オ
ンでない場合、ST402においてライト許可1及びラ
イト許可2をオフし、出力ポート2の信号をLAWレベル
として、ライト許可信号(WR)を無効にする。その
後、ST403において、システムプログラムのリセッ
ト処理を行う。
In ST401, it is determined whether write permission 1 and write permission 2 are both on. If both are not on, write permission 1 and write permission 2 are turned off in ST402, the signal of output port 2 is set to the LAW level, and the write permission signal (WR) is invalidated. Thereafter, in ST403, the system program is reset.

【0055】ST401で両者が両方オンである場合、
ST404において、プログラム用フラッシュメモリ5
のアドレス1にコマンド1を書き込む。次いで、ST4
05において、アドレス2にコマンド2を書き込む。
If both are on in ST401,
In ST404, the program flash memory 5
Write command 1 to address 1 of Next, ST4
At 05, command 2 is written to address 2.

【0056】ST406においては、ライト許可1及び
ライト許可2が両方オンか否か判断する。両者が両方オ
ンでない場合、ST407においてライト許可1及びラ
イト許可2をオフし、出力ポート2の信号をLAWレベル
として、ライト許可信号(WR)を無効にする。その
後、ST408において、システムプログラムのリセッ
ト処理を行う。
In ST406, it is determined whether both write permission 1 and write permission 2 are on. If both are not on, write permission 1 and write permission 2 are turned off in ST407, the signal of output port 2 is set to the LAW level, and the write permission signal (WR) is invalidated. Thereafter, in ST408, the system program is reset.

【0057】ST406で両者が両方オンである場合、
ST409において、プログラム用フラッシュメモリ5
のアドレス1にコマンド3を書き込む。
If both are on in ST406,
In ST409, the program flash memory 5
Write command 3 to address 1 of

【0058】ST410において、プログラムアドレス
にプログラムデータを書き込む。次いで、ST411に
おいて、プログラムフラッシュメモリ5のデータポーリ
ングを行う。その後、ST412において、プログラム
が正常に終了したか否か判断する。異常の場合には、S
T413に進み、エラー処理を行う。一方、正常な場合
には書き込み処理を終了する。
In ST410, program data is written to a program address. Next, in ST411, data polling of the program flash memory 5 is performed. Then, in ST412, it is determined whether or not the program has been completed normally. If abnormal, S
Proceeding to T413, error processing is performed. On the other hand, if it is normal, the writing process ends.

【0059】従って、書き込みモジュールは、ST40
4、ST405及びST409のシーケンスを経て始め
て、プログラムを書き込むことができる。そして、ST
401及びST406において、フラグが書き換え許可
を示していることを確認しているため、誤操作によりプ
ログラムの書き込みが行われるのを防止することができ
る。
Therefore, the writing module performs at ST40
4. A program can be written only after the sequence of ST405 and ST409. And ST
In steps 401 and ST406, it is confirmed that the flag indicates that rewriting is permitted, so that it is possible to prevent the program from being written due to an erroneous operation.

【0060】上述のように、プログラム用フラッシュメ
モリ5のライト許可信号(WR)が有効となるのは、電
源をオンするときにスタートキー2を押し下げたこと、
及び、暗証番号が正常であることの両方が満たされた場
合にのみとなり、誤操作によりシステムプログラムが消
去及び書き換えられることはない。
As described above, the write permission signal (WR) of the program flash memory 5 becomes effective when the start key 2 is depressed when the power is turned on.
Also, this is only when both the passwords are normal and the system program is not erased or rewritten due to an erroneous operation.

【0061】次にシステムプログラムが暴走して、図3
に示すST314のライト許可信号を有効にする処理に
プログラムが飛んできた場合について説明する。
Next, the system program runs away, and FIG.
The case where the program jumps to the processing for enabling the write permission signal in ST314 shown in FIG.

【0062】本実施の形態に係る電子機器のように、デ
ータ用フラッシュメモリ7を搭載している場合、システ
ムプログラムは、フラッシュメモリを消去及び書き換え
るプログラムが存在する。このため、システムプログラ
ムが暴走してシステムプログラム用フラッシュメモリ5
に対して、消去及び書き換えを実行しようとすることが
ある。
When the data flash memory 7 is mounted as in the electronic apparatus according to the present embodiment, the system program includes a program for erasing and rewriting the flash memory. As a result, the system program runs away and the system program flash memory 5
May be attempted to be erased and rewritten.

【0063】図4に示すように、書き込みモジュールで
は、ライト許可1及びライト許可2が両方オンになって
いない場合、ST401及びST406の確認処理で検
出し、ST402及びST407で、ライト許可1及び
ライト許可2をオフし、ライト許可信号(WR)を無効
にして、ST403及びST407のシステムプログラ
ムのリセット処理へ進む。従って、フラッシュメモリの
書き込みはST404、ST405及びST409のシ
ーケンスが順番通りに実行されないと行われないため、
プログラムの書き換えを防止することができる。
As shown in FIG. 4, in the write module, when both the write permission 1 and the write permission 2 are not turned on, the write module detects the write permission 1 and the write permission 1 in the ST402 and ST407. The permission 2 is turned off, the write permission signal (WR) is invalidated, and the process proceeds to ST403 and ST407, the resetting process of the system program. Therefore, writing to the flash memory is not performed unless the sequence of ST404, ST405, and ST409 is executed in order.
Rewriting of the program can be prevented.

【0064】また、ST404のアドレス1にコマンド
1を書き込む処理にプログラムが暴走してきた場合で
も、ST406においてフラグを確認するためにシステ
ムプログラムが書き変わることはない。
Even if the program goes out of control in the process of writing command 1 to address 1 in ST404, the system program is not rewritten to confirm the flag in ST406.

【0065】同様に消去シーケンスにも同じ判定を用い
ることにより、システムプログラムが不正に消去される
のを防ぐことができる。
Similarly, by using the same judgment for the erase sequence, it is possible to prevent the system program from being illegally erased.

【0066】上述のように、システムプログラムが暴走
してST314に飛んできても、フラグがオンでないた
め、書き込みモジュールでのST401及びST406
での確認処理でエラーとなり、書き込みシーケンスが順
番通りに実行されない。この結果、システムプログラム
が間違って書き込まれることが防止できる。
As described above, even if the system program runs away and jumps to ST314, the flag is not ON, so that ST401 and ST406 in the write module are executed.
An error occurs in the confirmation process in step 2, and the write sequence is not executed in order. As a result, erroneous writing of the system program can be prevented.

【0067】さらに、書き込みモジュールの書き込みシ
ーケンスの途中でフラグの確認を行っているので(ST
406)、システムプログラムの暴走によりST404
に飛んでしまってもシステムプログラムが間違って書き
込まれるのを防止できる。この結果、プログラムの暴走
に対してフラッシュメモリのプログラムの信頼性を飛躍
的に向上することができる。
Further, since the flag is confirmed during the write sequence of the write module (ST
406), ST404 due to runaway of the system program
It is possible to prevent the system program from being erroneously written even if it jumps to the server. As a result, the reliability of the program in the flash memory against the program runaway can be significantly improved.

【0068】次にシステムプログラムの消去中や書き込
み中に誤って電源がオフになった場合について説明す
る。
Next, a case where the power is turned off by mistake during erasing or writing of the system program will be described.

【0069】システムプログラムの消去及び書き込み中
に誤って電源がオフになった場合、プログラムの書き換
えが正常に終了していないので、システムプログラムの
先頭及び最後の少なくとも一方は「00」又は「FF」
にセットされる。このため、システムプログラムの先頭
又は最後の文字列は、パワーオンプログラムに保存され
たユニークパターン11と一致しなくなる。従って、図
3に示すST303のユニークパターン判定でエラーと
なり、ST310に進み、エラーを表示し、S311に
おいて電源オフ待ちになる。オペレータは、一度電源を
オフし、再度スタートキー2を押し下げながら電源をオ
ンして、システムプログラムの書き換えを行う。以上の
動作により、正常にシステムプログラムの書き換えを行
えば、電子装置が正常動作するようになる。この結果、
システムプログラムの書き換えに以上があっても簡単に
電子機器の機能を回復することができる。
If the power is accidentally turned off during the erasing and writing of the system program, at least one of the beginning and end of the system program is "00" or "FF" because the rewriting of the program is not completed normally.
Is set to For this reason, the first or last character string of the system program does not match the unique pattern 11 stored in the power-on program. Accordingly, an error occurs in the unique pattern determination in ST303 shown in FIG. 3, the process proceeds to ST310, an error is displayed, and the power supply waits in S311. The operator turns off the power once, turns on the power while depressing the start key 2 again, and rewrites the system program. With the above operation, if the system program is normally rewritten, the electronic device operates normally. As a result,
Even if the system program is rewritten, the function of the electronic device can be easily restored.

【0070】[0070]

【発明の効果】以上の説明から明らかなように、本発明
によれば、不揮発性メモリに搭載されたプログラムが、
誤操作及び誤動作により消去又は書き換えられるのを防
止することができる。また、プログラムの暴走に対して
不揮発性メモリのプログラムの信頼性を飛躍的に向上す
ることができる。
As is apparent from the above description, according to the present invention, the program mounted on the nonvolatile memory is:
Erasure or rewriting due to erroneous operation or erroneous operation can be prevented. Further, the reliability of the program in the nonvolatile memory against the program runaway can be remarkably improved.

【0071】また、本発明によれば、システムプログラ
ムの消去及び書き換えが正常に終了しなかった場合にも
簡単に電子機器の機能を復帰させることができる。
Further, according to the present invention, the function of the electronic device can be easily restored even when the erasing and rewriting of the system program are not completed normally.

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

【図1】本発明の実施の形態に係る電子機器を示す概略
構成図
FIG. 1 is a schematic configuration diagram showing an electronic device according to an embodiment of the present invention.

【図2】上記実施の形態に係るプログラム用フラッシュ
メモリの格納エリアのアドレス配置を示す模式図
FIG. 2 is a schematic diagram showing an address arrangement of a storage area of a program flash memory according to the embodiment;

【図3】上記実施の形態に係る電子装置におけるシステ
ムプログラムの書き換え動作を示すフロー図
FIG. 3 is a flowchart showing an operation of rewriting a system program in the electronic device according to the embodiment;

【図4】上記実施の形態に係る電子機器における書き込
みモジュールの動作を示すフロー図
FIG. 4 is a flowchart showing an operation of a writing module in the electronic device according to the embodiment.

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

1 CPU 2 スタートキー 3 リセット回路 4 電源スイッチ 5 プログラム用フラッシュメモリ 6 SRAM 7 データ用フラッシュメモリ 8 ゲート回路 DESCRIPTION OF SYMBOLS 1 CPU 2 Start key 3 Reset circuit 4 Power switch 5 Flash memory for program 6 SRAM 7 Flash memory for data 8 Gate circuit

Claims (5)

【特許請求の範囲】[Claims] 【請求項1】 プログラムを格納した不揮発性メモリ
と、前記プログラムの書き換えを許可するフラグ情報を
格納したメモリと、所定条件の場合に前記フラグ情報を
書き換えるフラグ書き換え手段と、前記フラグ情報に基
づいて前記不揮発性メモリに対するライト許可信号の有
効/無効を制御するライト制御手段と、前記ライト許可
信号が有効な場合にプログラムの書き換えを行う書き換
え手段と、を具備することを特徴とする電子機器。
A nonvolatile memory for storing a program, a memory for storing flag information for permitting rewriting of the program, a flag rewriting means for rewriting the flag information under a predetermined condition, An electronic apparatus comprising: a write control unit that controls whether a write permission signal for the nonvolatile memory is valid / invalid; and a rewriting unit that rewrites a program when the write permission signal is valid.
【請求項2】 メモリは複数のフラグ情報を格納し、前
記複数のフラグ情報を書き換える条件は、所定のプログ
ラム書き換え手順で順次行われる操作に関連し、ライト
制御手段は前記複数のフラグ情報のいずれもが書き換え
許可を示す場合にライト許可信号を有効とすることを特
徴とする請求項1記載の電子機器。
2. The memory according to claim 1, wherein the memory stores a plurality of pieces of flag information, and the condition for rewriting the plurality of pieces of flag information relates to an operation sequentially performed in a predetermined program rewriting procedure. 2. The electronic device according to claim 1, wherein the write enable signal is made valid when the device indicates rewrite permission.
【請求項3】 ライト制御手段は、プログラム書き換え
手順の途中でフラグ情報の確認を複数回行うことを特徴
とする請求項1又は請求項2記載の電子機器。
3. The electronic device according to claim 1, wherein the write control unit checks the flag information a plurality of times during the program rewriting procedure.
【請求項4】 不揮発性メモリのプログラム格納領域に
含まれる文字列情報が所定の文字列と一致しない場合に
プログラムの異常として検知する検知手段を具備するこ
とを特徴とする請求項1乃至請求項3のいずれか記載の
電子機器。
4. The apparatus according to claim 1, further comprising a detection unit configured to detect an abnormality in the program when character string information included in a program storage area of the nonvolatile memory does not match a predetermined character string. 3. The electronic device according to any one of 3.
【請求項5】 フラグ書き換え手段は、不揮発性メモリ
のプログラム格納領域に含まれる文字列情報が所定の文
字列と一致する場合にフラグ情報を不許可とすることを
特徴とする請求項1乃至請求項4のいずれか記載の電子
機器。
5. The flag rewriting means for rejecting flag information when character string information included in a program storage area of a nonvolatile memory matches a predetermined character string. Item 5. An electronic device according to any one of Items 4.
JP13868798A 1998-05-20 1998-05-20 Electronics Expired - Fee Related JP4050824B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP13868798A JP4050824B2 (en) 1998-05-20 1998-05-20 Electronics

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP13868798A JP4050824B2 (en) 1998-05-20 1998-05-20 Electronics

Publications (2)

Publication Number Publication Date
JPH11327891A true JPH11327891A (en) 1999-11-30
JP4050824B2 JP4050824B2 (en) 2008-02-20

Family

ID=15227771

Family Applications (1)

Application Number Title Priority Date Filing Date
JP13868798A Expired - Fee Related JP4050824B2 (en) 1998-05-20 1998-05-20 Electronics

Country Status (1)

Country Link
JP (1) JP4050824B2 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007249645A (en) * 2006-03-16 2007-09-27 Sanmei Electric Co Ltd Program change method
JP2008009798A (en) * 2006-06-30 2008-01-17 Matsushita Electric Ind Co Ltd Software correction device
JP2009251954A (en) * 2008-04-07 2009-10-29 Sony Ericsson Mobilecommunications Japan Inc Software-updating system, software-updating method, portable terminal, and program

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007249645A (en) * 2006-03-16 2007-09-27 Sanmei Electric Co Ltd Program change method
JP2008009798A (en) * 2006-06-30 2008-01-17 Matsushita Electric Ind Co Ltd Software correction device
JP2009251954A (en) * 2008-04-07 2009-10-29 Sony Ericsson Mobilecommunications Japan Inc Software-updating system, software-updating method, portable terminal, and program

Also Published As

Publication number Publication date
JP4050824B2 (en) 2008-02-20

Similar Documents

Publication Publication Date Title
JP2755828B2 (en) Secure application card for sharing application data and procedures between multiple microprocessors
US7281101B2 (en) Memory device storing data relating to specific application programs
TWI242128B (en) Data processing system and data processing method
US8397042B2 (en) Secure memory interface
RU2187147C2 (en) Stealing protection device
US8171192B2 (en) Hardware-assisted device configuration detection
WO1998030958A1 (en) Secure multiple application ic card system
JPH0350314B2 (en)
US20060150255A1 (en) Manipulation-protected microcontroller system
CN112560120B (en) Secure memory bank and method for starting secure memory bank
US7284132B2 (en) Memory card
JP2004005679A (en) Computer system, memory structure, and method of executing program
US7836219B1 (en) System and method for authentication of embedded RAID on a host RAID card
JP2000112824A (en) Memory system
JPH11327891A (en) Electronic equipment
JP2005512192A (en) How to synchronize cache memory with main memory
EP1079340A2 (en) Integrated circuit card protected from unauthorized access
JP4104990B2 (en) Memory card
JPH10301854A (en) Chip card and method for importing information on the same
JPH07175725A (en) Semiconductor memory device
JP2000357216A (en) Ic card
JPH1145206A (en) Electronic device, memory starting method, and record medium recording memory starting program
US20050015629A1 (en) Portable non-volatile memory device and data security method of same
JP2003345657A (en) Reading and writing system and erasing system for recording medium and recording medium embodying the reading and writing system and erasing system
US7806319B2 (en) System and method for protection of data contained in an integrated circuit

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20050322

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20070116

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20070308

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20070821

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20071005

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: 20071106

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20071130

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20101207

Year of fee payment: 3

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20101207

Year of fee payment: 3

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20111207

Year of fee payment: 4

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20111207

Year of fee payment: 4

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20121207

Year of fee payment: 5

LAPS Cancellation because of no payment of annual fees