JP2001092675A - Microcomputer and device for rewriting the same - Google Patents

Microcomputer and device for rewriting the same

Info

Publication number
JP2001092675A
JP2001092675A JP27163699A JP27163699A JP2001092675A JP 2001092675 A JP2001092675 A JP 2001092675A JP 27163699 A JP27163699 A JP 27163699A JP 27163699 A JP27163699 A JP 27163699A JP 2001092675 A JP2001092675 A JP 2001092675A
Authority
JP
Japan
Prior art keywords
area
address
program
rewriting
microcomputer
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
JP27163699A
Other languages
Japanese (ja)
Inventor
Kazuyo Nishikawa
和予 西川
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 Holdings Corp
Original Assignee
Matsushita Electric Industrial Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Matsushita Electric Industrial Co Ltd filed Critical Matsushita Electric Industrial Co Ltd
Priority to JP27163699A priority Critical patent/JP2001092675A/en
Publication of JP2001092675A publication Critical patent/JP2001092675A/en
Pending legal-status Critical Current

Links

Abstract

PROBLEM TO BE SOLVED: To execute an instruction to use data written in a vector table region in a loader region in which on-board rewriting is unavailable by realizing the rewriting in the loader region at the time of changing data in the vector table region after a user program is changed in a microcomputer incorporating a flash EEPROM. SOLUTION: At the time of on-board rewriting, the data of a vector table region after program change are written in a rewritable firm region. When an instruction to read the vector table region is executed after the on-board rewriting, an address converter 12 converts an address outputted from a CPU 11 into the address of the film region, and reads the data after change to execut the instruction after change.

Description

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

【0001】[0001]

【発明の属する技術分野】本発明は、電気的に消去、書
換え可能なフラッシュEEPROMを内蔵したマイクロ
コンピュータに関するものである。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a microcomputer having an electrically erasable and rewritable flash EEPROM.

【0002】[0002]

【従来の技術】プログラムを格納するメモリとCPUを
1チップ上に集積したマイクロコンピュータにおいて、
プログラムを格納するメモリとして電気的に消去、書換
え可能なフラッシュEEPROMを搭載することが増え
てきている。このフラッシュEEPROMは、EPRO
M内蔵マイクロコンピュータと同様に専用ソケットアダ
プタを用いてPROMライタで書き換える方法と、基板
上に実装したまま書き換えるオンボード書換えの2種類
の方法がある。
2. Description of the Related Art In a microcomputer in which a memory for storing a program and a CPU are integrated on one chip,
An increasingly erasable and rewritable flash EEPROM is mounted as a memory for storing programs. This flash EEPROM is an EPRO
As in the case of the microcomputer with the built-in M, there are two methods: a method of rewriting with a PROM writer using a dedicated socket adapter, and an on-board rewriting method of rewriting while mounted on a board.

【0003】オンボード書換えでは、マイクロコンピュ
ータに内蔵の書換制御回路を用いて予めROMに書き込
まれた書換制御プログラムによって書換えを行うことが
できる。フラッシュEEPROMは、書換制御プログラ
ムを書き込むローダ領域と、マイクロコンピュータの使
い方に合わせた独自のユーザプログラムを書き込むファ
ーム領域との2種類の領域に分かれている。
In on-board rewriting, rewriting can be performed by using a rewriting control circuit built in a microcomputer according to a rewriting control program previously written in a ROM. The flash EEPROM is divided into two types of areas: a loader area for writing a rewrite control program, and a firmware area for writing a unique user program according to the use of the microcomputer.

【0004】PROMライタによる書換えでは、ローダ
領域とファーム領域の両方を書き換えることが可能で、
オンボード書換えではファーム領域のみを書き換える。
In rewriting by a PROM writer, both the loader area and the firmware area can be rewritten.
In on-board rewriting, only the firmware area is rewritten.

【0005】図2はフラッシュEEPROMのメモリア
ドレス領域を示した図であり、図3は図2における領域
Aの詳細図である。図2における領域Aは、図3に示す
ようにベクタ1からベクタnのn個の領域に分割されて
おり、分岐先アドレスを指定するベクタテーブル領域で
ある。
FIG. 2 is a view showing a memory address area of a flash EEPROM, and FIG. 3 is a detailed view of an area A in FIG. The area A in FIG. 2 is divided into n areas of vector 1 to vector n as shown in FIG. 3, and is a vector table area for specifying a branch destination address.

