JP2008186476A - Microcomputer - Google Patents

Microcomputer Download PDF

Info

Publication number
JP2008186476A
JP2008186476A JP2008059286A JP2008059286A JP2008186476A JP 2008186476 A JP2008186476 A JP 2008186476A JP 2008059286 A JP2008059286 A JP 2008059286A JP 2008059286 A JP2008059286 A JP 2008059286A JP 2008186476 A JP2008186476 A JP 2008186476A
Authority
JP
Japan
Prior art keywords
program
storage area
user
control program
interface
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
JP2008059286A
Other languages
Japanese (ja)
Inventor
Naoki Yada
直樹 矢田
Eiichi Ishikawa
栄一 石川
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.)
Renesas Technology Corp
Renesas Semiconductor Package and Test Solutions Co Ltd
Original Assignee
Renesas Technology Corp
Renesas Northern Japan Semiconductor Inc
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Renesas Technology Corp, Renesas Northern Japan Semiconductor Inc filed Critical Renesas Technology Corp
Priority to JP2008059286A priority Critical patent/JP2008186476A/en
Publication of JP2008186476A publication Critical patent/JP2008186476A/en
Pending legal-status Critical Current

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To provide a microcomputer in which onboard writing can be performed by user exclusive use communication protocol even if serial interface is not made on a mounting board, and in which the user exclusive use communication protocol codes are not destroyed even if the microcomputer runs away. <P>SOLUTION: The microcomputer is provided with a CPU (2), a non-volatile memory (13), and a RAM (3). The non-volatile memory includes a first domain (Tmat) which possesses a communication control program processed by the CPU, a second domain (Umat) in which interface with the outside is established by the processing of the communication control program by the CPU and deleting and writing are enabled, and a third domain (Mmat) in which interface with the outside is established by the processing of the communication control program by the CPU, deleting and writing are enabled, and deleting and writing are enabled by the processing of the program of the second domain by the CPU. The second domain and the third domain can be selected exclusively by a register. <P>COPYRIGHT: (C)2008,JPO&INPIT

Description

本発明は、電気的に消去及び書き込み可能な不揮発性メモリとCPU(中央処理装置)を有するマイクロコンピュータ、特に前記不揮発性メモリに対する消去及び書き込み動作の許可と禁止に関し、例えばフラッシュメモリを有するワンチップのマイクロコンピュータに適用して有効な技術に関する。   The present invention relates to a microcomputer having an electrically erasable and writable non-volatile memory and a CPU (central processing unit), and more particularly to permission and prohibition of erasing and writing operations for the non-volatile memory. The present invention relates to an effective technology applied to microcomputers.

フラッシュメモリなどの電気的に消去及び書き込み可能な不揮発性メモリはメモリセルにプログラムされる閾値電圧の相違に応じて情報を記憶する。フラッシュメモリにおいてその閾値電圧の相違は、フローティングゲートが保有する電子又は正孔の量の相違によって実現される。例えば熱平衡状態の閾値電圧に対して相対的に高い閾値電圧状態を書き込み状態、相対的に低い閾値電圧状態を消去状態と称する(逆の定義も可能である)。このとき、特に制限されないが、メモリセルを消去状態にする消去及びメモリセルを書き込み状態にする書き込みの各動作では、高電圧パルスの印加と、それによる閾値電圧状態のベリファイとを繰返し行う。マイクロコンピュータのオンチップフラッシュッメモリに消去及び書込みを可能にする動作モードとして、ライタモード及びブートモードを有するものが有る。ライタモードとは、例えば、マイクロコンピュータを見掛け上、フラッシュメモリチップと等価とし、EPROMライタのような書込み装置に接続して、消去及び書込みを可能にする動作モードである。ブートモードは、例えば、マイクロコンピュータがシステムに実装された状態で調歩同期若しくは非同期のシリアルインタフェース(UART)を介して実装システムとの通信を確立させて消去及び書込みを可能にする動作モードである。システム実装前にオンチップフラッシュメモリにプログラムやデータを初期的に書き込む場合にはライタモードを利用できる。一方、システム実装後に、プログラムのバージョンアップやデータのチューニングのためにオンチップフラッシュッメモリの記憶情報を書き換える場合にはブートモードを利用できる。   An electrically erasable and writable nonvolatile memory such as a flash memory stores information according to a difference in threshold voltage programmed in the memory cell. In the flash memory, the difference in threshold voltage is realized by the difference in the amount of electrons or holes held in the floating gate. For example, a relatively high threshold voltage state with respect to a threshold voltage in a thermal equilibrium state is referred to as a write state, and a relatively low threshold voltage state is referred to as an erase state (the reverse definition is also possible). At this time, although not particularly limited, in each of the erasing operation for setting the memory cell in the erasing state and the writing operation for setting the memory cell in the writing state, the application of the high voltage pulse and the verification of the threshold voltage state are repeated. As an operation mode that enables erasing and writing to an on-chip flash memory of a microcomputer, there are those having a writer mode and a boot mode. The writer mode is an operation mode in which, for example, a microcomputer is apparently equivalent to a flash memory chip and is connected to a writing device such as an EPROM writer to enable erasing and writing. The boot mode is an operation mode that enables erasing and writing by establishing communication with the mounting system via an asynchronous or asynchronous serial interface (UART) with the microcomputer mounted on the system, for example. The writer mode can be used to write programs and data to the on-chip flash memory initially before system mounting. On the other hand, when the information stored in the on-chip flash memory is rewritten for system version upgrade or data tuning after system installation, the boot mode can be used.

従来、ブートモードにはベーシックなインタフェース方式としてシリアルインタフェースを利用するようになっているから、ブートモードを用いてオンボード書換えを行う場合、マイクロコンピュータの実装システムボードには調歩同期のようなシリアルインタフェース回路を搭載することが行われていた。   Conventionally, a serial interface is used as a basic interface method in the boot mode. Therefore, when performing on-board rewriting using the boot mode, a serial interface such as start-stop synchronization is used on the microcomputer mounting system board. A circuit was installed.

しかしながら、調歩同期のようなシリアルインタフェース回路を本来必要としないシステムもある。例えば、CD−ROM(Compact Disk-Read Only Memory)、CD−RW(Compact Disk- rewritable)、DVD−ROM(Digital Video Disk-Read Only Memory)、DVD−RAM(Digital Video Disk-Random Access Memory)などのディスクドライブシステムではATAPI(AT Attachment Packet Interface)やSCSI(Small Computer System Interface)などのインタフェースが必然的に存在する。エンジンやトランスミッションなどの自動車関係の制御システムではHCANと称されるようなエリアネットワークインタフェースが存在する。このように各ユーザのシステムボードにATAPI,SCSI又はHCANなどのインタフェースが存在しても、ブートモードでオンボード書換えを行うためだけに調歩同期のようなシリアルインターフェースをさらに存在させる必要があるとすれば、これはユーザのシステムボードにとってオーバーヘッドの問題を生ずることになる。   However, there are systems that do not originally require a serial interface circuit such as start-stop synchronization. For example, CD-ROM (Compact Disk-Read Only Memory), CD-RW (Compact Disk-rewritable), DVD-ROM (Digital Video Disk-Read Only Memory), DVD-RAM (Digital Video Disk-Random Access Memory), etc. In such disk drive systems, interfaces such as ATAPI (AT Attachment Packet Interface) and SCSI (Small Computer System Interface) inevitably exist. In an automotive control system such as an engine or transmission, there is an area network interface called HCAN. Thus, even if an interface such as ATAPI, SCSI, or HCAN exists on the system board of each user, it is necessary to additionally provide a serial interface such as start-stop synchronization in order to perform on-board rewriting in the boot mode. For example, this creates an overhead problem for the user's system board.

これを回避するには、自由に利用することが許容されたフラッシュメモリ上の記憶領域(即ちユーザメモリ領域)でプログラムを実行可能なユーザプログラムモードでオンボード書き込みを実施可能にすればよい。即ち、予め、例えばライターモードでユーザメモリ領域にATAPI等のユーザシステムボード専用の通信プロトコル処理プログラムを書き込む。これを実施した後に、マイクロコンピュータをユーザのシステムボートに実装し、そのユーザ専用の通信プロトコル処理プログラムをCPUで実行すれば、ユーザのシステムボード上にシリアルインターフェースを持たなくても、ユーザメモリ領域に対するプログラムバージョンアップやチューニングデータ書換えなどを実施することができる。   In order to avoid this, on-board writing may be performed in a user program mode in which a program can be executed in a storage area (that is, a user memory area) on the flash memory that is allowed to be freely used. That is, a communication protocol processing program dedicated to the user system board such as ATAPI is written in advance in the user memory area in the writer mode, for example. After implementing this, if the microcomputer is mounted on the user's system board and the communication protocol processing program dedicated to the user is executed by the CPU, the user memory area can be stored even if the user's system board does not have a serial interface. Program version upgrade and tuning data rewrite can be performed.

しかしながら、ユーザの制御プログラムやチューニングデータなどが書き込まれるユーザ領域に専用通信プロトコル処理プログラムも一緒に書き込む場合には、ユーザが制御プログラムを作成する時に、その専用通信プロトコルのプログラムが誤って消去され難いようにする制御を実現しなければならず、ユーザがプログラムを作成するのに大きな負担になることが懸念される。また、システムボード上に実装した後にユーザプログラムモードでCPUが暴走したとき、ユーザプログラムモードで実行可能にされる前記通信プロトコルの処理プログラムが誤って消えてしまえば、消去及び書込みのためにユーザシステムボードとは2度とインタフェースを確立することができない。実装基板からマイクロコンピュータチップを取り外して、ライタモードを用いない限り、再書き込みを実施する事ができなくなる問題が本発明者によって明らかにされた。尚、本明細書においてユーザとはマイクロコンピュータ等の半導体デバイスの利用者を広義に意味する。したがって、半導体デバイスの製造メーカが其の半導体デバイスを何らかの意味で使用すれば、其の限りにおいて当該製造メーカはユーザでもある。   However, when the dedicated communication protocol processing program is also written in the user area where the user's control program and tuning data are written, when the user creates the control program, the program of the dedicated communication protocol is not easily deleted by mistake. There is a concern that it will be a heavy burden for the user to create a program. In addition, when the CPU runs out of control in the user program mode after being mounted on the system board, if the processing program of the communication protocol that can be executed in the user program mode disappears by mistake, the user system is deleted for erasing and writing. An interface cannot be established with the board again. The present inventor has revealed a problem that rewriting cannot be performed unless the microcomputer chip is removed from the mounting substrate and the writer mode is used. In this specification, the user means a user of a semiconductor device such as a microcomputer in a broad sense. Therefore, if a manufacturer of a semiconductor device uses the semiconductor device in any sense, the manufacturer is also a user.

本発明の目的は、消去されるとシステム上致命的な打撃を受けることになる実装ボードとの間の通信プロトコルのようなプログラム情報が不揮発性メモリから消失し難い構成のマイクロコンピュータを提供することにある。   SUMMARY OF THE INVENTION An object of the present invention is to provide a microcomputer having a configuration in which program information such as a communication protocol with a mounting board that will receive a fatal blow on the system when erased is unlikely to disappear from a nonvolatile memory. It is in.

本発明の別の目的は、マイクロコンピュータの実装基板がサポートする個別的な通信プロトコルに対してもインタフェースの確立を保証することができるマイクロコンピュータを提供することにある。   Another object of the present invention is to provide a microcomputer capable of guaranteeing the establishment of an interface even for an individual communication protocol supported by a mounting board of the microcomputer.

CPUの暴走によってもオンチップ不揮発性メモリの記憶情報消失を極力抑制することが可能なマイクロコンピュータを提供することにある。   An object of the present invention is to provide a microcomputer capable of suppressing the loss of stored information in an on-chip nonvolatile memory as much as possible even when a CPU runs away.

本発明の前記並びにその他の目的と新規な特徴は本明細書の記述及び添付図面から明らかになるであろう。   The above and other objects and novel features of the present invention will be apparent from the description of this specification and the accompanying drawings.

〔1〕本願において開示される発明のうち代表的なものの概要を簡単に説明すれば下記の通りである。   [1] The outline of representative ones of the inventions disclosed in the present application will be briefly described as follows.

すなわち、マイクロコンピュータのオンチップ不揮発性メモリには、ユーザ(マイクロコンピュータの使用者)の制御プログラム等を書きこむ第3領域(ユーザマット)以外に、第2領域(ユーザブートマット)を用意する。このユーザブートマットは、例えばユーザ専用の通信プロトコルを書きこむ記憶領域(マット)として使用し、そのマットからプログラムを実行するユーザブートモードも専用モードとして用意する。このユーザブートモードでは、ユーザブートマットは消去及び書き込み不可能にされる。   That is, in the on-chip nonvolatile memory of the microcomputer, a second area (user boot mat) is prepared in addition to the third area (user mat) in which a user (microcomputer user) control program is written. This user boot mat is used, for example, as a storage area (mat) for writing a user-specific communication protocol, and a user boot mode for executing a program from the mat is also prepared as a dedicated mode. In this user boot mode, the user boot mat is disabled from being erased and writable.

上記による作用効果は以下の通りである。(1)ユーザ専用の通信プロトコルを格納可能なユーザブートマットを用意したので、マイクロコンピュータが備える任意のインタフェースを流用することができる。(2)不揮発性メモリの消去及び書き込みにユーザ任意のインターフェースを採用する事が可能となったことにより、ユーザ実装ボードに必ずシリアルインターフェースを用意しなくてもよくなる。(3)ユーザブートマットとユーザマットを分けた事により、ユーザマットに専用通信プロトコル処理プログラムを書かなくても、消去及び書き込み用にユーザ任意の書きこみインターフェースが実現できるから、ユーザマットに格納して使用する制御プログラムの作成が容易になる。要するに、ユーザプログラムモードで使用する通信制御プログラムの消去防止などについて特別な考慮を払わなくてもよい。(4)ユーザブートマットから立ち上がるユーザブートモードでは、ハードウェア的にユーザブートマットを消去及び書きこみ不可にするので、暴走等でユーザブートマットの記憶情報が破壊される事はなく、デバック時にCPUが暴走しても、外部インターフェースを制御するプログラムの破壊には至らないので、実装したマイクロコンピュータチップを取り外さなくても、オンボードでユーザマットの書換えを自由に行うことができる。   The effect by the above is as follows. (1) Since a user boot mat capable of storing a user-specific communication protocol is prepared, any interface provided in the microcomputer can be used. (2) Since it is possible to employ any user interface for erasing and writing to the nonvolatile memory, it is not necessary to prepare a serial interface on the user mounting board. (3) By separating the user boot mat from the user mat, it is possible to realize a user-specific writing interface for erasing and writing without writing a dedicated communication protocol processing program in the user mat. It is easy to create a control program to be used. In short, it is not necessary to pay special consideration to prevention of erasure of the communication control program used in the user program mode. (4) In the user boot mode that rises from the user boot mat, the user boot mat cannot be erased and written by hardware, so that the stored information of the user boot mat is not destroyed due to runaway or the like, and the CPU is used during debugging. If the program runs out of control, the program that controls the external interface will not be destroyed, so the user mat can be freely rewritten on-board without removing the mounted microcomputer chip.

〔2〕本発明の更に詳しい第1の態様に係るマイクロコンピュータは、CPUと、電気的に消去及び書き込み可能な第1領域(ブートマット)、第2領域(ユーザブートマット)及び第3領域(ユーザマット)を有する不揮発性メモリと、動作モードの指示手段とを含む。動作モードの指示手段は、前記CPUに第1領域のプログラムを処理させると共に前記第1領域を消去及び書き込み不可能にする第1モード(ブートモード)、前記CPUに第2領域のプログラムを処理させると共に第1領域及び第2領域を消去及び書き込み不可能にする第2モード(ユーザブートモード)、及び前記CPUに第3領域のプログラムを処理させると共に第1領域及び第2領域を消去及び書き込み不可能にする第3モード(ユーザモード)、を指示し、例えばモード信号の入力回路等で実現される。   [2] A microcomputer according to a more detailed first aspect of the present invention includes a CPU, an electrically erasable and writable first area (boot mat), a second area (user boot mat), and a third area ( A non-volatile memory having a user mat) and an operation mode instruction means. The operation mode instruction means causes the CPU to process the program in the first area, makes the first area unerasable and non-writable (boot mode), and causes the CPU to process the program in the second area. In addition, a second mode (user boot mode) for making the first area and the second area unerasable and non-writable, and causing the CPU to process a program for the third area and not erasing and writing the first area and the second area. The third mode (user mode) to be enabled is instructed, and is realized by, for example, a mode signal input circuit.

この態様のマイクロマイクロコンピュータは、第2領域及び第3領域に具体的なプログラムが記憶されていない状態、要するに、ユーザが第2及び第3領域に所望のプログラムを格納する処理に至る前の状態も意味している。マイクロコンピュータがシステムボードに実装されるときは、前記第2領域にシステムボードに固有のインタフェースを確立する通信プロトコル処理プログラムなどを格納し、第3領域にシステムボードを制御するユーザプログラムやチューニングデータなどを格納して、ユーザシステムの制御に利用される。オンボード書込みを行う場合には、ユーザブートモードのような第2モードを指定し、前記CPUに第2領域の通信プロトコル処理プログラム等を処理させ、システムボードに固有のインタフェースを確立させ、第3領域のユーザプログラムをバージョンアップし、或はチューニングデータの書換えを行うことができる。したがって、上記(1)〜(4)の作用効果を得ることができる。   The microcomputer according to this aspect is in a state in which no specific program is stored in the second area and the third area, that is, a state before the user has stored the desired program in the second and third areas. Also means. When the microcomputer is mounted on the system board, a communication protocol processing program for establishing an interface unique to the system board is stored in the second area, a user program for controlling the system board, tuning data, etc. in the third area Is used to control the user system. When performing on-board writing, a second mode such as a user boot mode is designated, the CPU processes the communication protocol processing program in the second area, etc., and an interface unique to the system board is established. The user program in the area can be upgraded or the tuning data can be rewritten. Therefore, the effects (1) to (4) can be obtained.

〔3〕本発明の更に詳しい第2の態様に係るマイクロコンピュータは、CPUと、電気的に消去及び書き込み可能な第1領域(ブートマット)、第2領域(ユーザブートマット)及び第3領域(ユーザマット)を有する不揮発性メモリと、第1モード、第2モード又は第3モードを選択的に指定する指示手段と、を含む。前記CPUは、第1モードの指定により第1領域のプログラムを処理し、第2モードの指定により第2領域のプログラムを処理し、第3モードの指定により第3領域のプログラムを処理する。前記不揮発性メモリは、第1モードの指定により前記第2領域及び第3領域が消去及び書き込み可能にされ且つ第1領域が消去及び書き込み不可能にされ、第2モードの指定により第3領域が消去及び書き込み可能にされ且つ第1領域及び第2領域が消去及び書き込み不可能にされ、第3モードに指定により第3領域が消去及び書き込み可能にされ且つ第1領域及び第2領域が消去及び書き込み不可能にされる。この態様のマイクロコンピュータにおいても上記(1)〜(4)の作用効果を得ることができる。   [3] A microcomputer according to the second aspect of the present invention further includes a CPU, an electrically erasable and writable first area (boot mat), a second area (user boot mat), and a third area ( Non-volatile memory having a user mat) and instruction means for selectively specifying the first mode, the second mode, or the third mode. The CPU processes the program in the first area by designating the first mode, processes the program in the second area by designating the second mode, and processes the program in the third area by designating the third mode. In the nonvolatile memory, the second area and the third area are made erasable and writable by the designation of the first mode, and the first area is made erasable and writable, and the third area is made to be designated by the second mode. The first area and the second area are made erasable and writable, and the third area is made erasable and writable by the designation of the third mode, and the first area and the second area are erased and writable. Writable. Also in the microcomputer of this aspect, the effects (1) to (4) can be obtained.

