JP2002287994A - Microcontroller - Google Patents

Microcontroller

Info

Publication number
JP2002287994A
JP2002287994A JP2001092389A JP2001092389A JP2002287994A JP 2002287994 A JP2002287994 A JP 2002287994A JP 2001092389 A JP2001092389 A JP 2001092389A JP 2001092389 A JP2001092389 A JP 2001092389A JP 2002287994 A JP2002287994 A JP 2002287994A
Authority
JP
Japan
Prior art keywords
ram
address
cpu
microcontroller
program
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
JP2001092389A
Other languages
Japanese (ja)
Inventor
Masahiro Kaminan
雅裕 上南
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 JP2001092389A priority Critical patent/JP2002287994A/en
Publication of JP2002287994A publication Critical patent/JP2002287994A/en
Pending legal-status Critical Current

Links

Abstract

PROBLEM TO BE SOLVED: To provide a microcontroller including a nonvolatile memory enabling to use the entire range of the nonvolatile memory as a range for a user program or data, without increasing the area of a chip. SOLUTION: A serial interface 16 and a DMA 17 transfer a program controlling rewriting of a flash memory 12 from an exterior device 30 to a RAM 14 in an early state. Under the condition that an on-board rewriting mode signal SM is inputted, a reset vector converting circuit 20 outputs an address of a RAM 13 storing a program instead of a reset vector when a CPU 22 outputs a storing address of the reset vector. Thereby, the CPU 13 executes a rewriting control program stored in the RAM 14 just after releasing a reset.

Description

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

【0001】[0001]

【発明の属する技術分野】本発明は、不揮発性メモリを
内蔵したマイクロコントローラに関する技術に属する。
The present invention relates to a technique relating to a microcontroller having a built-in nonvolatile memory.

【0002】[0002]

【従来の技術】近年、電気的に消去および書き込み可能
なフラッシュメモリ等の不揮発性メモリを内蔵したマイ
クロコントローラについて、これがシステムに実装され
た状態すなわちオンボード状態において、不揮発性メモ
リに対してプログラムやデータ等の記憶内容を書き換え
変更するための種々の方法が提案されている。
2. Description of the Related Art In recent years, a microcontroller having a built-in nonvolatile memory such as an electrically erasable and writable flash memory has been programmed with respect to the nonvolatile memory when the microcontroller is mounted on a system, that is, on-board. Various methods have been proposed for rewriting and changing storage contents such as data.

【0003】不揮発性メモリの書き換えモードには、C
PUの制御の基に書き換えを行うオンボード書き換えモ
ードと、汎用PROMライターのような外部装置の制御
の基に書き換えを行うPROM書き換えモードとの2つ
の異なるモードがある。PROM書き換えモードは、主
にマイクロコントローラをシステムに実装する前の初期
データや初期プログラムの書き込みに適用される。一
方、オンボード書き換えモードは、マイクロコントロー
ラを実装した製品の出荷直前のプログラム変更や出荷後
のプログラムバージョンアップ等に使用される、という
使い分けがなされている。
[0005] The rewriting mode of the nonvolatile memory includes C
There are two different modes, an on-board rewrite mode in which rewriting is performed under the control of the PU, and a PROM rewrite mode in which rewriting is performed under the control of an external device such as a general-purpose PROM writer. The PROM rewrite mode is mainly applied to writing of initial data and an initial program before the microcontroller is mounted on the system. On the other hand, the on-board rewrite mode is properly used for changing a program immediately before shipment of a product in which a microcontroller is mounted, upgrading a program version after shipment, and the like.

【0004】より詳細には、PROM書き換えモードの
場合、不揮発性メモリは、汎用PROMライター等の外
部装置によって外部から直接アクセス可能な状態とな
り、不揮発性メモリの書き換え制御に関係のないCPU
等は、不揮発性メモリから切り離された状態となる。
More specifically, in the PROM rewrite mode, the nonvolatile memory is in a state where it can be directly accessed from the outside by an external device such as a general-purpose PROM writer.
Etc. are in a state separated from the nonvolatile memory.

【0005】一方、オンボード書き換えモードの場合
は、不揮発性メモリの所定の領域には、オンボード書き
換えモードであるか否かを判定するための書き換えモー
ド判定プログラムと、不揮発性メモリの書き換えを制御
する書き換え制御プログラムをRAMに転送する転送制
御プログラムとが予め書き込まれている。そして、モー
ド判定プログラムの実行によってオンボード書き換えモ
ードであることを認識した場合、CPUは、転送制御プ
ログラムを実行することによって、マイクロコントロー
ラに一般に搭載されている周辺機能であるシリアルイン
ターフェースやDMAを動作させて、外部装置から書き
換え制御プログラムをRAMに転送する。転送終了後、
CPUの処理はRAM上の書き換え制御プログラムの実
行に移行し、これによって不揮発性メモリに対する消去
・書き込みが行われる。
On the other hand, in the case of the on-board rewrite mode, a rewrite mode determination program for determining whether or not the rewrite mode is the on-board rewrite mode is provided in a predetermined area of the non-volatile memory. And a transfer control program for transferring the rewrite control program to be transferred to the RAM. If the CPU recognizes that the mode is the on-board rewrite mode by executing the mode determination program, the CPU executes the transfer control program to operate the serial interface and DMA which are peripheral functions generally mounted on the microcontroller. Then, the rewriting control program is transferred from the external device to the RAM. After the transfer,
The processing of the CPU shifts to the execution of a rewrite control program on the RAM, whereby erasing and writing to the nonvolatile memory are performed.

