JP2001147863A - Flash memory rewrite device - Google Patents

Flash memory rewrite device

Info

Publication number
JP2001147863A
JP2001147863A JP32825699A JP32825699A JP2001147863A JP 2001147863 A JP2001147863 A JP 2001147863A JP 32825699 A JP32825699 A JP 32825699A JP 32825699 A JP32825699 A JP 32825699A JP 2001147863 A JP2001147863 A JP 2001147863A
Authority
JP
Japan
Prior art keywords
flash memory
user program
rewriting
program
emulation
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
JP32825699A
Other languages
Japanese (ja)
Inventor
Yoshihiro Kawase
義博 川瀬
Atsushi Yamaguchi
惇 山口
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.)
Denso Corp
Original Assignee
Denso Corp
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 Denso Corp filed Critical Denso Corp
Priority to JP32825699A priority Critical patent/JP2001147863A/en
Publication of JP2001147863A publication Critical patent/JP2001147863A/en
Pending legal-status Critical Current

Links

Abstract

PROBLEM TO BE SOLVED: To provide a flash memory rewrite device capable of communicating with an outside tool even when the rewriting of a user program including a communication program fails. SOLUTION: An emulation device 1 is provided with an evaluation chip 2, a flash memory 3 and an emulation RAM 4. The flash memory 3 stores a prescribed user program including a program for communicating with an outside tool 10. Firmware is operated by the EVA chip 2 so that communication with an outside tool can be attained according to a writing request from the outside tool 10. At that time, a user program in the flash memory 3 is rewritten by the EVA chip 2, and whether or not the rewriting of the user program is normally ended is judged.

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【発明の属する技術分野】本発明は、所定のプログラム
を格納するフラッシュメモリを備え、そのプログラムの
書き替えを行うフラッシュメモリ書き替え装置に関する
ものである。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a flash memory rewriting device having a flash memory for storing a predetermined program and rewriting the program.

【0002】[0002]

【従来の技術】従来、この種の装置として、フラッシュ
メモリにおける一部の領域に、外部ツールと通信するた
めの通信プログラムをユーザプログラムと共に格納し、
その通信プログラムを用いてフラッシュメモリのプログ
ラムを書き替えるものが知られている。
2. Description of the Related Art Conventionally, as this type of device, a communication program for communicating with an external tool is stored in a partial area of a flash memory together with a user program.
It is known to rewrite a flash memory program using the communication program.

【0003】詳述すると、図6に示すマイコン(フラッ
シュメモリ書き替え装置)20は、フラッシュメモリ2
1と、RAM22とを備えている。フラッシュメモリ2
1には、各種制御を実行するためのユーザプログラムが
格納されている。ユーザプログラムは、その一部に通信
プログラムを有しており、同通信プログラムが処理され
ることでマイコン20と外部ツール23との間で通信が
行われる。
More specifically, a microcomputer (flash memory rewriting device) 20 shown in FIG.
1 and a RAM 22. Flash memory 2
1 stores a user program for executing various controls. The user program has a communication program in a part thereof, and communication between the microcomputer 20 and the external tool 23 is performed by processing the communication program.

【0004】そして、ユーザプログラムの書き替えの際
には、図6(a)に示すように、外部ツール23からマ
イコン20に対して書き替え要求が発行される。する
と、図6(b)に示すように、マイコン20は、通信プ
ログラムを実行することで、外部ツール23又はマイコ
ン20内に予め用意されている書き替えプログラムをR
AM22に転送する。その後、図6(c)に示すよう
に、マイコン20は、RAM22上の書き替えプログラ
ムを実行することで、通信プログラムを含む新規ユーザ
プログラムを外部ツール23からRAM22に一旦ロー
ドしてフラッシュメモリ21を書き替えるようになって
いる。
When a user program is rewritten, a rewrite request is issued from the external tool 23 to the microcomputer 20, as shown in FIG. Then, as shown in FIG. 6B, the microcomputer 20 executes the communication program to execute the external tool 23 or the rewriting program prepared in the microcomputer 20 in advance.
Transfer to AM22. Thereafter, as shown in FIG. 6C, the microcomputer 20 executes the rewriting program on the RAM 22 to temporarily load the new user program including the communication program from the external tool 23 into the RAM 22 and store the new user program in the flash memory 21. It is rewritten.

【0005】[0005]

【発明が解決しようとする課題】ところが、上記書き替
え方法により通信プログラムを含むユーザプログラムの
書き替えを行う場合に、電源の遮断やノイズ等の影響に
よってフラッシュメモリ21の書き替えが失敗すると、
フラッシュメモリ21には、正しく動作しないプログラ
ムが存在することになる。つまり、フラッシュメモリ2
1には、正常な通信プログラムが存在せず、同フラッシ
ュメモリ21の書き替えが実施できなくなる。
However, when the user program including the communication program is rewritten by the above-described rewriting method, if the rewriting of the flash memory 21 fails due to the influence of power cutoff, noise, or the like,
A program that does not operate correctly exists in the flash memory 21. That is, the flash memory 2
No. 1 does not have a normal communication program, so that the flash memory 21 cannot be rewritten.

【0006】そこで従来では、これを避ける方法とし
て、外部ツール23と通信するためのプログラムが格納
される領域を消去せず、それ以外の領域の書き替えを実
施する方法が採用されている。
Therefore, conventionally, as a method for avoiding this, a method is employed in which an area for storing a program for communicating with the external tool 23 is not erased, but the other area is rewritten.

