TWI306191B - A method for debugging a firmware program and a debugging microprocessor - Google Patents

A method for debugging a firmware program and a debugging microprocessor Download PDF

Info

Publication number
TWI306191B
TWI306191B TW95111940A TW95111940A TWI306191B TW I306191 B TWI306191 B TW I306191B TW 95111940 A TW95111940 A TW 95111940A TW 95111940 A TW95111940 A TW 95111940A TW I306191 B TWI306191 B TW I306191B
Authority
TW
Taiwan
Prior art keywords
debugging
variable
microprocessor
firmware
data
Prior art date
Application number
TW95111940A
Other languages
Chinese (zh)
Other versions
TW200636446A (en
Inventor
Shuford Clark
Original Assignee
Via Tech Inc
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Via Tech Inc filed Critical Via Tech Inc
Publication of TW200636446A publication Critical patent/TW200636446A/en
Application granted granted Critical
Publication of TWI306191B publication Critical patent/TWI306191B/en

Links

Landscapes

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

Description

1306191 九、發明說明: 【發明所屬之技術領域】 本發明係關於一種嵌入式韌體程式(embedded firmware program),且特別是關於一種嵌入式韌體程式之 除錯微處理器及方法。 【先前技#f】 φ 當利用一微處理器進行一韌體程式的除錯(debugging) 時,通常需審視微處理器内部的暫存器值。達成此目的的 方法之一是增加額外的硬體支援,以讓程式設計者能方便 查詢該等暫存器。一般内含此種除錯應用程式之電腦可以 稱之為除錯主機(debugging host)。有時除錯主機可以直接 與微處理器通訊’但通常會運用一通訊協定轉換器 (protocol converter)以將除錯主機之輸出訊號轉換為微處 理機的介面格式。通訊協定轉換器並負責依據除錯主機的 • 要求以設定微處理器的除錯暫存器之工作。 為了使勒體程式之除錯順利進行,程式設計者通常會 於除錯過程中設定程式斷點(breakpoint)、變數觀察點 (watchpoint)、以及硬體事件捕捉點(catchpoint)。程式斷點 是以指令流程為根據而設定的事件,例如當微處理器執行 了在一特定程式位址的某一指令’或是當微處理器執行了 一特定指令的運算碼(opcode)。變數觀察點則是以資料流程 為根據而設定的事件,例如當微處理器自一特定變數位址 存取某一變數,或是當微處理器存取了一特定資料值。硬1306191 IX. Description of the Invention: [Technical Field] The present invention relates to an embedded firmware program, and more particularly to an error-fixing microprocessor and method for an embedded firmware program. [Previous technique #f] φ When using a microprocessor to perform debugging of a firmware program, it is usually necessary to review the value of the scratchpad inside the microprocessor. One way to achieve this is to add additional hardware support to make it easy for programmers to query the registers. Generally, a computer containing such a debugging application can be called a debugging host. Sometimes the debugger can communicate directly with the microprocessor', but usually a protocol converter is used to convert the debug host's output signal to the microprocessor's interface format. The protocol converter is responsible for setting up the microprocessor's debug register based on the debugger's requirements. In order to facilitate the debugging of the Lex program, the programmer usually sets the program breakpoint, the variable watchpoint, and the hardware event capture point during the debugging process. Program breakpoints are events that are set based on the instruction flow, such as when the microprocessor executes an instruction at a particular program address or when the microprocessor executes an opcode of a particular instruction. Variable observation points are events that are set based on the data flow, such as when the microprocessor accesses a variable from a particular variable address, or when the microprocessor accesses a particular data value. hard

Client’s Docket No.:CRU04-00l6 TT’s Docket No:0008-A4068‘TW/Final/Yuan/2006-03-28 1306191 體事件捕捉點為程式設計者希望知道其發生 硬體相關事件,例如中斷(interrupt)、重開機等:先定義的 一般而言,微處理器中的除錯模組皆會勺八— 器’該組暫存器可被設^用來監測勃體=組暫存 斷點或變數觀察點之特定的位址或資料值。、…於程式 數目是有限的,僅僅增加暫存器的數 器的 模組設計複雜度的大量提升,因此該組 =成除錯 式斷點或變數觀察點共用。該組暫存器通常程 第一部分暫存器係用來監測記憶體位址,:γ P刀 用來則是用來監測資料。該組暫存器尚包括 器’其内賴存之值係絲選擇目前所要 行中的位址或是資料’若是位址(不論是指令二= 位址)則是與該第-部分暫存料比對,若是資 指令資料或是變數資料)則是與該第二部分暫存器作比^。 這種型態的暫存器於整個除錯系統中運用時會出現以 下的問題。一個變數觀察點可藉由兩種方式麻現,第一種 稱之為硬體變數觀察點,第二種稱之為軟^數觀察點。 於硬體變數祕點的情町,程式設計者可快速地進行除 錯,因為系統會運用一嵌入式電路内模擬器(embedded in-circuit emulator)模組中的該等暫存器來進行與匯流排上 的資料相比較的工作,以監控變數觀察點對應之事件,同 時微處理器可以依原有速度執行韌體程式。於軟體變數觀 察點的情況下,每當微處理器執行一指令,除錯主機便需 查詢微處理器一次,以便檢驗變數觀察點對應之資料值是Client's Docket No.: CRU04-00l6 TT's Docket No:0008-A4068'TW/Final/Yuan/2006-03-28 1306191 The body event capture point is for the programmer to know that it has a hardware-related event, such as an interrupt. , restart, etc.: In general, the debug module in the microprocessor will be scooped up - the 'storage register can be set to monitor the Boss = group temporary breakpoints or variables Observe the specific address or data value of the point. The number of programs is limited, and only a large increase in the module design complexity of the registers of the scratchpad is added, so the group = becomes a debug breakpoint or a variable watchpoint share. The first part of the register is used to monitor the memory address, and the γ P knife is used to monitor the data. The set of registers also includes the value of the internal memory of the device, and the address or data of the current desired line. If the address (whether the instruction 2 = address) is the temporary storage of the first part The material comparison, if it is the instruction data or the variable data, is compared with the second part of the register. This type of scratchpad can present the following problems when used in the entire debug system. A variable observation point can be seen in two ways. The first one is called a hardware variable observation point, and the second type is called a soft number observation point. In the case of the hardware variable, the programmer can quickly debug, because the system uses the registers in an embedded in-circuit emulator module. The data on the bus is compared to monitor the events corresponding to the variable observation points, and the microprocessor can execute the firmware at the original speed. In the case of a software variable observation point, whenever the microprocessor executes an instruction, the debugger needs to query the microprocessor once to check that the data value corresponding to the variable observation point is