前記第1領域にはマイクロコンピュータの外部とインタフェースを確立するための第1の通信制御プログラムを保有させてよい。前記第1領域は第1乃至第3の何れの動作モードにおいても消去及び書き込み不可能にされるから、マイクロコンピュータの製造過程などでEPROMライタなどの書き込み装置を用いて初期的に書込みされる。第1の通信制御プログラムはベーシックな調歩同期によるシリアルインタフェースプログラムであってよい。   The first area may have a first communication control program for establishing an interface with the outside of the microcomputer. Since the first area cannot be erased or written in any of the first to third operation modes, it is initially written using a writing device such as an EPROM writer in the manufacturing process of the microcomputer. The first communication control program may be a serial interface program based on basic start-stop synchronization.

前記第2領域にはマイクロコンピュータの外部とインタフェースを確立するための第2の通信制御プログラムを保有させてよい。前記第2領域は第1モードで消去及び書込み可能であるから、第2の通信制御プログラムはユーザ専用の通信プロトコル、即ちシステムボードに固有のインタフェース仕様(例えばATAPI)を満足する通信制御プログラムであってよい。   The second area may have a second communication control program for establishing an interface with the outside of the microcomputer. Since the second area can be erased and written in the first mode, the second communication control program is a communication control program that satisfies a user-specific communication protocol, that is, an interface specification (for example, ATAPI) specific to the system board. It's okay.

前記第1領域は第1乃至第3の何れの動作モードにおいても消去及び書き込み不可能にされるから、第1領域に前記不揮発性メモリのための消去及び書き込み制御プログラムを保有させれば、それが不所望に消失する虞を未然に防止できる。   Since the first area cannot be erased or written in any of the first to third operation modes, if the first area has an erase and write control program for the nonvolatile memory, Can be prevented from disappearing undesirably.

同様に、前記第1の領域には、前記消去及び書き込み制御プログラムの転送制御プログラムを保有させてよい。   Similarly, the first area may have a transfer control program for the erase and write control program.

前記CPUによる転送制御プログラムの処理により前記消去及び書き込み制御プログラムが転送されるRAMをマイクロコンピュータに内蔵してよい。CPUは内蔵RAM上で前記消去及び書き込み制御プログラムを実行可能になる。   A RAM to which the erasing and writing control program is transferred by processing of the transfer control program by the CPU may be built in the microcomputer. The CPU can execute the erase and write control program on the built-in RAM.

CPUの暴走などによる不揮発性メモリの不所望な書換え防止の観点より、前記不揮発性メモリは、前記指示手段によるモード指定とは別に、外部端子から与えられる書き込み動作の指示を、消去及び書き込み動作を可能にするための必要条件に加えるとよい。   From the viewpoint of preventing undesired rewriting of the non-volatile memory due to a runaway of the CPU, the non-volatile memory performs an erasing and a writing operation instruction from the external terminal separately from the mode designation by the instruction means. Add to the requirements to make it possible.

〔4〕前記第2態様に係るマイクロコンピュータにおけるCPUのリセットベクタアドレス(リセット解除後に参照されるベクタアドレス)に着目すると、前記第1領域、第2領域及び第3領域の夫々における先頭アドレスをCPUのアドレス空間上同一アドレスとし、前記CPUが用いる先頭アドレスを第2領域とするか第3領域とするかを排他的に指定する第1レジスタ手段(FMATS)をCPUのアドレス空間に配置する構成を採用することができる。   [4] Focusing on the reset vector address of the CPU in the microcomputer according to the second aspect (vector address to be referred to after the reset is released), the first address in each of the first area, the second area, and the third area is the CPU. The first register means (FMATS) that exclusively designates whether the head address used by the CPU is the second area or the third area is arranged in the address space of the CPU. Can be adopted.

この構成において第1モードの指定により第1領域のプログラムが実行されたとき、第1領域のプログラム自体が第1領域に対する消去及び書込みを行う処理ルーチンを含んでいなければ、第1領域に対する消去及び書込みは行われない。第1領域に格納すべきプログラムの開発及びそのプログラムの書込みをマイクロコンピュータの製造メーカで行うことを想定すれば、第1領域に対する消去及び書込みを不可能にすることは万全である。第1モードの指定により第1領域のプログラムを実行した後、第1レジスタ手段の設定に従って第2領域又は第3領域のプログラムを実行可能な状態に遷移することができる。この後、第2領域又は第3領域に格納したプログラムだけで第1領域のプログラムを実行可能な状態に戻ることは基本的に不可能であり、仮に戻ることを許容するハードウェアを持っていても第1領域の消去及び書き込みはやはり不可能である。   In this configuration, when a program in the first area is executed by specifying the first mode, if the program in the first area itself does not include a processing routine for erasing and writing to the first area, erasing the first area And no writing is performed. Assuming that the development of a program to be stored in the first area and the writing of the program are performed by a microcomputer manufacturer, it is perfectly possible to make erasure and writing to the first area impossible. After executing the program in the first area by specifying the first mode, it is possible to transition to a state where the program in the second area or the third area can be executed according to the setting of the first register means. After this, it is basically impossible to return to the state in which the program in the first area can be executed only by the program stored in the second area or the third area, and hardware that allows the temporary return is provided. However, the first area cannot be erased and written.

前記CPUのアドレス空間にRAMを配置すると、CPUはRAM上にプログラムを転送して実行することが可能になる。   If the RAM is arranged in the address space of the CPU, the CPU can transfer and execute the program on the RAM.

CPUがRAM上でプログラムを処理していることを条件に、前記第1レジスタ手段の設定変更を許可すれば、第1乃至第3領域の何れかの領域でプログラムをフェッチしている状態から別の領域でのプログラム実行の遷移を円滑化することができる。CPUがRAM上でプログラムを処理していることをバス制御手段(BSC)が検出することを条件に、前記第1レジスタ手段の設定変更の許可するようにしてよい。   If the setting change of the first register means is permitted on the condition that the CPU is processing the program on the RAM, it is different from the state in which the program is fetched in any one of the first to third areas. The transition of program execution in this area can be smoothed. The setting change of the first register means may be permitted on condition that the bus control means (BSC) detects that the CPU is processing the program on the RAM.

消去及び書き込み制御プログラムをRAMへストアさせる動作に許可を与える情報がセットされる第2レジスタ手段(FKEY)を設け、前記不揮発性メモリは、この第2レジスタ手段の許可情報がリセットされることを、消去及び書き込み動作を可能にするための必要条件にするとよい。これによれば、消去及び書き込み制御プログラムをRAMへ転送する必要のいないとき仮にCPUが暴走しても、第2レジスタ手段のリセット状態により消去及び書き込み制御プログラムが誤ってRAMに転送され、それが不所望に実行される確率を低減できる。また、消去及び書き込み制御プログラムをRAMへ転送しているとき仮にCPUが暴走しても、第2レジスタ手段のセット状態は消去及び書き込み動作の抑止条件になっているから、このとき消去及び書き込みプログラムが誤って実行開始される確率を低減できる。   There is provided second register means (FKEY) in which information for giving permission to the operation of storing the erase and write control program in the RAM is set, and the non-volatile memory has the permission information of the second register means reset. It may be necessary to make the erase and write operations possible. According to this, even if the CPU goes out of control when it is not necessary to transfer the erase and write control program to the RAM, the erase and write control program is erroneously transferred to the RAM due to the reset state of the second register means. The probability of undesired execution can be reduced. In addition, even if the CPU runs out of control while transferring the erase and write control program to the RAM, the set state of the second register means is a condition for inhibiting the erase and write operations. Can reduce the probability that the execution is erroneously started.

〔5〕前記第2態様に係るマイクロコンピュータにおける消去及び書き込み制御プログラムに着目する。前記CPUのアドレス空間にRAMを配置し、前記第1領域に消去及び書き込み制御プログラムを格納しておき、前記CPUは第1モードに応答して前記消去及び書き込み制御プログラムを前記RAMに転送制御し、転送先のRAMから消去及び書き込み制御プログラムをフェッチして実行するとよい。マイクロコンピュータのユーザは消去及び書き込み制御プログラムを開発する必要はない。RAM上で消去及び書き込み制御プログラムを実行すれば、第1モードにおいて第2領域及び第3領域に対する消去及び書込みを円滑化できる。   [5] Attention is paid to the erase and write control program in the microcomputer according to the second aspect. A RAM is arranged in the address space of the CPU, and an erase and write control program is stored in the first area. The CPU controls the transfer of the erase and write control program to the RAM in response to the first mode. The erase and write control program may be fetched from the transfer destination RAM and executed. Microcomputer users do not need to develop erase and write control programs. If the erase and write control program is executed on the RAM, the erase and write to the second area and the third area can be facilitated in the first mode.

第1領域の消去及び書き込み制御プログラムを第2モードでも利用可能にするには、例えば、前記第2モードにおいてCPUは、第3レジスタ手段(SCO)の第1設定値に応答して、前記第1領域のプログラムを処理する状態に遷移し、前記消去及び書き込み制御プログラムをRAMに転送制御して、第2領域のプログラムを処理する状態に復帰させるようにすればよい。   In order to make the erase and write control program for the first area usable also in the second mode, for example, in the second mode, the CPU responds to the first set value of the third register means (SCO) in the second mode. The state may be changed to a state where a program in one area is processed, and the erase and write control program is controlled to be transferred to the RAM so as to return to a state where the program in the second area is processed.

第1領域の消去及び書き込み制御プログラムを第3モードでも利用可能にするには、例えば、前記第3モードにおいてCPUは、第3レジスタ手段(SCO)の第1設定値に応答して、前記第1領域のプログラムを処理する状態に遷移し、前記消去及び書き込み制御プログラムをRAMに転送制御して、第3領域のプログラムを処理する状態に復帰させるようにすればよい。   In order to make the erase and write control program for the first area usable also in the third mode, for example, in the third mode, the CPU responds to the first set value of the third register means (SCO) in response to the first set value. The state may be changed to a state where a program in one area is processed, and the erase and write control program is controlled to be transferred to the RAM so as to return to a state where the program in the third area is processed.

消去及び書き込み制御プログラムをRAMへストアさせる動作に許可を与える情報として第2設定値がセットされる第2レジスタ手段(FKEY)を設け、前記不揮発性メモリは、この第2レジスタ手段の許可情報が第3設定値にリセットされることを、消去及び書き込み動作を可能にするための必要条件とし、前記第2のレジスタ手段に第2設定値がセットされる状態を第3レジスタ手段に第1設定値をセット可能にするための必要条件としてよい。要するに、ユーザが消去及び書き込みを実施したくない所で、プログラムが暴走し、消去及び書き込み制御プログラムが転送されると、ユーザプログラムを破壊する可能性が高くなる。これを回避するために、ユーザは、第3レジスタ手段に第1設定値をセットする前に、第2レジスタ手段に第2設定値をストアする。この第2設定値をストアしてない時は、第3レジスタ手段を第1設定値にセットすることはできない。第2レジスタ手段に第2設定値がストアされている時は、第3レジスタ手段を第1設定値にセットすることが可能となり、これによってプログラムの転送が可能となる。   Second register means (FKEY) in which a second set value is set as information for giving permission to the operation of storing the erase and write control program in the RAM is provided. The nonvolatile memory has permission information of the second register means. The reset to the third set value is a necessary condition for enabling the erase and write operations, and a state in which the second set value is set in the second register means is set in the third register means. It may be a necessary condition for enabling the value to be set. In short, if the program runs out of control where the user does not want to perform erasing and writing, and the erasing and writing control program is transferred, there is a high possibility that the user program will be destroyed. In order to avoid this, the user stores the second setting value in the second register means before setting the first setting value in the third register means. When the second set value is not stored, the third register means cannot be set to the first set value. When the second set value is stored in the second register means, it is possible to set the third register means to the first set value, thereby enabling program transfer.

消去及び書き込み制御プログラムが転送された後にプログラムが暴走した場合の事を考え、第2レジスタを使用する。基本的には、その他の条件により、CPUが暴走しても、消去及び書き込みが実施されないようになっているが、さらに信頼性を上げる為に、ユーザは、消去及び書き込みを実施する前に、第2レジスタ手段に第3設定値をセットする。この第3設定値をストアしてない時は、他の消去及び書き込み条件が誤ってイネーブルになっていたとしても、消去及び書込み動作は不可能なままにされる。   Considering the case where the program runs away after the erase and write control program is transferred, the second register is used. Basically, even if the CPU runs out of control due to other conditions, erasure and writing are not performed, but in order to further improve the reliability, the user must A third set value is set in the second register means. When the third set value is not stored, the erase and write operations remain disabled even if other erase and write conditions are erroneously enabled.

〔6〕不揮発性メモリの内、ユーザに開放される記憶領域に着目する。マイクロコンピュータは、CPUと、電気的に消去及び書き込み可能な不揮発性メモリとを含み、不揮発性メモリは第1メモリマット(ユーザブートマット)と第2メモリマット(ユーザマット)を備え、第1メモリマットと第2メモリマットは、レジスタで排他的に選択可能になっており、第1メモリマットが選択された場合は第1メモリマットに対する消去及び書き込み動作が抑止され、第2メモリマットが選択された場合はRAM上でのプログラム実行状態に遷移することを解除条件として消去及び書き込み動作が抑止される、ものである。これにより、プログラムを現に実行しているメモリマットが消去及び書込みされることによる不都合な状態の発生を未然に防止することができる。   [6] Pay attention to a storage area open to the user in the nonvolatile memory. The microcomputer includes a CPU and an electrically erasable and writable nonvolatile memory. The nonvolatile memory includes a first memory mat (user boot mat) and a second memory mat (user mat). The mat and the second memory mat can be selected exclusively by a register. When the first memory mat is selected, the erase and write operations on the first memory mat are suppressed, and the second memory mat is selected. In such a case, transition to the program execution state on the RAM is used as a release condition, and the erase and write operations are suppressed. As a result, it is possible to prevent the occurrence of an inconvenient state due to erasing and writing of the memory mat that is currently executing the program.

〔7〕不揮発性メモリの記憶領域全体に着目する。マイクロコンピュータは、CPUと、電気的に消去及び書き込み可能な不揮発性メモリとを有し、前記不揮発性メモリは、外部とのインタフェースを確立するためにCPUにより処理される通信制御プログラム(シリアル通信PGM)を保有する第1領域(ブートマット)と、前記CPUによる通信制御プログラムの処理により外部とのインタフェースが確立されて消去及び書き込み可能にされる第2領域(ユーザブートマット)と、前記CPUによる通信制御プログラムの処理により外部とのインタフェースが確立されて消去及び書き込み可能にされ、且つCPUによる第2領域のプログラムの処理により消去及び書き込み可能にされる第3領域(ユーザマット)と、を有する。   [7] Focus on the entire storage area of the nonvolatile memory. The microcomputer has a CPU and an electrically erasable and writable nonvolatile memory, and the nonvolatile memory is a communication control program (serial communication PGM) processed by the CPU to establish an interface with the outside. ) Possessing a first area (boot mat), a second area (user boot mat) that is made erasable and writable by establishing an interface with the outside by processing of the communication control program by the CPU, and by the CPU A third area (user mat) that has an interface with the outside established by the processing of the communication control program and can be erased and written, and can be erased and written by the program of the second area by the CPU; .

〔8〕更に別の観点によるマイクロコンピュータは、第1インタフェース(ATAPI,SCSI,HCAN)を有する実装基板に実装されるべきマイクロコンピュータであって、中央処理装置と、前記第1インタフェースと異なる第2インタフェース(SCI)を用いた通信プロトコル(UART)を確立するための第1通信処理プログラムが格納される第1記憶領域(ブートマット)と、前記第1インタフェースを用いた通信プロトコルを確立するための第2通信処理プログラムが格納される第2記憶領域(ユーザブートマット)と、所定の第1動作モードで前記中央処理装置によって実行される制御プログラムが格納される第3記憶領域(ユーザマット)とを有する不揮発性メモリとを有する。   [8] A microcomputer according to still another aspect is a microcomputer to be mounted on a mounting board having a first interface (ATAPI, SCSI, HCAN), and a central processing unit and a second interface different from the first interface. A first storage area (boot mat) for storing a first communication processing program for establishing a communication protocol (UART) using an interface (SCI), and a communication protocol for establishing the communication protocol using the first interface A second storage area (user boot mat) in which a second communication processing program is stored, and a third storage area (user mat) in which a control program executed by the central processing unit in a predetermined first operation mode is stored A non-volatile memory.

前記第1記憶領域は、さらに、書き込み制御プログラムが格納され、このとき、前記第2記憶領域に格納される前記第2通信処理プログラムは、前記書き込み制御プログラム及び前記第1通信処理プログラムを前記中央処理装置によって実行させる第1書き込みモードによって、前記第2記憶領域に書き込まれる。   The first storage area further stores a write control program. At this time, the second communication processing program stored in the second storage area stores the write control program and the first communication processing program in the center. The data is written into the second storage area by the first write mode executed by the processing device.

また、前記第3記憶領域に格納される前記制御プログラムは、前記第1書き込みモード、又は、前記第1記憶領域に格納された書き込み制御プログラム及び前記第2通信処理プログラムを前記中央処理装置によって実行させる第2書き込みモードの何れかによって、前記第3記憶領域に書き込まれる。   The control program stored in the third storage area is executed by the central processing unit by the first write mode or the write control program and the second communication processing program stored in the first storage area. The data is written into the third storage area according to any of the second write modes.

前記第1記憶領域は、さらに、消去制御プログラムが格納され、このとき、前記第2記憶領域に格納される前記第2通信処理プログラムは、前記消去制御プログラム及び前記第1通信処理プログラムを前記中央処理装置によって実行させる第1消去モードによって、前記第2記憶領域から消去可能にされる。   The first storage area further stores an erasure control program. At this time, the second communication processing program stored in the second storage area stores the erasure control program and the first communication processing program in the center. Erasing from the second storage area is enabled by the first erasing mode executed by the processing device.

前記第3記憶領域に格納される前記制御プログラムは、前記第1消去モード、又は、前記第1記憶領域に格納された消去制御プログラム及び前記第2通信処理プログラムを前記中央処理装置によって実行させる第2消去モードの何れかによって、前記第3記憶領域から消去可能である。   The control program stored in the third storage area is the first erasing mode or the erasing control program and the second communication processing program stored in the first storage area are executed by the central processing unit. The data can be erased from the third storage area by any one of the two erase modes.

更に上記とは異なる観点によるマイクロコンピュータは、中央処理装置と、第1インタフェース(SCSI)を用いた通信プロトコル(UART)を確立するための第1通信処理プログラムと書き込み制御プログラムが格納される第1記憶領域と、前記第1インタフェースと異なる前記第2インタフェース(ATAPI,SCSI,HCAN)を用いた通信プロトコルを確立するための第2通信処理プログラムが格納される第2記憶領域と、所定の第1動作モードで前記中央処理装置によって実行される制御プログラムが格納される第3記憶領域とを有する不揮発性メモリと、を有する。   Further, the microcomputer according to the aspect different from the above stores the first communication processing program and the write control program for establishing the communication protocol (UART) using the central processing unit and the first interface (SCSI). A storage area; a second storage area for storing a second communication processing program for establishing a communication protocol using the second interface (ATAPI, SCSI, HCAN) different from the first interface; and a predetermined first A non-volatile memory having a third storage area for storing a control program executed by the central processing unit in an operation mode.

本願において開示される発明のうち代表的なものによって得られる効果を簡単に説明すれば下記の通りである。   The effects obtained by the representative ones of the inventions disclosed in the present application will be briefly described as follows.

すなわち、ユーザの実装ボートに必ずシリアルインターフェースを作成しなくても、ユーザ専用の通信プロトコルで、オンボード書きこみが実施でき、暴走しても、ユーザ専用通信プロトコルコードを破壊する事はない。   In other words, even if a serial interface is not necessarily created on the user's mounting board, on-board writing can be performed with a user-specific communication protocol, and even if runaway occurs, the user-specific communication protocol code is not destroyed.