【0007】ところで、フラッシュメモリ21は、複数
のブロックに分割され、書き替え時では、このブロック
毎にデータが消去されるようになっている。具体的に
は、図7に示すように、256キロバイト(KB)の記
憶容量を有するフラッシュメモリ21では、例えば、6
4KBの4つのブロック21aに分割され、このブロッ
ク21a毎にデータの消去が実施される。また、フラッ
シュメモリ21に格納される前記通信プログラムは、通
常2〜4KBのサイズとなっている。従って、上述した
ように、通信プログラムが格納される領域を消去しない
方法を採用すると、通信プログラム(2〜4KB)のた
めに消去しないブロックサイズ(64KB)が必要以上
に大きくなり、記憶領域が無駄になるといった問題も生
じてしまう。
Incidentally, the flash memory 21 is divided into a plurality of blocks, and at the time of rewriting, data is erased for each block. Specifically, as shown in FIG. 7, in the flash memory 21 having a storage capacity of 256 kilobytes (KB), for example,
It is divided into four 4 KB blocks 21a, and data is erased for each block 21a. Further, the communication program stored in the flash memory 21 usually has a size of 2 to 4 KB. Therefore, as described above, if the method of not erasing the area storing the communication program is adopted, the block size (64 KB) that is not erased for the communication program (2 to 4 KB) becomes unnecessarily large, and the storage area is wasted. Problem.

【0008】本発明は、上記問題に着目してなされたも
のであって、その目的とするところは、通信プログラム
を含むユーザプログラムの書き替えに失敗したとして
も、外部ツールとの間で通信することができるフラッシ
ュメモリ書き替え装置を提供することである。
The present invention has been made in view of the above problems, and has as its object to communicate with an external tool even if rewriting of a user program including a communication program fails. It is an object of the present invention to provide a flash memory rewriting device capable of performing the above.

【0009】[0009]

【課題を解決するための手段】上記目的を達成するため
に、請求項1に記載の発明によれば、外部ツールからの
書き替え要求に伴い、通信手段により外部ツールとの間
で通信が行われ、その際、書き替え手段によりフラッシ
ュメモリ内に格納されるユーザプログラムが書き替えら
れる。また、判定手段によって、ユーザプログラムの書
き替えが正常に完了したか否かが判定され、その判定し
た結果が記憶される。この場合、仮にフラッシュメモリ
の書き替えが失敗しても、それが判定でき、その際に、
前記通信プログラムとは別に設けた通信手段により外部
ツールとの間で通信することができる。つまり、書き替
えが失敗したときに正常に動作できなくなる通信プログ
ラムを介すことなく外部ツールとの間で通信できる。そ
の結果、ユーザプログラムの再書き替えが実施できなく
なるといった不都合は生じることはなく、ユーザプログ
ラムの書き替えが適正に実施できる。
According to the first aspect of the present invention, communication with an external tool is performed by a communication unit in response to a rewrite request from the external tool. At this time, the user program stored in the flash memory is rewritten by the rewriting means. The determining means determines whether or not the rewriting of the user program has been normally completed, and stores the determined result. In this case, even if rewriting of the flash memory fails, it can be determined, and at that time,
Communication with an external tool can be performed by communication means provided separately from the communication program. That is, it is possible to communicate with an external tool without going through a communication program that cannot operate normally when the rewriting fails. As a result, there is no inconvenience that the user program cannot be rewritten, and the user program can be properly rewritten.

【0010】請求項2に記載の発明によれば、ユーザプ
ログラムの書き替えが未完了の旨が判定されたとき、ユ
ーザプログラムの実行が禁止される。一方、ユーザプロ
グラムの書き替えが正常に完了した旨が判定されたと
き、その書き替え完了後のユーザプログラムの実行が許
可される。この場合、書き替えに失敗したユーザプログ
ラムが誤って実行されることを回避できる。
According to the second aspect of the invention, when it is determined that the rewriting of the user program is not completed, the execution of the user program is prohibited. On the other hand, when it is determined that the rewriting of the user program has been completed normally, execution of the user program after the completion of the rewriting is permitted. In this case, it is possible to prevent the user program whose rewriting has failed from being executed by mistake.

【0011】請求項3に記載の発明によれば、ユーザプ
ログラムの書き替え状態がフラッシュメモリに記憶され
る。つまり、ユーザプログラムと、フラッシュメモリの
書き替え状態とが共通のフラッシュメモリに格納される
ので、ユーザプログラムと、フラッシュメモリの書き替
え状態とを別々のメモリに格納するものと比較して、コ
スト的に有利となる。
According to the third aspect of the invention, the rewrite state of the user program is stored in the flash memory. That is, since the user program and the rewrite state of the flash memory are stored in the common flash memory, the cost of the user program and the rewrite state of the flash memory are lower than those stored in separate memories. This is advantageous.

【0012】請求項4に記載の発明によれば、起動時に
実行されるファームウエアにより外部ツールとの間で通
信が行われ、その際、フラッシュメモリのユーザプログ
ラムの書き替えが実施される。つまり、ユーザプログラ
ムよりも先に実行されるファームウエアにより外部ツー
ルとの間で通信を行うことができ、ユーザプログラムの
書き替えが適正に実施できる。
According to the fourth aspect of the present invention, communication between the external tool and the external tool is performed by firmware executed at the time of startup, and at this time, the user program in the flash memory is rewritten. That is, communication with the external tool can be performed by firmware executed before the user program, and the user program can be appropriately rewritten.

【0013】フラッシュメモリに格納されるユーザプロ
グラムのエミュレーションを行うためのエミュレーショ
ン装置では、請求項5に記載の発明のように、フラッシ
ュメモリのユーザプログラムがエミュレーションRAM
に転送され、ユーザプログラムのエミュレーションが実
施される。この装置において、エミュレーションRAM
上のユーザプログラムをフラッシュメモリに書き込むこ
とで、フラッシュメモリの書き替えが実施できる。具体
的には、外部ツールからエミュレーションRAM上に転
送された新規のユーザプログラム、または、エミュレー
ションにて変更されたエミュレーションRAM上のユー
ザプログラムをフラッシュメモリに書き替えることがで
きる。
According to an emulation apparatus for emulating a user program stored in a flash memory, a user program in a flash memory is emulated in an emulation RAM.
And emulation of the user program is performed. In this device, the emulation RAM
By writing the above user program into the flash memory, the flash memory can be rewritten. Specifically, a new user program transferred from an external tool onto the emulation RAM or a user program on the emulation RAM changed by emulation can be rewritten to the flash memory.