Client’s Docket N〇.:CRU04-0016 TT^ Docket No:0608-A40684-TW/Finaimlan/2006-03-28 7 1306191 否改變,因此在軟體變數觀察點的情況下,除錯進行的速 度變得报慢,並且幾乎無法在實際應用中實行。當程式設 計者不熟悉上述硬體變數觀察點與軟體變數觀察點的區 別’並且相信設定程式斷點與變數觀察點的先後順序不會 造成除錯進行的差別時,問題便發生了。 舉例來說,於一僅具一組暫存器用來進行除錯的除錯 系統中,程式設計者先設定程式斷點再設定變數觀察點。 當程式斷點先被設定時,通訊協定轉換器將暫存器與程式 斷點的關係設定完畢後,回報除錯主機程式斷點已被設定 成功。當接著進行變數觀察點的設定時,通訊協定轉換器 發現暫存器已先被程式斷點佔用了,不夠用來設定變數觀 察點。因此通訊協定轉換器回報除錯主機變數觀察點未設 定成功。此時大部分除錯主機只得選擇以軟體變數觀察點 的方式實現變數觀察點,因此微處理機每執行一步動體程 式程式,除錯主機便需查詢微處理器一次變數的變動情 形。問題便在於這種方式實在速度太慢,而#進行韌體程 式除錯的有效方式。 若變數觀察點先被設定,則當接著進行程式斷點的設 定時,通訊協定轉換器發現暫存器已先被變數觀察點佔用 了,不夠用來設定程式斷點。因此通訊協定轉換器回報除 錯主機程式斷點未設定成功。此時除錯主機只得向程式設 計者顯示程式斷點未設定成功的訊息,因此程式設計者可 決定是否他要繼續除錯工作的進行。此時若除錯繼續進 行,則變數觀察點將如程式設計者所預期的運作,但程式Client's Docket N〇.:CRU04-0016 TT^ Docket No:0608-A40684-TW/Finaimlan/2006-03-28 7 1306191 No change, so in the case of software variable observation point, the speed of debugging is reported It's slow and hard to implement in real-world applications. The problem occurs when the programmer is unfamiliar with the difference between the hardware variable observation point and the software variable observation point' and believes that the order of setting the program breakpoint and the variable observation point does not cause a difference in debugging. For example, in a debug system with only one set of scratchpads for debugging, the programmer first sets the program breakpoint and then sets the variable watchpoint. When the program breakpoint is first set, the protocol converter sets the relationship between the scratchpad and the program breakpoint, and returns the debug host program breakpoint has been set successfully. When the variable observation point is set, the protocol converter finds that the scratchpad has been occupied by the program breakpoint and is not enough to set the variable observation point. Therefore, the communication protocol converter returns the debug host variable observation point is not set successfully. At this point, most of the debuggers have to choose to implement the variable observation point in the way of the software variable observation point. Therefore, each time the microprocessor executes a one-step dynamic program, the debugger needs to query the microprocessor for a variable change. The problem is that this method is too slow, and # is an effective way to perform firmware-based debugging. If the variable observation point is set first, then when the program breakpoint is set, the protocol converter finds that the scratchpad has been occupied by the variable observation point first, which is not enough to set the program breakpoint. Therefore, the protocol converter returns that the debug host program breakpoint is not set successfully. At this point, the debugger only has to display to the programmer the message that the program breakpoint is not set successfully, so the programmer can decide whether he wants to continue the debug work. At this point, if the debugging continues, the variable observation point will operate as expected by the programmer, but the program

Client's Docket N〇.:CRU04-0016 TT^ Docket No:0608-A40684-TW/Finaman/2006-03,28 8 1306191 -設計者就無法於除錯過程中使用程式斷點進行除錯。 • *於在此觀肖單—組暫存n進行程式斷點與變數觀 察點的除錯系統中,程式斷點與變數觀察點的先後設定』嗔 序不同會造成不同的執行狀態,此會使程式設計者感到十 分困惑。再者,程式設計者無法區別硬體與軟體變數觀察 點,因而會對軟體變數觀察點造成的除錯執行速度變慢感 到驚訝。此外,軟體變數觀察點僅能偵查到變數值的變化, _ 而不能偵查某一變數位址是否被讀取或寫入,當相同值被 寫入一變數位址時,軟體變數觀察點亦不能發現。但若增 加暫存器數目又會造成除錯模組設計複雜度的大量提升。 因此,習知技術之除錯系統的設計方式會造成程式設計者 相當大的不便。 【發明内容】 有鑑於此,為了避免習知技術所產生的問題,本發明 提供一種應用於韌體程式除錯之微處理器。該微處理器可 馨 受一除錯主機控制以對於該韌體程式進行除錯,該微處理 器包括一用以執行該韌體程式之核心模組,一耦接至該核 心模組之匯流排介面模組(bus interface module),係用以透 過一匯流排自該韌體程式中擷取核心模組所需之複數個指 令與存取所需之複數個變數,以及該微處理器包括一與該 核心模組與該匯流排介面模組耦接之嵌入式電路内模擬器 模組(embedded in-circuit emulator),係以分開且獨立的方 式儲存至少一第一除錯參數與至少一第二除錯參數,以及 在以下狀況產生時通知該核心模組,該些狀況包括當該核 Client’s Docket N〇.:CRU04-0016 TT's Docket No:0608-A40684-TW/Final/Yuan/2006-03-28 „ 1306191 •=松組與該匯流排介面模組之間所傳輸的該等指令之相關 資訊與該等第一除錯參數中任一相符合時,或當該核心模 組與該匯流排介面模組之間所傳輸的該等變數之相關資訊 與該等第二除錯參數中任一相符合時。 本發明更提供一種應用於韌體程式除錯之方法。該韌 體程式係被一用於除錯之微處理器所執行,該微處理器透 過一匯流排擷取該韌體程式之複數個指令並存取該韌體程 _ 式之複數個變數。其中,應用於韌體程式除錯的方法包括: 在該微處理器中,以分開且獨立方式儲存至少一第一除錯 參數與至少一第二除錯參數。此時若被該微處理器擷取的 該等指令之相關資訊與該等第一除錯參數中有任一相符 時,中止該微處理器繼續執行該韌體程式並通知一除錯主 機。另外,若被該微處理器存取的該等變數之相關資訊與 該等第二除錯參數中有任一相符時,通知該除錯主機至少 有一弟一除錯參數已被更新。 _ 综合上述,本發明仍在同一組暫存器中以不增加暫存 器數1下設定各個暫存器内存值,但各個暫存器係各自對 應儲存不同的除錯參數,因此不會有暫存器先被程式斷點 或變數觀察點之除錯方法佔㈣統發生,也因此程式設 计師不需再因究竟是要先設定程式斷點或變數觀察點而倍 受困擾。 為了讓本發明之上述和其他目的、特徵、和優點能更 明顯易懂,下文特舉數較佳實施例,並配合所附圖示,作 詳細說明如下:Client's Docket N〇.:CRU04-0016 TT^ Docket No:0608-A40684-TW/Finaman/2006-03,28 8 1306191 - Designers cannot use program breakpoints for debugging during debugging. • In the debugging system of the program breakpoint and the variable observation point, the program breakpoint and the variable watchpoint are set differently, which will cause different execution states. Make the programmer feel very confused. Furthermore, the programmer cannot distinguish between the hardware and software variable observation points, and is therefore surprised by the slower execution speed of the software variable observation points. In addition, the software variable observation point can only detect the change of the variable value, _ and can not detect whether a certain variable address is read or written. When the same value is written to a variable address, the software variable observation point cannot Find. However, if the number of scratchpads is increased, the complexity of the debugging module design will be greatly improved. Therefore, the design of the debugging system of the prior art can cause considerable inconvenience to the programmer. SUMMARY OF THE INVENTION In view of the above, in order to avoid the problems caused by the prior art, the present invention provides a microprocessor for firmware debugging. The microprocessor can be controlled by a debug host to debug the firmware. The microprocessor includes a core module for executing the firmware, and a confluence coupled to the core module. The bus interface module is configured to retrieve a plurality of variables and access variables required for the core module from the firmware program through a bus, and the microprocessor includes An embedded in-circuit emulator coupled to the core module and the bus interface module stores the at least one first debugging parameter and at least one in a separate and independent manner The second debugging parameter, and notifying the core module when the following conditions are generated, the conditions include when the core Client's Docket N〇.: CRU04-0016 TT's Docket No: 0608-A40684-TW/Final/Yuan/2006- 03-28 „ 1306191 • If the information about the instructions transmitted between the loose group and the bus interface module matches any of the first debug parameters, or when the core module is The transmission between the bus interface modules The related information of the variable is consistent with any of the second debugging parameters. The invention further provides a method for debugging the firmware program, which is used by a microprocessor for debugging. Executing, the microprocessor retrieves a plurality of instructions of the firmware program through a bus and accesses a plurality of variables of the firmware, wherein the method for debugging the firmware includes: ??? storing, in a separate and independent manner, at least one first debugging parameter and at least one second debugging parameter. At this time, if the information related to the instructions captured by the microprocessor is related to the first debugging When any of the parameters matches, the microprocessor is suspended from executing the firmware and notifying the debug host. In addition, if the information related to the variables accessed by the microprocessor is related to the second debug When there is any match in the parameter, it is notified that the debug host has at least one brother and one debug parameter has been updated. _ In summary, the present invention still sets each temporary in the same group of registers without increasing the number of registers 1 Memory value, but each temporary Each of the devices stores different debugging parameters, so there is no such thing as the first time that the scratchpad is interrupted by the program or the error of the variable observation point (4), so the programmer does not need to The above and other objects, features, and advantages of the present invention will become more apparent from the aspects of the invention. The details are as follows:

Client’s Docket No. :CRU04-0016 TT’s Docket No:0608-A40684-TW/Final/Yuan/2006-03-28 1306191 【實施方式】Client’s Docket No. : CRU04-0016 TT’s Docket No: 0608-A40684-TW/Final/Yuan/2006-03-28 1306191 [Embodiment]

第1圖為根據本發明之除錯系統100的方塊圖。除錯 系統100包括除錯主機(debugging host) 102、通訊協定轉換 器(protocol converter) 104 、以及微處理」 (microprocessor)106。除錯主機102係作為進行韌體程式^ 錯(debugging)之程式設計者的使用者介面,以控制整個= 體程式除錯過程。除錯主機102可為一用以儲存除錯應^ 程式之電腦系統,而程式設計者可以透過使用該應用程式 以控制除錯進度並更改除錯過程之詳細設定。微處理号 106係位於一電路板140上,並執行一韌體程式以控制電 路板140上的其他元件,其中整個除錯過程的目的便是欲 對執行中的韌體程式進行除錯。通訊協定轉換器1〇4係作 為除錯主機102與微處理器1〇6的溝通介面,將兩者溝通 的訊號轉換為彼此能了解的格式’以使兩者的溝通能順利 進行。 除了微處理器106之外’電路板140上所包含的其他 元件,包括用來儲存資料以及被微處理器1〇6執行之韌體 程式150的系統記憶體12〇、特定用途的晶片、以及其他 的電路元件。微處理器106經由匯流排130與這些元件相 搞接’以經由匯流排130控制這些電路板上的元件並接收 這些元件的回應。匯流排130中包含至少一位址匯流排132 與至少一資料匯流排134,兩者連接介於系統記憶體12〇 與匯流排介面模組之間。當微處理器1〇6欲擷取系統記憶 體120中儲存的韌體程式之指令時,先透過位址匯流排ι321 is a block diagram of a debug system 100 in accordance with the present invention. The debug system 100 includes a debugging host 102, a protocol converter 104, and a microprocessor 106. The debug host 102 is used as a user interface for the programmer of the firmware program to control the entire body program debugging process. The debug host 102 can be a computer system for storing debug programs, and the programmer can use the application to control the debug progress and change the detailed settings of the debug process. The microprocessor 106 is located on a circuit board 140 and executes a firmware program to control other components on the circuit board 140. The entire debugging process is intended to debug the firmware in execution. The protocol converter 1〇4 serves as a communication interface between the debug host 102 and the microprocessor 1〇6, and converts the signals communicated by the two into a format that can be understood by each other to enable the communication between the two to proceed smoothly. In addition to the microprocessor 106, other components included on the circuit board 140 include system memory 12 for storing data and firmware 150 executed by the microprocessor 1, a specific use wafer, and Other circuit components. Microprocessor 106 interfaces with these components via busbars 130 to control the components on these boards via busbars 130 and receive responses from those components. The bus bar 130 includes at least one address bus bar 132 and at least one data bus bar 134 connected between the system memory 12 〇 and the bus bar interface module. When the microprocessor 1 撷 6 wants to retrieve the firmware program stored in the system memory 120, first through the address bus ι 32

Client’s Docket N〇.:CRU04-0016 TT,s Docket No:0608-A40684-TW/Final/Yuan/2006-03-28 11 1306191 向系統記憶體120指定韌體程式的指令位址;而系統記憶 體120收到被指定的指令位址後,經由資料匯流排134將 ' 韌體程式150之指令資料回傳至微處理器1〇6。另外,執 行韌體程式150後會產生許多變數160,亦儲存於系統記 憶體120中。當微處理器106欲擷取系統記憶體12〇中儲 存的變數160時,先透過位址匯流排132向系統記憶體12〇 指定變數160的變數位址;而系統記憶體120收到被指定 的變數位址後,經由資料匯流排134將變數160之變數資 I 料回傳至微處理器106。系統記憶體120亦可由儲存勃體 程式150的第一記憶體與儲存資料的第二記憶體組成,其 中第一記憶體可為唯讀記憶體(read only memory,ROM), 第二記憶體可為隨機存取記憶體(random access memory, RAM)。 微處理器106包括核心模組11〇、匯流排介面模組(bus interface module) 112、嵌入式電路内模擬器模組(embedded in-circuit emulator module) 114、以及聯合測試行動群組Client's Docket N〇.:CRU04-0016 TT,s Docket No:0608-A40684-TW/Final/Yuan/2006-03-28 11 1306191 Specify the instruction address of the firmware program to the system memory 120; and the system memory After receiving the designated instruction address, the instruction file of the firmware 150 is transmitted back to the microprocessor 1〇6 via the data bus 134. In addition, a number of variables 160 are generated after the firmware 150 is executed and are also stored in the system memory 120. When the microprocessor 106 wants to retrieve the variable 160 stored in the system memory 12, the variable address of the variable 160 is first specified to the system memory 12 by the address bus 132; and the system memory 120 is received. After the variable address, the variable 160 of the variable 160 is passed back to the microprocessor 106 via the data bus 134. The system memory 120 may also be composed of a first memory storing the body program 150 and a second memory storing data, wherein the first memory may be a read only memory (ROM), and the second memory may be It is a random access memory (RAM). The microprocessor 106 includes a core module 11A, a bus interface module 112, an embedded in-circuit emulator module 114, and a joint test action group.

(joint test action group,以下簡稱 JTAG)介面 116。JTAG 介面116為附加到微處理器1〇〇上的特殊之4或5接腳介 面,除錯主機102可透過連接到JTAG介面116的測試探 針與微處理器106相通訊。核心模組110為微處理器100 的核心,執行勒體程式的指令以控制電路板上的其他元 件。匯流排介面模組112可存取電路板14〇上的匯流排 130。因此,核心模組11〇可透過匯流排介面模組112存取 韌體程式150的指令、自系統記憶體120讀取變數、及將(joint test action group, hereinafter referred to as JTAG) interface 116. The JTAG interface 116 is a special 4 or 5 pin interface that is attached to the microprocessor 1 and the debug host 102 can communicate with the microprocessor 106 via a test probe connected to the JTAG interface 116. The core module 110 is the core of the microprocessor 100 and executes instructions of the program to control other components on the board. The bus interface module 112 can access the bus bar 130 on the circuit board 14A. Therefore, the core module 11 can access the firmware program 150 through the bus interface module 112, read variables from the system memory 120, and

Client’s Docket No·:CRU04-0016 λλ m TT's Docket No:0608-A40684-TW/Final/Yuan/2006-03-28 1306191 變數寫入至系統記憶體。 當程式設計者利用除錯主機1〇2中的除錯應用程式對Client’s Docket No·: CRU04-0016 λλ m TT's Docket No: 0608-A40684-TW/Final/Yuan/2006-03-28 1306191 Variables are written to the system memory. When the programmer uses the debug application pair in the debug host 1〇2