【0006】上述したオンボード書き換え方法は、書き
換え対象となる不揮発性メモリ内に予めモード判定プロ
グラムと転送制御プログラムを書き込んでおくという方
法であった。このような方法とは別に、転送制御プログ
ラムを書き換え対象となる不揮発性メモリとは別のマス
クROMに格納しておき、オンボード書き換えモードで
ある場合には、マスクROM上の転送制御プログラムを
実行してRAMに書き換え制御プログラムを転送して、
CPUの処理をRAM上の転送プログラムに移行して不
揮発性メモリを書き換える方法も提案されている。
The above-described on-board rewriting method is a method in which a mode determination program and a transfer control program are previously written in a nonvolatile memory to be rewritten. Separately from this method, the transfer control program is stored in a mask ROM different from the nonvolatile memory to be rewritten, and in the on-board rewrite mode, the transfer control program in the mask ROM is executed. And transfer the rewrite control program to the RAM,
A method of rewriting the nonvolatile memory by transferring the processing of the CPU to a transfer program on the RAM has also been proposed.

【0007】図7は不揮発性メモリに予めモード判定プ
ログラムと転送制御プログラムとが書き込まれたマイク
ロコントローラの構成を示す図であり、図8は転送制御
プログラムがマスクROMに格納された不揮発性メモリ
内蔵マイクロコントローラの構成を示す図である。
FIG. 7 is a diagram showing a configuration of a microcontroller in which a mode determination program and a transfer control program are previously written in a nonvolatile memory. FIG. 8 shows a nonvolatile memory in which a transfer control program is stored in a mask ROM. FIG. 3 is a diagram illustrating a configuration of a microcontroller.

【0008】まず図7の構成において、オンボード書き
換えがどのように実行されるかを説明する。外部装置5
8はマイクロコントローラ50に対して、リセット解除
信号とオンボード書き換えモード信号を出力する。リセ
ット解除したCPU51は、不揮発性メモリとしてのフ
ラッシュメモリ52に格納されたモード判定プログラム
を実行し、データ端子とクロック端子の状態を認識し
て、オンボード書き換えモードであるか否かを判定す
る。オンボード書き換えモードを認識した場合、CPU
51は、フラッシュメモリ52に格納された転送制御プ
ログラムを実行し、シリアルインターフェース56やD
MA57を制御して、外部装置58から書き換え制御プ
ログラムを受信しRAM53に転送する。書き換え制御
プログラムのRAM53への転送が完了すると、CPU
51は命令の実行をRAM53上のプログラムに移行
し、転送された書き換え制御プログラムを実行し、外部
装置58から書き込むべきユーザープログラムやデータ
を受信しながら、フラッシュメモリ52に対して消去・
書き込みを実行する。
First, how the on-board rewriting is performed in the configuration shown in FIG. 7 will be described. External device 5
8 outputs a reset release signal and an on-board rewrite mode signal to the microcontroller 50. The CPU 51 that has released the reset executes the mode determination program stored in the flash memory 52 as the nonvolatile memory, recognizes the states of the data terminal and the clock terminal, and determines whether or not the mode is the on-board rewrite mode. When the onboard rewrite mode is recognized, the CPU
51 executes the transfer control program stored in the flash memory 52,
It controls the MA 57 to receive the rewrite control program from the external device 58 and transfers it to the RAM 53. When the transfer of the rewrite control program to the RAM 53 is completed, the CPU
51 shifts the execution of the instruction to a program on the RAM 53, executes the transferred rewrite control program, and erases / writes the flash memory 52 while receiving the user program and data to be written from the external device 58.
Execute writing.

【0009】次に図8の構成において、オンボード書き
換えがどのように実行されるかを説明する。外部装置6
9はマイクロコントローラ60に対して、リセット解除
信号とオンボード書き換えモード信号を出力する。リセ
ット解除したCPU61は、データ端子とクロック端子
の状態を認識してハードウェア的にオンボード書き換え
モードであるか否かを判定する。オンボード書き換えモ
ードを認識した場合、CPU61は、マスクROM68
に格納された転送制御プログラムを実行し、シリアルイ
ンターフェース66やDMA67を制御して、外部装置
69から書き換え制御プログラムを受信しRAM63に
転送する。書き換え制御プログラムのRAM63への転
送が完了すると、CPU61は命令の実行をRAM63
上のプログラムに移行し、転送された書き換え制御プロ
グラムを実行し、外部装置69から書き込むべきユーザ
ープログラムやデータを受信しながら、フラッシュメモ
リ62に対して消去・書き込みを実行する。
Next, how the on-board rewriting is performed in the configuration of FIG. 8 will be described. External device 6
9 outputs a reset release signal and an on-board rewrite mode signal to the microcontroller 60. The CPU 61 that has released the reset recognizes the state of the data terminal and the clock terminal and determines whether or not the mode is the on-board rewrite mode by hardware. When recognizing the onboard rewrite mode, the CPU 61 sets the mask ROM 68
, And controls the serial interface 66 and the DMA 67 to receive the rewrite control program from the external device 69 and transfer it to the RAM 63. When the transfer of the rewrite control program to the RAM 63 is completed, the CPU 61 executes the instruction to the RAM 63.
The program shifts to the above program, executes the transferred rewrite control program, and executes erasing / writing to the flash memory 62 while receiving a user program or data to be written from the external device 69.

【0010】[0010]