ユーザマットには、ユーザの制御プログラムを作成すれば良く、プログラムの作成が容易となる。要するに、ユーザブートマットとユーザマットを分けた事により、ユーザマットに専用通信プロトコルを書かなくても、消去及び書き込み用にユーザ任意の書きこみインターフェースが実現できるから、ユーザマットに格納して使用する制御プログラムの作成が容易になる。したがって、ユーザプログラムモードで使用する通信制御プログラムの消去防止などについて特別な考慮を払わなくてもよい。   A user control program may be created for the user mat, and the creation of the program is facilitated. In short, by separating the user boot mat from the user mat, it is possible to realize a user-specific writing interface for erasing and writing without writing a dedicated communication protocol in the user mat. It is easy to create a control program. Therefore, it is not necessary to pay special consideration to prevention of erasure of the communication control program used in the user program mode.

ユーザブートマットから立ち上がるユーザブートモードでは、ハードウェア的にユーザブートマットを消去及び書きこみ不可にするので、暴走等でユーザブートマットの記憶情報が破壊される事はなく、デバック時にCPUが暴走しても、外部インターフェースを制御するプログラムの破壊には至らないので、実装したマイクロコンピュータチップを取り外さなくても、オンボードでユーザマットの書換えを自由に行うことができる。   In the user boot mode that rises from the user boot mat, the user boot mat cannot be erased or written in hardware, so the stored information in the user boot mat will not be destroyed due to runaway, etc., and the CPU will runaway during debugging. However, since the program for controlling the external interface is not destroyed, the user mat can be freely rewritten on-board without removing the mounted microcomputer chip.

《マイクロコンピュータ》
図1には本発明の一例に係るデータ処理装置としてのマイクロコンピュータが示される。同図に示されるマイクロコンピュータ1は、特に制限されないが、単結晶シリコンのような1個の半導体基板(半導体チップ)にCMOS集積回路製造技術により形成される。
<Microcomputer>
FIG. 1 shows a microcomputer as a data processing apparatus according to an example of the present invention. The microcomputer 1 shown in the figure is not particularly limited, but is formed on a single semiconductor substrate (semiconductor chip) such as single crystal silicon by a CMOS integrated circuit manufacturing technique.

マイクロコンピュータ1は、演算制御装置としての中央処理装置(CPU)2、不揮発性メモリとしてのRAM3、バスステートコントローラ(BSC)4、フラッシュメモリ13、及びその他の内蔵回路を総称するその他モジュール7を有する。前記フラッシュメモリ13は電気的に書き換え可能な不揮発性メモリの一例であり、フラッシュメモリモジュール5とフラッシュコントロールモジュール6によって構成される。前記その他モジュール7としてマスクROM8、割り込みコントローラ(INTC)9、タイマ(TMR)10、入出力ポート(I/O)11、シリアルインタフェースコントローラ(SCI)12、その他インタフェースコントローラ16、DMAC(Direct Memory Access Controller)17及びシステムコントローラ15等を有する。それら回路モジュールはバスIAB,IDB,PAB,PDB,CONTを介してインタフェースされる。   The microcomputer 1 has a central processing unit (CPU) 2 as an arithmetic control device, a RAM 3 as a nonvolatile memory, a bus state controller (BSC) 4, a flash memory 13, and other modules 7 generically including other built-in circuits. . The flash memory 13 is an example of an electrically rewritable nonvolatile memory, and includes a flash memory module 5 and a flash control module 6. As the other module 7, mask ROM 8, interrupt controller (INTC) 9, timer (TMR) 10, input / output port (I / O) 11, serial interface controller (SCI) 12, other interface controller 16, DMAC (Direct Memory Access Controller) ) 17 and the system controller 15. These circuit modules are interfaced via buses IAB, IDB, PAB, PDB, CONT.

前記バスIAB,IDBは情報伝送速度の比較的速い内部アドレスバス、内部データバスである。前記バスPAB,PDBは情報伝送速度が比較的遅い周辺アドレスバス、周辺データバスである。バスCONTは、バスコマンド、バスアクセス制御信号、及びタイミング制御信号等を伝達する制御信号線を総称する。内部バスIDB,IABと周辺バスPDB,PABとの動作速度の相違若しくはアクセス対象に固有のアクセス形態の相違に対して前記BSC4がアクセス動作タイミング等を最適制御すると共に、前記BSC4はアクセスアドレスに応じたチップ選択若しくはモジュール選択制御等も行なう。   The buses IAB and IDB are an internal address bus and an internal data bus having a relatively high information transmission speed. The buses PAB and PDB are a peripheral address bus and a peripheral data bus whose information transmission speed is relatively low. The bus CONT is a generic name for control signal lines that transmit bus commands, bus access control signals, timing control signals, and the like. The BSC 4 optimally controls the access operation timing and the like according to the access address in response to the difference in operation speed between the internal buses IDB and IAB and the peripheral buses PDB and PAB, or the difference in the access form specific to the access target. Chip selection or module selection control is also performed.

前記システムコントローラ15には外部から複数ビットのモード信号14及びリセット信号RESなどが入力される。マイクロコンピュータ1のパワーオンリセット或はハードウェアリセットによりリセット信号RESがローレベルにされると、そのローレベル期間においてマイクロコンピュータ1の内部でリセット動作が行われる。リセット信号RESによるリセットの解除後、複数ビットのモード信号14の状態に応じて、マイクロコンピュータ1の動作モードが決定される。CPU2は、その動作モードに応じたプログラム領域のリセットベクタをリードし、そのアドレスの命令をフェッチし、フェッチした命令を解読して、命令実行を開始する。   The system controller 15 receives a multi-bit mode signal 14 and a reset signal RES from the outside. When the reset signal RES is set to the low level by the power-on reset or the hardware reset of the microcomputer 1, the reset operation is performed inside the microcomputer 1 during the low level period. After canceling the reset by the reset signal RES, the operation mode of the microcomputer 1 is determined according to the state of the multi-bit mode signal 14. The CPU 2 reads the reset vector in the program area corresponding to the operation mode, fetches the instruction at the address, decodes the fetched instruction, and starts instruction execution.

RAM3はCPU2のワーク領域若しくはデータ又はプログラムの一時記憶領域としても利用される。前記マスクROM8はデータテーブルなどの記憶領域とされる。フラッシュメモリモジュール5はCPU2のプログラムやデータの記憶領域とされる。   The RAM 3 is also used as a work area for the CPU 2 or a temporary storage area for data or programs. The mask ROM 8 is a storage area such as a data table. The flash memory module 5 is a storage area for programs and data of the CPU 2.

割り込みコントローラ10はマイクロコンピュータ1の外部から与えられる割込要求又はマイクロコンピュータ1内部の状態に応じて内蔵回路モジュールから発生される割込要求が入力され、割り込み優先レベル及び割り込みマスク等に従って、競合する割込み要求の調停と割込み優先レベルによる割込みマスク処理を行う。割り込みコントローラ10は割込み要求の調停と割込みマスク処理との結果に従って、CPU2に割込み信号IRQを与えるとと共に、受付ら得た割込み要求の割り込み要因に応ずる割り込みベクタアドレスをCPU2に与える。CPU2は割り込みベクタアドレスによって指示されるプログラムに処理を分岐する。割込みコントローラ9はCPU2から割込みマスクデータ(IMSK)が与えられ、この割込みマスクデータ(IMSK)で示される割込み優先レベルよりも低い割込み要求の受付をマスクする。   The interrupt controller 10 receives an interrupt request given from the outside of the microcomputer 1 or an interrupt request generated from the built-in circuit module according to the internal state of the microcomputer 1 and competes according to the interrupt priority level, interrupt mask, etc. Interrupt request arbitration and interrupt mask processing based on interrupt priority level. The interrupt controller 10 gives an interrupt signal IRQ to the CPU 2 according to the result of the interrupt request arbitration and the interrupt mask process, and also gives the CPU 2 an interrupt vector address corresponding to the interrupt factor of the received interrupt request. The CPU 2 branches the process to a program designated by the interrupt vector address. The interrupt controller 9 receives interrupt mask data (IMSK) from the CPU 2 and masks reception of an interrupt request lower than the interrupt priority level indicated by the interrupt mask data (IMSK).

I/O11は外部アドレスバス及び外部データバスへの接続、SCI12の外部インタフェース、TMR10の外部イベント信号入力、そのインタフェースコントローラ16の外部インタフェース等に用いられる。インタフェースコントローラ16は例えば、ATAPI又はSCSIなどのインタフェースに適用可能である。   The I / O 11 is used for connection to an external address bus and an external data bus, an external interface of the SCI 12, an external event signal input of the TMR 10, an external interface of the interface controller 16, and the like. The interface controller 16 is applicable to an interface such as ATAPI or SCSI, for example.

図2には前記CPU2の具体例が示される。CPU2は、特に制限されないが、シフタSFT及び算術論理演算器ALU等の演算器と、32ビットの汎用レジスタR0〜R31、プログラムカウンタPC、ステータスレジスタSR及びテンポラリレジスタTR等のレジスタ群、そしてリードデータバッファRDB、ライトデータバッファWDB及びアドレスバッファABなどのバッファ回路を実行部に有し、それらは第1乃至第3内部バスIB1〜IB3のうちの所定の内部バスに接続される。CPU2は命令制御部として、命令レジスタIR、命令デコーダIDEC、命令シーケンスロジックINTLを有する。   FIG. 2 shows a specific example of the CPU 2. The CPU 2 is not particularly limited, but an arithmetic unit such as a shifter SFT and an arithmetic logic unit ALU, a register group such as a 32-bit general purpose registers R0 to R31, a program counter PC, a status register SR and a temporary register TR, and read data The execution unit includes buffer circuits such as a buffer RDB, a write data buffer WDB, and an address buffer AB, which are connected to a predetermined internal bus among the first to third internal buses IB1 to IB3. The CPU 2 includes an instruction register IR, an instruction decoder IDEC, and an instruction sequence logic INTL as an instruction control unit.

前記リードデータバッファRDBは例えば32ビットのデータバスIDBから入力したデータを内部バスIB2に供給する。ステータスレジスタSRは割込みマスクデータIMSKのフィールドを有する。割込みマスクデータIMSKは割込みコントローラ9に与えられる。割込みコントローラ9は割込みマスクデータIMSKで示される割込み優先レベルよりも低い割込み要求をマスクする。   The read data buffer RDB supplies, for example, data input from a 32-bit data bus IDB to the internal bus IB2. The status register SR has a field for interrupt mask data IMSK. The interrupt mask data IMSK is given to the interrupt controller 9. The interrupt controller 9 masks an interrupt request lower than the interrupt priority level indicated by the interrupt mask data IMSK.

前記プログラムカウンタPCは次に実行すべき命令アドレスを保有し、その命令アドレスがアドレスバッファABから内部アドレスバスIABに出力されると、RAM3等の対応アドレスからリードされた命令が内部データバスIDBを介して命令レジスタIRにフェッチされる。命令デコーダIDECは命令レジスタIRの命令を解読して、CPU2内部の制御信号を生成して、前記実行部による演算処理を制御する。命令シーケンスロジックINTLは割込み信号IRQ等に応答して命令実行順序を変更する制御を行なう。   The program counter PC holds an instruction address to be executed next, and when the instruction address is output from the address buffer AB to the internal address bus IAB, the instruction read from the corresponding address of the RAM 3 or the like uses the internal data bus IDB. To the instruction register IR. The instruction decoder IDEC decodes the instruction in the instruction register IR, generates a control signal inside the CPU 2, and controls arithmetic processing by the execution unit. The instruction sequence logic INTL controls to change the instruction execution order in response to the interrupt signal IRQ and the like.

図1においてフラッシュメモリモジュール5は、メモリセルアレイ20、Xデコーダ・ドライバ(XDE・DV)21、センスアンプアレイ(SAA)22、Yスイッチアレイ(YSW)23、Yデコーダ(YDE)24、入出力回路(IFB)25、電源回路(VGN)26、及びタイミングジェネレータ(TGN)27を有する。メモリセルアレイ20はマトリクス配置されたフラッシュッメモリセル(図示せず)を有する。フラッシュメモリセルは、特に制限されないが、半導体基板若しくはウェル領域にソース、ドレインを有し、チャネルの上方に夫々絶縁膜を介してフローティングゲート及びコントロールゲートが形成されたスタック構造を有し、ソースをソース線に、ドレインをビット線に、コントロールゲートをワード線に接続して構成される。   In FIG. 1, a flash memory module 5 includes a memory cell array 20, an X decoder / driver (XDE / DV) 21, a sense amplifier array (SAA) 22, a Y switch array (YSW) 23, a Y decoder (YDE) 24, and an input / output circuit. (IFB) 25, power supply circuit (VGN) 26, and timing generator (TGN) 27. The memory cell array 20 has flash memory cells (not shown) arranged in a matrix. Although the flash memory cell is not particularly limited, the flash memory cell has a stack structure in which a source and a drain are provided in a semiconductor substrate or a well region, and a floating gate and a control gate are formed above the channel via an insulating film, respectively. The source line is connected to the bit line and the control gate is connected to the word line.

フラッシュメモリセルは閾値電圧がプログラム可能にされ、プログラムされた閾値電圧に応じて情報を保持する。例えば、1個のフラッシュメモリセルが1ビットの情報を保持する場合に、相対的に高い閾値電圧状態を書き込み状態、相対的に低い閾値電圧状態を消去状態と称する。書き込み状態を得る為の書き込み動作は、特に制限されないが、コントロールゲートに10V、ドレインに例えば5V、ソースおよび基板に例えば0Vを印加して、ドレイン・ソース間に電流を流し、これによってホットエレクトロン注入が起こり、フローティングゲートに電子が蓄積され、メモリセルの閾値電圧が高くなる。前記消去状態を得る為の消去動作は、特に制限されないが、コントロールゲートに10V、ソース及び基板に例えば−10Vを印加し、さらにドレインを例えば開放(フローティング)にして、フローティングゲートに蓄積された電子を基板に放出させ、これによってメモリセルの閾値電圧が低くなる。   The flash memory cell is programmable in threshold voltage and retains information according to the programmed threshold voltage. For example, when one flash memory cell holds 1-bit information, a relatively high threshold voltage state is referred to as a write state, and a relatively low threshold voltage state is referred to as an erase state. The write operation for obtaining the write state is not particularly limited, but 10 V is applied to the control gate, 5 V is applied to the drain, and 0 V is applied to the source and the substrate, and a current is caused to flow between the drain and source, thereby injecting hot electrons. Occurs, electrons are accumulated in the floating gate, and the threshold voltage of the memory cell increases. The erase operation for obtaining the erased state is not particularly limited, but 10V is applied to the control gate, -10V is applied to the source and the substrate, and the drain is opened (floating), for example. Are released to the substrate, which lowers the threshold voltage of the memory cell.

前記入出力回路25はバスIAB,IDB,PAB,PDB,CONTとの間でアドレス、制御信号及びコマンドを入力すると共にデータの入出力を行なう。入出力回路25に入力されたアドレス信号はXDEC・DV21及びYDE24に入力されて夫々デコードされる。XDEC・DV21はそのデコード結果に従ってワード線を選択する。YDE24はそのデコード結果に従ってYSW23を介してビット線を選択する。ワード線選択及びビット線選択によってフラッシュメモリセルが選択される。読み出し動作では、前記選択されたフラッシュメモリセルの読み出しデータは、SAA22にて検出され、入出力回路25を経てバスPDBまたはIDBに出力される。書き込み動作では、バスPDB又はIDBから入出力回路25に与えられる書き込みデータが入出力回路25内の書き込みラッチ回路にラッチされ、ワード線選択されたメモリセルに対し、ラッチデータに従って書き込み・書き込み阻止が制御される。書き込み処理の前には予めブロック単位でフラッシュメモリセルに対する消去が行なわれる。   The input / output circuit 25 inputs addresses, control signals, and commands and inputs / outputs data with the buses IAB, IDB, PAB, PDB, and CONT. The address signal input to the input / output circuit 25 is input to the XDEC / DV 21 and the YDE 24 and decoded. The XDEC / DV 21 selects a word line according to the decoding result. The YDE 24 selects a bit line via the YSW 23 according to the decoding result. A flash memory cell is selected by word line selection and bit line selection. In the read operation, read data of the selected flash memory cell is detected by the SAA 22 and output to the bus PDB or IDB via the input / output circuit 25. In the write operation, write data given from the bus PDB or IDB to the input / output circuit 25 is latched by the write latch circuit in the input / output circuit 25, and the memory cell selected by the word line is prevented from being written / written according to the latch data. Be controlled. Before the writing process, the flash memory cells are erased in units of blocks.

前記電源回路26はクランプ回路やチャージポンプ回路などを有し、フラッシュメモリの書き込み・消去・読み出しなどの動作で使用する様々な電圧を供給する。前記タイミングジェネレータ27は、制御バスCONTを介して供給されるストローブ信号及びデータバスPDB,IDBを介して入力されるコマンドに基づいてフラッシュメモリの外部とのインタフェース制御を行なう。   The power supply circuit 26 includes a clamp circuit, a charge pump circuit, and the like, and supplies various voltages used in operations such as writing, erasing, and reading of the flash memory. The timing generator 27 performs interface control with the outside of the flash memory based on a strobe signal supplied via the control bus CONT and a command input via the data buses PDB and IDB.

図1において前記フラッシュコントロールモジュール6は、フラッシュメモリモジュール5に対する消去及び書込みやそのためのプログラム転送関係の各種制御レジスタ30と制御論理回路29とを有する。図1には制御レジスタとしてFCCS,FKEY,FMATS,ライタモード関係レジスタ,書き込み消去関係レジスタが代表的に示されている。フラッシュメモリモジュール5に対する消去及び書込み動作の制御にはRAM3の記憶領域やCPU2の汎用レジスタも利用する。   In FIG. 1, the flash control module 6 includes various control registers 30 and a control logic circuit 29 related to erasure and writing to the flash memory module 5 and program transfer therefor. FIG. 1 representatively shows FCCS, FKEY, FMATS, writer mode related registers, and write / erase related registers as control registers. The storage area of the RAM 3 and the general-purpose register of the CPU 2 are also used for controlling the erase and write operations for the flash memory module 5.

《フラッシュメモリのメモリマット》
図3にはフラッシュメモリのメモリマットが例示される。フラッシュメモリモジュール5のメモリセルアレイ20は、電気的に消去及び書き込み可能なブートマット(第1領域)Tmat、ユーザブートマット(第2領域)Umat、ユーザマット(第3領域)Mmat、及びリペア及びトリミングマットRmatを有する。前記ブートマットTmat、ユーザブートマットUmat、及びユーザマットMmatは夫々CPU2のアドレス空間における先頭アドレスである0番地(H’0000000)をスタートアドレスとしてメモリ空間が割り当てられる。要するに、前記ブートマットTmat、ユーザブートマットUmat、及びユーザマットMmatはアドレス空間がオーバラップされ、前記アドレスデコーダYDEC及びXDEC・DVはどのマットを利用するかの指示に応答してアドレスデコード論理が選択されることになる。どのマットを利用するかはモード信号14で指示されるマイクロコンピュータの動作モードなどによって決まる。リペア及びトリミングマットRmatはメモリセルアレイにおける欠陥救済アドレスや回路の特性に応じた合わせ込みのためのトリミング回路の設定データが格納される。
<Flash memory mat>
FIG. 3 illustrates a memory mat of a flash memory. The memory cell array 20 of the flash memory module 5 includes an electrically erasable and writable boot mat (first area) Tmat, a user boot mat (second area) Umat, a user mat (third area) Mmat, and repair and trimming. It has a mat Rmat. The boot mat Tmat, the user boot mat Umat, and the user mat Mmat are each allocated a memory space with the start address 0 (H′0000000) in the address space of the CPU 2 as a start address. In short, the boot mat Tmat, the user boot mat Umat, and the user mat Mmat are overlapped in address space, and the address decoder YDEC and XDEC / DV select the address decoding logic in response to an instruction on which mat is used. Will be. Which mat is used is determined by the operation mode of the microcomputer indicated by the mode signal 14. The repair and trimming mat Rmat stores setting data of a trimming circuit for alignment according to a defect relief address and circuit characteristics in the memory cell array.