【0006】図4と図5はフラッシュEEPROM内蔵
マイクロコンピュータのプログラム命令の一例であり、
ファーム領域に書き込まれているものとする。図4にお
ける命令1はABCという関数を呼び出す命令である。
命令1がCPUに読み込まれると、CPUのプログラム
カウンタは関数ABCの先頭アドレスの値になり、関数
ABCに分岐する。図5における命令2は、CPUに命
令1と同じ動作をさせる命令である。ここで、図3に示
すベクタ1領域には関数ABCの先頭アドレスの値が書
き込まれているものとする。命令2がCPUに読み込ま
れると、CPUのプログラムカウンタはまず図3のベク
タ1領域のアドレスになり、ベクタ1領域の値を読み出
して、次にプログラムカウンタはベクタ1に書き込まれ
ている値になり、ベクタ1領域に書き込まれているアド
レスすなわち関数ABCに分岐する。
FIGS. 4 and 5 show examples of program instructions of a microcomputer having a built-in flash EEPROM.
It is assumed that the data has been written in the firmware area. Instruction 1 in FIG. 4 is an instruction for calling a function called ABC.
When the instruction 1 is read by the CPU, the program counter of the CPU becomes the value of the start address of the function ABC and branches to the function ABC. The instruction 2 in FIG. 5 is an instruction for causing the CPU to perform the same operation as the instruction 1. Here, it is assumed that the value of the start address of the function ABC is written in the vector 1 area shown in FIG. When the instruction 2 is read by the CPU, the program counter of the CPU first becomes the address of the vector 1 area in FIG. 3, reads the value of the vector 1 area, and then the program counter becomes the value written in the vector 1. , Branches to the address written in the vector 1 area, that is, the function ABC.

【0007】このように命令1と命令2はどちらも関数
ABCを呼び出す動作をさせるための命令であるが、命
令1は直接アドレスを指定するのに対し、命令2はベク
タ番号を指定するだけのベクタ間接分岐命令である。ア
ドレスの指定に32ビットのメモリが必要で、ベクタ番
号の指定に8ビットのメモリが必要である場合、同じ命
令をあらわす命令コードサイズを命令1より命令2の方
が24ビット分小さくすることができる。そのため、同
じ関数を何度も呼び出すプログラムでは命令2を用いた
方が命令1を用いるよりはるかにプログラム全体のコー
ドサイズを小さくすることができ、マイクロコンピュー
タに内蔵するフラッシュEEPROMの容量を小さくで
きる。
As described above, both the instruction 1 and the instruction 2 are operations for calling the function ABC, but the instruction 1 directly specifies an address, whereas the instruction 2 only specifies a vector number. This is a vector indirect branch instruction. If a 32-bit memory is required to specify an address and an 8-bit memory is required to specify a vector number, the instruction code size for the same instruction may be reduced by 24 bits for instruction 2 than for instruction 1. it can. Therefore, in a program that calls the same function many times, using the instruction 2 can reduce the code size of the entire program much more than using the instruction 1, and the capacity of the flash EEPROM built in the microcomputer can be reduced.

【0008】[0008]

【発明が解決しようとする課題】ここで、命令2の実行
に必要なベクタ1領域は、図2に示すローダ領域内の領
域Aにある。ファーム領域に書き込まれているユーザプ
ログラムに変更が生じオンボード書換えによりファーム
領域のプログラムを書き換えた際に、領域Aの内容に変
更が生じる可能性がある。しかし、CPUがローダ領域
のプログラム命令を実行することによりファーム領域の
プログラムデータの書換えを行っているため、ローダ領
域は書き換えることができない。ゆえにユーザプログラ
ムを開発する際に領域Aのデータ、例えば命令2で用い
るベクタ1の値に変更が生じないように考慮する必要が
あり、その制約のためプログラム効率を上げることがで
きず、プログラムコードサイズが増大する。また、領域
Aのデータを変更せずにユーザプログラムを変更するこ
とが不可能な場合は、命令2のような領域Aのデータを
用いる命令が使用できず、プログラムコードサイズが増
大する。
Here, the vector 1 area necessary for executing the instruction 2 is located in the area A in the loader area shown in FIG. When the user program written in the firmware area is changed and the program in the firmware area is rewritten by on-board rewriting, the contents of the area A may be changed. However, since the CPU rewrites the program data in the firmware area by executing the program instruction in the loader area, the loader area cannot be rewritten. Therefore, when developing the user program, it is necessary to consider that the data in the area A, for example, the value of the vector 1 used in the instruction 2 does not change, and the program efficiency cannot be increased due to the restriction. Increase in size. If it is impossible to change the user program without changing the data in the area A, an instruction using the data in the area A, such as the instruction 2, cannot be used, and the program code size increases.