【発明が解決しようとする課題】しかしながら、まず図
7のような従来の構成では、CPUは必ず不揮発性メモ
リ上のアドレスからアクセスを開始するため、オンボー
ド書き換えを制御するために必要なモード判定プログラ
ムや転送制御プログラムを予め不揮発性メモリ自身に書
き込んでおく必要が生じた。この結果、不揮発性メモリ
の全領域をユーザープログラムやデータの領域として活
用できないという問題があった。
However, in the conventional configuration as shown in FIG. 7, the CPU always starts the access from the address in the nonvolatile memory, so that the mode determination necessary for controlling the on-board rewriting is performed. It has become necessary to write a program or a transfer control program in the nonvolatile memory itself in advance. As a result, there is a problem that the entire area of the nonvolatile memory cannot be used as an area for the user program or data.

【0011】また図8のような、不揮発性メモリの全領
域をユーザープログラムやデータの領域として活用でき
るように、転送制御プログラムを不揮発性メモリとは別
のマスクROMに格納しておく構成では、ハードウェア
としてマスクROMを追加しなければならないためにチ
ップ面積が大きくなり、したがって、チップコストが増
大するという問題があった。
In a configuration as shown in FIG. 8, the transfer control program is stored in a mask ROM separate from the non-volatile memory so that the entire area of the non-volatile memory can be used as a user program or data area. Since a mask ROM has to be added as hardware, the chip area is increased, and the chip cost is increased.

【0012】前記の問題に鑑み、本発明は、不揮発性メ
モリ内蔵マイクロコントローラとして、チップ面積を増
大させることなく、不揮発性メモリの全領域をユーザー
プログラムやデータの領域として活用可能にすることを
課題とする。
In view of the above problems, it is an object of the present invention to provide a microcontroller with a built-in nonvolatile memory that makes it possible to utilize the entire area of the nonvolatile memory as a user program or data area without increasing the chip area. And

【0013】[0013]

【課題を解決するための手段】前記の課題を解決するた
めに、本発明が講じた解決手段は、マイクロコントロー
ラとして、CPUと、記憶内容が電気的に消去および書
き込み可能な不揮発性メモリと、RAMとを備え、オン
ボード書き換えモードにおいてリセットがかかったと
き、リセット解除後に、前記CPUが前記RAMに格納
された前記不揮発性メモリの書き換えを制御するプログ
ラムを実行するように構成されているものである。
Means for Solving the Problems To solve the above-mentioned problems, a solution taken by the present invention is to provide a CPU as a microcontroller, a nonvolatile memory whose storage contents can be electrically erased and written, and And a CPU configured to execute a program for controlling rewriting of the non-volatile memory stored in the RAM when reset is applied in an on-board rewriting mode and after reset is released. is there.

【0014】この発明によると、CPUが、リセットを
解除した後に、RAMに格納された書き換え制御プログ
ラムを直接実行することが可能となるため、不揮発性メ
モリ上に予めモード判定プログラムや転送制御プログラ
ムを書き込んでおく必要がない。この結果、不揮発性メ
モリの全領域を、ユーザープログラムおよびデータの領
域として活用することが可能となる。
According to the present invention, the CPU can directly execute the rewrite control program stored in the RAM after the reset is released, so that the mode determination program and the transfer control program are previously stored in the nonvolatile memory. There is no need to write it. As a result, the entire area of the nonvolatile memory can be used as a user program and data area.

【0015】そして、前記本発明に係るマイクロコント
ローラは、オンボード書き換えモード信号が入力された
状態で、前記CPUがリセットベクタの格納アドレスを
出力したとき、前記CPUに対して、リセットベクタの
代わりに、前記プログラムが格納された前記RAMのア
ドレスを出力するリセットベクタ変換回路を備えている
のが好ましい。
In the microcontroller according to the present invention, when the CPU outputs the storage address of the reset vector while the on-board rewrite mode signal is input, the microcontroller outputs the reset vector instead of the reset vector. And a reset vector conversion circuit for outputting an address of the RAM in which the program is stored.

【0016】また、前記本発明に係るマイクロコントロ
ーラは、オンボード書き換えモード信号が入力された状
態で、前記CPUがリセットベクタの格納アドレスを出
力したとき、前記格納アドレスを、前記プログラムが格
納された前記RAMのアドレスに変換して出力するRA
Mアドレス出力回路を備えているのが好ましい。
In the microcontroller according to the present invention, when the CPU outputs a storage address of a reset vector in a state where an on-board rewrite mode signal is input, the storage address is stored in the microcontroller. RA for converting to the address of the RAM and outputting
Preferably, an M address output circuit is provided.

【0017】さらに、前記本発明に係るマイクロコント
ローラは、外部装置とのデータ通信を行うシリアルイン
ターフェースと、前記シリアルインターフェースによっ
て受信したデータを前記CPUの動作を介さずに前記R
AMに転送するDMAとを備え、前記シリアルインター
フェースおよびDMAは、オンボード書き換えモード信
号を受けて、前記外部装置から前記プログラムを受信可
能になり、かつ、受信したプログラムを前記RAMに転
送可能な状態になるのが好ましい。
Further, the microcontroller according to the present invention comprises a serial interface for performing data communication with an external device, and the data received by the serial interface to the R interface without the operation of the CPU.
A DMA for transferring the program to the AM, wherein the serial interface and the DMA are capable of receiving the program from the external device upon receiving an on-board rewrite mode signal, and capable of transferring the received program to the RAM. It is preferable that

【0018】[0018]