電ίϊ刚均夠之勃體程式150進行除錯時’通常會預 先设定一些程•點(breakpoint)以阻止微處理器繼續執行 勃體程式。此時程式設計者便可在除錯主機的螢幕上觀察 ㈣程式的部分重要魏值,並檢查依_式_前的指 令執行後這些變數錢否正確變動。另外,被程式設計者 預先設定的重錢數值漏她察點(她hpQint)。若 程式設計者認為料魏值有部分是錯㈣,程式設計者 便可修正勃體程式,以測試是否這些變數值會正確地變 動反之若變數值皆為正確的,表示於程式斷點前 體程式的賴JE確’而*需任何修正。程式設計者接著 透過除錯域決定是否讓微處理器賴執行減程式。 嵌入式電路内模擬器模組114為除錯過程的核心。复 監測指令匯流排以_程式斷點的發生,並監測 ^ 排則貞測魏觀察㈣發生。當核心模組no執行儲存;: 系統記憶射__式時,核心餘則關持續自系 統記憶體中練勃體程式的指令。每當擷取-㈣程式ί 令,核心模組必須透過匯流排介面模組112向系統記^ 指定欲擷取的指令的指令位址,然後“記憶體會將= 於該位址的指令資料回傳予核心模組iig。因^ 路内模擬器模、组114可監測於核心模組m與匯流排2 模組U2間傳輸的指令位址_令資料等之 訊,則貞測程式斷點。當_到程式斷點時,嵌入式^When the ϊ ϊ 均 150 150 150 150 150 150 150 150 150 150 150 150 150 ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ ’ At this point, the programmer can observe (4) some important values of the program on the screen of the debug host, and check whether the variables are correctly changed after the execution of the instruction before the ___. In addition, the value of the money set by the programmer is pre-set to her point (her hpQint). If the programmer thinks that the Wei value is partially wrong (4), the programmer can correct the Boomer program to test whether the variable values will change correctly. If the variable values are correct, they are expressed in the program breakpoint precursor. The program's Lai JE does 'and * needs any correction. The programmer then decides through the debug field whether to let the microprocessor perform the subtraction. The embedded in-circuit simulator module 114 is the core of the debug process. The re-monitoring instruction bus occurs with the occurrence of the _ program breakpoint and monitors the ^ 贞 贞 魏 Wei observation (4). When the core module no performs storage;: When the system memory is __, the core remainder is the instruction that continues to execute the program from the system memory. Whenever the -(4) program is used, the core module must specify the instruction address of the instruction to be retrieved from the system through the bus interface module 112, and then "the memory will return the instruction data of the address." Passed to the core module iig. Because the in-circuit simulator module and group 114 can monitor the command address_order data transmitted between the core module m and the busbar 2 module U2, the program breakpoint is detected. When _ to program breakpoint, embedded ^

Client’s Docket N〇_:CRU04-0016 TT’s Docket No:0608-A40684-TW/Final/Yuan/200匕 〇3力 1306191Client’s Docket N〇_:CRU04-0016 TT’s Docket No:0608-A40684-TW/Final/Yuan/200匕 〇3 force 1306191

内模擬器模組114將會透過了TAG介面116通知除錯主機 102 ’並中止核心模組110的動作,此時程式設計者可撿杳 此1¾ 4又的執行結果是否正確以利後續程式修改,或 繼續接續7變數觀__除錯。 W 本發明之另—實施例係嵌入式電路内模擬器模組114 亦監测貝料匯流排以偵測變數觀察點的發生。當核心模組 10執行fej體&式時’被核d、组11G計算出的變數值桃 儲存於系統記憶體中。因此當執行勤體程式時,核心模^ 110必須持續自系統記憶體中讀取變數資料, = 數資料寫人至系統記憶體中。每當存取-變數,核 110必須透過匯流排介面模組112向系統記憶體指定^ 取的㈣的變數位址’然後系統記憶體會 子 的變數資料回傳予核心模組削。因此嵌人式電;: |§权組114可監測於核心模组11〇與匯流排介面模組' 間傳輸的變數位址或變數資料等之變數相關資訊, 變數觀察點。當偏u憎數觀察點時,嵌人式電路内根輕 器模組114將會透過JTAG介φ 116通知除錯主機1〇2 並將變數觀察狀值傳駐除錯线1G2。關地,此時 程式設計者可檢查此階段的執行結果是否正確以利後續程 式修改,或是選擇繼續接續的程式斷點進行除錯。 第2圖為依據本發明之嵌入式電路内模擬器模組2⑽ 的區塊圖。嵌入式電路内模擬器模組200對應於第1圖的 嵌入式電路内模擬器模組114。嵌入式電路内模擬器模紱 200監測於核心模組11〇與匯流排介面模組1丨2間傳輪的The internal simulator module 114 will notify the debug host 102' through the TAG interface 116 and suspend the action of the core module 110. At this time, the programmer can check whether the execution result is correct for subsequent program modification. , or continue to connect 7 variables view __ debug. Another embodiment of the present invention is an embedded in-circuit simulator module 114 that also monitors the billet bus to detect the occurrence of variable observation points. When the core module 10 executes the fej body & formula, the variable value peach calculated by the core d and the group 11G is stored in the system memory. Therefore, when executing the body program, the core module 110 must continue to read the variable data from the system memory, and the number of data is written to the system memory. Whenever the access-variable, the core 110 must specify the (four) variable address of the system memory through the bus interface module 112, and then the variable data of the system memory is transmitted back to the core module. Therefore, the embedded power;: | § right group 114 can monitor the variable information related to the variable address or variable data transmitted between the core module 11 〇 and the bus interface module ′, the variable observation point. When the point is observed, the embedded circuit internal light module 114 will notify the debug host 1〇2 through the JTAG interface φ 116 and transmit the variable observation value to the debug line 1G2. In this case, the programmer can check whether the execution result of this stage is correct for subsequent modification, or choose to continue the program breakpoint to debug. Figure 2 is a block diagram of the in-circuit emulator module 2 (10) in accordance with the present invention. The embedded in-circuit emulator module 200 corresponds to the in-circuit emulator module 114 of Fig. 1. The embedded in-circuit simulator module 200 is monitored between the core module 11〇 and the busbar interface module 1丨2.

Client's Docket N〇.:CRU04-0016 TT's Docket No:0608-A40684-TW/FinalAruan/2006-03-28 1306191 指令與變數相關資訊,並在指令相關資訊與程式斷點相符 ' 合或變數相關資訊與變數觀察點相符合時,透過JTAG介 • 面116通知除錯主機102。 每當核心模組110自儲存被執行之韌體程式的系統記 憶體中讀取一指令時,核心模組110必須透過匯流排介面 模組112輸出該指令之位址,然後該位址的指令資料才會 由系統記憶體回傳至核心模組110。同樣的,每當核心模 組110自儲存韌體程式之變數資料的系統記憶體中讀取一 > 變數時,或是當核心模組110將一變數值寫入系統記憶體 中時,核心模組110必須透過匯流排介面模組112輸出該 變數之位址,然後該位址的變數資料才會由系統記憶體回 傳至核心模組110,或寫入變數位址指定的系統記憶體中。 嵌入式電路内模擬器模組200包括一用以儲存程式斷 點之指令位址的指令位址暫存器202,一用以儲存程式斷 點之指令資料的指令資料暫存器204,一用以儲存變數觀 _ 察點之變數位址的變數位址暫存器206,以及一用以儲存 變數觀察點之變數資料的變數資料暫存器208。該4個暫 存器的儲存空間雖與習知暫存器組相同,但卻是專門用來 分別且獨立地儲存程式斷點與變數觀察點的位址與資料等 之相關資訊。由於嵌入式電路内模擬器模組200的資料暫 存器與位址暫存器並非由程式斷點與變數觀察點所共用, 因此不會發生習知因變數觀察點與程式斷點設定先後順序 的不同而造成除錯過程不同的影響的問題,而困擾程式設 計者。Client's Docket N〇.:CRU04-0016 TT's Docket No:0608-A40684-TW/FinalAruan/2006-03-28 1306191 Command and variable related information, and the instruction related information and program breakpoints match 'combination or variable related information and When the variable observation points coincide, the debug host 102 is notified through the JTAG interface 116. Whenever the core module 110 reads an instruction from the system memory storing the executed firmware program, the core module 110 must output the address of the instruction through the bus interface module 112, and then the instruction of the address. The data is then passed back to the core module 110 by the system memory. Similarly, whenever the core module 110 reads a variable from the system memory in which the firmware variable data is stored, or when the core module 110 writes a variable value into the system memory, the core The module 110 must output the address of the variable through the bus interface module 112, and then the variable data of the address is transmitted back to the core module 110 by the system memory, or the system memory specified by the variable address is written. in. The embedded in-circuit emulator module 200 includes an instruction address register 202 for storing the program address of the program breakpoint, and an instruction data register 204 for storing the instruction data of the program break point. The variable address register 206 for storing the variable address of the variable view point, and a variable data register 208 for storing the variable data of the variable observation point. Although the storage space of the four registers is the same as that of the conventional register group, it is specifically used to separately and independently store the information about the address and data of the program breakpoint and the variable observation point. Since the data register and the address register of the simulator module 200 in the embedded circuit are not shared by the program breakpoint and the variable observation point, the prior order of the variable observation point and the program break point does not occur. The problem that causes the different effects of the debugging process is bothering the programmer.

