[go: up one dir, main page]

JP3775462B2 - Debug system and information storage medium - Google Patents

Debug system and information storage medium Download PDF

Info

Publication number
JP3775462B2
JP3775462B2 JP09242899A JP9242899A JP3775462B2 JP 3775462 B2 JP3775462 B2 JP 3775462B2 JP 09242899 A JP09242899 A JP 09242899A JP 9242899 A JP9242899 A JP 9242899A JP 3775462 B2 JP3775462 B2 JP 3775462B2
Authority
JP
Japan
Prior art keywords
information
address
program
instruction
execution
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.)
Expired - Fee Related
Application number
JP09242899A
Other languages
Japanese (ja)
Other versions
JP2000284985A (en
Inventor
真 工藤
力 中山
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 JP09242899A priority Critical patent/JP3775462B2/en
Publication of JP2000284985A publication Critical patent/JP2000284985A/en
Application granted granted Critical
Publication of JP3775462B2 publication Critical patent/JP3775462B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

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

Description

【0001】
【発明の属する技術分野】
本発明は、デバッグシステム及びデバッグシステムに用いる情報記憶媒体に関する。
【0002】
【背景技術及び発明が解決しようとする課題】
近年、ゲーム装置、カーナビゲーションシステム、プリンタ、携帯情報端末などの電子機器に組み込まれ、高度な情報処理を実現できるマイクロコンピュータに対する需要が高まっている。このような組み込み型のマイクロコンピュータは、通常、ターゲットシステムと呼ばれるユーザボードに実装される。このターゲットシステムを動作させるソフトウェアの開発を支援するためにICE(In-Circuit Emulator)と呼ばれるソフトウェア開発支援ツールが広く使用されている。
【0003】
さて、このようなICEとしては、従来、図1に示すようなCPU置き換え型と呼ばれるICEが主流を占めていた。このCPU置き換え型ICEでは、デバッグ時にターゲットシステム300からマイクロコンピュータ302を取り外し、その代わりにデバッグツール304のプローブ306を接続する。そして、このデバッグツール304に、取り外したマイクロコンピュータ302の動作をエミュレートさせる。また、このデバッグツール304に、トレース情報の取得やデバッグのために必要な種々の処理を行わせる。
【0004】
しかしながら、このCPU置き換え型ICEでは、マイクロコンピュータ302の内部動作周波数が上がるとプローブ306やトレース情報を格納するバッファで生じる信号の遅延によりリアルタイムトレースが困難になる。
【0005】
このような問題を解決するために量産チップ上でリアルタイムトレースを可能にするシステムの開発が行われている。このとき、トレース情報としてアドレスバス等の情報をリアルタイムにトレースバッファに格納しようとすると数十本の専用端子が必要となる。ここにおいて、係る端子はデバッグ時のみ必要な物で、エンドユーザーにとっては不要なものであるから、より少ないほうが好ましい。
【0006】
そこで、本出願人はリアルタイムトレースを実現するためのトレース情報を専用4端子に出力し、このトレース情報からリアルタイムトレースを可能にするシステムを開発している。
【0007】
具体的には毎クロック毎にCPUの実行ステータス情報を3端子に出力し、また絶対分岐命令等により絶対分岐が発生すると続く27クロックサイクルで分岐先のPC値をシリアルに1端子に出力する。絶対分岐命令とはプログラムの実行中にレジスタの値等によって分岐先のアドレスが決まる命令であり、命令コードからは分岐先を判断することができない命令である。従って絶対分岐命令が発生するとプログラムの命令コードから分岐先が分からないため分岐先のPC値を出力することでトレースが可能となる。
【0008】
ところが、ターゲットシステムは絶対分岐が発生するまでプログラムカウンタの値を出力しないため、この間のプログラムカウンタ値を把握できずにトレース情報が生成できないという問題点があった。
【0009】
また本出願人の開発中のターゲットシステムはデバッグ用端子を極力少なくするため、絶対分岐命令により絶対分岐が発生した場合と割り込みにより絶対分岐が発生した場合とを区別せずに、いずれも絶対分岐命令実行を示すステータス情報を出力していた。このため絶対分岐命令実行のステータス情報の場合、それが命令実行によるものか割り込みによるものか区別できないという問題点があった。
【0010】
本発明は、以上のような技術的課題に鑑みてなされたものであり、その目的とするところは、少ない端子で量産チップ上でのリアルタイムトレースを実現し、トレース情報の生成が可能なデバッグシステム及び情報記憶媒体を提供することにある。より詳しくは絶対分岐発生以前に関してもトレース情報の生成が可能なデバッグシステム及び情報記憶媒体を提供すること、また絶対分岐発生のステータス情報が絶対分岐命令実行によるものか割り込みによるものかを判別可能なデバッグシステム及び情報記憶媒体を提供することにある。
【0011】
【課題を解決するための手段】
本発明は、CPUの実行状態が通常命令実行、絶対分岐命令実行、相対分岐命令実行のいずれに属するかを判別するためのステータス情報と絶対分岐命令の分岐先アドレスを出力するターゲットシステムのトレース情報を出力するデバッグシステムであって、ターゲットシステムから前記ステータス情報を受け取って上書きしないでメモリに蓄積する手段と、当該デバッグシステムが有しているターゲットシステムの実行開始アドレス及びターゲットのCPUで実行されるプログラムの機械語命令列を把握するための情報に基づき、絶対分岐命令発生以前のトレース情報を生成するトレース情報生成手段と、を含むことを特徴とする。
【0012】
また本発明に係る情報記憶媒体は前記手段を実現するための情報を含むことを特徴とする。
【0013】
ここにおいてターゲットシステムが実行するプログラムの機械語命令列を把握するための情報とは、2進法や16進法で表された機械語の命令コード列でもよいし、機械語の命令コード列をニーモニックコードで表した命令コード列でもよい。少なくともターゲットシステムのCPUが実行する機械語の命令列が把握できるものであればよい。
【0014】
本発明ではターゲットシステムから受け取ったステータス情報を上書きしないでトレースメモリに蓄積する。このため、特に範囲指定トレース等を行わない場合には、実行開始からのステータス情報がトレースメモリの先頭から蓄積されている。このため、当該デバッグシステムはターゲットシステムの実行開始アドレス及びターゲットシステムで実行されたプログラム内容に基づき、前記メモリに蓄積開始後で絶対分岐命令発生以前のトレース情報を生成することができる。
【0015】
本発明によれば、少ないデバッグ用端子しか有しないターゲットシステムのデバッグを行う際にも、絶対分岐命令の実行以前のトレース情報が生成できないといった制約を受けることなく、実行範囲全体のトレース情報をえることができる。
【0016】
すなわち本発明のデバッグシステムは少ないデバッグ情報からでも通常のICE等と同様のトレース情報が作成可能であるため、ターゲットシステムのデバッグ用端子の削減を可能にし、ターゲットシステムのコスト削減に貢献できるという効果も有する。
【0017】
なお、前記実行開始アドレス及びターゲットシステムで実行されたプログラム内容は予めデバッグシステム内に保持しておいてもよいし、後で取得してもよい。
【0018】
例えばデバッグシステムからターゲットシステムの実行開始アドレスを指定して実行させるような場合には、指定した実行開始アドレスを保持しておくようにすることが好ましい。また、デバッグシステムからターゲットシステムに実行用のプログラムをロードするような場合には、ロードじたプログラム内容をデバッグシステム内に保持しておくようにすることが好ましい。
【0019】
本発明は CPUの実行状態が通常命令実行、絶対分岐命令実行、相対分岐命令実行のいずれに属するか及びトリガポイントにマッチしたか否かを判別するためのステータス情報と絶対分岐命令の分岐先アドレスを出力するターゲットシステムのトレース情報を出力するデバッグシステムであって、ターゲットシステムから前記ステータス情報を受け取って、メモリに蓄積する手段と、メモリに蓄積されたステータス情報がトリガポイントにマッチしていることを示している場合に、当該デバッグシステムが有しているトリガポイントアドレス及びターゲットが実行するプログラムの機械語命令列を把握するための情報に基づき絶対分岐命令発生以前のトレース情報を生成するトレース情報生成手段とを含むことを特徴とする。
【0020】
また本発明に係る情報記憶媒体は前記手段を実現するための情報を含むことを特徴とする。
【0021】
ここにおいてターゲットが実行するプログラムの機械語命令列を把握するための情報とは、2進法や16進法で表された機械語の命令コード列でもよいし、機械語の命令コード列をニーモニックコードで表した命令コード列でもよい。少なくともターゲットマシンが実行する機械語の命令コード列が把握できるものであればよい。
【0022】
またトリガポイントは複数ある場合でもよい。トリガポイントは出力する範囲を指定するために用いられ、指定された範囲のステータス情報を出力する場合でもよい。また範囲指定には関係なく、トリガポイントにマッチしたか否かの情報を出力する場合でもよい。
【0023】
メモリに蓄積されたステータス情報にはトリガポイントにマッチしたか否かの情報が含まれている。このため、当該デバッグシステムが有しているトリガポイントアドレス及びターゲットシステムで実行されたプログラム内容に基づき、前記メモリに蓄積開始後で絶対分岐命令発生以前のトレース情報を生成することができる。
【0024】
本発明によれば、少ないデバッグ用端子しか有しないターゲットシステムのデバッグを行う際にも、絶対分岐命令の実行以前のトレース情報が生成できないといった制約を受けることなく、実行範囲全体のトレース情報をえることができる。
【0025】
すなわち本発明のデバッグシステムは少ないデバッグ情報からでも通常のICE等と同様のトレース情報が作成可能であるため、ターゲットシステムのデバッグ用端子の削減を可能にし、ターゲットシステムのコスト削減に貢献できるという効果も有する。
【0026】
なお、前記トリガポイントアドレス及びターゲットシステムで実行されたプログラム内容は予めデバッグシステム内に保持しておいてもよいし、後で取得してもよい。
【0027】
例えばデバッグシステムからターゲットシステムのトリガポイントアドレスを指定して実行させるような場合には、指定したトリガポイントアドレスを保持しておくようにすることが好ましい。また、デバッグシステムからターゲットシステムに実行用のプログラムをロードするような場合には、ロードしたプログラム内容をデバッグシステム内に保持しておくようにすることが好ましい。
【0028】
本発明は CPUの実行状態が通常命令実行、絶対分岐発生、相対分岐命令実行のいずれに属するかを判別するためのステータス情報と絶対分岐命令の分岐先アドレスを出力するターゲットシステムのトレース情報を出力するデバッグシステムであって、ターゲットシステムから前記ステータス情報を受け取ってメモリに蓄積する手段と、前記メモリに蓄積されたステータス情報が絶対分岐発生を示していた場合に、当該絶対分岐発生が割り込み発生によるものか否かを、プログラムの機械語命令列を把握するための情報に基づき判別してトレース情報を生成するトレース情報生成手段とを含むことを特徴とする。
【0029】
また本発明に係る情報記憶媒体は前記手段を実現するための情報を含むことを特徴とする。
【0030】
ここにおいてターゲットが実行するプログラムの機械語命令列を把握するための情報とは、2進法や16進法で表された機械語の命令コード列でもよいし、機械語の命令コード列をニーモニックコードで表した命令コード列でもよい。少なくともターゲットマシンが実行する機械語の命令コード列が把握できるものであればよい。
【0031】
絶対分岐は一般に絶対分岐命令が実行された場合や割り込みがあった場合に発生する。ここにおいて割り込みとはプログラム分岐の一種であるが分岐命令によるものではなくコンピュータのハードウエアの信号によって分岐するものである。本発明のターゲットシステムではデバッグ用の端子を減らすために、割り込みによって絶対分岐が起こった場合と分岐命令によって絶対分岐が起こった場合とを区別せずにいずれも絶対分岐発生のステータス情報を出力している。
【0032】
従ってステータス情報と絶対分岐先のアドレスのみからでは、絶対分岐命令が実行されたのか割り込みが発生したのか判別できずトレース情報の生成が困難である。
【0033】
しかし本発明では、絶対分岐命令実行を示すステータスに対応したプログラムの機械語命令列が、実際に絶対分岐命令であるか否かを自動的に調べて前記判別を行うことで、トレース情報の生成を可能としている。
【0034】
本発明によれば、少ないデバッグ用端子しか有しないターゲットシステムのデバッグを行う際にも、絶対分岐命令と割り込みの発生の区別を行いトレース情報を生成することができる。すなわち本発明のデバッグシステムは少ないデバッグ情報からでも通常のICE等と同様のトレース情報が作成可能であるため、ターゲットシステムのデバッグ用端子の削減を可能にし、ターゲットシステムのコスト削減に貢献できるという効果も有する。
【0035】
なお、ターゲットシステムが実行するプログラムの機械語命令列を把握するための情報は予めデバッグシステム内に保持しておいてもよいし、後で取得してもよい。
【0036】
例えばデバッグシステムからターゲットシステムに実行用のプログラムをロードするような場合には、ロードしたプログラム内容をデバッグシステム内に保持しておくようにすることが好ましい。
【0037】
本発明のデバッグシステムは ターゲットが実行するプログラムの機械語命令列を把握するための情報を予め記憶しているプログラム情報記憶手段をさらに含み、前記トレース情報生成手段が、プログラム情報記憶手段に記憶された前記プログラムの機械語命令列を把握するための情報を用いてトレース情報を生成する事を特徴とする。
【0038】
また本発明に係る情報記憶媒体は前記手段を実現するための情報を含むことを特徴とする。
【0039】
本発明によれば、トレース情報生成の度にターゲットシステムのメモリを読む必要がないので、ターゲットシステム実行中でもトレース情報の生成が可能になる。またトレース情報の生成のための処理時間を大幅に削減することができる。
【0040】
【発明の実施の形態】
以下、本発明の好適な実施形態について図面を用いて詳細に説明する。
【0041】
1.本実施形態の構成の概要
まず本実施形態の構成について図2を用いて説明する。
【0042】
図2に示すように、デバッグ対象となるターゲットシステムであるマイクロコンピュータ10は、CPU(中央処理ユニット)12、実行情報出力部14、内部メモリ16を含む。
【0043】
ここで実行情報出力部16は、リアルタイムトレースを実現するための実行情報を専用4端子に出力する。具体的には毎クロック毎にCPUの命令実行ステータス情報を3端子(DST[2:0])に出力し、PC絶対分岐実行が発生すると続く27クロックサイクルで分岐先のPC値(DPCO)をシリアルに1端子に出力する。
【0044】
また内部メモリ16にはターゲットシステムで実行されるプログラム等が記憶されている。
【0045】
また本実施形態のデバッグシステム20は、ターゲットであるマイクロコンピュータに直接接続されるデバッグツール21と、当該デバッグツールと接続されたホストコンピュータ23で構成されている。
【0046】
デバッグツール21は実行情報取得部22,ターゲットメモリ書き込み部28を含み、ホストコンピュータ23はプログラム情報記憶部26、トレース情報生成部27,プログラム情報書き込み部29を含んでいる。
【0047】
実行情報取得部22は、3ビットのDST[2:0]と、分岐先のPC(プログラムカウンタ)値を表すDPCOを内部のトレースメモリ24に格納する。トレース範囲が指定されている場合には、その範囲のDST[2:0]とDPCOをトレースメモリに格納する。
【0048】
なお分岐先PCは下位ビットから1ビットずつシリアルに出力されるため、全ビット出力される前に新たな絶対分岐が発生すると、絶対分岐先のアドレス情報の一部しかを受けとれないことになる。
【0049】
ターゲットメモリ書き込み部28は、ターゲットシステムの内部メモリ16にプログラムをロードしたり、ターゲットシステムのメモリのプログラムを書き換えたりする機能を有し、TXD/RXDライン(双方向通信ライン)を介してマイクロコンピュータ10の内部メモリ14に書き込むデータを送信する。
【0050】
プログラム情報記憶部26は、ターゲットシステムの内部メモリ16に記憶されたプログラムと同一のプログラムの機械語コード列を記憶する。
【0051】
トレース情報生成部27は、ターゲットシステムから絶対分岐先アドレスの一部を受け取った場合に、ターゲットシステムが実行するプログラムが存在するアドレス領域に関する情報及びターゲットシステムから受けとったステータス情報の少なくとも一方に基づき、前記絶対分岐先アドレスの一部以外の部分を特定してトレース情報を生成する処理を行う。さらに受け取った絶対分岐先のアドレス情報の一部を下位ビットとする候補アドレス群を抽出し、ターゲットシステムから受け取ったステータス情報の配列と、候補アドレス群に含まれる所与の候補アドレスにより特定される機械語コード列から予測されるステータス情報の配列と比較して絶対分岐先のアドレス情報を特定する処理を行う。
【0052】
また当該デバッグシステムが有しているターゲットシステムの実行開始アドレス及びターゲットのCPUで実行されるプログラムの機械語コード列に基づき絶対分岐命令発生以前のトレース情報を生成する処理を行う。
【0053】
またメモリに蓄積されたステータス情報がトリガポイントにマッチしていることを示している場合には、当該デバッグシステムが有しているトリガポイントアドレス及びターゲットが実行するプログラムの機械語コード列に基づき、絶対分岐命令発生以前のトレース情報を生成する処理を行う。
【0054】
前記メモリに蓄積されたステータス情報が絶対分岐発生を示していた場合には、当該絶対分岐発生が割り込み発生によるものか否かを、プログラムの機械語コード列に基づき判別してトレース情報を生成する処理を行う。
【0055】
またトレース情報生成に際しては、プログラム情報記憶部26に記憶されたプログラムの機械語コード列を用いる。
【0056】
プログラム情報書き込み部29は、ターゲットシステムのメモリにロードしたプログラムと同一のプログラムを前記プログラム情報記憶部26にロードしたり、ターゲットシステムのメモリに記憶されているプログラムコードを読み出して前記プログラム情報記憶部26に書き込んだり、前記プログラム情報記憶部26に記憶されたプログラムをターゲットシステムのプログラムと同内容になるよう書き換えたりする処理を行う。
【0057】
2.ターゲットシステムが出力するステータス情報の内容
図3はDST[2:0]の出力値(以下DST情報という)とCPUの命令実行状態の関係を表した図である。ここにおいてPC相対分岐命令とはプログラム中に明示的に記述されたアドレスに分岐する命令であり、命令コードから分岐先を判断可能である。またPC絶対分岐命令とはプログラムの実行中にレジスタの値によって分岐先のアドレスが決まる命令であり、命令コードからは分岐先を判断することができない。
【0058】
従って本実施の形態ではPC絶対分岐命令が発生すると分岐先のPC値(DPCO)を出力することでトレースを可能としている。
【0059】
即ちマイクロプロセッサが命令をアドレスの順番に実行している時(DST情報が000又は100である場合)には、プログラムカウンタがどこまで進んだか分かるのでプログラムの命令コードからトレースが可能である。また、マイクロプロセッサがPC相対分岐命令を実行した時(DST情報が001又は101である場合)にも、プログラムの命令コードから分岐先が分かるのでトレースが可能である。
【0060】
しかし、マイクロプロセッサがPC絶対分岐命令を実行した時(DST情報が010又は110である場合)には、プログラムの命令コードから分岐先が分からないため、DST情報のみではトレースができない。そこで、係る場合に分岐先のPC値(DPCO)を出力することでトレースを可能としているのである。
【0061】
3.分岐先アドレスを特定するための処理
ターゲットシステムは、前記PC値をシリアルに1端子に出力しているので、絶対分岐命令が連続又は数命令間隔で実行されると、PC値の情報が途中で途切れてしまいトレースができないという問題点があった。
【0062】
そこで本実施の形態では、PC値の一部の情報しかえることが出来ない場合でも後述するマップ情報と前記DST情報に基づき絶対分岐の分岐先PC値を特定できるように、トレース情報生成部27は以下に説明するような分岐先アドレスを特定するための処理を行っている。
【0063】
図4(A)(B)は絶対分岐先のアドレスを特定するための候補アドレス群の抽出について説明するための図である。
【0064】
図4(A)の310は、DPCO信号から得られたPC値の情報を16進数で表したものである。PC値は下位のビットから1ビットずつ27ビット出力されるが、この間に新たな絶対分岐が発生したら、そこで新たな絶対分岐先のPC値が出力されるため、先に出力されていたPC値はそこで途切れてしまう。
【0065】
310は下位12ビット分の情報312でPC値が途切れてしまい、上位のビット情報314、316が得られていない状態である。このような場合、先頭の4ビット316(16進コードなので1桁)を0とすると絶対分岐先の候補となるPC値は216=65536個となる(図4(A)320参照)。従って、実際のPC値を特定することは困難である。
【0066】
そこで本実施の形態では、図4(B)に示すようにターゲットシステムのCPUが接続されているメモリのマップ情報330を、デバッグシステムのパラメタファイル340に格納しておく。マップ情報330とはプログラムが存在するアドレスに関する情報であり、例えばマップ情報330は、ターゲットのCPUにRAM1、IROM、RAM2が接続されており、RAM1の0−7FF番地、IROMの80000−80FFF番地、RAM2の90000−9FFFF番地にプログラムが格納されていることを示している。
【0067】
PC値の下位12ビットの情報が図4(A)と同じく802番地であるとすると、RAM1の中には候補はなく、IROMでは80802番地が候補となり、RAM2では90802〜9F802の16個が候補となり、全部で候補数は17となる(図4(B)の340参照)。
【0068】
図5(A)〜(C)はマップ情報から抽出した候補群からの絶対分岐先のアドレスを特定する処理について説明するための図である。図5(A)は、トレースメモリ24に格納されている絶対分岐命令実行以降のDST情報350を示している。
【0069】
図5(B)は、マップ情報により特定された候補群の一つである80802番地以降の命令コード360と当該命令コードの命令の種類370と当該命令コードが実行された場合に出力されるであろうDST情報380を表している。
【0070】
また、図5(C)は、マップ情報により特定された候補群の一つである90802番地以降の命令コード390と当該命令コードの命令の種類400と当該命令コードが実行された場合に出力されるであろうDST情報410を表している。他の候補群についても図5(B)(C)と同様に出力が予想されるであろうDST情報列を生成して、図5(A)のトレースメモリ24のDST情報350と比較処理を行う。そして同じであれば、当該候補が分岐先アドレスとして特定される。ここでは、図5(B)の80802番地以降の命令実行により出力されるDST情報列が図5(A)のトレースメモリ34のDST情報350と一致するので、80802番地を分岐先アドレスとして特定する。
【0071】
図6、図7、図8は、絶対分岐が短い間隔で発生しDPCOからプログラムカウンタ値が全ビット出力されない場合に分岐先アドレスを特定する処理の動作例を示すフローチャート図である。
【0072】
まず図6を用いて不完全PC値の解析処理の全体の流れについて説明する。
【0073】
不完全PC値の解析処理の開始にあたり、まず候補PC値(ulWorkPc)、候補数(ulExpectNum)の初期設定を行う(ステップS10)。
【0074】
そしてループA(ステップS20〜S40)でパラメタファイルでマップ情報を定義してあるメモリの個数分、マップ情報を利用した候補PC検索処理(ステップS30)を行う。例えば図4(B)においては、パラメタファイル340において、RAM1、IROM、RAM2の3つのメモリのマップ情報が定義されているので、3回候補PC値検索処理を行うことになる。この候補PC値検索処理で、候補PC値(ulWorkPc)、候補数(ulExpectNum)が更新される。
【0075】
ループAが終了すると、設定された候補数(ulExpectNum)が1か否か判断する。そして候補数(ulExpectNum)=1であれば、1つのPC値に特定されたと判断し、候補PC値特定処理で更新された候補PC値(ulWorkPc)を、実際にCPUが実行したアドレスとし、トレースデータの生成処理を行う(ステップS50、S60)。
【0076】
次に図7を用いて、マップ情報を利用した候補PC検索処理(図6のステップS30)の詳細な処理例について説明する。
【0077】
マップ情報で定義されたメモリの先頭アドレスをDPCO信号の出力ビット数だけ右にシフトしたものを、開始アドレス(ulMapTopAddr)にセットする。また、マップ情報で定義されたメモリの終了アドレスをDPCO信号の出力ビット数だけ右にシフトしたものを、終了アドレス(ulMapBottomAddr)にセットする。
【0078】
例えば図4(A)(B)で説明したようにDPCO信号の出力が12ビットである場合(図4(A)の312参照)には、RAM2の先頭アドレス90000を12ビットだけ右にシフトした00090を開始アドレス(ulMapTopAddr)にセットする。またRAM2の最後尾アドレス9FFFFを12ビットだけ右にシフトした0009Fを終了アドレス(ulMapBottomAddr)にセットする。なお、先頭アドレス90000、最後尾アドレス9FFFFは16進数で表記しているため、一桁で4ビット分のDPCO信号を表している。
【0079】
そしてループBで開始アドレス(ulMapTopAddr)から終了アドレス(ulMapBottomAddr)まで以下の処理を繰り返す(ステップS120〜S170)。例えば図4(B)の場合、00090から0009Fまで16回繰り返すことになる。
【0080】
まず、開始アドレス(ulMapTopAddr)をDPCO信号の出力ビット数だけ左にシフトしたものに、DPCOから得られた出力中のPC値を足したものを処理対象PC値(ulPC)にセットする(ステップS130)。
【0081】
そして命令コード上で処理対象PC値(ulPC)以降の命令値を取り出すためのワークアドレス(unWorkAddr)に処理対象PC値(ulPC)をセットする(ステップS140)。
【0082】
例えば図4(B)において、最初の開始アドレス(ulMapTopAddr)をは、00090である。従ってこれをDPCO信号の出力ビット数である12ビットだけ左にシフトさせると09000となる。これにDPCOから得られた出力中のPC値である000802を足した090802が処理対象PC値(ulPC)としてセットされる。
【0083】
そして処理対象PC値(ulPC)に対してDST情報を利用したPC値特定処理を行う(ステップS150)。
【0084】
そして次のループに備えて、開始アドレス(ulMapTopAddr)を更新しておく(ステップS160)。図4(B)では開始アドレス(ulMapTopAddr)が更新されて00091となる。
【0085】
次に図8を用いて、DST情報を利用したPC値特定処理(図7のステップS150)の詳細な処理例について説明する。
【0086】
ループCでDPCO信号の出力ビット数だけ以下の処理を繰り返す(ステップS210〜S250)。本実施の形態では1クロック毎にDPCOが1ビット出力されるので絶対分岐命令が発生してから概ねDPCO信号の出力ビット数だけそれ以降の命令が実行されているため、DPCO信号の出力ビット数だけそれ以降の命令の実行状態を表すDST情報がトレースメモリに格納されることになるからである。
【0087】
例えば図4(B)ではDPCO信号の出力ビット数が12ビットであるので、ステップS220からS240までの処理が12回繰り返されることになる。
【0088】
まず比較対象DSTコード(ucKindCode)に、ワークアドレス(unWorkAddr)が指すプログラム上の命令コードを実行した場合に出力されるであろうDST信号を代入する(ステップS220)。例えば図5(B)においてワークアドレス1(362)は分岐無し命令であるaddを指しているので、分岐無し命令が実行された場合に出力されるであろうDST情報’000’を比較対象DSTコード(ucKindCode)に代入する。
【0089】
そしてトレースメモリ上の対応するDST信号と前記比較対象DSTコードと(ucKindCode)比較して一致していなければ当該処理対象PC値は求める絶対分岐先のPC値ではないとしてループCを抜ける(ステップS230)。
【0090】
一致している場合には命令コード上の次の命令コードを取り出すために、ワークアドレス(unWorkAddr)を次の命令コード位置に位置づける(ステップS240)。αは次の命令に移行するための命令サイズである。例えば図5(B)において1命令が2バイトの場合、ワークアドレス1(362)からワークアドレス2(364)に位置づける。
【0091】
そしてDPCO信号の出力ビット数だけループCが実行された場合には、候補PC値以降の命令コードが実行された場合のDST信号とトレースメモリに格納されたDST信号がすべて一致したことになるので、当該処理対象PC値(ulPC)が求める絶対分岐先のアドレスであるとして、処理対象PC値(ulPC)を候補PC値(ulWorkPc)にセットする。また候補数(ulExpectNum)をインクリメントする(ステップS260)。
【0092】
4.ターゲットシステムを停止させることなくトレース機能を実現するための処理
本実施の形態ではターゲットシステムの実行を停止させることなくトレース情報を生成するために、ターゲットシステムの内部メモリに記憶されたプログラムの機械語命令列(以下プログラム情報という)をホストコンピュータのプログラム情報記憶部26に記憶させている。
【0093】
このようにする事により、例えばトレースメモリ上のDST信号と比較する前記比較対象DSTコード(ucKindCode)にを、プログラム情報記憶部26に記憶されたプログラム情報から作成することができる。従ってトレース情報を生成する際にターゲットシステムの内部メモリ16を読む必要がないので、ターゲットシステムの実行を停止させることなくトレース情報を生成することができる。
【0094】
また、ターゲットシステムの内部メモリ16を読む必要がないのでトレース情報生成のための処理時間を大幅に短縮することができる。
【0095】
本実施の形態ではターゲットシステムの内部メモリ16に記憶されたプログラム情報であってトレースに使うものをホストコンピュータのプログラム情報記憶部26に記憶させるために、プログラム情報書き込み部29は以下のような処理を行っている。
【0096】
図9はターゲットシステムの内部メモリにプログラムをロードする場合の動作例を説明するためのフローチャート図である。
【0097】
本実施の形態ではターゲットシステムの内部メモリにプログラムをロードする際に、当該プログラムのトレース予定がある場合にはターゲットシステムの内部メモリにロードしたプログラム内容をプログラム情報記憶部に書き込む(ステップS310、S320、S330)。
【0098】
図10は、ターゲットシステムの内部のプログラムを書き換える場合の動作例を説明するためのフローチャート図である。
【0099】
本実施の形態ではターゲットシステムの内部メモリのプログラムを書き換える際に、当該プログラムのトレース予定がある場合には前記プログラム情報記憶部に記憶されたプログラムの対応箇所をターゲットシステムのプログラムと同内容に書き換える(ステップS410、S420、S430)。
【0100】
図11は、プログラムをロードせずに、既にターゲットシステムの内部メモリにある場合の動作例について説明するためのフローチャート図である。
【0101】
当該プログラムのトレースを行う場合には、マップ情報からプログラムが格納されているメモリのスタートアドレスとエンドアドレスを特定する(ステップS510、S520)。そしてターゲットシステムの内部メモリのスタートアドレス、エンドアドレスで特定されている内容を読み込み、プログラム情報記憶部に書き込む(ステップS530)。
【0102】
5.絶対分岐命令発生以前のプログラムカウンタ解析処理
図12は絶対分岐命令発生以前のプログラムカウンタ解析処理について説明するための図である。図12は、ターゲットシステムで命令i1、i2、…が実行されて、そのステータス情報DST1〜DST12がトレースメモリに蓄積されている様子を表している。本実施の形態ではターゲットシステムは絶対分岐命令を実行するまでプログラムカウンタ値を出力しないので、命令i9が実行されるまでプログラムカウンタ値は出力されない。従って絶対分岐発生以前に実行された命令i1〜命令i8については、実行位置の特定ができずトレース情報が作成できないという問題点があった。
【0103】
そこで本実施の形態では、トレースメモリに蓄積された先頭ステータス情報DST1に対応する命令実行の際のプログラムカウンタを特定するために以下のような構成を採用している。
【0104】
すなわち、範囲指定トレースを行わない場合には、例えばプログラムの実行開始位置を指定して実行させる際に、デバッグシステムで実行開始アドレスを取得しておく。そしてトレースメモリに上書きしないオーバーライト無しモードにおいて、ターゲットシステムから出力されるステータス情報を蓄積する。
【0105】
ここにおいて、範囲指定トレースを行わない場合には、ターゲットシステムは実行したすべての命令についてステータス情報であるDST情報を出力する。従ってトレースメモリの先頭に蓄積されているDST情報DST1は、前記実行開始アドレスに対応する命令が出力したものと特定できる。
【0106】
また本実施の形態のターゲットシステムは先頭アドレスとエンドアドレスをトリガアドレスとしてセットすることにより、先頭アドレスからエンドアドレスまでの命令に対応したステータス情報のみを出力させる範囲指定トレースを行うことができる。このときデバッグシステムで、ターゲットシステムにセットしたトリガアドレスをあらかじめ取得しておく。
【0107】
係る範囲指定トレースを行う場合には、トレースメモリの先頭に蓄積されているDST情報DST1は、先頭アドレスとして指定したトリガアドレスに対応する命令が出力したものと特定できる。
【0108】
図13は、トレースメモリに蓄積されている最も古いデータ出力時のプログラムカウンタを解析する処理の動作例を表したフローチャート図である。
【0109】
範囲指定トレースを行う場合には、候補PC(ulPC)に先頭アドレスであるトリガアドレス1をセットする(ステップS610、S620)。
【0110】
また範囲指定トレースを行わない場合でトレースメモリにオーバーライトしない場合には、候補PC(ulPC)にトレース開始直前のプログラムカウンタ値をセットする(ステップS630、S640)。なお、トレース開始直前のプログラムカウンタ値には、これから実行する命令のアドレス値がセットされている。
【0111】
そして候補PC(ulPC)を、トレースメモリの最も古いステータス情報に対応した命令のアドレス値として、トレース情報を生成する(ステップS650)。
【0112】
6.ハードウエア割り込みの判別処理
図14は、絶対分岐命令実行を示すステータス情報が命令実行によるものかハードウエア割り込みによるものかを判別する処理について説明するための図である。
【0113】
図14の1410に示すようにトレースメモリに格納されているステータス情報が絶対分岐命令の実行を示すものである場合には、通常の絶対分岐命令実行によるものである場合とハードウエア割り込みによるものである場合がある。
【0114】
そこで本実施の形態では、プログラム情報記憶部に記憶されているプログラムの機械語命令列の情報と比較して、前記ステータス情報が通常の絶対分岐命令実行によるものであるかハードウエア割り込みによるものであるかを判別している。
【0115】
トレースメモリに格納されているトレース情報に対応する命令の機械語命令列がi1、i2…とすると、1410のステータス情報が通常の絶対分岐命令実行によるものである場合には対応する機械語命令は1420のi3となる。このi3が絶対分岐命令でない場合には、1410のステータス情報は通常の絶対分岐命令実行によるものでなくハードウエア割り込みによるものであることが判別できることになる。
【0116】
図15は、絶対分岐命令実行を示すステータス情報が命令実行によるものかハードウエア割り込みによるものかを判別する処理の動作例について説明するためのフローチャート図である。
【0117】
トレースメモリに蓄積されているDST情報の個数だけループAの処理を行う(ステップS710〜S760)。
【0118】
DST情報が絶対分岐命令の実行を示している場合には、まず当該DST情報出力の際のプログラムカウンタが示すアドレスを解析する(ステップS720,S730)。そして、解析結果のプログラムカウンタが示すアドレスの命令コードが絶対分岐命令でない場合にはハードウエア割り込み発生箇所とし、データに登録する(ステップS740,S750)。
【0119】
7.ターゲットシステムとデバッグツールの構成例
図16に本実施形態のマイクロコンピュータ及びデバッグシステムの詳細な構成例を示す。図16に示すように、マイクロコンピュータ1020は、CPU1022、BCU(バス制御ユニット)1026、内部メモリ(ミニモニタROM1042及びミニモニタRAM1044以外の内部ROM及び内部RAM)1028、クロック生成部1030、ミニモニタ部1040(第1のモニタ手段)、実行情報出力部1050を含む。
【0120】
ここでCPU1022は、種々の命令の実行処理を行うものであり、内部レジスタ1024を含む。内部レジスタ1024は、汎用レジスタであるR0〜R15や、特殊レジスタであるSP(スタックポインタレジスタ)、AHR(積和結果データの上位レジスタ)、ALR(積和結果データの下位レジスタ)などを含む。
【0121】
BCU1026はバスを制御するものである。例えば、CPU1022に接続されるハーバードアーキテクチャのバス1031や、内部メモリ1028に接続されるバス1032や、外部メモリ1036に接続される外部バス1033や、ミニモニタ部1040、実行情報出力部1050などに接続される内部バス1034の制御を行う。
【0122】
またクロック生成部1030は、マイクロコンピュータ1020内で使用される各種のクロックを生成するものである。クロック生成部1030はBCLKを介して外部のデバッグツール1060にもクロックを供給している。
【0123】
ミニモニタ部1040は、ミニモニタROM1042、ミニモニタRAM1044、制御レジスタ1046、SIO1048を含む。
【0124】
ここで、ミニモニタROM1042には、ミニモニタプログラムが格納される。本実施形態では、このミニモニタプログラムは、GO、リード、ライトなどのシンプルでプリミティブなコマンドの処理のみを行うようになっている。このため、ミニモニタROM42のメモリ容量を例えば256バイト程度に抑えることができ、オンチップデバッグ機能を持たせながらマイクロコンピュータ1020を小規模化できるようになる。
【0125】
ミニモニタRAM1044には、デバッグモードへの移行時に(ユーザプログラムのブレーク発生時に)、CPU1022の内部レジスタ1024の内容が退避される。これにより、デバッグモードの終了後にユーザプログラムの実行を適正に再スタートできるようになる。また内部レジスタの内容のリード等を、ミニモニタプログラムが持つプリミティブなリードコマンド等で実現できるようになる。
【0126】
制御レジスタ1046は、各種のデバッグ処理を制御するためのレジスタであり、ステップ実行イネーブルビット、ブレークイネーブルビット、ブレークアドレスビット、トレースイネーブルビットなどを有する。ミニモニタプログラムにより動作するCPU1022が制御レジスタ1046の各ビットにデータをライトしたり、各ビットのデータをリードすることで、各種のデバッグ処理が実現される。
【0127】
SIO1048は、マイクロコンピュータ1020の外部に設けられたデバッグツール1060との間でデータを送受信するためのものである。SIO1048とデバッグツール1060との間は、TXD/RXD(データ送受信ライン)で接続されている。
【0128】
実行情報出力部1050は、リアルタイムトレース機能を実現するためのものであり、CPUの実行状態を表すステータス情報であるDST情報(DST[2:0])及びPC絶対分岐が発生した際の分岐先のPC(プログラムカウンタ)値(DPCO)を実行情報として専用4端子を介して外部に出力する。
【0129】
実行情報出力部1050とデバッグツール1060との間は、CPU1022の命令実行のステータス情報を出力する3本のDST[2:0]と、絶対分岐先のPC(プログラムカウンタ)値をシリアルに1ビットずつ出力する1本のDPCOという4本のラインで接続されている。
【0130】
デバッグツール1060はメインモニタ部1062、実行情報取得部1064を含み、パーソナルコンピュータ等により実現されるホストシステム1066に接続される。
【0131】
メインモニタ部106は、ホストシステム1066から入力されるデバッグコマンドをプリミティブコマンドに変換(分解)するための処理を行う。そして、メインモニタ部1062が、プリミティブコマンドの実行を指示するデータをミニモニタ部1040に送信すると、ミニモニタ部1040が、指示されたプリミティブコマンドを実行するための処理を行うことになる。
【0132】
また、実行情報取得部1064は、3ビットのDST[2:0]と、分岐先のPC(プログラムカウンタ)値を表すDPCOを内部のトレースメモリ1104に格納する。トレース範囲が指定されている場合には、その範囲のDST[2:0]とDPCOをトレースメモリに格納する。
【0133】
次に本実施の形態で、デバッグシステムからマイクロコンピュータの内部メモリにプログラムをロードしたり、内部メモリの情報を書き換える構成について説明する。
【0134】
図17に示すように、本実施形態では、マイクロコンピュータ1020が、CPU(中央処理ユニット)1022及び本実施形態の要部であるミニモニタ部(第1のモニタ手段)1040を含む。また、マイクロコンピュータ1020の外部にはメインモニタ部(第2のモニタ手段)1062が設けられている。ここでメインモニタ部1062は、例えばホストコンピュータ1066などが発行したデバッグコマンドをプリミティブコマンドに変換(分解)するための処理を行う。また、ミニモニタ部1040は、メインモニタ部1062との間でデータを送受信する。そして、ミニモニタ部1040は、実行するプリミティブコマンドを、メインモニタ部1062からの受信データに基づいて決定し、プリミティブコマンドを実行するための処理を行う。
【0135】
ここで、メインモニタ部1062の変換処理の対象となるデバッグコマンドとしては、プログラムロード、GO、ステップ実行、メモリライト、メモリリード、内部レジスタライト、内部レジスタリード、ブレークポイント設定、ブレークポイント解除などのコマンドを考えることができる。メインモニタ部1062は、これらの多様で複雑なデバッグコマンドを、例えばGO、ライト(デバッグモード時におけるメモリマップ上の所与のアドレスへのライト)、リード(メモリマップ上の所与のアドレスからのリード)などの、シンプルでプリミティブなコマンドに変換する処理を行う。このようにすることで、ミニモニタ部1040の処理を行うミニモニタプログラムの命令コードサイズを格段に小さくすることができる。
【0136】
これにより、デバッグシステムからマイクロコンピュータの内部メモリにプログラムをロードしたり、内部メモリの情報を書き換えることができる。すなわちターゲットシステムであるマイクロコンピュータにプログラムロードを行う場合や、メモリライトを行う場合には、ホストコンピュータから、これらのデバッグコマンドを発行することになる。
【0137】
8.プリミティブコマンドへの変換
図18(A)(B)(C)(D)に、各種のデバッグコマンドをプリミティブコマンドへ変換する処理について模式的に示す。
【0138】
例えば図18(A)に示すように、(ADD・・・、SUB・・・、AND・・・、OR・・・、XOR・・・、LD.W・・・)という12バイトのプログラムを80010h番地にロードするというデバッグコマンドが発行されたとする。この場合、このプログラムロードコマンドは、ライト(80010h、ADD・・・、SUB)、ライト(80014h、AND・・・、OR・・・)、ライト(80018h、XOR・・・、LD.W・・・)という3つのプリミティブなライトコマンドに変換される。即ち、ミニモニタプログラムが、この3つのプリミティブなライトコマンドを実行することで、プログラムロードコマンドが実現されるようになる。
【0139】
また図18(B)に示すようにステップ実行コマンドというデバッグコマンドが発行されたとする。すると、このステップ実行コマンドは、図16の制御レジスタ1046のステップ実行イネーブルビットへのライトコマンドとGOコマンドに変換される。即ち、ミニモニタプログラムが、このプリミティブなライトコマンドとGOコマンドを実行することで、ステップ実行コマンドが実現されるようになる。
【0140】
また図18(C)に示すように内部レジスタリードコマンドというデバッグコマンドが発行されたとする。すると、この内部レジスタリードコマンドは、メモリマップ上のミニモニタRAM44(内部レジスタの内容の退避先)からのリードコマンドに変換される。即ち、ミニモニタプログラムが、このプリミティブなリードコマンドを実行することで、内部レジスタリードコマンドが実現されるようになる。内部レジスタライトコマンド、メモリリードコマンド、メモリライトコマンドも同様にして実現される。
【0141】
また図18(D)に示すようにトリガアドレスをブレークポイントとして設定するブレークポイント設定コマンドというデバッグコマンドが発行されたとする。すると、このブレークポイント設定コマンドは、制御レジスタ1046のブレークイネーブルビット及びブレークアドレスビットへのライトコマンドに変換される。即ち、ミニモニタプログラムが、このプリミティブなライトコマンドを実行することで、ブレークポイント設定コマンドが実現されるようになる。
【0142】
このように本実施形態では、複雑で多様なデバッグコマンドが、プリミティブでシンプルなリード、ライト、GOコマンドに変換される。そして、ミニモニタプログラムは、このプリミティブなリード、ライト、GOコマンドを実行するだけでよいため、ミニモニタプログラムの命令コードサイズは非常に小さくなる。この結果、ミニモニタROM1042のメモリ容量も小さくでき、小さなハードウェア規模でオンチップデバッグ機能を実現できるようになる。
【0143】
9.デバッグツールの構成例
図19にデバッグツール1060の構成例を示す。
【0144】
CPU1090は、ROM1108に格納されるプログラムを実行したり、デバッグツール1060の全体の制御を行うものである。送受信切替部1092は、データの送信と受信とを切り替えるためのものである。クロック制御部1094は、CPU1090のSCLK端子、アドレスアップカウンタ1100、トレースメモリ1104に供給するクロックを制御するものである。このクロック制御部1094には、マイクロコンピュータ1020(SIO1048)からのBCLKが入力される。クロック制御部1094は周波数検出回路1095、分周回路1096を含む。周波数検出回路1095は、BCLKの周波数が属する周波数範囲を検出して、その結果を制御レジスタ1098に出力する。また分周回路1096での分周比は制御レジスタ1098により制御される。即ちCPU1090により実行されるメインモニタプログラム(メインモニタROM110に格納)が、制御レジスタ1098からBCLKの周波数範囲を読み出す。そして、メインモニタプログラムは、この周波数範囲に応じた最適な分周比を決定し、この分周比を制御レジスタ1098に書き込む。そして、分周回路1096は、この分周比でBCLKを分周してSMC2を生成し、CPU1090のSCLK端子に出力する。
【0145】
アドレスアップカウンタ1100は、トレースメモリのアドレスをカウントアップするためのものである。セレクタ1102は、ライン1122(アドレスアップカウンタ1100が出力するアドレス)とライン1124(アドレスバス1120からのアドレス)のいずれかを選択し、トレースメモリ1104のアドレス端子にデータを出力する。またセレクタ1106は、ライン1126(図16の実行情報出力部1050の出力であるDST[2:0]、DPCO)とライン1128(データバス1118)のいずれかを選択し、トレースメモリ1104のデータ端子にデータを出力したり、データ端子からデータを取り出す。
【0146】
ROM1108はメインモニタROM1110(図16のメインモニタ部1062に相当)を含み、メインモニタROM1110には、メインモニタプログラムが格納される。このメインモニタプログラムは、図18(A)〜図18(D)で説明したように、デバッグコマンドをプリミティブコマンドに変換するための処理を行う。RAM1112は、CPU1090のワーク領域となるものである。
【0147】
RS232Cインターフェース1114、パラレルインターフェース1116は、図16のホストコンピュータ1066とのインターフェースとなるものであり、ホストシステム1066からのデバッグコマンドはこれらのインターフェースを介してCPU1090に入力されることになる。クロック生成部1118は、CPU1090を動作させるクロックなどを生成するものである。
【0148】
次に本実施形態でのリアルタイムトレース処理について簡単に説明する。本実施形態では、図16のCPU1022の命令実行のステータス情報を表す3ビットのDST[2:0]と、分岐先のPC値を表すDPCOをトレースメモリ1104に蓄える。そして、トレースメモリ1104に蓄えられたデータと、ホストコンピュータ1066のプログラム情報記憶部に記憶されたユーザプログラムの機械語命令列の情報とに基づいて、トレースデータを生成する。このようにすることで、マイクロコンピュータ1020とデバッグツール1060との間の接続ラインの本数を少なくしながら、リアルタイムトレース機能を実現することが可能になる。
【0149】
ユーザプログラム実行モードにおいては、ライン1122が選択され、セレクタ1102を介してアドレスアップカウンタ1100の出力がトレースメモリ1104のアドレス端子に入力される。また、ライン1126が選択され、セレクタ1106を介してDST[2:0]、DPCOがトレースメモリ1104のデータ端子に入力される。ここでアドレスアップカウンタ1100には、まず最初に、データバス1118、アドレスバス1120を用いてCPU1090により図20(A)に示すようなスタートアドレスが設定される。またアドレスアップカウンタ1100のST/SP(開始/停止)端子には、トレース範囲を特定するDST[2]のラインが接続される。そして図20(B)に示すように、DST[2]のラインに第1のパルス130が入力されると、アドレスアップカウンタ1100のアドレスアップカウントが開始する。そして、DST[2]のラインに第2のパルス132が入力されると、アドレスアップカウンタ1100のアドレスアップカウントが停止し、トレース動作が停止する。このようにして、所望のトレース範囲でのデータ(DST[2:0]、DPCO)をトレースメモリ1104に蓄えることが可能になる。
【0150】
一方、ユーザプログラム実行モードからデバッグモードに移行すると、ライン1124が選択され、セレクタ1102を介してアドレスバス1120からのアドレスがトレースメモリ1104のアドレス端子に入力される。またライン1128が選択され、セレクタ1106を介してトレースメモリ1104からのデータがデータバス1118に出力される。これにより、トレースメモリ1104に蓄えられたデータ(DST[2:0]、DPCO)を、デバッグモード時にCPU1090(メインモニタプログラム)が読み出すことが可能になる。そして、読み出されたデータとユーザープログラムの機械語命令列の情報とに基づいて、トレースデータを生成することが可能になる。
【0151】
なお、本発明は本実施形態に限定されず、本発明の要旨の範囲内で種々の変形実施が可能である。
【0152】
例えば本実施の形態では、デバッグシステムの機能を実現する手段がデバッグツールとホストコンピュータに分散して設けられている場合を例にとり説明したががこれに限られない。デバッグツールとホストコンピュータのいずれか一方にすべて機能を実現する手段を設けてデバッグシステムを実現するようにしてもよい。
【0153】
また本実施の形態では、ターゲットシステムから分岐先のPC値が1ビットずつシリアルに出力される場合を例にとり説明したがこれに限られない。分岐先PC出力用の端子を数ビット分用意しておいて数ビットずつシリアルに出力するような場合でもよい。
【0154】
また本実施の形態では二つのトリガアドレスで範囲指定トレースを行う場合を例にとり説明したがこれに限られない。例えば、トリガポイントが一つまたが3つ以上設定されている場合でもよいし、トリガポイントによって範囲指定を行わない場合でもよい。
【0155】
またマイクロコンピュータやデバッグツールの構成も本実施形態で説明したものに限定されず、種々の変形実施が可能である。
【図面の簡単な説明】
【図1】CPU置き換え型のICEの例を示す図である。
【図2】本実施形態の構成について説明するための図である。
【図3】DST[2:0]の出力値とCPUの命令実行状態の関係を表した図である。
【図4】図4(A)、図4(B)は絶対分岐先のアドレスを特定するための候補アドレス群の抽出について説明するための図である。
【図5】図5(A)〜図5(C)はマップ情報から抽出した候補群からの絶対分岐先のアドレスの特定処理について説明するための図である。
【図6】絶対分岐が短い間隔で発生しDPCOからプログラムカウンタ値が全ビット出力されない場合に分岐先アドレスを特定する処理の動作例を示すフローチャート図である。
【図7】絶対分岐が短い間隔で発生しDPCOからプログラムカウンタ値が全ビット出力されない場合に分岐先アドレスを特定する処理の動作例を示すフローチャート図である。
【図8】絶対分岐が短い間隔で発生しDPCOからプログラムカウンタ値が全ビット出力されない場合に分岐先アドレスを特定する処理の動作例を示すフローチャート図である。
【図9】ターゲットシステムの内部メモリにプログラムをロードする場合の動作例を説明するためのフローチャート図である。
【図10】ターゲットシステムの内部のプログラムコードを書き換える場合の動作例を説明するためのフローチャート図である。
【図11】プログラムをロードせずに、既にターゲットシステムの内部メモリにある場合の動作例について説明するためのフローチャート図である。
【図12】絶対分岐命令発生以前のプログラムカウンタ解析処理について説明するための図である。
【図13】トレースメモリに蓄積されている最も古いデータ出力時のプログラムカウンタを解析する処理の動作例を表したフローチャート図である。
【図14】絶対分岐命令実行を示すステータス情報が命令実行によるものかハードウエア割り込みによるものかを判別する処理について説明するための図である。
【図15】絶対分岐命令実行を示すステータス情報が命令実行によるものかハードウエア割り込みによるものかを判別する処理の動作例について説明するためのフローチャート図である。
【図16】マイクロコンピュータ、デバッグシステムの構成例を示す機能ブロック図である。
【図17】本実施の形態におけるデバッグコマンドの実行処理について説明するための図である。
【図18】図18(A)〜図18(D)は、デバッグコマンドをプリミティブコマンドへ変換(分解)する処理について説明するための図である。
【図19】デバッグツールの詳細な構成例を示す機能ブロック図である。
【図20】DST[2]とトレース範囲の関係を示す図である。
【符号の説明】
10 マイクロコンピュータ
12 CPU(中央処理ユニット)
14 実行情報出力部
16 内部メモリ
20 デバッグシステム
22 実行情報取得部
24 トレースメモリ
26 プログラム情報記憶部
27 トレース情報生成部
28 ターゲットメモリ書き込み部
29 プログラム情報書き込み部
1020 マイクロコンピュータ
1022 CPU
1024 内部レジスタ
1026 BCU
1028 内部メモリ
1030 クロック生成部
1036 外部メモリ
1040 ミニモニタ部
1042 ミニモニタROM
1044 ミニモニタRAM
1046 制御レジスタ
1048 SIO
1050 実行情報出力部
1060 デバッグツール
1062 メインモニタ部
1064 実行情報取得部
1066 ホストコンピュータ
1090 CPU
1092 送受信切替部
1094 クロック制御部
1095 周波数検出部
1096 分周回路
1098 制御レジスタ
1100 アドレスアップカウンタ
1102 セレクタ
1104 トレースメモリ
1106 セレクタ
1108 ROM
1110 外部モニタROM
1112 RAM
1114 RS232Cインターフェース
1116 パラレルインターフェース
1118 クロック生成部
[0001]
BACKGROUND OF THE INVENTION
The present invention relates to a debugging system and an information storage medium used for the debugging system.
[0002]
[Background Art and Problems to be Solved by the Invention]
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 development of software for operating the target system.
[0003]
As such an 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 acquiring trace information and debugging.
[0004]
However, in this CPU replacement type ICE, when the internal operating frequency of the microcomputer 302 increases, real-time tracing becomes difficult due to signal delay generated in the probe 306 and a buffer for storing trace information.
[0005]
In order to solve such problems, a system that enables real-time tracing on a mass-produced chip has been developed. At this time, in order to store information such as an address bus as trace information in the trace buffer in real time, several tens of dedicated terminals are required. Here, the number of such terminals is necessary only for debugging and unnecessary for the end user.
[0006]
Therefore, the present applicant has developed a system that outputs trace information for realizing real-time trace to four dedicated terminals, and enables real-time trace from this trace information.
[0007]
Specifically, CPU execution status information is output to 3 terminals every clock, and when an absolute branch is generated by an absolute branch instruction or the like, the branch destination PC value is serially output to 1 terminal in the following 27 clock cycles. An absolute branch instruction is an instruction whose branch destination address is determined by a register value or the like during execution of a program and cannot be determined from an instruction code. Therefore, when an absolute branch instruction is generated, the branch destination cannot be determined from the instruction code of the program, so that tracing can be performed by outputting the PC value of the branch destination.
[0008]
However, since the target system does not output the value of the program counter until an absolute branch occurs, there is a problem that the program counter value cannot be grasped during this time and trace information cannot be generated.
[0009]
In addition, in order to minimize the number of debugging terminals as much as possible, the target system under development by the present applicant does not distinguish between the case where an absolute branch occurs due to an absolute branch instruction and the case where an absolute branch occurs due to an interrupt. Status information indicating instruction execution was output. For this reason, in the case of status information of absolute branch instruction execution, there is a problem that it cannot be distinguished whether it is due to instruction execution or due to an interrupt.
[0010]
The present invention has been made in view of the technical problems as described above, and an object of the present invention is to provide a debugging system capable of generating real-time trace on a mass-produced chip with few terminals and generating trace information. And providing an information storage medium. More specifically, it is possible to provide a debugging system and an information storage medium capable of generating trace information even before the occurrence of an absolute branch, and to determine whether the status information of the absolute branch occurrence is due to execution of an absolute branch instruction or due to an interrupt. A debugging system and an information storage medium are provided.
[0011]
[Means for Solving the Problems]
The present invention provides status information for determining whether the execution state of the CPU belongs to normal instruction execution, absolute branch instruction execution, or relative branch instruction execution, and trace information of the target system that outputs the branch destination address of the absolute branch instruction Is executed by the means for receiving the status information from the target system and storing it in the memory without overwriting, the execution start address of the target system and the target CPU of the debug system. Trace information generating means for generating trace information before the occurrence of an absolute branch instruction based on information for grasping a machine language instruction sequence of the program.
[0012]
The information storage medium according to the present invention includes information for realizing the above means.
[0013]
Here, the information for grasping the machine language instruction string of the program executed by the target system may be a machine language instruction code string expressed in binary or hexadecimal notation, or a machine language instruction code string. An instruction code string represented by a mnemonic code may be used. It suffices that at least the machine language instruction sequence executed by the CPU of the target system can be grasped.
[0014]
In the present invention, status information received from the target system is stored in the trace memory without being overwritten. For this reason, particularly when range specification tracing or the like is not performed, status information from the start of execution is accumulated from the top of the trace memory. Therefore, the debug system can generate trace information after the start of accumulation in the memory and before the occurrence of the absolute branch instruction based on the execution start address of the target system and the contents of the program executed on the target system.
[0015]
According to the present invention, even when debugging a target system having a small number of debugging terminals, the trace information of the entire execution range can be obtained without being restricted by the fact that the trace information before execution of the absolute branch instruction cannot be generated. be able to.
[0016]
That is, since the debug system of the present invention can generate trace information similar to that of a normal ICE or the like even from a small amount of debug information, it is possible to reduce the number of debug terminals of the target system and contribute to the cost reduction of the target system. Also have.
[0017]
The execution start address and the contents of the program executed on the target system may be stored in the debug system in advance or may be acquired later.
[0018]
For example, when the execution start address of the target system is specified from the debug system and executed, it is preferable to hold the specified execution start address. Further, when an execution program is loaded from the debug system to the target system, it is preferable to keep the loaded program content in the debug system.
[0019]
The present invention provides status information for determining whether the CPU execution state belongs to normal instruction execution, absolute branch instruction execution, or relative branch instruction execution, and whether or not the trigger point is matched, and the branch destination address of the absolute branch instruction A debug system that outputs trace information of the target system that outputs the status information, the status information received from the target system and stored in the memory, and the status information stored in the memory match the trigger point Trace information for generating trace information before the occurrence of an absolute branch instruction based on the trigger point address of the debug system and the information for grasping the machine language instruction sequence of the program executed by the target Generating means.
[0020]
The information storage medium according to the present invention includes information for realizing the above means.
[0021]
Here, the information for grasping the machine language instruction sequence of the program executed by the target may be a machine language instruction code sequence expressed in binary or hexadecimal, or the machine language instruction code sequence may be mnemonic. An instruction code sequence expressed in code may be used. It is sufficient that at least the machine language instruction code sequence executed by the target machine can be grasped.
[0022]
There may be a plurality of trigger points. The trigger point is used for designating a range to be output, and it may be the case where the status information of the designated range is output. Further, regardless of the range specification, information on whether or not the trigger point is matched may be output.
[0023]
The status information stored in the memory includes information on whether or not the trigger point is matched. Therefore, based on the trigger point address of the debug system and the contents of the program executed in the target system, it is possible to generate trace information before the absolute branch instruction is generated after the start of accumulation in the memory.
[0024]
According to the present invention, even when debugging a target system having a small number of debugging terminals, the trace information of the entire execution range can be obtained without being restricted by the fact that the trace information before execution of the absolute branch instruction cannot be generated. be able to.
[0025]
That is, since the debug system of the present invention can generate trace information similar to that of a normal ICE or the like even from a small amount of debug information, it is possible to reduce the number of debug terminals of the target system and contribute to the cost reduction of the target system. Also have.
[0026]
The trigger point address and the contents of the program executed on the target system may be stored in the debug system in advance or may be acquired later.
[0027]
For example, in the case where the trigger point address of the target system is designated and executed from the debug system, it is preferable to retain the designated trigger point address. Further, when an execution program is loaded from the debug system to the target system, it is preferable to keep the loaded program contents in the debug system.
[0028]
The present invention outputs status information for determining whether the execution state of the CPU belongs to normal instruction execution, absolute branch generation, or relative branch instruction execution, and target system trace information that outputs the branch destination address of the absolute branch instruction. Means for receiving the status information from the target system and storing it in the memory, and when the status information stored in the memory indicates the occurrence of an absolute branch, the occurrence of the absolute branch is caused by the occurrence of an interrupt. Trace information generating means for generating trace information by discriminating whether or not the program is based on information for grasping a machine language instruction sequence of the program.
[0029]
The information storage medium according to the present invention includes information for realizing the above means.
[0030]
Here, the information for grasping the machine language instruction sequence of the program executed by the target may be a machine language instruction code sequence expressed in binary or hexadecimal, or the machine language instruction code sequence may be mnemonic. An instruction code sequence expressed in code may be used. It is sufficient that at least the machine language instruction code sequence executed by the target machine can be grasped.
[0031]
An absolute branch generally occurs when an absolute branch instruction is executed or an interrupt occurs. Here, an interrupt is a kind of program branch, but is not caused by a branch instruction, but is branched by a signal of a computer hardware. In the target system of the present invention, in order to reduce the number of terminals for debugging, status information on the occurrence of an absolute branch is output without distinguishing whether an absolute branch has occurred due to an interrupt or an absolute branch due to a branch instruction. ing.
[0032]
Therefore, it is difficult to determine whether an absolute branch instruction has been executed or an interrupt has occurred from only the status information and the absolute branch destination address, and it is difficult to generate trace information.
[0033]
However, according to the present invention, it is possible to generate trace information by automatically checking whether or not the machine language instruction string of the program corresponding to the status indicating execution of the absolute branch instruction is actually an absolute branch instruction, and performing the determination. Is possible.
[0034]
According to the present invention, even when a target system having a small number of debugging terminals is debugged, it is possible to generate trace information by distinguishing between an absolute branch instruction and the occurrence of an interrupt. That is, since the debug system of the present invention can generate trace information similar to that of a normal ICE or the like even from a small amount of debug information, it is possible to reduce the number of debug terminals of the target system and contribute to the cost reduction of the target system. Also have.
[0035]
Information for grasping a machine language instruction sequence of a program executed by the target system may be stored in the debug system in advance or may be acquired later.
[0036]
For example, when a program for execution is loaded from the debug system to the target system, it is preferable to keep the loaded program contents in the debug system.
[0037]
The debugging system of the present invention further includes program information storage means for storing in advance information for grasping a machine language instruction sequence of a program executed by the target, and the trace information generation means is stored in the program information storage means. Trace information is generated using information for grasping a machine language instruction sequence of the program.
[0038]
The information storage medium according to the present invention includes information for realizing the above means.
[0039]
According to the present invention, since it is not necessary to read the memory of the target system every time the trace information is generated, the trace information can be generated even during execution of the target system. In addition, the processing time for generating trace information can be greatly reduced.
[0040]
DETAILED DESCRIPTION OF THE INVENTION
DESCRIPTION OF EMBODIMENTS Hereinafter, preferred embodiments of the present invention will be described in detail with reference to the drawings.
[0041]
1. Outline of Configuration of the Present Embodiment First, the configuration of the present embodiment will be described with reference to FIG.
[0042]
As shown in FIG. 2, the microcomputer 10 that is a target system to be debugged includes a CPU (Central Processing Unit) 12, an execution information output unit 14, and an internal memory 16.
[0043]
Here, the execution information output unit 16 outputs execution information for realizing a real-time trace to four dedicated terminals. Specifically, CPU instruction execution status information is output to 3 terminals (DST [2: 0]) every clock, and when a PC absolute branch execution occurs, the branch destination PC value (DPCO) is output in the following 27 clock cycles. Outputs serially to one terminal.
[0044]
The internal memory 16 stores a program executed by the target system.
[0045]
The debug system 20 according to this embodiment includes a debug tool 21 that is directly connected to a target microcomputer and a host computer 23 that is connected to the debug tool.
[0046]
The debug tool 21 includes an execution information acquisition unit 22 and a target memory writing unit 28, and the host computer 23 includes a program information storage unit 26, a trace information generation unit 27, and a program information writing unit 29.
[0047]
The execution information acquisition unit 22 stores 3-bit DST [2: 0] and DPCO representing a branch destination PC (program counter) value in the internal trace memory 24. When the trace range is designated, DST [2: 0] and DPCO in the range are stored in the trace memory.
[0048]
Since the branch destination PC is serially output bit by bit from the lower bits, if a new absolute branch occurs before all bits are output, only a part of the address information of the absolute branch destination can be received. .
[0049]
The target memory writing unit 28 has a function of loading a program into the internal memory 16 of the target system and rewriting a program in the memory of the target system, and is a microcomputer via a TXD / RXD line (bidirectional communication line). Data to be written to the internal memory 14 is transmitted.
[0050]
The program information storage unit 26 stores a machine language code string of the same program as the program stored in the internal memory 16 of the target system.
[0051]
When the trace information generation unit 27 receives a part of the absolute branch destination address from the target system, the trace information generation unit 27 is based on at least one of the information on the address area where the program executed by the target system exists and the status information received from the target system. A process for generating trace information by specifying a part other than a part of the absolute branch destination address is performed. Further, a candidate address group having a part of the received address information of the absolute branch destination as a lower bit is extracted, and specified by an array of status information received from the target system and a given candidate address included in the candidate address group Compared with the array of status information predicted from the machine language code string, the address information of the absolute branch destination is specified.
[0052]
Further, processing for generating trace information before the occurrence of the absolute branch instruction is performed based on the execution start address of the target system possessed by the debug system and the machine language code string of the program executed by the target CPU.
[0053]
If the status information stored in the memory indicates that it matches the trigger point, based on the trigger point address of the debug system and the machine language code string of the program executed by the target, Performs processing to generate trace information before the occurrence of an absolute branch instruction.
[0054]
If the status information stored in the memory indicates the occurrence of an absolute branch, the trace information is generated by determining whether the occurrence of the absolute branch is due to the occurrence of an interrupt based on the machine language code string of the program. Process.
[0055]
When generating trace information, a machine language code string of a program stored in the program information storage unit 26 is used.
[0056]
The program information writing unit 29 loads the same program as the program loaded into the memory of the target system into the program information storage unit 26 or reads out the program code stored in the memory of the target system to read the program information storage unit The program stored in the program information storage unit 26 is rewritten to have the same content as the program of the target system.
[0057]
2. Contents of Status Information Output by Target System FIG. 3 is a diagram showing the relationship between the output value of DST [2: 0] (hereinafter referred to as DST information) and the instruction execution state of the CPU. Here, the PC relative branch instruction is an instruction that branches to an address explicitly described in the program, and the branch destination can be determined from the instruction code. The PC absolute branch instruction is an instruction in which the branch destination address is determined by the register value during the execution of the program, and the branch destination cannot be determined from the instruction code.
[0058]
Therefore, in this embodiment, when a PC absolute branch instruction is generated, tracing is possible by outputting the PC value (DPCO) of the branch destination.
[0059]
That is, when the microprocessor executes instructions in the order of addresses (when the DST information is 000 or 100), it can be traced from the instruction code of the program because the program counter can be known to what extent. Also, when the microprocessor executes a PC relative branch instruction (when the DST information is 001 or 101), the branch destination can be known from the instruction code of the program, so that tracing is possible.
[0060]
However, when the microprocessor executes the PC absolute branch instruction (when the DST information is 010 or 110), the branch destination is not known from the instruction code of the program, and therefore tracing cannot be performed only with the DST information. In such a case, tracing is possible by outputting the PC value (DPCO) of the branch destination.
[0061]
3. Since the processing target system for specifying the branch destination address serially outputs the PC value to one terminal, if the absolute branch instruction is executed continuously or at intervals of several instructions, the information of the PC value is halfway. There was a problem that it was interrupted and could not be traced.
[0062]
Therefore, in the present embodiment, even when only a part of the PC value information can be obtained, the trace information generation unit 27 can specify the branch destination PC value of the absolute branch based on the map information and the DST information described later. Performs processing for specifying a branch destination address as described below.
[0063]
4A and 4B are diagrams for explaining extraction of a candidate address group for specifying an absolute branch destination address.
[0064]
Reference numeral 310 in FIG. 4A represents the PC value information obtained from the DPCO signal in hexadecimal. The PC value is output 27 bits one bit at a time from the lower bits. If a new absolute branch occurs during this period, the new absolute branch destination PC value is output there. Breaks there.
[0065]
310 is a state in which the PC value is interrupted by the information 312 for the lower 12 bits, and the upper bit information 314 and 316 is not obtained. In such a case, if the first 4 bits 316 (1 digit because it is a hexadecimal code) is set to 0, the number of PC values that are absolute branch destination candidates is 2 16 = 65536 (see 320 in FIG. 4A). Therefore, it is difficult to specify the actual PC value.
[0066]
Therefore, in the present embodiment, as shown in FIG. 4B, map information 330 of the memory to which the CPU of the target system is connected is stored in the parameter file 340 of the debug system. The map information 330 is information relating to the address where the program exists. For example, the map information 330 includes RAM1, IROM, and RAM2 connected to the target CPU, and addresses 0-7FF in RAM1, 80000-80FFF in IROM, It shows that the program is stored at address 90000-9FFFF of RAM2.
[0067]
Assuming that the lower 12 bits of the PC value are at address 802 as in FIG. 4A, there are no candidates in RAM1, 80802 is a candidate in IROM, and 16 in 90802-9F802 are candidates in RAM2. Thus, the total number of candidates is 17 (see 340 in FIG. 4B).
[0068]
FIGS. 5A to 5C are diagrams for explaining processing for specifying an absolute branch destination address from a candidate group extracted from map information. FIG. 5A shows DST information 350 after execution of an absolute branch instruction stored in the trace memory 24.
[0069]
FIG. 5B is output when the instruction code 360 and subsequent instruction codes 360, one of the candidate groups specified by the map information, the instruction type 370 of the instruction code, and the instruction code are executed. The DST information 380 that is likely to be displayed.
[0070]
FIG. 5C is output when the instruction code 390 from address 90802, which is one of the candidate groups specified by the map information, the instruction type 400 of the instruction code, and the instruction code are executed. DST information 410 that may be present. For other candidate groups, a DST information sequence that is expected to be output is generated in the same manner as in FIGS. 5B and 5C, and the DST information 350 in the trace memory 24 in FIG. Do. If they are the same, the candidate is specified as the branch destination address. Here, since the DST information sequence output by the instruction execution after address 80802 in FIG. 5B matches the DST information 350 in the trace memory 34 in FIG. 5A, the address 80802 is specified as the branch destination address. .
[0071]
6, 7, and 8 are flowcharts illustrating an operation example of processing for specifying a branch destination address when an absolute branch occurs at a short interval and the program counter value does not output all bits from the DPCO.
[0072]
First, the overall flow of the incomplete PC value analysis process will be described with reference to FIG.
[0073]
At the start of incomplete PC value analysis processing, initial setting of candidate PC value (ulWorkPc) and number of candidates (ulExpectNum) is first performed (step S10).
[0074]
In loop A (steps S20 to S40), candidate PC search processing (step S30) using map information is performed for the number of memories for which map information is defined in the parameter file. For example, in FIG. 4B, the parameter file 340 defines the map information of three memories RAM1, IROM, and RAM2, and therefore the candidate PC value search process is performed three times. In this candidate PC value search process, the candidate PC value (ulWorkPc) and the number of candidates (ulExpectNum) are updated.
[0075]
When the loop A ends, it is determined whether or not the set number of candidates (ulExpectNum) is 1. If the number of candidates (ulExpectNum) = 1, it is determined that one PC value has been specified, the candidate PC value (ulWorkPc) updated in the candidate PC value specifying process is set as the address actually executed by the CPU, and the trace is performed. Data generation processing is performed (steps S50 and S60).
[0076]
Next, a detailed process example of the candidate PC search process using the map information (step S30 in FIG. 6) will be described with reference to FIG.
[0077]
The start address (ulMapTopAddr) obtained by shifting the start address of the memory defined by the map information to the right by the number of output bits of the DPCO signal is set. Also, the end address (ulMapBottomAddr) obtained by shifting the end address of the memory defined by the map information to the right by the number of output bits of the DPCO signal is set.
[0078]
For example, as described in FIGS. 4A and 4B, when the output of the DPCO signal is 12 bits (see 312 in FIG. 4A), the start address 90000 of the RAM 2 is shifted to the right by 12 bits. Set 9090 to the start address (ulMapTopAddr). Further, 0009F obtained by shifting the last address 9FFFF of the RAM 2 to the right by 12 bits is set as the end address (ulMapBottomAddr). Since the head address 90000 and the last address 9FFFF are expressed in hexadecimal, each digit represents a DPCO signal of 4 bits.
[0079]
Then, in loop B, the following processing is repeated from the start address (ulMapTopAddr) to the end address (ulMapBottomAddr) (steps S120 to S170). For example, in the case of FIG. 4B, it is repeated 16 times from 00990 to 0009F.
[0080]
First, a value obtained by adding the start address (ulMapTopAddr) to the left by the number of output bits of the DPCO signal and the PC value being output from the DPCO is set as the processing target PC value (ulPC) (step S130). ).
[0081]
Then, the processing target PC value (ulPC) is set to the work address (unWorkAddr) for extracting the instruction value after the processing target PC value (ulPC) on the instruction code (step S140).
[0082]
For example, in FIG. 4B, the first start address (ulMapTopAddr) is 00990. Therefore, if this is shifted to the left by 12 bits which is the number of output bits of the DPCO signal, 09000 is obtained. 090802, which is obtained by adding 00802 which is the PC value being output obtained from DPCO, is set as the processing target PC value (ulPC).
[0083]
Then, a PC value specifying process using the DST information is performed on the processing target PC value (ulPC) (step S150).
[0084]
In preparation for the next loop, the start address (ulMapTopAddr) is updated (step S160). In FIG. 4B, the start address (ulMapTopAddr) is updated to become 00091.
[0085]
Next, a detailed processing example of the PC value specifying process (step S150 in FIG. 7) using the DST information will be described with reference to FIG.
[0086]
In loop C, the following processing is repeated for the number of output bits of the DPCO signal (steps S210 to S250). In the present embodiment, since one bit of DPCO is output every clock, since the instruction is executed by the number of output bits of the DPCO signal after the absolute branch instruction is generated, the number of output bits of the DPCO signal. This is because DST information indicating the execution state of the subsequent instructions is stored in the trace memory.
[0087]
For example, in FIG. 4B, since the number of output bits of the DPCO signal is 12 bits, the processing from step S220 to S240 is repeated 12 times.
[0088]
First, the DST signal that will be output when the instruction code on the program indicated by the work address (unWorkAddr) is executed is substituted into the comparison target DST code (ucKindCode) (step S220). For example, in FIG. 5B, work address 1 (362) points to add, which is an instruction without branch, and therefore, DST information '000' that will be output when the instruction without branch is executed is compared with DST to be compared. Assign to code (ucKindCode).
[0089]
If the corresponding DST signal on the trace memory and the comparison target DST code do not coincide with each other (ucKindCode), the processing target PC value is determined not to be the absolute branch destination PC value to be obtained and the loop C is exited (step S230 ).
[0090]
If they match, the work address (unWorkAddr) is positioned at the next instruction code position in order to extract the next instruction code on the instruction code (step S240). α is an instruction size for shifting to the next instruction. For example, in FIG. 5B, when one instruction is 2 bytes, it is positioned from work address 1 (362) to work address 2 (364).
[0091]
When the loop C is executed by the number of output bits of the DPCO signal, the DST signal when the instruction code after the candidate PC value is executed and the DST signal stored in the trace memory all match. Assuming that the processing target PC value (ulPC) is the absolute branch destination address, the processing target PC value (ulPC) is set to the candidate PC value (ulWorkPc). The number of candidates (ulExpectNum) is incremented (step S260).
[0092]
4). Processing for realizing the trace function without stopping the target system In this embodiment, in order to generate trace information without stopping the execution of the target system, the machine language of the program stored in the internal memory of the target system An instruction sequence (hereinafter referred to as program information) is stored in the program information storage unit 26 of the host computer.
[0093]
In this way, for example, the comparison target DST code (ucKindCode) to be compared with the DST signal on the trace memory can be created from the program information stored in the program information storage unit 26. Therefore, since it is not necessary to read the internal memory 16 of the target system when generating the trace information, the trace information can be generated without stopping the execution of the target system.
[0094]
In addition, since it is not necessary to read the internal memory 16 of the target system, the processing time for generating trace information can be greatly shortened.
[0095]
In the present embodiment, the program information writing unit 29 performs the following processing in order to store the program information stored in the internal memory 16 of the target system and used for tracing in the program information storage unit 26 of the host computer. It is carried out.
[0096]
FIG. 9 is a flowchart for explaining an operation example when a program is loaded into the internal memory of the target system.
[0097]
In this embodiment, when a program is loaded into the internal memory of the target system, if the program is scheduled to be traced, the contents of the program loaded into the internal memory of the target system are written into the program information storage unit (steps S310 and S320). , S330).
[0098]
FIG. 10 is a flowchart for explaining an operation example when rewriting a program in the target system.
[0099]
In this embodiment, when a program in the internal memory of the target system is rewritten, if there is a plan to trace the program, the corresponding part of the program stored in the program information storage unit is rewritten with the same contents as the program of the target system. (Steps S410, S420, S430).
[0100]
FIG. 11 is a flowchart for explaining an operation example when the program is not loaded and is already in the internal memory of the target system.
[0101]
When tracing the program, the start address and end address of the memory in which the program is stored are specified from the map information (steps S510 and S520). Then, the contents specified by the start address and end address of the internal memory of the target system are read and written in the program information storage unit (step S530).
[0102]
5. Program Counter Analysis Processing Before Absolute Branch Instruction Generation FIG. 12 is a diagram for explaining program counter analysis processing before absolute branch instruction generation. FIG. 12 shows a state in which instructions i1, i2,... Are executed in the target system, and status information DST1 to DST12 is accumulated in the trace memory. In the present embodiment, since the target system does not output the program counter value until the absolute branch instruction is executed, the program counter value is not output until the instruction i9 is executed. Therefore, for the instructions i1 to i8 executed before the occurrence of the absolute branch, there is a problem that the execution position cannot be specified and the trace information cannot be created.
[0103]
Therefore, in the present embodiment, the following configuration is adopted in order to specify a program counter at the time of executing an instruction corresponding to the head status information DST1 accumulated in the trace memory.
[0104]
That is, when the range designation trace is not performed, for example, when the execution start position of the program is designated and executed, the execution start address is acquired by the debug system. Then, status information output from the target system is accumulated in a non-overwrite mode in which the trace memory is not overwritten.
[0105]
Here, when the range designation trace is not performed, the target system outputs DST information that is status information for all executed instructions. Therefore, the DST information DST1 accumulated at the head of the trace memory can be specified as the output of the instruction corresponding to the execution start address.
[0106]
In addition, the target system according to the present embodiment can set a start address and an end address as trigger addresses, and can perform a range designation trace that outputs only status information corresponding to instructions from the start address to the end address. At this time, the trigger address set in the target system is acquired in advance by the debug system.
[0107]
When performing such a range designation trace, the DST information DST1 accumulated at the head of the trace memory can be specified as being output by an instruction corresponding to the trigger address designated as the head address.
[0108]
FIG. 13 is a flowchart showing an operation example of processing for analyzing the program counter at the time of outputting the oldest data stored in the trace memory.
[0109]
When performing the range designation trace, the trigger address 1 which is the head address is set to the candidate PC (ulPC) (steps S610 and S620).
[0110]
When the range designation trace is not performed and the trace memory is not overwritten, the program counter value immediately before the trace start is set to the candidate PC (ulPC) (steps S630 and S640). Note that the address value of the instruction to be executed is set as the program counter value immediately before the start of tracing.
[0111]
Then, the trace information is generated using the candidate PC (ulPC) as the address value of the instruction corresponding to the oldest status information in the trace memory (step S650).
[0112]
6). Hardware Interrupt Determination Processing FIG. 14 is a diagram for explaining processing for determining whether status information indicating execution of an absolute branch instruction is due to instruction execution or hardware interrupt.
[0113]
When the status information stored in the trace memory indicates execution of an absolute branch instruction as indicated by 1410 in FIG. 14, it is due to execution of a normal absolute branch instruction or hardware interrupt. There may be.
[0114]
Therefore, in this embodiment, the status information is based on execution of a normal absolute branch instruction or hardware interrupt, as compared with the information in the machine language instruction sequence of the program stored in the program information storage unit. It is determined whether it exists.
[0115]
Assuming that the machine language instruction string of the instruction corresponding to the trace information stored in the trace memory is i1, i2,... I20 of 1420. If i3 is not an absolute branch instruction, it can be determined that the status information 1410 is not due to normal execution of an absolute branch instruction but is due to a hardware interrupt.
[0116]
FIG. 15 is a flowchart for explaining an operation example of processing for determining whether status information indicating execution of an absolute branch instruction is due to instruction execution or hardware interrupt.
[0117]
Loop A processing is performed for the number of DST information stored in the trace memory (steps S710 to S760).
[0118]
When the DST information indicates the execution of the absolute branch instruction, first, the address indicated by the program counter when the DST information is output is analyzed (steps S720 and S730). If the instruction code at the address indicated by the program counter as the analysis result is not an absolute branch instruction, it is set as a hardware interrupt occurrence location and registered in the data (steps S740 and S750).
[0119]
7). Configuration Example of Target System and Debug Tool FIG. 16 shows a detailed configuration example of the microcomputer and the debug system of this embodiment. As shown in FIG. 16, the microcomputer 1020 includes a CPU 1022, a BCU (bus control unit) 1026, an internal memory (internal ROM and internal RAM other than the mini monitor ROM 1042 and the mini monitor RAM 1044) 1028, a clock generation unit 1030, and a mini monitor unit 1040 (first monitor). 1 monitoring means) and an execution information output unit 1050.
[0120]
Here, the CPU 1022 executes various instructions and includes an internal register 1024. The internal registers 1024 include general-purpose registers R0 to R15, special registers SP (stack pointer register), AHR (higher-order register for product-sum result data), ALR (lower-order register for product-sum result data), and the like.
[0121]
The BCU 1026 controls the bus. For example, it is connected to a Harvard architecture bus 1031 connected to the CPU 1022, a bus 1032 connected to the internal memory 1028, an external bus 1033 connected to the external memory 1036, a mini monitor unit 1040, an execution information output unit 1050, and the like. The internal bus 1034 is controlled.
[0122]
The clock generation unit 1030 generates various clocks used in the microcomputer 1020. The clock generation unit 1030 also supplies a clock to an external debug tool 1060 via BCLK.
[0123]
The mini monitor unit 1040 includes a mini monitor ROM 1042, a mini monitor RAM 1044, a control register 1046, and an SIO 1048.
[0124]
Here, the mini monitor ROM 1042 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 1020 can be reduced in size while having an on-chip debugging function.
[0125]
The contents of the internal register 1024 of the CPU 1022 are saved in the mini monitor RAM 1044 when shifting to the debug mode (when a break occurs in the user program). 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.
[0126]
The control register 1046 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 1022 operating according to the mini-monitor program writing data to each bit of the control register 1046 or reading data of each bit.
[0127]
The SIO 1048 is for transmitting and receiving data to and from the debug tool 1060 provided outside the microcomputer 1020. The SIO 1048 and the debug tool 1060 are connected by TXD / RXD (data transmission / reception line).
[0128]
The execution information output unit 1050 is for realizing a real-time trace function, and is a branch destination when a DST information (DST [2: 0]) that is status information indicating the execution state of the CPU and a PC absolute branch occurs. The PC (program counter) value (DPCO) is output as execution information to the outside through the dedicated four terminals.
[0129]
Between the execution information output unit 1050 and the debug tool 1060, three DST [2: 0] for outputting the status information of the instruction execution of the CPU 1022 and the PC (program counter) value of the absolute branch destination are serially 1 bit. They are connected by four lines, one DPCO that outputs them one by one.
[0130]
The debug tool 1060 includes a main monitor unit 1062 and an execution information acquisition unit 1064, and is connected to a host system 1066 realized by a personal computer or the like.
[0131]
The main monitor unit 106 performs processing for converting (decomposing) a debug command input from the host system 1066 into a primitive command. When the main monitor unit 1062 transmits data instructing execution of a primitive command to the mini monitor unit 1040, the mini monitor unit 1040 performs processing for executing the instructed primitive command.
[0132]
Further, the execution information acquisition unit 1064 stores the 3-bit DST [2: 0] and DPCO representing the branch destination PC (program counter) value in the internal trace memory 1104. When the trace range is designated, DST [2: 0] and DPCO in the range are stored in the trace memory.
[0133]
Next, in the present embodiment, a configuration for loading a program from the debug system into the internal memory of the microcomputer and rewriting information in the internal memory will be described.
[0134]
As shown in FIG. 17, in the present embodiment, the microcomputer 1020 includes a CPU (central processing unit) 1022 and a mini-monitor unit (first monitor means) 1040 that is a main part of the present embodiment. A main monitor unit (second monitor means) 1062 is provided outside the microcomputer 1020. Here, the main monitor unit 1062 performs processing for converting (decomposing) a debug command issued by, for example, the host computer 1066 into a primitive command. Further, the mini monitor unit 1040 transmits and receives data to and from the main monitor unit 1062. Then, the mini monitor unit 1040 determines a primitive command to be executed based on the received data from the main monitor unit 1062, and performs a process for executing the primitive command.
[0135]
Here, debug commands to be converted by the main monitor unit 1062 include program load, GO, step execution, memory write, memory read, internal register write, internal register read, breakpoint setting, breakpoint release, and the like. You can think of commands. The main monitor unit 1062 sends these various and 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 1040 can be significantly reduced.
[0136]
As a result, a program can be loaded from the debug system to the internal memory of the microcomputer, and information in the internal memory can be rewritten. That is, when a program is loaded into a microcomputer as a target system or when a memory write is performed, these debug commands are issued from the host computer.
[0137]
8). Conversion to Primitive Command FIGS. 18A, 18B, 18C, and 18D schematically show processing for converting various debug commands into primitive commands.
[0138]
For example, as shown in FIG. 18A, 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.
[0139]
Further, it is assumed 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 and a GO command to the step execution enable bit of the control register 1046 in FIG. That is, the mini monitor program executes the primitive write command and the GO command, thereby realizing a step execution command.
[0140]
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 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.
[0141]
Assume that a debug command called a breakpoint setting command for setting a trigger address as a breakpoint 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 1046. That is, the breakpoint setting command is realized by the mini monitor program executing this primitive write command.
[0142]
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 1042 can be reduced, and an on-chip debugging function can be realized with a small hardware scale.
[0143]
9. Configuration Example of Debug Tool FIG. 19 shows a configuration example of the debug tool 1060.
[0144]
The CPU 1090 executes a program stored in the ROM 1108 and controls the entire debug tool 1060. The transmission / reception switching unit 1092 is for switching between transmission and reception of data. The clock control unit 1094 controls a clock supplied to the SCLK terminal of the CPU 1090, the address up counter 1100, and the trace memory 1104. BCLK from the microcomputer 1020 (SIO 1048) is input to the clock control unit 1094. The clock control unit 1094 includes a frequency detection circuit 1095 and a frequency dividing circuit 1096. The frequency detection circuit 1095 detects the frequency range to which the frequency of BCLK belongs, and outputs the result to the control register 1098. Further, the frequency dividing ratio in the frequency dividing circuit 1096 is controlled by the control register 1098. That is, the main monitor program (stored in the main monitor ROM 110) executed by the CPU 1090 reads the BCLK frequency range from the control register 1098. 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 1098. Then, the frequency dividing circuit 1096 divides BCLK by this frequency dividing ratio to generate SMC2, and outputs it to the SCLK terminal of the CPU 1090.
[0145]
The address up counter 1100 is for counting up the address of the trace memory. The selector 1102 selects either the line 1122 (address output from the address up counter 1100) or the line 1124 (address from the address bus 1120), and outputs data to the address terminal of the trace memory 1104. The selector 1106 selects either the line 1126 (DST [2: 0], DPCO which is the output of the execution information output unit 1050 in FIG. 16) or the line 1128 (data bus 1118), and the data terminal of the trace memory 1104 Output data to or retrieve data from the data terminal.
[0146]
The ROM 1108 includes a main monitor ROM 1110 (corresponding to the main monitor unit 1062 in FIG. 16), and the main monitor ROM 1110 stores a main monitor program. As described with reference to FIGS. 18A to 18D, the main monitor program performs processing for converting a debug command into a primitive command. The RAM 1112 serves as a work area for the CPU 1090.
[0147]
The RS232C interface 1114 and the parallel interface 1116 serve as interfaces with the host computer 1066 of FIG. 16, and debug commands from the host system 1066 are input to the CPU 1090 via these interfaces. The clock generation unit 1118 generates a clock for operating the CPU 1090 and the like.
[0148]
Next, the real-time trace processing in this embodiment will be briefly described. In the present embodiment, 3-bit DST [2: 0] representing the status information of instruction execution of the CPU 1022 in FIG. 16 and DPCO representing the branch destination PC value are stored in the trace memory 1104. Then, trace data is generated based on the data stored in the trace memory 1104 and the machine language instruction sequence information of the user program stored in the program information storage unit of the host computer 1066. By doing so, it is possible to realize a real-time trace function while reducing the number of connection lines between the microcomputer 1020 and the debug tool 1060.
[0149]
In the user program execution mode, the line 1122 is selected, and the output of the address up counter 1100 is input to the address terminal of the trace memory 1104 via the selector 1102. In addition, the line 1126 is selected, and DST [2: 0] and DPCO are input to the data terminal of the trace memory 1104 via the selector 1106. Here, in the address up counter 1100, first, a start address as shown in FIG. 20A is set by the CPU 1090 using the data bus 1118 and the address bus 1120. The ST / SP (start / stop) terminal of the address up counter 1100 is connected to the DST [2] line for specifying the trace range. Then, as shown in FIG. 20B, when the first pulse 130 is input to the DST [2] line, the address upcounting of the address upcounter 1100 starts. When the second pulse 132 is input to the DST [2] line, the address upcount of the address upcounter 1100 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 1104.
[0150]
On the other hand, when shifting from the user program execution mode to the debug mode, the line 1124 is selected, and the address from the address bus 1120 is input to the address terminal of the trace memory 1104 via the selector 1102. The line 1128 is selected, and data from the trace memory 1104 is output to the data bus 1118 via the selector 1106. As a result, the data (DST [2: 0], DPCO) stored in the trace memory 1104 can be read by the CPU 1090 (main monitor program) in the debug mode. Then, trace data can be generated based on the read data and the information of the machine language instruction sequence of the user program.
[0151]
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.
[0152]
For example, although a case has been described with the present embodiment as an example where the means for realizing the functions of the debug system are provided separately in the debug tool and the host computer, the present invention is not limited thereto. A debugging system may be realized by providing means for realizing all functions in either the debugging tool or the host computer.
[0153]
In this embodiment, the case where the branch destination PC value is serially output bit by bit from the target system has been described as an example, but the present invention is not limited to this. A branch destination PC output terminal may be prepared for several bits and serially output several bits at a time.
[0154]
In the present embodiment, the case of performing range designation tracing with two trigger addresses has been described as an example, but the present invention is not limited to this. For example, one or three or more trigger points may be set, or a range may not be specified by the trigger point.
[0155]
Further, the configuration of the microcomputer and the debug tool is not limited to that described in the present embodiment, and various modifications can be made.
[Brief description of the drawings]
FIG. 1 is a diagram illustrating an example of a CPU replacement type ICE.
FIG. 2 is a diagram for explaining a configuration of the present embodiment.
FIG. 3 is a diagram illustrating a relationship between an output value of DST [2: 0] and an instruction execution state of a CPU.
FIGS. 4A and 4B are diagrams for explaining extraction of a candidate address group for specifying an absolute branch destination address. FIGS.
FIGS. 5A to 5C are diagrams for explaining processing for specifying an absolute branch destination address from a candidate group extracted from map information. FIG.
FIG. 6 is a flowchart showing an operation example of processing for specifying a branch destination address when an absolute branch occurs at a short interval and the program counter value does not output all bits from the DPCO.
FIG. 7 is a flowchart showing an operation example of processing for specifying a branch destination address when an absolute branch occurs at a short interval and all bits of the program counter value are not output from the DPCO.
FIG. 8 is a flowchart showing an operation example of processing for specifying a branch destination address when an absolute branch occurs at a short interval and the program counter value does not output all bits from the DPCO.
FIG. 9 is a flowchart for explaining an operation example when a program is loaded into an internal memory of a target system.
FIG. 10 is a flowchart for explaining an operation example when rewriting a program code inside the target system;
FIG. 11 is a flowchart for explaining an operation example when the program is not loaded and is already in the internal memory of the target system.
FIG. 12 is a diagram for explaining a program counter analysis process before the occurrence of an absolute branch instruction.
FIG. 13 is a flowchart showing an operation example of processing for analyzing a program counter at the time of outputting the oldest data stored in the trace memory.
FIG. 14 is a diagram for describing processing for determining whether status information indicating absolute branch instruction execution is due to instruction execution or hardware interrupt;
FIG. 15 is a flowchart for explaining an operation example of processing for determining whether status information indicating absolute branch instruction execution is due to instruction execution or hardware interrupt;
FIG. 16 is a functional block diagram illustrating a configuration example of a microcomputer and a debugging system.
FIG. 17 is a diagram for explaining debug command execution processing in the present embodiment;
FIGS. 18A to 18D are diagrams for explaining processing for converting (decomposing) a debug command into a primitive command.
FIG. 19 is a functional block diagram illustrating a detailed configuration example of a debug tool.
FIG. 20 is a diagram illustrating a relationship between DST [2] and a trace range.
[Explanation of symbols]
10 Microcomputer 12 CPU (Central Processing Unit)
14 execution information output unit 16 internal memory 20 debug system 22 execution information acquisition unit 24 trace memory 26 program information storage unit 27 trace information generation unit 28 target memory writing unit 29 program information writing unit 1020 microcomputer 1022 CPU
1024 Internal register 1026 BCU
1028 Internal memory 1030 Clock generation unit 1036 External memory 1040 Mini monitor unit 1042 Mini monitor ROM
1044 Mini monitor RAM
1046 control register 1048 SIO
1050 Execution information output unit 1060 Debug tool 1062 Main monitor unit 1064 Execution information acquisition unit 1066 Host computer 1090 CPU
1092 Transmission / reception switching unit 1094 Clock control unit 1095 Frequency detection unit 1096 Frequency dividing circuit 1098 Control register 1100 Address up counter 1102 Selector 1104 Trace memory 1106 Selector 1108 ROM
1110 External monitor ROM
1112 RAM
1114 RS232C interface 1116 Parallel interface 1118 Clock generation unit