【0014】[0014]

【発明の実施の形態】以下、この発明を具体化した実施
の形態を図面に従って説明する。本実施の形態では、車
両制御システムの開発に際して適用されるエミュレーシ
ョン装置に具体化している。
Embodiments of the present invention will be described below with reference to the drawings. In the present embodiment, the present invention is embodied in an emulation device applied when developing a vehicle control system.

【0015】車両制御システムは、電子制御装置(EC
U)を備えて構成され、この電子制御装置に搭載される
マイコンによって各種制御が実施されるようになってい
る。それ故、車両制御システムの開発段階では、マイコ
ンに組み込まれるユーザプログラムにおける制御データ
等を最適な値に適合するために、システムに使用される
マイコンと同等の機能を有しかつエミュレート機能を有
するエミュレーション装置が使用される。なお、本実施
の形態におけるエミュレーション装置は、機能ブロック
を構成する複数の半導体チップを1枚の基板上に高密度
に実装したマルチチップモジュール(MCM)として実
現され、そのエミュレーション装置が電子制御装置(E
CU)に搭載されるようになっている。
The vehicle control system includes an electronic control unit (EC)
U), and various controls are performed by a microcomputer mounted on the electronic control device. Therefore, in the development stage of the vehicle control system, it has a function equivalent to the microcomputer used in the system and has an emulation function in order to adapt the control data in the user program incorporated in the microcomputer to the optimum value. An emulation device is used. The emulation device according to the present embodiment is realized as a multi-chip module (MCM) in which a plurality of semiconductor chips constituting functional blocks are densely mounted on one substrate, and the emulation device is an electronic control device (MC). E
CU).

【0016】図1には、本実施の形態におけるエミュレ
ーション装置1の概略構成を示す。図1に示すように、
エミュレーション装置1は、エバリュエーションチップ
(以下、エバチップという)2と、フラッシュメモリ3
と、エミュレーションRAM(以下、E_RAMとい
う)4とを備えている。
FIG. 1 shows a schematic configuration of an emulation device 1 according to the present embodiment. As shown in FIG.
The emulation device 1 includes an evaluation chip (hereinafter, referred to as an evaluation chip) 2 and a flash memory 3.
And an emulation RAM (hereinafter referred to as E_RAM) 4.

【0017】エバチップ2は、量産時の制御システムに
用いられるマイコンと同等の機能に加えてエミュレート
機能を有している。つまり、エバチップは、量産用マイ
コンの代替として動作すべく、量産用マイコンと同様に
CPU、RAM、バックアップRAM、タイマ、A/D
コンバータ、SCI等を備えている。フラッシュメモリ
3には、ハードウエアに固定され起動時に実行されるフ
ァームウエアと、所定の制御を実施するためのユーザプ
ログラムが格納されている。また、E_RAM4は、フ
ラッシュメモリ3に格納されるユーザプログラムのエミ
ュレーションを行うために配設されている。
The evaluation chip 2 has an emulation function in addition to functions equivalent to those of a microcomputer used in a control system during mass production. In other words, the evaluation chip operates in the same manner as the mass-production microcomputer to operate as a substitute for the mass-production microcomputer, as well as the CPU, RAM, backup RAM, timer, A / D
A converter, an SCI, and the like are provided. The flash memory 3 stores firmware that is fixed to hardware and is executed at the time of startup, and a user program for performing predetermined control. The E_RAM 4 is provided for emulating a user program stored in the flash memory 3.

【0018】これらエバチップ2、フラッシュメモリ
3、E_RAM4はバス5により接続されている。そし
て、エバチップ2からフラッシュメモリ3及びE_RA
M4に対するアドレス指定や、エバチップ2、フラッシ
ュメモリ3、E_RAM4間でのデータの授受がバス5
を介して行われる。
The evaluation chip 2, the flash memory 3, and the E_RAM 4 are connected by a bus 5. Then, the flash memory 3 and the E_RA
Address designation for M4 and transfer of data between the evaluation chip 2, the flash memory 3, and the E_RAM 4 are performed on the bus 5
Done through.

【0019】外部ツール10は、フラッシュ書き込みコ
マンド等をエミュレーション装置1に出力するための機
器であり、例えば汎用パソコンにて構成され、同外部ツ
ール10にはメッセージを表示するための表示部10a
が設けられている。
The external tool 10 is a device for outputting a flash write command or the like to the emulation device 1, and is composed of, for example, a general-purpose personal computer. The external tool 10 has a display unit 10a for displaying a message.
Is provided.

【0020】また、本実施の形態のエミュレーション装
置1は、NBD(Non Break Debugger)モジュー
ル(例えば、日立社製SH7055のAUDモジュー
ル)を備えており、このNBDモジュールを用いること
により、外部ツール10からの要求に応じてエバチップ
2内のCPUを介さずに直接E_RAM4のデータ書き
込み/読み出しができるようになっている。
The emulation apparatus 1 according to the present embodiment includes an NBD (Non Break Debugger) module (for example, an AUD module of SH7055 manufactured by Hitachi, Ltd.). In response to the request, the data writing / reading of the E_RAM 4 can be directly performed without the intervention of the CPU in the evaluation chip 2.

【0021】本実施形態に用いられるフラッシュメモリ
3は、1メガバイト(MB)の記憶領域を有している。
その構成は、図2に示すように、ユーザプログラム以外
を格納するための格納領域Xとして割り当てられた51
2キロバイト(KB)の領域と、通信プログラムを含む
ユーザプログラムを格納するための格納領域Yとして割
り当てられた512KBの領域とからなる。
The flash memory 3 used in this embodiment has a storage area of 1 megabyte (MB).
As shown in FIG. 2, the configuration is such that 51
It consists of an area of 2 kilobytes (KB) and an area of 512 KB allocated as a storage area Y for storing a user program including a communication program.