【0009】本発明は上記従来の問題点を解決するもの
で、オンボード書換え時にベクタテーブル領域(領域
A)のデータに変更があっても、前述の命令2のような
ベクタ間接分岐命令を正常に実行することができるとと
もに、ユーザプログラム開発上の制約をなくし、プログ
ラムコードサイズを縮小できるマイクロコンピュータお
よびその書換え装置を提供することを目的とする。
The present invention solves the above-mentioned conventional problem. Even if data in the vector table area (area A) is changed during on-board rewriting, the vector indirect branch instruction such as the instruction 2 described above can be normally executed. It is an object of the present invention to provide a microcomputer and a rewriting device capable of reducing the program code size by eliminating the restrictions on the user program development while executing the program.

【0010】[0010]

【課題を解決するための手段】この目的を達成するため
に本発明のマイクロコンピュータは、ベクタテーブル領
域を含むローダ領域とファーム領域とを有したフラッシ
ュEEPROMと、ベクタテーブル領域に予め書き込ま
れている値により間接分岐できる機能を有したCPUと
を備えたマイクロコンピュータであって、フラッシュE
EPROMがPROMライタで書換え後の状態かオンボ
ード書換え後の状態かを判定するメモリ状態判定回路
と、CPUから出力されるアドレスがベクタテーブル領
域のアドレスであるか否かを判定するアドレス領域判定
部と、メモリ状態判定回路によりフラッシュEEPRO
Mがオンボード書換え後の状態であると判定され、かつ
アドレス領域判定部によりCPUから出力されるアドレ
スがベクタテーブル領域のアドレスであると判定された
場合にのみ、CPUから出力されるアドレスをファーム
領域のアドレスに変換してフラッシュEEPROMに供
給し、それ以外の場合はCPUから出力されるアドレス
をそのままフラッシュEEPROMに供給するアドレス
変換・非変換回路とを設けたことを特徴とする。
In order to achieve this object, a microcomputer according to the present invention has a flash EEPROM having a loader area including a vector table area and a firmware area, and is pre-written in a vector table area. And a CPU having a function capable of indirect branching according to a value.
A memory state determination circuit for determining whether the EPROM has been rewritten by a PROM writer or a state after onboard rewriting, and an address area determination unit for determining whether an address output from the CPU is an address of a vector table area And flash EEPROM by the memory state determination circuit.
Only when M is determined to be in the state after on-board rewriting and the address area determination unit determines that the address output from the CPU is the address of the vector table area, the address output from the CPU is updated. An address conversion / non-conversion circuit is provided, which converts the address into an area address and supplies the address to the flash EEPROM, and otherwise supplies the address output from the CPU to the flash EEPROM as it is.

【0011】この構成によれば、オンボード書換えを行
う際、本来ローダ領域内のベクタテーブル領域に書き込
まれるべき分岐先アドレスのデータをファーム領域に書
き込んでおくことで、オンボード書換え後に、CPUが
ベクタテーブル領域のデータを読み出す動作を行った場
合、CPUから出力されるアドレスをファーム領域のア
ドレスに変換してファーム領域のデータを読み出すこと
によって、オンボード書換え時にベクタテーブル領域の
データに変更があっても、ベクタ間接分岐命令を正常に
実行することができる。これにより、ユーザプログラム
開発上の制約をなくし、プログラムコードサイズを縮小
できる。
According to this configuration, at the time of on-board rewriting, the data of the branch destination address that should be originally written in the vector table area in the loader area is written in the firmware area. When the operation of reading the data in the vector table area is performed, the address output from the CPU is converted into the address of the firmware area, and the data in the firmware area is read. However, the vector indirect branch instruction can be executed normally. This eliminates restrictions on user program development and reduces the program code size.