Claims (2)

CPUの実行状態が通常命令実行、絶対分岐命令実行、相対分岐命令実行のいずれに属するかを判別するためのステータス情報と絶対分岐命令の分岐先アドレスを出力するターゲットシステムのトレース情報を出力するデバッグシステムであって、
ターゲットが実行するプログラムの機械語命令列を把握するための情報を記憶部に記憶させる手段と、
ターゲットシステムから前記ステータス情報を受け取ってメモリに蓄積する蓄積手段と、
前記メモリに蓄積されたステータス情報が絶対分岐命令実行を示しているか否か判断し、絶対分岐命令実行を示している場合には、当該ステータス情報出力の際のアドレスを解析し、記憶部に記憶されているターゲットが実行するプログラムの機械語命令列を把握するための情報を読み出して、解析したアドレスの命令コードを割り出し、割り出した命令コードが絶対分岐命令でない場合には当該ステータス情報が割り込み発生によるものであると判断してトレース情報を生成するトレース情報生成手段と、を含み、
前記トレース情報生成手段は、
先に絶対分岐が発生してその後命令をアドレスの順番に実行しているときには先の絶対分岐時に出力された分岐先アドレスからプログラムカウンタがどこまで進んだかを調べて当該ステータス情報出力の際のアドレスを解析するように構成され、
前記ターゲットシステムが絶対分岐先のアドレス情報を1又は数ビットづつシリアルに出力するように構成され、先の絶対分岐先のアドレス情報の一部しか受け取れなかった場合には、受け取った絶対分岐先のアドレス情報の一部を下位ビットとする候補アドレス群に含まれる各候補アドレスについて、当該候補アドレス以降のプログラムの機械語命令列をプログラム情報記憶部から読み出し、読み出したプログラムの機械語命令列が実行された場合に出力されるであろうステータス情報列を生成して、生成したステータス情報の配列とメモリに格納されている絶対分岐命令以降のステータス情報の配列との比較処理を行い、一致する候補アドレスが1つしか存在しない場合に当該候補アドレスを先の絶対分岐先のアドレスとして、当該ステータス情報出力の際のアドレスを解析することを特徴とするデバッグシステム。
Debug that outputs status information for determining whether the CPU execution status belongs to normal instruction execution, absolute branch instruction execution, or relative branch instruction execution, and target system trace information that outputs the branch destination address of the absolute branch instruction A system,
Means for storing in the storage unit information for grasping a machine language instruction sequence of a program executed by the target;
Storage means for receiving the status information from the target system and storing it in a memory;
It is determined whether or not the status information stored in the memory indicates execution of an absolute branch instruction. If the status information indicates execution of an absolute branch instruction, the address when the status information is output is analyzed and stored in the storage unit. Reads the information for grasping the machine language instruction string of the program executed by the target being executed, determines the instruction code of the analyzed address, and if the calculated instruction code is not an absolute branch instruction, the status information is interrupted Trace information generating means for generating trace information by judging that
The trace information generating means includes
When an absolute branch occurs first and instructions are subsequently executed in the order of addresses, the program counter is checked to determine how far the program counter has advanced from the branch destination address that was output during the previous absolute branch. Configured to parse,
The target system is configured to serially output the address information of the absolute branch destination by one or several bits, and when only a part of the address information of the previous absolute branch destination is received, For each candidate address included in the candidate address group in which a part of the address information is a lower bit, the machine language instruction sequence of the program after the candidate address is read from the program information storage unit, and the machine language instruction sequence of the read program is executed. The status information string that will be output if the error is generated is compared, the generated status information array is compared with the status information array stored in the memory after the absolute branch instruction, and the candidate matches If there is only one address, the candidate address is used as the address of the previous absolute branch destination. Debugging system characterized by analyzing the address from which the task information output.
CPUの実行状態が通常命令実行、絶対分岐命令実行、相対分岐命令実行のいずれに属するかを判別するためのステータス情報と絶対分岐命令の分岐先アドレスを出力するターゲットシステムのトレース情報を出力するデバッグシステムを制御するためのコンピュータが読みとり可能な情報記憶媒体であって、
ターゲットが実行するプログラムの機械語命令列を把握するための情報を記憶部に記憶させる手段と、
ターゲットシステムから前記ステータス情報を受け取ってメモリに蓄積する蓄積手段と、
前記メモリに蓄積されたステータス情報が絶対分岐命令実行を示しているか否か判断し、絶対分岐命令実行を示している場合には、当該ステータス情報出力の際のアドレスを解析し、記憶部に記憶されているターゲットが実行するプログラムの機械語命令列を把握するための情報を読み出して、解析したアドレスの命令コードを割り出し、割り出した命令コードが絶対分岐命令でない場合には当該ステータス情報が割り込み発生によるものであると判断してトレース情報を生成するトレース情報生成手段と、してコンピュータを機能させるためのプログラムが記憶され、
前記トレース情報生成手段は、
先に絶対分岐が発生してその後命令をアドレスの順番に実行しているときには先の絶対分岐時に出力された分岐先アドレスからプログラムカウンタがどこまで進んだかを調べて当該ステータス情報出力の際のアドレスを解析するように構成され、
前記ターゲットシステムが絶対分岐先のアドレス情報を1又は数ビットづつシリアルに出力するように構成され、先の絶対分岐先のアドレス情報の一部しか受け取れなかった場合には、受け取った絶対分岐先のアドレス情報の一部を下位ビットとする候補アドレス群に含まれる各候補アドレスについて、当該候補アドレス以降のプログラムの機械語命令列をプログラム情報記憶部から読み出し、読み出したプログラムの機械語命令列が実行された場合に出力されるであろうステータス情報列を生成して、生成したステータス情報の配列とメモリに格納されている絶対分岐命令以降のステータス情報の配列との比較処理を行い、一致する候補アドレスが1つしか存在しない場合に当該候補アドレスを先の絶対分岐先のアドレスとして、当該ステータス情報出力の際のアドレスを解析することを特徴とする情報記憶媒体。
Debug that outputs status information for determining whether the CPU execution status belongs to normal instruction execution, absolute branch instruction execution, or relative branch instruction execution, and target system trace information that outputs the branch destination address of the absolute branch instruction A computer-readable information storage medium for controlling the system,
Means for storing in the storage unit information for grasping a machine language instruction sequence of a program executed by the target;
Storage means for receiving the status information from the target system and storing it in a memory;
It is determined whether or not the status information stored in the memory indicates execution of an absolute branch instruction. If the status information indicates execution of an absolute branch instruction, the address when the status information is output is analyzed and stored in the storage unit. Reads the information for grasping the machine language instruction string of the program executed by the target being executed, determines the instruction code of the analyzed address, and if the calculated instruction code is not an absolute branch instruction, the status information is interrupted A program for causing the computer to function as trace information generating means for generating trace information by judging that
The trace information generating means includes
When an absolute branch occurs first and instructions are subsequently executed in the order of addresses, the program counter is checked to determine how far the program counter has advanced from the branch destination address that was output during the previous absolute branch. Configured to parse,
The target system is configured to serially output the address information of the absolute branch destination by one or several bits, and when only a part of the address information of the previous absolute branch destination is received, For each candidate address included in the candidate address group in which a part of the address information is a lower bit, the machine language instruction sequence of the program after the candidate address is read from the program information storage unit, and the machine language instruction sequence of the read program is executed. The status information string that will be output if the error is generated is compared, the generated status information array is compared with the status information array stored in the memory after the absolute branch instruction, and the candidate matches If there is only one address, the candidate address is used as the address of the previous absolute branch destination. Information storage medium characterized by analyzing the address from which the task information output.
JP09242899A 1999-03-31 1999-03-31 Debug system and information storage medium Expired - Fee Related JP3775462B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP09242899A JP3775462B2 (en) 1999-03-31 1999-03-31 Debug system and information storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP09242899A JP3775462B2 (en) 1999-03-31 1999-03-31 Debug system and information storage medium

