[go: up one dir, main page]

JP2005251217A - Microcomputer, electronic equipment and debugging system - Google Patents

Microcomputer, electronic equipment and debugging system Download PDF

Info

Publication number
JP2005251217A
JP2005251217A JP2005091910A JP2005091910A JP2005251217A JP 2005251217 A JP2005251217 A JP 2005251217A JP 2005091910 A JP2005091910 A JP 2005091910A JP 2005091910 A JP2005091910 A JP 2005091910A JP 2005251217 A JP2005251217 A JP 2005251217A
Authority
JP
Japan
Prior art keywords
data
command
monitor
microcomputer
monitoring means
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
JP2005091910A
Other languages
Japanese (ja)
Inventor
Makoto Kudo
真 工藤
Yoichi Hijikata
陽一 土方
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.)
Seiko Epson Corp
Original Assignee
Seiko Epson Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Seiko Epson Corp filed Critical Seiko Epson Corp
Priority to JP2005091910A priority Critical patent/JP2005251217A/en
Publication of JP2005251217A publication Critical patent/JP2005251217A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)
  • Test And Diagnosis Of Digital Computers (AREA)
  • Microcomputers (AREA)

Abstract

【課題】 小さな命令コードサイズでオンチップデバッグ機能を実現できるマイクロコンピュータ、電子機器、デバッグシステムを提供する。
【解決手段】マイクロコンピュータは、中央処理ユニット22と、第2のモニタ手段62との間でデータを送受信し、実行するプリミティブコマンドを第2のモニタ手段62からの受信データに基づき決定し、決定したプリミティブコマンドを実行するための処理を行う第1のモニタ手段40を含む。第1のモニタ手段40は、プリミティブコマンドの命令コードを含むモニタプログラムが格納されるモニタROM42を含み、第2のモニタ手段62からの受信データはプリミティブコマンドを識別するための識別データを含む。第1のモニタ手段40は、第2のモニタ手段62から受信データを受信した場合に、受信データに含まれる識別データにより指定される命令コードのプリミティブコマンドを実行する。
【選択図】 図3
PROBLEM TO BE SOLVED: To provide a microcomputer, an electronic device and a debugging system capable of realizing an on-chip debugging function with a small instruction code size.
The microcomputer transmits and receives data between the central processing unit and the second monitor means, and determines a primitive command to be executed based on the received data from the second monitor means. First monitoring means 40 for performing processing for executing the primitive command. The first monitor means 40 includes a monitor ROM 42 in which a monitor program including the instruction code of the primitive command is stored, and the received data from the second monitor means 62 includes identification data for identifying the primitive command. When receiving the reception data from the second monitoring unit 62, the first monitoring unit 40 executes the primitive command of the instruction code specified by the identification data included in the reception data.
[Selection] Figure 3

Description

本発明は、マイクロコンピュータ、マイクロコンピュータを含む電子機器、及びデバッグシステムに関する。   The present invention relates to a microcomputer, an electronic device including the microcomputer, and a debugging system.

近年、ゲーム装置、カーナビゲーションシステム、プリンタ、携帯情報端末などの電子機器に組み込まれ、高度な情報処理を実現できるマイクロコンピュータに対する需要が高まっている。そして、このような組み込み型のマイクロコンピュータは、通常、ターゲットシステムと呼ばれるユーザボードに実装される。そして、このターゲットシステムを動作させるソフトウェアの開発を支援するためにICE(In-Circuit Emulator)と呼ばれるソフトウェア開発支援ツールが広く使用されている。   In recent years, there has been an increasing demand for microcomputers that are incorporated in electronic devices such as game devices, car navigation systems, printers, and portable information terminals, and that can realize advanced information processing. Such an embedded microcomputer is usually mounted on a user board called a target system. A software development support tool called ICE (In-Circuit Emulator) is widely used to support the development of software for operating the target system.

さて、このようなICEとしては、従来、図1(A)に示すようなCPU置き換え型と呼ばれるICEが主流を占めていた。このCPU置き換え型ICEでは、デバッグ時にターゲットシステム300からマイクロコンピュータ302を取り外し、その代わりにデバッグツール304のプローブ306を接続する。そして、このデバッグツール304に、取り外したマイクロコンピュータ302の動作をエミュレートさせる。また、このデバッグツール304に、デバッグのために必要な種々の処理を行わせる。   Conventionally, as such ICE, an ICE called a CPU replacement type as shown in FIG. In this CPU replacement type ICE, the microcomputer 302 is removed from the target system 300 during debugging, and the probe 306 of the debugging tool 304 is connected instead. Then, the debugging tool 304 is made to emulate the operation of the removed microcomputer 302. Further, the debug tool 304 is caused to perform various processes necessary for debugging.

しかしながら、このCPU置き換え型ICEには、プローブ306のピン数が多くなると共にプローブ306の線308が増えるという欠点があった。このため、マイクロコンピュータ302の高周波数動作をエミュレートすることが困難になる(例えば33MHZ程度が限界)。またターゲットシステム300の設計も困難になる。更に、マイクロコンピュータ302を実装して動作させる実動作時とデバッグツール304でマイクロコンピュータ302の動作をエミュレートするデバッグモード時とで、ターゲットシステム300の動作環境(信号のタイミング、負荷条件)が変化してしまう。またこのCPU置き換え型ICEには、マイクロコンピュータが異なれば、たとえそれが派生品であっても、設計が異なるデバッグツールや、ピン数やピンの位置が異なるプローブを使用しなければならないという問題もあった。   However, this CPU replacement type ICE has a drawback that the number of pins of the probe 306 increases and the number of lines 308 of the probe 306 increases. For this reason, it becomes difficult to emulate the high frequency operation of the microcomputer 302 (for example, about 33 MHZ is a limit). Also, the design of the target system 300 becomes difficult. Furthermore, the operating environment (signal timing and load condition) of the target system 300 changes between the actual operation in which the microcomputer 302 is mounted and operated and the debug mode in which the debugging tool 304 emulates the operation of the microcomputer 302. Resulting in. In addition, this CPU replacement type ICE has a problem that, if the microcomputer is different, even if it is a derivative product, it is necessary to use a debugging tool with a different design or a probe with a different number of pins or pin positions. there were.

一方、このようなCPU置き換え型ICEの欠点を解消するものとして、図1(B)に示すような、モニタプログラム310をターゲットシステム312に実装するタイプのICEが知られている。しかしながら、これまでのモニタプログラム実装型ICEでは、モニタプログラム310に、全てのデバッグコマンド(プログラムのロード、GO、ステップ実行、メモリのリード・ライト、内部レジスタのリード・ライト、ブレークポイントの設定・解除)を実行する機能を持たせる必要があった。したがって、モニタプログラム310の命令コードサイズが非常に大きくなってしまう(例えば30〜50Kバイト)。このため、ユーザが自由に使用できるメモリ領域が減ってしまうと共に、デバッグ時とデバッグ時以外でシステムが異なってしまうという問題があった。図1(B)の問題点を解決する方法として、モニタプログラムをチップ上にのせるオンチップデバッグという方法があるが、命令コードサイズが大きなモニタプログラムをチップ内に設けると、チップのサイズを大きくしてしまうという問題点がある。   On the other hand, an ICE of the type in which the monitor program 310 is mounted on the target system 312 as shown in FIG. However, in the conventional monitor program mounting type ICE, all debug commands (program load, GO, step execution, memory read / write, internal register read / write, breakpoint setting / release are included in the monitor program 310. ) Must be provided. Therefore, the instruction code size of the monitor program 310 becomes very large (for example, 30 to 50 Kbytes). For this reason, there is a problem that the memory area that can be freely used by the user is reduced and the system is different between debugging and non-debugging. As a method for solving the problem of FIG. 1B, there is a method called on-chip debugging in which a monitor program is placed on a chip. If a monitor program having a large instruction code size is provided in the chip, the chip size is increased. There is a problem that it will.

本発明は、以上のような技術的課題に鑑みてなされたものであり、その目的とするところは、小さな命令コードサイズ又は回路規模でオンチップデバッグ機能を実現できるマイクロコンピュータ、これを含む電子機器、及びデバッグシステムを提供することにある。   The present invention has been made in view of the above technical problems, and an object thereof is a microcomputer capable of realizing an on-chip debugging function with a small instruction code size or circuit scale, and an electronic apparatus including the microcomputer And providing a debugging system.

上記課題を解決するために本発明は、オンチップデバッグ機能を有するマイクロコンピュータであって、命令の実行処理を行う中央処理ユニットと、マイクロコンピュータの外部に設けられデバッグコマンドを少なくとも1つのプリミティブコマンドに変換するための処理を行う第2のモニタ手段との間でデータを送受信し、実行するプリミティブコマンドを前記第2のモニタ手段からの受信データに基づいて決定し、決定したプリミティブコマンドを実行するための処理を行う第1のモニタ手段とを含み、前記第1のモニタ手段は、前記第1のモニタ手段の処理を実行するためのモニタプログラムが格納されるモニタROMを含み、前記モニタプログラムは、前記プリミティブコマンドの命令コードを含み、前記第2のモニタ手段からの前記受信データは、前記プリミティブコマンドを識別するための識別データを含み、前記第1のモニタ手段は、前記第2のモニタ手段から前記受信データを受信した場合に、前記受信データに含まれる前記識別データにより指定される命令コードのプリミティブコマンドを実行することを特徴とする。   In order to solve the above-described problems, the present invention is a microcomputer having an on-chip debugging function, and a central processing unit for executing instructions and a debugging command provided outside the microcomputer as at least one primitive command. To transmit / receive data to / from the second monitoring unit that performs processing for conversion, determine a primitive command to be executed based on the received data from the second monitoring unit, and execute the determined primitive command The first monitor means includes a monitor ROM that stores a monitor program for executing the process of the first monitor means, and the monitor program includes: Including the instruction code of the primitive command, and from the second monitor means The received data includes identification data for identifying the primitive command, and the first monitor means includes the identification data included in the received data when the received data is received from the second monitor means. A primitive command having an instruction code specified by is executed.

また本発明は、オンチップデバッグ機能を有するマイクロコンピュータであって、命令の実行処理を行う中央処理ユニットと、マイクロコンピュータの外部に設けられデバッグコマンドを少なくとも1つのプリミティブコマンドに変換するための処理を行う第2のモニタ手段との間でデータを送受信し、実行するプリミティブコマンドを前記第2のモニタ手段からの受信データに基づいて決定し、決定したプリミティブコマンドを実行するための処理を行う第1のモニタ手段と、前記中央処理ユニットの命令実行処理に使用され、デバッグモード時におけるメモリマップ上にそのアドレスが割り付けられる制御レジスタとを含み、前記第2のモニタ手段は、前記デバッグコマンドであるステップ実行コマンドを、ステップ実行イネーブルビットへのライトコマンドである第1のプリミティブコマンドと、GOコマンドである第2のプリミティブコマンドに変換し、前記第1のモニタ手段は、前記第1、第2のプリミティブコマンドを実行することで、ステップ実行処理を行うことを特徴とする。   The present invention also relates to a microcomputer having an on-chip debugging function, comprising: a central processing unit that executes instruction execution processing; and processing for converting a debug command into at least one primitive command provided outside the microcomputer. Data is transmitted / received to / from the second monitoring means to be executed, a primitive command to be executed is determined based on the received data from the second monitoring means, and a process for executing the determined primitive command is performed. And a control register which is used for instruction execution processing of the central processing unit and whose address is allocated on the memory map in the debug mode, wherein the second monitoring means is a step which is the debug command. Execute command, step execution enable bit A first primitive command that is a write command to the second command and a second primitive command that is a GO command, and the first monitoring means executes the first and second primitive commands, thereby performing a step. An execution process is performed.

また本発明は、オンチップデバッグ機能を有するマイクロコンピュータであって、命令の実行処理を行う中央処理ユニットと、マイクロコンピュータの外部に設けられデバッグコマンドを少なくとも1つのプリミティブコマンドに変換するための処理を行う第2のモニタ手段との間でデータを送受信し、実行するプリミティブコマンドを前記第2のモニタ手段からの受信データに基づいて決定し、決定したプリミティブコマンドを実行するための処理を行う第1のモニタ手段と、前記第2のモニタ手段からの前記受信データを一時的に蓄えるための受信バッファと、前記第2のモニタ手段への送信データを一時的に蓄えるための送信バッファとを含み、前記第2のモニタ手段からの前記受信データは、前記プリミティブコマンドを識別するための識別データを含み、前記第1のモニタ手段は、前記受信データの識別データがリードコマンドのプリミティブコマンドを示すものであった場合には、前記受信バッファの前記受信データからリードアドレスを取得し、取得した前記リードアドレスからデータをリードし、リードした前記データを前記送信バッファにライトし、前記受信データの識別データがライトコマンドのプリミティブコマンドを示すものであった場合には、前記受信バッファの前記受信データからライトアドレスとライトデータを取得し、取得した前記ライトアドレスに、取得した前記ライトデータを書き込む処理を行うことを特徴とする。   The present invention also relates to a microcomputer having an on-chip debugging function, comprising: a central processing unit that executes instruction execution processing; and processing for converting a debug command into at least one primitive command provided outside the microcomputer. Data is transmitted / received to / from the second monitoring means to be executed, a primitive command to be executed is determined based on the received data from the second monitoring means, and a process for executing the determined primitive command is performed. Monitoring means, a reception buffer for temporarily storing the reception data from the second monitoring means, and a transmission buffer for temporarily storing transmission data to the second monitoring means, The received data from the second monitor means identifies the primitive command. The first monitor means obtains a read address from the received data in the reception buffer when the identification data of the received data indicates a primitive command of a read command; When data is read from the acquired read address, the read data is written to the transmission buffer, and the identification data of the reception data indicates a primitive command of a write command, the data of the reception buffer A write address and write data are acquired from received data, and the process of writing the acquired write data to the acquired write address is performed.

また本発明は、前記第1のモニタ手段は、受信した識別データが外部ルーチンジャンプコマンドのプリミティブコマンドを示すものであった場合には、前記受信バッファの前記受信データからルーチンアドレスを取得して外部ルーチンにジャンプし、ジャンプ後に前記第1のモニタ手段の処理にリターンする処理を行うことを特徴とする。   According to the present invention, when the received identification data indicates a primitive command of an external routine jump command, the first monitor means acquires a routine address from the received data in the reception buffer and externally A jump is made to the routine, and after the jump, a process of returning to the process of the first monitoring means is performed.

また本発明は、前記中央処理ユニットの内部レジスタの内容が退避され、デバッグモード時におけるメモリマップ上にそのアドレスが割り付けられるモニタRAMを含み、前記第1のモニタ手段は、受信した識別データがGOコマンドのプリミティブコマンドを示すものであった場合には、前記モニタRAMに退避したデータを前記内部レジスタにリストアし、リストア後にユーザプログラムの処理にリターンする処理を行うことを特徴とする。   Further, the present invention includes a monitor RAM in which the contents of the internal register of the central processing unit are saved and the address is assigned on the memory map in the debug mode. The first monitor means receives the identification data as GO If the command indicates a primitive command, the data saved in the monitor RAM is restored to the internal register, and the process of returning to the process of the user program after the restoration is performed.

また本発明は、マイクロコンピュータを含むターゲットシステムのためのデバッグシステムであって、ホストシステムが発行したデバッグコマンドを少なくとも1つのプリミティブコマンドに変換するための処理を行う第2のモニタ手段と、前記第2のモニタ手段との間でデータを送受信し、実行するプリミティブコマンドを前記第2のモニタ手段からの受信データに基づいて決定し、決定したプリミティブコマンドを実行するための処理を行う第1のモニタ手段とを含み、前記第1のモニタ手段は、前記第1のモニタ手段の処理を実行するためのモニタプログラムが格納されるモニタROMを含み、前記モニタプログラムは、前記プリミティブコマンドの命令コードを含み、前記第2のモニタ手段からの前記受信データは、前記プリミティブコマンドを識別するための識別データを含み、前記第1のモニタ手段は、前記第2のモニタ手段から前記受信データを受信した場合に、前記受信データに含まれる前記識別データにより指定される命令コードのプリミティブコマンドを実行することを特徴とする。   The present invention is also a debug system for a target system including a microcomputer, the second monitor means for performing processing for converting a debug command issued by a host system into at least one primitive command, A first monitor that transmits and receives data to and from the second monitoring means, determines a primitive command to be executed based on the received data from the second monitoring means, and performs processing for executing the determined primitive command The first monitor means includes a monitor ROM in which a monitor program for executing the processing of the first monitor means is stored, and the monitor program includes an instruction code of the primitive command. , The received data from the second monitor means is the primitive. Including identification data for identifying a command, and the first monitor means, when receiving the received data from the second monitor means, an instruction code specified by the identification data included in the received data The primitive command is executed.