【0012】また、本発明のマイクロコンピュータの書
換装置は、請求項1のマイクロコンピュータに内蔵のフ
ラッシュEEPROMのオンボード書換えを行うため
に、プログラムファイルを入力し、このプログラムファ
イル中のベクタテーブル領域に書き込むべきデータがフ
ァーム領域に書き込まれるように自動的に変換する機能
を備えたものであり、この書換装置でオンボード書換え
を行うことにより、ユーザは、本来ローダ領域内のベク
タテーブル領域に書き込まれるべき分岐先アドレスのデ
ータがファーム領域に書き込まれることを意識すること
なくプログラム開発ができる。
Further, the microcomputer rewriting device of the present invention inputs a program file to perform on-board rewriting of a flash EEPROM built in the microcomputer according to the first aspect of the present invention, and stores the program file in a vector table area in the program file. It has a function of automatically converting data to be written so that the data is written to the firmware area. By performing on-board rewriting with this rewriting device, the user is originally written to the vector table area in the loader area. A program can be developed without being aware that the data at the desired branch destination address is written to the firmware area.

【0013】[0013]

【発明の実施の形態】本発明の実施の形態について図面
を参照しながら説明する。図1は本発明の実施の形態の
フラッシュEEPROM内蔵マイクロコンピュータのブ
ロック図を示したものである。図1において、11はプ
ログラムカウンタ、命令解読部、演算器等を備えメモリ
からの読み出しデータに基づいて動作するCPU、12
はCPU11から出力されるアドレスを変換するアドレ
ス変換器、13はアドレス領域判定部、14はフラッシ
ュEEPROM16の書き換え状態を判定するメモリ状
態判定回路、15は選択回路、16はフラッシュEEP
ROMである。なお、アドレス変換・非変換回路は、ア
ドレス変換器12と選択回路15とからなる。
Embodiments of the present invention will be described with reference to the drawings. FIG. 1 is a block diagram showing a microcomputer with a built-in flash EEPROM according to an embodiment of the present invention. In FIG. 1, reference numeral 11 denotes a CPU which includes a program counter, an instruction decoding unit, an arithmetic unit, and operates based on data read from a memory;
Is an address converter for converting an address output from the CPU 11, 13 is an address area determining unit, 14 is a memory state determining circuit for determining a rewriting state of the flash EEPROM 16, 15 is a selection circuit, and 16 is a flash EEPROM.
ROM. The address conversion / non-conversion circuit includes an address converter 12 and a selection circuit 15.

【0014】アドレス領域判定部13は、CPU11か
ら出力されるアドレスが図2に示す領域Aのアドレスに
該当する場合は1を、それ以外の場合は0を出力する。
メモリ状態判定回路14は、マイクロコンピュータがプ
ログラム命令を実行開始する際に、フラッシュEEPR
OM16内の図2に示す領域Cの値を読み出してその値
を記憶するレジスタを有し、領域Cに書き込まれている
値(0または1)を出力する。なお、領域Cには、PR
OMライタで書換えを行う際に1が書き込まれ、オンボ
ード書換え時に0が書き込まれる。選択回路15は、ア
ドレス領域判定部13の出力が1で、かつ、メモリ状態
判定回路14の出力が0の場合に、アドレス変換器12
から入力されたアドレスを出力し、それ以外の場合はC
PU11から入力されたアドレスを出力する。アドレス
変換器12は図2に示す領域Aのアドレスを領域Bのア
ドレスに変換する。
The address area judging section 13 outputs 1 when the address output from the CPU 11 corresponds to the address of the area A shown in FIG. 2, and outputs 0 otherwise.
When the microcomputer starts executing the program instruction, the memory state determination circuit 14 executes the flash EEPROM
The OM 16 has a register that reads the value of the area C shown in FIG. 2 in the OM 16 and stores the value, and outputs the value (0 or 1) written in the area C. In the area C, PR
1 is written when rewriting is performed by the OM writer, and 0 is written when on-board rewriting is performed. When the output of the address area determination unit 13 is 1 and the output of the memory state determination circuit 14 is 0, the selection circuit 15
Output the address input from C, otherwise C
The address input from the PU 11 is output. The address converter 12 converts the address of the area A shown in FIG.