Publications (2)

Publication Number Publication Date
JP2000284985A JP2000284985A (en) 2000-10-13
JP3775462B2 true JP3775462B2 (en) 2006-05-17

Family

ID=14054178

Family Applications (1)

Application Number Title Priority Date Filing Date
JP09242899A Expired - Fee Related JP3775462B2 (en) 1999-03-31 1999-03-31 Debug system and information storage medium

Country Status (1)

Country Link
JP (1) JP3775462B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11360713B2 (en) 2019-02-27 2022-06-14 Rohm Co., Ltd. Semiconductor device and debug system

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7817293B2 (en) 2005-01-07 2010-10-19 Infoprint Solutions Company, Llc Trace and debug tool for high speed printer systems
JP2010123050A (en) * 2008-11-21 2010-06-03 Renesas Technology Corp Semiconductor device
US12086042B2 (en) 2019-10-18 2024-09-10 Rohm Co., Ltd. Tracing circuit, semiconductor device, tracer, and tracing system

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11360713B2 (en) 2019-02-27 2022-06-14 Rohm Co., Ltd. Semiconductor device and debug system

Also Published As

Publication number Publication date
JP2000284985A (en) 2000-10-13

Similar Documents

Publication Publication Date Title
US6922795B2 (en) Microcomputer, electronic equipment, and debugging system
US7401257B2 (en) Microcomputer and method for developing system program
JP5414292B2 (en) Defect analysis apparatus, method and program
JPH08185336A (en) Microprocessor and methods for transmitting and tracing signal between microprocessor and debugging tool
US7596719B2 (en) Microcontroller information extraction system and method
JP2002202900A (en) Debug device
JP3775462B2 (en) Debug system and information storage medium
US20060075310A1 (en) Microcomputer and trace control method capable of tracing desired task
US20030191624A1 (en) Debug function built-in type microcomputer
JP3741187B2 (en) Debug system and information storage medium
JP3711438B2 (en) Debug system and information storage medium
US20040049665A1 (en) Trace control circuit adapted for high-speed microcomputer operation
JP2003263339A (en) Microcomputer with built-in debug function
JP2008507025A (en) Emulation and debug interface for integrated circuit testing
US20040015885A1 (en) Emulator and emulation method
CN116737078A (en) Flash memory read-write system, method, equipment and medium
JPH08255096A (en) Microprocessor and debugging system
JP2009529722A (en) Apparatus, method and computer program product for generating tracking data
US20230314513A1 (en) In-circuit emulator device
JP2004038464A (en) Microcomputer with built-in debugging function
US20050033542A1 (en) Debugger apparatus and debugging method
US6854047B2 (en) Data storage device and data transmission system using the same
CN100369008C (en) Integrated Circuit Physical Simulator
JPH09185526A (en) Debugging device
JP2003263336A (en) Microcomputer with built-in debug function

Legal Events

Date Code Title Description
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20050414

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20050517

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20050712

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20050803

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20050928

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20051026

RD04 Notification of resignation of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7424

Effective date: 20051220

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20051222

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20051228

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20060201

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20060214

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20090303

Year of fee payment: 3

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20100303

Year of fee payment: 4

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20100303

Year of fee payment: 4

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20110303

Year of fee payment: 5

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20120303

Year of fee payment: 6

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20120303

Year of fee payment: 6

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20130303

Year of fee payment: 7

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20140303

Year of fee payment: 8

LAPS Cancellation because of no payment of annual fees