《動作モード》
フラッシュメモリは、プロセス世代が進むにつれて、書き込み関係、消去関係のプログラムが複雑化しつつある。このような事情の下で、消去及び書き込み制御プログラムをユーザが作成しなければならないとすると、ユーザの負担が大きくなる。マイクロコンピュータ1においては、ユーザに消去及び書き込みプログラムを作成する負担を減らし、簡単な手続きで消去及び書き込みをどのモードでも実施できるように考慮されている。特に、フラッシュメモリ13を消去及び書き込みするための高電圧パルス印加時間などのパラメータをチューニングしたり処理フローを変更したりするときに、ハードウェアに依存せずソフトウェアを使用して実施でき、ユーザに負担をかけず、簡単な手続きで消去及び書き込みを実施できる動作モードを用意している。その内容を簡単に説明すると、ブートマットTmatが保有している消去及び書き込み制御プログラムをどの動作モードでも参照できるようにし、しかも、ブートマットTmatのプログラムには、セキュリティに関する部分の記述もあるので、不都合のない範囲でユーザがそのプログラムを使用できるようにしてある。
"action mode"
In the flash memory, as the process generation progresses, the program related to writing and erasing is becoming more complicated. Under such circumstances, if the user has to create an erase and write control program, the burden on the user increases. In the microcomputer 1, it is considered that the user can reduce the burden of creating an erasing and writing program and can perform erasing and writing in any mode with a simple procedure. In particular, when tuning parameters such as the high voltage pulse application time for erasing and writing the flash memory 13 or changing the processing flow, it can be performed using software without depending on hardware, and can There is an operation mode that can be erased and written in a simple procedure without imposing a burden. Briefly describing the contents, the erase and write control program held by the boot mat Tmat can be referred to in any operation mode, and the program of the boot mat Tmat has a description about the security. The user can use the program as long as there is no inconvenience.

マクロコンピュータ1の動作モードを詳述する。フラッシュメモリ13に対する消去及び書き込みに着目すると、マイクロコンピュータ1は、ライタモード、ブートモード(第1モード)、ユーザブートモード(第2モード)、及びユーザモード(第3モード)を有する。特に制限されないが、前記モード信号14は2ビットであり、システムコントローラ15は、其の論理値の組み合わせを解読して、指示された動作モードが、前記ライタモード、ブートモード、ユーザブートモード、又はユーザモードの何れであるかを判定する。   The operation mode of the macro computer 1 will be described in detail. Focusing on erasing and writing to the flash memory 13, the microcomputer 1 has a writer mode, a boot mode (first mode), a user boot mode (second mode), and a user mode (third mode). Although not particularly limited, the mode signal 14 is 2 bits, and the system controller 15 decodes the combination of the logical values, and the designated operation mode is the writer mode, boot mode, user boot mode, or It is determined which of the user modes.

前記ライタモードはEPROMライタのような書き込み装置を用いてフラッシュメモリ13の消去及び書き込みを実施可能にする動作モードである。ライタモードが指定されると、リセット処理後、CPU2はブートマットTmatの先頭番地からベクタフェッチを行ってプログラムの実行を開始する(ブートマットから起動)。そして、ライターモードに必要な処理として、コマンド判定プログラムや消去及び書き込み関係のプログラムを全てRAM3に転送する。その後に、CPU2は、RAM3に転送されたプログラムの実行に移行し、フラッシュメモリ13はEPROMライタによって消去及び書き込み可能にされる。このライタモードは、オフボード(マイクロコンピュータがシステムボードに実装されていない状態)で前記ユーザマットMmat及びユーザブートマットUmatに任意のユーザ制御プログラム等を格納するのに適している。   The writer mode is an operation mode that enables erasing and writing of the flash memory 13 using a writing device such as an EPROM writer. When the writer mode is designated, after reset processing, the CPU 2 performs vector fetch from the head address of the boot mat Tmat and starts execution of the program (starts from the boot mat). Then, as a process necessary for the writer mode, all of the command determination program and the erase and write related programs are transferred to the RAM 3. Thereafter, the CPU 2 shifts to the execution of the program transferred to the RAM 3, and the flash memory 13 is made erasable and writable by the EPROM writer. This writer mode is suitable for storing an arbitrary user control program or the like in the user mat Mmat and the user boot mat Umat off-board (in a state where the microcomputer is not mounted on the system board).

前記ブートモードは、マットTmat,Umat、Mmatの全てを消去し、SCI12を使用して書き込みを実施可能にする動作モードである。このブートモードは前記CPU2にブートマットTmatのプログラムを処理させると共に当該ブートマットTmatを消去及び書き込み不可能にする。具体的には、ブートモードが指定されると、リセット処理後、CPU2はブートマットTmatの先頭番地からベクタフェッチを行ってプログラムの実行を開始する。そして、ブートモードに必要な処理として、ブートマットTmat内の消去及び書き込み関係のプログラム及びコマンド判定プログラムをRAM3に転送する。転送終了とその他の処理終了後に、CPU2はRAM3上のプログラム実行に移る。RAM3上のプログラム実行でマットUmat、Mmatの全てを消去した後に、コマンド判定プログラムを起動し、SCI12を利用して書き込みが実施可能になる。このブートモードは、シリアル通信インタフェースを備えたオンボードで、前記ユーザマットMmat及びユーザブートマットUmatに任意のユーザ制御プログラム等を格納するのに適している。   The boot mode is an operation mode in which all of the mats Tmat, Umat, and Mmat are erased and writing can be performed using the SCI 12. In this boot mode, the CPU 2 processes the program of the boot mat Tmat and makes the boot mat Tmat unerasable and writable. Specifically, when the boot mode is designated, after the reset process, the CPU 2 performs vector fetch from the head address of the boot mat Tmat and starts executing the program. Then, as processing necessary for the boot mode, an erase and write related program and a command determination program in the boot mat Tmat are transferred to the RAM 3. After completion of the transfer and other processing, the CPU 2 proceeds to execute the program on the RAM 3. After erasing all of the mats Umat and Mmat by executing the program on the RAM 3, the command determination program is started and writing can be performed using the SCI 12. This boot mode is an on-board equipped with a serial communication interface, and is suitable for storing an arbitrary user control program or the like in the user mat Mmat and the user boot mat Umat.

前記ユーザブートモードは、前記CPU2にユーザブートマットUmatのプログラムを処理させてユーザ任意のインタフェースを使用した消去及び書き込みを実施可能とし、ブートマットTmat及びユーザブートマットUmatに対しては消去及び書き込みを不可能にする動作モードである。具体的には、ユーザブートモードは、ブートマットTmatから起動し、CPU2がブートマットTmat内のプログラムを実行すると共にRAM3へユーザブートマット切換えプログラムの転送を行う。その後に、CPU2はRAM3上のプログラム実行に移る。CPU2によるRAM3上のプログラム実行で、CPU2のアドレス空間で見えるフラッシュメモリ13上のマットをデフォルトのユーザマットMmatからユーザブートマットUmatへ切換え、ユーザブートマットUmatのベクタアドレスを読み出した後にその領域へジャンプする。セキュリティが掛かっている場合は、ユーザマットMmatの消去を実施した後にジャンプを実施する。書き込みを実施する時は、後述するSCOモードを使用して必要な消去及び書き込みプログラムをブートマットTmatからRAM3にダウンロードした後、その消去及び書き込み制御プログラムを利用して、ユーザマットMmatに対する書き込みを行う。要するに、ユーザブートマットUmatにユーザ専用のインターフェースプログラムを用意して、ユーザの実装ボートに合った書き込みデータ転送が実現可能となる。このユーザブートモードは、ユーザのシステムボードが備えているオンボードインタフェースを使用して、ユーザの制御プログラムなどをユーザマットMmatに書き込むのに適している。この動作においてユーザブートマットUmatの消去は阻止される。したがって、ユーザのシステムボードがシリアルインタフェースを備えず、オンボードでブートモードを利用できなくても、これに代えて、ユーザのシステムボードが備えているオンボードインタフェースを介する書き込みをを保証することができる。   The user boot mode allows the CPU 2 to process the program of the user boot mat Umat so that erasure and writing can be performed using any user interface, and the boot mat Tmat and the user boot mat Umat can be erased and written. This is the operation mode to be disabled. Specifically, the user boot mode is started from the boot mat Tmat, and the CPU 2 executes the program in the boot mat Tmat and transfers the user boot mat switching program to the RAM 3. Thereafter, the CPU 2 proceeds to execute a program on the RAM 3. By executing a program on the RAM 3 by the CPU 2, the mat on the flash memory 13 visible in the address space of the CPU 2 is switched from the default user mat Mmat to the user boot mat Umat, and after jumping to the area after reading the vector address of the user boot mat Umat To do. When security is applied, the jump is executed after the user mat Mmat is erased. When writing is performed, a necessary erase and write program is downloaded from the boot mat Tmat to the RAM 3 using the SCO mode described later, and then the user mat Mmat is written using the erase and write control program. . In short, a user-specific interface program is prepared in the user boot mat Umat, and write data transfer suitable for the user's mounting board can be realized. This user boot mode is suitable for writing a user control program or the like to the user mat Mmat using an on-board interface provided on the user system board. In this operation, erasure of the user boot mat Umat is prevented. Therefore, even if the user's system board does not have a serial interface and the boot mode cannot be used on-board, instead, writing via the on-board interface provided by the user's system board is guaranteed. it can.

前記ユーザモードはユーザマットMmatが保有するプログラムを利用して消去及び書き込みを実施可能にする動作モードであり、ブートマットTmat及びユーザブートマットUmatの消去及び書き込みについては不可能にする。詳しくは、CPU2をユーザマットMmatから起動し、ユーザマットMmat上のプログラムが実行される。特に、ユーザが必要な時に、後述するSCOビットをイネーブルにするとブートマットTmatとユーザマットMmatが自動的に切り替わり、ブートマットTmatのある番地からプログラムがスタートし、ブートマットTmat上の消去及び書き込み制御プログラムがRAM3に転送され、プログラムの転送が終了したらユーザマットMmatとブートマットTmatが自動的に切り替えられて、ユーザの処理へ復帰し、ユーザのプログラムで前記消去及び書き込み制御プログラムが利用されて、ユーザマットMmatに対する消去及び書き込みが可能にされる。要するに、ユーザプログラムモードでは、後述するSCOモードを使用してブートマットTmat上の消去及び書き込み制御プログラムをRAM3上に転送しそのプログラムを利用可能にしている。このユーザモードは、オンボードでユーザ制御プログラム実行中にユーザマットMmat上のパラメータなどを書き換えるのに適している。   The user mode is an operation mode in which erasing and writing can be performed using a program held by the user mat Mmat, and erasing and writing of the boot mat Tmat and the user boot mat Umat are disabled. Specifically, the CPU 2 is activated from the user mat Mmat, and the program on the user mat Mmat is executed. In particular, when the user needs to enable the SCO bit, which will be described later, the boot mat Tmat and the user mat Mmat are automatically switched, and the program starts from the address where the boot mat Tmat is located, and erase and write control on the boot mat Tmat is performed. When the program is transferred to the RAM 3 and the transfer of the program is completed, the user mat Mmat and the boot mat Tmat are automatically switched to return to the user process, and the user program uses the erase and write control program, Erasing and writing can be performed on the user mat Mmat. In short, in the user program mode, the erase and write control program on the boot mat Tmat is transferred to the RAM 3 using the SCO mode described later, and the program is made available. This user mode is suitable for rewriting parameters on the user mat Mmat during execution of the user control program on board.

図4の(A),(B)には各マットの各動作モードによるアクセス態様が示される。同図に示されるアクセス態様は上記動作モードで説明したアクセス態様を整理したものである。同図からも明らかなように、リペア及びトリミングマットRmatとブートマットTmatは何れの動作モードにおいても消去及び書き込み不可能にされ、ユーザブートマットUmatはユーザ制御プログラムが実行可能にされるユーザブートモード及びユーザモード(ユーザプログラムモード)において消去及び書き込み不可能にされる。このユーザブートモードは、ユーザのシステムボードが備えているオンボードインタフェースを使用して、ユーザの制御プログラムなどをユーザマットMmatに書き込むのに適している。この動作においてユーザブートマットUmatの消去は阻止される。したがって、ユーザのシステムボードがシリアルインタフェースを備えず、オンボードでブートモードを利用できなくても、これに代えて、ユーザのシステムボードが備えているオンボードインタフェースを介する書き込みを保証することができる。尚、図4においてアクセスとはリードアクセスを意味し、記号△はブートマットに格納されたプログラムにしたがってリードアクセス可能であることを意味し、ユーザ制御プログラムにしたがって任意にリードアクセスできることは意味しない。   4A and 4B show an access mode according to each operation mode of each mat. The access mode shown in the figure is an arrangement of the access modes described in the operation mode. As can be seen from the figure, the repair and trimming mat Rmat and the boot mat Tmat cannot be erased or written in any operation mode, and the user boot mat Umat is a user boot mode in which a user control program can be executed. In the user mode (user program mode), erasure and writing are disabled. This user boot mode is suitable for writing a user control program or the like to the user mat Mmat using an on-board interface provided on the user system board. In this operation, erasure of the user boot mat Umat is prevented. Therefore, even if the user's system board does not have a serial interface and the boot mode cannot be used on-board, the writing via the on-board interface provided on the user's system board can be guaranteed instead. . In FIG. 4, “access” means read access, and the symbol Δ means that read access is possible according to the program stored in the boot mat, and it does not mean that arbitrary read access is possible according to the user control program.

図5にはCPUが実行するプログラムの所在と実行による作用を模式的に示す。図5ではCPU2の図示は省略してあり、CN1はブートマットTmatからRAM3に転送された消去及び書き込み制御プログラム等をCPU2が解読した結果の制御信号群を仮想的に示す。CN2はブートマットTmatからRAM3に転送されたシリアルインタフェース制御プログラムをCPU2が解読した結果の制御信号群を仮想的に示す。CN3はユーザブートマットUmatのユーザインタフェース制御プログラムをCPU2が解読した結果の制御信号群を仮想的に示す。CN4はユーザマットMmatのユーザインタフェース制御プログラムをCPU2が解読した結果の制御信号群を仮想的に示す。制御信号CN3,CN4はユーザブートマットUmat、ユーザマットMmatから直接フェッチしたプログラムの解読結果であるように図示されているが、一旦RAM3に転送され、RAM3からフェッチしたプログラムの解読結果であってよい。Sig1〜Sig4はシステムコントローラ15によるリセット解除後のモード信号14の解読結果を意味し、Sig1はブートモード、Sig2はユーザブートモード、Sig3はユーザモード、Sig4はライトモードを意味する。それら信号Sig1〜Sig4は実際にはCPU2にも供給されるがここではその状態の図示を省略してある。   FIG. 5 schematically shows the location and execution of the program executed by the CPU. In FIG. 5, the CPU 2 is not shown, and CN 1 virtually shows a control signal group obtained as a result of the CPU 2 decoding the erase and write control program transferred from the boot mat Tmat to the RAM 3. CN2 virtually represents a control signal group as a result of the CPU 2 decoding the serial interface control program transferred from the boot mat Tmat to the RAM 3. CN3 virtually represents a control signal group obtained as a result of the CPU 2 decoding the user interface control program of the user boot mat Umat. CN4 virtually indicates a control signal group obtained as a result of the CPU 2 decoding the user interface control program of the user mat Mmat. Although the control signals CN3 and CN4 are illustrated as the decoding results of the program fetched directly from the user boot mat Umat and the user mat Mmat, they may be the decoding results of the program once transferred to the RAM 3 and fetched from the RAM 3. . Sig1 to Sig4 mean the decoding result of the mode signal 14 after the reset release by the system controller 15, Sig1 means the boot mode, Sig2 means the user boot mode, Sig3 means the user mode, and Sig4 means the write mode. The signals Sig1 to Sig4 are actually supplied to the CPU 2, but the state thereof is omitted here.

モード信号14にてブートモードが指示されると、信号Sig1に応答してフラッシュコントロールモジュール6によりブートマットTmatの消去及び書き込み制御プログラム及びシリアル通信制御プログラム等がRAM3に転送される(径路P1)。CPU2びよる其のシリアル通信制御プログラムの解読結果(CN2)にしたがってホスト装置HST1にオンボードのシリアルインタフェースから書き込みデータがRAM3に取り込まれ(径路P2)、CPU2による消去及び書き込み制御プログラムの解読結果(CN1)にしたがってフラッシュメモリ13が消去され、RAM3上の書込みデータを用いてユーザブートマットUmat及びユーザマットMmatに対してユーザ制御プログラムの書込みが行われる(経路P3,P4)。   When the boot mode is instructed by the mode signal 14, in response to the signal Sig1, the flash control module 6 transfers the boot mat Tmat erase / write control program, serial communication control program, and the like to the RAM 3 (path P1). In accordance with the decoding result (CN2) of the serial communication control program by the CPU 2, write data is taken into the RAM 3 (path P2) from the on-board serial interface to the host device HST1, and the decoding result of the erase and write control program by the CPU 2 ( The flash memory 13 is erased according to CN1), and the user control program is written to the user boot mat Umat and the user mat Mmat using the write data on the RAM 3 (paths P3 and P4).

モード信号14にてユーザブートモードが指示されると、信号Sig2に応答してフラッシュコントロールモジュール6によりブートマットTmatからマット切換え制御プログラム等がRAM3に転送され(径路P1)、ユーザブートマットUmatに切換えられ、ユーザブートマットUmatの先頭ベクタをフェッチして実行する。書き込みを実施する時は、消去及び書き込みプログラムをブートマットTmatからRAM3にダウンロードする。ユーザブートマットUmatが保有するユーザインタフェース制御プログラムの解読結果(CN3)にしたがってホスト装置HST2にオンボードのユーザインタフェースから書き込みデータがRAM3に取り込まれ(径路P5)、CPU2による消去及び書き込み制御プログラムの解読結果(CN1)にしたがってフラッシュメモリ13が消去され、RAM3上の書込みデータを用いてユーザマットMmatに対してユーザ制御プログラムやユーザデータの書込みが行われる(経路P3,P4)。ユーザインタフェースは例えばその他にインタフェースコントローラ16により実現されるATAPI用インタフェースなどとされる。尚、ユーザブートマットUmatに格納されるユーザインタフェース制御プログラムはブートマットTmatに格納されたものと類似若しくは別のシリアルインタフェース制御プログラムであってもよい。   When the user boot mode is instructed by the mode signal 14, the mat control control program or the like is transferred from the boot mat Tmat to the RAM 3 by the flash control module 6 in response to the signal Sig2 (path P1) and switched to the user boot mat Umat. The first vector of the user boot mat Umat is fetched and executed. When writing is performed, an erase and write program is downloaded from the boot mat Tmat to the RAM 3. In accordance with the decoding result (CN3) of the user interface control program held by the user boot mat Umat, the write data is taken into the RAM 3 from the on-board user interface to the host device HST2 (path P5), and the erase and write control program by the CPU 2 is decoded. The flash memory 13 is erased according to the result (CN1), and the user control program and user data are written to the user mat Mmat using the write data on the RAM 3 (paths P3 and P4). The user interface is, for example, an ATAPI interface realized by the interface controller 16. Note that the user interface control program stored in the user boot mat Umat may be a serial interface control program similar to or different from that stored in the boot mat Tmat.

モード信号14にてユーザモードが指示されると、信号Sig3によりそれがフラッシュコントロールモジュール6に伝達され、書き込みを実施する時は、消去及び書き込みプログラムをブートマットTmatからRAM3にダウンロードする。ユーザマットMmatが保有するユーザインタフェース制御プログラムの解読結果(CN4)にしたがってホスト装置HST2にオンボードのユーザインタフェースから書き込みデータがRAM3に取り込まれ(径路P5)、CPU2による消去及び書き込み制御プログラムの解読結果(CN1)にしたがってフラッシュメモリ13が消去され、RAM3上の書込みデータを用いてユーザマットMmatに対してユーザ制御プログラムやユーザデータの書込みが行われる(経路P3,P4)。尚、ユーザマットMmatに格納されるユーザインタフェース制御プログラムはブートマットTmatに格納されたものと類似若しくは別のシリアルインタフェース制御プログラムであってもよい。   When the user mode is instructed by the mode signal 14, it is transmitted to the flash control module 6 by the signal Sig 3, and when performing writing, an erasing and writing program is downloaded from the boot mat Tmat to the RAM 3. In accordance with the decoding result (CN4) of the user interface control program held by the user mat Mmat, the write data is taken into the RAM 3 (path P5) from the on-board user interface to the host device HST2, and the decoding result of the erase and write control program by the CPU 2 The flash memory 13 is erased in accordance with (CN1), and the user control program and user data are written to the user mat Mmat using the write data on the RAM 3 (paths P3 and P4). The user interface control program stored in the user mat Mmat may be a serial interface control program similar to or different from that stored in the boot mat Tmat.