また本発明は、マイクロコンピュータを含むターゲットシステムのためのデバッグシステムであって、ホストシステムが発行したデバッグコマンドを少なくとも1つのプリミティブコマンドに変換するための処理を行う第2のモニタ手段と、前記第2のモニタ手段との間でデータを送受信し、実行するプリミティブコマンドを前記第2のモニタ手段からの受信データに基づいて決定し、決定したプリミティブコマンドを実行するための処理を行う第1のモニタ手段と、前記中央処理ユニットの命令実行処理に使用され、デバッグモード時におけるメモリマップ上にそのアドレスが割り付けられる制御レジスタとを含み、前記第2のモニタ手段は、前記デバッグコマンドであるステップ実行コマンドを、ステップ実行イネーブルビットへのライトコマンドである第1のプリミティブコマンドと、GOコマンドである第2のプリミティブコマンドに変換し、前記第1のモニタ手段は、前記第1、第2のプリミティブコマンドを実行することで、ステップ実行処理を行うことを特徴とする。   The present invention is also a debug system for a target system including a microcomputer, the second monitor means for performing processing for converting a debug command issued by a host system into at least one primitive command, A first monitor that transmits and receives data to and from the second monitoring means, determines a primitive command to be executed based on the received data from the second monitoring means, and performs processing for executing the determined primitive command And a control register which is used for instruction execution processing of the central processing unit and whose address is allocated on the memory map in the debug mode, the second monitoring means is a step execution command which is the debug command To the step execution enable bit. The first monitor command is converted into a first primitive command that is a command and a second primitive command that is a GO command, and the first monitoring means executes the first and second primitive commands, thereby performing step execution processing. It is characterized by performing.

また本発明は、マイクロコンピュータを含むターゲットシステムのためのデバッグシステムであって、ホストシステムが発行したデバッグコマンドを少なくとも1つのプリミティブコマンドに変換するための処理を行う第2のモニタ手段と、前記第2のモニタ手段との間でデータを送受信し、実行するプリミティブコマンドを前記第2のモニタ手段からの受信データに基づいて決定し、決定したプリミティブコマンドを実行するための処理を行う第1のモニタ手段と、前記第2のモニタ手段からの前記受信データを一時的に蓄えるための受信バッファと、前記第2のモニタ手段への送信データを一時的に蓄えるための送信バッファとを含み、前記第2のモニタ手段からの前記受信データは、前記プリミティブコマンドを識別するための識別データを含み、前記第1のモニタ手段は、前記受信データの識別データがリードコマンドのプリミティブコマンドを示すものであった場合には、前記受信バッファの前記受信データからリードアドレスを取得し、取得した前記リードアドレスからデータをリードし、リードした前記データを前記送信バッファにライトし、前記受信データの識別データがライトコマンドのプリミティブコマンドを示すものであった場合には、前記受信バッファの前記受信データからライトアドレスとライトデータを取得し、取得した前記ライトアドレスに、取得した前記ライトデータを書き込む処理を行うことを特徴とする。   The present invention is also a debug system for a target system including a microcomputer, the second monitor means for performing processing for converting a debug command issued by a host system into at least one primitive command, A first monitor that transmits and receives data to and from the second monitoring means, determines a primitive command to be executed based on the received data from the second monitoring means, and performs processing for executing the determined primitive command Means, a reception buffer for temporarily storing the reception data from the second monitoring means, and a transmission buffer for temporarily storing transmission data to the second monitoring means, The received data from the second monitoring means is an identification data for identifying the primitive command. The first monitor means obtains a read address from the received data in the receive buffer, if the identification data of the received data indicates a primitive command of a read command, When data is read from the read address, the read data is written to the transmission buffer, and the identification data of the reception data indicates a primitive command of a write command, the reception data of the reception buffer The write address and the write data are acquired from the data, and the process of writing the acquired write data to the acquired write address is performed.

また本発明は、オンチップデバッグ機能を有するマイクロコンピュータであって、命令の実行処理を行う中央処理ユニットと、マイクロコンピュータの外部に設けられデバッグコマンドを少なくとも1つのプリミティブコマンドに変換するための処理を行う第2のモニタ手段との間でデータを送受信し、実行するプリミティブコマンドを前記第2のモニタ手段からの受信データに基づいて決定し、決定したプリミティブコマンドを実行するための処理を行う第1のモニタ手段とを含むことを特徴とする。   The present invention also relates to a microcomputer having an on-chip debugging function, comprising: a central processing unit that executes instruction execution processing; and processing for converting a debug command into at least one primitive command provided outside the microcomputer. Data is transmitted / received to / from the second monitoring means to be executed, a primitive command to be executed is determined based on the received data from the second monitoring means, and a process for executing the determined primitive command is performed. And monitoring means.

本発明によれば、マイクロコンピュータの外部に設けられた第2のモニタ手段が、ホストシステム等が発行したデバッグコマンドをプリミティブコマンドに変換(分解)するための処理を行う。そして、第1のモニタ手段は、この第2のモニタ手段からデータを受信し、この受信データに基づいて決定されたプリミティブコマンドを実行するための処理を行う。本発明によれば、第1のモニタ手段の処理を実行するためのモニタプログラムに、各デバッグコマンドを実行するための複雑なルーチンを持たせる必要がなくなる。したがって、モニタプログラムの命令コードサイズを格段に小さくできるようになり、小さなハードウェア規模でオンチップデバッグ機能を実現できるようになる。   According to the present invention, the second monitoring means provided outside the microcomputer performs processing for converting (decomposing) a debug command issued by the host system or the like into a primitive command. The first monitor means receives data from the second monitor means and performs a process for executing the primitive command determined based on the received data. According to the present invention, the monitor program for executing the process of the first monitor means does not need to have a complicated routine for executing each debug command. Therefore, the instruction code size of the monitor program can be remarkably reduced, and an on-chip debugging function can be realized with a small hardware scale.

また本発明は、前記プリミティブコマンドが、ユーザプログラムの実行を開始するコマンド、デバッグモード時におけるメモリマップ上のアドレスにデータをライトするコマンド、及び前記メモリマップ上のアドレスからデータをリードするコマンドを含むことを特徴とする。このようにプリミティブコマンドをシンプルにすることで、モニタプログラムの命令コードサイズを更に小さくできるようになる。   In the present invention, the primitive command includes a command for starting execution of a user program, a command for writing data to an address on a memory map in a debug mode, and a command for reading data from an address on the memory map. It is characterized by that. Thus, by simplifying the primitive command, the instruction code size of the monitor program can be further reduced.

また本発明は、前記中央処理ユニットの命令実行処理に使用され、デバッグモード時におけるメモリマップ上にそのアドレスが割り付けられる制御レジスタを含むことを特徴とする。このようにすれば、デバッグモード時に制御レジスタを用いたデバッグ処理を行うことが可能になり、処理の簡易化、ハードウェアの小規模化を図れるようになる。   The present invention is also characterized in that it includes a control register which is used for instruction execution processing of the central processing unit and whose address is allocated on a memory map in debug mode. In this way, it becomes possible to perform a debugging process using the control register in the debug mode, thereby simplifying the process and reducing the hardware scale.

また本発明は、前記中央処理ユニットの内部レジスタの内容が退避され、デバッグモード時におけるメモリマップ上にそのアドレスが割り付けられるモニタRAMを含むことを特徴とする。このようにすれば、デバッグモード時に、内部レジスタの内容をリードしたりすることが可能になり、より多様なデバッグ機能を実現できるようになる。   The present invention also includes a monitor RAM in which the contents of the internal register of the central processing unit are saved and the address is allocated on the memory map in the debug mode. In this way, it is possible to read the contents of the internal register in the debug mode, thereby realizing a wider variety of debug functions.

また本発明は、前記第2のモニタ手段との間で半2重の双方向通信を行うための1本の双方向通信ラインが接続される端子を含み、スレーブとなる前記第1のモニタ手段が、マスタとなる前記第2のモニタ手段からデータを受信したことを条件に、該受信データに対応する処理を行い該受信データに対応する応答データを前記第2のモニタ手段に送信することを特徴とする。このようにすれば、マイクロコンピュータの端子(ピン)数を減らすことが可能となり、マイクロコンピュータの低コスト化を図れるようになる。また、第1、第2のモニタ手段の間の通信プロトコルを単純化でき、モニタプログラムの命令コードサイズを更に小さくできるようになる。   The present invention also includes a terminal to which one bidirectional communication line for performing half-duplex bidirectional communication with the second monitoring means is connected, and the first monitoring means serving as a slave. On the condition that data has been received from the second monitoring means serving as a master, and performing processing corresponding to the received data and transmitting response data corresponding to the received data to the second monitoring means. Features. In this way, the number of terminals (pins) of the microcomputer can be reduced, and the cost of the microcomputer can be reduced. Further, the communication protocol between the first and second monitoring means can be simplified, and the instruction code size of the monitor program can be further reduced.

また本発明は、前記第2のモニタ手段からの受信データが、前記第1のモニタ手段が実行するプリミティブコマンドの識別データを含むことを特徴とする。このようにすることで、プリミティブコマンドの実行の指示を簡易に第2のモニタ手段から第1のモニタ手段に伝えることが可能になる。   Further, the invention is characterized in that the received data from the second monitor means includes identification data of a primitive command executed by the first monitor means. In this way, it is possible to easily transmit an instruction to execute a primitive command from the second monitor unit to the first monitor unit.

また本発明は、前記第1のモニタ手段が、前記第2のモニタ手段との間で固定長のデータを送受信することを特徴とする。このようにすることで、第1のモニタ手段のモニタプログラムの命令コードサイズを更に小さくすることが可能になる。   Further, the present invention is characterized in that the first monitor means transmits and receives fixed-length data to and from the second monitor means. By doing so, it is possible to further reduce the instruction code size of the monitor program of the first monitor means.

また本発明は、前記第1のモニタ手段の処理を実行するためのモニタプログラムがROMに格納されていることを特徴とする。このようにすることで、RAMに比べて占有面積の小さいROMにモニタプログラムが格納されると共に、モニタプログラムをRAMにロードするロジック回路等が不要になる。したがって、マイクロコンピュータの更なる小規模化を図れるようになる。   The present invention is also characterized in that a monitor program for executing the processing of the first monitor means is stored in a ROM. By doing so, the monitor program is stored in a ROM that occupies a smaller area than the RAM, and a logic circuit for loading the monitor program into the RAM becomes unnecessary. Therefore, the microcomputer can be further downsized.

また本発明は、前記第1のモニタ手段が、第1のクロックを分周し、調歩同期式で送受信されるデータの各ビットをサンプリングするための第1のサンプリングクロックを生成する第1の分周回路と、前記第1のサンプリングクロックに基づいてデータを送受信する回路とを含み、前記第1のモニタ手段が、前記第2のモニタ手段が含む第2の分周回路が第2のサンプリングクロックを生成するための信号として、前記第1のクロックを、前記第2のモニタ手段に供給することを特徴とする。このように、サンプリングクロックを生成するための第1のクロックを第1、第2のモニタ手段で共有することで、通信データのサンプリングエラーの発生率を格段に低くすることが可能になると共に、通信速度の最適化、高速化を図れるようになる。   According to the present invention, the first monitor means divides the first clock and generates a first sampling clock for sampling each bit of data transmitted and received in an asynchronous manner. And a circuit for transmitting and receiving data based on the first sampling clock, wherein the first monitor means is a second frequency divider circuit included in the second monitor means is a second sampling clock. The first clock is supplied to the second monitor means as a signal for generating the signal. Thus, by sharing the first clock for generating the sampling clock between the first and second monitoring means, it is possible to significantly reduce the rate of occurrence of sampling errors in communication data, Communication speed can be optimized and increased.

また本発明は、前記第1のモニタ手段がリード及びライト可能なモニタRAMを含み、前記第1のモニタ手段が、ユーザプログラムの実行がブレークしデバッグモードに移行した場合に、前記中央処理ユニットのプログラムカウンタ値及び内部レジスタの内容を前記モニタRAMに待避することを特徴とする。このようにすることで、デバッグモードからユーザプログラム実行モードに戻った時に適正にユーザプログラムを実行できるようになる。また第1のモニタ手段が内部レジスタの内容等を利用して各種の処理を行うことも可能になる。   The present invention also includes a monitor RAM in which the first monitor means is readable and writable. When the first monitor means breaks the execution of the user program and shifts to the debug mode, the central processing unit The program counter value and the contents of the internal register are saved in the monitor RAM. By doing so, the user program can be properly executed when returning from the debug mode to the user program execution mode. Further, the first monitor means can perform various processes using the contents of the internal register.

また本発明に係る電子機器は、上記のいずれかのマイクロコンピュータと、前記マイクロコンピュータの処理対象となるデータの入力源と、前記マイクロコンピュータにより処理されたデータを出力するための出力装置とを含むことを特徴とする。このようにすれば、電子機器を動作させるプログラムなどのデバッグ作業の効率化を図れるようになり、電子機器の開発期間の短縮化、低コスト化を図れるようになる。   An electronic apparatus according to the present invention includes any one of the above microcomputers, an input source of data to be processed by the microcomputer, and an output device for outputting data processed by the microcomputer. It is characterized by that. In this way, it becomes possible to improve the efficiency of debugging work such as a program for operating the electronic device, thereby shortening the development period of the electronic device and reducing the cost.

また本発明は、マイクロコンピュータを含むターゲットシステムのためのデバッグシステムであって、ホストシステムが発行したデバッグコマンドを少なくとも1つのプリミティブコマンドに変換するための処理を行う第2のモニタ手段と、前記第2のモニタ手段との間でデータを送受信し、実行するプリミティブコマンドを前記第2のモニタ手段からの受信データに基づいて決定し、決定したプリミティブコマンドを実行するための処理を行う第1のモニタ手段とを含むこ 本発明によれば、第1のモニタ手段の処理を実行するためのモニタプログラムの命令コードサイズを格段に小さくできる。これにより、ユーザが自由に使用できるメモリ領域を増やすことが可能になる。また、ターゲットシステムを、実動作時の環境と同一の環境でデバッグできるデバッグシステムを提供できるようになる。   The present invention is also a debug system for a target system including a microcomputer, the second monitor means for performing processing for converting a debug command issued by a host system into at least one primitive command, A first monitor that transmits and receives data to and from the second monitoring means, determines a primitive command to be executed based on the received data from the second monitoring means, and performs processing for executing the determined primitive command According to the present invention, the instruction code size of the monitor program for executing the processing of the first monitor means can be remarkably reduced. This makes it possible to increase the memory area that the user can freely use. In addition, it is possible to provide a debugging system that can debug the target system in the same environment as the actual operating environment.

以下、本発明の好適な実施形態について図面を用いて詳細に説明する。   DESCRIPTION OF EMBODIMENTS Hereinafter, preferred embodiments of the present invention will be described in detail with reference to the drawings.

1.本実施形態の特徴
まず本実施形態の特徴について図2を用いて説明する。
1. Features of this embodiment First, features of this embodiment will be described with reference to FIG.

図2に示すように、本実施形態では、マイクロコンピュータ10が、CPU(中央処理ユニット)12及び本実施形態の要部であるミニモニタ部(第1のモニタ手段)14を含む。また、マイクロコンピュータ10の外部にはメインモニタ部(第2のモニタ手段)16が設けられている。ここでメインモニタ部16は、例えばホストシステムなどが発行したデバッグコマンドをプリミティブコマンドに変換(分解)するための処理を行う。また、ミニモニタ部14は、メインモニタ部16との間でデータを送受信する。そして、ミニモニタ部14は、実行するプリミティブコマンドを、メインモニタ部16からの受信データに基づいて決定し、プリミティブコマンドを実行するための処理を行う。   As shown in FIG. 2, in the present embodiment, the microcomputer 10 includes a CPU (central processing unit) 12 and a mini-monitor unit (first monitor means) 14 that is a main part of the present embodiment. A main monitor unit (second monitor means) 16 is provided outside the microcomputer 10. Here, the main monitor unit 16 performs processing for converting (decomposing) a debug command issued by, for example, a host system into a primitive command. The mini monitor unit 14 transmits and receives data to and from the main monitor unit 16. Then, the mini monitor unit 14 determines a primitive command to be executed based on the received data from the main monitor unit 16, and performs processing for executing the primitive command.