【0022】格納領域Xには、ファームウエアを格納す
るための領域X1と、フラッシュメモリ3の書き替え状
態を記憶する領域X2が確保されている。フラッシュメ
モリ3の書き替え状態とは、その書き替え時に正常に書
き替え動作が完了したか否かを表すデータであり、予め
規定された例えば16ビットのデータがこの領域X2に
記憶されるようになっている。また、E_RAM4は、
フラッシュメモリ3のユーザプログラム格納領域Yと同
じ512KBの記憶領域を有している。
In the storage area X, an area X1 for storing firmware and an area X2 for storing a rewrite state of the flash memory 3 are secured. The rewriting state of the flash memory 3 is data indicating whether or not the rewriting operation has been completed normally at the time of the rewriting. The rewriting state is such that predetermined 16-bit data, for example, is stored in the area X2. Has become. Also, E_RAM4 is
The flash memory 3 has the same 512 KB storage area as the user program storage area Y.

【0023】このように構成したエミュレーション装置
1では、フラッシュメモリ3の格納領域Yのユーザプロ
グラムがE_RAM4上に転送されて、ユーザプログラ
ムのエミュレーションが実施されるようになっている。
また、エミュレーション時には、NBDモジュールを用
いることにより、車両制御を好適に実施すべく、E_R
AM4上の制御データが最適な値に適合される。なお、
格納領域X,Yはそれぞれ64KBの8つのブロックか
ら構成され、フラッシュメモリ3の書き替え時におい
て、このブロック毎にデータが消去される。
In the emulation apparatus 1 configured as described above, the user program in the storage area Y of the flash memory 3 is transferred to the E_RAM 4, and emulation of the user program is performed.
Further, at the time of emulation, by using the NBD module, E_R
The control data on AM4 is adapted to the optimal value. In addition,
Each of the storage areas X and Y is composed of eight blocks of 64 KB, and data is erased for each block when the flash memory 3 is rewritten.

【0024】ここで、フラッシュメモリ3に格納された
ユーザプログラムをE_RAM4に転送してエミュレー
ションを実施する際の動作を説明する。システムの起動
時において、エバチップ2のCPUによりファームウエ
アが実行されて、フラッシュメモリ3の格納領域Yのユ
ーザプログラムがE_RAM4に転送される。そして、
このE_RAM4にエバチップ2のプログラムカウンタ
を遷移させることで、E_RAM4のユーザプログラム
が実行される。本エミュレーション装置1において、こ
のプログラムカウンタをE_RAM4へ遷移させた後
は、フラッシュメモリ3はバス5から切り離され、エバ
チップ2は再びフラッシュメモリ3へアクセスすること
ができない。つまり、エミュレーション時には、E_R
AM4上の通信プログラムによって、エミュレーション
装置1と外部ツール10との間の通信が行われる。
Here, the operation when the user program stored in the flash memory 3 is transferred to the E_RAM 4 and emulation is performed will be described. When the system is started, firmware is executed by the CPU of the evaluation chip 2, and the user program in the storage area Y of the flash memory 3 is transferred to the E_RAM 4. And
By causing the program counter of the evaluation chip 2 to transition to the E_RAM 4, the user program of the E_RAM 4 is executed. In the emulator 1, after the program counter is shifted to the E_RAM 4, the flash memory 3 is disconnected from the bus 5, and the evaluation chip 2 cannot access the flash memory 3 again. That is, at the time of emulation, E_R
Communication between the emulation device 1 and the external tool 10 is performed by a communication program on the AM 4.

【0025】次いで、フラッシュメモリ3内のユーザプ
ログラムを新規のユーザプログラムに書き替える際の動
作を図3を用いて説明する。図3には、フラッシュメモ
リ3内に事前に格納されている旧ユーザプログラムを新
ユーザプログラムに書き替える際の処理を示す。
Next, the operation of rewriting a user program in the flash memory 3 with a new user program will be described with reference to FIG. FIG. 3 shows a process for rewriting an old user program stored in advance in the flash memory 3 with a new user program.

【0026】図3(a)に示すように、E_RAM4上
の旧ユーザプログラムが実行されている状態で、外部ツ
ール10から書き替え要求が発行される。すると、エバ
チップ2は、その書き替え要求をE_RAM4の通信プ
ログラムによって受信して「フラッシュ書き替えモー
ド」をエバチップ2内のバックアップRAMに設定し、
その上でシステムをリセットする。具体的には、エバチ
ップ2によってリセット信号が出力され、同信号に基づ
いてリセット回路(図示せず)が作動してシステムがリ
セットされる。このリセット後にシステムが再起動され
る時、エバチップ2は、フラッシュメモリ3の領域X1
に格納されるファームウエアを実行する。これにより、
フラッシュメモリ3のユーザプログラム格納領域Yの書
き替えが実施される。この書き替え処理では、NBDモ
ジュールの機能を使用することで、図3(b)に示すよ
うに、新規のユーザプログラムが外部ツール10からE
_RAM4へ直接書き込まれる。そして、図3(c)に
示すように、E_RAM4の内容がフラッシュメモリ3
に書き込まれることで、フラッシュメモリ3が新規のユ
ーザプログラムに書き替えられる。
As shown in FIG. 3A, a rewrite request is issued from the external tool 10 while the old user program on the E_RAM 4 is being executed. Then, the evaluation chip 2 receives the rewriting request by the communication program of the E_RAM 4, sets the “flash rewriting mode” in the backup RAM in the evaluation chip 2,
Then reset the system. Specifically, a reset signal is output by the evaluation chip 2, and a reset circuit (not shown) operates based on the reset signal to reset the system. When the system is restarted after this reset, the evaluation chip 2
Execute the firmware stored in. This allows
The rewriting of the user program storage area Y of the flash memory 3 is performed. In this rewriting process, by using the function of the NBD module, as shown in FIG.
_RAM4 is written directly. Then, as shown in FIG. 3C, the contents of the E_RAM 4 are stored in the flash memory 3.
, The flash memory 3 is rewritten with a new user program.