【発明の実施の形態】以下、本発明の実施形態につい
て、図面を参照しながら説明する。
Embodiments of the present invention will be described below with reference to the drawings.

【0019】(第1の実施形態)図1は本発明の第1の
実施形態に係る不揮発性メモリ内蔵マイクロコントロー
ラの構成を示す図である。図1において、10は不揮発
性メモリ内蔵マイクロコントローラ、11はCPU、1
2は書き換え対象となる電気的に消去および書き込み可
能な不揮発性メモリとしてのフラッシュメモリ、13は
RAM、14はアドレスバス、15はデータバス、16
は外部装置30との通信を行うシリアルインターフェー
ス、17はシリアルインターフェース16によって受信
したデータをCPU11の動作を介さずにハードウェア
的にRAM13に転送するDMAである。外部装置30
は、フラッシュメモリ12の書き換えを制御する書き換
え制御プログラムと、他のプログラムやデータをマイク
ロコントローラ10に対して供給する。
(First Embodiment) FIG. 1 is a diagram showing a configuration of a microcontroller with a built-in nonvolatile memory according to a first embodiment of the present invention. In FIG. 1, 10 is a microcontroller with built-in nonvolatile memory, 11 is a CPU, 1
2 is a flash memory as an electrically erasable and writable nonvolatile memory to be rewritten, 13 is a RAM, 14 is an address bus, 15 is a data bus, 16
Reference numeral 17 denotes a serial interface that communicates with the external device 30; and 17, a DMA that transfers data received by the serial interface 16 to the RAM 13 in hardware without going through the operation of the CPU 11. External device 30
Supplies a rewrite control program for controlling rewriting of the flash memory 12, and other programs and data to the microcontroller 10.

【0020】図1に示すマイクロコントローラ10は、
オンボード書き換えモードにおいてリセットがかかった
とき、リセット解除後に、CPU11が、RAM13に
格納された,フラッシュメモリ12の書き換えを制御す
るプログラムを実行するように、構成されている。20
はCPU11が、リセットを解除した後にRAM13上
のプログラムを直接実行可能なように設けられたリセッ
トベクタ変換回路である。リセットベクタ変換回路20
は、オンボード書き換えモード信号SMが入力された状
態で、CPU11がリセットベクタの格納アドレスを出
力したとき、CPU11に対して、リセットベクタの代
わりに、書き換え制御プログラムが格納されたRAM1
3のアドレスを出力する。
The microcontroller 10 shown in FIG.
When a reset is applied in the on-board rewrite mode, the CPU 11 executes a program for controlling rewriting of the flash memory 12 stored in the RAM 13 after the reset is released. 20
Is a reset vector conversion circuit provided so that the CPU 11 can directly execute the program on the RAM 13 after releasing the reset. Reset vector conversion circuit 20
When the CPU 11 outputs the storage address of the reset vector in a state where the on-board rewrite mode signal SM is input, the CPU 1 outputs to the CPU 1 the RAM 1 storing the rewrite control program instead of the reset vector.
The address 3 is output.

【0021】図2はリセットベクタ変換回路20の構成
の一例を示す図である。図2において、21はCPU1
1から出力されたアドレスがリセットベクタアドレスで
あるか否かを判定するアドレス比較器、22はオンボー
ド書き換えモード信号SMが入力され、かつアドレス比
較器21の出力がアクティブであるとき、“H”レベル
を出力するANDゲート、23はRAM13において書
き換え制御プログラムが格納されたアドレス値を出力す
るRAMアドレス発生器、24はANDゲート22の出
力が“H”レベルであるときはRAMアドレス発生器2
3の出力を選択する一方、“L”レベルであるときはデ
ータバス15の値を出力するセレクタである。
FIG. 2 is a diagram showing an example of the configuration of the reset vector conversion circuit 20. In FIG. 2, reference numeral 21 denotes a CPU1.
The address comparator 22 determines whether or not the address output from 1 is a reset vector address. When the on-board rewrite mode signal SM is input and the output of the address comparator 21 is active, the address comparator 22 is set to “H”. An AND gate 23 for outputting a level, 23 is a RAM address generator for outputting an address value in the RAM 13 at which the rewrite control program is stored, and 24 is a RAM address generator 2 when the output of the AND gate 22 is at "H" level.
3 is a selector that outputs the value of the data bus 15 when the output is at the “L” level while the output of the data bus 15 is selected.

【0022】図3は本実施形態におけるメモリのアドレ
ス空間である。図3に示すように、RAM13の先頭ア
ドレスX‘00000’(Xは16進数を表す)から、
書き換え制御プログラムが格納されている。また、フラ
ッシュメモリ12の先頭アドレスX‘04000’には
リセットベクタが格納されている。すなわち、図2にお
けるアドレス比較器21はCPU11から出力されたア
ドレスがX‘04000’であるか否かを判定し、RA
Mアドレス発生器23はアドレスX‘00000’を出
力する。
FIG. 3 shows an address space of the memory according to the present embodiment. As shown in FIG. 3, from the start address X'00000 '(X represents a hexadecimal number) of the RAM 13,
A rewrite control program is stored. Further, a reset vector is stored at the head address X'04000 'of the flash memory 12. That is, the address comparator 21 in FIG. 2 determines whether the address output from the CPU 11 is X'04000 ',
M address generator 23 outputs address X'00000 '.

【0023】以上のように構成された本実施形態に係る
マイクロコントローラについて、以下、その動作を説明
する。
The operation of the thus configured microcontroller according to the present embodiment will be described below.