ここで、メインモニタ部16の変換処理の対象となるデバッグコマンドとしては、プログラムロード、GO、ステップ実行、メモリライト、メモリリード、内部レジスタライト、内部レジスタリード、ブレークポイント設定、ブレークポイント解除などのコマンドを考えることができる。メインモニタ部16は、これらの多様で複雑なデバッグコマンドを、例えばGO、ライト(デバッグモード時におけるメモリマップ上の所与のアドレスへのライト)、リード(メモリマップ上の所与のアドレスからのリード)などの、シンプルでプリミティブなコマンドに変換する処理を行う。このようにすることで、ミニモニタ部14の処理を行うミニモニタプログラムの命令コードサイズを格段に小さくすることができる。これにより、マイクロコンピュータ10のオンチップデバッグ機能を実現できるようになる。   Here, debug commands to be converted by the main monitor unit 16 include program load, GO, step execution, memory write, memory read, internal register write, internal register read, breakpoint setting, breakpoint release, etc. You can think of commands. The main monitor unit 16 sends these various complex debug commands to, for example, GO, write (write to a given address on the memory map in debug mode), read (from a given address on the memory map). (Read), etc., to convert to simple and primitive commands. In this way, the instruction code size of the mini monitor program that performs the processing of the mini monitor unit 14 can be significantly reduced. Thereby, the on-chip debugging function of the microcomputer 10 can be realized.

即ち、図1(B)に示すようなタイプのICEでは、モニタプログラム310は、プログラムロード、GO、ステップ実行などのデバッグコマンドの全ての処理ルーチンを有している。このため、モニタプログラム310の命令コードサイズが非常に大きくなり(例えば30〜50Kバイト)、モニタプログラム310をマイクロコンピュータ314に内蔵することは事実上困難となる。   That is, in the ICE of the type shown in FIG. 1B, the monitor program 310 has all processing routines for debug commands such as program load, GO, and step execution. For this reason, the instruction code size of the monitor program 310 becomes very large (for example, 30 to 50 Kbytes), and it becomes practically difficult to incorporate the monitor program 310 in the microcomputer 314.

これに対して、本実施形態では、ミニモニタ部14の処理を行うミニモニタプログラムは、GO、ライト、リードなどのシンプルなプリミティブコマンドの処理ルーチンのみを有し、命令コードサイズが非常に小さい(例えば256バイト)。したがって、ミニモニタプログラムをマイクロコンピュータ10に内蔵することが可能となり、オンチップデバッグ機能を実現できるようになる。また、ユーザが自由に使用できるメモリ領域の減少を最小限に抑える、あるいは全く減少させないようにすることが可能になる。   On the other hand, in the present embodiment, the mini monitor program that performs processing of the mini monitor unit 14 has only a simple primitive command processing routine such as GO, write, and read, and the instruction code size is very small (for example, 256 bytes). Therefore, the mini monitor program can be built in the microcomputer 10 and an on-chip debugging function can be realized. Further, it is possible to minimize the decrease in the memory area that can be freely used by the user or not to reduce it at all.

2.詳細な構成例
図3に本実施形態のマイクロコンピュータ及びデバッグシステムの詳細な構成例を示す。図3に示すように、マイクロコンピュータ20は、CPU22、BCU(バス制御ユニット)26、内部メモリ(ミニモニタROM42及びミニモニタRAM44以外の内部ROM及び内部RAM)28、クロック生成部30、ミニモニタ部40(第1のモニタ手段)、トレース部50を含む。
2. Detailed Configuration Example FIG. 3 shows a detailed configuration example of the microcomputer and debug system of the present embodiment. As shown in FIG. 3, the microcomputer 20 includes a CPU 22, a BCU (bus control unit) 26, an internal memory (an internal ROM and an internal RAM other than the mini monitor ROM 42 and the mini monitor RAM 44) 28, a clock generation unit 30, and a mini monitor unit 40 (first monitor). 1 monitoring means) and a trace unit 50.

ここでCPU22は、種々の命令の実行処理を行うものであり、内部レジスタ24を含む。内部レジスタ24は、汎用レジスタであるR0〜R15や、特殊レジスタであるSP(スタックポインタレジスタ)、AHR(積和結果データの上位レジスタ)、ALR(積和結果データの下位レジスタ)などを含む。   Here, the CPU 22 executes various instructions and includes an internal register 24. The internal registers 24 include general-purpose registers R0 to R15, special registers SP (stack pointer register), AHR (higher register of product-sum result data), ALR (lower register of product-sum result data), and the like.

BCU26はバスを制御するものである。例えば、CPU22に接続されるハーバードアーキテクチャのバス31や、内部メモリ28に接続されるバス32や、外部メモリ36に接続される外部バス33や、ミニモニタ部40、トレース部50などに接続される内部バス34の制御を行う。   The BCU 26 controls the bus. For example, a Harvard architecture bus 31 connected to the CPU 22, a bus 32 connected to the internal memory 28, an external bus 33 connected to the external memory 36, an internal connected to the mini monitor unit 40, the trace unit 50, and the like. The bus 34 is controlled.

またクロック生成部30は、マイクロコンピュータ20内で使用される各種のクロックを生成するものである。クロック生成部30はBCLKを介して外部のデバッグツール60にもクロックを供給している。   The clock generation unit 30 generates various clocks used in the microcomputer 20. The clock generation unit 30 also supplies a clock to the external debug tool 60 via BCLK.

ミニモニタ部40は、ミニモニタROM42、ミニモニタRAM44、制御レジスタ46、SIO48を含む。   The mini monitor unit 40 includes a mini monitor ROM 42, a mini monitor RAM 44, a control register 46, and an SIO 48.

ここで、ミニモニタROM42には、ミニモニタプログラムが格納される。本実施形態では、このミニモニタプログラムは、GO、リード、ライトなどのシンプルでプリミティブなコマンドの処理のみを行うようになっている。このため、ミニモニタROM42のメモリ容量を例えば256バイト程度に抑えることができ、オンチップデバッグ機能を持たせながらマイクロコンピュータ20を小規模化できるようになる。   Here, the mini monitor ROM 42 stores a mini monitor program. In the present embodiment, this mini monitor program only processes simple and primitive commands such as GO, read, and write. For this reason, the memory capacity of the mini-monitor ROM 42 can be suppressed to, for example, about 256 bytes, and the microcomputer 20 can be reduced in size while having an on-chip debugging function.

ミニモニタRAM44には、デバッグモードへの移行時に(ユーザプログラムのブレーク発生時に)、CPU22の内部レジスタ24の内容が退避される。これにより、デバッグモードの終了後にユーザプログラムの実行を適正に再スタートできるようになる。また内部レジスタの内容のリード等を、ミニモニタプログラムが持つプリミティブなリードコマンド等で実現できるようになる。   The content of the internal register 24 of the CPU 22 is saved in the mini monitor RAM 44 when the mode is shifted to the debug mode (when a break of the user program occurs). As a result, the execution of the user program can be restarted properly after the debug mode ends. In addition, reading of the contents of the internal register can be realized by a primitive read command etc. possessed by the mini monitor program.

制御レジスタ46は、各種のデバッグ処理を制御するためのレジスタであり、ステップ実行イネーブルビット、ブレークイネーブルビット、ブレークアドレスビット、トレースイネーブルビットなどを有する。ミニモニタプログラムにより動作するCPU22が制御レジスタ46の各ビットにデータをライトしたり、各ビットのデータをリードすることで、各種のデバッグ処理が実現される。   The control register 46 is a register for controlling various debugging processes, and includes a step execution enable bit, a break enable bit, a break address bit, a trace enable bit, and the like. Various debugging processes are realized by the CPU 22 operating by the mini-monitor program writing data to each bit of the control register 46 or reading the data of each bit.

SIO48は、マイクロコンピュータ20の外部に設けられたデバッグツール60との間でデータを送受信するためのものである。SIO48とデバッグツール60との間は、TXD/RXD(データ送受信ライン)で接続されている。   The SIO 48 is for transmitting and receiving data to and from the debug tool 60 provided outside the microcomputer 20. The SIO 48 and the debug tool 60 are connected by TXD / RXD (data transmission / reception line).

トレース部50は、リアルタイムトレース機能を実現するためのものである。トレース部50とデバッグツール60との間は、CPU22の命令実行のステートを表す3ビットのDST[2:0]と、分岐先のPC(プログラムカウンタ)値を表すDPCOという4本のラインで接続されている。   The trace unit 50 is for realizing a real-time trace function. The trace unit 50 and the debug tool 60 are connected by four lines of 3-bit DST [2: 0] representing the instruction execution state of the CPU 22 and DPCO representing the branch destination PC (program counter) value. Has been.

デバッグツール60はメインモニタ部62を含み、パーソナルコンピュータ等により実現されるホストシステム66に接続される。ホストシステム66が、ユーザの操作により、プログラムロード、ステップ実行などのデバッグコマンドを発行すると、メインモニタ部62が、このデバッグコマンドをプリミティブコマンドに変換(分解)するための処理を行う。そして、メインモニタ部62が、プリミティブコマンドの実行を指示するデータをミニモニタ部40に送信すると、ミニモニタ部40が、指示されたプリミティブコマンドを実行するための処理を行うことになる。   The debug tool 60 includes a main monitor unit 62 and is connected to a host system 66 realized by a personal computer or the like. When the host system 66 issues a debug command such as program load or step execution by a user operation, the main monitor unit 62 performs processing for converting (decomposing) the debug command into a primitive command. When the main monitor unit 62 transmits data instructing execution of a primitive command to the mini-monitor unit 40, the mini-monitor unit 40 performs processing for executing the instructed primitive command.

図4に、デバッグモード時のメモリマップの例を示す。図4のD1、D2、D3に示すように、デバッグモード時には、図3の制御レジスタ46、ミニモニタRAM44、ミニモニタROM42のアドレスも、メモリマップ上に割り付けられる。   FIG. 4 shows an example of a memory map in the debug mode. As indicated by D1, D2, and D3 in FIG. 4, in the debug mode, the addresses of the control register 46, mini monitor RAM 44, and mini monitor ROM 42 in FIG. 3 are also allocated on the memory map.

3.プリミティブコマンドへの変換
図5(A)、(B)、(C)、(D)に、各種のデバッグコマンドをプリミティブコマンドへ変換する処理について模式的に示す。
3. Conversion to Primitive Command FIGS. 5A, 5B, 5C, and 5D schematically show processing for converting various debug commands to primitive commands.

例えば図5(A)に示すように、(ADD・・・、SUB・・・、AND・・・、OR・・・、XOR・・・、LD.W・・・)という12バイトのプログラムを80010h番地にロードするというデバッグコマンドが発行されたとする。この場合、このプログラムロードコマンドは、ライト(80010h、ADD・・・、SUB)、ライト(80014h、AND・・・、OR・・・)、ライト(80018h、XOR・・・、LD.W・・・)という3つのプリミティブなライトコマンドに変換される。即ち、ミニモニタプログラムが、この3つのプリミティブなライトコマンドを実行することで、プログラムロードコマンドが実現されるようになる。   For example, as shown in FIG. 5A, a 12-byte program (ADD ..., SUB ..., AND ..., OR ..., XOR ..., LD.W ...) Assume that a debug command for loading at address 80010h is issued. In this case, the program load command includes write (80010h, ADD ..., SUB), write (80013h, AND ..., OR ...), write (80018h, XOR ..., LD.W ... .) Is converted into three primitive write commands. That is, the program load command is realized by the mini monitor program executing these three primitive write commands.

また図5(B)に示すようにステップ実行コマンドというデバッグコマンドが発行されたとする。すると、このステップ実行コマンドは、図3の制御レジスタ46のステップ実行イネーブルビットへのライトコマンド(図4のD1のアドレスへのライトコマンド)とGOコマンドに変換される。即ち、ミニモニタプログラムが、このプリミティブなライトコマンドとGOコマンドを実行することで、ステップ実行コマンドが実現されるようになる。   Assume that a debug command called a step execution command is issued as shown in FIG. Then, this step execution command is converted into a write command to the step execution enable bit of the control register 46 in FIG. 3 (write command to the address D1 in FIG. 4) and a GO command. That is, the mini monitor program executes the primitive write command and the GO command, thereby realizing a step execution command.

また図5(C)に示すように内部レジスタリードコマンドというデバッグコマンドが発行されたとする。すると、この内部レジスタリードコマンドは、メモリマップ上のミニモニタRAM44(内部レジスタの内容の退避先)からのリードコマンド(図4のD2のアドレスからのリードコマンド)に変換される。即ち、ミニモニタプログラムが、このプリミティブなリードコマンドを実行することで、内部レジスタリードコマンドが実現されるようになる。内部レジスタライトコマンド、メモリリードコマンド、メモリライトコマンドも同様にして実現される。   Assume that a debug command called an internal register read command is issued as shown in FIG. Then, the internal register read command is converted into a read command (read command from the address D2 in FIG. 4) from the mini-monitor RAM 44 (a save destination of the contents of the internal register) on the memory map. That is, when the mini monitor program executes this primitive read command, the internal register read command is realized. The internal register write command, memory read command, and memory write command are also realized in the same manner.

また図5(D)に示すようにブレークポイント設定コマンドというデバッグコマンドが発行されたとする。すると、このブレークポイント設定コマンドは、制御レジスタ46のブレークイネーブルビット及びブレークアドレスビットへのライトコマンドに変換される。即ち、ミニモニタプログラムが、このプリミティブなライトコマンドを実行することで、ブレークポイント設定コマンドが実現されるようになる。   Assume that a debug command called a breakpoint setting command is issued as shown in FIG. Then, this breakpoint setting command is converted into a write command to the break enable bit and break address bit of the control register 46. That is, the breakpoint setting command is realized by the mini monitor program executing this primitive write command.

このように本実施形態では、複雑で多様なデバッグコマンドが、プリミティブでシンプルなリード、ライト、GOコマンドに変換される。そして、ミニモニタプログラムは、このプリミティブなリード、ライト、GOコマンドを実行するだけでよいため、ミニモニタプログラムの命令コードサイズは非常に小さくなる。この結果、ミニモニタROM42のメモリ容量も小さくでき、小さなハードウェア規模でオンチップデバッグ機能を実現できるようになる。   As described above, in this embodiment, complicated and various debug commands are converted into primitive, simple read, write, and GO commands. Since the mini-monitor program only needs to execute these primitive read, write, and GO commands, the instruction code size of the mini-monitor program becomes very small. As a result, the memory capacity of the mini monitor ROM 42 can be reduced, and an on-chip debugging function can be realized with a small hardware scale.

4.SIOの構成例
図6にSIO48の構成例を示す。SIO48は、送受信バッファ70、シフトレジスタ76、送受信切替部78、クロック制御部80及び制御レジスタ84を含む。
4). Configuration Example of SIO FIG. 6 shows a configuration example of the SIO 48. The SIO 48 includes a transmission / reception buffer 70, a shift register 76, a transmission / reception switching unit 78, a clock control unit 80, and a control register 84.

ここで送受信バッファ70は、送信データ、受信データを一時的に蓄えるためのものであり、送信バッファ72、受信バッファ74を有する。シフトレジスタ76は、送信バッファ72からの送信データをパラレルデータからシリアルデータに変換し送受信切替部78に出力する機能を有する。また送受信切替部78からの受信データをシリアルデータからパラレルデータに変換し受信バッファ74に出力する機能も有する。送受信切替部78は、データの送信と受信とを切り替えるためのものである。これにより、TXD/RXDを使用した半2重のデータ送受信が可能になる。   Here, the transmission / reception buffer 70 is for temporarily storing transmission data and reception data, and includes a transmission buffer 72 and a reception buffer 74. The shift register 76 has a function of converting transmission data from the transmission buffer 72 from parallel data to serial data and outputting it to the transmission / reception switching unit 78. Also, it has a function of converting received data from the transmission / reception switching unit 78 from serial data to parallel data and outputting it to the reception buffer 74. The transmission / reception switching unit 78 is for switching between transmission and reception of data. As a result, half-duplex data transmission / reception using TXD / RXD becomes possible.

クロック制御部80は、内蔵する分周回路82によりBCLKを分周し、この分周により得られたサンプリングクロックSMC1をシフトレジスタ76に出力する。シフトレジスタ76は、このSMC1に基づき動作する。またクロック制御部80は、デバッグツール60にBCLKを供給する。これにより、マイクロコンピュータ20とデバッグツール60により、BCLKが共有されるようになる。   The clock control unit 80 divides BCLK by the built-in frequency dividing circuit 82, and outputs the sampling clock SMC 1 obtained by this frequency division to the shift register 76. The shift register 76 operates based on this SMC1. The clock control unit 80 supplies BCLK to the debug tool 60. As a result, the BCLK is shared by the microcomputer 20 and the debug tool 60.

分周回路82での分周比は制御レジスタ84により設定される。即ちCPU22により実行されるミニモニタプログラムが、所望の分周比を制御レジスタ84に書き込むことで、分周回路82での分周比が設定されることになる。なお、制御レジスタ84のアドレスも、図3の制御レジスタ46と同様に、図4のD1の位置に割り付けられている。   The frequency dividing ratio in the frequency dividing circuit 82 is set by the control register 84. That is, the mini monitor program executed by the CPU 22 writes a desired frequency dividing ratio in the control register 84, whereby the frequency dividing ratio in the frequency dividing circuit 82 is set. The address of the control register 84 is also assigned to the position D1 in FIG. 4 in the same manner as the control register 46 in FIG.

