CN101178685A - An Enhanced Microprocessor On-Chip Dynamic Tracing Method with Special Function Register Breakpoints - Google Patents
An Enhanced Microprocessor On-Chip Dynamic Tracing Method with Special Function Register Breakpoints Download PDFInfo
- Publication number
- CN101178685A CN101178685A CNA2007100465348A CN200710046534A CN101178685A CN 101178685 A CN101178685 A CN 101178685A CN A2007100465348 A CNA2007100465348 A CN A2007100465348A CN 200710046534 A CN200710046534 A CN 200710046534A CN 101178685 A CN101178685 A CN 101178685A
- Authority
- CN
- China
- Prior art keywords
- breakpoint
- sfr
- register
- mode
- debugging
- 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.)
- Granted
Links
Landscapes
- Debugging And Monitoring (AREA)
Abstract
本发明涉及一种带特殊功能寄存器断点的增强型片上动态跟踪方法。本方法通过一个集成在微处理器内部的独立的带有SFR断点功能的增强型片上调试模块,可以将程序执行过程中的某些位置或特殊功能寄存器设置为断点,然后对这些断点处的内部寄存器的信息进行跟踪,记录和实时输出。并通过添加调试使能信号来实现调试模式和正常运行模式的切换。本发明的方法可应用于8051系列微处理器领域,亦可应用于其他微处理器领域。
The invention relates to an enhanced on-chip dynamic tracing method with special function register breakpoints. This method can set some positions or special function registers in the program execution process as breakpoints through an independent enhanced on-chip debugging module with SFR breakpoint function integrated in the microprocessor, and then set these breakpoints The information of the internal registers at the location is tracked, recorded and output in real time. And by adding a debug enable signal to realize the switching between the debug mode and the normal operation mode. The method of the invention can be applied to the field of 8051 series microprocessors, and can also be applied to the fields of other microprocessors.
Description
技术领域technical field
本发明涉及一种带特殊功能寄存器断点的增强型微处理器片上动态跟踪方法,支持在线调试功能,包括单步调试,地址断点和SFR特殊功能寄存器断点的设置和检测,以及微处理器内部寄存器的查看和修改等。可应用于8051系列的单片微处理器,也可应用于其他微处理器、微处理器领域。The invention relates to an enhanced on-chip dynamic tracking method of a microprocessor with special function register breakpoints, which supports online debugging functions, including single-step debugging, setting and detection of address breakpoints and SFR special function register breakpoints, and microprocessing View and modify the internal registers of the device, etc. It can be applied to single-chip microprocessors of 8051 series, and can also be applied to other microprocessors and microprocessor fields.
背景技术Background technique
动态跟踪(Dynamic Trace)是指实时地记录程序运行的轨迹信息,并把这些信息通过某种手段传送到外部的调试工具进行分析和调试的过程。在大多数的逻辑分析仪和在线仿真器等设备中,都有用于动态跟踪处理器运行轨迹的跟踪部件,用来监测处理器的各种内部信息,这样调试者就可以方便地检测程序执行流程、查找程序错误、重构程序运行轨迹等。Dynamic Trace (Dynamic Trace) refers to the process of recording the trajectory information of program operation in real time, and transmitting this information to an external debugging tool for analysis and debugging by some means. In most devices such as logic analyzers and in-circuit emulators, there are tracking components used to dynamically track the running track of the processor, which are used to monitor various internal information of the processor, so that the debugger can easily detect the program execution flow , find program errors, reconstruct the program running track, etc.
摩托罗拉公司最早认识到OCD技术这个发展趋势,并率先在683xx和68HC16处理器上创造了BDM调试接口。而MIPS、Intel、IBM和ARM等实现了基于JTAG标准的串行调试接口。尽管BDM和JTAG调试接口这两者在实现的细节上相差很远,但是从用户的角度看,它们提供相似的调试功能。由于JTAG是IEEE的国际标准,当前绝大多数CPU厂商都用它来实现处理器的片上调试逻辑。现有的片上调试技术依赖于特定结构的实现,对处理器核改动较大,需占用较多资源,实现起来不够方便;同时现有的片上调试技术一般只能实现程序地址断点和单步执行等调试功能,而特殊功能寄存器(SFR-special functionregister)是微处理器的重要组成部分,在微处理器中起着重要的作用,实时了解特殊功能寄存器的运行状态对于用户来说十分重要,所以实现SFR断点十分必要。Motorola was the first to recognize the development trend of OCD technology, and took the lead in creating the BDM debugging interface on the 683xx and 68HC16 processors. And MIPS, Intel, IBM and ARM have realized the serial debugging interface based on JTAG standard. Although the BDM and JTAG debug interfaces are far apart in implementation details, they provide similar debug functionality from the user's point of view. Since JTAG is an IEEE international standard, most CPU manufacturers currently use it to implement the on-chip debugging logic of the processor. The existing on-chip debugging technology relies on the realization of a specific structure, which requires a lot of changes to the processor core and requires more resources, which is not convenient to implement; at the same time, the existing on-chip debugging technology can only achieve program address breakpoints and single-step Execution and other debugging functions, and the special function register (SFR-special function register) is an important part of the microprocessor and plays an important role in the microprocessor. It is very important for the user to know the running status of the special function register in real time. Therefore, it is necessary to realize the SFR breakpoint.
发明内容Contents of the invention
本发明的目的在于提供一种带SFR断点功能的增强型微处理器的片上动态跟踪方法。通过一个集成在微处理器内部的独立的带有SFR断点功能的增强型片上调试模块(Enhanced OCD module with SFR Breakpoint Function:E-OCD-SFR-B),可以将程序执行过程中调试者关心的一些位置或SFR设置为断点(breakpoint),并对这些位置的信息进行跟踪、记录和实时地输出,以实现动态跟踪的目的。而且整个过程不需要专门的跟踪缓冲单元,只需少量的寄存器就能满足数据的暂存要求。并通过添加外部调试使能信号实现调试和正常运行状态的切换。The object of the present invention is to provide an on-chip dynamic tracking method of an enhanced microprocessor with SFR breakpoint function. Through an independent enhanced on-chip debug module with SFR breakpoint function (Enhanced OCD module with SFR Breakpoint Function: E-OCD-SFR-B) integrated in the microprocessor, the debugger's concern during program execution can be Some locations or SFRs are set as breakpoints, and the information of these locations is tracked, recorded and output in real time to achieve the purpose of dynamic tracking. Moreover, the whole process does not need a special tracking buffer unit, and only a small number of registers can meet the temporary storage requirements of data. And by adding an external debugging enable signal to realize switching between debugging and normal operation.
为达到上述目的,本发明的构思如下:For achieving the above object, design of the present invention is as follows:
构建一个集成在处理器内部的带有SFR断点功能的增强型片上调试模块(EnhancedOCD module with SFR Breakpoint Function:E-OCD-SFR-B),通过这个模块将程序执行过程中的某些位置或SFR标记为观察点。E-OCD-SFR-B通过外部的调试使能信号(DBG_enable)的设置,可以实现调试模式和正常工作模式的自由切换。调试使能信号(DBG_enable)保持低电平,正常在工作模式下,E-OCD-SFR-B不干预处理器的工作;调试使能信号(DBG_enable)变为高电平,允许进行调试,调试模式又可以分为地址比较模式和SFR断点模式。1)地址比较模式:在程序执行的过程中,将每条指令的地址与断点寄存器(breakpoint register)值进行比较来检测观察点。如果有观察点被检测到,则输出符合信号到时钟模块,系统时钟(clk)暂停,从而达到暂停微处理器运行的目的,调试时钟(DBG_clk)开始运行,此时将预先设定选择好的内部寄存器的信息输出到指定的输出寄存器(desired_SFR)中。若数据输出完毕,则设置外部调试使能信号为低电平,恢复程序的执行。2)SFR断点模式:选择特定的SFR,程序运行过程中,将此SFR中的值与断点寄存器值进行比较。如果有观察点被检测到,则输出符合信号到时钟模块,系统时钟(clk)暂停,从而达到暂停微处理器运行的目的,调试时钟(DBG_clk)开始运行,此时将预先设定选择好的内部寄存器的信息输出到指定的输出寄存器(desired_SFR)中。若数据输出完毕,则设置外部调试使能信号为低电平,恢复程序的执行。Build an enhanced on-chip debug module with SFR breakpoint function (EnhancedOCD module with SFR Breakpoint Function: E-OCD-SFR-B) integrated in the processor, through which certain positions or SFRs are marked as observation points. E-OCD-SFR-B can freely switch between the debugging mode and the normal working mode through the setting of the external debugging enable signal (DBG_enable). The debug enable signal (DBG_enable) keeps low level, and in normal working mode, E-OCD-SFR-B does not interfere with the work of the processor; the debug enable signal (DBG_enable) becomes high level, allowing debugging, debugging The mode can be divided into address comparison mode and SFR breakpoint mode. 1) Address comparison mode: In the process of program execution, the address of each instruction is compared with the value of the breakpoint register (breakpoint register) to detect the observation point. If an observation point is detected, the signal will be output to the clock module, the system clock (clk) will be suspended, so as to achieve the purpose of suspending the operation of the microprocessor, and the debug clock (DBG_clk) will start running. At this time, the selected The information of the internal register is output to the specified output register (desired_SFR). If the data output is completed, the external debugging enable signal is set to be low level, and the execution of the program is resumed. 2) SFR breakpoint mode: select a specific SFR, and compare the value in this SFR with the breakpoint register value during program running. If an observation point is detected, the signal will be output to the clock module, the system clock (clk) will be suspended, so as to achieve the purpose of suspending the operation of the microprocessor, and the debug clock (DBG_clk) will start running. At this time, the selected The information of the internal register is output to the specified output register (desired_SFR). If the data output is completed, the external debugging enable signal is set to be low level, and the execution of the program is resumed.
根据上述构思,本发明采用下述技术方案:According to above-mentioned design, the present invention adopts following technical scheme:
增强型片上调试方法,其特征在于实现一般片上的单步执行、地址断点调试功能的同时,添加SFR断点功能,实现SFR的完全可控制性和可观察性,因此将调试模式分为地址比较模式和SFR断点模式两种,其具体步骤为:The enhanced on-chip debugging method is characterized in that it realizes the single-step execution and address breakpoint debugging functions on the general chip, and at the same time adds the SFR breakpoint function to realize the complete controllability and observability of SFR, so the debugging mode is divided into address There are two kinds of comparison mode and SFR breakpoint mode, and the specific steps are:
a.设定一个调试命令寄存器模块DBG_command,用于产生调试所需的命令,控制调试的起始和方式。a. Set a debug command register module DBG_command, which is used to generate the commands required for debugging, and control the start and mode of debugging.
在调试模块的调试命令寄存器DBG_command中选择断点模式为地址比较模式或SFR断点模式,选择需要输出的特殊功能寄存器。如果选择地址比较模式,可以设定断点为当前地址或断点寄存器指定的地址;若选择SFR断点模式,还需设定选择哪个SFR作为断点;In the debug command register DBG_command of the debug module, select the breakpoint mode as address comparison mode or SFR breakpoint mode, and select the special function register to be output. If you choose the address comparison mode, you can set the breakpoint to the current address or the address specified by the breakpoint register; if you choose the SFR breakpoint mode, you also need to set which SFR to choose as the breakpoint;
b.在断点寄存器breakpoint register写入值。b. Write a value in the breakpoint register breakpoint register.
c.若选择地址比较模式,将程序计数器指针PC与预设的断点寄存器值进行比较,相等则停止微处理器的运行,并将预设的特殊功能寄存器的值输出到输出SFR寄存器desired_SFR;c. If the address comparison mode is selected, compare the program counter pointer PC with the preset breakpoint register value, and if they are equal, stop the operation of the microprocessor, and output the value of the preset special function register to the output SFR register desired_SFR;
d.若选择SFR断点模式,将选定的SFR值与预设的断点寄存器值进行比较,若相同则停止微处理器的运行,并将预设的特殊功能寄存器的值输出到输出SFR寄存器desired_SFR;d. If the SFR breakpoint mode is selected, compare the selected SFR value with the preset breakpoint register value, if they are the same, stop the operation of the microprocessor, and output the preset special function register value to the output SFR register desired_SFR;
e.通过设置外部的调试使能DBG_en信号为高电平来启动动态跟踪过程,满足设置条件,进入调试状态,这时只需将调试使能DBG_en信号设置为低电平就可以恢复到原来的正常运行状态。e. Start the dynamic tracking process by setting the external debugging enable DBG_en signal to a high level, meet the setting conditions, and enter the debugging state. At this time, you only need to set the debugging enable DBG_en signal to a low level to restore to the original normal operating state.
上述的设定一个调试命令寄存器DBG_command的方法为:The above method of setting a debug command register DBG_command is:
定义DBG_command为一个8位的寄存器,它被用来存储调试命令的二进制编码,并将接收到的调试命令译码为相应的控制信号。Define DBG_command as an 8-bit register, which is used to store the binary code of the debugging command, and decode the received debugging command into the corresponding control signal.
DBG_command的格式见说明书附图表1。其中,DBG_command中没有用到的其他二进制编码暂时保留,可以在以后进行扩展。The format of DBG_command is shown in Figure 1 attached to the manual. Among them, other binary codes not used in DBG_command are temporarily reserved and can be expanded in the future.
SFR_output_select——选择进入调试模式后需要输出的特殊功能寄存器。SFR_output_select——select the special function registers that need to be output after entering the debug mode.
这里设定了三位,所以可以在8个SFR中进行选择;选择格式如说明书附图表2所示。Three bits are set here, so you can choose among 8 SFRs; the selection format is shown in Table 2 of the attached manual.
SFR_select——在SFR断点模式下,选择哪个SFR作为断点比较。SFR_select——In SFR breakpoint mode, which SFR is selected as a breakpoint comparison.
这里定义了两位,所以可以在4个SFR中进行选择,选择格式如说明书附图表3所示。Two bits are defined here, so you can choose from 4 SFRs, and the selection format is shown in Table 3 of the attached manual.
PC_break——与SFR_output_select高两位复用,在地址比较模式,选择断点的地址,选择格式如说明书附图表4所示。PC_break——Multiplexed with the upper two bits of SFR_output_select. In the address comparison mode, select the address of the breakpoint. The selection format is shown in Table 4 of the attached manual.
single_step——单步运行标志位。single_step——Single-step operation flag.
mode——断点模式选择标志位。0为地址比较模式;1为SFR断点模式mode - breakpoint mode selection flag. 0 is address comparison mode; 1 is SFR breakpoint mode
在SFR断点模式下,需要设置模式选择位、作为断点比较的SFR以及需要输出的SFR。In the SFR breakpoint mode, it is necessary to set the mode selection bit, the SFR used as the breakpoint comparison, and the SFR to be output.
start——调试开始标志位。在此位置1,表明调试开始。start——debugging start flag. Setting this bit to 1 indicates that debugging has started.
上述的设定设置断点寄存器(breakpoint_register)值的方法为:预先定义一个未被定义的特殊功能寄存器,将其定义为断点寄存器,将设定的断点值写入该断点寄存器即可。The method for setting the value of the breakpoint register (breakpoint_register) above is: pre-define an undefined special function register, define it as a breakpoint register, and write the set breakpoint value into the breakpoint register. .
上述在片上调试的过程中根据情况进行动态跟踪操作有如下两种:There are two types of dynamic tracking operations according to the situation in the process of on-chip debugging:
a)第一种是地址断点模式,即将程序指针PC与预设的断点寄存器值进行比较,如果相等,触发断点条件,输出符合信号给时钟生成模块,停止微处理器核的时钟运行,同时调试时钟开始工作,将需要观察的特殊功能寄存器的值输出到输出寄存器,等待下一步的处理。a) The first is the address breakpoint mode, which is to compare the program pointer PC with the preset breakpoint register value. If they are equal, the breakpoint condition is triggered, and the signal is output to the clock generation module to stop the clock operation of the microprocessor core. , and the debug clock starts to work at the same time, output the value of the special function register to be observed to the output register, and wait for the next step of processing.
b)第二种是SFR断点模式,即将选定的SFR值与预设的断点寄存器值进行比较,如果相等,触发断点条件,输出符合信号给时钟生成模块,停止微处理器核的时钟运行,同时调试时钟开始工作,将需要观察的特殊功能寄存器的值输出到输出寄存器,等待下一步的处理。b) The second is the SFR breakpoint mode, which compares the selected SFR value with the preset breakpoint register value. If they are equal, the breakpoint condition is triggered, and the output meets the signal to the clock generation module to stop the microprocessor core. The clock is running, and the debugging clock starts to work at the same time, output the value of the special function register to be observed to the output register, and wait for the next step of processing.
上述在片上调试的过程中根据情况进行调试模式和正常运行模式自由切换的操作方法为:The operation method for freely switching between the debugging mode and the normal operation mode according to the situation during the on-chip debugging process is as follows:
为方便实现两种工作方式的自由切换,添加调试使能(DBG_enable)信号。In order to realize the free switching between the two working modes, a debug enable (DBG_enable) signal is added.
a)从正常运行模式进入调试模式:必须设置DBG_enable信号为高电平,否则调试命令寄存器(DBG_command)不起作用;a) Enter debug mode from normal operation mode: the DBG_enable signal must be set to high level, otherwise the debug command register (DBG_command) will not work;
b)从调试模式恢复到正常运行模式:只需设置DBG_enable信号为低电平,就可以方便地恢复微处理器的正常运行。b) Restore from debug mode to normal operation mode: Just set the DBG_enable signal to be low level, and the normal operation of the microprocessor can be resumed conveniently.
本发明与现有技术相比较,具有如下显而易见的突出实质性特点和显著优点:本发明通过一个集成在微处理器内部的独立的带SFR断点功能的增强型片上调试模块,将程序执行过程中的某些位置和特殊功能寄存器设置为断点,然后对这些断点处的内部寄存器的信息进行跟踪,记录和实时输出以实现动态跟踪的目的。并通过添加调试使能信号来实现调试模式和正常工作模式的切换。本发明整个过程不需要专门的跟踪缓冲单元,只需少量的寄存器就能满足数据的暂存要求。本发明适用于8051系列微处理器,且适用于其他微处理器领域。Compared with the prior art, the present invention has the following obvious outstanding substantive features and significant advantages: the present invention uses an independent enhanced on-chip debugging module with SFR breakpoint function integrated in the microprocessor to control the program execution process Some positions and special function registers are set as breakpoints, and then the information of the internal registers at these breakpoints is tracked, recorded and output in real time to achieve the purpose of dynamic tracking. And by adding a debugging enable signal to realize switching between the debugging mode and the normal working mode. The whole process of the invention does not need a special tracking buffer unit, and only a small amount of registers can meet the temporary storage requirements of data. The invention is suitable for 8051 series microprocessors and other microprocessor fields.
附图说明:Description of drawings:
图1是带有SFR断点功能的增强型片上调试的工作流程图。Figure 1 is a flowchart of the enhanced on-chip debugging with SFR breakpoint function.
图2是断点模块的内部结构示意图。Fig. 2 is a schematic diagram of the internal structure of the breakpoint module.
图3是时钟生成模块。Figure 3 is the clock generation module.
具体实施方式Detailed ways
本发明的一个优选实施例结合附图详述如下:A preferred embodiment of the present invention is described in detail as follows in conjunction with accompanying drawing:
本微处理器的片上动态跟踪方法,通过一个带有SFR断点功能的增强型片上调试模块(Enhanced OCD module with SFR Breakpoint Function:E-OCD-SFR-B),采用下述的工作流程(见图1)来实现对处理器运行过程的动态跟踪:The on-chip dynamic tracking method of this microprocessor adopts the following workflow (see Figure 1) to realize the dynamic tracking of the processor running process:
a)如果保持调试使能信号(DBG_enable)为低电平,则此时调试命令寄存器(DBG_command)不起作用,微处理器正常运行。如果要进行调试,设置调试使能信号(DBG_enable)为高电平。a) If the debug enable signal (DBG_enable) is kept at a low level, the debug command register (DBG_command) does not work at this time, and the microprocessor operates normally. If you want to debug, set the debug enable signal (DBG_enable) to a high level.
b)向调试命令寄存器(DBG_command)写入初值,调试命令寄存器格式说明如附图表1所示。本设计中,首先定义了调试开始标志位start,如果对该标志位置1,表明调试的开始。设定开始标志位的原因是:如果没有该调试开始标志位,因为调试寄存器(breakpoint_register)的默认值是全0,一旦调试使能信号变为高电平,如果此时PC或选定的SFR值为0,则触发断点条件,这样就带来非预想的断点,降低了该片上调试单元的正确性。本设计中,对于SFR断点的选择(SFR_select)定义了两位,即能对4个特殊功能寄存器进行选择,这里设置为常用的累加器(ACC-Accumulator)、堆栈(SP-Stack Point)、状态(PSW-ProgramStatusWord)、P0(port 0)。对于输出SFR的选择定义了三位,即能从8个SFR中进行输出选择,这里设置为常用的堆栈(SP-Stack Point)、累加器(Acc-Accumulator)、状态寄存器(PSW-ProgramStatusWord)、B寄存器、P0(port0)、P1(port 1)、P2(port 2)、P3(port 3)。模式选择位(mode)选择断点模式,置0时选择地址断点模式,置1时选择SFR断点模式。本设计中,将调试命令寄存器(DBG_command)的高两位复用,用于在地址比较模式进行作为断点的地址选择位(PC_break)。PC_break等于01,选择当前PC为断点,这种模式的优点就是可以在程序中自由选择任何感兴趣的位置设置断点,比较适合在对程序的运行不是很了解的使用者;PC_break等于10,选择指定的PC作为断点,当程序运行到这个特定的地址时,断点条件就触发,进入调试阶段。b) Write the initial value to the debug command register (DBG_command), and the format description of the debug command register is shown in Table 1 of the accompanying drawing. In this design, the start flag bit start is defined first, if the flag position is 1, it indicates the start of debugging. The reason for setting the start flag is: if there is no debug start flag, because the default value of the debug register (breakpoint_register) is all 0, once the debug enable signal becomes high, if the PC or the selected SFR A value of 0 triggers a breakpoint condition, which brings unexpected breakpoints and reduces the correctness of the on-chip debug unit. In this design, two bits are defined for the SFR breakpoint selection (SFR_select), that is, four special function registers can be selected. Here, the commonly used accumulator (ACC-Accumulator), stack (SP-Stack Point), Status (PSW-ProgramStatusWord), P0 (port 0). For the selection of the output SFR, three bits are defined, that is, the output can be selected from 8 SFRs. Here, it is set to the commonly used stack (SP-Stack Point), accumulator (Acc-Accumulator), status register (PSW-ProgramStatusWord), B register, P0 (port0), P1 (port 1), P2 (port 2), P3 (port 3). The mode selection bit (mode) selects the breakpoint mode. When it is set to 0, the address breakpoint mode is selected, and when it is set to 1, the SFR breakpoint mode is selected. In this design, the high two bits of the debug command register (DBG_command) are multiplexed for the address selection bit (PC_break) as a breakpoint in the address comparison mode. PC_break is equal to 01, and the current PC is selected as a breakpoint. The advantage of this mode is that you can freely choose any interesting position in the program to set a breakpoint, which is more suitable for users who do not know much about the operation of the program; PC_break is equal to 10, Select the specified PC as a breakpoint. When the program runs to this specific address, the breakpoint condition will be triggered and enter the debugging stage.
c)将预定的值写入断点寄存器(breakpoint_register),如图2所示,等待比较;断点寄存器因为断点模式的不同选择而不同,如果选择是地址比较模式的当前地址比较模式,则原理上此时是将当前地址与断点寄存器进行比较,实际上两者相同,所以直接触发满足信号(match)即可;如果选择地址比较模式的指定地址比较模式,即选择程序计数器(PC)和断点寄存器值进行比较,此时断点寄存器为16bit;如果是SFR断点模式,选择SFR和断点寄存器值进行比较,此时断点寄存器为8bit。c) Write the predetermined value into the breakpoint register (breakpoint_register), as shown in Figure 2, wait for comparison; the breakpoint register is different because of the different selections of the breakpoint mode, if the selection is the current address comparison mode of the address comparison mode, then In principle, at this time, the current address is compared with the breakpoint register. In fact, the two are the same, so it is enough to directly trigger the match signal; if the specified address comparison mode of the address comparison mode is selected, the program counter (PC) is selected. Compared with the breakpoint register value, the breakpoint register is 16bit at this time; if it is the SFR breakpoint mode, select SFR and the breakpoint register value for comparison, and the breakpoint register is 8bit at this time.
d)调试使能信号的设置可以实现调试模式和正常工作模式的自由切换。如果调试使能信号保持低电平,则微处理器正常工作。将外部调试使能信号DBG_enable置为高电平,允许进行断点比较。d) The setting of the debugging enable signal can realize free switching between the debugging mode and the normal working mode. If the debug enable signal is held low, the microprocessor is operating normally. Set the external debug enable signal DBG_enable to high level to allow breakpoint comparison.
e)图2中的比较器(compare)将断点寄存器的值和地址或选定的SFR值进行比较。比较器的结构是一组异或门电路,如果两组信号如果相同,则断点条件满足,符合信号(match)变为高电平,并将此信号输出到时钟生成模块;在地址比较的当前地址模式,不用比较器,直接输出match信号;e) The comparator (compare) in Figure 2 compares the value of the breakpoint register with the address or the selected SFR value. The structure of the comparator is a set of XOR gate circuits. If the two sets of signals are the same, the breakpoint condition is satisfied, and the match signal (match) becomes high level, and this signal is output to the clock generation module; in the address comparison In the current address mode, the match signal is directly output without a comparator;
f)时钟信号是微处理器运行的基础,所以片上调试的最主要的就是实现时钟信号的可控制性。图3中的时钟生成模块可见,若match信号为低电平,则表明断点条件此时没有满足,系统时钟(clk)在与match信号相或后,仍然正常工作;如果match信号为高电平,则此时表明断点条件已经触发,进入调试模式,需要暂停微处理器的运行,match信号与系统时钟信号相或后,输出时钟变为始终是高电平,微处理器的运行停止。f) The clock signal is the basis of the operation of the microprocessor, so the most important thing for on-chip debugging is to realize the controllability of the clock signal. It can be seen from the clock generation module in Figure 3 that if the match signal is at low level, it indicates that the breakpoint condition is not met at this time, and the system clock (clk) still works normally after being ORed with the match signal; if the match signal is at high level Ping, it indicates that the breakpoint condition has been triggered at this time, enters the debugging mode, needs to suspend the operation of the microprocessor, after the match signal and the system clock signal are ORed, the output clock becomes always high, and the operation of the microprocessor stops .
g)在触发断点条件后,可以将需要观察的信号输出到输出寄存器(desired_SFR),因为此时系统时钟已经停止运行,所以需要在时钟生成模块添加调试时钟(DBG_clk),在调试时钟信号作用下,将需要观察的信号值输出。这样就对内部SFR做到了完全的可见性,实现了片上调试的初衷。优点是不需要添加额外的外部专用电路就可以实现对微处理器运行以及特殊功能寄存器的可控制性和可见性。g) After the breakpoint condition is triggered, the signal to be observed can be output to the output register (desired_SFR), because the system clock has stopped running at this time, so it is necessary to add a debug clock (DBG_clk) to the clock generation module. Next, output the signal value to be observed. In this way, the internal SFR is completely visible, and the original intention of on-chip debugging is realized. The advantage is that the controllability and visibility of the operation of the microprocessor and the special function registers can be realized without adding additional external dedicated circuits.
h)当需要从调试模式重新恢复到正常运行状态时,只需要将调试使能信号(DBG_enable)设置为低电平,DBG_enable为低电平,则调试命令寄存器(DBG_command)值为全0,调试命令寄存器此时无效,程序恢复执行。h) When it is necessary to restore from the debug mode to the normal operating state, it is only necessary to set the debug enable signal (DBG_enable) to low level, and if DBG_enable is low level, the value of the debug command register (DBG_command) is all 0, and the The command register is invalidated at this time and program execution resumes.
上述的调试命令寄存器DBG_command格式如表1所示,SFR输出选择格式如表2所示,SFR断点选择格式如表3所示,地址断点格式如表4所示。The above-mentioned debugging command register DBG_command format is shown in Table 1, the SFR output selection format is shown in Table 2, the SFR breakpoint selection format is shown in Table 3, and the address breakpoint format is shown in Table 4.
表1Table 1
表2Table 2
表3table 3
表4Table 4
Claims (6)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CNB2007100465348A CN100511179C (en) | 2007-09-27 | 2007-09-27 | Enhancement type microprocessor piece on-chip dynamic state tracking method with special function register breakpoints |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CNB2007100465348A CN100511179C (en) | 2007-09-27 | 2007-09-27 | Enhancement type microprocessor piece on-chip dynamic state tracking method with special function register breakpoints |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN101178685A true CN101178685A (en) | 2008-05-14 |
| CN100511179C CN100511179C (en) | 2009-07-08 |
Family
ID=39404945
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CNB2007100465348A Expired - Fee Related CN100511179C (en) | 2007-09-27 | 2007-09-27 | Enhancement type microprocessor piece on-chip dynamic state tracking method with special function register breakpoints |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN100511179C (en) |
Cited By (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN102646051A (en) * | 2012-03-13 | 2012-08-22 | 深圳市融创天下科技股份有限公司 | Method, system and terminal equipment for outputting function execution streams |
| CN103716028A (en) * | 2012-09-28 | 2014-04-09 | 中国航空工业集团公司第六三一研究所 | Switch switching debugging/non debugging mode and power on and off state circuit and method |
| CN106021041A (en) * | 2016-04-29 | 2016-10-12 | 中国科学技术大学 | Finite state machine based multi-cycle non-flow line CPU debugging method |
| CN106095631A (en) * | 2016-06-03 | 2016-11-09 | 中国科学技术大学 | A kind of multicycle nonpipeline CPU dynamic modulation realized based on finite state machine |
| CN107015846A (en) * | 2017-04-14 | 2017-08-04 | 直觉系统科技(昆山)有限公司 | A kind of emulation mode and device for realizing processor simulation core |
| CN107436842A (en) * | 2016-05-25 | 2017-12-05 | 中兴通讯股份有限公司 | A kind of microcode adjustment method and veneer |
| CN104239201B (en) * | 2013-06-20 | 2018-08-24 | 上海博达数据通信有限公司 | Memory read-write monitoring method in a kind of soft single step system |
-
2007
- 2007-09-27 CN CNB2007100465348A patent/CN100511179C/en not_active Expired - Fee Related
Cited By (10)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN102646051A (en) * | 2012-03-13 | 2012-08-22 | 深圳市融创天下科技股份有限公司 | Method, system and terminal equipment for outputting function execution streams |
| CN103716028A (en) * | 2012-09-28 | 2014-04-09 | 中国航空工业集团公司第六三一研究所 | Switch switching debugging/non debugging mode and power on and off state circuit and method |
| CN104239201B (en) * | 2013-06-20 | 2018-08-24 | 上海博达数据通信有限公司 | Memory read-write monitoring method in a kind of soft single step system |
| CN106021041A (en) * | 2016-04-29 | 2016-10-12 | 中国科学技术大学 | Finite state machine based multi-cycle non-flow line CPU debugging method |
| CN106021041B (en) * | 2016-04-29 | 2020-01-03 | 中国科学技术大学 | Multi-cycle non-pipeline CPU debugging method based on finite state machine |
| CN107436842A (en) * | 2016-05-25 | 2017-12-05 | 中兴通讯股份有限公司 | A kind of microcode adjustment method and veneer |
| CN106095631A (en) * | 2016-06-03 | 2016-11-09 | 中国科学技术大学 | A kind of multicycle nonpipeline CPU dynamic modulation realized based on finite state machine |
| CN106095631B (en) * | 2016-06-03 | 2020-01-03 | 中国科学技术大学 | Multi-cycle non-pipeline CPU dynamic debugging method based on finite state machine |
| CN107015846A (en) * | 2017-04-14 | 2017-08-04 | 直觉系统科技(昆山)有限公司 | A kind of emulation mode and device for realizing processor simulation core |
| CN107015846B (en) * | 2017-04-14 | 2020-08-14 | 直觉系统科技(昆山)有限公司 | Simulation method and device for realizing eukaryon simulation of processor |
Also Published As
| Publication number | Publication date |
|---|---|
| CN100511179C (en) | 2009-07-08 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN103729288B (en) | The adjustment method of application program under a kind of embedded multi-core environment | |
| CN104471545B (en) | Device with configurable breakpoints based on interrupt status | |
| US7681078B2 (en) | Debugging a processor through a reset event | |
| US6877114B2 (en) | On-chip instrumentation | |
| CN101178685A (en) | An Enhanced Microprocessor On-Chip Dynamic Tracing Method with Special Function Register Breakpoints | |
| CN102388368B (en) | A memory monitoring method and device | |
| WO2020207040A1 (en) | On-chip debugging device and method | |
| CN102360329A (en) | Bus monitoring and debugging control device and methods for monitoring and debugging bus | |
| CN107861866B (en) | Embedded system debugging method based on UART interface | |
| CN107577593A (en) | Carry out diagnosis coding using one step is performed | |
| KR101547163B1 (en) | Debug instruction for use in a multi-threaded data processing system | |
| US9477577B2 (en) | Method and apparatus for enabling an executed control flow path through computer program code to be determined | |
| JP2001236245A (en) | Method and apparatus for regenerating an emulated instruction set trace upon execution on hardware specific to different instruction set fields | |
| CN115757168A (en) | Vehicle UI automatic test script recording method and device and electronic equipment | |
| US8707267B1 (en) | Debugging a computer program by interrupting program execution in response to access of unused I/O port | |
| US6647511B1 (en) | Reconfigurable datapath for processor debug functions | |
| CN100388215C (en) | Debug Support Unit and Debug Method Using Multiple Asynchronous Clocks on Chip Hardware | |
| WO2011109971A1 (en) | Circuit and method for microcontroller online debugging, microcontroller | |
| CN100405323C (en) | A Realization Method of Supporting EJTAG Test in Instruction Level Random Test | |
| CN106528414A (en) | Processor chip simulator | |
| CN111008133B (en) | Coarse-grained data flow architecture execution array debugging method and device | |
| US20210064514A1 (en) | Techniques to identify improper information in call stacks | |
| CN105095079A (en) | Method and device for hot spot module instruction tracking | |
| CN117707969B (en) | ARMv 8-based operation system adjustment and measurement system | |
| WO2022235265A1 (en) | Debug channel for communication between a processor and an external debug host |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| C10 | Entry into substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| C14 | Grant of patent or utility model | ||
| GR01 | Patent grant | ||
| CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20090708 Termination date: 20150927 |
|
| EXPY | Termination of patent right or utility model |