【0024】まず、外部装置30はマイクロコントロー
ラ10に対して、オンボード書き換えモード信号SMを
出力し、これに続いて、フラッシュメモリ12の書き換
えを制御する書き換え制御プログラムを出力する。シリ
アルインターフェース16およびDMA17は、CPU
11からの制御が行われていない初期状態において、外
部から入力されたデータをRAM13に転送可能な状態
になっている。すなわち、外部装置30から書き換え制
御プログラムを受信して、RAM13に転送する。
First, the external device 30 outputs an on-board rewrite mode signal SM to the microcontroller 10, and subsequently outputs a rewrite control program for controlling rewriting of the flash memory 12. The serial interface 16 and the DMA 17 are a CPU
In an initial state in which the control from 11 is not performed, data input from the outside can be transferred to the RAM 13. That is, the rewrite control program is received from the external device 30 and transferred to the RAM 13.

【0025】図4に示すように、シリアルインターフェ
ース16およびDMA17は、制御レジスタ31,32
を有しており、制御レジスタ31,32のリセット時の
設定値が、オンボード書き換えモード信号SMの状態に
よって変更される。例えば、図4(a)の構成では、レ
ジスタ出力のリセット状態が“L”レベルであり、オン
ボード書き換えモード信号SMが“H”のときレジスタ
出力を“H”に変更することが可能になる。また図4
(b)の構成では、レジスタ出力のリセット状態が
“H”レベルであり、オンボード書き換えモード信号S
Mが“H”のときレジスタ出力を“L”に変更すること
が可能になる。
As shown in FIG. 4, the serial interface 16 and the DMA 17 include control registers 31 and 32.
The reset values of the control registers 31 and 32 are changed according to the state of the on-board rewrite mode signal SM. For example, in the configuration of FIG. 4A, the reset state of the register output is “L” level, and when the on-board rewrite mode signal SM is “H”, the register output can be changed to “H”. . FIG. 4
In the configuration of (b), the reset state of the register output is “H” level, and the on-board rewrite mode signal S
When M is “H”, the register output can be changed to “L”.

【0026】書き換え制御プログラムのRAM13への
転送が完了すると、外部装置30はマイクロコントロー
ラ10に対して、リセットを解除する信号を出力する。
リセット解除したCPU11は、リセット解除後にジャ
ンプするメモリアドレス値(リセットベクタアドレス
値)を読み出すために、フラッシュメモリ12上にマッ
ピングされているリセットベクタアドレスを出力する。
When the transfer of the rewrite control program to the RAM 13 is completed, the external device 30 outputs to the microcontroller 10 a signal for releasing the reset.
The CPU 11 that has released the reset outputs the reset vector address mapped on the flash memory 12 to read the memory address value (reset vector address value) that jumps after the reset is released.

【0027】リセットベクタアドレスがアドレスバス1
4に出力された場合、リセットベクタ変換回路20にお
いて、アドレス比較器21は“H”レベルを出力する。
このとき、オンボード書き換えモード信号SMも“H”
レベルになっているため、ANDゲート22は“H”レ
ベルをセレクタ24に対して出力し、セレクタ24は、
RAMアドレス発生器23の出力すなわちアドレスX
‘00000’を、CPU11に対して出力する。
The reset vector address is the address bus 1
4, in the reset vector conversion circuit 20, the address comparator 21 outputs “H” level.
At this time, the on-board rewrite mode signal SM is also “H”.
Therefore, the AND gate 22 outputs an “H” level to the selector 24, and the selector 24
Output of RAM address generator 23, ie, address X
'00000' is output to the CPU 11.

【0028】この結果、CPU11は、RAM13の先
頭アドレスX‘00000’をリセットベクタアドレス
の内容と認識して、RAM13上の書き換え制御プログ
ラムの実行を開始する。そして、外部装置30から書き
込むべきプログラムやデータを受信しながら、フラッシ
ュメモリ12に対して消去・書き込みを実行する。
As a result, the CPU 11 recognizes the start address X'00000 'of the RAM 13 as the contents of the reset vector address, and starts executing the rewrite control program on the RAM 13. Then, while receiving a program or data to be written from the external device 30, the flash memory 12 is erased and written.

【0029】(第2の実施形態)図5は本発明の第2の
実施形態に係る不揮発性メモリ内蔵マイクロコントロー
ラの構成を示す図である。図5において、図1と共通の
構成要素には、図1と同一の符号を付している。
(Second Embodiment) FIG. 5 is a diagram showing a configuration of a microcontroller with a built-in nonvolatile memory according to a second embodiment of the present invention. 5, the same reference numerals as in FIG. 1 denote the same components as in FIG.

【0030】図5に示すマイクロコントローラ10A
は、第1の実施形態と同様に、オンボード書き換えモー
ドにおいてリセットがかかったとき、リセット解除後
に、CPU11が、RAM13に格納された,フラッシ
ュメモリ12の書き換えを制御するプログラムを実行す
るように、構成されている。40はCPU11が、リセ
ットを解除した後にRAM13上のプログラムを直接実
行可能なように設けられたRAMアドレス出力回路であ
る。RAMアドレス出力回路40は、オンボード書き換
えモード信号SMが入力された状態で、CPU11がリ
セットベクタの格納アドレスを出力したとき、格納アド
レスを、書き換え制御プログラムが格納されたRAM1
3のアドレスに変換して出力する。
The microcontroller 10A shown in FIG.
Similar to the first embodiment, when reset is applied in the on-board rewrite mode, the CPU 11 executes a program for controlling rewriting of the flash memory 12 stored in the RAM 13 after reset release. It is configured. Reference numeral 40 denotes a RAM address output circuit provided so that the CPU 11 can directly execute a program on the RAM 13 after releasing the reset. When the CPU 11 outputs the storage address of the reset vector while the on-board rewrite mode signal SM is input, the RAM address output circuit 40 changes the storage address to the RAM 1 in which the rewrite control program is stored.
3 and output.