【0027】なお、本実施の形態のエミュレーション装
置1では、上述した新規のユーザプログラムの書き替え
の他に、例えば、エミュレーションにより適合した制御
データの書き替えも実施できる。つまり、エミュレーシ
ョン後において、E_RAM4の一部領域の内容をユー
ザプログラム格納領域Yの所定のブロックに書き込むこ
とも可能となっている。
In the emulation apparatus 1 of the present embodiment, in addition to the above-described rewriting of a new user program, for example, rewriting of control data more suitable for emulation can be performed. That is, after the emulation, the contents of the partial area of the E_RAM 4 can be written in a predetermined block of the user program storage area Y.

【0028】次に、エバチップ2により実行される処理
のうち、システム起動時に実行されるファームウエアの
処理を図4及び図5のフローチャートを用いて詳述す
る。先ず、エバチップ2はステップ100において、エ
バチップ2内のバックアップRAMに設定された動作モ
ードを判定し、フラッシュ書き替えモードと判定したと
き、ステップ110に移行して書き替え処理を実施す
る。この書き替え処理は図5に示すように、ステップ1
11において、初期化処理としてバックアップRAMの
動作モードをフラッシュ書き替えモードからユーザプロ
グラム実行モードに変更する。引き続き、ステップ11
2においてエバチップ2は、フラッシュ書き替え状態を
表すデータとして、未書き替え状態を示す「H’FFF
F」をフラッシュメモリ3の領域X2に書き込む。そし
て、エバチップ2はステップ113に移行して、ユーザ
プログラム格納領域Yのデータを消去した後、外部ツー
ル10からE_RAM4に転送された新規のユーザプロ
グラムをユーザプログラム格納領域Yに書き込む。さら
に、正常に書き込みが行われたことを確認するために、
ベリファイ処理が実施される。つまり、E_RAM4の
内容と、フラッシュメモリ3の格納領域Yに書き込まれ
た内容とが同一か否かが判定される。このベリファイ処
理にて、E_RAM4の内容とフラッシュメモリ3に書
き込まれた内容が一致しない場合は、再度、新規のユー
ザプログラムの書き込み処理が実施される。そして、書
き込みが正常に完了した場合、エバチップ2はステップ
114において、フラッシュメモリ3の領域X2に、書
き替え完了状態を示す「H’AA55」を書き込んだ後
に書き替え処理を終了する。
Next, among the processing executed by the evaluation chip 2, the processing of firmware executed when the system is started will be described in detail with reference to the flowcharts of FIGS. First, in step 100, the evaluation chip 2 determines the operation mode set in the backup RAM in the evaluation chip 2, and when the operation mode is determined to be the flash rewriting mode, the process proceeds to step 110 to perform the rewriting process. This rewriting process is performed as shown in FIG.
In step 11, the operation mode of the backup RAM is changed from the flash rewrite mode to the user program execution mode as initialization processing. Continue with step 11
2, the evaluation chip 2 outputs “H′FFF” indicating the unwritten state as data indicating the flash rewritten state.
F ”is written in the area X2 of the flash memory 3. Then, the process proceeds to step 113, where the evaluation chip 2 erases the data in the user program storage area Y, and then writes the new user program transferred from the external tool 10 to the E_RAM 4 in the user program storage area Y. In addition, in order to confirm that the writing was successful,
Verify processing is performed. That is, it is determined whether the contents of the E_RAM 4 and the contents written in the storage area Y of the flash memory 3 are the same. If the contents of the E_RAM 4 and the contents written to the flash memory 3 do not match in this verification processing, the processing of writing a new user program is performed again. Then, when the writing is completed normally, the evaluation chip 2 writes “H′AA55” indicating the rewriting completed state in the area X2 of the flash memory 3 in step 114, and then ends the rewriting process.

【0029】フラッシュメモリ3の書き替え処理が終了
すると、外部ツール10がエミュレーション装置1にリ
セットコマンドを発行する。このリセットコマンドに基
づいてエバチップ2はリセット信号をリセット回路(図
示せず)に出力し、同信号に基づいてシステムがリセッ
トされる。
When the rewriting of the flash memory 3 is completed, the external tool 10 issues a reset command to the emulation device 1. The evaluation chip 2 outputs a reset signal to a reset circuit (not shown) based on the reset command, and the system is reset based on the signal.

【0030】その後、システムの起動時には、再び図4
に示すファームウエアが実行される。この場合、ステッ
プ100の処理にて、ユーザプログラム実行モードが判
定され、エバチップ2は、ステップ120に移行する。
エバチップ2は、ステップ120において、領域X2に
書き込まれている値に基づいて書き替え完了状態か否か
を判定する。そして、この領域X2に「H’AA55」
が書き込まれており、書き替え完了状態と判定したと
き、エバチップ2はステップ130に移行する。エバチ
ップ2はステップ130において、フラッシュメモリ3
の格納領域Yに書き込まれているユーザープログラムを
E_RAM4へ転送した後、E_RAM4のユーザープ
ログラムへジャンプする。つまり、プログラムカウンタ
をE_RAM4上へ遷移させることで、エバチップ2に
よりそのE_RAM4上のユーザープログラムが実行さ
れ、ユーザープログラムのエミュレーションが実施され
る。
Thereafter, when the system is started, FIG.
Is executed. In this case, in the process of step 100, the user program execution mode is determined, and the evaluation chip 2 proceeds to step 120.
In step 120, the evaluation chip 2 determines whether or not the rewriting is completed based on the value written in the area X2. Then, "H'AA55" is set in this area X2.
Has been written, and the evaluation chip 2 proceeds to step 130 when it is determined that the rewriting is completed. The evaluation chip 2 determines in step 130 that the flash memory 3
After the user program written in the storage area Y is transferred to the E_RAM4, the process jumps to the user program in the E_RAM4. That is, by shifting the program counter to the E_RAM 4, the user program on the E_RAM 4 is executed by the evaluation chip 2, and emulation of the user program is performed.