5.デバッグツールの構成例
図7にデバッグツール60の構成例を示す。
5). Configuration Example of Debug Tool FIG. 7 shows a configuration example of the debug tool 60.

CPU90は、ROM108に格納されるプログラムを実行したり、デバッグツール60の全体の制御を行うものである。送受信切替部92は、データの送信と受信とを切り替えるためのものである。クロック制御部94は、CPU90のSCLK端子、アドレスアップカウンタ100、トレースメモリ104に供給するクロックを制御するものである。このクロック制御部94には、マイクロコンピュータ20(SIO48)からのBCLKが入力される。クロック制御部94は周波数検出回路95、分周回路96を含む。周波数検出回路95は、BCLKの周波数が属する周波数範囲を検出して、その結果を制御レジスタ98に出力する。また分周回路96での分周比は制御レジスタ98により制御される。即ちCPU90により実行されるメインモニタプログラム(メインモニタROM110に格納)が、制御レジスタ98からBCLKの周波数範囲を読み出す。そして、メインモニタプログラムは、この周波数範囲に応じた最適な分周比を決定し、この分周比を制御レジスタ98に書き込む。そして、分周回路96は、この分周比でBCLKを分周してSMC2を生成し、CPU90のSCLK端子に出力する。   The CPU 90 executes a program stored in the ROM 108 and controls the entire debug tool 60. The transmission / reception switching unit 92 is for switching between transmission and reception of data. The clock control unit 94 controls a clock supplied to the SCLK terminal of the CPU 90, the address up counter 100, and the trace memory 104. The clock control unit 94 receives BCLK from the microcomputer 20 (SIO 48). The clock control unit 94 includes a frequency detection circuit 95 and a frequency dividing circuit 96. The frequency detection circuit 95 detects the frequency range to which the BCLK frequency belongs, and outputs the result to the control register 98. The frequency dividing ratio in the frequency dividing circuit 96 is controlled by the control register 98. That is, the main monitor program (stored in the main monitor ROM 110) executed by the CPU 90 reads the frequency range of BCLK from the control register 98. Then, the main monitor program determines an optimum frequency division ratio corresponding to this frequency range, and writes this frequency division ratio in the control register 98. Then, the frequency dividing circuit 96 divides BCLK by this frequency dividing ratio to generate SMC2, and outputs it to the SCLK terminal of the CPU 90.

アドレスアップカウンタ100は、トレースメモリのアドレスをカウントアップするためのものである。セレクタ102は、ライン122(アドレスアップカウンタ100が出力するアドレス)とライン124(アドレスバス120からのアドレス)のいずれかを選択し、トレースメモリ104のアドレス端子にデータを出力する。またセレクタ106は、ライン126(図3のトレース部50の出力であるDST[2:0]、DPCO)とライン128(データバス118)のいずれかを選択し、トレースメモリ104のデータ端子にデータを出力したり、データ端子からデータを取り出す。   The address up counter 100 is for counting up the address of the trace memory. The selector 102 selects either the line 122 (address output from the address up counter 100) or the line 124 (address from the address bus 120), and outputs data to the address terminal of the trace memory 104. The selector 106 selects either the line 126 (DST [2: 0], DPCO which is the output of the trace unit 50 in FIG. 3) or the line 128 (data bus 118), and the data is input to the data terminal of the trace memory 104. Or retrieve data from the data terminal.

ROM108はメインモニタROM110(図3のメインモニタ部62に相当)を含み、メインモニタROM110には、メインモニタプログラムが格納される。このメインモニタプログラムは、図5(A)〜図5(D)で説明したように、デバッグコマンドをプリミティブコマンドに変換するための処理を行う。RAM112は、CPU90のワーク領域となるものである。   The ROM 108 includes a main monitor ROM 110 (corresponding to the main monitor unit 62 in FIG. 3), and the main monitor ROM 110 stores a main monitor program. As described with reference to FIGS. 5A to 5D, the main monitor program performs processing for converting a debug command into a primitive command. The RAM 112 serves as a work area for the CPU 90.

RS232Cインターフェース114、パラレルインターフェース116は、図3のホストシステム66とのインターフェースとなるものであり、ホストシステム66からのデバッグコマンドはこれらのインターフェースを介してCPU90に入力されることになる。クロック生成部118は、CPU90を動作させるクロックなどを生成するものである。   The RS232C interface 114 and the parallel interface 116 serve as an interface with the host system 66 of FIG. 3, and debug commands from the host system 66 are input to the CPU 90 via these interfaces. The clock generation unit 118 generates a clock for operating the CPU 90 and the like.

次に本実施形態でのリアルタイムトレース処理について簡単に説明する。本実施形態では、図3のCPU22の命令実行のステートを表す3ビットのDST[2:0]と、分岐先のPC値を表すDPCOをトレースメモリ104に蓄える。そして、トレースメモリ104に蓄えられたデータと、ユーザプログラムのソースコードとに基づいて、トレースデータを合成する。このようにすることで、マイクロコンピュータ20とデバッグツール60との間の接続ラインの本数を少なくしながら、リアルタイムトレース機能を実現することが可能になる。   Next, the real-time trace processing in this embodiment will be briefly described. In the present embodiment, 3-bit DST [2: 0] representing the instruction execution state of the CPU 22 in FIG. 3 and DPCO representing the branch destination PC value are stored in the trace memory 104. Then, the trace data is synthesized based on the data stored in the trace memory 104 and the source code of the user program. By doing so, it is possible to realize a real-time trace function while reducing the number of connection lines between the microcomputer 20 and the debug tool 60.

ユーザプログラム実行モードにおいては、ライン122が選択され、セレクタ102を介してアドレスアップカウンタ100の出力がトレースメモリ104のアドレス端子に入力される。また、ライン126が選択され、セレクタ106を介してDST[2:0]、DPCOがトレースメモリ105のデータ端子に入力される。ここでアドレスアップカウンタ100には、まず最初に、データバス118、アドレスバス120を用いてCPU90により図8(A)に示すようなスタートアドレスが設定される。またアドレスアップカウンタ100のST/SP(開始/停止)端子には、トレース範囲を特定するDST[2]のラインが接続される。そして図8(B)に示すように、DST[2]のラインに第1のパルス130が入力されると、アドレスアップカウンタ100のアドレスアップカウントが開始する。そして、DST[2]のラインに第2のパルス132が入力されると、アドレスアップカウンタ100のアドレスアップカウントが停止し、トレース動作が停止する。このようにして、所望のトレース範囲でのデータ(DST[2:0]、DPCO)をトレースメモリ104に蓄えることが可能になる。   In the user program execution mode, the line 122 is selected, and the output of the address up counter 100 is input to the address terminal of the trace memory 104 via the selector 102. In addition, the line 126 is selected, and DST [2: 0] and DPCO are input to the data terminal of the trace memory 105 via the selector 106. Here, in the address up counter 100, first, the start address as shown in FIG. 8A is set by the CPU 90 using the data bus 118 and the address bus 120. The ST / SP (start / stop) terminal of the address up counter 100 is connected to the DST [2] line for specifying the trace range. Then, as shown in FIG. 8B, when the first pulse 130 is input to the line DST [2], the address upcount of the address upcounter 100 starts. When the second pulse 132 is input to the DST [2] line, the address upcount of the address upcounter 100 is stopped and the trace operation is stopped. In this way, data (DST [2: 0], DPCO) in a desired trace range can be stored in the trace memory 104.

一方、ユーザプログラム実行モードからデバッグモードに移行すると、ライン124が選択され、セレクタ102を介してアドレスバス120からのアドレスがトレースメモリ104のアドレス端子に入力される。またライン128が選択され、セレクタ106を介してトレースメモリ104からのデータがデータバス118に出力される。これにより、トレースメモリ104に蓄えられたデータ(DST[2:0]、DPCO)を、デバッグモード時にCPU90(メインモニタプログラム)が読み出すことが可能になる。そして、読み出されたデータとユーザープログラムのソースコードとに基づいて、トレースデータを合成することが可能になる。   On the other hand, when shifting from the user program execution mode to the debug mode, the line 124 is selected, and the address from the address bus 120 is input to the address terminal of the trace memory 104 via the selector 102. The line 128 is selected, and the data from the trace memory 104 is output to the data bus 118 via the selector 106. As a result, the data stored in the trace memory 104 (DST [2: 0], DPCO) can be read by the CPU 90 (main monitor program) in the debug mode. Then, it becomes possible to synthesize trace data based on the read data and the source code of the user program.

6.データの送受信
さて、図9(A)に示すように、ミニモニタ部40とメインモニタ部62の間でのデバッグデータの通信の手法としては、TXD(送信)とRXD(受信)のラインを別々に設け、全2重で通信する手法が考えられる。
6). Transmission / Reception of Data As shown in FIG. 9A, as a method of communication of debug data between the mini monitor unit 40 and the main monitor unit 62, TXD (transmission) and RXD (reception) lines are separately set. A method of providing full duplex communication is conceivable.

しかしながら、このようにデバッグデータの通信のために2本のライン(端子)を使用してしまうと、その分だけマイクロコンピュータの端子数(ピン数)が増えてしまい、これはマイクロコンピュータの高コスト化を招く。   However, if two lines (terminals) are used for communication of debug data in this way, the number of terminals (number of pins) of the microcomputer increases accordingly, which is a high cost of the microcomputer. Invite

そこで本実施形態では、図9(B)に示すように、ミニモニタ部40とメインモニタ部62との間に1本のTXD/RXDライン(双方向通信ライン)を設け、半2重の双方向通信を行う。このようにすることで、マイクロコンピュータの端子数の増加を最小限に抑えることができ、マイクロコンピュータの低コスト化を図れる。   Therefore, in the present embodiment, as shown in FIG. 9B, a single TXD / RXD line (bidirectional communication line) is provided between the mini monitor unit 40 and the main monitor unit 62, and a half duplex bidirectional operation is performed. Communicate. By doing so, an increase in the number of terminals of the microcomputer can be minimized, and the cost of the microcomputer can be reduced.

そして更に本実施形態では、図9(C)に示すように、スレーブとなるミニモニタ部40が、マスタとなるメインモニタ部62からデータを受信したことを条件に、その受信データに対応する処理を行い、その受信データに対応する応答データをメインモニタ部62に送信する。即ち、メインモニタ部62がデータ(コマンド)をミニモニタ部40に送信すると、ウェイト状態となっていたミニモニタ部40がこれを受信し、その受信データに対応する処理を行う。そして、その受信データに対応するデータ(リプライ)をメインモニタ部62に送信する。その後、ミニモニタ部40は、メインモニタ部62からデータを受信するまでウェイト状態になる。即ちミニモニタ部40は、メインモニタ部62からデータを受信するまで動作を停止し、データを受信したことを条件に動作を開始する。このようにすることで、ミニモニタ部40とメインモニタ部62との間の通信ラインを1本にしながら、データを適正に送受信できるようになる。   Further, in the present embodiment, as shown in FIG. 9C, the processing corresponding to the received data is performed on condition that the mini-monitor unit 40 serving as the slave has received data from the main monitor unit 62 serving as the master. The response data corresponding to the received data is transmitted to the main monitor unit 62. That is, when the main monitor unit 62 transmits data (command) to the mini-monitor unit 40, the mini-monitor unit 40 in the wait state receives this, and performs processing corresponding to the received data. Then, data (reply) corresponding to the received data is transmitted to the main monitor unit 62. Thereafter, the mini monitor unit 40 waits until data is received from the main monitor unit 62. That is, the mini monitor unit 40 stops operating until data is received from the main monitor unit 62, and starts operating on the condition that the data has been received. In this way, data can be properly transmitted and received while the communication line between the mini monitor unit 40 and the main monitor unit 62 is single.

さて、図9(A)の通信手法は、TXDとRXDが別ラインになっているため、図9(B)に比べてデータを高速に通信できるという利点がある。また、ミニモニタ部40、メインモニタ部62の一方で通信エラーが発生した場合に、即座にエラーメッセージを他方に返すことができるという利点もある。例えば、ミニモニタ部40で通信エラーが発生した場合には、RXDでのデータ受信の終了を待つことなくTXDを使用して即座にエラーメッセージをメインモニタ部62に返すことができる。   The communication method of FIG. 9A has an advantage that data can be communicated at higher speed than FIG. 9B because TXD and RXD are on separate lines. There is also an advantage that when a communication error occurs in one of the mini monitor unit 40 and the main monitor unit 62, an error message can be immediately returned to the other. For example, when a communication error occurs in the mini monitor unit 40, an error message can be immediately returned to the main monitor unit 62 using TXD without waiting for the end of data reception by RXD.

一方、本実施形態では後述するように、ミニモニタ部40とメインモニタ部62とでBCLKを共有させている。これにより後述するように、最適な速度で高速にデータを通信できるようになる。したがって、図9(A)のような通信ラインを2本設ける構成にせずに、図9(B)のように通信ラインを1本だけ設ける構成にしても、問題なくデバッグデータを高速に送受信できるようになる。   On the other hand, in the present embodiment, the BCLK is shared by the mini monitor unit 40 and the main monitor unit 62 as described later. As a result, as described later, data can be communicated at high speed at an optimum speed. Therefore, debug data can be transmitted and received at high speed without any problem even if only one communication line is provided as shown in FIG. 9B instead of the two communication lines as shown in FIG. 9A. It becomes like this.

また、本実施形態では後述するように、送受信データは固定長でありデータ長が短い(例えば14バイト)。したがって、例えばミニモニタ部40で通信エラーが発生した場合、受信処理の終了を待ってからエラーメッセージを送信しても、時間的な遅れはそれほど大きくならない。また、送受信データのデータ長が短いため、通信エラーの発生自体も最小限に抑えることができる。   In this embodiment, as will be described later, transmission / reception data has a fixed length and a short data length (for example, 14 bytes). Therefore, for example, when a communication error occurs in the mini-monitor unit 40, even if an error message is transmitted after waiting for the end of the reception process, the time delay is not so great. In addition, since the data length of the transmission / reception data is short, the occurrence of a communication error itself can be minimized.

このように本実施形態では、デバッグデータの通信ラインを1本だけ設ける構成にすることでマイクロコンピュータの端子数を減らすという利益を得ている。そしてこの利益を得るために生じる不利益(通信速度の低下、エラーメッセージの遅延)を、BCLKを共有化したり送受信データを固定長の短いデータにすることで解消している。   As described above, the present embodiment has an advantage of reducing the number of terminals of the microcomputer by providing only one debug data communication line. Disadvantages (decrease in communication speed, error message delay) that occur in order to obtain this benefit are eliminated by sharing BCLK or making transmission / reception data short data of a fixed length.

7.送受信データのフォーマット及び種類
図10(A)に、TXD/RXDのラインで送受信されるデータのフォーマット例を示す。送受信データは、1バイトのID(コマンド識別データ)、1バイトのデータサイズ、4バイトのアドレス、4バイトのデータ1、4バイトのデータ2から成る14バイトの固定長データになっている。
7). Format and Type of Transmission / Reception Data FIG. 10A shows a format example of data transmitted / received through the TXD / RXD line. The transmission / reception data is 14-byte fixed length data composed of 1-byte ID (command identification data), 1-byte data size, 4-byte address, 4-byte data 1, and 4-byte data 2.

図10(B)に示すように、メインモニタ部62がミニモニタ部40にGOコマンドの実行を指示する場合、ミニモニタ部40が受信するデータのIDには、GOコマンドの識別データである00hが設定される。そしてこの場合には、ミニモニタ部40は、メインモニタ部62にデータを送信しない。   As shown in FIG. 10B, when the main monitor unit 62 instructs the mini monitor unit 40 to execute the GO command, the ID of the data received by the mini monitor unit 40 is set to 00h which is identification data of the GO command. Is done. In this case, the mini monitor unit 40 does not transmit data to the main monitor unit 62.

図10(C)に示すように、メインモニタ部62がライトコマンドの実行を指示する場合、ミニモニタ部40の受信データのIDには、ライトコマンドの識別データである01hが設定される。また受信データのアドレス、データ1、データ2には、各々、ライトアドレス、ライトデータ1、ライトデータ2が設定される。そして、ミニモニタ部40の送信データのデータ1には01hが設定される。   As shown in FIG. 10C, when the main monitor unit 62 instructs the execution of the write command, the ID of the received data of the mini monitor unit 40 is set to 01h that is the identification data of the write command. Further, the write address, the write data 1, and the write data 2 are set in the received data address, data 1, and data 2, respectively. Then, 01h is set in the data 1 of the transmission data of the mini monitor unit 40.