Client’s Docket N〇.:CRU04-0016 TT's Docket No:0608-A40684-TW/Final/Yuan/2006-03-28 15 1306191 每當核心模組110透過匯流排介面模組112向系統記 憶體指定一指令位址’比較器212便將該指令位址與儲存 於指令位址暫存器202中程式斷點的指令位址相比較,以 產生第一比較結果信號。若該指令位址與程式斷點的任一 指令位址相符合’則比較器212產生的第一比較結果信號 係呈現致能狀態。每當系統記憶體透過匯流排介面模組 112向核心模組11〇傳回一指令資料,比較器214便將該 指令貢料與儲存於指令資料暫存器2〇4中程式斷點的指令 資料相比較,以產生第二比較結果信號。若該指令資料與 程式斷點的任一指令資料相符合,則比較器214產生的第 二比較結果信號係呈現致能狀態。 每當核心模組110透過匯流排介面模組112向系統記 憶體指定一變數位址,比較器216便將該變數位址與儲存 於變數位址暫存器206中變數觀察點的變數位址相比較, 以產生第二比較結果信號。若該變數位址與變數觀察點的 任一變數位址相符合,則比較器216產生的第三比較結果 信號係呈現致能狀態。每當系統記憶體透過匯流排介面模 組112向核心模組110傳回—變數資料,比較器218便將 該變數資料與儲存於變數資料暫存器2〇8中變數觀察點的 變數資料相比較,以產生第四比較結果信號。若該變數資 料與變數觀察點的任一變數資料相符合,則比較器218產 生的第四比較結果信號係呈現致能狀態。 上述自比較器212至218輸出的4個比較結果信號由 OR閘220執行一 0R函數於其上以產生一輸出值。若該輸Client's Docket N〇.:CRU04-0016 TT's Docket No:0608-A40684-TW/Final/Yuan/2006-03-28 15 1306191 Whenever the core module 110 assigns an instruction to the system memory through the bus interface module 112 The address 'comparator 212 compares the instruction address with the instruction address stored in the program bit address in the instruction address register 202 to generate a first comparison result signal. If the instruction address matches any of the instruction addresses of the program breakpoint, then the first comparison result signal generated by the comparator 212 is in an enabled state. Whenever the system memory transmits back a command data to the core module 11 through the bus interface module 112, the comparator 214 outputs the command and the instruction stored in the instruction data register 2〇4. The data is compared to produce a second comparison result signal. If the command data matches any of the command data of the program breakpoint, the second comparison result signal generated by the comparator 214 is in an enabled state. Whenever the core module 110 assigns a variable address to the system memory through the bus interface module 112, the comparator 216 compares the variable address with the variable address of the variable observation point stored in the variable address register 206. In comparison, a second comparison result signal is generated. If the variable address matches any of the variable addresses of the variable observation point, the third comparison result signal generated by the comparator 216 is in an enabled state. Whenever the system memory returns the variable data to the core module 110 through the bus interface module 112, the comparator 218 compares the variable data with the variable data stored in the variable observation point of the variable data register 2〇8. Compare to generate a fourth comparison result signal. If the variable data matches any of the variable data of the variable observation point, the fourth comparison result signal generated by the comparator 218 is in an enabled state. The four comparison result signals output from the comparators 212 to 218 described above are executed by the OR gate 220 to perform an 0R function to generate an output value. If the loss

