JP2007026084A - Microprocessor - Google Patents
Microprocessor Download PDFInfo
- Publication number
- JP2007026084A JP2007026084A JP2005207177A JP2005207177A JP2007026084A JP 2007026084 A JP2007026084 A JP 2007026084A JP 2005207177 A JP2005207177 A JP 2005207177A JP 2005207177 A JP2005207177 A JP 2005207177A JP 2007026084 A JP2007026084 A JP 2007026084A
- Authority
- JP
- Japan
- Prior art keywords
- microprocessor
- debug
- program
- asr
- interrupt
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Landscapes
- Debugging And Monitoring (AREA)
- Test And Diagnosis Of Digital Computers (AREA)
- Microcomputers (AREA)
Abstract
Description
本発明は、ユーザシステム上で動作するソフトウェアの開発支援のためのエミュレーション技術、そのエミュレーションを可能とするシステムLSIもしくはマイクロプロセッサ、及びそれらを含むエミュレータに適用して有効な技術に関する。 The present invention relates to an emulation technology for supporting development of software that operates on a user system, a system LSI or a microprocessor that enables the emulation, and a technology that is effective when applied to an emulator including them.
本発明者が検討した技術として、例えば、マイクロプロセッサ等のエミュレーション技術においては、以下の技術が考えられる。 As technologies studied by the present inventor, for example, the following technologies are conceivable in an emulation technology such as a microprocessor.
システムLSIもしくはマイクロプロセッサ応用機器の開発において、その応用システム(ユーザシステム)のデバッグやそのシステムの詳細な評価を行うため、エミュレータが使用されている。このエミュレータは、開発中のユーザシステムに接続されて、その詳細なシステムデバッグを支援するものである。 In the development of system LSI or microprocessor application equipment, an emulator is used to debug the application system (user system) and perform detailed evaluation of the system. This emulator is connected to a user system under development and supports detailed system debugging.
ユーザシステムのデバッグにおいて、所定の条件が成立した場合にユーザプログラムの実行を停止(ブレーク)する機能は、エミュレータの基本機能の一つとされる。 In the debugging of the user system, the function of stopping (breaking) execution of the user program when a predetermined condition is satisfied is one of the basic functions of the emulator.
ユーザプログラム実行中にブレーク命令またはブレーク信号がマイクロプロセッサに入力されると、ユーザプログラムモードからデバッグモードに遷移される。この機能を用いてユーザプログラムのブレーク機能が実現される。 When a break instruction or a break signal is input to the microprocessor during execution of the user program, a transition is made from the user program mode to the debug mode. A break function of the user program is realized using this function.
ユーザプログラムの特定アドレスの命令がブレーク命令に置き換えられたり、アドレスバスやデータバスの状態が特定条件に一致したことによりブレーク信号が生成されたりすると、それを受けて、制御がユーザプログラムモードからデバッグモードに遷移される。制御がデバッグモードに遷移されると、デバッグプログラムが動作してレジスタやメモリの内容表示や、デバッグを行っているプログラマによるエミュレータを介したレジスタやメモリの内容変更などの操作が行われる。 When an instruction at a specific address in the user program is replaced with a break instruction, or when a break signal is generated when the address bus or data bus state matches a specific condition, control is debugged from the user program mode. Transition to mode. When the control shifts to the debug mode, the debug program operates to display the contents of the registers and memories, and the operations such as changing the contents of the registers and memories through the emulator by the programmer performing debugging.
このとき、ユーザプログラムの実行は停止しているが、デバッグを行っているプログラマのエミュレータ操作と連動してユーザプログラムの実行再開を行うため、割込み応答時間として要求される時間(通常は数十マイクロ秒)と比べ、非常に長い時間、割込み処理を行うことができない。そのため、機器制御などのリアルタイム処理を必要とするシステムでは、デバッグ効率を著しく低下させる恐れがある。 At this time, the execution of the user program is stopped, but the execution of the user program is resumed in conjunction with the emulator operation of the programmer who is debugging, so the time required for the interrupt response time (usually several tens of microseconds) Interrupt processing cannot be performed for a very long time compared to (second). Therefore, in a system that requires real-time processing such as device control, there is a risk that debugging efficiency may be significantly reduced.
この問題に対し、特許文献1では、デバッグプログラムが中断したことを示す信号を用意し、当該信号が“1”の時、割込からの復帰命令を実行した場合、デバッグモードへ復帰する方式で解決が図られている。
To solve this problem,
また同様に、特許文献2では、デバッグプログラム実行中に割込みを検出した場合、デバッグプログラムにより、割込みの種類に対応したユーザ指定のアドレスをテーブルから検索し、ブレークからの復帰命令で割込みハンドラへ直接分岐し、割込みからの復帰命令にブレークを設定し、再度デバッグプログラムへ復帰する方式で解決が図られている。
Similarly, in
また、ユーザシステムのデバッグにおいて、バスに流れるアドレスやデータ、もしくはユーザプログラムの分岐元、分岐先アドレスを取り出し、所定のメモリもしくはピンを使用して外部に出力する(トレース)する機能は、前記ブレーク機能と並び、エミュレータの基本機能の一つとされる。 In the debugging of the user system, the address and data flowing on the bus or the branch source and branch destination addresses of the user program are taken out and output (traced) to the outside using a predetermined memory or pin. Along with the functions, it is one of the basic functions of the emulator.
このトレース機能により、ユーザプログラム実行中に、マイクロプロセッサから、バスに接続されたメモリや他のIPへのロード、ストアに対するアドレスやデータ、もしくはマイクロプロセッサの実行するユーザプログラム内の分岐命令に対する分岐元アドレスや分岐先アドレスを、ユーザプログラムの実行を停止させることなく取り出すことができる。このように取り出した情報(トレースデータという)は、所定のメモリもしくはピンを介して外部へ取り出され、デバッグを行っているプログラマが確認することができる。
ところで、前記のようなマイクロプロセッサ等のエミュレーション技術について、本発明者が検討した結果、以下のようなことが明らかとなった。 By the way, as a result of the study of the emulation technology such as the microprocessor as described above, the following has been clarified.
ブレーク機能によるユーザプログラムの停止は、トレース機能では不可能なマイクロプロセッサ内部のレジスタなどの内容表示や変更を可能とするが、機器制御などの割込みを利用したリアルタイム処理を不可能にする。 Stopping the user program by the break function enables the display and change of the contents of registers in the microprocessor, which is impossible with the trace function, but disables real-time processing using interrupts such as device control.
これに対し、前記特許文献1、特許文献2のようにデバッグモードを中断し、割込みを利用したリアルタイム処理を可能とする方法が挙げられる。この方法では、デバッグモード中であっても例外的にリアルタイム処理を可能とするが、ブレーク機能で停止させているユーザプログラム1で使用するデバイスやメモリ領域と、リアルタイム処理として実行されるユーザプログラム2で使用するデバイスやメモリ領域に共通部分がある場合、ユーザプログラム2が実行されることにより、ユーザプログラム1で使用するデバイスやメモリ領域の状態が変化してしまうことがある。そのため、ユーザプログラム1のデバッグが不可能となる場合がある。
On the other hand, there is a method of interrupting the debug mode and enabling real-time processing using an interrupt as in
そこで、ユーザプログラム2にブレーク機能を使ってデバッグすることを考えた場合、ユーザプログラム2を実行中のプロセッサ内部のレジスタなどの内容表示や変更は可能となるが、ユーザプログラム2をブレークにより長時間停止することになるため、リアルタイム処理ではなくなってしまう。また、ユーザプログラム1に対してブレーク機能を使用している状態で、ユーザプログラム2に対するブレーク機能を使用することになるため、プロセッサ内部のデバッグ専用リソースの状態(ステート)をデバッグプログラムから退避及び復帰可能とする必要がある。
Therefore, when considering debugging the
一方、ユーザプログラム2にトレース機能を使ってデバッグを行う場合、そもそもマイクロプロセッサ内部のレジスタなどの内容表示や変更が行えないため、ブレーク機能が利用可能である場合と比べ、マイクロプロセッサ内部でどのような原因で不具合が発生するか、特定がより難しくなる。
On the other hand, when the
本発明の前記並びにその他の目的と新規な特徴は、本明細書の記述及び添付図面から明らかになるであろう。 The above and other objects and novel features of the present invention will be apparent from the description of this specification and the accompanying drawings.
本願において開示される発明のうち、代表的なものの概要を簡単に説明すれば、次のとおりである。 Of the inventions disclosed in the present application, the outline of typical ones will be briefly described as follows.
すなわち、本発明によるマイクロプロセッサは、ブレーク機能を使用してデバッグモードへ遷移した状態で、デバッグモードを中断して割込みを利用したリアルタイム処理を行っているプログラムに対して、さらにブレーク機能を使用可能とするため、前記マイクロプロセッサの内部状態を保持・退避可能なレジスタと、前記マイクロプロセッサの内部状態の退避及び復帰に使用されるメモリとを有するものである。 In other words, the microprocessor according to the present invention can further use the break function for a program in which the debug mode is interrupted and the real-time processing using the interrupt is performed after transitioning to the debug mode using the break function. For this reason, a register capable of holding and saving the internal state of the microprocessor and a memory used for saving and restoring the internal state of the microprocessor are provided.
本願において開示される発明のうち、代表的なものによって得られる効果を簡単に説明すれば、以下のとおりである。 Of the inventions disclosed in the present application, effects obtained by typical ones will be briefly described as follows.
デバッグ効率の向上を図ることができる。 The debugging efficiency can be improved.
以下、本発明の実施の形態を図面に基づいて詳細に説明する。なお、実施の形態を説明するための全図において、同一部材には原則として同一の符号を付し、その繰り返しの説明は省略する。 Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings. Note that components having the same function are denoted by the same reference symbols throughout the drawings for describing the embodiment, and the repetitive description thereof will be omitted.
以下に述べる本発明の実施の形態1〜3に係るマイクロプロセッサにより、デバッグモードを中断して実行している割込みを利用したリアルタイム処理に対し、デバッグを行っているプログラマが設定する割り込み応答時間の許容範囲内で、自由にブレーク機能を適用可能とし、デバッグ効率の向上を実現した。 By the microprocessor according to the first to third embodiments of the present invention described below, the interrupt response time set by the debugging programmer is set for the real-time processing using the interrupt that is executed while the debug mode is interrupted. The break function can be freely applied within the allowable range, and debugging efficiency has been improved.
(実施の形態1)
図1は、本発明の実施の形態1に係るマイクロプロセッサの構成を示すブロック図である。
(Embodiment 1)
FIG. 1 is a block diagram showing a configuration of a microprocessor according to
まず、図1により、本実施の形態1に係るマイクロプロセッサの構成の一例を説明する。本実施の形態1のマイクロプロセッサ10は、例えば、CPU(中央処理装置)コア1、デバッグ制御回路6、ユーザRAM(ランダムアクセスメモリ)8、ASE−RAM(デバッグ専用メモリ)7、BUS(バス)9などから構成されている。また、CPUコア1は、内部ステート制御回路3、モード遷移制御回路4、CPU動作制御回路5、ASR.state(内部ステート)レジスタ80などから構成されている。なお、ユーザRAM8は、図1ではマイクロプロセッサ10に内蔵されているが、外付けにしてもよい。また、マイクロプロセッサ10は、通常は1つのチップで構成されるが、2つ以上の複数のチップで構成してもよい。また、マイクロプロセッサ10はシステムLSIの一部であってもよい。
First, an example of the configuration of the microprocessor according to the first embodiment will be described with reference to FIG. The
ASR.stateレジスタ80は、マイクロプロセッサ10内部のデバッグ専用リソースのステート(状態)を示すレジスタである。内部ステート制御回路3は、ASR.stateレジスタ80の更新制御を行う回路である。モード遷移制御回路4は、デバッグモードとデバッグモードの中断時の更新制御を行う回路である。CPU動作制御回路5は、入力された割込み要求信号と命令実行の状態とASR.stateレジスタ80の内容から内部ステート制御回路3およびモード遷移制御回路4を動作させる回路である。デバッグ制御回路6は、マイクロプロセッサ10内のデバッグ制御とマイクロプロセッサ10外との通信を行う回路である。ASE−RAM7は、デバッグプログラムでのみ操作可能なデバッグ専用メモリである。ユーザRAM8は、ユーザプログラムおよびデバッグプログラムで操作可能なメモリである。BUS9は、CPUコア1、デバッグ制御回路6、ASE−RAM7、ユーザRAM8とを接続するバスである。
ASR. The
図2に、ASR.stateレジスタ80を構成するASR.stateビットの制御論理の一例を示す。このASR.stateビットを複数ビット(例えば32ビット)並べることによりASR.stateレジスタ80が構成される。
In FIG. ASR. An example of the control logic of the state bit is shown. This ASR. By arranging a plurality of state bits (for example, 32 bits), ASR. A
図2において、ASR.stateビットに対応するCPUコア内部のデバッグ専用リソースのステートのセット条件を40、リセット時の初期値を41、クリア条件を42、内部ステートを保持するフリップフロップを43とする。また、ASR書き込み信号34が“1”の時、ASR.stateレジスタ80に書き込む値がのったASRデータ信号35の対応する値をフリップフロップ43に書き込む。
In FIG. It is assumed that the debug condition resource setting condition in the CPU core corresponding to the state bit is 40, the reset initial value is 41, the clear condition is 42, and the flip-flop holding the internal state is 43. When the
図3に、本実施の形態1に対応するデバッグプログラムのフローチャートを示す。まず、ステップS94でユーザプログラムを開始し、ステップS90でブレークが発生しているか否かを判定する。ブレークが発生している場合は、ステップS95でスタック待避(ASR.stateレジスタ80の内容をスタックとしてASE−RAM7に書き出す)を行い、ステップS91で割込みを監視しながら、ステップS96でデバッグプログラムを実行する。割込みが発生しない場合は、デバッグプログラムが終了するまで実行し(ステップS96〜S97)、ステップS98でスタック復帰(ASE−RAM7の内容をスタックとしてASRレジスタ2に書き戻す)を行った後、ユーザプログラムに復帰する。
FIG. 3 shows a flowchart of the debug program corresponding to the first embodiment. First, a user program is started at step S94, and it is determined whether a break has occurred at step S90. If a break has occurred, the stack is saved in step S95 (the contents of the ASR.state register 80 are written to the ASE-
また、ステップS91で割込みを受理した場合は、ステップS92で割込みハンドラへ分岐して割込み処理用ユーザプログラムに分岐する。また、ユーザプログラムからデバッグプログラムへの復帰はステップS93で割込みから復帰する命令(RTE命令)の復帰先がデバッグプログラムかどうかを判定することで行う。 If an interrupt is accepted in step S91, the process branches to the interrupt handler in step S92 and branches to the interrupt processing user program. The return from the user program to the debug program is performed by determining whether the return destination of the instruction (RTE instruction) that returns from the interrupt is the debug program in step S93.
以上のような回路とデバッグプログラムの組み合わせで、デバッグモードを中断して実行している割込みを利用したユーザプログラムに対し、自由にブレーク機能が適用可能となる。 With the combination of the circuit and the debug program as described above, the break function can be freely applied to the user program that uses the interrupt executed by interrupting the debug mode.
(実施の形態2)
図4は本発明の実施の形態2に係るマイクロプロセッサの構成を示すブロック図である。
(Embodiment 2)
FIG. 4 is a block diagram showing a configuration of a microprocessor according to
まず、図4により、本実施の形態2に係るマイクロプロセッサ10aの構成の一例を説明する。本実施の形態のマイクロプロセッサ10aは、例えば、前記実施の形態1のマイクロプロセッサ10にブレーク抑止制御回路1000を追加したものである。本実施の形態のマイクロプロセッサ10aは、例えば、CPUコア1a、デバッグ制御回路6、ユーザRAM8、ASE−RAM7、BUS9などから構成されている。また、CPUコア1aは、内部ステート制御回路3、モード遷移制御回路4、ブレーク抑止制御回路1000、CPU動作制御回路5a、ASR.stateレジスタ80などから構成されている。前記実施の形態1と同様に、ユーザRAM8は、図4ではマイクロプロセッサ10aに内蔵されているが、外付けにしてもよい。また、マイクロプロセッサ10aは、通常は1つのチップで構成されるが、2つ以上の複数のチップで構成してもよい。また、マイクロプロセッサ10aはシステムLSIの一部であってもよい。
First, an example of the configuration of the
ASR.stateレジスタ80は、プロセッサ内部のデバッグ専用リソースのステートを示すレジスタである。内部ステート制御回路3は、ASR.stateの更新制御を行う回路である。モード遷移制御回路4は、デバッグモードとデバッグモードの中断時の更新制御を行う回路である。ブレーク抑止制御回路1000は、デバッグモード中の割込み受理を積算し、ある回数に達するとそれ以降のブレークを抑止する信号を発生する回路である。CPU動作制御回路5aは、入力された割込み要求信号と命令実行の状態とASR.stateレジスタ80の内容から、内部ステート制御回路3およびモード遷移制御回路4を動作させる回路である。デバッグ制御回路6は、マイクロプロセッサ内のデバッグ制御とマイクロプロセッサ外との通信を行う回路である。ASE−RAM7は、デバッグプログラムでのみ操作可能なデバッグ専用メモリである。ユーザRAM8は、ユーザプログラムおよびデバッグプログラムで操作可能なメモリである。BUS9はCPUコア1a、デバッグ制御回路6、ASE−RAM7、ユーザRAM8とを接続するバスである。
ASR. The
ASR.stateビットの制御論理は、前記実施の形態1で示した図2の論理を使用する。 ASR. As the control logic of the state bit, the logic of FIG. 2 shown in the first embodiment is used.
図5に、ブレーク抑止制御回路1000の構成を示す。ブレーク抑止制御回路1000は、デバッグモード中であることを示すASE信号30と、割込みが受理されたことを示す割込み受理信号31が同時に“1”になったとき、カウンタ1100をカウントアップし、クリア信号1105が“1”になったときにカウントダウンする。このクリア信号1105が“1”になるのは、リセット期間中と、割込みから復帰する命令(RTE命令)により、中断していたデバッグプログラムを再開する際である。また、デバッグ中断上限回数を示す信号1104の値をデバッグプログラムからのみ書き込み可能であって、アドレスマップされているレジスタ1101を持ち、前記カウンタ1100の値と、レジスタ1101との値を比較して一致した場合にブレーク抑止信号1103を“1”とする比較器1102を持つ。
FIG. 5 shows the configuration of the break
図6に、本実施の形態2に対応するデバッグプログラムのフローチャートを示す。まず、ステップS125でユーザプログラムを開始し、ステップS120でブレーク抑止制御回路1000を使用してデバッグ中断回数が上限でないかを判定する。上限に達していた場合、ブレークを受け付けずユーザプログラムのみを実行する。そのため、割込みなどで他のユーザプログラムが動作しても、多重ブレークを使用することを抑止し、スタック領域が無限に増加することを防ぐ。一方、上限に達していない場合は、ステップS121でブレークが発生しているかを判定し、ブレークが発生している場合は、ステップS126でスタック待避を行い、ステップS122で割込みを監視しながらデバッグプログラムを実行する(ステップS127)。割込みが発生しない場合は、デバッグプログラムが終了するまで実行し(ステップS128)、ステップS129でスタック復帰を行った後、ユーザプログラムに復帰する。また、ステップS122で割込みを受理した場合は、ステップS123で割込みハンドラへ分岐して割込み処理用ユーザプログラムに分岐する。また、ユーザプログラムからデバッグプログラムへの復帰は、ステップS124でRTE命令の復帰先がデバッグプログラムかどうかを判定することでを行う。
FIG. 6 shows a flowchart of a debug program corresponding to the second embodiment. First, in step S125, the user program is started, and in step S120, it is determined whether the number of debug interruptions is not the upper limit using the break
以上のような回路とデバッグプログラムの組み合わせで、デバッグモードを中断して実行している割込みを利用したユーザプログラムに対し、自由にブレーク機能を適用可能となる。また、デバッグ中断回数を制限することで、デバッグ専用リソースを減らすことができる。 With the combination of the circuit and the debug program as described above, the break function can be freely applied to the user program that uses the interrupt that is executed by interrupting the debug mode. Further, by limiting the number of debugging interruptions, it is possible to reduce debugging dedicated resources.
(実施の形態3)
図7は本発明の実施の形態3に係るマイクロプロセッサの構成を示すブロック図である。
まず、図7により、本実施の形態3に係るマイクロプロセッサ10bの構成の一例を説明する。本実施の形態3に係るマイクロプロセッサ10bは、例えば、前記実施の形態1に係るマイクロプロセッサ10のASR.stateレジスタ80をASRレジスタ2に置き換えたものである。
(Embodiment 3)
FIG. 7 is a block diagram showing a configuration of a microprocessor according to
First, an example of the configuration of the
本実施の形態3のマイクロプロセッサ10bは、例えば、CPUコア1b、デバッグ制御回路6、ユーザRAM8、ASE−RAM7、BUS9などから構成されている。また、CPUコア1bは、内部ステート制御回路3、モード遷移制御回路4、CPU動作制御回路5b、ASRレジスタ2などから構成されている。前記実施の形態1及び2と同様に、ユーザRAM8は、図7ではマイクロプロセッサ10bに内蔵されているが、外付けにしてもよい。また、マイクロプロセッサ10bは、通常は1つのチップで構成されるが、2つ以上の複数のチップで構成してもよい。また、マイクロプロセッサ10bはシステムLSIの一部であってもよい。
The
図8に、ASRレジスタ2の構成を示す。ASRレジスタ2は、デバッグモードを中断して割込みを受理したことを示すASR.ARビット20と、前記実施の形態1及び2のASR.stateレジスタ80に相当する、プロセッサ内部のデバッグ専用リソースのステートを示すASR.stateビット21を持ったレジスタである。
FIG. 8 shows the configuration of the
図7の内部ステート制御回路3は、ASR.stateビット21の更新制御を行う回路である。モード遷移制御回路4は、ASR.ARビット20の更新制御を行う回路である。CPU動作制御回路5bは、入力された割込み要求信号と命令実行の状態とASRレジスタ2の内容から内部ステート制御回路3およびモード遷移制御回路4を動作させる回路である。デバッグ制御回路6は、マイクロプロセッサ10b内のデバッグ制御と、マイクロプロセッサ10b外との通信を行う回路である。ASE−RAM7は、デバッグプログラムでのみ操作可能なデバッグ専用メモリである。ユーザRAM8は、ユーザプログラムおよびデバッグプログラムで操作可能なメモリである。、BUS9は、CPUコア1b、デバッグ制御回路6、ASE−RAM7、ユーザRAM8とを接続するバスである。
The internal
図8に示すように、ASRレジスタ2は、デバッグプログラムからのみ操作可能なアドレス割り付けの32ビットレジスタとし、最上位ビットをASR.ARビット20、それ以外のビットをASR.stateビット21とする。ASR.stateビット21は、CPUコア内部のデバッグ専用リソースのステートの数に従い必要な数だけ使用し、残りはリザーブビットとして“0”固定とする。
As shown in FIG. 8, the
図9に、ASR.ARビット20の制御論理を示す。デバッグモード中であることを示すASE信号30と、割込みが受理されたことを示す割込み受理信号31が同時に“1”になったとき、フリップフロップ32に“1”を書き込み、またARクリア信号33が“1”になったときはフリップフロップ32に書き込まれている値を“0”に書き換える。このARクリア信号33が“1”となるのは、リセット期間中と、割込みから復帰する命令(RTE命令という)により、中断していたデバッグプログラムを再開する際である。また、ASR書き込み信号34が“1”の時、ASRレジスタ2に書き込む値がのったASRデータ信号35のASR.ARビット20に対応する値をフリップフロップ32に書き込む。
In FIG. The control logic of the
ASR.stateビット21の制御論理は、前記実施の形態1で示した図2の論理を使用する。図2に示すように、ASR.stateビット21に対応するCPUコア内部のデバッグ専用リソースのステートのセット条件を40、リセット時の初期値を41、クリア条件を42、内部ステートを保持するフリップフロップを43とする。また、ASR書き込み信号34が“1”の時、ASRレジスタに書き込む値がのったASRデータ信号35の対応する値をフリップフロップ43に書き込む。
ASR. The control logic of the
次に図10により、ASR.ARビット20の遷移を説明する。ユーザプログラムA500において、ブレーク501が発生すると、マイクロプロセッサ10bはデバッグモードに遷移し、デバッグプログラムA502の実行を開始する。このデバッグプログラムA502を実行中に、割込み503が発生すると、マイクロプロセッサはASR.ARビット20に“1”を書き込み、ユーザプログラムB504の実行を開始する。ユーザプログラムB504実行中に、さらにブレーク505が発生すると、マイクロプロセッサ10bは再度デバッグモードへ遷移し、デバッグプログラムB506の実行を開始する。デバッグプログラムB506の実行が終わると、ブレークから復帰命令(RTB命令とよぶ)により、ブレーク機能により中断していたユーザプログラムB508に復帰する(507)。ユーザプログラムB508の実行が終わると、割込みからの復帰命令(RTE命令とよぶ)により、デバッグプログラムA502の続きである510に復帰する(509)。この際、前記ARクリア信号33が“1”となるため、ASR.ARビット20が“0”となる。デバッグプログラムA510の実行が終わると、RTB命令により、ユーザプログラムA512に復帰し、ブレーク501が発生した直後の状態へ復帰する。
Next, referring to FIG. The transition of the
図11に、500〜512までのユーザプログラム、デバッグプログラムの実行順と、スタック操作の様子を時間軸にそって示す。ブレーク501によって開始されるデバッグプログラムA502では、まずASE−RAM7へのスタック待避A600を行う。また同様に、ブレーク505によって開始されるデバッグプログラムB506では、ASE−RAM7へのスタック待避B601を行う。
FIG. 11 shows the execution order of
また、デバッグプログラムB506から、ユーザプログラムB508へRTB命令で復帰する際には、RTB命令実行前に、スタック復帰B602を行う。同様に、デバッグプログラムA510から、ユーザプログラムA512へRTB命令で復帰する際には、RTB命令実行前に、スタック復帰B603を行う。 When returning from the debug program B506 to the user program B508 with an RTB instruction, a stack return B602 is performed before the RTB instruction is executed. Similarly, when returning from the debug program A510 to the user program A512 with an RTB instruction, a stack return B603 is performed before executing the RTB instruction.
以上の中で、デバッグプログラムB506を実行している期間が、多重ブレーク期間604である。また、デバッグプログラムのためのスタック操作をしている期間600〜603は、割込み受理禁止期間であり、それ以外のデバッグモードである期間605がデバッグプログラム実行中の割込み許可期間605である。なお、スタック領域としてASE−RAM7を使用するのは、ユーザプログラムによる予期せぬデータ破壊からデバッグプログラムのスタック情報を保護するためである。また、ASE−RAM7はデバッグプログラム専用のメモリであるため、容量が非常に少なく(通常数キロバイト)、さらにデバッグプログラム本体の格納以外にトレースデータ保存用にも使用される事があるため、スタック領域のサイズはできる限り少ない方が望ましい。
Among the above, the period during which the
ところで、ユーザプログラムB504,508は、デバッグプログラムA502,510よりも優先して実行すべきリアルタイム処理である。また、デバッグプログラムA502,510は、デバッグを行っているプログラマのエミュレータ操作と連動してユーザプログラムの実行再開を行う。 By the way, the user programs B504 and 508 are real-time processes to be executed with priority over the debug programs A502 and 510. The debug programs A 502 and 510 resume execution of the user program in conjunction with the emulator operation of the programmer who is performing debugging.
デバッグプログラムA502,510と、デバッグプログラムB506は、ともにASE−RAM7上に置かれる。デバッグプログラムB506は、リアルタイム処理に対するブレーク505の後に実行するため、デバッグプログラムA502,510のように、デバッグを行っているプログラマのエミュレータ操作と連動していると、ユーザプログラムB504,508のリアルタイム処理が不可能になってしまう。そのため、デバッグプログラムB506で実行する命令列数、多重ブレーク期間604の上限を設定することで、ユーザプログラムB504,508のリアルタイム処理を可能とする必要がある。
Both the debug programs A 502 and 510 and the
図12に、この制約に対応するデバッグプログラムのフローチャートを示す。まず、ステップS700の初期設定で、リアルタイム処理を行うユーザプログラムに対して、実行したい命令列と多重ブレーク期間の上限を設定する。その後、ステップS712でユーザプログラムを開始し、ステップS701でブレークが発生しているかを判定する。ブレークが発生している場合は、ステップS702でASR.ARビット20の評価を行う。ASR.ARビット20が“0”である場合は、ステップS713でスタック待避を行い、ステップS703で割込みを監視しながらデバッグを行っているプログラマのエミュレータ操作と連動したデバッグプログラムを実行する。ステップS703で割込みが発生しない場合は、ステップS705のデバッグプログラムが終了するまで実行し(ステップS714)、ステップS715でスタック復帰を行った後、ユーザプログラムに復帰する。
FIG. 12 shows a flowchart of the debug program corresponding to this restriction. First, as an initial setting in step S700, an instruction sequence to be executed and an upper limit of a multiple break period are set for a user program that performs real-time processing. Thereafter, the user program is started in step S712, and it is determined whether a break has occurred in step S701. If a break has occurred, the ASR. The
また、ステップS703で割込みを受理した場合は、ステップS707でASR.ARビット20に“1”を書き込み、割込みハンドラへ分岐して割込み処理用ユーザプログラムに分岐する。
If an interrupt is accepted in step S703, ASR. Write “1” to the
一方、ステップS702でASR.ARビット20が“1”であった場合は、ステップS700で設定した制約に違反しないかを確認する(ステップS708)。違反しない場合はさらにスタック領域に空きがあるかを確認し(ステップS709)、大丈夫な場合はステップS713のスタック操作を行う。
On the other hand, in step S702, ASR. If the
また、ステップS704ではASR.ARビット20が“1”であるため、ステップS700で設定したリアルタイム処理に対応するデバッグプログラムを実行する(ステップS706)。また、ステップS708、ステップS709の判定で、多重ブレークできなかった場合は、ステップS700で設定したリアルタイム処理に対応するデバッグプログラムを実行し(ステップS710)、ステップS716で終了したらユーザプログラムに復帰する。また、ユーザプログラムからデバッグプログラムへの復帰はステップS711で判定を行う。
In step S704, ASR. Since the
以上のような回路とデバッグプログラムの組み合わせで、リアルタイム処理ではないユーザプログラムだけでなく、デバッグモードを中断して実行している割込みを利用したリアルタイム処理に対し、デバッグを行っているプログラマが設定する割り込み応答時間の許容範囲内で、自由にブレーク機能を適用可能となる。 With the combination of the above circuit and debug program, the debugging programmer sets not only the user program that is not real-time processing but also the real-time processing that uses the interrupt that is executed by interrupting the debug mode. The break function can be freely applied within the allowable range of interrupt response time.
本実施の形態3のマイクロプロセッサは、デバッグモードを中断して割込みを受理したことを示すビット(ASR.ARビット20)と、プロセッサ内部のデバッグ専用リソースのステートを示すビット(ASR.stateビット21)を持ったレジスタ(ASRレジスタ2)をデバッグプログラムから参照できるため、検出したブレークが通常のユーザプログラムのデバッグのために発生したものか、割込みを利用したリアルタイム処理のためにデバッグモードを中断して実行しているユーザプログラムのものかを判別可能である。また、マイクロプロセッサ内部のデバッグ専用リソースをスタックとしてメモリに書き出すことで、さらに多重にデバッグモードを中断して割込みを受理することができるという利点がある。 The microprocessor according to the third embodiment has a bit (ASR.AR bit 20) indicating that the debug mode is interrupted and an interrupt is accepted, and a bit (ASR.state bit 21) indicating the state of the dedicated debugging resource in the processor. ) Can be referenced from the debug program, so whether the detected break occurred for debugging a normal user program or the debug mode is suspended for real-time processing using interrupts. It is possible to determine whether the user program is being executed. Further, by writing the debugging dedicated resources inside the microprocessor as a stack to the memory, there is an advantage that the debugging mode can be interrupted and interrupts can be accepted.
以上、本発明者によってなされた発明をその実施の形態に基づき具体的に説明したが、本発明は前記実施の形態に限定されるものではなく、その要旨を逸脱しない範囲で種々変更可能であることはいうまでもない。 As mentioned above, the invention made by the present inventor has been specifically described based on the embodiment. However, the invention is not limited to the embodiment, and various modifications can be made without departing from the scope of the invention. Needless to say.
例えば、ASRレジスタのビット数を変更することで、バス幅の異なるマイクロプロセッサに適用可能である。 For example, it can be applied to microprocessors having different bus widths by changing the number of bits of the ASR register.
また、ASR.stateビットの数が非常に多い場合、ASR.stateビットのみで構成されるデバッグプログラムからのみ操作可能なアドレス割り付けのレジスタを追加定義する事で対応可能である。 In addition, ASR. If the number of state bits is very large, ASR. This can be dealt with by additionally defining an address allocation register that can be operated only from a debug program composed only of state bits.
多重ブレーク回数を制限するために、ASR.ARビットを任意のビット数のカウンタとし、またブレークの上限回数を設定するレジスタを別途用意することで、ASR.ARビットの比較などを行う回数を減らすことも可能である。 In order to limit the number of multiple breaks, ASR. By using the AR bit as a counter of an arbitrary number of bits and separately preparing a register for setting the upper limit number of breaks, ASR. It is also possible to reduce the number of times the AR bit comparison is performed.
ブレーク発生時のデバッグプログラムの開始アドレスを、ASR.ARビットによって切り替える事で、ASR.ARビットの比較などを行う回数を減らすことも可能である。 The start address of the debug program when a break occurs is set to ASR. By switching by AR bit, ASR. It is also possible to reduce the number of times the AR bit comparison is performed.
本発明は、マイクロプロセッサ等の半導体製品の製造業で利用可能である。 The present invention can be used in the manufacturing industry of semiconductor products such as microprocessors.
1,1a,1b CPUコア
2 ASRレジスタ
3 内部ステート制御回路
4 モード遷移制御回路
5,5a,5b CPU動作制御回路
6 デバッグ制御回路
7 ASE−RAM(デバッグ専用メモリ)
8 ユーザRAM
9 BUS
10,10a,10b マイクロプロセッサ
20 ASR.ARビット
21 ASR.stateビット
32,43 フリップフロップ
80 ASR.stateレジスタ
1000 ブレーク抑止制御回路
1100 カウンタ
1101 レジスタ
1102 比較器
1, 1a,
8 User RAM
9 BUS
10, 10a,
Claims (7)
前記マイクロプロセッサの内部状態を保持し、退避可能なレジスタと、
前記マイクロプロセッサの内部状態の退避及び復帰に使用されるメモリとを有し、
前記ユーザプログラムを中断してさらに第2のデバッグプログラムの実行が可能であることを特徴とするマイクロプロセッサ。 A microprocessor capable of interrupting the first debug program by an interrupt and executing a user program during execution of the first debug program,
A register that holds and saves the internal state of the microprocessor;
A memory used for saving and restoring the internal state of the microprocessor;
A microprocessor characterized in that the user program can be interrupted to execute a second debug program.
前記メモリは、デバッグプログラムでのみ操作可能なデバッグ専用メモリであり、
前記レジスタの退避先は、前記デバッグ専用メモリであることを特徴とするマイクロプロセッサ。 The microprocessor of claim 1, wherein
The memory is a dedicated debug memory that can be operated only by a debug program,
The microprocessor is characterized in that the save destination of the register is the debug-dedicated memory.
多重割込み回数をカウントするカウンタと、
多重割込み回数の上限値を保持する保持回路と、
前記カウンタの値と前記保持回路の値とを比較する比較器とを有し、
前記比較器の比較結果に基づいて、多重割込み回数を制限することを特徴とするマイクロプロセッサ。 The microprocessor of claim 1, wherein
A counter that counts the number of multiple interrupts;
A holding circuit that holds the upper limit of the number of multiple interrupts;
A comparator that compares the value of the counter with the value of the holding circuit;
A microprocessor that limits the number of multiple interrupts based on a comparison result of the comparator.
デバッグモードを中断して割込みを受理したことを示すビットを有し、
前記ビットの内容に基づいて、多重割込み回数を制限することを特徴とするマイクロプロセッサ。 The microprocessor of claim 1, wherein
Has a bit to indicate that the interrupt was accepted by interrupting debug mode,
A microprocessor characterized in that the number of multiple interrupts is limited based on the contents of the bits.
前記ビットを利用して、前記割込みにより実行される処理が、リアルタイム処理の必要な処理か否かを判定し、前記リアルタイム処理を崩さない範囲でブレーク機能を利用可能とする機能を有することを特徴とするマイクロプロセッサ。 The microprocessor of claim 4, wherein
Using the bit, it is determined whether or not the process executed by the interrupt is a process that requires a real-time process, and has a function of enabling a break function within a range that does not break the real-time process. And a microprocessor.
前記レジスタに保持される前記マイクロプロセッサの内部状態は、デバッグ専用リソースのステートであることを特徴とするマイクロプロセッサ。 The microprocessor of claim 1, wherein
The microprocessor characterized in that the internal state of the microprocessor held in the register is a state of a dedicated resource for debugging.
前記マイクロプロセッサの内部状態の退避及び復帰は、デバッグプログラムにより行われることを特徴とするマイクロプロセッサ。 The microprocessor of claim 1, wherein
The microprocessor characterized in that the internal state of the microprocessor is saved and restored by a debug program.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2005207177A JP2007026084A (en) | 2005-07-15 | 2005-07-15 | Microprocessor |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2005207177A JP2007026084A (en) | 2005-07-15 | 2005-07-15 | Microprocessor |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2007026084A true JP2007026084A (en) | 2007-02-01 |
Family
ID=37786749
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2005207177A Pending JP2007026084A (en) | 2005-07-15 | 2005-07-15 | Microprocessor |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2007026084A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2011501265A (en) * | 2007-10-12 | 2011-01-06 | フリースケール セミコンダクター インコーポレイテッド | Debug instructions for use in data processing systems |
JP2011512603A (en) * | 2008-02-21 | 2011-04-21 | ローベルト ボツシユ ゲゼルシヤフト ミツト ベシユレンクテル ハフツング | Device for examining the program memory of a computing unit |
-
2005
- 2005-07-15 JP JP2005207177A patent/JP2007026084A/en active Pending
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2011501265A (en) * | 2007-10-12 | 2011-01-06 | フリースケール セミコンダクター インコーポレイテッド | Debug instructions for use in data processing systems |
JP2011512603A (en) * | 2008-02-21 | 2011-04-21 | ローベルト ボツシユ ゲゼルシヤフト ミツト ベシユレンクテル ハフツング | Device for examining the program memory of a computing unit |
US8464100B2 (en) | 2008-02-21 | 2013-06-11 | Robert Bosch Gmbh | System for checking a program memory of a processing unit |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105095128B (en) | Interrupt processing method and interrupt controller | |
JP2009524140A (en) | Area protection device, instruction set, and method for protecting memory area | |
EP3770765B1 (en) | Error recovery method and apparatus | |
US8392641B2 (en) | Microcontroller with an interrupt structure having programmable priority levels with each priority level associated with a different register set | |
CN105453029A (en) | Handling access attributes for data accesses | |
JP2008009721A (en) | Evaluation system and evaluation method thereof | |
US7010725B2 (en) | Method and apparatus for getting dump of a computer system | |
WO2015075505A1 (en) | Apparatus and method for external access to core resources of a processor, semiconductor systems development tool comprising the apparatus, and computer program product and non-transitory computer-readable storage medium associated with the method | |
US6877113B2 (en) | Break determining circuit for a debugging support unit in a semiconductor integrated circuit | |
US5257269A (en) | Error controller for use in debugging microprocessor | |
JP2007026084A (en) | Microprocessor | |
CN115576734B (en) | Multi-core heterogeneous log storage method and system | |
JP2011134162A (en) | System and method for controlling switching of task | |
US20060195849A1 (en) | Method for synchronizing events, particularly for processors of fault-tolerant systems | |
WO2017020639A1 (en) | Network processor, packet processing data acquisition method, and storage medium | |
JP2001256044A (en) | Data processor | |
US20030145175A1 (en) | Multiprocessor system having respective control programs of a plurality of processors stored contiguously in a memory | |
JPH1040130A (en) | Microcomputer | |
JP2005018650A (en) | Nonvolatile semiconductor storage device and data processor | |
JP3088285B2 (en) | In-circuit emulator | |
US20020032821A1 (en) | Management of interruptions in a computer platform | |
JP2003030003A (en) | Debug system | |
JP2015201208A (en) | System on chip and verification method thereof | |
JP2011215853A (en) | Semiconductor device and control method for the same | |
US7206926B2 (en) | Programmable unit including program operation unit and associated stopping device |