なお、ライトコマンドを、バイトデータのライトコマンド、ハーフワードデータのライトコマンド、ワードデータのライトコマンド、ダブルワードデータのライトコマンドというように、ライトするデータの長さに応じて複数種類用意するようにしてもよい。このようにした場合には、各々のライトコマンドに対して異なったIDを割り振ることになる。   A plurality of types of write commands, such as a byte data write command, a half word data write command, a word data write command, and a double word data write command, are prepared according to the length of data to be written. May be. In this case, a different ID is assigned to each write command.

図10(D)に示すように、メインモニタ部62がリードコマンドの実行を指示する場合、ミニモニタ部40の受信データのIDには、リードコマンドの識別データである02hが設定される。また受信データのアドレスにはリードアドレスが設定される。そして、ミニモニタ部40の送信データのデータ1、データ2には、各々、リードコマンド処理で得られたリードデータ1、リードデータ2が設定される。   As shown in FIG. 10D, when the main monitor unit 62 instructs the execution of the read command, the received data ID of the mini monitor unit 40 is set to 02h, which is the identification data of the read command. A read address is set as the address of the received data. The read data 1 and the read data 2 obtained by the read command process are set in the data 1 and the data 2 of the transmission data of the mini monitor unit 40, respectively.

さて、本実施形態では、ミニモニタ部62が実行するプリミティブコマンドとして、GO、ライト、リードコマンド以外にも、外部ルーチンジャンプ、データフィルなどのコマンドを用意している。   In the present embodiment, commands such as an external routine jump and data fill are prepared as primitive commands to be executed by the mini monitor unit 62 in addition to GO, write, and read commands.

ここで外部ルーチンジャンプコマンドは、外部ルーチンにジャンプすることを指示するコマンドである。このような外部ルーチンジャンプコマンドを用いることで、例えばフラッシュメモリ(EEPROM)の初期化プログラムや書き込みプログラムのルーチンへのジャンプが可能になる。そして図11(A)に示すように、メインモニタ部62が外部ルーチンジャンプコマンドの実行を指示する場合、ミニモニタ部40の受信データのIDには、外部ルーチンジャンプコマンドの識別データである03hが設定される。また受信データのデータサイズ、アドレス、データ1、データ2には、各々、18h(誤動作防止チェック)、%R12(ルーチンアドレス)、%R13(ライトデータ)、%R14(データアドレス)が設定される。そして、ミニモニタ部40の送信データのデータ1には、%R10(戻り値。戻り値が0の場合に正常終了)が設定される。   Here, the external routine jump command is a command for instructing to jump to the external routine. By using such an external routine jump command, for example, it is possible to jump to a routine of an initialization program or a writing program of a flash memory (EEPROM). As shown in FIG. 11A, when the main monitor unit 62 instructs execution of the external routine jump command, the ID of the reception data of the mini monitor unit 40 is set to 03h which is identification data of the external routine jump command. Is done. Also, 18h (malfunction prevention check),% R12 (routine address),% R13 (write data), and% R14 (data address) are set in the data size, address, data 1 and data 2 of the received data, respectively. . Then,% R10 (return value. When the return value is 0, normal termination) is set in the data 1 of the transmission data of the mini-monitor unit 40.

またデータフィルコマンドは、メモリを所与の値(例えば0)でフィルするためのコマンドである。例えば大容量のメモリの全てのビットを0の値に設定する場合、ライトコマンドを用いたのでは処理時間が非常に長くなる。このような場合、データフィルコマンドが有効になる。そして図11(B)に示すように、メインモニタ部62がデータフィルコマンドの実行を指示する場合、ミニモニタ部40の受信データのIDには、データフィルコマンドの識別データである04hが設定される。また受信データのデータサイズ、アドレス、データ1、データ2には、各々、データサイズである1、2又は4、スタートアドレス、フィル回数、フィルパターンが設定される。   The data fill command is a command for filling the memory with a given value (for example, 0). For example, when all bits of a large-capacity memory are set to a value of 0, the processing time becomes very long if a write command is used. In such a case, the data fill command becomes valid. As shown in FIG. 11B, when the main monitor unit 62 instructs execution of the data fill command, the ID of the received data of the mini monitor unit 40 is set to 04h that is identification data of the data fill command. . The data size, address, data 1 and data 2 of the received data are set with data size 1, 2 or 4, start address, fill count and fill pattern, respectively.

このように本実施形態では、メインモニタ部62からの受信データに、ミニモニタ部40が実行するプリミティブコマンドの識別データIDを含ませている。このようにすることで、プリミティブコマンドの実行の指示を簡易にミニモニタ部40に伝えることが可能になる。   As described above, in this embodiment, the reception data from the main monitor unit 62 includes the identification data ID of the primitive command executed by the mini monitor unit 40. In this way, it is possible to easily transmit an instruction to execute a primitive command to the mini monitor unit 40.

8.固定長の送受信データ
本実施形態では図10(A)に示すように、ミニモニタ部40、メインモニタ部62間の送受信データを14バイトの固定長のデータにしている。このようにすることで、ミニモニタプログラムの命令コードサイズを更に小さくすることが可能になる。
8). In this embodiment, as shown in FIG. 10A, the transmission / reception data between the mini-monitor unit 40 and the main monitor unit 62 is 14-byte fixed-length data. In this way, the instruction code size of the mini monitor program can be further reduced.

即ち送受信データを可変長にすると、図12(A)のE1、E2、E3に示す処理部分(命令列)が、ほとんど全てのコマンドについて必要になる。これらのE1、E2、E3の処理部分は、どれだけのデータ数の処理が必要かを判断する部分である。即ち可変長データを処理する場合には、送受信データに含まれるデータサイズに基づいて、処理すべきデータの数を調べる必要がある。そして、そのデータ数を、例えばワーク領域であるRAM上に保持しておいて、1つのデータの処理が終了する毎にこのデータ数をデクリメントしたり、データ数が0になったか否かを判断したりする処理が必要になる。このため、図12(A)に示すように、ミニモニタプログラムのソースコードのサイズが大きくなる。   That is, when the transmission / reception data is variable length, the processing parts (instruction sequences) indicated by E1, E2, and E3 in FIG. 12A are necessary for almost all commands. These processing parts E1, E2, and E3 are parts for determining how many data processes are necessary. That is, when processing variable-length data, it is necessary to check the number of data to be processed based on the data size included in the transmission / reception data. Then, the number of data is held on, for example, a RAM that is a work area, and each time processing of one data is finished, the number of data is decremented or it is determined whether or not the number of data becomes zero. Processing is required. For this reason, as shown in FIG. 12A, the size of the source code of the mini monitor program is increased.

これに対して、本実施形態では、送受信データを固定長にしている。このため、図12(A)と図12(B)を比較すればわかるように、ミニモニタプログラムのソースコードのサイズを可変長の場合に比べて例えば2/3程度にできる。これにより、図3のミニモニタROM42のサイズを更に小さくでき、小さなハードウェア規模でオンチップデバッグ機能を実現できるようになる。   On the other hand, in this embodiment, the transmission / reception data has a fixed length. For this reason, as can be seen by comparing FIG. 12A and FIG. 12B, the size of the source code of the mini monitor program can be reduced to, for example, about 2/3 as compared with the case of the variable length. Thereby, the size of the mini monitor ROM 42 of FIG. 3 can be further reduced, and an on-chip debugging function can be realized with a small hardware scale.

なお、送受信データを固定長にすると通信効率が悪化するため、可変長にする場合に比べて通信速度が低下するという問題が生じる。そこで、本実施形態では後述するように、ミニモニタ部40とメインモニタ部62にBCLKを共有させている。これにより、最適な速度で高速にデータを通信できるようになり、上記の問題を解消できる。   Note that when the transmission / reception data is set to a fixed length, the communication efficiency is deteriorated, so that there is a problem that the communication speed is lowered as compared with the case where the length is variable. Therefore, in this embodiment, the BCLK is shared by the mini monitor unit 40 and the main monitor unit 62 as described later. As a result, data can be communicated at high speed at an optimum speed, and the above problem can be solved.

9.ミニモニタROM
本実施形態では図3に示すように、マイクロコンピュータ20内にミニモニタROM42を設け、このミニモニタROM42にミニモニタプログラムを格納するようにしている。このようにすることで、ハードウェアの小規模化、マイクロコンピュータの低コスト化を図れるようになる。
9. Mini monitor ROM
In the present embodiment, as shown in FIG. 3, a mini monitor ROM 42 is provided in the microcomputer 20, and a mini monitor program is stored in the mini monitor ROM 42. By doing so, it is possible to reduce the hardware scale and the cost of the microcomputer.

例えば図13(A)に示す構成では、マイクロコンピュータ330にローダロジック回路332及びRAM334を設ける。そして、このローダロジック回路332を用いて、JTAGインターフェース336を介して外部からRAM334にモニタプログラムをロードする。しかしながら、この構成では、ローダロジック回路332や、サイズがROMの5〜10倍程度になるRAM334をマイクロコンピュータ330内に設ける必要がある。このため、マイクロコンピュータ330の大規模化、高コスト化の問題を招く。   For example, in the configuration illustrated in FIG. 13A, a loader logic circuit 332 and a RAM 334 are provided in the microcomputer 330. The loader logic circuit 332 is used to load a monitor program into the RAM 334 from the outside via the JTAG interface 336. However, in this configuration, it is necessary to provide the loader logic circuit 332 and the RAM 334 whose size is about 5 to 10 times that of the ROM in the microcomputer 330. For this reason, there arises a problem of an increase in scale and cost of the microcomputer 330.

これに対して、本実施形態では図13(B)に示すように、ミニモニタプログラムは、サイズがRAMの1/5〜1/10倍程度になるミニモニタROM42に格納される。またローダロジック回路も必要ない。したがって、図13(A)の構成に比べて、マイクロコンピュータ20の小規模化、低コスト化を図れるようになる。   On the other hand, in this embodiment, as shown in FIG. 13B, the mini monitor program is stored in the mini monitor ROM 42 whose size is about 1/5 to 1/10 times the RAM. Also, no loader logic circuit is required. Therefore, the microcomputer 20 can be reduced in size and cost as compared with the configuration of FIG.

また図13(A)の構成では、電源投入時又はリセット時に、CPUを一旦停止し、次にローダロジック回路332でモニタプログラムをRAM334にロードし、その後、CPUをデバッグモードで再スタートする必要がある。このため、処理が複雑化すると共に、デバッグモードのスタートに時間を要するようになってしまう。   In the configuration of FIG. 13A, it is necessary to stop the CPU once when power is turned on or reset, and then load the monitor program into the RAM 334 with the loader logic circuit 332, and then restart the CPU in the debug mode. is there. This complicates the processing and requires time for starting the debug mode.

これに対して、図13(B)の本実施形態では、RAMにミニモニタプログラムをロードする必要がない。このため、電源投入時又はリセット時に、CPUを一旦停止することなく、CPUのデバッグモードの動作をすぐにスタートできるようになる。   On the other hand, in the present embodiment shown in FIG. 13B, it is not necessary to load the mini monitor program into the RAM. For this reason, when the power is turned on or reset, the operation of the CPU in the debug mode can be started immediately without temporarily stopping the CPU.

10.BCLKの共有化
さて、マイクロコンピュータとデバッグツールとの間でのデータの通信方式としては、いわゆる同期式と呼ばれるものや調歩同期式と呼ばれるものを採用できる。そしてICEにおいては、マイクロコンピュータとデバッグツールとの間の通信ラインの本数をできる限り少なくすることが望まれる。更に通信データのサンプリングエラーをできる限り防止することも望まれる。
10. Sharing BCLK As a data communication method between the microcomputer and the debug tool, a so-called synchronous method or a so-called asynchronous method can be adopted. In ICE, it is desired to reduce the number of communication lines between the microcomputer and the debug tool as much as possible. It is also desirable to prevent communication data sampling errors as much as possible.

ところが同期式で通信を行う場合には、図14(A)に示すように、マイクロコンピュータ340(第1の情報処理装置)とデバッグツール342(第2の情報処理装置)との間に4本の通信ラインを設ける必要がある。即ち、送信データであるTXDのライン、TXDのサンプリングクロックであるTCLKのライン、受信データであるRXDのライン、RXDのサンプリングクロックであるRCLKのラインが必要になる。このため、通信ラインの本数が不要に増えてしまう。   However, when performing communication in a synchronous manner, as shown in FIG. 14A, there are four cables between the microcomputer 340 (first information processing apparatus) and the debug tool 342 (second information processing apparatus). It is necessary to provide a communication line. That is, a TXD line as transmission data, a TCLK line as TXD sampling clock, an RXD line as reception data, and an RCLK line as RXD sampling clock are required. This unnecessarily increases the number of communication lines.

一方、調歩同期式で通信を行う場合には、図14(B)に示すように、マイクロコンピュータ340とデバッグツール342は、別々にほぼ同一周波数のクロックを持つことになる。例えばマイクロコンピュータ340はクロックCLK1を持ち、デバッグシステム342はクロックCLK2を持ち、CLK1とCLK2の周波数をほぼ同一にする。そしてマイクロコンピュータ340は、図15(A)に示すように、CLK1を分周することでサンプリングクロックSMC1を生成し、調歩同期式で通信されるデータの各ビット(スタートビット、D0〜D7、ストップビット)を、このSMC1でサンプリングする。またデバッグツール342は、図15(B)に示すように、CLK2を分周することでサンプリングクロックSMC2を生成し、調歩同期式で通信されるデータの各ビット(ステートビット、D0〜D7、ストップビット)をこのSMC2でサンプリングする。   On the other hand, in the case of performing asynchronous communication, as shown in FIG. 14B, the microcomputer 340 and the debug tool 342 separately have clocks having substantially the same frequency. For example, the microcomputer 340 has the clock CLK1, the debug system 342 has the clock CLK2, and the frequencies of CLK1 and CLK2 are substantially the same. Then, as shown in FIG. 15A, the microcomputer 340 generates the sampling clock SMC1 by dividing CLK1, and each bit (start bit, D0 to D7, stop bit) of data communicated in an asynchronous manner. Bit) is sampled by this SMC1. Further, as shown in FIG. 15B, the debug tool 342 generates the sampling clock SMC2 by dividing CLK2, and each bit (state bits, D0 to D7, stop bit) of data communicated in an asynchronous manner. Bit) is sampled by this SMC2.

しかしながら、この調歩同期式では、マイクロコンピュータ340に含まれるCPUの動作周波数が高くなりCLK1及びCLK2の周波数が高くなると、SMC1及びSMC2の周波数も高くなり、通信データのサンプリングエラーが生じやすくなってしまう。逆に言えば、通信データのサンプリングエラーが生じない程度までしか、CLK1及びCLK2の周波数を高くできない。これは、マイクロコンピュータ340が高速動作する環境でのデバッグ作業ができないということを意味する。即ち、デバッグ作業時においては、マイクロコンピュータのクロック周波数を下げなければいけなくなる。   However, in this asynchronous system, when the operating frequency of the CPU included in the microcomputer 340 is increased and the frequencies of CLK1 and CLK2 are increased, the frequencies of SMC1 and SMC2 are also increased, and communication data sampling errors are likely to occur. . In other words, the frequency of CLK1 and CLK2 can be increased only to the extent that a sampling error of communication data does not occur. This means that debugging work cannot be performed in an environment where the microcomputer 340 operates at high speed. That is, at the time of debugging work, it is necessary to lower the clock frequency of the microcomputer.

このような問題を解決するために本実施形態では、図16に示すように、マイクロコンピュータ140とデバッグツール150とで、サンプリングクロックを生成するためのBCLKを共有させている。   In order to solve such a problem, in this embodiment, as shown in FIG. 16, the microcomputer 140 and the debug tool 150 share BCLK for generating a sampling clock.

より具体的には、マイクロコンピュータ140(第1の情報処理装置)は、通信部142(図3のSIO48に相当)を含む。そして通信部142は、送受信回路144(図6の送受信バッファ70、シフトレジスタ76及び送受信切替部78に相当)、分周回路146(図6の分周回路82に相当)を含む。この分周回路146は、図17(A)に示すように、BCLK(第1のクロック)を分周し、調歩同期式で送受信されるデータの各ビットをサンプリングするためのサンプリングクロックSMC1を生成する。そして、送受信回路144は、このSMC1に基づいてデータを送受信する。更にマイクロコンピュータ140は、BCLKをデバッグツール150に供給する。   More specifically, the microcomputer 140 (first information processing apparatus) includes a communication unit 142 (corresponding to the SIO 48 in FIG. 3). The communication unit 142 includes a transmission / reception circuit 144 (corresponding to the transmission / reception buffer 70, the shift register 76, and the transmission / reception switching unit 78 in FIG. 6) and a frequency dividing circuit 146 (corresponding to the frequency dividing circuit 82 in FIG. 6). As shown in FIG. 17A, the frequency dividing circuit 146 divides BCLK (first clock) and generates a sampling clock SMC1 for sampling each bit of data transmitted and received in an asynchronous manner. To do. The transmission / reception circuit 144 transmits / receives data based on the SMC1. Further, the microcomputer 140 supplies BCLK to the debug tool 150.