【0031】図6はRAMアドレス出力回路40の構成
の一例を示す図である。図6において、41はCPU1
1から出力されたアドレスがリセットベクタアドレスで
あるか否かを判定するアドレス比較器、42はオンボー
ド書き換えモード信号SMが入力され、かつアドレス比
較器41の出力がアクティブであるとき、“H”レベル
を出力するANDゲート、43はCPU11から出力さ
れたアドレスがリセットベクタアドレスであるとき、こ
れをRAM13において書き換え制御プログラムが格納
されたアドレス値に変換するアドレス変換器、44はA
NDゲート42の出力が“H”レベルであるときはアド
レス変換器43の出力を選択する一方、“L”レベルで
あるときは、CPU11から出力されたアドレス値を出
力するセレクタである。
FIG. 6 is a diagram showing an example of the configuration of the RAM address output circuit 40. In FIG. 6, reference numeral 41 denotes the CPU 1
The address comparator 42 determines whether or not the address output from 1 is a reset vector address. When the on-board rewrite mode signal SM is input and the output of the address comparator 41 is active, “H” is set. An AND gate 43 for outputting a level, an address converter 43 for converting a reset vector address into an address value in which a rewrite control program is stored in the RAM 13 when the address output from the CPU 11 is a reset vector address, and a reference numeral 44 for A
When the output of the ND gate 42 is at "H" level, the selector selects the output of the address converter 43, and when it is at "L" level, it is a selector that outputs the address value output from the CPU 11.

【0032】以上のように構成された本実施形態に係る
マイクロコントローラについて、以下、その動作を説明
する。
The operation of the microcontroller according to the present embodiment configured as described above will be described below.

【0033】まず、外部装置30はマイクロコントロー
ラ10Aに対して、オンボード書き換えモード信号SM
を出力し、これに続いて、フラッシュメモリ12の書き
換えを制御する書き換え制御プログラムを出力する。シ
リアルインターフェース16およびDMA17は、CP
U11からの制御が行われていない初期状態において、
外部から入力されたデータをRAM13に転送可能な状
態になっている。すなわち、外部装置30から書き換え
制御プログラムを受信して、RAM13に転送する。
First, the external device 30 sends an on-board rewrite mode signal SM to the microcontroller 10A.
Then, a rewrite control program for controlling rewriting of the flash memory 12 is output. The serial interface 16 and the DMA 17
In the initial state where the control from U11 is not performed,
Data input from the outside can be transferred to the RAM 13. That is, the rewrite control program is received from the external device 30 and transferred to the RAM 13.

【0034】書き換え制御プログラムのRAM13への
転送が完了すると、外部装置30はマイクロコントロー
ラ10Aに対して、リセットを解除する信号を出力す
る。リセット解除したCPU11は、リセット解除後に
ジャンプするメモリアドレス値(リセットベクタアドレ
ス値)を読み出すために、フラッシュメモリ12上にマ
ッピングされているリセットベクタアドレスを出力す
る。
When the transfer of the rewrite control program to the RAM 13 is completed, the external device 30 outputs a signal for releasing the reset to the microcontroller 10A. The CPU 11 that has released the reset outputs the reset vector address mapped on the flash memory 12 to read the memory address value (reset vector address value) that jumps after the reset is released.

【0035】リセットベクタアドレスが出力されたと
き、RAMアドレス出力回路40において、アドレス比
較器41は“H”レベルを出力する。このとき、オンボ
ード書き換えモード信号SMも“H”レベルになってい
るため、ANDゲート42は“H”レベルをセレクタ4
4に対して出力する。セレクタ44はアドレス変換器4
3によって変換されたアドレス値すなわちアドレスX
‘00000’をアドレスバス14に出力する。
When the reset vector address is output, in the RAM address output circuit 40, the address comparator 41 outputs "H" level. At this time, since the on-board rewrite mode signal SM is also at the “H” level, the AND gate 42 sets the “H” level to the selector 4.
4 is output. The selector 44 is an address converter 4
3, the address value translated by
'00000' is output to the address bus 14.

【0036】この結果、CPU11は、RAM13の先
頭アドレスX‘00000’をリセットベクタアドレス
の内容と認識して、RAM13上の書き換え制御プログ
ラムの実行を開始する。そして、外部装置30から書き
込むべきプログラムやデータを受信しながら、フラッシ
ュメモリ12に対して消去・書き込みを実行する。
As a result, the CPU 11 recognizes the start address X'00000 'of the RAM 13 as the contents of the reset vector address, and starts executing the rewrite control program on the RAM 13. Then, while receiving a program or data to be written from the external device 30, the flash memory 12 is erased and written.