特に図示はしないが、マイクロコンピュータ1の比較例として、ユーザブートマットUmat及びユーザブートモードを備えていないマイクロコンピュータを想定する。この場合、ユーザブートマットUmatに格納したユーザインタフェースプログラムをユーザマットMmatに格納しておけば、前記マイクロコンピュータ1と同じように、ホスト装置HST2のオンボードのユーザインタフェースを介してプログラムやデータをユーザマットMmatに書込み又は書換えを行なうことができる。但し、マクロコンピュータ1もそうであるが、ユーザマットMmatに対しては自由な書換えが許容される関係上、ユーザマットMmatに格納されたユーザインタフェースプログラムは消去される虞がある。消去されたとき、ホスト装置HST2がブートモードで利用可能なシリアルインタフェースをオンボードで備えていなければ、その比較例に係るマイクロコンピュータは最早ホスト装置HST2とはオンボードで情報を入出力できなくなる。   Although not particularly illustrated, a microcomputer that does not include the user boot mat Umat and the user boot mode is assumed as a comparative example of the microcomputer 1. In this case, if the user interface program stored in the user boot mat Umat is stored in the user mat Mmat, the program and data can be transmitted to the user via the on-board user interface of the host device HST2 as in the microcomputer 1. The mat Mmat can be written or rewritten. However, as is the case with the macro computer 1, the user interface program stored in the user mat Mmat may be erased because the user mat Mmat can be freely rewritten. If the host device HST2 is not equipped with an on-board serial interface that can be used in the boot mode when erased, the microcomputer according to the comparative example can no longer input and output information to and from the host device HST2.

上記動作モードを有するマイクロコンピュータ1によれば、以下の作用効果を得ることができる。(1)ユーザ専用の通信プロトコルを格納可能なユーザブートマットUmatを用意したので、マイクロコンピュータ1が備える任意のインタフェースをフラッシュメモリ13の消去及び書込みに流用することができる。(2)フラッシュメモリ13の消去及び書き込みにユーザ任意のインターフェースを採用する事が可能となったことにより、ホスト装置HST2に必ずシリアルインターフェースを用意しなくてもよい。(3)ユーザブートマットUmatとユーザマットMmatを分けた事により、ユーザマットMmatに専用通信プロトコルを書かなくても、消去及び書き込み用にユーザ任意の書きこみインターフェースが実現できるから、ユーザマットMmatに格納して使用する制御プログラムの作成が容易になる。要するに、ユーザプログラムモードで使用する通信制御プログラムの消去防止などについて特別な考慮を払わなくてもよい。(4)ユーザブートマットUmatから立ち上がるユーザブートモードでは、ハードウェア的にユーザブートマットUmatを消去及び書込み不可にするので、暴走等でユーザブートマットUmatの記憶情報が破壊される事はなく、デバック時にCPU2が暴走しても、外部インターフェースを制御するプログラムの破壊には至らないので、実装したマイクロコンピュータチップを取り外さなくても、オンボードでユーザマットMmatの書換えを自由に行うことができる。   According to the microcomputer 1 having the above operation mode, the following operational effects can be obtained. (1) Since the user boot mat Umat capable of storing a user-specific communication protocol is prepared, any interface provided in the microcomputer 1 can be used for erasing and writing of the flash memory 13. (2) Since it is possible to employ any user interface for erasing and writing the flash memory 13, it is not necessary to provide a serial interface in the host device HST2. (3) Since the user boot mat Umat and the user mat Mmat are separated, an arbitrary writing interface for erasing and writing can be realized without writing a dedicated communication protocol in the user mat Mmat. It is easy to create a control program to be stored and used. In short, it is not necessary to pay special consideration to prevention of erasure of the communication control program used in the user program mode. (4) In the user boot mode that rises from the user boot mat Umat, the user boot mat Umat cannot be erased and written by hardware, so that the stored information of the user boot mat Umat is not destroyed due to runaway or the like. Even if the CPU 2 runs out of control sometimes, the program for controlling the external interface is not destroyed, so that the user mat Mmat can be freely rewritten on-board without removing the mounted microcomputer chip.

《消去及び書き込みのプロテクト》
図6にはフラッシュメモリ13の消去及び書き込みに対するプロテクトのための論理構成が例示される。同図の論理は正論理とされ、その構成はフラッシュコントロールモジュール6によって実現される。
《Erase and write protection》
FIG. 6 illustrates a logical configuration for protection against erasure and writing of the flash memory 13. The logic of the figure is positive logic, and the configuration is realized by the flash control module 6.

フラッシュメモリに対する消去及び書き込み動作は、書込み消去関係レジスタ群30Aの初期値に対して、処理に必要な制御データを設定することによって可能にされる。書込み消去関係レジスタ群30Aに対する制御データの設定は制御ビットSWEが論理値“1”で可能になる。要するに、制御ビットSWEが論理値“1”にされない限り、フラッシュメモリ13の消去及び書込みは不可能にされる。   Erase and write operations to the flash memory are made possible by setting control data necessary for processing with respect to the initial value of the write / erase related register group 30A. Setting of control data for the write / erase related register group 30A is enabled when the control bit SWE has a logical value "1". In short, unless the control bit SWE is set to the logical value “1”, erasing and writing of the flash memory 13 are disabled.

制御ビットSWEを論理値“1”にする第1の条件は外部端子PfweによりレジスタFCCSのイネーブルビットFWEを論理値“1”にセットすることである。   The first condition for setting the control bit SWE to the logical value “1” is to set the enable bit FWE of the register FCCS to the logical value “1” by the external terminal Pfwe.

第2の条件は、ナンドゲート40の出力を論理値“1”とする動作モードの選択状態とフラッシュメモリのマット選択状態を得ることである。即ち、動作モードがテストモード(TESTTM=1)、ライタモード(WRTM=1)、又はブートモード(BOOT=1)であること。或は、ユーザモード又はユーザブートモードにおいてユーザブートマットUmatが選択されていないこと(UMATSEL=0)である。尚、テストモードとはマイクロコンピュータの製造メーカがデバイステストに用いる動作モードであり、全ての動作が可能にされるが、ユーザには非公開な動作モード、即ち、ユーザによる設定が不可能な考慮が払われている。   The second condition is to obtain an operation mode selection state in which the output of the NAND gate 40 is a logical value “1” and a mat selection state of the flash memory. That is, the operation mode is a test mode (TESTTM = 1), a writer mode (WRTM = 1), or a boot mode (BOOT = 1). Alternatively, the user boot mat Umat is not selected in the user mode or the user boot mode (UMATSEL = 0). Note that the test mode is an operation mode used by the microcomputer manufacturer for the device test, and all operations are possible. However, the operation mode is not disclosed to the user, that is, cannot be set by the user. Has been paid.

前記信号UMATSELはレジスタFMATS及び当該レジスタFMATSの設定値に対するAA判定回路41の判定結果とされる。レジスタFMATSは、ユーザマットMmatとユーザブートマットUmatを切換えるときに使用する。このレジスタFMATSを使用することによって、CPU2のオペレーションをユーザマットMmatからユーザブートマットUmatへ遷移する事が可能になる。ただし、マットの切換えには制限事項がある。即ち、レジスタFMATSのユーザブートマット選択ビットをセットできる条件は、CPU2のオペレーションがRAM3のプログラムを実行していることである。この条件は、CPU2による命令フェッチのアドレスエリアがRAM3のアドレスエリアであることをBSC4が検出して判定する。レジスタFMATSの初期値はH’AA以外であり、ユーザマット選択状態を示す。H’AAによってユーザブートマット選択状態を示す。図7にはCPU2のオペレーション(OP)がユーザマットMmatとユーザブートマットUmatとの間で切換えられるときの状態遷移が示される。   The signal UMATSEL is a determination result of the AA determination circuit 41 with respect to the register FMATS and the set value of the register FMATS. The register FMATS is used when switching between the user mat Mmat and the user boot mat Umat. By using the register FMATS, the operation of the CPU 2 can be changed from the user mat Mmat to the user boot mat Umat. However, there are restrictions on mat switching. That is, the condition for setting the user boot mat selection bit of the register FMATS is that the operation of the CPU 2 is executing the program of the RAM 3. This condition is determined by the BSC 4 detecting that the address area of the instruction fetch by the CPU 2 is the address area of the RAM 3. The initial value of the register FMATS is other than H'AA and indicates the user mat selection state. The user boot mat selection state is indicated by H'AA. FIG. 7 shows a state transition when the operation (OP) of the CPU 2 is switched between the user mat Mmat and the user boot mat Umat.

この第2の条件により、ユーザブートマットUmatのアクセスは、どのモードでも可能であるが、書き込み/消去は、ライターモードとブートモード(及びテストモード)のみ可能になる。   According to the second condition, the user boot mat Umat can be accessed in any mode, but writing / erasing can be performed only in the writer mode and the boot mode (and the test mode).

第3の条件はレジスタFKEYが消去及び書き込み許容値に設定されていることである。前記レジスタFKEYは、電圧降下やノイズ等が原因で、プログラムが暴走し、それによるプログラムの破壊を防ぐために設けられている。消去及び書込み制御プログラム(書き込み/消去プログラム)が転送された後にプログラムが暴走した場合を考慮してレジスタFKEYを使用する。基本的には、端子Pfweと制御ビットSWEにより、CPU2が暴走しても、書き込み/消去が実施されないようになっているが、さらに信頼性を上げる為にユーザは、書き込み/消去を実施する前に、レジスタFKEYに“5A”の値をセットする。この“5A”をストアしてない時は、FWEがイネーブル(“1”)になっていたとしても、制御ビットSWEをセットする事ができないようになる。レジスタFKEYに“5A”がストアされている状態は、A5,5A判定回路42で検出され、信号fwemkp=1にされ、これによって、SWEが論理値“1”にセット可能にされる。   The third condition is that the register FKEY is set to an erasing and writing allowable value. The register FKEY is provided in order to prevent the program from running out of control due to a voltage drop, noise, or the like, and thereby destroying the program. The register FKEY is used in consideration of a case where the program runs away after the erase and write control program (write / erase program) is transferred. Basically, the terminal Pfwe and the control bit SWE prevent the writing / erasing even if the CPU 2 runs out of control. However, in order to further improve the reliability, the user must perform the writing / erasing. Then, a value of “5A” is set in the register FKEY. When this “5A” is not stored, the control bit SWE cannot be set even if the FWE is enabled (“1”). The state in which “5A” is stored in the register FKEY is detected by the A5, 5A determination circuit 42, and the signal fwemkp = 1 is set, so that the SWE can be set to the logical value “1”.

前記レジスタFKEYは上述の書き込み/消去プログラム関係として機能される他に、プログラム転送関係として機能される。即ち、フラッシュッメモリの消去及び書き込み制御プログラムをブートマットTmatに格納し、ブートモードの他に、ユーザブートモード及びユーザモードで利用可能にする関係上、ブートマットTmatの当該消去及び書き込み制御プログラムをRAM3に転送させるため、レジスタFCCSに制御ビットSCOを設け、制御ビットSCOをイネーブルすると、自動的にユーザマットMmatとブートマットTmatが切り替えれ、ブートマットTmatから消去及び書込み制御プログラムがRAM3に転送され、処理終了後にリターン命令が実行されてユーザの処理へ復帰するようになっている。このとき、ユーザが書き込み/消去を実施したくない所で、プログラムが暴走し、書き込み/消去プログラムが転送されると、ユーザプログラムを破壊する可能性が高くなる。これを回避するために、レジスタFKEYを使用する。ユーザは、制御ビットSCOをセットする前に、このレジスタFKEYに“A5”をストアする。この“A5”をストアしてない時は、制御ビットSCOをセットする事はできない。また、CPU2がRAM3上のプログラムをオペレーションしていることも条件にされる。“A5”がストアされ、RAM3上でCPU2のオペレーションが行われている時は、SCOビットがセット可能となり、消去及び書き込み制御プログラムをブートマットTmatからRAM3へ転送することが許容される。   The register FKEY functions as a program transfer relationship in addition to functioning as the above-described write / erase program relationship. In other words, the flash memory erase and write control program is stored in the boot mat Tmat, and the boot mat Tmat can be used in the user boot mode and the user mode in addition to the boot mode. When the control bit SCO is enabled in the register FCCS for transfer to the RAM 3, and the control bit SCO is enabled, the user mat Mmat and the boot mat Tmat are automatically switched, and the erase and write control program is transferred from the boot mat Tmat to the RAM 3. A return instruction is executed after the process is completed, and the process returns to the user process. At this time, if the program runs away in a place where the user does not want to perform writing / erasing and the writing / erasing program is transferred, there is a high possibility that the user program is destroyed. To avoid this, the register FKEY is used. The user stores “A5” in this register FKEY before setting the control bit SCO. When this “A5” is not stored, the control bit SCO cannot be set. The CPU 2 is also required to operate a program on the RAM 3. When “A5” is stored and the CPU 2 is operating on the RAM 3, the SCO bit can be set, and the erase and write control program is allowed to be transferred from the boot mat Tmat to the RAM 3.

上述のように、フラッシュメモリ13に対する消去及び書込みに関しては、レジスタFKEYでプログラムの転送と消去書き込みを排他制御しているので、プログラムが転送されない状態で暴走した場合は、書き込み/消去が実行され難い。   As described above, with regard to erasing and writing with respect to the flash memory 13, since the program transfer and erasure writing are exclusively controlled by the register FKEY, it is difficult to execute writing / erasing if the program runs away without being transferred. .

《プログラムモード判定処理》
ここで、前記各動作モードにおける処理の詳細を説明する。図8にはプログラムモード判定処理のフローチャート13が例示される。SCOモードとはユーザモードにおいてフラッシュメモリを消去及び書込みするときの動作モードを意味する。ブートモード、ライタモード、ユーザブートモード、ユーザモードは夫々対応するモード端子をセットしてリセット解除すればよい。SCOモードは、ユーザモード中において制御ビットSCOに論理値“1”をセットして設定される。設定された動作モードに応じてモード判定レジスタにモード情報がセットされる。
<Program mode judgment processing>
Here, details of the processing in each of the operation modes will be described. FIG. 8 illustrates a flowchart 13 of the program mode determination process. The SCO mode means an operation mode when the flash memory is erased and written in the user mode. The boot mode, writer mode, user boot mode, and user mode may be canceled by setting the corresponding mode terminal. The SCO mode is set by setting the logical value “1” to the control bit SCO during the user mode. Mode information is set in the mode determination register according to the set operation mode.

動作モードが設定されると、CPU2はブートマット内のプログラムを実行する(ブートマット内OP)。ブートモード、ライタモード、ユーザブートモードはブートマット内の先頭アドレスからベクタをフェッチしてプログラム実行を開始する(S1)が、SCOモードの場合にはブートマット内の先頭以外の所定番地、例えば優先度の最も高い例外処理であるユーザブレーク番地から処理を開始する。   When the operation mode is set, the CPU 2 executes a program in the boot mat (OP in the boot mat). In boot mode, writer mode, and user boot mode, a vector is fetched from the top address in the boot mat and program execution is started (S1). In the SCO mode, a predetermined address other than the top in the boot mat, for example, priority is given. The processing is started from the user break address which is the exception processing with the highest frequency.

処理開始すると、モード判定用レジスタをリードし(S2)、その内容を判定し、消去及び書込み制御プログラムの転送など、必要な前処理を行なって(S2〜S5)、対応する処理に進む(S6〜S9)。尚、フローチャートの各処理欄に示される“user”はその処理がユーザにより定義されたプログラムに基づいて行われる処理であることを意味し、処理欄に示される“boot”はその処理がブートマットTmatのプログラムに基づいて行われる処理であることを意味する。   When the processing starts, the mode determination register is read (S2), the contents thereof are determined, and necessary preprocessing such as erasure and transfer of the write control program is performed (S2 to S5), and the process proceeds to the corresponding processing (S6). To S9). Note that “user” shown in each processing column of the flowchart means that the processing is performed based on a program defined by the user, and “boot” shown in the processing column indicates that the processing is a boot mat. This means that the process is performed based on the Tmat program.

《ライタモード処理》
図9にはライタモード処理のフローチャートが例示される。ライタモードが設定されたときは、図8に示されるようにライタモード制御プログラムがRAM3に転送されている。先ず、ライタモードにおいて消去及び書込みに利用されるコマンド・データレジスタ(CDL)、フラグレジスタ(FLG)がクリアされ、コマンドフラグ(CDF)に“1”がセットされ(S11)、電源が落ちまで、フラグレジスタ(FLG)及びコマンドフラグ(CDF)の状態を参照しながら、EPROMライタからコマンド・データレジスタ(CDL)にセットされるコマンド及び書込みデータにしたがって、ユーザマットMmat及びユーザブートマットUmatに対する消去(S14,S15)及び書込み(S12,S13)が行われる。ライトモード処理はRAM3内オペレーションとされる。
<Writer mode processing>
FIG. 9 illustrates a flowchart of the writer mode process. When the writer mode is set, the writer mode control program is transferred to the RAM 3 as shown in FIG. First, the command / data register (CDL) and flag register (FLG) used for erasing and writing in the writer mode are cleared, the command flag (CDF) is set to “1” (S11), and the power is turned off. While referring to the states of the flag register (FLG) and the command flag (CDF), the user mat Mmat and the user boot mat Umat are erased according to the command and write data set from the EPROM writer to the command data register (CDL) ( S14, S15) and writing (S12, S13) are performed. The write mode process is an operation in the RAM 3.

《ブートモード処理》
図10にはブートモード処理のフローチャートが例示される。先ず、オンボードのシリアルインタフェースとSCI12との送受信を確立し(S20)、マイクロコンピュータ1の発振周波数等の必要なパラメータをダウンロードして設定する(S21)。次いで、ホスト装置からのコマンドを判定し、マイクロコンピュータの製品名や消去ブロック数などのステータスをホスト装置に返し(S22)、コマンド判定プログラムと消去プログラムをRAM3に転送して(SCOモードを利用することも可能)、RAM3上でのオペレーションに遷移する(S23)。そして、ユーザマットMmat及びユーザブートマットUmatを全面消去した(S24)後、コマンドに応答しながら、ユーザマット書込み処理(S25)、ユーザブートマット書込み処理(S26)、書込みベリファイ処理(S27,S28)等を行なう。
《Boot mode processing》
FIG. 10 illustrates a flowchart of boot mode processing. First, transmission / reception between the on-board serial interface and the SCI 12 is established (S20), and necessary parameters such as the oscillation frequency of the microcomputer 1 are downloaded and set (S21). Next, a command from the host device is determined, a status such as a microcomputer product name and the number of erase blocks is returned to the host device (S22), and a command determination program and an erase program are transferred to the RAM 3 (using the SCO mode). It is also possible to make a transition to the operation on the RAM 3 (S23). Then, after the user mat Mmat and the user boot mat Umat are completely erased (S24), the user mat write process (S25), the user boot mat write process (S26), and the write verify process (S27, S28) while responding to the command. Etc.