デバッグツール150(第2の情報処理装置)は、通信部152を含む。そして通信部152は、送受信回路154(図7のCPU90、送受信切替部92に相当)、分周回路156(図7の分周回路96に相当)を含む。この分周回路156は、図17(B)に示すように、マイクロコンピュータ140から供給されたBCLKを分周し、サンプリングクロックSMC2を生成する。そして、送受信回路154は、このSMC2に基づいてデータを送受信する。   The debug tool 150 (second information processing apparatus) includes a communication unit 152. The communication unit 152 includes a transmission / reception circuit 154 (corresponding to the CPU 90 and the transmission / reception switching unit 92 in FIG. 7) and a frequency dividing circuit 156 (corresponding to the frequency dividing circuit 96 in FIG. 7). As shown in FIG. 17B, the frequency dividing circuit 156 divides BCLK supplied from the microcomputer 140 and generates a sampling clock SMC2. The transmission / reception circuit 154 transmits / receives data based on the SMC2.

このように本実施形態では、調歩同期式でありながら、サンプリングクロックSMC1、SMC2を生成するためのBCLKをマイクロコンピュータ140とデバッグツール150とで共有する。これにより、通信データのサンプリングエラーの発生率を、図14(B)に示す一般的な調歩同期式通信に比べて格段に減少できる。また、図14(A)の同期式通信では、4本の通信ラインが必要であったが、本実施形態では図16に示すように2本の通信ラインで済む(全2重の場合には3本)。したがって、マイクロコンピュータ140とデバッグツール150との間の通信ラインの本数を、図14(A)に比べて少なくできる。この結果、マイクロコンピュータ140の端子数を減らすことが可能になり、マイクロコンピュータ140の低コスト化を図れるようになる。   As described above, in this embodiment, the microcomputer 140 and the debug tool 150 share BCLK for generating the sampling clocks SMC1 and SMC2 while being asynchronous. As a result, the rate of occurrence of communication data sampling errors can be significantly reduced as compared with the general asynchronous communication shown in FIG. Further, in the synchronous communication of FIG. 14A, four communication lines are necessary, but in this embodiment, two communication lines are sufficient as shown in FIG. 16 (in the case of full duplex). 3). Therefore, the number of communication lines between the microcomputer 140 and the debug tool 150 can be reduced as compared with FIG. As a result, the number of terminals of the microcomputer 140 can be reduced, and the cost of the microcomputer 140 can be reduced.

特に、図14(B)の構成では、CLK1(及びCLK2)の周波数が高くなればなるほど、通信データのサンプリングエラーの発生率も高くなる。このため、デバッグ作業時においてマイクロコンピュータ340のクロック周波数を高くできず、マイクロコンピュータ340が高速動作する環境でのデバッグ作業ができなかった。   In particular, in the configuration of FIG. 14B, the higher the frequency of CLK1 (and CLK2), the higher the incidence of communication data sampling errors. For this reason, the clock frequency of the microcomputer 340 cannot be increased during the debugging operation, and the debugging operation cannot be performed in an environment where the microcomputer 340 operates at high speed.

これに対して、図16の本実施形態では、マイクロコンピュータ140もデバッグツール150もBCLKに基づいてサンプリングクロックを生成している。このため、BCLKの周波数が高くなっても、サンプリングエラーの発生率がそれほど高くならない。この結果、マイクロコンピュータ140が高速動作する環境でのデバッグ作業が可能になり、より実動作時に近い環境でのデバッグ作業が可能になる。   On the other hand, in this embodiment of FIG. 16, both the microcomputer 140 and the debug tool 150 generate the sampling clock based on BCLK. For this reason, even if the frequency of BCLK increases, the occurrence rate of sampling errors does not increase so much. As a result, debugging work can be performed in an environment in which the microcomputer 140 operates at high speed, and debugging work can be performed in an environment closer to actual operation.

更に本実施形態では、図18に示すように、通信部142に分周比制御部148(図6の制御レジスタ84に相当)を含ませると共に、通信部152に分周比制御部158(図7の制御レジスタ98に相当)、周波数検出回路159(図7の周波数検出回路95に相当)を含ませている。これにより、SMC1を生成する際の分周比FD1と、SMC2を生成する際の分周比FD2を可変に制御することが可能になる。この結果、BCLKの周波数が変化しても、最適で高速な通信速度でデータを通信することが可能になる。   Furthermore, in this embodiment, as shown in FIG. 18, the communication unit 142 includes a frequency division ratio control unit 148 (corresponding to the control register 84 in FIG. 6), and the communication unit 152 has a frequency division ratio control unit 158 (FIG. 18). 7 and a frequency detection circuit 159 (corresponding to the frequency detection circuit 95 of FIG. 7). This makes it possible to variably control the frequency dividing ratio FD1 when generating SMC1 and the frequency dividing ratio FD2 when generating SMC2. As a result, even if the frequency of BCLK changes, data can be communicated at an optimal and high communication speed.

即ち図19(A)に示すようにBCLKの周波数が低くなった場合には、図17(A)、(B)で16であった分周比FD1、FD2が例えば8に変更される。これにより、サンプリングクロックSMC1、SMC2は、BCLKを16分周したクロックから8分周したクロックに変更される。この結果、1ビットのデータに対応するBCLKのクロック数が、16であったものが(16クロックモード)、8に変更される(8クロックモード)。   That is, as shown in FIG. 19A, when the frequency of BCLK is lowered, the frequency division ratios FD1 and FD2 that were 16 in FIGS. 17A and 17B are changed to 8, for example. As a result, the sampling clocks SMC1 and SMC2 are changed from a clock obtained by dividing BCLK by 16 to a clock obtained by dividing the clock by eight. As a result, the clock number of BCLK corresponding to 1-bit data is changed from 16 (16 clock mode) to 8 (8 clock mode).

また図19(B)に示すようにBCLKの周波数が更に低くなった場合には、図19(A)で8であった分周比FD1、FD2が例えば4に変更される。これにより、サンプリングクロックSMC1、SMC2は、BCLKを8分周したクロックから4分周したクロックに変更される。この結果、1ビットのデータに対応するBCLKのクロック数が、8であったものが(8クロックモード)、4になるように変更される(4クロックモード)。   Further, as shown in FIG. 19B, when the frequency of BCLK is further lowered, the frequency division ratios FD1 and FD2 that were 8 in FIG. As a result, the sampling clocks SMC1 and SMC2 are changed from a clock obtained by dividing BCLK by 8 to a clock obtained by dividing the clock by four. As a result, the BCLK clock number corresponding to 1-bit data is changed from 8 (8 clock mode) to 4 (4 clock mode).

このようにすることで、BCLKの周波数が低くなった場合にも、データの通信速度は結局低くならなくなる。この結果、最適で高速な通信速度でデータを通信することが可能になる。   In this way, even when the BCLK frequency is lowered, the data communication speed is not lowered. As a result, data can be communicated at an optimum and high communication speed.

特に、マイクロコンピュータのクロック周波数は、マイクロコンピュータを使用するユーザ毎に異なったものになるのが一般的である。即ち、あるユーザは60MHZのクロックでマイクロコンピュータを動作させ、別のユーザは20MHZのクロックでマイクロコンピュータを動作させる。   In particular, the clock frequency of the microcomputer is generally different for each user who uses the microcomputer. That is, one user operates the microcomputer with a clock of 60 MHZ, and another user operates the microcomputer with a clock of 20 MHZ.

しかしながら、図14(A)、(B)の通信方式では、マイクロコンピュータのクロック周波数が変化すると、データの通信速度も変化してしまう。即ち、クロック周波数が低くなるとデータの通信速度も低くなってしまう。したがって、最大限の通信速度でデータを通信することができなくなる。   However, in the communication systems shown in FIGS. 14A and 14B, when the clock frequency of the microcomputer changes, the data communication speed also changes. That is, when the clock frequency is lowered, the data communication speed is also lowered. Therefore, data cannot be communicated at the maximum communication speed.

これに対して、本実施形態では、マイクロコンピュータのクロック周波数が、マイクロコンピュータを使用するユーザに応じて変化すると、分周比FD1、FD2も変化し、1ビットのデータに対応するクロック数も変化する。即ちクロック周波数が低くなると、分周比FD1、FD2も小さくなり、1ビットのデータに対応するクロック数も少なくなる。この結果、通信速度は結局低くならず、最適で高速な通信速度で通信を行えるようになる。即ち、多様な周波数のクロックを使用するユーザに応じて、最適な通信速度で通信を行えるようになる。   On the other hand, in this embodiment, when the clock frequency of the microcomputer changes according to the user who uses the microcomputer, the frequency division ratios FD1 and FD2 also change, and the number of clocks corresponding to 1-bit data also changes. To do. That is, when the clock frequency is lowered, the frequency division ratios FD1 and FD2 are also reduced, and the number of clocks corresponding to 1-bit data is also reduced. As a result, the communication speed is not lowered after all, and communication can be performed at an optimal and high communication speed. That is, communication can be performed at an optimum communication speed according to a user who uses clocks having various frequencies.

次に、通信部142、152での処理について図20、図21のフローチャートを用いて更に詳細に説明する。   Next, processing in the communication units 142 and 152 will be described in more detail with reference to the flowcharts of FIGS.

図20に示すように、まず、図18の通信部152内の周波数検出回路159が、マイクロコンピュータ140から供給されるBCLKの周波数を検出する(ステップV1)。そして、BCLKの周波数が30MHZ以上であるか否かを判断し(ステップV2)、30MHZ以上である場合には、分周比制御部158が分周比FD2を16に設定する(ステップV3)。そして、FD2が16であることを知らせる分周比データを、送受信回路154を介してマイクロコンピュータ140に送信する(ステップV4)。次に、分周回路156がFD2=16でBCLKを分周しSMC2を生成する(ステップV5)。そして、以降は、このSMC2によりデータの送受信を行う。   As shown in FIG. 20, first, the frequency detection circuit 159 in the communication unit 152 in FIG. 18 detects the frequency of BCLK supplied from the microcomputer 140 (step V1). Then, it is determined whether or not the frequency of BCLK is 30 MHZ or more (step V2). If it is 30 MHZ or more, the frequency division ratio control unit 158 sets the frequency division ratio FD2 to 16 (step V3). Then, frequency division ratio data notifying that FD2 is 16 is transmitted to the microcomputer 140 via the transmission / reception circuit 154 (step V4). Next, the frequency dividing circuit 156 divides BCLK by FD2 = 16 and generates SMC2 (step V5). Thereafter, data transmission / reception is performed by the SMC2.

BCLKの周波数が30MHZより低い場合には、周波数が15MHZ以上か否かを判断する(ステップV6)。そして、周波数が15MHZ以上である場合にはFD2=8に設定し(ステップV7)、ステップV4、V5と同様の処理を行う(ステップV8、V9)。また、BCLKの周波数が15MHZより低い場合にはFD2=4に設定し(ステップV10)、ステップV4、V5と同様の処理を行う(ステップV11、V12)。   When the frequency of BCLK is lower than 30 MHZ, it is determined whether or not the frequency is 15 MHZ or higher (step V6). If the frequency is 15 MHZ or higher, FD2 = 8 is set (step V7), and processing similar to steps V4 and V5 is performed (steps V8 and V9). If the frequency of BCLK is lower than 15 MHZ, FD2 = 4 is set (step V10), and the same processing as steps V4 and V5 is performed (steps V11 and V12).

一方、マイクロコンピュータ140側では図21のフローチャートに示すような処理を行う。即ち、まず、デバッグツール150から送受信回路144を介して分周比データを受信する(ステップW1)。次に、受信した分周比データに基づいて分周比制御部148が分周比FD1を決定する(ステップW2)。そして、分周回路146は、このFD1でBCLKを分周しSMC1を生成する。そして、以降は、このSMC1でデータの送受信を行う。   On the other hand, the microcomputer 140 performs processing as shown in the flowchart of FIG. That is, first, frequency division ratio data is received from the debug tool 150 via the transmission / reception circuit 144 (step W1). Next, the frequency division ratio control unit 148 determines the frequency division ratio FD1 based on the received frequency division ratio data (step W2). Then, the frequency dividing circuit 146 divides BCLK by this FD1 to generate SMC1. Thereafter, data transmission / reception is performed by the SMC 1.

11.ミニモニタ部の詳細な処理例
次にミニモニタ部の詳細な処理例について説明する。
11. Detailed Processing Example of Mini Monitor Unit Next, a detailed processing example of the mini monitor unit will be described.

図22に示すように、ユーザプログラムの実行中にブレークが発生すると、ミニモニタプログラムの処理がスタートし、ユーザプログラム実行モードからデバッグモードに移行する。そして、ミニモニタプログラムが所与のコマンド処理を行いリターン命令を実行すると、デバッグモードからユーザプログラム実行モードに戻る。   As shown in FIG. 22, when a break occurs during execution of the user program, processing of the mini monitor program starts and shifts from the user program execution mode to the debug mode. When the mini monitor program executes a given command process and executes a return instruction, the program returns from the debug mode to the user program execution mode.

図23、図24に、デバッグモードでのミニモニタプログラムの処理を表すフローチャートを示す。   23 and 24 are flowcharts showing the processing of the mini monitor program in the debug mode.

デバッグモードに移行すると、ミニモニタプログラムは、まず、図3のCPU22の内部レジスタ24の内容をミニモニタRAM44に退避する(ステップS1)。そして、ミニモニタプログラムが使用する制御レジスタ46の設定処理を行う(ステップS2)。   When shifting to the debug mode, the mini-monitor program first saves the contents of the internal register 24 of the CPU 22 in FIG. 3 to the mini-monitor RAM 44 (step S1). Then, setting processing of the control register 46 used by the mini monitor program is performed (step S2).

次に、デバッグツール60から受信した14バイトのデータ(図10(A)参照)を、受信バッファ74(図6参照)にライトする(ステップS3)。そして、受信バッファ74のデータの先頭の1バイト(コマンド識別データID)をチェックする(ステップS4)。   Next, the 14-byte data (see FIG. 10A) received from the debug tool 60 is written to the reception buffer 74 (see FIG. 6) (step S3). Then, the first byte (command identification data ID) of the data in the reception buffer 74 is checked (step S4).

そして図24に示すように、IDがリードコマンドを示すものであった場合には(図10(D)参照)、受信バッファ74からリードアドレスを取得する(ステップS5、S6)。そして、取得したリードアドレスからデータをリードし、送信バッファ72にライトする(ステップS7)。次に、送信バッファ72のデータをデバッグツール60に送信する(ステップS8)。そして、図23のステップS3に戻り、次の受信データを受信バッファ74にライトする。   As shown in FIG. 24, when the ID indicates a read command (see FIG. 10D), a read address is acquired from the reception buffer 74 (steps S5 and S6). Then, data is read from the acquired read address and written to the transmission buffer 72 (step S7). Next, the data in the transmission buffer 72 is transmitted to the debug tool 60 (step S8). Then, the process returns to step S 3 in FIG. 23, and the next received data is written to the receiving buffer 74.

IDがライトコマンドを示すものであった場合には(図10(C)参照)、受信バッファ74からライトアドレスを取得する(ステップS9、S10)。そして、受信バッファ74からライトデータを取得し、ステップS10で取得したライトアドレスにライトする(ステップS11)。   If the ID indicates a write command (see FIG. 10C), the write address is acquired from the reception buffer 74 (steps S9 and S10). Then, write data is acquired from the reception buffer 74 and written to the write address acquired in step S10 (step S11).

IDが外部ルーチンジャンプコマンドを示すものであった場合には(図11(A)参照)、受信バッファ74からルーチンアドレスを取得する(ステップS12、S13)。そして、外部ルーチンにジャンプ後、ミニモニタプログラムにリターンする(ステップS14)。   If the ID indicates an external routine jump command (see FIG. 11A), the routine address is acquired from the reception buffer 74 (steps S12 and S13). Then, after jumping to the external routine, the process returns to the mini monitor program (step S14).

IDがGOコマンドを示すものであった場合には(図11(B)参照)、ミニモニタRAM44に退避したデータを内部レジスタ24にリストアする(ステップS15、S16)。そして、図22に示すようにユーザプログラムにリターンし、デバッグモードから抜ける(ステップS17)。   If the ID indicates a GO command (see FIG. 11B), the data saved in the mini monitor RAM 44 is restored to the internal register 24 (steps S15 and S16). Then, as shown in FIG. 22, the process returns to the user program and exits from the debug mode (step S17).