【0031】一方、前記フラッシュ書き替え処理(図5
のステップ112,113の処理)中において、電源の
瞬断やノイズ等が発生すると、フラッシュメモリ3の書
き替えが未完了のまま同処理が中断されてしまう場合が
ある。この場合において、エバチップ2はステップ10
0の処理を経てステップ120の処理に移行すると、エ
バチップ2は、領域X2に書き込まれている値(H’F
FFF)に基づいて書き替え未完了と判定してステップ
140に移行する。そして、ステップ140において、
エバチップ2は、外部ツール10からの書き替え要求を
受信するまで待機する。なおこのとき、外部ツール10
の表示部10aにフラッシュメモリ3の書き替え異常を
示すメッセージが表示される。その後、作業者等の操作
に伴い外部ツール10から書き替え要求が発行される
と、エバチップ2はステップ110に移行して、フラッ
シュ書き替え処理を再実行する。
On the other hand, the flash rewriting process (FIG. 5)
During the processing of steps 112 and 113), if an instantaneous power interruption or noise occurs, the processing may be interrupted while the rewriting of the flash memory 3 is not completed. In this case, the evaluation chip 2 performs step 10
When the processing shifts to the processing of step 120 after the processing of 0, the evaluation chip 2 stores the value (H′F) written in the area X2.
FFF), it is determined that rewriting is not completed, and the process proceeds to step 140. Then, in step 140,
The evaluation chip 2 waits until a rewrite request from the external tool 10 is received. At this time, the external tool 10
A message indicating an abnormal rewriting of the flash memory 3 is displayed on the display section 10a. Thereafter, when a rewrite request is issued from the external tool 10 in response to an operation of a worker or the like, the evaluation chip 2 proceeds to step 110 and executes the flash rewrite process again.

【0032】このように、フラッシュメモリ3の書き替
えが正常に完了したか否かが判定され、ユーザプログラ
ムの書き替えが未完了と判定されたとき、E_RAM4
へのユーザプログラムの転送が中止されて、E_RAM
4上のユーザプログラムの実行が禁止される。一方、ユ
ーザプログラムの書き替えが正常に完了したと判定され
たとき、フラッシュメモリ3のユーザプログラムがE_
RAM4へ転送され、E_RAM4上のユーザプログラ
ムの実行が許可される。
As described above, it is determined whether or not the rewriting of the flash memory 3 has been completed normally. When it is determined that the rewriting of the user program has not been completed, the E_RAM 4
Transfer of the user program to the E_RAM
4 execution of the user program is prohibited. On the other hand, when it is determined that the rewriting of the user program has been completed normally,
The data is transferred to the RAM 4 and the execution of the user program on the E_RAM 4 is permitted.

【0033】なお、エミュレーションにより適合した制
御データをE_RAM4からフラッシュメモリ3に書き
戻す場合も、動作モードをフラッシュ書き替えモードに
設定した上でシステムのリセットが実施される。その
後、図4,5に示す処理が実施されることにより、E_
RAM4の内容がフラッシュメモリ3に書き替えられる
ようになっている。
When the control data adapted by emulation is written back from the E_RAM 4 to the flash memory 3, the system is reset after setting the operation mode to the flash rewrite mode. Thereafter, the processing shown in FIGS.
The contents of the RAM 4 are rewritten to the flash memory 3.

【0034】本実施の形態では、エバチップ2が書き替
え手段に相当し、ファームウエアが通信手段に相当す
る。また、ステップ120の処理が判定手段に相当す
る。以上詳述した本実施の形態は、以下の特徴を有す
る。
In this embodiment, the evaluation chip 2 corresponds to the rewriting means, and the firmware corresponds to the communication means. Further, the processing of step 120 corresponds to the determination means. The present embodiment described above has the following features.

【0035】(1)起動時に実行されるファームウエア
により外部ツール10との間で通信が行われ、その際
に、フラッシュメモリ3のユーザプログラムの書き替え
が実施される。また、フラッシュメモリ3の書き替えが
正常に行われたか否かが判定される。この場合、仮にフ
ラッシュメモリ3のユーザプログラムの書き替えが失敗
しても、それが判定でき、その際に、通信プログラムと
は別に設けたファームウエアによって外部ツール10と
の間で通信を行うことができる。つまり、書き替えに失
敗したときに、正常に動作できなくなる通信プログラム
を介すことなく外部ツール10との間で通信できる。そ
の結果、ユーザプログラムの再書き替えが実施できなく
なるといった不都合は生じることはなく、ユーザプログ
ラムの書き替えが適正に実施できる。
(1) Communication with the external tool 10 is performed by firmware executed at the time of startup. At this time, the user program in the flash memory 3 is rewritten. Further, it is determined whether or not the rewriting of the flash memory 3 has been normally performed. In this case, even if the rewriting of the user program in the flash memory 3 fails, it can be determined. At that time, communication with the external tool 10 can be performed by firmware provided separately from the communication program. it can. That is, when the rewriting fails, communication can be performed with the external tool 10 without going through a communication program that cannot operate normally. As a result, there is no inconvenience that the user program cannot be rewritten, and the user program can be properly rewritten.

【0036】(2)ユーザプログラムの書き替え状態が
判定され、書き替えが正常に実施されるまで、ユーザプ
ログラムの実行が禁止される。その結果、書き替えに失
敗したユーザプログラムの実行を確実に防止できる。
(2) The rewriting state of the user program is determined, and execution of the user program is prohibited until the rewriting is normally performed. As a result, the execution of the user program whose rewriting has failed can be reliably prevented.

【0037】(3)従来技術のように、通信プログラム
が格納されるブロックを消去しない方法を採用すると、
ユーザプログラムのための格納領域が無駄になる場合が
あったが、本実施の形態のエミュレーション装置1で
は、ユーザプログラム格納領域Yにおいて、通信プログ
ラムのために消去しない領域を設ける必要はない。つま
り、ユーザプログラム格納領域Yを有効利用できる。
(3) If a method of not erasing a block storing a communication program is adopted as in the prior art,
In some cases, the storage area for the user program is wasted, but in the emulation apparatus 1 of the present embodiment, it is not necessary to provide an area in the user program storage area Y that is not erased for the communication program. That is, the user program storage area Y can be used effectively.