【0015】まずオンボード書き換え前のマイクロコン
ピュータの動作について説明する。PROMライタで図
2に示すローダ領域とファーム領域の両方にプログラム
が書き込まれているものとする。ファーム領域には図5
に示すプログラムが書込まれており、図2の領域A内に
ある図3のベクタ1領域には図5のプログラムにおける
関数ABCの先頭アドレス値が書き込まれている。PR
OMライタで書込みを行う際にフラッシュEEPROM
16内の領域Cに1を書込んでおくと、メモリ状態判定
回路14は1を出力する。図5に示す命令2がCPU1
1に読み込まれた場合、プログラムカウンタが図2に示
す領域A内のベクタ1領域のアドレスを示す値になる。
このとき、アドレス領域判定部13は1を出力し領域A
のアドレスであると判定するが、メモリ状態判定回路1
4の出力が1であるので、選択回路15はCPU11か
ら出力されたアドレスをフラッシュEEPROM16に
供給し、フラッシュEEPROM16から領域A内のベ
クタ1のデータが読み出され、CPU11のプログラム
カウンタの値がベクタ1のデータになり、図5の関数A
BCに分岐する。
First, the operation of the microcomputer before on-board rewriting will be described. It is assumed that a program has been written to both the loader area and the firmware area shown in FIG. 2 by the PROM writer. Figure 5 shows the farm area.
5 is written in the vector 1 area of FIG. 3 in the area A of FIG. 2, and the start address value of the function ABC in the program of FIG. 5 is written. PR
Flash EEPROM when writing with OM writer
When 1 is written in the area C in the memory 16, the memory state determination circuit 14 outputs 1. Instruction 2 shown in FIG.
When read to 1, the program counter becomes a value indicating the address of the vector 1 area in the area A shown in FIG.
At this time, the address area determination unit 13 outputs 1 and outputs the area A
Is determined, the memory state determination circuit 1
4 is 1, the selection circuit 15 supplies the address output from the CPU 11 to the flash EEPROM 16, reads the data of the vector 1 in the area A from the flash EEPROM 16, and sets the value of the program counter of the CPU 11 to the vector. 1 and the function A of FIG.
Branch to BC.

【0016】次に、図5のユーザプログラムに変更が生
じ、フラッシュEEPROM16のオンボード書き換え
を行うとする。オンボード書き換えを行う際、図2に示
す領域Bに変更後のプログラムにおける関数ABCの先
頭アドレスを書き込むとともに、領域Cに0を書込む。
Next, it is assumed that a change occurs in the user program shown in FIG. 5 and on-board rewriting of the flash EEPROM 16 is performed. When performing on-board rewriting, the head address of the function ABC in the program after the change is written to the area B shown in FIG.

【0017】次に、オンボード書き換え後は、オンボー
ド書き換え時に領域Cに0が書き込まれているため、メ
モリ状態判定回路14の出力は0になる。図5に示す命
令2がCPU11に読み込まれた場合、プログラムカウ
ンタが図2に示す領域A内のベクタ1領域のアドレスを
示す値になる。このときアドレス領域判定部13は領域
Aのアドレスであると判定し1を出力し、選択回路15
はアドレス変換器12の出力(領域Aのアドレスが変換
された領域Bのアドレス)をフラッシュEEPROM1
6に供給し、領域B内のベクタ1のデータ(プログラム
変更後の関数ABCの先頭アドレス)が読み出され、C
PU11のプログラムカウンタの値が関数ABCの先頭
アドレスになり、関数ABCに分岐する。
Next, after the on-board rewriting, since 0 is written in the area C at the time of the on-board rewriting, the output of the memory state determination circuit 14 becomes 0. When the instruction 2 shown in FIG. 5 is read by the CPU 11, the program counter becomes a value indicating the address of the vector 1 area in the area A shown in FIG. At this time, the address area judging section 13 judges that the address is in the area A, outputs 1 and outputs
Indicates the output of the address converter 12 (the address of the area B obtained by converting the address of the area A) into the flash EEPROM 1
6, the data of the vector 1 in the area B (the head address of the function ABC after the program is changed) is read out, and
The value of the program counter of the PU 11 becomes the start address of the function ABC, and branches to the function ABC.