一方、IDがリード、ライト、外部ルーチンジャンプ、GOコマンドのいずれでもなかった場合には、処理が必要ないと判断する(ステップS15、S18)。そして送信バッファ72にダミーのデータをライトする(ステップS19)。なお、図24では、データフィルコマンドの処理については省略している。   On the other hand, if the ID is not any of read, write, external routine jump, and GO command, it is determined that no processing is required (steps S15 and S18). Then, dummy data is written to the transmission buffer 72 (step S19). In FIG. 24, processing of the data fill command is omitted.

以上のようにして、デバッグコマンドを変換することで得られたプリミティブコマンドが、ミニモニタプログラムにより実行されることになる。   As described above, the primitive command obtained by converting the debug command is executed by the mini monitor program.

12.電子機器
次に、以上の本実施形態のマイクロコンピュータを含む電子機器に関して説明する。
12 Next, an electronic device including the microcomputer according to the present embodiment will be described.

例えば図25(A)に電子機器の1つであるカーナビゲーションシステムの内部ブロック図を示し、図26(A)にその外観図を示す。カーナビゲーションシステムの操作はリモコン510を用いて行われ、GPSやジャイロからの情報に基づいて位置検出部520が車の位置を検出する。地図などの情報はCDROM530(情報記憶媒体)に格納されている。画像メモリ540は画像処理の際の作業領域になるメモリであり、生成された画像は画像出力部550を用いて運転者に表示される。マイクロコンピュータ500は、リモコン510、位置検出部520、CDROM530などのデータ入力源からデータを入力し、種々の処理を行い、処理後のデータを画像出力部550などの出力装置を用いて出力する。   For example, FIG. 25A shows an internal block diagram of a car navigation system which is one of electronic devices, and FIG. 26A shows an external view thereof. The operation of the car navigation system is performed using the remote controller 510, and the position detection unit 520 detects the position of the vehicle based on information from the GPS and the gyro. Information such as a map is stored in a CDROM 530 (information storage medium). The image memory 540 is a memory serving as a work area for image processing, and the generated image is displayed to the driver using the image output unit 550. The microcomputer 500 receives data from a data input source such as the remote controller 510, the position detection unit 520, and the CDROM 530, performs various processes, and outputs the processed data using an output device such as the image output unit 550.

図25(B)に電子機器の1つであるゲーム装置の内部ブロック図を示し、図26(B)にその外観図を示す。このゲーム装置では、ゲームコントローラ560からのプレーヤの操作情報、CDROM570からのゲームプログラム、ICカード580からのプレーヤ情報等に基づいて、画像メモリ590を作業領域としてゲーム画像やゲーム音を生成し、画像出力部610、音出力部600を用いて出力する。   FIG. 25B shows an internal block diagram of a game device which is one of electronic devices, and FIG. 26B shows an external view thereof. In this game apparatus, based on the operation information of the player from the game controller 560, the game program from the CD ROM 570, the player information from the IC card 580, and the like, a game image and game sound are generated using the image memory 590 as a work area. Output is performed using the output unit 610 and the sound output unit 600.

図25(C)に電子機器の1つであるプリンタの内部ブロック図を示し、図26(C)にその外観図を示す。このプリンタでは、操作パネル620からの操作情報、コードメモリ630及びフォントメモリ640から文字情報に基づいて、ビットマップメモリ650を作業領域として、印刷画像を生成し、プリント出力部660を用いて出力する。またプリンタの状態やモードを表示パネル670を用いてユーザに伝える。   FIG. 25C shows an internal block diagram of a printer which is one of electronic devices, and FIG. 26C shows an external view thereof. In this printer, based on the operation information from the operation panel 620 and the character information from the code memory 630 and the font memory 640, a print image is generated using the bitmap memory 650 as a work area and is output using the print output unit 660. . The printer status and mode are communicated to the user using the display panel 670.

本実施形態のマイクロコンピュータ又はデバッグシステムによれば、図25(A)〜図26(C)の電子機器を動作させるユーザプログラムの開発の容易化、開発期間の短縮化を図れるようになる。またマイクロコンピュータが実動作する環境と同じ環境で、ユーザプログラムのデバッグ作業を行うことができるため、電子機器の信頼性を高めることができる。また電子機器に組み込まれるマイクロコンピュータのハードウェアを小規模化、低コスト化できるため、電子機器の低コスト化も図れるようになる。更にミニモニタプログラムの命令コードサイズは小さいため、ユーザがプログラムや各種データの格納に使用するメモリ領域を最大限に確保でき、場合によれば、ユーザーが使用する該メモリ領域を全く使用せずにモニタプログラムを載せることができる。   According to the microcomputer or the debugging system of the present embodiment, it becomes possible to facilitate the development of a user program for operating the electronic devices of FIGS. 25A to 26C and shorten the development period. In addition, since the user program can be debugged in the same environment as the environment in which the microcomputer actually operates, the reliability of the electronic device can be improved. Further, since the hardware of the microcomputer incorporated in the electronic device can be reduced in size and cost, the cost of the electronic device can be reduced. Furthermore, since the instruction code size of the mini-monitor program is small, the user can secure the maximum memory area for storing programs and various data. In some cases, the memory area used by the user is not used at all. A monitor program can be loaded.

なお本実施形態のマイクロコンピュータを適用できる電子機器としては、上記以外にも例えば、携帯電話(セルラーフォン)、PHS、ページャ、オーディオ機器、電子手帳、電子卓上計算機、POS端末、タッチパネルを備えた装置、プロジェクタ、ワードプロセッサ、パーソナルコンピュータ、テレビ、ビューファインダ型又はモニタ直視型のビデオテープレコーダなど種々のものを考えることができる。   In addition to the above, the electronic apparatus to which the microcomputer of the present embodiment can be applied includes, for example, a mobile phone (cellular phone), a PHS, a pager, an audio device, an electronic notebook, an electronic desk calculator, a POS terminal, and a touch panel. Various devices such as a projector, a word processor, a personal computer, a television, a viewfinder type or a monitor direct-view type video tape recorder can be considered.

なお、本発明は本実施形態に限定されず、本発明の要旨の範囲内で種々の変形実施が可能である。   In addition, this invention is not limited to this embodiment, A various deformation | transformation implementation is possible within the range of the summary of this invention.

例えば本発明のプリミティブコマンドとしては、本実施形態で説明したものが特に望ましいが、これに限定されるものではない。   For example, as the primitive commands of the present invention, those described in this embodiment are particularly desirable, but the present invention is not limited to these.

またマイクロコンピュータやミニモニタ部(第1のモニタ手段)の構成も本実施形態で説明したものに限定されず、種々の変形実施が可能である。   Further, the configuration of the microcomputer and the mini-monitor unit (first monitor means) is not limited to that described in the present embodiment, and various modifications can be made.

またデバッグシステムの構成も図7に示すものに限られるものではない。   Further, the configuration of the debug system is not limited to that shown in FIG.

図1(A)はCPU置き換え型のICE、図1(B)はモニタプログラム実装型ICEの例を示す図である。FIG. 1A shows an example of a CPU replacement type ICE, and FIG. 1B shows an example of a monitor program mounting type ICE. 本実施形態の特徴について説明するための図である。It is a figure for demonstrating the characteristic of this embodiment. 本実施形態のマイクロコンピュータ、デバッグシステムの構成例を示す機能ブロック図である。It is a functional block diagram which shows the structural example of the microcomputer of this embodiment, and a debugging system. デバッグモード時のメモリマップを示す図である。It is a figure which shows the memory map at the time of debug mode. 図5(A)、(B)、(C)、(D)は、デバッグコマンドをプリミティブコマンドへ変換(分解)する処理について説明するための図である。FIGS. 5A, 5 </ b> B, 5 </ b> C, and 5 </ b> D are diagrams for explaining processing for converting (decomposing) a debug command into a primitive command. SIOの構成例を示す機能ブロック図である。It is a functional block diagram which shows the structural example of SIO. デバッグツールの構成例を示す機能ブロック図である。It is a functional block diagram which shows the structural example of a debug tool. 図8(A)、(B)は、リアルタイムトレース処理について説明するための図である。8A and 8B are diagrams for explaining the real-time trace processing. 図9(A)、(B)、(C)は、ミニモニタ部とメインモニタ部との間の通信手法について説明するための図である。FIGS. 9A, 9B, and 9C are diagrams for explaining a communication method between the mini monitor unit and the main monitor unit. 図10(A)、(B)、(C)、(D)は、送受信データのフォーマット及び種類について説明するための図である。FIGS. 10A, 10B, 10C, and 10D are diagrams for explaining the format and type of transmission / reception data. 図11(A)、(B)も、送受信データのフォーマット及び種類について説明するための図である。FIGS. 11A and 11B are also diagrams for explaining the format and type of transmission / reception data. 図12(A)、(B)は、送受信データが可変長、固定長の場合のミニモニタプログラムのソースコードのサイズについて説明するための図である。FIGS. 12A and 12B are diagrams for explaining the size of the source code of the mini-monitor program when the transmission / reception data has a variable length and a fixed length. 図13(A)、(B)は、ミニモニタプログラムをROMに格納する手法について説明するための図である。FIGS. 13A and 13B are diagrams for explaining a method of storing the mini monitor program in the ROM. 図14(A)、(B)は、同期式、調歩同期式の通信手法について説明するための図である。FIGS. 14A and 14B are diagrams for explaining synchronous and asynchronous communication methods. 図15(A)、(B)は、一般的な調歩同期式でのクロックとサンプリングクロックとサンプリングデータのタイミング波形を示す図である。FIGS. 15A and 15B are diagrams illustrating timing waveforms of a clock, a sampling clock, and sampling data in a general asynchronous manner. 本実施形態の通信手法について説明するための図である。It is a figure for demonstrating the communication method of this embodiment. 図17(A)、(B)は、図16の手法でのクロックとサンプリングクロックとサンプリングデータのタイミング波形を示す図である。17A and 17B are diagrams showing timing waveforms of the clock, sampling clock, and sampling data in the method of FIG. 本実施形態の通信手法について説明するための図である。It is a figure for demonstrating the communication method of this embodiment. 図19(A)、(B)は、図18の手法でのクロックとサンプリングクロックとサンプリングデータのタイミング波形を示す図である。FIGS. 19A and 19B are diagrams showing timing waveforms of the clock, sampling clock, and sampling data in the method of FIG. デバッグツール側での分周比設定処理について説明するためのフローチャートである。It is a flowchart for demonstrating the division ratio setting process by the debug tool side. マイクロコンピュータ側での分周比設定処理について説明するためのフローチャートである。It is a flowchart for demonstrating the division ratio setting process by the side of a microcomputer. ユーザプログラム実行モードからデバッグモードへの移行について説明するための図である。It is a figure for demonstrating the transfer from user program execution mode to debug mode. 本実施形態の詳細な処理例を説明するためのフローチャートである。It is a flowchart for demonstrating the detailed process example of this embodiment. 本実施形態の詳細な処理例を説明するためのフローチャートである。It is a flowchart for demonstrating the detailed process example of this embodiment. 図25(A)、(B)、(C)は、種々の電子機器の内部ブロック図の例である。25A, 25B, and 25C are examples of internal block diagrams of various electronic devices. 図26(A)、(B)、(C)は、種々の電子機器の外観図の例である。FIGS. 26A, 26B, and 26C are examples of external views of various electronic devices.

符号の説明Explanation of symbols

10 マイクロコンピュータ、12 CPU(中央処理ユニット)、14 ミニモニタ部(第1のモニタ手段)、16 メインモニタ部(第2のモニタ手段)、20 マイクロコンピュータ、22 CPU(中央処理ユニット)、24 内部レジスタ、26 BCU(バス制御ユニット)、28 内部メモリ、30 クロック生成部、31 バス、32 バス、33 外部バス、34 内部バス、36 外部メモリ、40 ミニモニタ部(第1のモニタ手段)、42 ミニモニタROM、44 ミニモニタRAM、46 制御レジスタ、48 SIO、50 トレース部、60 デバッグツール、62 メインモニタ部(第2のモニタ手段)、66 ホストシステム、70 送受信バッファ、72 送信バッファ、74 受信バッファ、76 シフトレジスタ、78 送受信切替部、80 クロック制御部、82 分周回路、84 制御レジスタ、90 CPU、92 送受信切替部、94 クロック制御部、95 周波数検出部、96 分周回路、98 制御レジスタ、100 アドレスアップカウンタ、102 セレクタ、104 トレースメモリ、106 セレクタ、108 ROM、110 メインモニタROM、112 RAM、114 RS232Cインターフェース、116 パラレルインターフェース、118 クロック生成部、140 マイクロコンピュータ(第1の情報処理装置)、142 通信部、144 送受信回路、146 分周回路、148 分周比制御部、150 デバッグツール(第2の情報処理装置)、152 通信部、154 送受信回路、156 分周回路、158 分周比制御部、159 周波数検出回路 10 microcomputer, 12 CPU (central processing unit), 14 mini monitor section (first monitoring means), 16 main monitor section (second monitoring means), 20 microcomputer, 22 CPU (central processing unit), 24 internal register , 26 BCU (bus control unit), 28 internal memory, 30 clock generation unit, 31 bus, 32 bus, 33 external bus, 34 internal bus, 36 external memory, 40 mini monitor unit (first monitor means), 42 mini monitor ROM , 44 Mini monitor RAM, 46 Control register, 48 SIO, 50 Trace unit, 60 Debug tool, 62 Main monitor unit (second monitor means), 66 Host system, 70 Transmit / receive buffer, 72 Transmit buffer, 74 Receive buffer, 76 Shift register, 8 transmission / reception switching unit, 80 clock control unit, 82 frequency dividing circuit, 84 control register, 90 CPU, 92 transmission / reception switching unit, 94 clock control unit, 95 frequency detection unit, 96 frequency dividing circuit, 98 control register, 100 address up counter , 102 selector, 104 trace memory, 106 selector, 108 ROM, 110 main monitor ROM, 112 RAM, 114 RS232C interface, 116 parallel interface, 118 clock generation unit, 140 microcomputer (first information processing apparatus), 142 communication unit 144 transmission / reception circuit, 146 frequency division circuit, 148 frequency division ratio control unit, 150 debug tool (second information processing device), 152 communication unit, 154 transmission / reception circuit, 156 frequency division circuit, 158 frequency division ratio control unit, 159 Frequency detection circuit

Claims (13)