《ユーザブートモード処理》
図11にはユーザブートモード処理のフローチャートが例示される。ユーザブートモードでは、特に制限されないが、ブートマットTmatの先頭ベクタからオペレーションを開始し、ユーザブートマットUmatへの切換えプログラムをブートマットTmatからRAM3に転送し(S30)、RAM3上でのオペレーションに遷移し(S31)、レジスタFMATSにH’AAをセットして、レジスタFMATSによるユーザマット指示状態(初期値)をユーザブートマットに切換える(S32)。ここで、ユーザブートマットUmatのエリア設定に誤りが有るかを判定し(S33,S34)誤りが無ければユーザブートマットUmatの先頭ベクタアドレスをリードし(S35)、リードしたベクタアドレスにサブルーチンジャンプする(S36)。CPU2はユーザブートマットUmat上のプログラムを実行し、先ず、ユーザ定義の通信を確立し、書込みに必要なユーザプログラムをRAM3に転送する(S37)。CPU2はRAM3上のプログラム実行に遷移し(S38)、再度レジスタFMATSの操作を行なって、処理対象マットをユーザブートマットUmatからユーザマットMmatに切換える(S39)。そして、RAM3上のユーザプログラムを実行して制御ビットSCOを“1”にセットし(S40)、SCOモード処理に遷移して、ブートマットTmat内の消去及び書き込み制御プログラムをRAM3に転送させ(S41)、転送された消去及び書き込み制御プログラムを用いた書込み/消去の処理が行なわれる(S42)。
<< User boot mode processing >>
FIG. 11 illustrates a flowchart of user boot mode processing. In the user boot mode, although not particularly limited, the operation is started from the top vector of the boot mat Tmat, the program for switching to the user boot mat Umat is transferred from the boot mat Tmat to the RAM 3 (S30), and the operation shifts to the operation on the RAM 3. Then, H'AA is set in the register FMATS, and the user mat instruction state (initial value) by the register FMATS is switched to the user boot mat (S32). Here, it is determined whether there is an error in the area setting of the user boot mat Umat (S33, S34). If there is no error, the head vector address of the user boot mat Umat is read (S35), and a subroutine jump is made to the read vector address. (S36). The CPU 2 executes a program on the user boot mat Umat, first establishes user-defined communication, and transfers a user program necessary for writing to the RAM 3 (S37). The CPU 2 transitions to program execution on the RAM 3 (S38), operates the register FMATS again, and switches the processing target mat from the user boot mat Umat to the user mat Mmat (S39). Then, the user program on the RAM 3 is executed and the control bit SCO is set to “1” (S40), and the process shifts to the SCO mode process to transfer the erase and write control program in the boot mat Tmat to the RAM 3 (S41). ), A write / erase process using the transferred erase and write control program is performed (S42).

《ユーザモード処理》
図12にはユーザモード処理のフローチャートが例示される。ユーザモードが指定されると、ユーザマットMmatの先頭からベクタフェッチが行なわれて(S50)、ユーザの制御プログラムが実行される(S51)。ユーザプログラムの実行中にユーザマットMmatへの書込みが必要になると、RAM3上でオペレーションを行なってSCOビットを“1”にセットし(S52)、SCOモード処理に遷移して、ブートマット内の消去及び書き込み制御プログラムをRAM3に転送させ(S53)、転送された消去及び書き込み制御プログラムを用いた書込み/消去の処理が行なわれる(S54)。
《User mode processing》
FIG. 12 illustrates a flowchart of user mode processing. When the user mode is designated, vector fetch is performed from the top of the user mat Mmat (S50), and the user control program is executed (S51). If writing to the user mat Mmat becomes necessary during the execution of the user program, an operation is performed on the RAM 3 to set the SCO bit to “1” (S52), transition to the SCO mode processing, and deletion in the boot mat. Then, the write control program is transferred to the RAM 3 (S53), and write / erase processing using the transferred erase and write control program is performed (S54).

《書き込み/消去処理》
図13には前記ステップS42,S54の書き込み/消去処理のフローチャートが例示される。ステップS60〜S63までが書き込み/消去の初期化処理である。ここでは、消去及び書き込み制御プログラムはマイクロコンピュータ1の製造メーカにより予めブートマットTmatに保持されている。要する、そのプログラムはユーザ固有の条件について規定しない。例えば消去電圧パルスや書き込み電圧パルスの印加時間はフラッシュッメモリセルの特性に応じて決まるが、そのパルス印加時間はマイクロコンピュータ1の動作クロック信号で制御する必要があり、其のために必要な動作周波数のデータが制御レジスタFPEFEQに設定される(S60)。制御レジスタFPEFEQは、特に制限されないが、CPU2の汎用レジスタR4が割当てられる。
<Write / Erase Processing>
FIG. 13 illustrates a flowchart of the write / erase process in steps S42 and S54. Steps S60 to S63 are write / erase initialization processes. Here, the erase and write control program is held in the boot mat Tmat in advance by the manufacturer of the microcomputer 1. In short, the program does not specify user-specific conditions. For example, the application time of the erase voltage pulse and the write voltage pulse is determined according to the characteristics of the flash memory cell, and the pulse application time must be controlled by the operation clock signal of the microcomputer 1, and the operation necessary for that. The frequency data is set in the control register FPEFEQ (S60). The control register FPEFEQ is not particularly limited, but the general-purpose register R4 of the CPU 2 is assigned.

消去電圧パルスや書き込み電圧パルス及びベリファイ動作のサイクル中にユーザの処理が完全に断たれる不都合を解消するためのユーザブランチ処理(詳細は後述)のための分岐先処理のアドレスをレジスタFUBRAに設定する(S61)。   The address of the branch destination process for the user branch process (details will be described later) is set in the register FUBRA in order to eliminate the inconvenience that the user process is completely interrupted during the erase voltage pulse, the write voltage pulse, and the verify operation cycle. (S61).

この後、初期化プログラム領域にサブルーチンジャンプし(S62)、初期化プログラムを実行し(S64)、上記周波数やユーザブランチアドレスといった初期設定の内容にしたがって、消去及び書き込みのためのパラメータが消去及び書込み制御プログラム上に自動的に設定される。   Thereafter, the subroutine jumps to the initialization program area (S62), the initialization program is executed (S64), and the parameters for erasing and writing are erased and written according to the initial setting contents such as the frequency and the user branch address. It is automatically set on the control program.

次に、消去及び書き込みのハードプロテクトを解除するために、端子Pfweを介して制御ビットFWEを論理値“1”にセットしてハードプロテクトを解除し、ユーザプログラムの実行に遷移する(S64)。このオペレーション状態で、書込みデータを用意し(S65)、ユーザが実施したい書き込み/消去を実行する(S66)。ステップS65,S66の処理はユーザが目的とする処理が終了されるまで繰返される。   Next, in order to cancel the hard protection of erasure and writing, the control bit FWE is set to the logical value “1” via the terminal Pfwe to cancel the hard protection, and the process proceeds to the execution of the user program (S64). In this operation state, write data is prepared (S65), and write / erase to be performed by the user is executed (S66). The processes in steps S65 and S66 are repeated until the process intended by the user is completed.

《ユーザブランチ》
図13の書き込み消去処理を更に詳述しながらユーザブランチ処理について説明する。
<< User branch >>
The user branch process will be described with further details of the write / erase process of FIG.

図14は図13の書き込み処理に着目した概略フローチャートである。書き込み処理は、ブートマットTmatからソースコード(消去及び書き込み制御プログラム等)をRAM3に転送する処理(T1)、書き込み初期化の実行(T2)、及び書き込み実行(T3)に大別される。   FIG. 14 is a schematic flowchart focusing on the writing process of FIG. The write process is roughly divided into a process (T1) for transferring a source code (such as an erase and write control program) from the boot mat Tmat to the RAM 3, a write initialization execution (T2), and a write execution (T3).

転送処理(T1)は、転送を実施したいプログラムを選択し、レジスタFKEYをセットし制御ビットSCOをイネーブルにする。これを実施する事によって、ブートマットから自動的に転送プログラムがスタートする。プログラムは、RAM3のスタートアドレスから必要な領域だけプログラムが転送される。この時に初期化プログラムも転送される。   In the transfer process (T1), a program to be transferred is selected, the register FKEY is set, and the control bit SCO is enabled. By executing this, the transfer program starts automatically from the boot mat. The program is transferred from the start address of the RAM 3 only in a necessary area. At this time, the initialization program is also transferred.

初期化の実行(T2)では、初期化プログラムが実行され、転送されたプログラムに対し、動作周波数に依存するウェイトタイムループ回数の設定やユーザブランチアドレスが設定される。   In the initialization execution (T2), the initialization program is executed, and the setting of the number of wait time loops depending on the operating frequency and the user branch address are set for the transferred program.

書き込み実行(T3)では、書き込みを実施する前に、どの様な方式でも良いが、書き込みデータをRAM3上に転送する。このときには、ある決まった順序でデータを並べる必要がある。転送領域は、ユーザが任意に設定する事が可能で、必要な手続きを実施し、転送を実施した後、プログラムのある決まった番地にサブルーチンジャンプを実施する。このサブルーチンジャンプを実施する事で書き込みが実行される。   In the write execution (T3), any method may be used before writing, but write data is transferred onto the RAM 3. At this time, it is necessary to arrange the data in a certain order. The transfer area can be arbitrarily set by the user, and after executing necessary procedures and executing the transfer, a subroutine jump is executed at a predetermined address in the program. Writing is executed by executing this subroutine jump.

図15にはRAM3への転送処理(T1)の詳細が例示される。先ずレジスタFKEYを“A5”に設定し(T10)、転送したいソースコードを選択する(T11)。ソースコードの選択は、書き込み消去関係レジスタ30Aに対して行われる。選択可能なソースコードは、特に制限されないが、書き込み及び書き込みベリファイプログラム、消去及び消去ベリファイプログラム等である。そして制御ビットSCOが“1”にセットされて、選択されたソースコードがRAM3の所定エリアに転送される(T12)。制御ビットSCOのイネーブルを実施する時は、CPU2はフラッシュッメモリ13の外でオペレーションを実施している必要がある。これは、オペレーション可能なマットがユーザマットMmatからブートマットTmatに変化してしまうためにプログラムが暴走するからである。制御ビットSCOのイネーブルを実施したら、自動的にブートマットTmatからプログラムがスタートする。このブートプログラムは、汎用レジスタの値をソフトウェア処理でスタックに退避する。ユーザの処理に戻るときは、リターン命令でユーザの処理に復帰する。この復帰を実施する前にブートマットTmat内の転送プログラムは、退避を実施した汎用レジスタの値を復帰する。最後に転送が正常に終了したかの判別が行われる(T13)。   FIG. 15 illustrates details of the transfer process (T1) to the RAM 3. First, the register FKEY is set to “A5” (T10), and the source code to be transferred is selected (T11). The source code is selected for the write / erase related register 30A. The selectable source code is not particularly limited, but includes a write and write verify program, an erase and erase verify program, and the like. Then, the control bit SCO is set to “1”, and the selected source code is transferred to a predetermined area of the RAM 3 (T12). When the control bit SCO is enabled, the CPU 2 needs to perform an operation outside the flash memory 13. This is because the program runs out of control because the operable mat changes from the user mat Mmat to the boot mat Tmat. When the control bit SCO is enabled, the program automatically starts from the boot mat Tmat. This boot program saves the value of the general-purpose register to the stack by software processing. When returning to the user process, the process returns to the user process by a return instruction. Before carrying out this restoration, the transfer program in the boot mat Tmat restores the value of the general-purpose register that has been saved. Finally, it is determined whether the transfer has been completed normally (T13).

図16には書き込み初期化処理(T2)の詳細が例示される。先ずレジスタFPEFEQ(R4)にマイクロコンピュータ1の動作周波数がセットされ(T20)、レジスタFUBRAにユーザブランチアドレスがセットされる。レジスタFUBRAにはCPU2の汎用レジスタR5が割当てられる。其の後、書き込み初期化プログラムが実行される(T22)。例えば、書き込み関係の初期化プログラムは、設定されたチップ動作周波数の値を参照し、ウェイトタイムループ回数を決定する。決定したウェイトタイム時間をRAM3上に転送された書き込み制御プログラムに埋め込む処理を行なう。また、書き込み初期化プログラムは、レジスタFUBRA(R5)の値を参照して、ユーザブランチを実施するか、実施した場合に何処のアドレスにジャンプするかの書き込みプログラム変更を実施する。要するに、ユーザブランチを実施するサブルーチンジャンプ命令に、レジスタFUBRA(R5)の値が、分岐先アドレスとして埋め込まれる。最後に、初期化処理が正常に終了したことを判別して(T23)、処理を終了する。   FIG. 16 illustrates details of the write initialization process (T2). First, the operating frequency of the microcomputer 1 is set in the register FPEFEQ (R4) (T20), and the user branch address is set in the register FUBRA. A general-purpose register R5 of the CPU 2 is assigned to the register FUBRA. Thereafter, the write initialization program is executed (T22). For example, the write-related initialization program determines the number of wait time loops with reference to the set chip operating frequency value. Processing for embedding the determined wait time in the write control program transferred to the RAM 3 is performed. Further, the write initialization program refers to the value of the register FUBRA (R5), and executes the user branch or changes the write program to which address to jump to when executed. In short, the value of the register FUBRA (R5) is embedded as a branch destination address in a subroutine jump instruction for executing a user branch. Finally, it is determined that the initialization process has ended normally (T23), and the process ends.

ここで、前記レジスタFUBRAは書き込み/消去途中でのユーザブランチアドレスを指定するレジスタであり、このエリアは汎用レジスタR5に存在する。ユーザブランチを実施したくない時は、このレジスタにH’00000000をセットする。ユーザブランチにより誤動作を生じないようにするために、フラッシュメモリエリアで書き込み/消去途中のエリアに関してはユーザブランチを禁止し、内蔵RAMの内、書き込み/消去プログラムが転送された領域へのユーザブランチを禁止し、プログラムデータの書き換えを禁止し、ユーザブランチを実施した先で、SCOモードの実行や書き込み/消去ルーチン、書き込み/消去初期化ルーチンをコールすることを禁止することが望ましい。   Here, the register FUBRA is a register for designating a user branch address during writing / erasing, and this area exists in the general-purpose register R5. When it is not desired to execute the user branch, H'00000000 is set in this register. In order not to cause a malfunction due to the user branch, the user branch is prohibited for the area in the flash memory area that is in the middle of writing / erasing, and the user branch to the area of the built-in RAM to which the writing / erasing program is transferred. It is desirable to prohibit the program data from being rewritten and to prohibit the execution of the SCO mode, the write / erase routine, and the write / erase initialization routine after the user branch is executed.

図18には図16の書き込み初期化時における内蔵RAM3、書き込みプログラム、初期化処理、レジスタR4,R5との間のデータ接続関係が示される。同図により、初期化プログラムは、レジスタR4,R5を参照し、参照結果を書き込みプログラムのユーザブランチ処理に反映し、ウェイト関係パラメータに反映することが明瞭である。   FIG. 18 shows the data connection relationship between the built-in RAM 3, the write program, the initialization process, and the registers R4 and R5 at the time of write initialization in FIG. From the figure, it is clear that the initialization program refers to the registers R4 and R5, reflects the reference result in the user branch processing of the writing program, and reflects it in the weight related parameters.

図17には書き込み実行(T3)の詳細が例示される。先ず、マスク不可能な割込み(NMI)を受け付けたときの分岐先をRAM3アドレスエリアに変更する(T30)。例えばベクタベースレジスタをRAM3のアドレスエリアに設定変更すればよい。これは、書き込み途上のフラッシュメモリエリアを避けることが誤動作防止の点より望ましいからである。そのようなNMIはユーザ定義のエラー処理ルーチンをコールするために利用すればよい。そして、NMIよりも割込み優先レベルの低い割込みをマスクする(T31)。例えばステータスレジスタSRに割込みマスクデータIMSKのNMIの次に低い割込み優先レベルを設定すればよい。これは、書き込み/消去中は、状態によってフラッシュメモリに高電圧が掛かっている。この状態でIRQ等の割り込みが入ったとしても、フラッシュメモリのベクターを読める事は保証できない。よって、書き込み/消去中は、NMI以外の割り込みは禁止にする。   FIG. 17 illustrates details of the write execution (T3). First, the branch destination when an unmaskable interrupt (NMI) is received is changed to the RAM3 address area (T30). For example, the vector base register may be changed to the address area of the RAM 3. This is because it is preferable from the viewpoint of preventing malfunction to avoid the flash memory area in the middle of writing. Such an NMI may be used to call a user-defined error handling routine. Then, an interrupt having an interrupt priority level lower than that of NMI is masked (T31). For example, the next lowest interrupt priority level after the NMI of the interrupt mask data IMSK may be set in the status register SR. This is because a high voltage is applied to the flash memory depending on the state during writing / erasing. Even if an interrupt such as IRQ enters in this state, it cannot be guaranteed that the vector of the flash memory can be read. Therefore, interrupts other than NMI are prohibited during writing / erasing.

そして、書き込みアドレスの設定エリアを汎用レジスタR5にセットする(T32)。すなわち、内蔵RAM3に書かれている書き込みアドレスエリアの先頭アドレスを汎用レジスタR5にセットする。そして、書き込みデータアドレスの設定エリアを汎用レジスタR4にセットする(T33)。即ち、内蔵RAM3に書かれている書き込みデータアドレスエリアの先頭アドレスを汎用レジスタR4にセットする。其の後、レジスタFKEYに書き込み/消去コード“5A”をセットし(T34)、書き込みプログラムにジャンプして実行する(T35)。最後に書き込みが正常に終了したかを判別する(T36)。   Then, the setting area for the write address is set in the general-purpose register R5 (T32). That is, the head address of the write address area written in the built-in RAM 3 is set in the general-purpose register R5. Then, the setting area for the write data address is set in the general-purpose register R4 (T33). That is, the head address of the write data address area written in the built-in RAM 3 is set in the general-purpose register R4. Thereafter, the write / erase code “5A” is set in the register FKEY (T34), and the program jumps to the write program and executed (T35). Finally, it is determined whether the writing has been normally completed (T36).

図19には書き込み時におけるRAM3、汎用レジスタR4,R5、書き込みプログラムとの間のデータ接続関係が例示される。ここではデュアルバンク書込みを想定しているから、書込みアドレスエリアの先頭アドレスと書込みデータアドレスエリアの先頭アドレスとを夫々のバンク毎に参照できなければならないため、RAMエリアFMPDR0,FMPDR1をレジスタR4で、RAMエリアFMPAR0,FMPAR1をレジスタR5で参照可能にしている。   FIG. 19 illustrates a data connection relationship between the RAM 3, the general-purpose registers R4 and R5, and the writing program at the time of writing. Here, since dual bank writing is assumed, it is necessary to be able to refer to the start address of the write address area and the start address of the write data address area for each bank. Therefore, the RAM areas FMPDR0 and FMPDR1 are registered in the register R4. The RAM areas FMPAR0 and FMPAR1 can be referred to by the register R5.