Client’s Docket No.:CRU04-0016 TT^ Docket No:0608-A40684-TW/Final/Yuan/2006-03-28 16 1306191 出值係呈現致能狀態,可能表示核心模組 體程式被程式設計者設定的程式斷點部分 =^丁勒 -錯主機將收到嵌入式電路内模擬器模組2〇〇的提除 並且核心模組110亦被嵌入式電路内模擬器模电=二 執餘體程式的動作。該輪出值呈現為致能狀離 ^ =::U°正在更改被程式設計者設定的;數觀:: ==通將收到嵌入式電路内‘ =、、且200的“通知’並且變數觀察點的新變 送至除錯主機,W切式設計者料除被傳 弟3圖為依據本發明之對㈣程式進行除 3〇〇之流程圖。首先,於微處 /日、法 儲存至少一第一除錯參數與至。第^分開並獨立地 302)。該第-除錯參數可為 錯參數(步驟 程式斷點,而該第二除錯參數為 數變數的變數觀察點。其中第一除鈣^ 程式之複 丨址,可藉由複數指令位址暫存器2〇2日而館對應的指令位 參數對應的指令資料,可#由複,而第一除錯 _,如和临, 可藉由複數變數位址暫存H 2。6來儲''之變數位址, 對應的變數資料,可藉由複數變數資暫:第二除錯參數 存,如同第2圖所示。 貝抖暫存器208來儲 接著,比對該微處理器擷取的該等 微處理器存取的該等複數變數。若該等 ^令’以及该 該第一除錯參數對應的指令位置相符人指令之位址與 13時,產生第一比較Client's Docket No.:CRU04-0016 TT^ Docket No:0608-A40684-TW/Final/Yuan/2006-03-28 16 1306191 The value system is enabled, which may indicate that the core module is set by the programmer. The program breakpoint part = ^ Dingle - wrong host will receive the embedded circuit simulator module 2 提 and the core module 110 is also embedded in the circuit simulator modulo = two suffix Actions. The round-out value appears as an enablement from ^ =::U° is being changed by the programmer; number view:: == will receive 'notification' in the embedded circuit '=, and 200 The new change of the variable observation point is sent to the debug host, and the W-cut designer is divided into the flowchart of the (4) program according to the present invention, except for the micro-location/day, the method. Storing at least one first debugging parameter and reaching. The second dividing and independently 302). The first debugging error parameter may be a wrong parameter (step program breakpoint, and the second debugging parameter is a variable variable observation point of the number variable). The first de-calcification program of the calcium-removing program can be repeated by the complex instruction address register 2〇2, and the instruction data corresponding to the instruction bit parameter corresponding to the library can be #复复, and the first debugging _, For example, the variable variable address can be stored by the complex variable address, and the corresponding variable data can be stored by the complex variable: the second debugging parameter is stored as shown in Fig. 2 The Bayer register 208 is stored to store the complex variables that are accessed by the microprocessors retrieved by the microprocessor. Address match ^ order 'command position and the corresponding parameter of the first debug instruction of the person 13, generates a first comparison

Client’s Docket N〇.:CRU04-0016 TT's Docket No:0608-A40684-TW/Fmal/Yuan/2006-03-28 1306191 結果信號(㈣304)。賴等魏 參數對應的指令資料相符合時,產生該f:除錯 (步驟聊若該等複數變數之位址與該第二二= 的變數位置相符合時,產生一 > 數對應 释若該等複數變數之資料&^比==號(步驟 變數資料相符合時,產生_第四、的該 結果信號而產生-輪出值。(步驟312) ^ 此時若步驟312中之該輪出值為正(步驟 前有程式斷點或變數觀察點所對應的事件發生。若此= 二或第mb較結果信料正(㈣ 、苐 所對應的事件發生,被微處理)表4㈣觀察點 參數相符,因此通知該除錯主機該^的變數與第二除錯 被更新(步驟318)。否則,此時為第二除錯參數已 為正’表示為程式斷點所對應的事件^二比較結果信號 理器繼續執行該勃體程式並通知除錯該微處 组僅3 = 3址^技術中的嵌人式^路内模擬器模 ==::r,分別與自微處理器 之位==習知技術中的嵌入式電路内模擬器模組 暫存器的數目是有限的,若程式設計 ,,夕程式斷點,便沒有設定變數觀察點的空間。如 此-來,除錯域僅能在處㈣錢行—式Client’s Docket N〇.: CRU04-0016 TT's Docket No: 0608-A40684-TW/Fmal/Yuan/2006-03-28 1306191 Result signal ((iv) 304). When the command data corresponding to the Wei parameter matches, the f: debug is generated (step chat if the address of the complex variable matches the variable position of the second two =, a corresponding number is generated) The data of the complex variables &^ ratio == (when the step variable data is matched, the result signal of the fourth is generated to generate a round-off value. (Step 312) ^ At this point, if the step 312 The round-out value is positive (the event corresponding to the program breakpoint or the variable observation point before the step occurs. If this = 2 or the mb is the result of the positive ((4), the corresponding event occurs, it is micro-processed) Table 4 (4) The observation point parameters match, so the variable of the debug host is notified that the variable of the ^ is updated with the second debug (step 318). Otherwise, the second debug attribute has been positively represented as the event corresponding to the program breakpoint. ^Two comparison results the signal processor continues to execute the Bosch program and informs the debugging that the micro-group is only 3 = 3 addresses ^ embedded in-circuit simulator mode ==::r, respectively, and self-micro processing Bit == The number of embedded circuit in-circuit emulator modules in the prior art is limited. If the program design, the program breakpoint, there is no space to set the variable observation point. So - the debug field can only be in the (four) money line -

Client’s Docket N〇.:CRU04-0016 TT5sDocketNo:0608-A40684-TW/FmayYuan/2006-03-28 18 1306191 後便檢查一次變數觀察點之值,此稱之為軟體變數觀察 點,並會大大地降低韌體程式的執行速度。同樣地,若程 式設計者設定太多變數觀察點,便沒有設定程式斷點的空 間,由於程式設計者不一定了解嵌入式電路内模擬器模組 之内部設計細節,程式設計者可能會對因變數觀察點與程 式斷點設定先後順序的不同而造成除錯過程不同的影響感 到疑惑。 因此,本發明提供一種除錯系統,針對其中程式斷點 與變數觀察點有各自專屬的資料暫存器與位址暫存器。此 種設計大大簡化了設定程式斷點與變數觀察點的過程,並 且避免兩者共用資料暫存器與位址暫存器所導致的問題。 此種設計亦讓程式設計者於除錯時無論先設定程式斷點或 變數觀察點均會得到一致的結果,而避免程式設計者的困 惑。另外,由於變數觀察點有專屬的硬體支持,因此程式 設計者亦不會被突然由硬體變數觀察點轉變為軟體變數觀 察點而感到驚訝。 雖然本發明已以較佳實施例揭露如上,然其並非用以 限定本發明,任何熟習此項技術者,在不脫離本發明之精 神和範圍内,當可作些許之更動與潤飾,因此本發明之保 護範圍當視後附之申請專利範圍所界定者為準。 【圖式簡單說明】 第1圖為根據本發明之除錯系統的方塊圖; 第2圖為依據本發明之嵌入式電路内模擬器模組的區Client's Docket N〇.:CRU04-0016 TT5sDocketNo:0608-A40684-TW/FmayYuan/2006-03-28 18 1306191 After checking the value of the variable observation point, this is called the software variable observation point and will be greatly reduced. The execution speed of the firmware program. Similarly, if the programmer sets too many variable observation points, there is no space for setting the program breakpoint. Since the programmer does not necessarily understand the internal design details of the emulator module in the embedded circuit, the programmer may have a reason. The difference between the variable observation point and the program breakpoint setting sequence is different because of the different effects of the debugging process. Therefore, the present invention provides a debug system for each of the program breakpoints and variable watchpoints having their own dedicated data register and address register. This design greatly simplifies the process of setting program breakpoints and variable watchpoints, and avoids the problems caused by the shared data register and address register. This design also allows the programmer to achieve consistent results regardless of the program breakpoint or variable viewpoint when debugging, and avoids the programmer's confusion. In addition, because the variable observation points have exclusive hardware support, the programmer is not surprised by the sudden change from the hardware variable observation point to the software variable observation point. Although the present invention has been disclosed in the above preferred embodiments, it is not intended to limit the invention, and it is intended that the invention may be modified and modified without departing from the spirit and scope of the invention. The scope of the invention is defined by the scope of the appended claims. BRIEF DESCRIPTION OF THE DRAWINGS FIG. 1 is a block diagram of a debug system according to the present invention; FIG. 2 is a block diagram of an emulator module in an embedded circuit according to the present invention.

Client’s Docket No· :CRU04-0016 TT's Docket No:0608-A40684-TW/Final/Yuan/2006-03-28 19 1306191 塊圖;以及 ' 第3圖為依據本發明之對韌體程式進行除錯的方法之 " 流程圖。 【主要元件符號說明】 102〜除錯主機; 104〜通訊協定轉換器; 106〜微處理器; φ 110〜核心模組; 112〜匯流排介面模組; 132〜位址匯流排;134〜資料匯流排; 130〜匯流排;140〜電路板; 120〜系統記憶體; 150〜韌體程式;160〜變數; 114、200〜嵌入式電路内模擬器模組; 116〜JTAG介面; • 202〜指令位址暫存器; 204〜指令資料暫存器; 206〜變數位址暫存器; 208〜變數資料暫存器; 220〜OR閘; 212-218〜比較器。Client's Docket No· :CRU04-0016 TT's Docket No:0608-A40684-TW/Final/Yuan/2006-03-28 19 1306191 Block Diagram; and 'Figure 3 is the debugging of the firmware program according to the present invention. Method " Flowchart. [Main component symbol description] 102~Debug host; 104~communication protocol converter; 106~microprocessor; φ110~core module; 112~bus interface module; 132~address bus; 134~ Busbar; 130~ busbar; 140~ circuit board; 120~ system memory; 150~ firmware program; 160~ variable; 114, 200~ embedded circuit simulator module; 116~JTAG interface; Instruction address register; 204~ instruction data register; 206~variable address register; 208~variable data register; 220~OR gate; 212-218~ comparator.

Client's Docket N〇.:CRU04-0016 TT's Docket No:0608-A40684-TW/Final/Yuan/2006-03-28 20Client's Docket N〇.:CRU04-0016 TT's Docket No:0608-A40684-TW/Final/Yuan/2006-03-28 20

Claims (1)

1306191 十、申請專利範圍: - 1. 一種用於韌體程式除錯之微處理器,可受一除錯主 - 機控制以對於一韌體程式進行除錯,包括·· 一核心模組,用以執行該韋刃體程式; 一匯流排介面模組(bus interface module),耦接至該核 心模組,用以透過一匯流排為該核心模組擷取該韌體程式 之複數指令與存取該韌體程式之複數變數;以及 一飯入式電路内模擬器模組(embedded in-circuit I emulator),輕接至該核心模組與該匯流排介面模組,用以 分開並獨立地儲存至少一第一除錯參數與至少一第二除錯 參數,以及當於該核心模組與該匯流排介面模組所傳輸的 該等複數指令與該至少一第一除錯參數的任一相符合時, 或當於該核心模組與該匯流排介面模組所傳輸的該等複數 變數與該至少一第二除錯參數的任一相符合時,通知該核 心模組。 2. 如申請專利範圍第1項所述之用於韌體程式除錯之 > 微處理器,其中該至少一第一除錯參數與至少一第二除錯 參數可經由該除錯主機進行設定與修改。 3. 如申請專利範圍第1項所述之用於韌體程式除錯之 微處理器,其中該至少一第一除錯參數為用以中斷該韌體 程式之執行的至少一程式斷點(breakpoint)。 4. 如申請專利範圍第1項所述之用於韌體程式除錯之 微處理器,其中該至少一第二除錯參數為用以監測該韌體 程式之該等複數變數的至少一變數觀察點(watchpoint)。 Client’s Docket No.:CRU04-0016 TT5s Docket No:0608-A40684-TW/Final/Yuan/2006-03-28 21 1306191 5. 如申請專利範圍第1項所述之用於韌體程式除錯之 微處理器,其中該韌體程式之該等複數指令儲存於一第一 記憶體,該韌體程式之該等複數變數儲存於一第二記憶 體,而該第一與第二記憶體皆經由該匯流排耦接至該微處 理器。 6. 如申請專利範圍第1項所述之用於韌體程式除錯之 微處理器,其中該嵌入式電路内模擬器模組包括: 複數指令位址暫存器,用以儲存由該除錯主機設定之 該至少一第一除錯參數的至少一指令位址; 複數指令資料暫存器,用以儲存由該除錯主機設定之 該至少一第一除錯參數的至少一指令資料; 複數變數位址暫存器,用以儲存由該除錯主機設定之 該至少一第二除錯參數的至少一變數位址;以及 複數變數資料暫存器,用以儲存由該除錯主機設定之 該至少一第二除錯參數的至少一變數資料。 7. 如申請專利範圍第6項所述之用於韌體程式除錯之 微處理器,其中該嵌入式電路内模擬器模組更包括: 一第一比較器,耦接至該核心模組與該等複數指令位 址暫存器,用以於該等複數指令之位址與該至少一第一除 錯參數的該至少一指令位置中的任一相符合時,產生一第 一比較結果信號,其中該核心模組輸出該等複數指令之位 址以便讓該匯流排介面模組擷取該等複數指令; 一第二比較器,耦接至該匯流排介面模組與該等複數 指令資料暫存器,用以於該等複數指令之資料與該至少一 Clienfs Docket No. :CRU04-0016 TT^ Docket No:0608-A40684-TW/Final/Yuan/2006-03-28 Ϊ306191 第一除錯參數的該至少一指令資料中的任一相符合時,產 ' 生一第二比較結果信號,其中該匯流排介面模組擷取該等 複數指令之資料並將該等複數指令之資料回傳至該核心模 組; 一第三比較器,耦接至該核心模組與該等複數變數位 址暫存器,用以於該等複數變數之位址與該至少一第二除 錯參數的該至少一變數位置中的任一相符合時,產生一第 三比較結果信號,其中該核心模組指定該等複數變數之位 • 址以便讓該匯流排介面模組擷取該等複數變數; 一第四比較器,耦接至該匯流排介面模組與該等複數 變數資料暫存器,用以於該等複數變數之資料與該至少一 第二除錯參數的該至少一變數資料中的任一相符合時,產 生一第四比較結果信號,其中該匯流排介面模組擷取該等 複數變數之資料並將該等複數變數之資料回傳至該核心模 組;以及 一 OR閘,耦接至該第一、第二、第三與第四比較器, ® 用以執行一 OR函數於該第一、第二、第三與第四比較結 果信號而產生一輸出值; 其中若該輸出值係呈現致能狀態,該嵌入式電路内模 擬器模組便通知該除錯主機。 8. —種對韌體程式進行除錯的方法,該韌體程式被一 用於除錯之微處理器所執行,該微處理器擷取該韌體程式 之複數指令與存取該韌體程式之複數變數,該對韌體程式 進行除錯的方法包括下列步驟: Client’s Docket N〇.:CRU04-0016 TT’s Docket No:0608-A40684-TW/Final/Yuan/2006-03-28 23 Ϊ306191 於該微處理器中,分開並獨立地儲存至少一第一除錯 參數與至少一第二除錯參數; 若被該微處理器擷取的該等複數指令與該至少一第一 除錯參數的任一相符時,中止該微處理器繼續執行該韌體 程式並通知一除錯主機;以及 若被該微處理器存取的該等複數變數與該至少一第二 除錯參數的任一相符時,通知該除錯主機該至少一第二除 錯參數已被更新。 9. 如申請專利範圍第8項所述之對韌體程式進行除錯 的方法,其中該至少一第一除錯參數為用以中斷該韌體程 式之執行的至少一程式斷點。 10. 如申請專利範圍第8項所述之對韌體程式進行除 錯的方法,其中該至少一第二除錯參數為用以監測該韌體 程式之該等複數變數的至少一變數觀察點。 11. 如申請專利範圍第8項所述之對韌體程式進行除 錯的方法,其中該儲存步驟包括下列步驟: 分開且獨立地儲存由該除錯主機設定之該至少一第一 除錯參數的至少一指令位址與至少一指令資料;以及 分開且獨立地儲存由該除錯主機設定之該至少一第二 除錯參數的至少一變數位址與至少一變數資料。 12. 如申請專利範圍第11項所述之對韌體程式進行除 錯的方法,更包括下列步驟: 若該等複數指令之位址與該至少一第一除錯參數的該 至少一指令位置中的任一相符合時,產生一第一比較結果 Client's Docket No. :CRU04-0016 TT’s Docket No:0608-A40684_TW/Final/Yuan/2006-03-28 24 1306191 m 信號,其中該微處理器指定該等複數指令之位址以便擷取 - 該等複數指令; * 若該等複數指令之資料與該至少一第一除錯參數的該 至少一指令資料中的任一相符合時,產生一第二比較結果 信號,其中該等複數指令之資料會被擷取並被回傳至該微 處理器; 若該等複數變數之位址與該至少一第二除錯參數的該 至少一變數位置中的任一相符合時,產生一第三比較結果 k 信號,其中該微處理器指定該等複數變數之位址以便擷取 該等複數變數; 若該等複數變數之資料與該至少一第二除錯參數的該 至少一變數資料中的任一相符合時,產生一第四比較結果 信號,其中該等複數變數之資料被擷取並被回傳至該微處 理器; 執行一 OR函數於該第一、第二、第三與第四比較結 果信號而產生一輸出值;以及 > 若該輸出值呈現致能狀態時,通知該除錯主機。 13.如申請專利範圍第8項所述之對韌體程式進行除 錯的方法,其中當該微處理器於該中止步驟中被中止執行 該韌體程式後,該除錯主機可命令該微處理器繼續執行該 韌體程式。 Client’s Docket No. :CRU04-0016 TT’s Docket No:0608-A40684-TW/Final/Yuan/2006-03-28 251306191 X. Patent application scope: - 1. A microprocessor for firmware debugging, which can be debugged by a master-machine to debug a firmware program, including a core module. The bus interface module is coupled to the core module for capturing a plurality of instructions of the firmware program for the core module through a bus bar. Accessing the complex variable of the firmware program; and an embedded in-circuit I emulator, which is connected to the core module and the bus interface module for separation and independence Storing at least one first debugging parameter and at least one second debugging parameter, and the plurality of instructions and the at least one first debugging parameter transmitted by the core module and the bus interface module The core module is notified when one of the coincidences, or when the complex variable transmitted by the core module and the bus interface module matches any of the at least one second debugging parameter. 2. The microprocessor for firmware debugging according to claim 1, wherein the at least one first debugging parameter and the at least one second debugging parameter are performed via the debug host. Settings and modifications. 3. The microprocessor for firmware debugging according to claim 1, wherein the at least one first debugging parameter is at least one program breakpoint for interrupting execution of the firmware program ( Breakpoint). 4. The microprocessor for firmware decoding according to claim 1, wherein the at least one second debugging parameter is at least one variable for monitoring the complex variables of the firmware program. Watchpoint. Client's Docket No.: CRU04-0016 TT5s Docket No: 0608-A40684-TW/Final/Yuan/2006-03-28 21 1306191 5. For the firmware of the firmware as described in item 1 of the patent application scope The processor, wherein the plurality of instructions of the firmware program are stored in a first memory, wherein the plurality of variables are stored in a second memory, and the first and second memories are The bus bar is coupled to the microprocessor. 6. The microprocessor for firmware firmware debugging according to claim 1, wherein the embedded circuit simulator module comprises: a plurality of instruction address registers for storing the division At least one instruction address of the at least one first debugging parameter set by the wrong host; a plurality of instruction data registers for storing at least one instruction data of the at least one first debugging parameter set by the debugging host; a plurality of variable address registers for storing at least one variable address of the at least one second debugging parameter set by the debug host; and a complex variable data register for storing settings by the debug host At least one variable data of the at least one second debugging parameter. 7. The microprocessor for firmware debugging according to claim 6, wherein the embedded in-circuit emulator module further comprises: a first comparator coupled to the core module And the plurality of instruction address registeres for generating a first comparison result when the addresses of the plurality of instructions coincide with any of the at least one instruction position of the at least one first debugging parameter a signal, wherein the core module outputs the addresses of the plurality of instructions to cause the bus interface module to capture the plurality of instructions; a second comparator coupled to the bus interface module and the plurality of instructions a data register for the data of the plurality of instructions and the at least one Clienfs Docket No.: CRU04-0016 TT^ Docket No: 0608-A40684-TW/Final/Yuan/2006-03-28 Ϊ306191 first division When any one of the at least one command data of the wrong parameter is met, a second comparison result signal is generated, wherein the bus interface module retrieves the data of the plurality of instructions and returns the data of the plurality of instructions Passed to the core module; a third comparator And coupled to the core module and the plurality of variable address registers for matching the address of the complex variable with any of the at least one variable position of the at least one second debugging parameter a third comparison result signal is generated, wherein the core module specifies a bit address of the complex variable to allow the bus interface interface module to capture the complex variable; and a fourth comparator coupled to the confluence The interface module and the plurality of variable data registers are configured to generate a fourth when the data of the complex variables matches any of the at least one variable data of the at least one second debugging parameter Comparing the result signals, wherein the bus interface module retrieves the data of the complex variables and transmits the data of the complex variables back to the core module; and an OR gate coupled to the first and second The third and fourth comparators, ???arem for performing an OR function on the first, second, third, and fourth comparison result signals to generate an output value; wherein the output value is an enable state, the embedding In-circuit simulator module The debug host is notified. 8. A method for debugging a firmware program, the firmware program being executed by a microprocessor for debugging, the microprocessor capturing a plurality of instructions of the firmware program and accessing the firmware The complex variable of the program, the method for debugging the firmware program includes the following steps: Client's Docket N〇.: CRU04-0016 TT's Docket No: 0608-A40684-TW/Final/Yuan/2006-03-28 23 Ϊ306191 The microprocessor separately and independently stores at least one first debugging parameter and at least one second debugging parameter; if the plurality of instructions captured by the microprocessor and the at least one first debugging parameter In either case, the microprocessor is suspended from executing the firmware and notifying a debug host; and if the complex variable accessed by the microprocessor matches any of the at least one second debug parameter When the debug host is notified, the at least one second debug parameter has been updated. 9. The method of debugging a firmware program as described in claim 8 wherein the at least one first debug parameter is at least one program breakpoint for interrupting execution of the firmware. 10. The method for debugging a firmware program according to claim 8, wherein the at least one second debugging parameter is at least one variable observation point for monitoring the complex variables of the firmware program. . 11. The method for debugging a firmware program according to claim 8, wherein the storing step comprises the steps of: separately and independently storing the at least one first debugging parameter set by the debug host. At least one instruction address and at least one instruction data; and separately and independently storing at least one variable address and at least one variable data of the at least one second debugging parameter set by the debug host. 12. The method for debugging a firmware program according to claim 11 of the patent application, further comprising the steps of: if the address of the plurality of instructions and the at least one instruction position of the at least one first debugging parameter When any of the matches is met, a first comparison result Client's Docket No. is generated: CRU04-0016 TT's Docket No: 0608-A40684_TW/Final/Yuan/2006-03-28 24 1306191 m signal, wherein the microprocessor specifies The addresses of the plurality of instructions for capturing - the plurality of instructions; * generating a first if the data of the plurality of instructions matches any of the at least one of the at least one first debugging parameter Comparing the result signals, wherein the data of the plurality of instructions is retrieved and transmitted back to the microprocessor; if the address of the complex variable is in the at least one variable position of the at least one second debugging parameter When any of the phases meets, a third comparison result k signal is generated, wherein the microprocessor specifies the addresses of the complex variables to retrieve the complex variables; if the data of the complex variables and the at least one second except When any one of the at least one variable data of the wrong parameter matches, a fourth comparison result signal is generated, wherein the data of the complex variables is captured and transmitted back to the microprocessor; performing an OR function on the The first, second, third, and fourth comparison result signals generate an output value; and > if the output value is in an enabled state, the debug host is notified. 13. The method of debugging a firmware program as described in claim 8 wherein the debugger can command the micro-processor after the microprocessor is suspended in the abort step. The processor continues to execute the firmware. Client’s Docket No. :CRU04-0016 TT’s Docket No:0608-A40684-TW/Final/Yuan/2006-03-28 25
TW95111940A 2005-04-13 2006-04-04 A method for debugging a firmware program and a debugging microprocessor TWI306191B (en)

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
US67066505P 2005-04-13 2005-04-13

Publications (2)

Publication Number Publication Date
TW200636446A TW200636446A (en) 2006-10-16
TWI306191B true TWI306191B (en) 2009-02-11

Family

ID=36994097

Family Applications (1)

Application Number Title Priority Date Filing Date
TW95111940A TWI306191B (en) 2005-04-13 2006-04-04 A method for debugging a firmware program and a debugging microprocessor

Country Status (2)

Country Link
CN (1) CN100403275C (en)
TW (1) TWI306191B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8543870B2 (en) * 2011-02-14 2013-09-24 Nanya Technology Corporation Circuit for detecting and recording chip fails and the method thereof
CN112820341B (en) * 2021-03-03 2024-05-07 群联电子股份有限公司 Memory inspection method, memory inspection device and memory inspection system
CN117413253A (en) * 2021-09-29 2024-01-16 英特尔公司 Apparatus, device, method and computer program for performing unit testing on firmware code
TWI819826B (en) * 2022-09-30 2023-10-21 瑞昱半導體股份有限公司 Electronic system and firmware update method having firmware update troubleshooting mechanism

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6219828B1 (en) * 1998-09-30 2001-04-17 International Business Machines Corporation Method for using two copies of open firmware for self debug capability
CN1162780C (en) * 2001-01-05 2004-08-18 英业达股份有限公司 BIOS tracing and debugging method
US7171653B2 (en) * 2003-06-03 2007-01-30 Hewlett-Packard Development Company, L.P. Systems and methods for providing communication between a debugger and a hardware simulator
JP2005018485A (en) * 2003-06-26 2005-01-20 Nec Corp Method for debugging firmware

Also Published As

Publication number Publication date
TW200636446A (en) 2006-10-16
CN100403275C (en) 2008-07-16
CN1831785A (en) 2006-09-13

Similar Documents

Publication Publication Date Title
JP4987182B2 (en) Computer system
US7010722B2 (en) Embedded symmetric multiprocessor system debug
JP2651916B2 (en) In-circuit emulator
US6877114B2 (en) On-chip instrumentation
JP4335999B2 (en) Semiconductor integrated circuit device with built-in processor
JP4847734B2 (en) Semiconductor integrated circuit device, debugging system and debugging method thereof
US6668339B1 (en) Microprocessor having a debug interruption function
US20030037225A1 (en) Apparatus and method for microcontroller debugging
TWI544410B (en) Diagnosing code using single step execution
US20090313507A1 (en) Generation of trace data in a multi-processor system
CN104320308B (en) A kind of method and device of server exception detection
US20060253842A1 (en) Modelling of programmable devices
JP4865943B2 (en) Computer system
TWI270769B (en) Trace, debug method and system for a processor
TWI306191B (en) A method for debugging a firmware program and a debugging microprocessor
JP2001154876A (en) Microcomputer debug architecture and method
JP2008507025A (en) Emulation and debug interface for integrated circuit testing
US7313729B2 (en) Low-cost debugging system with a ROM or RAM emulator
TWI314263B (en)
JP6981920B2 (en) Semiconductor devices and debugging methods
TW200415461A (en) Program debugging method
JP2003263339A (en) Debug function-incorporated microcomputer
US7231568B2 (en) System debugging device and system debugging method
JP2011028308A (en) Semiconductor device and software development support device
JP2004094451A (en) On-chip jtag interface circuit and system lsi