【0018】以上のように本実施の形態によれば、オン
ボード書換えを行う際、本来ローダ領域内の領域Aに書
き込まれるべき分岐先アドレスのデータ(ここでは関数
ABCの先頭アドレス)をファーム領域の領域Bに書き
込んでおくことで、オンボード書換え後に、CPU11
が領域Aのデータを読み出す動作を行った場合、CPU
11から出力されるアドレスを領域Bのアドレスに変換
して領域Bのデータを読み出すことによって、オンボー
ド書換え時に領域Aのデータに変更があっても、命令2
のようなベクタ間接分岐命令を正常に実行することがで
きる。これにより、ユーザプログラム開発上の制約をな
くし、プログラムコードサイズを縮小でき、フラッシュ
EEPROM16の容量を小さくできるので、マイクロ
コンピュータのコストを低く抑えられる等の利点が得ら
れる。
As described above, according to the present embodiment, when performing on-board rewriting, the data of the branch destination address (here, the start address of the function ABC) to be written to the area A in the loader area is stored in the firmware area. Is written in the area B of the CPU 11 so that the CPU 11
Performs the operation of reading the data in the area A,
By reading the data in the area B by converting the address output from the address 11 into the address in the area B, even if the data in the area A is changed at the time of on-board rewriting, the instruction 2
Can be normally executed. This eliminates restrictions on user program development, reduces the program code size, and reduces the capacity of the flash EEPROM 16, thereby providing advantages such as a reduction in microcomputer cost.

【0019】次に図1に示す構成を有するマイクロコン
ピュータのオンボード書換方法について説明する。図6
はフラッシュEEPROM内蔵マイクロコンピュータの
書換装置のブロック図である。17は入力されるプログ
ラムファイルを加工するプログラムデータ変換器、18
はマイクロコンピュータへ書き換えるプログラムを供給
するための通信制御回路、19は図1に示す構成を有す
るマイクロコンピュータである。
Next, an on-board rewriting method for a microcomputer having the configuration shown in FIG. 1 will be described. FIG.
1 is a block diagram of a rewriting device of a microcomputer with a built-in flash EEPROM. 17 is a program data converter for processing an input program file, 18
Is a communication control circuit for supplying a rewriting program to the microcomputer, and 19 is a microcomputer having the configuration shown in FIG.

【0020】プログラムデータ変換器17は、入力され
るプログラムファイルデータの内、図2の領域Aにあた
る部分を領域Bにコピーする。変換後のプログラムファ
イル中のファーム領域のデータが、通信制御回路18で
制御され、マイクロコンピュータ19に供給される。マ
イクロコンピュータ19はローダ領域に書き込まれてい
る書換制御プログラムを実行し、通信制御回路18から
書き換えるデータの供給を受け、ファーム領域のデータ
を書き換える。
The program data converter 17 copies a portion corresponding to the area A in FIG. The data of the firmware area in the converted program file is controlled by the communication control circuit 18 and supplied to the microcomputer 19. The microcomputer 19 executes the rewrite control program written in the loader area, receives the data to be rewritten from the communication control circuit 18, and rewrites the data in the firmware area.

【0021】ここで、プログラムデータ変換器17の動
作について詳しく説明しておく。図7(a)の入力デー
タに示されるように、ユーザはオンボード書換えを行わ
ないローダ領域の部分も合わせてプログラムを作成す
る。但し、書換制御プログラムの部分は固定プログラム
である。領域Aの部分はユーザが必要に応じて書き換え
る。領域Aの書換えを行った際は、領域Cのデータを0
にしておく。すなわち領域Aの内容に変更が生じた場
合、ユーザはプログラム作成時に領域Cに0を書いてお
く。領域Bはプログラム作成時には空けておく。ユーザ
が自由にプログラムデータとして使用できるのは、領域
C以降の部分のみである。プログラムデータ変換器17
では、図7(b)に示すように、領域Aのデータ(プロ
グラムA)を、空いている領域Bにコピーする。実際の
オンボード書換え処理では、ファーム領域のプログラム
データのみが書き込まれる。すなわち、領域Bのプログ
ラムA、領域Cの0、およびユーザプログラムが書き込
みデータとして使用される。
Here, the operation of the program data converter 17 will be described in detail. As shown in the input data of FIG. 7A, the user creates a program together with the portion of the loader area where on-board rewriting is not performed. However, the part of the rewrite control program is a fixed program. The user rewrites the area A as necessary. When the area A is rewritten, the data in the area C is set to 0.
Keep it. That is, when a change occurs in the content of the area A, the user writes 0 in the area C when creating the program. The area B is left empty when a program is created. The user can freely use only the part after the area C as the program data. Program data converter 17
Then, as shown in FIG. 7B, the data (program A) in the area A is copied to an empty area B. In the actual on-board rewriting process, only the program data in the firmware area is written. That is, the program A in the area B, 0 in the area C, and the user program are used as write data.