オンチップデバッグ機能を有するマイクロコンピュータであって、
命令の実行処理を行う中央処理ユニットと、
マイクロコンピュータの外部に設けられデバッグコマンドを少なくとも1つのプリミティブコマンドに変換するための処理を行う第2のモニタ手段との間でデータを送受信し、実行するプリミティブコマンドを前記第2のモニタ手段からの受信データに基づいて決定し、決定したプリミティブコマンドを実行するための処理を行う第1のモニタ手段とを含み、
前記第1のモニタ手段は、
前記第1のモニタ手段の処理を実行するためのモニタプログラムが格納されるモニタROMを含み、
前記モニタプログラムは、
前記プリミティブコマンドの命令コードを含み、
前記第2のモニタ手段からの前記受信データは、
前記プリミティブコマンドを識別するための識別データを含み、
前記第1のモニタ手段は、
前記第2のモニタ手段から前記受信データを受信した場合に、前記受信データに含まれる前記識別データにより指定される命令コードのプリミティブコマンドを実行することを特徴とするマイクロコンピュータ。
A microcomputer having an on-chip debugging function,
A central processing unit for executing instructions,
Data is transmitted to and received from the second monitor means that is provided outside the microcomputer and performs processing for converting a debug command into at least one primitive command, and a primitive command to be executed is sent from the second monitor means. First monitoring means for determining based on received data and performing processing for executing the determined primitive command;
The first monitoring means includes
A monitor ROM for storing a monitor program for executing the processing of the first monitor means;
The monitor program is
Including an instruction code of the primitive command;
The received data from the second monitor means is
Including identification data for identifying the primitive command;
The first monitoring means includes
A microcomputer that executes a primitive command of an instruction code specified by the identification data included in the received data when the received data is received from the second monitor means.
オンチップデバッグ機能を有するマイクロコンピュータであって、
命令の実行処理を行う中央処理ユニットと、
マイクロコンピュータの外部に設けられデバッグコマンドを少なくとも1つのプリミティブコマンドに変換するための処理を行う第2のモニタ手段との間でデータを送受信し、実行するプリミティブコマンドを前記第2のモニタ手段からの受信データに基づいて決定し、決定したプリミティブコマンドを実行するための処理を行う第1のモニタ手段と、
前記中央処理ユニットの命令実行処理に使用され、デバッグモード時におけるメモリマップ上にそのアドレスが割り付けられる制御レジスタとを含み、
前記第2のモニタ手段は、
前記デバッグコマンドであるステップ実行コマンドを、ステップ実行イネーブルビットへのライトコマンドである第1のプリミティブコマンドと、GOコマンドである第2のプリミティブコマンドに変換し、
前記第1のモニタ手段は、
前記第1、第2のプリミティブコマンドを実行することで、ステップ実行処理を行うことを特徴とするマイクロコンピュータ。
A microcomputer having an on-chip debugging function,
A central processing unit for executing instructions,
Data is transmitted to and received from the second monitor means that is provided outside the microcomputer and performs processing for converting a debug command into at least one primitive command, and a primitive command to be executed is sent from the second monitor means. First monitoring means for performing a process for executing the determined primitive command, based on the received data;
A control register that is used for instruction execution processing of the central processing unit and whose address is allocated on a memory map in debug mode;
The second monitor means includes
The step execution command which is the debug command is converted into a first primitive command which is a write command to a step execution enable bit and a second primitive command which is a GO command.
The first monitoring means includes
A microcomputer performing step execution processing by executing the first and second primitive commands.
オンチップデバッグ機能を有するマイクロコンピュータであって、
命令の実行処理を行う中央処理ユニットと、
マイクロコンピュータの外部に設けられデバッグコマンドを少なくとも1つのプリミティブコマンドに変換するための処理を行う第2のモニタ手段との間でデータを送受信し、実行するプリミティブコマンドを前記第2のモニタ手段からの受信データに基づいて決定し、決定したプリミティブコマンドを実行するための処理を行う第1のモニタ手段と、
前記第2のモニタ手段からの前記受信データを一時的に蓄えるための受信バッファと、
前記第2のモニタ手段への送信データを一時的に蓄えるための送信バッファとを含み、
前記第2のモニタ手段からの前記受信データは、
前記プリミティブコマンドを識別するための識別データを含み、
前記第1のモニタ手段は、
前記受信データの識別データがリードコマンドのプリミティブコマンドを示すものであった場合には、前記受信バッファの前記受信データからリードアドレスを取得し、取得した前記リードアドレスからデータをリードし、リードした前記データを前記送信バッファにライトし、
前記受信データの識別データがライトコマンドのプリミティブコマンドを示すものであった場合には、前記受信バッファの前記受信データからライトアドレスとライトデータを取得し、取得した前記ライトアドレスに、取得した前記ライトデータを書き込む処理を行うことを特徴とするマイクロコンピュータ。
A microcomputer having an on-chip debugging function,
A central processing unit for executing instructions,
Data is transmitted to and received from the second monitor means that is provided outside the microcomputer and performs processing for converting a debug command into at least one primitive command, and a primitive command to be executed is sent from the second monitor means. First monitoring means for performing a process for executing the determined primitive command, based on the received data;
A reception buffer for temporarily storing the reception data from the second monitoring means;
A transmission buffer for temporarily storing transmission data to the second monitoring means,
The received data from the second monitor means is
Including identification data for identifying the primitive command;
The first monitoring means includes
When the identification data of the received data indicates a primitive command of a read command, a read address is acquired from the received data of the reception buffer, data is read from the acquired read address, and the read Write data to the transmit buffer;
If the identification data of the received data indicates a primitive command of a write command, a write address and write data are acquired from the received data in the reception buffer, and the acquired write address is acquired at the acquired write address. A microcomputer that performs a process of writing data.
請求項3において、
前記第1のモニタ手段は、
受信した識別データが外部ルーチンジャンプコマンドのプリミティブコマンドを示すものであった場合には、前記受信バッファの前記受信データからルーチンアドレスを取得して外部ルーチンにジャンプし、ジャンプ後に前記第1のモニタ手段の処理にリターンする処理を行うことを特徴とするマイクロコンピュータ。
In claim 3,
The first monitoring means includes
If the received identification data indicates a primitive command of an external routine jump command, a routine address is acquired from the received data in the reception buffer and jumped to an external routine. After the jump, the first monitoring means A microcomputer characterized by performing a process returning to the process.
請求項3又は4において、
前記中央処理ユニットの内部レジスタの内容が退避され、デバッグモード時におけるメモリマップ上にそのアドレスが割り付けられるモニタRAMを含み、
前記第1のモニタ手段は、
受信した識別データがGOコマンドのプリミティブコマンドを示すものであった場合には、前記モニタRAMに退避したデータを前記内部レジスタにリストアし、リストア後にユーザプログラムの処理にリターンする処理を行うことを特徴とするマイクロコンピュータ。
In claim 3 or 4,
Including a monitor RAM in which the contents of the internal register of the central processing unit are saved and the address is assigned on the memory map in the debug mode;
The first monitoring means includes
When the received identification data indicates a GO command primitive command, the data saved in the monitor RAM is restored to the internal register, and the process of returning to the process of the user program after the restoration is performed. A microcomputer.
請求項1乃至5のいずれかにおいて、
前記プリミティブコマンドは、
ユーザプログラムの実行を開始するコマンド、デバッグモード時におけるメモリマップ上のアドレスにデータをライトするコマンド、及び前記メモリマップ上のアドレスからデータをリードするコマンドを含むことを特徴とするマイクロコンピュータ。
In any one of Claims 1 thru | or 5,
The primitive command is
A microcomputer comprising: a command for starting execution of a user program; a command for writing data to an address on a memory map in a debug mode; and a command for reading data from an address on the memory map.
請求項1乃至6のいずれかにおいて、
前記第2のモニタ手段との間で半2重の双方向通信を行うための1本の双方向通信ラインが接続される端子を含み、
スレーブとなる前記第1のモニタ手段は、
マスタとなる前記第2のモニタ手段からデータを受信したことを条件に、該受信データに対応する処理を行い該受信データに対応する応答データを前記第2のモニタ手段に送信することを特徴とするマイクロコンピュータ。
In any one of Claims 1 thru | or 6.
A terminal to which one bidirectional communication line for performing half-duplex bidirectional communication with the second monitoring means is connected;
The first monitoring means to be a slave is
On the condition that data is received from the second monitor means serving as a master, processing corresponding to the received data is performed, and response data corresponding to the received data is transmitted to the second monitor means, A microcomputer.
請求項1乃至7のいずれかにおいて、
前記第1のモニタ手段は、
前記第2のモニタ手段との間で固定長のデータを送受信することを特徴とするマイクロコンピュータ。
In any one of Claims 1 thru | or 7,
The first monitoring means includes
A microcomputer for transmitting and receiving fixed-length data to and from the second monitor means.
請求項1乃至8のいずれかにおいて、
前記第1のモニタ手段がリード及びライト可能なモニタRAMを含み、
前記第1のモニタ手段は、
ユーザプログラムの実行がブレークしデバッグモードに移行した場合に、前記中央処理ユニットのプログラムカウンタ値及び内部レジスタの内容を前記モニタRAMに待避することを特徴とするマイクロコンピュータ。
In any one of Claims 1 thru | or 8.
The first monitor means includes a readable and writable monitor RAM;
The first monitoring means includes
A microcomputer characterized in that the program counter value of the central processing unit and the contents of an internal register are saved in the monitor RAM when execution of a user program breaks and shifts to a debug mode.
請求項1乃至9のいずれかのマイクロコンピュータと、
前記マイクロコンピュータの処理対象となるデータの入力源と、
前記マイクロコンピュータにより処理されたデータを出力するための出力装置とを含むことを特徴とする電子機器。
A microcomputer according to any one of claims 1 to 9;
An input source of data to be processed by the microcomputer;
And an output device for outputting data processed by the microcomputer.
マイクロコンピュータを含むターゲットシステムのためのデバッグシステムであって、
ホストシステムが発行したデバッグコマンドを少なくとも1つのプリミティブコマンドに変換するための処理を行う第2のモニタ手段と、
前記第2のモニタ手段との間でデータを送受信し、実行するプリミティブコマンドを前記第2のモニタ手段からの受信データに基づいて決定し、決定したプリミティブコマンドを実行するための処理を行う第1のモニタ手段とを含み、
前記第1のモニタ手段は、
前記第1のモニタ手段の処理を実行するためのモニタプログラムが格納されるモニタROMを含み、
前記モニタプログラムは、
前記プリミティブコマンドの命令コードを含み、
前記第2のモニタ手段からの前記受信データは、
前記プリミティブコマンドを識別するための識別データを含み、
前記第1のモニタ手段は、
前記第2のモニタ手段から前記受信データを受信した場合に、前記受信データに含まれる前記識別データにより指定される命令コードのプリミティブコマンドを実行することを特徴とする特徴とするデバッグシステム。
A debugging system for a target system including a microcomputer,
Second monitoring means for performing processing for converting a debug command issued by the host system into at least one primitive command;
Data is transmitted / received to / from the second monitoring means, a primitive command to be executed is determined based on the received data from the second monitoring means, and processing for executing the determined primitive command is performed. Monitoring means,
The first monitoring means includes
A monitor ROM for storing a monitor program for executing the processing of the first monitor means;
The monitor program is
Including an instruction code of the primitive command;
The received data from the second monitor means is
Including identification data for identifying the primitive command;
The first monitoring means includes
A debug system characterized by executing a primitive command of an instruction code specified by the identification data included in the received data when the received data is received from the second monitor means.
マイクロコンピュータを含むターゲットシステムのためのデバッグシステムであって、
ホストシステムが発行したデバッグコマンドを少なくとも1つのプリミティブコマンドに変換するための処理を行う第2のモニタ手段と、
前記第2のモニタ手段との間でデータを送受信し、実行するプリミティブコマンドを前記第2のモニタ手段からの受信データに基づいて決定し、決定したプリミティブコマンドを実行するための処理を行う第1のモニタ手段と、
前記中央処理ユニットの命令実行処理に使用され、デバッグモード時におけるメモリマップ上にそのアドレスが割り付けられる制御レジスタとを含み、
前記第2のモニタ手段は、
前記デバッグコマンドであるステップ実行コマンドを、ステップ実行イネーブルビットへのライトコマンドである第1のプリミティブコマンドと、GOコマンドである第2のプリミティブコマンドに変換し、
前記第1のモニタ手段は、
前記第1、第2のプリミティブコマンドを実行することで、ステップ実行処理を行うことを特徴とするデバッグシステム。
A debugging system for a target system including a microcomputer,
Second monitoring means for performing processing for converting a debug command issued by the host system into at least one primitive command;
Data is transmitted / received to / from the second monitoring means, a primitive command to be executed is determined based on the received data from the second monitoring means, and processing for executing the determined primitive command is performed. Monitoring means,
A control register that is used for instruction execution processing of the central processing unit and whose address is allocated on a memory map in debug mode;
The second monitor means includes
The step execution command which is the debug command is converted into a first primitive command which is a write command to a step execution enable bit and a second primitive command which is a GO command.
The first monitoring means includes
A debug system that performs step execution processing by executing the first and second primitive commands.
マイクロコンピュータを含むターゲットシステムのためのデバッグシステムであって、
ホストシステムが発行したデバッグコマンドを少なくとも1つのプリミティブコマンドに変換するための処理を行う第2のモニタ手段と、
前記第2のモニタ手段との間でデータを送受信し、実行するプリミティブコマンドを前記第2のモニタ手段からの受信データに基づいて決定し、決定したプリミティブコマンドを実行するための処理を行う第1のモニタ手段と、
前記第2のモニタ手段からの前記受信データを一時的に蓄えるための受信バッファと、
前記第2のモニタ手段への送信データを一時的に蓄えるための送信バッファとを含み、
前記第2のモニタ手段からの前記受信データは、
前記プリミティブコマンドを識別するための識別データを含み、
前記第1のモニタ手段は、
前記受信データの識別データがリードコマンドのプリミティブコマンドを示すものであった場合には、前記受信バッファの前記受信データからリードアドレスを取得し、取得した前記リードアドレスからデータをリードし、リードした前記データを前記送信バッファにライトし、
前記受信データの識別データがライトコマンドのプリミティブコマンドを示すものであった場合には、前記受信バッファの前記受信データからライトアドレスとライトデータを取得し、取得した前記ライトアドレスに、取得した前記ライトデータを書き込む処理を行うことを特徴とするデバッグシステム。
A debugging system for a target system including a microcomputer,
Second monitoring means for performing processing for converting a debug command issued by the host system into at least one primitive command;
Data is transmitted / received to / from the second monitoring means, a primitive command to be executed is determined based on the received data from the second monitoring means, and processing for executing the determined primitive command is performed. Monitoring means,
A reception buffer for temporarily storing the reception data from the second monitoring means;
A transmission buffer for temporarily storing transmission data to the second monitoring means,
The received data from the second monitor means is
Including identification data for identifying the primitive command;
The first monitoring means includes
When the identification data of the received data indicates a primitive command of a read command, a read address is acquired from the received data of the reception buffer, data is read from the acquired read address, and the read Write data to the transmit buffer;
If the identification data of the received data indicates a primitive command of a write command, a write address and write data are acquired from the received data of the reception buffer, and the acquired write address is acquired at the acquired write address. A debugging system that performs a process of writing data.
JP2005091910A 2005-03-28 2005-03-28 Microcomputer, electronic equipment and debugging system Pending JP2005251217A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2005091910A JP2005251217A (en) 2005-03-28 2005-03-28 Microcomputer, electronic equipment and debugging system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2005091910A JP2005251217A (en) 2005-03-28 2005-03-28 Microcomputer, electronic equipment and debugging system

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
JP10372198A Division JP3684832B2 (en) 1998-03-31 1998-03-31 Microcomputer, electronic equipment and debugging system

Publications (1)

Publication Number Publication Date
JP2005251217A true JP2005251217A (en) 2005-09-15

Family

ID=35031565

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2005091910A Pending JP2005251217A (en) 2005-03-28 2005-03-28 Microcomputer, electronic equipment and debugging system

Country Status (1)

Country Link
JP (1) JP2005251217A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE102008008711A1 (en) * 2008-02-11 2009-08-13 Atmel Germany Gmbh Method for testing microcontroller, involves calling command for moving bit values of register of microcontroller as indirect jump address in test mode over interface
DE102008008709A1 (en) * 2008-02-11 2009-08-13 Atmel Germany Gmbh Microcontroller, has computing unit whose address output is connected with parallel input of shift register, where series input and output of shift register are connected with connection of microcontroller and computing unit, respectively

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE102008008711A1 (en) * 2008-02-11 2009-08-13 Atmel Germany Gmbh Method for testing microcontroller, involves calling command for moving bit values of register of microcontroller as indirect jump address in test mode over interface
DE102008008709A1 (en) * 2008-02-11 2009-08-13 Atmel Germany Gmbh Microcontroller, has computing unit whose address output is connected with parallel input of shift register, where series input and output of shift register are connected with connection of microcontroller and computing unit, respectively

Similar Documents

Publication Publication Date Title
JP3684832B2 (en) Microcomputer, electronic equipment and debugging system
US6922795B2 (en) Microcomputer, electronic equipment, and debugging system
US7233541B2 (en) Storage device
JP3671667B2 (en) Microcomputer, electronic equipment and debugging system
US9213615B2 (en) Information processing apparatus with debugging unit and debugging method therefor
CN112559410A (en) FPGA-based LIO bus extension UART peripheral system and method
JP3666237B2 (en) Information processing apparatus and electronic apparatus
JPH10116187A (en) Microcomputer
US7921334B2 (en) Program and method for error determination, and electronic apparatus
JP2000276370A (en) Microcomputer, electronic device and emulation method
JP2005251217A (en) Microcomputer, electronic equipment and debugging system
JP3741182B2 (en) Microcomputer, electronic equipment and debugging system
US7028237B2 (en) Internal bus testing device and method
JP2006252006A (en) Debug system, semiconductor integrated circuit device, microcomputer and electronic device
US6865638B1 (en) Apparatus and method for transferring multi-byte words in a fly-by DMA operation
JP2001092686A (en) Semiconductor device
US8352239B2 (en) Emulator interface device and method thereof
JP5036448B2 (en) FIFO memory reading method in in-circuit emulator and in-circuit emulator for one-chip microcomputer with built-in FIFO memory
JP2000284985A (en) Debug system and information storage medium
JP2006133836A (en) Microcomputer and method of manufacturing microcomputer
JP2008276441A (en) Host controller, semiconductor integrated circuit, and host control method
JP2002358202A (en) Portable information processing apparatus corresponding to plural types of programming language
JP2008293077A (en) Host controller, electronic device, and error determination method

Legal Events

Date Code Title Description
A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20061114

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20070115

RD03 Notification of appointment of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7423

Effective date: 20070115

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20070206

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20070405

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20070501