【0038】(4)エミュレーション装置1はマルチチ
ップモジュールとしてシステム化したので、ノイズ等の
影響を受けにくく信号伝送を高速に実施できるととも
に、実装効率を高めることができる。
(4) Since the emulation device 1 is systematized as a multi-chip module, it is hardly affected by noise and the like, so that signal transmission can be performed at high speed and mounting efficiency can be improved.

【0039】なお本発明は、上記以外に次の形態にて具
体化できる。上記実施の形態では、フラッシュメモリ3
に、ファームウエア、書き替え状態を表すデータ、ユー
ザプログラムを格納するものであったが、これに限定す
るものではない。ファームウエアや書き替え状態を表す
データは、ユーザプログラムを格納するフラッシュメモ
リとは別のメモリに格納する構成としてもよい。具体的
には、例えばファームウエアをEPROMに格納すると
ともに書き替え状態を表すデータをEEPROMに格納
し、さらに、ユーザプログラムをフラッシュメモリに格
納する。但し、上記実施の形態のように、1つのフラッ
シュメモリ3にファームウエア、書き替え状態、ユーザ
プログラムを格納する方が、コスト的にも有利である。
The present invention can be embodied in the following forms other than the above. In the above embodiment, the flash memory 3
In this example, firmware, data indicating a rewrite state, and a user program are stored, but the present invention is not limited to this. The data representing the firmware and the rewrite state may be stored in a memory different from the flash memory that stores the user program. Specifically, for example, firmware is stored in an EPROM, data indicating a rewrite state is stored in an EEPROM, and a user program is stored in a flash memory. However, storing the firmware, the rewrite state, and the user program in one flash memory 3 as in the above embodiment is more advantageous in terms of cost.

【0040】また一般に、エミュレーション装置1は、
フラッシュメモリ3のユーザプログラム格納領域Yにユ
ーザプログラムが書き込まれていない状態で製造され
る。このエミュレーション装置1が新品のとき、使用す
る前にフラッシュメモリ3の領域X2に未書き込み状態
を示す値「H’FFFF」を事前に書き込むようにして
もよい。この場合、エミュレーション装置1が初めて使
用される際に、ユーザプログラムが書き込まれていない
格納領域Yの内容を、E_RAM4に転送することを確
実に防止できる。
Generally, the emulation device 1
The flash memory 3 is manufactured without a user program written in the user program storage area Y. When the emulation device 1 is new, a value "H'FFFF" indicating an unwritten state may be written in the area X2 of the flash memory 3 before use. In this case, when the emulation device 1 is used for the first time, it is possible to reliably prevent the contents of the storage area Y in which the user program is not written from being transferred to the E_RAM 4.

【0041】上記実施の形態では、フラッシュメモリ書
き替え装置として、エミュレーション装置1に具体化し
たが、これに限定するものではない。要は、ユーザプロ
グラムを格納するフラッシュメモリを備え、そのユーザ
プログラムの書き替えを実施する装置に具体化するもの
であればよい。
In the above embodiment, the emulation device 1 is embodied as a flash memory rewriting device, but the present invention is not limited to this. In short, any device that has a flash memory for storing a user program and is embodied in a device that rewrites the user program may be used.

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

【図1】発明の実施の形態におけるエミュレーション装
置の概要を示す構成図。
FIG. 1 is a configuration diagram showing an outline of an emulation device according to an embodiment of the present invention.

【図2】フラッシュメモリ及びE_RAMのブロック
図。
FIG. 2 is a block diagram of a flash memory and E_RAM.

【図3】フラッシュメモリの書き替え動作を説明するた
めの図。
FIG. 3 is a diagram illustrating a rewriting operation of the flash memory.

【図4】ファームウエアの処理を説明するためのフロー
チャート図。
FIG. 4 is a flowchart for explaining firmware processing.

【図5】フラッシュメモリの書き替え処理を説明するた
めのフローチャート図。
FIG. 5 is a flowchart for explaining a flash memory rewriting process.

【図6】従来のフラッシュメモリの書き替え動作を説明
するための図。
FIG. 6 is a diagram for explaining a rewriting operation of a conventional flash memory.

【図7】フラッシュメモリのブロック図。FIG. 7 is a block diagram of a flash memory.

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

1…フラッシュメモリ書き替え装置としてのエミュレー
ション装置、2…書き替え手段としてのエバチップ、3
…フラッシュメモリ、4…エミュレーションRAM、1
0…外部ツール。
1. Emulation device as flash memory rewriting device 2. Evaluation chip as rewriting device 3.
... Flash memory, 4 ... Emulation RAM, 1
0 ... external tool.

フロントページの続き Fターム(参考) 5B018 GA06 HA01 KA01 KA12 NA06 QA05 QA15 RA11 RA12 5B048 AA13 BB02 5B076 EB03 Continuation of the front page F term (reference) 5B018 GA06 HA01 KA01 KA12 NA06 QA05 QA15 RA11 RA12 5B048 AA13 BB02 5B076 EB03

Claims (5)