【0022】このように、プログラムデータ変換器17
で自動的にプログラムデータの変換が行われるので、マ
イクロコンピュータのユーザは、オンボード書換後に図
2の領域Aが領域Bに移動することを意識することなく
プログラム開発ができる。
As described above, the program data converter 17
2 automatically converts the program data, so that the user of the microcomputer can develop the program without being aware that the area A in FIG.

【0023】なお、上記実施の形態では、領域Aに書き
込まれているデータを読み出すことにより、間接的に関
数を呼び出す命令を例に説明したが、割り込み発生時の
割り込み処理などのベクタ間接分岐命令にも用いること
ができる。
In the above embodiment, an example in which an instruction for indirectly calling a function by reading data written in the area A has been described. However, a vector indirect branch instruction such as an interrupt processing at the time of occurrence of an interrupt is described. Can also be used.

【0024】[0024]

【発明の効果】本発明によれば、オンボード書換えを行
う際、本来ローダ領域内のベクタテーブル領域に書き込
まれるべき分岐先アドレスのデータをファーム領域に書
き込んでおくことで、オンボード書換え後に、CPUが
ベクタテーブル領域のデータを読み出す動作を行った場
合、CPUから出力されるアドレスをファーム領域のア
ドレスに変換してファーム領域のデータを読み出すこと
によって、オンボード書換え時にベクタテーブル領域の
データに変更があっても、ベクタ間接分岐命令を正常に
実行することができる。これにより、ユーザプログラム
開発上の制約をなくし、プログラムコードサイズを縮小
でき、マイクロコンピュータに内蔵するフラッシュEE
PROMの容量を小さくできるので、マイクロコンピュ
ータのコストを低く抑えられる等の利点が得られる。
According to the present invention, when performing on-board rewriting, the data of the branch destination address that should be originally written in the vector table area in the loader area is written in the firmware area. When the CPU performs the operation of reading the data in the vector table area, the address output from the CPU is converted to the address in the firmware area, and the data in the firmware area is read. , The vector indirect branch instruction can be executed normally. This eliminates restrictions on user program development, reduces the program code size, and allows the flash EE built in the microcomputer to be used.
Since the capacity of the PROM can be reduced, advantages such as the cost of the microcomputer can be reduced.

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

【図1】本発明の実施の形態におけるマイクロコンピュ
ータのブロック図
FIG. 1 is a block diagram of a microcomputer according to an embodiment of the present invention.

【図2】図1におけるフラッシュEEPROMのメモリ
アドレス領域を示した図。
FIG. 2 is a view showing a memory address area of the flash EEPROM in FIG. 1;

【図3】図2の領域Aの拡大詳細図。FIG. 3 is an enlarged detailed view of a region A in FIG. 2;

【図4】プログラム命令の一例を示す図。FIG. 4 is a diagram showing an example of a program instruction.

【図5】プログラム命令の一例を示す図。FIG. 5 is a diagram showing an example of a program instruction.

【図6】本発明の実施の形態におけるマイクロコンピュ
ータの書換装置のブロック図。
FIG. 6 is a block diagram of a microcomputer rewriting device according to an embodiment of the present invention.

【図7】本発明の実施の形態におけるマイクロコンピュ
ータの書換装置のプログラムデータ変換器の動作を説明
するための図。
FIG. 7 is a diagram for explaining the operation of the program data converter of the microcomputer rewriting device according to the embodiment of the present invention.

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

11 CPU 12 アドレス変換器 13 アドレス領域判定部 14 メモリ状態判定回路 15 選択回路 16 フラッシュEEPROM 17 プログラムデータ変換器 18 通信制御回路 19 EEPROM内蔵マイクロコンピュータ DESCRIPTION OF SYMBOLS 11 CPU 12 Address converter 13 Address area judgment part 14 Memory state judgment circuit 15 Selection circuit 16 Flash EEPROM 17 Program data converter 18 Communication control circuit 19 Microcomputer with built-in EEPROM

Claims (2)