【0037】以上のように上述の各実施形態によると、
シリアルインターフェースおよびDMAを、その初期状
態において、外部装置から出力されたデータを受信する
状態とすることによって、RAM上に書き換え制御プロ
グラムを転送できる。また、リセットベクタ変換回路2
0やRAMアドレス変換回路40によって、CPU11
が、リセット解除後に、RAM13に転送された書き換
え制御プログラムを直接実行することが可能となる。す
なわち、リセット解除後にRAMからプログラムを起動
することができ、これにより、フラッシュメモリ12上
に予めモード判定プログラムや転送制御プログラムを書
き込んでおく必要がなくなる。この結果、フラッシュメ
モリ12の全領域を、ユーザープログラムおよびデータ
の領域として活用することが可能となる。また、マスク
ROM等のように不揮発性メモリとは別のメモリ領域
に、転送制御プログラムを格納しておく必要もないた
め、チップ面積の増加もない。
As described above, according to each of the above embodiments,
By setting the serial interface and the DMA to receive data output from the external device in the initial state, the rewrite control program can be transferred to the RAM. Also, the reset vector conversion circuit 2
0 and the RAM address conversion circuit 40
However, after the reset is released, the rewrite control program transferred to the RAM 13 can be directly executed. That is, the program can be started from the RAM after the reset is released, so that it is not necessary to previously write the mode determination program and the transfer control program on the flash memory 12. As a result, the entire area of the flash memory 12 can be used as a user program and data area. Further, since it is not necessary to store the transfer control program in a memory area different from the nonvolatile memory such as a mask ROM or the like, there is no increase in chip area.

【0038】[0038]

【発明の効果】以上のように本発明によると、CPU
が、リセットを解除後に、RAMに格納されたプログラ
ムを実行できるので、ユーザーは不揮発性メモリの全領
域をユーザープログラムやデータの領域として活用する
ことが可能となる。また、わずかな回路の追加によって
実現できるため、コストパフォーマンスが高いという効
果を得ることができる。
As described above, according to the present invention, the CPU
However, after the reset is released, the program stored in the RAM can be executed, so that the user can utilize the entire area of the nonvolatile memory as the area for the user program and data. In addition, since it can be realized by adding a small number of circuits, an effect of high cost performance can be obtained.

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

【図1】本発明の第1の実施形態に係る不揮発性メモリ
内蔵マイクロコントローラの構成を示す図である。
FIG. 1 is a diagram showing a configuration of a microcontroller with a built-in nonvolatile memory according to a first embodiment of the present invention.

【図2】本発明の第1の実施形態におけるリセットベク
タ変換回路の構成を示す図である。
FIG. 2 is a diagram illustrating a configuration of a reset vector conversion circuit according to the first embodiment of the present invention.

【図3】本発明の第1および第2の実施形態におけるメ
モリのアドレス空間である。
FIG. 3 is an address space of a memory according to the first and second embodiments of the present invention.

【図4】シリアルインターフェースおよびDMAにおけ
るレジスタ制御を示す図である。
FIG. 4 is a diagram showing register control in a serial interface and DMA.

【図5】本発明の第2の実施形態に係る不揮発性メモリ
内蔵マイクロコントローラの構成を示す図である。
FIG. 5 is a diagram showing a configuration of a microcontroller with a built-in nonvolatile memory according to a second embodiment of the present invention.

【図6】本発明の第2の実施形態におけるRAMアドレ
ス出力回路の構成を示す図である。
FIG. 6 is a diagram illustrating a configuration of a RAM address output circuit according to a second embodiment of the present invention.

【図7】従来の不揮発性メモリ内蔵マイクロコントロー
ラの構成を示す図である。
FIG. 7 is a diagram showing a configuration of a conventional microcontroller with built-in nonvolatile memory.

【図8】従来の不揮発性メモリ内蔵マイクロコントロー
ラの構成を示す図である。
FIG. 8 is a diagram showing a configuration of a conventional microcontroller with a built-in nonvolatile memory.

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

10,10A マイクロコントローラ 11 CPU 12 フラッシュメモリ(不揮発性メモリ) 13 RAM 16 シリアルインターフェース 17 DMA 20 リセットベクタ変換回路 30 外部装置 40 RAMアドレス出力回路 SM オンボード書き換えモード信号 10, 10A Microcontroller 11 CPU 12 Flash memory (non-volatile memory) 13 RAM 16 Serial interface 17 DMA 20 Reset vector conversion circuit 30 External device 40 RAM address output circuit SM On-board rewrite mode signal

Claims (4)