図20には図17のステップT35に対応する書込みプログラムの処理フローが例示される。この処理フローは、書込みデータラッチ(T40)、書込みパルスの印加(T41)、書込みベリファイ(T42)の処理サイクル中に、ユーザブランチアドレスにサブルーチンジャンプするかを判定するステップ(T43)を有し、初期化処理による設定値にしたがって、サブルーチンジャンプの指示がされている場合(ユーザブランチアドレスがH’00000000以外のとき)には、ユーザブランチアドレスに分岐して、サブルーチンを実行する(T44)。実行後に再び書き込み動作ルーチンに戻ってくる。書込みベリファイで所定の閾値状態を得られないときは、パルス印加回数Nをインクリメントして再度同じループを繰返し(T45)、くり返し回数が最大回数(WMAX)に達する前に書込み正常状態を得られれば其の時点で図17のフローに戻り(T46)、最大回数に達しても正常終了できないときは書込みエラー処理を行なって(T47)、図17のフローに戻る。   FIG. 20 illustrates a processing flow of the writing program corresponding to step T35 of FIG. This processing flow includes a step (T43) of determining whether to jump to a user branch address during a processing cycle of a write data latch (T40), a write pulse application (T41), and a write verify (T42). If a subroutine jump instruction is given according to the set value by the initialization process (when the user branch address is other than H'00000000), the process branches to the user branch address and executes the subroutine (T44). After execution, the program returns to the write operation routine. If the predetermined threshold state cannot be obtained by the write verify, the pulse application count N is incremented and the same loop is repeated again (T45), and the normal write state can be obtained before the repeat count reaches the maximum number (WMAX). At that time, the flow returns to the flow of FIG. 17 (T46). If the normal end cannot be completed even when the maximum number of times is reached, a write error process is performed (T47), and the flow returns to the flow of FIG.

このように、書込みパルス印可と書込みベリファイのサイクル中に、ユーザブランチアドレスで示されたサブルーチン処理に分岐可能であれば、書き込み中であっても、ユーザの制御プログラムに、ある一定間隔で制御を戻すことができる。しかも、ソフトウェアで実施しているので、ユーザの制御に戻ってくる間隔をソフトウェアで変更することも可能である。書き込み中でも、ユーザ制御プログラムに一定間隔で戻ってくることにより、このマクロコンピュータ1を使用したシステムを長い時間停止させなくても、消去及び書き込みが実施可能になる。したがって、一定期間毎に内外の事象を確認する必要のあるシステム、或は学習機能付きのシステム等に対して、ユーザのプログラム実行中に消去及び書込みを実行していくことが可能である。   In this way, if it is possible to branch to the subroutine processing indicated by the user branch address during the write pulse application and write verify cycles, the user control program is controlled at a certain interval even during writing. Can be returned. In addition, since it is implemented by software, it is also possible to change the interval for returning to the user's control by software. Even during writing, by returning to the user control program at regular intervals, erasing and writing can be performed without stopping the system using the macro computer 1 for a long time. Therefore, it is possible to execute erasure and writing during the execution of the user's program for a system that needs to confirm internal and external events at regular intervals, or a system with a learning function.

図21は図13の消去処理に着目した概略フローチャートである。消去処理は、ブートマットからソースコード(消去及び書き込み制御プログラム等)をRAM3に転送する処理(T5)、消去初期化の実行(T6)、及び消去実行(T7)に大別される。   FIG. 21 is a schematic flowchart focusing on the erasing process of FIG. The erasure process is roughly divided into a process (T5) for transferring a source code (such as an erasure and write control program) from the boot mat to the RAM 3, an erasure initialization execution (T6), and an erasure execution (T7).

転送処理(T5)は前記転送処理(T1)と同じである。初期化の実行(T6)では、転送されたプログラムに関して、動作周波数に依存するウェイトタイムループ回数の設定やユーザブランチの設定の為に、初期化プログラムを実行する。   The transfer process (T5) is the same as the transfer process (T1). In the initialization execution (T6), the initialization program is executed for setting the number of wait time loops depending on the operating frequency and setting the user branch for the transferred program.

消去実行(T7)では、RAM3に転送された消去プログラムのある決まった番地にジャンプサブルーチンを実施する事で消去を実行する。   In the erasure execution (T7), erasure is executed by executing a jump subroutine at a predetermined address of the erasure program transferred to the RAM 3.

図22には消去初期化処理(T6)の詳細が例示される。先ずレジスタFPEFEQ(R4)にマイクロコンピュータ1の動作周波数がセットされ(T60)、レジスタFUBRAにユーザブランチアドレスがセットされる(T61)。レジスタFUBRAにはCPU2の汎用レジスタR5が割当てられる。其の後、消去初期化プログラムが実行される(T62)。転送された時の消去プログラムは、ウェイトループ回数が初期設定状態になっている。この事から、この初期化プログラムを使用して、消去プログラムのウェイトループ回数を全て変更する。この計算を実施する為に、ユーザはレジスタFPEFEQ(R4)をセットする。レジスタFUBRA(R5)の設定では、消去プログラムのユーザブランチ設定を実施することになる。消去初期化プログラムは、レジスタFUBRAの設定値を参照して、ユーザブランチを実施するか、実施した場合に何処のアドレスにジャンプするかについて、消去プログラム変更を実施する。この変更を実施する為に、ユーザはレジスタFUBRAに値をセットする。最後に、初期化処理が正常終了したことを判別して(T63)、処理を終了する。   FIG. 22 illustrates details of the erase initialization process (T6). First, the operating frequency of the microcomputer 1 is set in the register FPEFEQ (R4) (T60), and the user branch address is set in the register FUBRA (T61). A general-purpose register R5 of the CPU 2 is assigned to the register FUBRA. Thereafter, an erase initialization program is executed (T62). In the erase program when transferred, the number of wait loops is in an initial setting state. For this reason, all the wait loop times of the erase program are changed by using this initialization program. To perform this calculation, the user sets register FPEFEQ (R4). In setting the register FUBRA (R5), the user branch of the erase program is set. The erase initialization program refers to the set value of the register FUBRA and changes the erase program regarding whether to execute the user branch or to which address to jump to when executed. To implement this change, the user sets a value in register FUBRA. Finally, it is determined that the initialization process has been completed normally (T63), and the process ends.

ここで、前記レジスタFUBRAの意義は書込みの場合と同じであり、ユーザブランチを実施したくない時は、このレジスタにH’00000000をセットする。   Here, the significance of the register FUBRA is the same as that in the case of writing, and H'00000000 is set in this register when the user branch is not desired to be executed.

図24には図22の消去初期化時における内蔵RAM3、消去プログラム、初期化処理、レジスタR4,R5との間のデータ接続関係が示される。同図により、初期化プログラムは、レジスタR4,R5を参照し、参照結果を書き込みプログラムのユーザブランチ処理に反映し、ウェイト関係パラメータに反映することが明らかである。   FIG. 24 shows the data connection relationship between the built-in RAM 3, the erase program, the initialization process, and the registers R4 and R5 at the time of the erase initialization shown in FIG. From the figure, it is clear that the initialization program refers to the registers R4 and R5, reflects the reference result in the user branch processing of the writing program, and reflects it in the weight related parameters.

図23には消去実行(T7)の詳細が例示される。先ず、マスク不可能な割込み(NMI)を受け付けたときの分岐先をRAM3アドレスエリアに変更する(T70)。例えばベクタベースレジスタをRAM3のアドレスエリアに設定変更すればよい。これは、消去途上のフラッシュメモリエリアを避けることが誤動作防止の点より望ましいからである。そのようなNMIはユーザ定義のエラー処理ルーチンをコールするために利用すればよい。そして、NMIよりも割込み優先レベルの低い割込みをマスクする(T71)。例えばステータスレジスタSRに割込みマスクデータIMSKのNMIの次に低い割込み優先レベルを設定すればよい。これは、消去中は、状態によってフラッシュメモリに高電圧が掛かっている。この状態でIRQ等の割り込みが入ったとしても、フラッシュメモリのベクターを読める事は保証できない。よって、消去中は、NMI以外の割り込みは禁止にする。   FIG. 23 illustrates details of the execution of erasure (T7). First, the branch destination when an unmaskable interrupt (NMI) is received is changed to the RAM3 address area (T70). For example, the vector base register may be changed to the address area of the RAM 3. This is because it is preferable from the viewpoint of preventing malfunction to avoid the flash memory area in the process of erasing. Such an NMI may be used to call a user-defined error handling routine. Then, an interrupt having an interrupt priority level lower than that of NMI is masked (T71). For example, the next lowest interrupt priority level after the NMI of the interrupt mask data IMSK may be set in the status register SR. This is because a high voltage is applied to the flash memory depending on the state during erasing. Even if an interrupt such as IRQ enters in this state, it cannot be guaranteed that the vector of the flash memory can be read. Therefore, interrupts other than NMI are prohibited during erasure.

そして、消去ブロック番号を汎用レジスタR4にセットする(T72)。其の後、レジスタFKEYに書き込み/消去コード“5A”をセットし(T73)、消去プログラムにジャンプして実行する(T74)。最後に消去正常終了を判別する(T75)。   Then, the erase block number is set in the general-purpose register R4 (T72). Thereafter, the write / erase code “5A” is set in the register FKEY (T73), and the program jumps to the erase program and executes (T74). Finally, the normal end of erasure is determined (T75).

図25には消去時におけるRAM3、汎用レジスタR4,R5、消去プログラムとの間のデータ接続関係が例示される。この接続関係は、ユーザが消去プログラムを作成しないので消去マット選択のインターフェース方法として、消去ブロック選択の受け渡しを、レジスタFEBS(R4)を介して消去ブロック番号を受け渡す事で実施する。   FIG. 25 illustrates a data connection relationship between the RAM 3, the general-purpose registers R4 and R5, and the erase program at the time of erasure. Since the user does not create an erase program, this connection relationship is implemented by passing an erase block number via the register FEBS (R4) as an erase mat selection interface method.

図26には図23のステップT74に対応する消去プログラムの処理フローが例示される。この処理フローは、消去データラッチ(T80)、消去パルスの印加(T81)、消去ベリファイ(T82)の処理サイクル中に、ユーザブランチアドレスにサブルーチンジャンプするかを判定するステップ(T83)を有し、初期化処理による設定値にしたがって、サブルーチンジャンプの指示がされている場合(ユーザブランチアドレスがH’00000000以外のとき)には、ユーザブランチアドレスに分岐して、サブルーチンを実行する(T84)。実行後に再び消去動作ルーチンに戻ってくる。消去ベリファイで所定の閾値状態を得られないときは、パルス印加回数Nをインクリメントして再度同じループを繰返し(T85)、くり返し回数が最大回数(EMAX)に達する前に消去正常状態を得られれば其の時点で図23のフローに戻り(T86)、最大回数に達しても正常終了できないときは消去エラー処理を行なって(T87)、図23のフローに戻る。   FIG. 26 illustrates a processing flow of the erase program corresponding to step T74 of FIG. This processing flow includes a step (T83) of determining whether to make a subroutine jump to the user branch address during the processing cycle of the erase data latch (T80), erase pulse application (T81), and erase verify (T82). If a subroutine jump instruction is given according to the set value by the initialization process (when the user branch address is other than H'00000000), the process branches to the user branch address and executes the subroutine (T84). After execution, the process returns to the erase operation routine. If the predetermined threshold state cannot be obtained by the erase verify, the pulse application count N is incremented and the same loop is repeated again (T85), and the normal erase state can be obtained before the repeat count reaches the maximum number (EMAX). At that time, the flow returns to the flow of FIG. 23 (T86). If the normal end cannot be completed even if the maximum number of times is reached, an erasure error process is performed (T87), and the flow returns to the flow of FIG.

このように、消去パルス印可と消去ベリファイのサイクル中に、ユーザブランチアドレスで示されたサブルーチン処理に分岐可能であれば、消去中であっても、ユーザの制御プログラムに、ある一定間隔で制御を戻すことができる。消去中でも、ユーザ制御プログラムに一定間隔で戻ってくることにより、このマクロコンピュータ1を使用したシステムを長い時間停止させなくても、消去が実施可能になる。したがって、一定期間毎に内外の事象を確認する必要のあるシステム、或は学習機能付きのシステム等に対して、ユーザのプログラム実行中に消去及び書込みを実行していくことが可能である。   In this way, if it is possible to branch to the subroutine processing indicated by the user branch address during the erase pulse application and erase verify cycle, the control program of the user is controlled at a certain interval even during the erase. Can be returned. Even during erasure, by returning to the user control program at regular intervals, erasure can be performed without stopping the system using the macro computer 1 for a long time. Therefore, it is possible to execute erasure and writing during the execution of the user's program for a system that needs to confirm internal and external events at regular intervals, or a system with a learning function.

《ユーザブランチ先でのプログラムの暴走》
書き込み/消去プログラムが転送された状態で、しかも端子Pfweがイネーブル状態(“1”)の場合は、フラッシュメモリ13が保有する記憶情報を如何なる場合にも正常に保持することを完全に保証する事は、困難である。図27にはユーザブランチ先でCPU2が暴走してフラッシュッメモリ13の記憶情報が破壊される事態を抑止可能にする書込み/消去処理の手法が例示される。即ち、書き込み/消去フロー中で各処理終了毎に実施する前記ステップT44,T84のユーザブランチ処理では、書込み消去の動作電源を初期化してリード動作の動作電源に遷移させ(T90)、その後、レジスタFKEYの値を、書込み/消去可能値“5A”以外の任意に値に変更する(T91)。例えば7X(X=0〜F)とする。これを実施することにより、制御ビットSWEのセットが不可になるので、ユーザブランチ先でCPUが暴走しても、簡単には書き込み/消去ができなくなる。
<< Program runaway at user branch destination >>
When the program / erase program is transferred and the terminal Pfwe is enabled (“1”), it is completely guaranteed that the storage information held in the flash memory 13 is normally held in any case. It is difficult. FIG. 27 exemplifies a write / erase processing technique that can prevent the CPU 2 from running away at the user branch destination and destroying the information stored in the flash memory 13. That is, in the user branch processing in steps T44 and T84 executed at the end of each process in the write / erase flow, the write / erase operation power supply is initialized and transitioned to the read operation power supply (T90), and then the register The value of FKEY is changed to any value other than the writable / erasable value “5A” (T91). For example, 7X (X = 0 to F) is set. By implementing this, the control bit SWE cannot be set, so that even if the CPU runs away at the user branch destination, writing / erasing cannot be performed easily.

ステップT91の処理において、レジスタFKEYに設定するコードを、処理に対して意味のあるコード、例えば、消去/書込みの進捗状況を示すコードにすれば、暴走などにより、書込み/消去未完の状態で書込み/消去の処理ルーチンからリターンしてきたような場合、或はレジスタFKEYの値が期待値以外の値に変化している場合、レジスタFKEYの値を参照することにより、異常を検出することができる。図27の例では、パルス印可とベリファイの間では“71”、ベリファイと書込みデータ再演算の間は“72”、再演算と書込みパルス印可前のダミーライトの間は“73”とし、ユーザブランチ処理から抜けるとき、レジスタFKEYの値が“7X(X=1〜F)”であるかを判定し(T92)、それ以外であれば何らかの異常が有ったと見なし、書込み/消去に対してフェイル処理を行なう(T93)。FKEYが“7X”であれば、正常に処理終了と見なし、FKEYを“5A”に戻す(T93)。   In the process of step T91, if the code set in the register FKEY is a code meaningful to the process, for example, a code indicating the progress of the erase / write, the program is written in an unfinished state due to runaway When the process returns from the / erase processing routine or when the value of the register FKEY has changed to a value other than the expected value, an abnormality can be detected by referring to the value of the register FKEY. In the example of FIG. 27, “71” is set between pulse application and verify, “72” is set between verify and write data recalculation, and “73” is set between rewrite and dummy write before write pulse is applied. When exiting from the processing, it is determined whether the value of the register FKEY is “7X (X = 1 to F)” (T92). Otherwise, it is considered that there is some abnormality, and writing / erasing is failed. Processing is performed (T93). If FKEY is “7X”, it is considered that processing is normally completed, and FKEY is returned to “5A” (T93).

尚、進捗情況を保持するレジスタはFKEYでなくてもよいが、ユーザブランチの場合に“5A”以外の値に書き換えることが得策であるという事情を考慮すれば、レジスタFKEYを利用することが、ハードウェアリソースと処理負担の両面において経済的である。   Note that the register that holds the progress status does not have to be FKEY. However, in consideration of the fact that it is a good idea to rewrite to a value other than “5A” in the case of the user branch, it is possible to use the register FKEY. Economical in terms of both hardware resources and processing burden.

以上本発明者によってなされた発明を実施形態に基づいて具体的に説明したが、本発明はそれに限定されるものではなく、その要旨を逸脱しない範囲において種々変更可能であることは言うまでもない。   Although the invention made by the present inventor has been specifically described based on the embodiments, it is needless to say that the present invention is not limited thereto and can be variously modified without departing from the gist thereof.

例えば、消去及び書込み可能な不揮発性メモリは2値のフラッシュメモリに限定されない。多値フラッシュメモリ、例えば、1個のフラッシュッメモリセルに2ビット以上の記憶情報を保持させることが可能な多値フラッシュメモリであってもよい。すなわち、1個のフラッシュメモリセルは、情報記憶に際して複数ビットの書き込みデータで指定される4種類以上の閾値電圧の中の一つの閾値電圧に設定され、情報読み出しに際して閾値電圧の状態を対応する複数ビットの記憶情報として出力する、1個のフラッシュメモリセルの記憶情報を複数ビット化したメモリである。ここでは、一つのフラッシュメモリセルに2ビットの情報を書き込むことができ、かつその情報を読み出すことができるフラッシュメモリを一例とする。このようなフラッシュメモリが実現しようとする多値情報記憶技術において、一つのメモリセルの情報記憶状態は、例えば消去状態(“11”)、第1の書き込み状態(“10”)、第2の書き込み状態(“00”)、第3の書き込み状態(“01”)の中から選ばれた一つの状態とされる。全部で4通りの情報記憶状態は、2ビットのデータによって決定される状態とされる。即ち、2ビットのデータを一つのメモリセルで記憶する。   For example, the erasable and writable nonvolatile memory is not limited to a binary flash memory. It may be a multi-level flash memory, for example, a multi-level flash memory capable of holding stored information of 2 bits or more in one flash memory cell. That is, one flash memory cell is set to one threshold voltage among four or more types of threshold voltages specified by a plurality of bits of write data at the time of information storage, and a plurality of threshold voltages corresponding to the state of the threshold voltage at the time of information reading. This is a memory in which the storage information of one flash memory cell, which is output as bit storage information, is converted into a plurality of bits. Here, an example is a flash memory in which 2-bit information can be written into one flash memory cell and the information can be read out. In the multi-value information storage technology to be realized by such a flash memory, the information storage state of one memory cell is, for example, an erase state (“11”), a first write state (“10”), a second One state selected from the write state (“00”) and the third write state (“01”). A total of four information storage states are determined by 2-bit data. That is, 2-bit data is stored in one memory cell.

また、フラッシュメモリセルはフローティングゲートとコントロールゲートの縦積み構造に限定されず、MOSトランジスタのゲート電極をフローティングゲート電極とし当該ゲート電極を延在させて形成したMOSゲート容量を介してチャネル領域をコントロールゲートに用いるようなデバイス構造などを採用してもよい。また、不揮発性記憶素子はフラッシュメモリに限定されず、MNOS(メタル・ナイトライド・オキサイド・セミコンダクタ)トランジスタを記憶素子とするEEPROM(エレクトリカリ・イレーザブル・アンド・プログラマブル・リード・オンリ・メモリ)のような不揮発性メモリ、或いは強誘電体メモリ等であってもよい。   In addition, the flash memory cell is not limited to a vertically stacked structure of floating gates and control gates, and the channel region is controlled through a MOS gate capacitor formed by extending the gate electrode using the gate electrode of the MOS transistor as a floating gate electrode. A device structure used for a gate may be adopted. The nonvolatile memory element is not limited to a flash memory, but is an EEPROM (Electrically Erasable and Programmable Read Only Memory) using a MNOS (Metal Nitride Oxide Semiconductor) transistor as a memory element. A non-volatile memory or a ferroelectric memory may be used.

また、マイクロコンピュータがオンチップで備える回路モジュールは上記の例に限定されず、適宜変更可能である。   The circuit module provided on-chip by the microcomputer is not limited to the above example, and can be changed as appropriate.

消去及び書込み制御プログラムをブートマットに初期的に保持させる構成に限定されない。システムボードからダウンロードする構成を採用してもよい。また、各種レジスタ手段はフラッシュメモリ内蔵の周辺レジスタであっても、CPU内蔵の汎用レジスタであっても、或は、SRAMなどのメモリで構成されるメモリマップドI/Oレジスタであってもよい。   The present invention is not limited to a configuration in which the erase and write control programs are initially held in the boot mat. A configuration downloaded from the system board may be adopted. The various register means may be a peripheral register with a built-in flash memory, a general-purpose register with a built-in CPU, or a memory mapped I / O register composed of a memory such as SRAM. .

前記ユーザブランチは、レジスタFUBRA(R5)の設定値に基づいて、ジャンプサブルーチン命令のジャンプ先コードを予め書き換える初期化処理を行なってから、其のプログラムを実行するものとして説明した。これに代えて、ジャンプサブルーチン命令でそのレジスタFUBRA(R5)を直接参照して分岐するようにしてもよい。この場合には、その消去及び書込み制御プログラムのコンパイラが一つの関数内で引数として利用する事ができる汎用レジスタの数の制限の範囲内で汎用レジスタR5を参照できなければならない。   It has been described that the user branch executes the program after performing the initialization process for rewriting the jump destination code of the jump subroutine instruction in advance based on the set value of the register FUBRA (R5). Alternatively, a branch may be made by directly referring to the register FUBRA (R5) with a jump subroutine instruction. In this case, the compiler for the erase and write control program must be able to refer to the general-purpose register R5 within the limit of the number of general-purpose registers that can be used as an argument in one function.

本発明の一例に係るマイクロコンピュータのブロック図である。It is a block diagram of a microcomputer according to an example of the present invention. CPU2の具体例を示すブロック図である。It is a block diagram which shows the specific example of CPU2. フラッシュメモリのメモリマットを例示する説明図である。It is explanatory drawing which illustrates the memory mat of flash memory. フラッシュメモリのメモリマット毎の各動作モードによるアクセス態様を例示する説明図である。It is explanatory drawing which illustrates the access mode by each operation mode for every memory mat of flash memory. CPUが実行するプログラムの所在と実行による作用を模式的に示す説明図である。It is explanatory drawing which shows typically the effect | action by the location and execution of the program which CPU runs. フラッシュメモリの消去及び書き込みプロテクトのための論理構成を例示する論理回路図である。3 is a logic circuit diagram illustrating a logic configuration for erasing and writing protection of a flash memory. FIG. CPUのオペレーションがユーザマットとユーザブートマットとの間で切換えられるときの状態遷移図である。It is a state transition diagram when operation of CPU is switched between a user mat and a user boot mat. プログラムモード判定処理のフローチャートである。It is a flowchart of a program mode determination process. ライタモード処理のフローチャートである。It is a flowchart of a writer mode process. ブートモード処理のフローチャートである。It is a flowchart of a boot mode process. ユーザブートモード処理のフローチャートである。It is a flowchart of a user boot mode process. ユーザモード処理のフローチャートである。It is a flowchart of a user mode process. 図11のステップS42及び図12のステップS54の書き込み/消去処理のフローチャートである。13 is a flowchart of write / erase processing in step S42 in FIG. 11 and step S54 in FIG. 図13の書き込み処理に着目した概略フローチャートである。14 is a schematic flowchart focusing on the writing process of FIG. 13. RAMへの転送処理(T1)の詳細を例示するフローチャートである。It is a flowchart which illustrates the detail of the transfer process (T1) to RAM. 書き込み初期化処理(T2)の詳細を例示するフローチャートである。It is a flowchart which illustrates the detail of a write initialization process (T2). 書き込み実行(T3)の詳細を例示するフローチャートである。It is a flowchart which illustrates the detail of write execution (T3). 図16の書き込み初期化時における内蔵RAM、書き込みプログラム、初期化処理、レジスタ(R4,R5)との間のデータ接続関係を例示する説明図である。FIG. 17 is an explanatory diagram exemplifying a data connection relationship between a built-in RAM, a writing program, initialization processing, and registers (R4, R5) at the time of writing initialization in FIG. 16; 書き込み時におけるRAM、汎用レジスタ(R4,R5)、書き込みプログラムとの間のデータ接続関係を例示する説明図である。It is explanatory drawing which illustrates the data connection relationship between RAM at the time of writing, general purpose registers (R4, R5), and a writing program. 図17のステップT35に対応する書込みプログラムの処理フローである。It is a processing flow of the writing program corresponding to step T35 of FIG. 図13の消去処理に着目した概略フローチャートである。14 is a schematic flowchart focusing on the erasing process of FIG. 13. 消去初期化処理(T6)の詳細を例示するフローチャートである。It is a flowchart which illustrates the detail of an erasure | elimination initialization process (T6). 消去実行(T7)の詳細を例示するフローチャートである。It is a flowchart which illustrates the detail of deletion execution (T7). 図22の消去初期化時における内蔵RAM、消去プログラム、初期化処理、レジスタ(R4,R5)との間のデータ接続関係を例示する説明図である。FIG. 23 is an explanatory view exemplifying a data connection relationship between a built-in RAM, an erase program, an initialization process, and registers (R4, R5) at the time of erase initialization in FIG. 22; 消去時におけるRAM、汎用レジスタ(R4,R5)、消去プログラムとの間のデータ接続関係を例示する説明図である。It is explanatory drawing which illustrates the data connection relationship between RAM at the time of erasing, general purpose registers (R4, R5), and an erasing program. 図23のステップT74に対応する消去プログラムの処理フローである。FIG. 24 is a processing flow of an erasing program corresponding to step T74 in FIG. ユーザブランチ先でCPUが暴走してフラッシュッメモリの記憶情報が破壊される事態を抑止可能にするユーザブランチ処理のフローチャートである。It is a flowchart of the user branch process which can suppress the situation where CPU runs away in a user branch destination and the memory information of flash memory is destroyed.

符号の説明Explanation of symbols

1 マイクロコンピュータ
2 CPU
3 RAM
4 バスステートコントローラ
5 フラッシュッメモリモジュール
6 フラッシュコントロールロジック
9 割込みコントローラ
RES リセット信号
13 フラッシュッメモリ
14 モード信号
15 システムコントローラ
20 メモリセルアレイ
FMATS 制御レジスタ
FKEY 制御レジスタ
FCCS 制御レジスタ
SCO 制御ビット
Rmat リペア及びトリミングマット
Tmat ブートマット
Umat ユーザブートマット
Mmat ユーザマット
Pfwe 外部端子
1 Microcomputer 2 CPU
3 RAM
4 bus state controller 5 flash memory module 6 flash control logic 9 interrupt controller RES reset signal 13 flash memory 14 mode signal 15 system controller 20 memory cell array FMATS control register FKEY control register FCCS control register SCO control bit Rmat repair and trim mat Tmat Bootmat Umat User bootmat Mmat Usermat Pfwe External terminal

Claims (21)

CPUと、消去及び書き込み可能な不揮発性メモリと、前記CPUのアドレス空間に配置されるRAMとを有するマイクロコンピュータであって、
前記不揮発性メモリは、外部とのインタフェースを確立するためにCPUにより処理される通信制御プログラムを保有する第1領域と、
前記CPUによる通信制御プログラムの処理により外部とのインタフェースが確立されて消去及び書き込み可能にされる第2領域と、
前記CPUによる通信制御プログラムの処理により外部とのインタフェースが確立されて消去及び書き込み可能にされ、且つCPUによる第2領域のプログラムの処理により消去及び書き込み可能にされる第3領域と、を有し、
前記不揮発性メモリの第2領域と第3領域とはレジスタによって排他的に選択可能な構成となることを特徴とするマイクロコンピュータ。
A microcomputer having a CPU, an erasable and writable nonvolatile memory, and a RAM arranged in the address space of the CPU,
The non-volatile memory has a first area that holds a communication control program processed by the CPU to establish an interface with the outside;
A second area in which an interface with the outside is established by the processing of the communication control program by the CPU and can be erased and written;
An interface with the outside is established by the processing of the communication control program by the CPU and can be erased and written, and the third area can be erased and written by the program of the second area by the CPU; ,
A microcomputer having a configuration in which the second area and the third area of the nonvolatile memory can be exclusively selected by a register.
第1インタフェースを有する実装基板に実装されるべきマイクロコンピュータであって、
中央処理装置と、
前記第1インタフェースと異なる第2インタフェースを用いた通信プロトコルを確立するための第1通信処理プログラムが格納される第1記憶領域と、前記第1インタフェースを用いた通信プロトコルを確立するための第2通信処理プログラムが格納される第2記憶領域と、所定の第1動作モードで前記中央処理装置によって実行される制御プログラムが格納される第3記憶領域とを有する不揮発性メモリと、
前記第2記憶領域と第3記憶領域とを排他的に選択するためのレジスタと、を有することを特徴とするマイクロコンピュータ。
A microcomputer to be mounted on a mounting board having a first interface,
A central processing unit;
A first storage area for storing a first communication processing program for establishing a communication protocol using a second interface different from the first interface, and a second for establishing a communication protocol using the first interface A non-volatile memory having a second storage area for storing a communication processing program, and a third storage area for storing a control program executed by the central processing unit in a predetermined first operation mode;
A microcomputer comprising: a register for exclusively selecting the second storage area and the third storage area.
前記第1記憶領域は、さらに、書き込み制御プログラムが格納され、
前記第2記憶領域に格納される前記第2通信処理プログラムは、前記書き込み制御プログラム及び前記第1通信処理プログラムを前記中央処理装置によって実行させる第1書き込みモードによって、前記第2記憶領域に書き込まれることを特徴とする請求項2記載のマイクロコンピュータ。
The first storage area further stores a write control program,
The second communication processing program stored in the second storage area is written to the second storage area in a first write mode in which the write control program and the first communication processing program are executed by the central processing unit. The microcomputer according to claim 2.
前記第3記憶領域に格納される前記制御プログラムは、前記第1書き込みモード、又は、前記第1記憶領域に格納された書き込み制御プログラム及び前記第2通信処理プログラムを前記中央処理装置によって実行させる第2書き込みモードの何れかによって、前記第3記憶領域に書き込まれることを特徴とする請求項3記載のマイクロコンピュータ。   The control program stored in the third storage area is a program that causes the central processing unit to execute the first write mode or the write control program and the second communication processing program stored in the first storage area. 4. The microcomputer according to claim 3, wherein writing to the third storage area is performed in any one of two writing modes. 前記第1インタフェースは、ATAPIインタフェース、SCSIインタフェース、または、HCANインタフェースであることを特徴とする請求項2記載のマイクロコンピュータ。   3. The microcomputer according to claim 2, wherein the first interface is an ATAPI interface, a SCSI interface, or an HCAN interface. 前記第2インタフェースは、調歩同期を利用したシリアルインタフェースであることを特徴とする請求項2記載のマイクロコンピュータ。   3. The microcomputer according to claim 2, wherein the second interface is a serial interface using start-stop synchronization. 前記不揮発性メモリは、フローティングゲートを有する不揮発性メモリセルを複数有することを特徴とする請求項2記載のマイクロコンピュータ。   3. The microcomputer according to claim 2, wherein the nonvolatile memory has a plurality of nonvolatile memory cells each having a floating gate. 前記不揮発性メモリは、フラッシュメモリであることを特徴とする請求項7記載のマイクロコンピュータ。   8. The microcomputer according to claim 7, wherein the nonvolatile memory is a flash memory. 前記第1記憶領域は、さらに、消去制御プログラムが格納され、
前記第2記憶領域に格納される前記第2通信処理プログラムは、前記消去制御プログラム及び前記第1通信処理プログラムを前記中央処理装置によって実行させる第1消去モードによって、前記第2記憶領域から消去可能にされることを特徴とする請求項2記載のマイクロコンピュータ。
The first storage area further stores an erase control program,
The second communication processing program stored in the second storage area can be erased from the second storage area in a first erasure mode in which the central processing unit executes the erasure control program and the first communication processing program. The microcomputer according to claim 2, wherein:
前記第3記憶領域に格納される前記制御プログラムは、前記第1消去モード、又は、前記第1記憶領域に格納された消去制御プログラム及び前記第2通信処理プログラムを前記中央処理装置によって実行させる第2消去モードの何れかによって、前記第3記憶領域から消去可能であることを特徴とする請求項9記載のマイクロコンピュータ。   The control program stored in the third storage area is the first erasing mode or the erasing control program and the second communication processing program stored in the first storage area are executed by the central processing unit. 10. The microcomputer according to claim 9, wherein the microcomputer can be erased from the third storage area by any one of the two erase modes. 前記第1記憶領域は、さらに、書き込み制御プログラムが格納され、
前記第2記憶領域に格納される前記第2通信処理プログラムは、前記書き込み制御プログラム及び前記第1通信処理プログラムを前記中央処理装置によって実行させる第1書き込みモードによって、前記第2記憶領域に書き込まれることを特徴とする請求項10記載のマイクロコンピュータ。
The first storage area further stores a write control program,
The second communication processing program stored in the second storage area is written to the second storage area in a first write mode in which the write control program and the first communication processing program are executed by the central processing unit. The microcomputer according to claim 10.
前記第3記憶領域に格納される前記制御プログラムは、前記第1書き込みモード、又は、前記第1記憶領域に格納された書き込み制御プログラム及び前記第2通信処理プログラムを前記中央処理装置によって実行させる第2書き込みモードの何れかによって、前記第3記憶領域に書き込まれることを特徴とする請求項11記載のマイクロコンピュータ。   The control program stored in the third storage area is a program that causes the central processing unit to execute the first write mode or the write control program and the second communication processing program stored in the first storage area. 12. The microcomputer according to claim 11, wherein writing to the third storage area is performed in any one of two writing modes. 中央処理装置と、
第1インタフェースを用いた通信プロトコルを確立するための第1通信処理プログラムと書き込み制御プログラムが格納される第1記憶領域と、前記第1インタフェースと異なる前記第2インタフェースを用いた通信プロトコルを確立するための第2通信処理プログラムが格納される第2記憶領域と、所定の第1動作モードで前記中央処理装置によって実行される制御プログラムが格納される第3記憶領域とを有する不揮発性メモリと、を有し、
前記第2記憶領域と第3記憶領域とは、排他的に選択可能とされることを特徴とするマイクロコンピュータ。
A central processing unit;
A first storage area for storing a first communication processing program and a write control program for establishing a communication protocol using the first interface, and a communication protocol using the second interface different from the first interface are established. A non-volatile memory having a second storage area for storing a second communication processing program for storing, and a third storage area for storing a control program executed by the central processing unit in a predetermined first operation mode; Have
The microcomputer, wherein the second storage area and the third storage area can be selected exclusively.
前記第2記憶領域に格納される前記第2通信処理プログラムは、前記書き込み制御プログラム及び前記第1通信処理プログラムを前記中央処理装置によって実行させる第1書き込みモードによって、前記第2記憶領域に書き込まれることを特徴とする請求項13記載のマイクロコンピュータ。   The second communication processing program stored in the second storage area is written to the second storage area in a first write mode in which the write control program and the first communication processing program are executed by the central processing unit. The microcomputer according to claim 13. 前記第3記憶領域に格納される前記制御プログラムは、前記第1書き込みモード、又は、前記第1記憶領域に格納された書き込み制御プログラム及び前記第2通信処理プログラムを前記中央処理装置によって実行させる第2書き込みモードの何れかによって、前記第3記憶領域に書き込まれることを特徴とする請求項14記載のマイクロコンピュータ。   The control program stored in the third storage area is a program that causes the central processing unit to execute the first write mode or the write control program and the second communication processing program stored in the first storage area. 15. The microcomputer according to claim 14, wherein writing to the third storage area is performed in any one of two writing modes. 前記第1記憶領域は、さらに、消去制御プログラムが格納され、
前記第2記憶領域に格納される前記第2通信処理プログラムは、前記消去制御プログラム及び前記第1通信処理プログラムを前記中央処理装置によって実行させる第1消去モードによって、前記第2記憶領域から消去にされることを特徴とする請求項13記載のマイクロコンピュータ。
The first storage area further stores an erase control program,
The second communication processing program stored in the second storage area is erased from the second storage area in a first erasure mode in which the central processing unit executes the erasure control program and the first communication processing program. 14. The microcomputer according to claim 13, wherein:
前記第3記憶領域に格納される前記制御プログラムは、前記第1消去モード、又は、前記第1記憶領域に格納された消去制御プログラム及び前記第2通信処理プログラムを前記中央処理装置によって実行させる第2消去モードの何れかによって、前記第3記憶領域から消去されることを特徴とする請求項16記載のマイクロコンピュータ。   The control program stored in the third storage area is the first erasing mode or the erasing control program and the second communication processing program stored in the first storage area are executed by the central processing unit. 17. The microcomputer according to claim 16, wherein the microcomputer is erased from the third storage area by any one of the two erase modes. 前記第1インタフェースは、ATAPIインタフェース、SCSIインタフェース、HCANインタフェースから選択された少なくとも1つのインタフェースであることを特徴とする請求項13記載のマイクロコンピュータ。   14. The microcomputer according to claim 13, wherein the first interface is at least one interface selected from an ATAPI interface, a SCSI interface, and an HCAN interface. 前記第2インタフェースは、調歩同期を利用したシリアルインタフェースであることを特徴とする請求項13記載のマイクロコンピュータ。   14. The microcomputer according to claim 13, wherein the second interface is a serial interface using start-stop synchronization. 前記不揮発性メモリは、フローティングゲートを有する不揮発性メモリセルを複数有することを特徴とする請求項13記載のマイクロコンピュータ。   14. The microcomputer according to claim 13, wherein the nonvolatile memory has a plurality of nonvolatile memory cells each having a floating gate. 前記不揮発性メモリは、フラッシュメモリであることを特徴とする請求項20記載のマイクロコンピュータ。   21. The microcomputer according to claim 20, wherein the nonvolatile memory is a flash memory.
JP2008059286A 2008-03-10 2008-03-10 Microcomputer Pending JP2008186476A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2008059286A JP2008186476A (en) 2008-03-10 2008-03-10 Microcomputer

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2008059286A JP2008186476A (en) 2008-03-10 2008-03-10 Microcomputer

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
JP2001097807A Division JP4162863B2 (en) 2001-03-30 2001-03-30 Microcomputer

Publications (1)

Publication Number Publication Date
JP2008186476A true JP2008186476A (en) 2008-08-14

Family

ID=39729414

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2008059286A Pending JP2008186476A (en) 2008-03-10 2008-03-10 Microcomputer

Country Status (1)

Country Link
JP (1) JP2008186476A (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH1055278A (en) * 1996-08-08 1998-02-24 Toshiba Microelectron Corp Memory mixed microcomputer
JPH10161988A (en) * 1996-11-28 1998-06-19 Nec Corp Microcomputer having flash eeprom built in
JP2000259420A (en) * 1999-03-05 2000-09-22 Denso Corp Device for updating learning value for electronic controller

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH1055278A (en) * 1996-08-08 1998-02-24 Toshiba Microelectron Corp Memory mixed microcomputer
JPH10161988A (en) * 1996-11-28 1998-06-19 Nec Corp Microcomputer having flash eeprom built in
JP2000259420A (en) * 1999-03-05 2000-09-22 Denso Corp Device for updating learning value for electronic controller

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
JPN6007016109; 'フラッシュメモリ内蔵マイコンのATAPIバスオンボード書き込み' 日立マイコン技報 第10巻,第2号, 199612, P38-39, 日立マイコンシステム *

Similar Documents

Publication Publication Date Title
JP4162863B2 (en) Microcomputer
JP4230122B2 (en) Microcomputer, writing method and erasing method
US6587916B2 (en) Microcomputer with built-in programmable nonvolatile memory
KR100604877B1 (en) Apparatus and method for controlling memory address mapping in embedded system
JP2008059052A (en) Semiconductor integrated circuit and microcomputer
WO2015127330A1 (en) System and method for modification of coded instructions in read-only memory using one-time programmable memory
JP4958201B2 (en) Microcomputer
JP2008186476A (en) Microcomputer
US7519802B2 (en) System and method for configuring a computer system
EP2730993B1 (en) Reset method and network device
JP4873526B2 (en) Semiconductor integrated circuit and microcomputer
JP3866269B2 (en) Microcomputer
US8140896B2 (en) System and method for downloading system program
KR100465610B1 (en) Microcomputer with embedded flash memory having on-chip programming capability and method of programming data into the embedded flash memory
JP2003044457A (en) Data processor
JP2010170579A (en) Data processor
US20150154123A1 (en) Device with processing unit and information storage
JP2008257415A (en) Controller having program write function
JP5519191B2 (en) Semiconductor integrated circuit and television
JP2002287994A (en) Microcontroller
JP2013050860A (en) Microcomputer and multiple microcomputer system

Legal Events

Date Code Title Description
A711 Notification of change in applicant

Free format text: JAPANESE INTERMEDIATE CODE: A712

Effective date: 20100527

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20110224

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20110421

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20120202

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20120330

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20121018