【特許請求の範囲】[Claims] 【請求項1】 外部ツールと通信を行うためのプログラ
ムを含む所定のユーザプログラムを格納するフラッシュ
メモリと、 該フラッシュメモリ内のユーザプログラムを書き替える
書き替え手段と、 前記外部ツールからの書き替え要求に伴い、外部ツール
との間で通信を行う通信手段と、 前記書き替え手段によるユーザプログラムの書き替えが
正常に完了したか否かを判定し、その判定した結果を記
憶する判定手段とを備えたことを特徴とするフラッシュ
メモリ書き替え装置。
1. A flash memory for storing a predetermined user program including a program for communicating with an external tool, rewriting means for rewriting a user program in the flash memory, and a rewriting request from the external tool A communication unit that communicates with an external tool, and a determination unit that determines whether or not the rewriting of the user program by the rewriting unit has been completed normally, and stores a result of the determination. A flash memory rewriting device characterized in that:
【請求項2】 請求項1に記載のフラッシュメモリ書き
替え装置において、 前記判定手段がユーザプログラムの書き替えが未完了の
旨を判定したとき、ユーザプログラムの実行を禁止し、
前記判定手段がユーザプログラムの書き替えが正常に完
了した旨を判定したとき、その書き替え完了後のユーザ
プログラムの実行を許可することを特徴とするフラッシ
ュメモリ書き替え装置。
2. The flash memory rewriting device according to claim 1, wherein the execution of the user program is prohibited when the judgment unit judges that the rewriting of the user program is not completed.
A flash memory rewriting device, wherein when the determination means determines that the rewriting of the user program has been completed normally, execution of the user program after the completion of the rewriting is permitted.
【請求項3】 請求項1又は2に記載のフラッシュメモ
リ書き替え装置において、 前記判定手段による判定結果を、前記ユーザプログラム
を格納したのと同じフラッシュメモリに記憶することを
特徴とするフラッシュメモリ書き替え装置。
3. The flash memory rewriting device according to claim 1, wherein a result of the determination by said determination means is stored in the same flash memory in which said user program is stored. Replacement device.
【請求項4】 請求項1〜3にいずれか一項に記載のフ
ラッシュメモリ書き替え装置において、 前記通信手段は、ハードウエアに固定化され起動時に実
行されるファームウエアであることを特徴とするフラッ
シュメモリ書き替え装置。
4. The flash memory rewriting device according to claim 1, wherein said communication means is firmware which is fixed to hardware and executed at the time of startup. Flash memory rewriting device.
【請求項5】 請求項1〜4のいずれか一項に記載のフ
ラッシュメモリ書き替え装置において、 前記フラッシュメモリに格納されるユーザプログラムを
エミュレーションRAMに転送し、そのユーザプログラ
ムのエミュレーションを行うエミュレーション装置に適
用され、 前記書き替え手段は、前記エミュレーションRAM上の
ユーザプログラムをフラッシュメモリに書き込むことを
特徴とするフラッシュメモリ書き替え装置。
5. The flash memory rewriting device according to claim 1, wherein the user program stored in the flash memory is transferred to an emulation RAM, and the emulation of the user program is performed. Wherein the rewriting means writes a user program on the emulation RAM to a flash memory.
JP32825699A 1999-11-18 1999-11-18 Flash memory rewrite device Pending JP2001147863A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP32825699A JP2001147863A (en) 1999-11-18 1999-11-18 Flash memory rewrite device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP32825699A JP2001147863A (en) 1999-11-18 1999-11-18 Flash memory rewrite device

Publications (1)

Publication Number Publication Date
JP2001147863A true JP2001147863A (en) 2001-05-29

Family

ID=18208196

Family Applications (1)

Application Number Title Priority Date Filing Date
JP32825699A Pending JP2001147863A (en) 1999-11-18 1999-11-18 Flash memory rewrite device

Country Status (1)

Country Link
JP (1) JP2001147863A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2003067213A (en) * 2001-08-30 2003-03-07 Ricoh Co Ltd Image forming device and program updating method for the same
JP2006252278A (en) * 2005-03-11 2006-09-21 Denso Corp Microcomputer
JP2007264697A (en) * 2006-03-27 2007-10-11 Seiko Epson Corp Processing system, projector, program and information storage medium
JP2012239159A (en) * 2011-04-28 2012-12-06 Canon Inc Image pickup apparatus

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2003067213A (en) * 2001-08-30 2003-03-07 Ricoh Co Ltd Image forming device and program updating method for the same
JP2006252278A (en) * 2005-03-11 2006-09-21 Denso Corp Microcomputer
JP2007264697A (en) * 2006-03-27 2007-10-11 Seiko Epson Corp Processing system, projector, program and information storage medium
JP2012239159A (en) * 2011-04-28 2012-12-06 Canon Inc Image pickup apparatus
US9086611B2 (en) 2011-04-28 2015-07-21 Canon Kabushiki Kaisha Image pickup apparatus that controls operation of a lens apparatus mounted thereon, lens apparatus that controls firmware update operation and control methods thereof

Similar Documents

Publication Publication Date Title
US5978862A (en) PCMCIA card dynamically configured in first mode to program FPGA controlling application specific circuit and in second mode to operate as an I/O device
EP0442651B1 (en) Apparatus and method for background memory test during system start up
US6745278B2 (en) Computer capable of rewriting an area of a non-volatile memory with a boot program during self mode operation of the computer
JP2990181B1 (en) Flash memory, microcomputer having flash memory, and method of storing program in flash memory
JPH0764770A (en) Microcontroller apparatus provided with remotely writable eprom and writing method
KR20080075110A (en) Initialization of flash storage via an embedded controller
JP2000065899A (en) Semiconductor device, and its data rewriting method
EP0686981A2 (en) Method for testing large memory arrays during system initialization
US6839835B2 (en) Method of loading initial program in processor system
US7096351B2 (en) Single-chip microcomputer and boot region switching method thereof
US6543008B1 (en) Computer system and program rewriting method
US8464016B2 (en) Method and device for switching over in a memory for a control device
JP3152535B2 (en) Data processing device
US5961611A (en) Automatic option setting circuit
JP2001147863A (en) Flash memory rewrite device
US6182207B1 (en) Microcontroller with register system for the indirect accessing of internal memory via auxiliary register
US20050068842A1 (en) Electronic device, nonvolatile memory and method of overwriting data in nonvolatile memory
JPH10283172A (en) Flash rom data rewrite system
JPH09305395A (en) Electronic equipment
JP4324149B2 (en) Emulator and development support system using it
US7596717B2 (en) Microcomputer and debugging method
JP2581057B2 (en) Evaluation microcomputer
JP2793623B2 (en) emulator
JP3535337B2 (en) Microcomputer emulator program loading device
JPH11328089A (en) Id information write circuit in device for pci bus interface

Legal Events

Date Code Title Description
A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20040629

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20041102