【特許請求の範囲】[Claims] 【請求項1】 ベクタテーブル領域を含むローダ領域と
ファーム領域とを有したフラッシュEEPROMと、前
記ベクタテーブル領域に予め書き込まれている値により
間接分岐できる機能を有したCPUとを備えたマイクロ
コンピュータであって、 前記フラッシュEEPROMがPROMライタで書換え
後の状態かオンボード書換え後の状態かを判定するメモ
リ状態判定回路と、 前記CPUから出力されるアドレスが前記ベクタテーブ
ル領域のアドレスであるか否かを判定するアドレス領域
判定部と、 前記メモリ状態判定回路により前記フラッシュEEPR
OMがオンボード書換え後の状態であると判定され、か
つ前記アドレス領域判定部により前記CPUから出力さ
れるアドレスが前記ベクタテーブル領域のアドレスであ
ると判定された場合にのみ、前記CPUから出力される
アドレスを前記ファーム領域のアドレスに変換して前記
フラッシュEEPROMに供給し、それ以外の場合は前
記CPUから出力されるアドレスをそのまま前記フラッ
シュEEPROMに供給するアドレス変換・非変換回路
とを設けたことを特徴とするマイクロコンピュータ。
1. A microcomputer comprising: a flash EEPROM having a loader area including a vector table area and a firmware area; and a CPU having a function capable of indirect branching based on a value previously written in the vector table area. A memory state determination circuit for determining whether the flash EEPROM has been rewritten by a PROM writer or a state after on-board rewriting; and whether or not an address output from the CPU is an address of the vector table area. An address area determining unit that determines whether the flash EEPROM is
Only when OM is determined to be in a state after on-board rewriting and the address output from the CPU is determined by the address area determination unit to be an address of the vector table area, the output from the CPU is performed. And an address conversion / non-conversion circuit for supplying an address output from the CPU to the flash EEPROM as it is after converting the address to the address of the firmware area and supplying the address to the flash EEPROM otherwise. A microcomputer characterized by the above-mentioned.
【請求項2】 請求項1のマイクロコンピュータに内蔵
のフラッシュEEPROMのオンボード書換えを行うた
めに、プログラムファイルを入力し、このプログラムフ
ァイル中のベクタテーブル領域に書き込むべきデータが
ファーム領域に書き込まれるように自動的に変換する機
能を備えたマイクロコンピュータの書換装置。
2. A program file is inputted to perform on-board rewriting of a flash EEPROM built in the microcomputer according to claim 1, and data to be written to a vector table area in the program file is written to a firmware area. A microcomputer rewriting device with the function of automatically converting to a file.
JP27163699A 1999-09-27 1999-09-27 Microcomputer and device for rewriting the same Pending JP2001092675A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP27163699A JP2001092675A (en) 1999-09-27 1999-09-27 Microcomputer and device for rewriting the same

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP27163699A JP2001092675A (en) 1999-09-27 1999-09-27 Microcomputer and device for rewriting the same

Publications (1)

Publication Number Publication Date
JP2001092675A true JP2001092675A (en) 2001-04-06

Family

ID=17502834

Family Applications (1)

Application Number Title Priority Date Filing Date
JP27163699A Pending JP2001092675A (en) 1999-09-27 1999-09-27 Microcomputer and device for rewriting the same

Country Status (1)

Country Link
JP (1) JP2001092675A (en)

Similar Documents

Publication Publication Date Title
JP3838840B2 (en) Computer
JPH08272736A (en) Equipment and method for using of noninterchangeable central processing unit for computer system
JPH11219299A (en) Microcomputer
KR100223844B1 (en) Option circuit
JP2001092675A (en) Microcomputer and device for rewriting the same
JPH10333898A (en) Microcomputer
US6766448B2 (en) Microcomputer for transferring program data to an internal memory from an external memory connected via a bus and a method therefor
JP2004348327A (en) Digital signal processor and digital signal processing method
JP2000293376A (en) Circuit and method for switching boot program
JP2002157115A (en) Data processor
JPH0410081B2 (en)
JP2001125608A (en) Programmable logic controller
JP3760093B2 (en) Microcomputer
JP2000105701A (en) Data processor
JP2000172359A (en) Starting method for personal computer
JP3097602B2 (en) Data processing device
JPH1050086A (en) Microcomputer having eeprom and its rewriting method
JP3207333B2 (en) Programmable controller
JP3147727B2 (en) Information processing apparatus and control method thereof
JP2002024043A (en) Microcomputer with built-in flash eeprom
JPH11259308A (en) Programmable controller
JPH1021067A (en) Dynamic correction method for program
JP3997505B2 (en) System program rewriting method for programmable controller
JP2002132499A (en) Data processing apparatus and recording medium
JP2928216B1 (en) Semiconductor integrated circuit