【特許請求の範囲】[Claims] 【請求項1】 CPUと、 記憶内容が電気的に消去および書き込み可能な不揮発性
メモリと、 RAMとを備え、 オンボード書き換えモードにおいてリセットがかかった
とき、リセット解除後に、前記CPUが、前記RAMに
格納された,前記不揮発性メモリの書き換えを制御する
プログラムを実行するように、構成されていることを特
徴とするマイクロコントローラ。
1. A CPU comprising: a CPU; a non-volatile memory whose storage content is electrically erasable and writable; and a RAM. A microcontroller configured to execute a program for controlling rewriting of the nonvolatile memory stored in the microcontroller.
【請求項2】 請求項1記載のマイクロコントローラに
おいて、 オンボード書き換えモード信号が入力された状態で、前
記CPUがリセットベクタの格納アドレスを出力したと
き、前記CPUに対して、リセットベクタの代わりに、
前記プログラムが格納された前記RAMのアドレスを出
力するリセットベクタ変換回路を備えていることを特徴
とするマイクロコントローラ。
2. The microcontroller according to claim 1, wherein when the CPU outputs the storage address of the reset vector in a state where the on-board rewrite mode signal is input, the CPU outputs the reset vector instead of the reset vector. ,
A microcontroller, comprising: a reset vector conversion circuit that outputs an address of the RAM in which the program is stored.
【請求項3】 請求項1記載のマイクロコントローラに
おいて、 オンボード書き換えモード信号が入力された状態で、前
記CPUがリセットベクタの格納アドレスを出力したと
き、前記格納アドレスを、前記プログラムが格納された
前記RAMのアドレスに変換して出力するRAMアドレ
ス出力回路を備えていることを特徴とするマイクロコン
トローラ。
3. The microcontroller according to claim 1, wherein when the CPU outputs a storage address of a reset vector in a state where an on-board rewrite mode signal is input, the storage address is stored in the program. A microcontroller comprising a RAM address output circuit for converting the data into an address of the RAM and outputting the converted address.
【請求項4】 請求項1記載のマイクロコントローラに
おいて、 外部装置とのデータ通信を行うシリアルインターフェー
スと、 前記シリアルインターフェースによって受信したデータ
を、前記CPUの動作を介さずに、前記RAMに転送す
るDMAとを備え、 前記シリアルインターフェースおよびDMAは、 オンボード書き換えモード信号を受けて、前記外部装置
から前記プログラムを受信可能になり、かつ、受信した
プログラムを前記RAMに転送可能な状態になるもので
あることを特徴とするマイクロコントローラ。
4. The microcontroller according to claim 1, wherein a serial interface that performs data communication with an external device, and a DMA that transfers data received by the serial interface to the RAM without going through the operation of the CPU. The serial interface and the DMA receive an on-board rewrite mode signal, receive the program from the external device, and transfer the received program to the RAM. A microcontroller, characterized in that:
JP2001092389A 2001-03-28 2001-03-28 Microcontroller Pending JP2002287994A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2001092389A JP2002287994A (en) 2001-03-28 2001-03-28 Microcontroller

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2001092389A JP2002287994A (en) 2001-03-28 2001-03-28 Microcontroller

Publications (1)

Publication Number Publication Date
JP2002287994A true JP2002287994A (en) 2002-10-04

Family

ID=18946855

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2001092389A Pending JP2002287994A (en) 2001-03-28 2001-03-28 Microcontroller

Country Status (1)

Country Link
JP (1) JP2002287994A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006113656A (en) * 2004-10-12 2006-04-27 Denso Corp Method, apparatus and program for transmitting rewrite program, vehicle control apparatus and receiving/starting program of rewrite program
WO2007013191A1 (en) * 2005-07-29 2007-02-01 Matsushita Electric Industrial Co., Ltd. Device for writing into memory

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH10116187A (en) * 1996-10-11 1998-05-06 Mitsubishi Electric Corp Microcomputer
JP2000056984A (en) * 1998-08-13 2000-02-25 Mitsubishi Electric Corp Micro computer with built-in memory and resetting method for micro computer
JP2000172380A (en) * 1998-12-03 2000-06-23 Mitsubishi Electric Corp Microcomputer

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH10116187A (en) * 1996-10-11 1998-05-06 Mitsubishi Electric Corp Microcomputer
JP2000056984A (en) * 1998-08-13 2000-02-25 Mitsubishi Electric Corp Micro computer with built-in memory and resetting method for micro computer
JP2000172380A (en) * 1998-12-03 2000-06-23 Mitsubishi Electric Corp Microcomputer

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006113656A (en) * 2004-10-12 2006-04-27 Denso Corp Method, apparatus and program for transmitting rewrite program, vehicle control apparatus and receiving/starting program of rewrite program
JP4617816B2 (en) * 2004-10-12 2011-01-26 株式会社デンソー Vehicle control device and rewrite program receiving / starting program
WO2007013191A1 (en) * 2005-07-29 2007-02-01 Matsushita Electric Industrial Co., Ltd. Device for writing into memory
JPWO2007013191A1 (en) * 2005-07-29 2009-02-05 パナソニック株式会社 Memory writing device

Similar Documents

Publication Publication Date Title
JP2006502482A (en) Booting from nonlinear memory
JP2004118826A (en) System unit booted using flash memory, and its booting method
JP2003150574A (en) Microcomputer
KR100604877B1 (en) Apparatus and method for controlling memory address mapping in embedded system
US7281113B2 (en) Microcomputer with built-in electrically rewritable nonvolatile memory
JP3918434B2 (en) Information processing device
JP2002287994A (en) Microcontroller
WO2002093390A1 (en) Data processor and data table update method
JP4958201B2 (en) Microcomputer
JP3998452B2 (en) Nonvolatile memory control circuit
JP4005950B2 (en) Microcontroller
JPH11184724A (en) In-circuit emulator and semiconductor integrated circuit
JP3866269B2 (en) Microcomputer
US7020813B2 (en) On chip debugging method of microcontrollers
KR100465610B1 (en) Microcomputer with embedded flash memory having on-chip programming capability and method of programming data into the embedded flash memory
JP2004013338A (en) Data processor and method
JP2007193745A (en) Lsi for ic card and memory data transfer method
JP2000259404A (en) Memory access system
JP3912447B2 (en) Memory system and method of using external nonvolatile memory
JP2011216046A (en) Integrated circuit device
JPH1050086A (en) Microcomputer having eeprom and its rewriting method
JPH08101794A (en) Rewriting system for firmware program
JP3997505B2 (en) System program rewriting method for programmable controller
JP2928216B1 (en) Semiconductor integrated circuit
JP4343244B2 (en) Microcomputer

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20060306

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20070626

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20070827

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20070925