WO2011109971A1 - 微控制器在线调试电路及方法、微控制器 - Google Patents

微控制器在线调试电路及方法、微控制器 Download PDF

Info

Publication number
WO2011109971A1
WO2011109971A1 PCT/CN2010/074120 CN2010074120W WO2011109971A1 WO 2011109971 A1 WO2011109971 A1 WO 2011109971A1 CN 2010074120 W CN2010074120 W CN 2010074120W WO 2011109971 A1 WO2011109971 A1 WO 2011109971A1
Authority
WO
WIPO (PCT)
Prior art keywords
breakpoint
flag
signal generating
generating unit
signal
Prior art date
Application number
PCT/CN2010/074120
Other languages
English (en)
French (fr)
Inventor
史卫东
潘松
陈光胜
陈立权
Original Assignee
上海海尔集成电路有限公司
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 上海海尔集成电路有限公司 filed Critical 上海海尔集成电路有限公司
Publication of WO2011109971A1 publication Critical patent/WO2011109971A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging

Definitions

  • Microcontroller online debugging circuit and method, and microcontroller The application is submitted to the Chinese Patent Office on March 10, 2010, and the application number is 201010123200.8, and the invention name is "microcontroller online debugging circuit and method, microcontroller" Priority of Chinese Patent Application, the entire contents of which is incorporated herein by reference.
  • the present invention relates to the field of integrated circuit testing technology, and in particular, to a microcontroller online debugging circuit and method, and a microcontroller. Background technique
  • a microcontroller is a general-purpose microcontroller that integrates a CPU core, on-chip memory, and various peripheral function modules. With the rapid development of electronic technology, the application system of the microcontroller is becoming more and more complex. There are several methods for developing and debugging a microcontroller application system. One of them is the online debugging technology, which integrates the debugging function module directly into the microcontroller. The debugger host computer can develop and debug the application of the microcontroller online with only a few micro control pins (usually five), so that development and debugging can be performed in the actual system. It is possible to avoid the development of differences between the simulation environment and the actual system.
  • FIG. 1 is a schematic structural diagram of a prior art microcontroller online debugging circuit, which is integrated in the aforementioned microcontroller.
  • the in-circuit debugging circuit mainly includes an interface protocol module 1 1 , a program execution control module 12 , a data memory/register read/write control module 13 , a program breakpoint register 14 , a program counter 15 , and a first comparator 16 .
  • the program breakpoint register 14, the program counter 15, and the first comparator 16 constitute a breakpoint flag signal generating module 24.
  • the interface protocol module 11 can communicate with the host computer through the debug clock line and the debug data line, interpret the command sent by the host computer, generate a debug control signal, and send it to the program execution control module 12.
  • the program execution control module 12 can receive the debugging instruction of the upper computer sent by the interface protocol module 11, and control the execution of the program according to the debugging instruction, and realize the control and debugging functions including full speed running, pause running, single step, step, and the like.
  • the interface protocol module 11 can also control the data memory/register read/write control module 13 according to the debugging instruction of the upper computer to implement read/write control of the on-chip memory/register, and the read/write data can pass through the data read/write bus. Transfer.
  • the host computer writes the program breakpoint address value to be set to the program breakpoint register 14 through the interface protocol module 11; the value stored in the program counter 15 is the address of the next program instruction to be executed.
  • the first comparator 16 can compare the value of the program break register 14 with the current value of the program counter 15, and if the two are equal, indicating that the program execution has reached the breakpoint position, the breakpoint flag signal can be output.
  • the program execution control module 12 can control the program to pause at this position according to the breakpoint flag signal to execute a subsequent program debug command.
  • the above scheme can realize the basic debugging function of the microcontroller, it can satisfy the development and debugging of the assembler.
  • the program of the microcontroller is becoming more and more complicated, and the program quantity is continuously improved; the development environment of the assembly language is far from satisfying the demand, and the high-level language such as the C language is widely used in system development.
  • the microcontroller can only run assembly language instructions, it is necessary to compile the program written in C language and turn it into an assembler to support the execution of the microcontroller.
  • a C language statement often corresponds to several or even dozens of assembly instructions after compilation, and the compilation from C language statements to assembly instructions is not fixed.
  • the invention provides a micro-controller online debugging circuit and method, and a micro-controller, which are used for solving the shortcomings of the prior art interruption point implementation method, and are not suitable for the breakpoint test of the complex program, and realize the breakpoint which can accurately control the complex program. debugging.
  • the invention provides a microcontroller online debugging circuit, which comprises:
  • An interface protocol module configured to receive a debug instruction, and generate breakpoint setting information according to the debug command
  • a breakpoint flag signal generating module configured to be connected to the interface protocol module, configured to generate a breakpoint flag signal according to the breakpoint setting information, and include a breakpoint signal generating unit for generating a breakpoint signal, the breakpoint signal
  • the generating unit includes a program breakpoint signal generating unit;
  • a program execution control module coupled to the breakpoint flag signal generating module, configured to control an implementation of an online debugging breakpoint according to the breakpoint flag signal;
  • the breakpoint signal generating unit further includes: at least one first breakpoint signal generating unit, configured to generate the breakpoint signal according to the breakpoint setting information, where the breakpoint setting information is outside a program breakpoint address value Information;
  • the breakpoint flag signal generating module further includes:
  • a breakpoint configuration register connected to the interface protocol module, for receiving a breakpoint setting information, that is, a logical combination manner, from the interface protocol module;
  • breakpoint combination logic module respectively connected to the breakpoint signal generating unit and the breakpoint configuration register, for using a breakpoint signal generated by the breakpoint signal generating unit according to the manner of the logical combination A logical combination is performed to obtain the breakpoint flag signal.
  • the invention also provides a microcontroller online debugging circuit, comprising:
  • An interface protocol module configured to receive debug data, and generate breakpoint setting information according to the debug data
  • a breakpoint flag signal generating module configured to be connected to the interface protocol module, configured to generate a breakpoint flag signal according to the breakpoint setting information;
  • the breakpoint flag signal generating module includes a breakpoint signal for generating a breakpoint signal Generating unit;
  • a program execution control module coupled to the breakpoint flag signal generating module, configured to control an implementation of an online debugging breakpoint according to the breakpoint flag signal;
  • the breakpoint signal generating unit includes a data breakpoint signal generating unit and a flag breakpoint signal generating unit;
  • the data breakpoint signal generating unit includes:
  • a data breakpoint register configured to be connected to the interface protocol module, for receiving a breakpoint setting information, that is, a data breakpoint matching value, from the interface protocol module;
  • a second comparator which is respectively connected to the data breakpoint register and the data read/write bus, and is configured to output a data breakpoint signal when the data breakpoint matching value is equal to the transmission value on the data read/write bus;
  • the flag breakpoint signal generating unit includes:
  • a flag breakpoint register connected to the interface protocol module, configured to receive a breakpoint setting information, that is, a state flag matching value, from the interface protocol module;
  • a status register that stores a status flag value
  • a third comparator which is respectively connected to the flag breakpoint register and the status register, and is configured to output a flag breakpoint signal when the state flag matching value is equal to the state flag value
  • the breakpoint flag signal generating module further includes:
  • a breakpoint configuration register connected to the interface protocol module, for receiving a breakpoint setting information, that is, a logical combination manner, from the interface protocol module;
  • a breakpoint combination logic module which is respectively connected to the breakpoint signal generating unit and the breakpoint configuration register, and is configured to logically combine the breakpoint signals generated by the breakpoint signal generating unit according to the logic combination manner to obtain the Breakpoint flag signal.
  • the invention provides a method for online debugging of a microcontroller, comprising:
  • the breakpoint setting information is information other than the program breakpoint address value, and obtaining a breakpoint flag signal according to the at least one breakpoint signal;
  • the online debugging breakpoint is controlled according to the breakpoint flag signal, and online debugging is completed.
  • the present invention provides two types of microcontrollers, each of which may include the above two types of microcontroller in-circuit debugging circuits.
  • the on-line debugging circuit and method and the micro-controller of the micro-controller of the invention increase the number of breakpoints and enhance the circuit by adding data breakpoints and state flag breakpoints on the basis of the original program breakpoint mode.
  • the function of the breakpoint compared with the breakpoint implementation of the current single program breakpoint mode, can more effectively implement the breakpoint debugging method of complex programs.
  • FIG. 1 is a schematic structural diagram of an in-circuit debugging circuit of a prior art microcontroller
  • FIG. 2 is a schematic structural diagram of an in-circuit debugging circuit of a microcontroller according to the present invention
  • FIG. 3 is a schematic flow chart of a method for online debugging of a microcontroller according to the present invention. detailed description
  • the main technical solution of the present invention is that, based on the on-line debugging circuit of the prior art microcontroller, the breakpoint flag signal generating module is improved, and the type of the breakpoint is increased, so that the breakpoint is used in the module.
  • the breakpoint signal generating unit of the signal may further include at least one first breakpoint signal generating unit, and the first breakpoint signal generating unit may generate a breakpoint signal according to the breakpoint setting information other than the program breakpoint address value, that is, it may The breakpoint is set in a manner other than the program address breakpoint mode; thus, compared with the current single program breakpoint breakpoint implementation, the breakpoint debugging method of the complex program can be realized more effectively by using other breakpoint methods.
  • FIG. 2 is a schematic structural diagram of an embodiment of an on-line debugging circuit of a microcontroller according to the present invention.
  • the on-line debugging circuit of the microcontroller of the embodiment mainly includes an interface protocol module 21, a program execution control module 22, and a data memory/register.
  • the interface protocol module 21 can communicate with the host computer through the debug clock line and the debug data line, receive the debug data, interpret the command sent by the host computer, generate a debug control signal and send it to the program execution control module 22; and can also set the relevant debug register. Control other modules of the in-circuit debugger to work, and send the data information required by the host computer to the host computer through the serial protocol.
  • the program execution control module 22 can control the execution of the program instructions according to the debug control signal, including functions of full speed operation, pause operation, single step, step, and the like.
  • the data memory/register read/write control module 13 is connected to the interface protocol module 21 via a data read/write bus, and can receive the read/write data memory/register command issued by the interface protocol module 21, and complete the data memory through the data read/write bus/ Register read/write function.
  • the breakpoint flag signal generating module 24 is connected to the interface protocol module 21, and can receive the breakpoint setting information generated by the interface protocol module 21 according to the debug data, and generate a breakpoint flag signal according to the breakpoint setting information.
  • the program execution control module 22 can control the implementation of the online debugging breakpoint according to the breakpoint flag signal to implement the function of the breakpoint.
  • the breakpoint flag signal generating module 24 of the prior art only includes the program breakpoint signal generating unit, and the breakpoint flag signal generating module 24 of the embodiment can Includes breakpoint signal generation units for other non-program address breakpoints.
  • the breakpoint flag signal generating module 24 may include a data breakpoint signal generating unit, and the data breakpoint signal generating unit may generate a data breakpoint signal; or may further include a flag breakpoint signal generating unit, the flag breakpoint signal The generating unit can generate a flag breakpoint signal.
  • the breakpoint signal is subjected to a breakpoint at the position where the set data breakpoint matching value is set; or, the breakpoint may be performed at the position of the set state flag matching value according to the flag breakpoint signal. Therefore, the function of the breakpoint is enhanced, and the breakpoint of the program can be realized more flexibly in a plurality of ways; and the breakpoint debugging of the high-level language program can be performed more effectively than the current single program address breakpoint mode.
  • the data breakpoint signal generating unit may be separately set, or the flag breakpoint signal generating unit may be separately set, or the two breakpoint signal generating units may be simultaneously set.
  • the data breakpoint signal generating unit and the flag breakpoint signal generating unit are only two examples, and those skilled in the art can understand that in actual program debugging, the user can flexibly according to the needs of the user and the actual program to be debugged. Set various types of breakpoints; based on a variety of high-level language types and combinations of various microcontrollers, a variety of combinatorial logic modes and breakpoint implementations can be set according to actual conditions, and will not be described here.
  • the breakpoint flag signal generating module 24 may also add a first breakpoint signal generating unit of a plurality of other breakpoint types on the basis of the existing program breakpoint signal generating unit, and the increase of the first breakpoint signal generating unit may be Make the setting of breakpoints more flexible.
  • the breakpoint flag signal generating module 24 of the in-circuit debugging circuit may include a breakpoint signal generating unit and a breakpoint signal combining unit.
  • the breakpoint signal generating unit may include a program breakpoint signal generating unit, a data breakpoint signal generating unit, and a flag breakpoint signal generating unit.
  • the program breakpoint signal generating unit is configured to generate a program breakpoint signal
  • the data breakpoint signal generating unit is configured to generate a data breakpoint signal
  • the flag breakpoint signal generating unit is configured to generate the flag breakpoint signal.
  • the breakpoint signal combining unit may include a breakpoint configuration register 31 and a breakpoint combination logic module 32, the breakpoint configuration register 31 being connected to the interface protocol module 21, and receiving a breakpoint from the interface protocol module 21.
  • the setting information is a logical combination manner, for example, a NAND mode; the breakpoint combination logic module 32 can logically combine a plurality of breakpoint signals generated by the breakpoint signal generating unit according to the logical combination set by the breakpoint configuration register 31. Get the breakpoint flag signal.
  • the program breakpoint signal generating unit may include a program breakpoint register 14, a program counter 15, and a first comparator 16.
  • the program breakpoint register 14 is one or more sets of registers equal to the program counter number of bits, which are connected to the interface protocol module 21, and the host computer can use the interface protocol module 21 to set the breakpoint setting information, that is, the program breakpoint address value.
  • the program counter 15 stores the next program instruction address value to be executed; the first comparator 16 is connected to the program break register 14 and the program counter 15, respectively, and can be used to program the program breakpoint address stored in the program break register 14. The value is compared with the program instruction address value stored in the program counter 15, and when the two are equal, the program breakpoint signal is output.
  • the program breakpoint signal generating unit may further include a program breakpoint counter 36.
  • the program breakpoint counter 36 can be coupled to the first comparator 16 and the breakpoint configuration register 31, respectively.
  • the first comparator 16 can output a program breakpoint matching flag when the program breakpoint address value is equal to the program instruction address value, indicating that a match event has occurred.
  • the program breakpoint counter 36 can count the match event.
  • the breakpoint configuration register 31 can set the number of breakpoint matches of various breakpoints, and the host computer can set it through the interface protocol module 21; the program breakpoint counter 36 can match the count value equal to the breakpoint. When the number of times, the program breakpoint signal is output.
  • the data breakpoint signal generating unit may include a data breakpoint register 37, a data read/write bus, and a second comparator 38.
  • the data breakpoint register 37 is one or more sets of registers equal to the number of bits of the read/write data bus, and is connected to the interface protocol module 21, and the host computer can use the interface protocol module 21 to set the breakpoint setting information to be set, that is, the data is broken.
  • the point match value is written to the data breakpoint register 37.
  • Second comparison The device 38 is coupled to the data breakpoint register 37 and the data read/write bus, respectively, for use in the output data breakpoint signal.
  • the data breakpoint signal generating unit further includes a data breakpoint counter 39.
  • the data breakpoint counter 39 can be coupled to the second comparator 38 and the breakpoint configuration register 31, respectively.
  • the second comparator 38 compares the data breakpoint value with the data value read and written on the data read/write bus, that is, the data read and written to the data memory/register.
  • the data breakpoint match flag can be output, indicating that a match event occurs; the data breakpoint counter 39 can count the match event and output when the count value is equal to the breakpoint match number set by the breakpoint configuration register 31. Data breakpoint signal.
  • the flag break signal generating unit may include a flag break register 40, a status register 41, and a third comparator 42.
  • the flag breakpoint register 40 is used to store the matching value of the status flag, and is connected to the interface protocol module 21, and the host computer can write the breakpoint setting information to be set, that is, the state flag matching value, to the flag breakpoint register 40 through the interface protocol module 21.
  • a status flag value is stored in status register 41.
  • the third comparator 42 can be coupled to the flag break register 40 and the status register 41, respectively, for outputting a flag break signal when the status flag match value is equal to the status flag value.
  • the flag breakpoint signal generating unit may further include a flag breakpoint counter 43.
  • the flag breakpoint counter 43 can be coupled to the third comparator 42 and the breakpoint configuration register 31, respectively. At this time, the third comparator 42 may output a flag breakpoint matching flag when the state flag matching value is equal to the state flag value, indicating that a matching event has occurred.
  • the flag breakpoint counter 43 can be used to count the match event and output a flag breakpoint signal when the count value is equal to the number of breakpoint matches set by the breakpoint configuration register 31.
  • the breakpoint combination logic module 32 can be compared with the program breakpoint counter 36, data breakpoints described above.
  • the device 39 is connected to the flag breakpoint counter 43, and logically combines the program breakpoint signal, the data breakpoint signal and the flag breakpoint signal generated by the breakpoint configuration register 31 to obtain a total breakpoint flag signal.
  • various breakpoint functions can be realized by judging this signal.
  • the user since the user is predictable for the structure of the program to be debugged, it is used to specifically set the condition of the breakpoint according to its actual needs and the known program structure. For example, if the user wants to execute the A instruction 100 times and the data matching value included in the instruction is equal to a, when the breakpoint is performed at the instruction address, it can set the program breakpoint counter matching number to 100, and The data breakpoint matching value is set to a, and logical and combined are used to obtain a breakpoint flag signal indicating the above breakpoint condition. For another example, if the user wants to perform a breakpoint when the status flag in the B command is b, it can use the flag breakpoint method alone, and set the state flag matching value in the flag breakpoint register to b.
  • breakpoint signal generating unit of the present embodiment has a plurality of types of breakpoint signal generating units, the user can use the flexible breakpoint setting mode according to actual needs, which is convenient.
  • the on-line debugging circuit of the microcontroller of the embodiment increases the type of the breakpoint by setting the breakpoint of the data read/write matching and the breakpoint matched by the state flag, and the function of the breakpoint and the debugger are enhanced.
  • the real-time monitoring capability of the processor running condition can realize the breakpoint debugging method of complex programs more effectively than the breakpoint implementation of the current single program breakpoint mode.
  • Step 401 Receive debug data, and generate breakpoint setting information according to the debug data; receive debug data through an interface protocol module, interpret commands sent by the host computer, and generate breakpoint setting information according to the debug data.
  • Step 402 Generate at least one breakpoint signal according to the breakpoint setting information, where the breakpoint setting information is information other than the program breakpoint address value;
  • the breakpoint setting information may include a data breakpoint matching value.
  • the generating a breakpoint signal according to the breakpoint setting information in the step may include: outputting a data breakpoint signal when the data breakpoint matching value is equal to the transmission value on the data read/write bus.
  • the breakpoint setting information may further include a status flag matching value.
  • the generating the breakpoint signal according to the breakpoint setting information may further include: outputting the flag breakpoint signal when the state flag matching value is equal to the state flag value stored in the status register.
  • the breakpoint setting information may further include a program breakpoint address value; wherein the generating a breakpoint signal according to the breakpoint setting information may further include: the program breakpoint address value is equal to a program instruction address value stored in the program counter When the program breaks the signal.
  • Step 403 Obtain a breakpoint flag signal according to the at least one breakpoint signal.
  • the method further includes: logically combining at least two of the breakpoint signals to obtain a breakpoint flag signal.
  • the method further includes: counting a breakpoint matching flag output by the breakpoint signal generating unit when the matching condition is satisfied, and setting the count value equal to the breakpoint configuration register At least two of the breakpoint signals are output when the number of breakpoint matches.
  • the program breakpoint matching flag is output; when the data breakpoint matching value is equal to the transmission value on the data read/write bus, the input is a data breakpoint match flag; when the state flag match value is equal to a state flag value stored in the status register, the output flag breakpoint match flag is output; the program breakpoint match flag, the data breakpoint match flag, and the flag break
  • the point matching flags are respectively counted; when the count value is equal to the number of breakpoints set by the breakpoint configuration register, the output program breakpoint signal, the data breakpoint signal, and the flag breakpoint signal are respectively output.
  • Step 404 Control the implementation of the online debugging breakpoint according to the breakpoint flag signal, and complete online debugging.
  • the circuit increases the type of breakpoints and enhances the function of the breakpoints, compared with the current single program breakpoint mode.
  • Point implementation can more effectively implement breakpoint debugging methods for complex programs.
  • An embodiment of the present invention provides a microcontroller, where the in-circuit debugging circuit in the microcontroller may include a program breakpoint signal generating unit and at least one first breakpoint signal generating unit, a breakpoint configuration register, and a breakpoint combination logic module.
  • the first breakpoint signal generating unit may be a data breakpoint signal generating unit or a flag breakpoint signal generating unit.
  • the embodiment of the invention further provides a microcontroller, wherein the online debugging circuit in the microcontroller can include a data breakpoint signal generating unit, a flag breakpoint signal generating unit, a breakpoint configuration register, and a breakpoint combination logic module.
  • the program counter, the status register, etc. may be a module set inside the CPU, and the program breakpoint register, the program breakpoint counter, and the breakpoint configuration register may be set inside the microcontroller, Module outside the CPU, the modules are connected to each other The function-independent debug circuit shown.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Description

微控制器在线调试电路及方法、 微控制器 本申请要求于 2010 年 03 月 10 日提交中国专利局、 申请号为 201010123200.8 , 发明名称为 "微控制器在线调试电路及方法、 微控制器" 的中国专利申请的优先权, 其全部内容通过引用结合在本申请中。 技术领域
本发明涉及集成电路测试技术领域, 特别涉及一种微控制器在线调试电 路及方法、 微控制器。 背景技术
微控制器是一种将 CPU内核、 片内存储器和多种外设功能模块集成的通 用微控制器, 随着电子技术的快速发展, 微控制器的应用系统日趋复杂。 微 控制器应用系统的开发和调试有多种方法, 其中一种为在线调试技术, 是将 调试功能模块直接集成到微控制器内部。 调试器上位机只需通过很少的几个 微控制引脚(通常为五根)即可在线对微控制器进行应用程序的开发与调试, 使得开发和调试可以在实际的系统中进行, 这样可以避免开发模拟环境与实 际系统的差异性。
图 1 为现有技术微控制器在线调试电路的结构示意图, 该在线调试电路 集成在前述的微控制器内。 如图 1 所示, 该在线调试电路主要包括接口协议 模块 1 1、 程序执行控制模块 12、 数据存储器 /寄存器读写控制模块 13、 程序 断点寄存器 14、程序计数器 15和第一比较器 16。 其中, 程序断点寄存器 14、 程序计数器 15和第一比较器 16组成了断点标志信号产生模块 24。 在进行微 控制器的调试时,接口协议模块 11可以通过调试时钟线和调试数据线与上位 机进行通讯, 解释上位机发送的命令, 产生调试控制信号, 发送到程序执行 控制模块 12。 程序执行控制模块 12可以接收接口协议模块 11发送的上位机 的调试指令, 并根据该调试指令控制程序的执行, 实现包括全速运行、 暂停 运行、 单步、 步跃等控制、 调试功能。 接口协议模块 11还可以根据上位机的 调试指令控制数据存储器 /寄存器读写控制模块 13 , 以实现对片内存储器 /寄 存器的读 /写控制, 该读 /写的数据可以通过数据读 /写总线进行传输。 上位机 通过接口协议模块 11 将要设置的程序断点地址值写入程序断点寄存器 14; 程序计数器 15 中存储的值为下一条要执行的程序指令的地址。 第一比较器 16可以将程序断点寄存器 14的值与程序计数器 15的当前值进行比较, 如果 二者相等, 表明该程序执行已经到达断点位置, 即可输出断点标志信号。 程 序执行控制模块 12可以根据该断点标志信号, 控制程序在此位置处暂停, 以 执行后续程序调试命令。
以上方案虽然可以实现微控制器基本的调试功能, 可以满足汇编程序的 开发和调试。 但是随着应用系统的复杂度的提高, 微控制器的程序也日趋复 杂, 程序量不断提高; 汇编语言的开发环境已远不能满足需求, C语言等高级 语言在系统开发中被广为采用。 由于微控制器只能运行汇编语言指令, 因此 就需要对使用 C语言编写的程序进行编译,使之转变为汇编程序以支持微控制 器执行。然而,一条 C语言语句经过编译后往往对应几条甚至几十条汇编指令, 且从 C语言语句到汇编指令的编译不是固定的,它取决于编译器的编译算法和 优化算法,从而使得 C语言的一条语句对应到的汇编程序的程序地址也是不确 定的, 因此, 上述现有技术方案中单一的程序地址断点实现方式, 很难支持 C 语言程序的断点调试。 发明内容
本发明提供一种微控制器在线调试电路及方法、 微控制器, 用以解决现 有技术中断点实现方法单一, 不适应复杂程序的断点测试的缺点, 实现可以 精确控制复杂程序的断点调试。
本发明提供一种微控制器在线调试电路, 包括:
接口协议模块, 用于接收调试指令, 并根据所述调试指令产生断点设置 信息;
断点标志信号产生模块, 与所述接口协议模块连接, 用于根据所述断点 设置信息, 产生断点标志信号; 包括用于产生断点信号的断点信号产生单元, 所述断点信号产生单元包括程序断点信号产生单元;
程序执行控制模块, 与所述断点标志信号产生模块连接, 用于根据所述 断点标志信号控制在线调试断点的实现;
所述断点信号产生单元还包括: 至少一个第一断点信号产生单元, 用于 根据所述断点设置信息产生所述断点信号, 所述断点设置信息为程序断点地 址值之外的信息;
所述断点标志信号产生模块还包括:
断点配置寄存器, 与所述接口协议模块连接, 用于从所述接口协议模块 接收断点设置信息即逻辑组合的方式;
断点组合逻辑模块, 分别与所述断点信号产生单元和断点配置寄存器连 接, 用于根据所述逻辑组合的方式对所述断点信号产生单元产生的断点信号 进行逻辑组合得到所述断点标志信号。
本发明还提供一种微控制器在线调试电路, 包括:
接口协议模块, 用于接收调试数据, 并根据所述调试数据产生断点设置 信息;
断点标志信号产生模块, 与所述接口协议模块连接, 用于根据所述断点 设置信息, 产生断点标志信号; 所述断点标志信号产生模块包括用于产生断 点信号的断点信号产生单元;
程序执行控制模块, 与所述断点标志信号产生模块连接, 用于根据所述 断点标志信号控制在线调试断点的实现;
所述断点信号产生单元包括数据断点信号产生单元和标志断点信号产生 单元;
所述数据断点信号产生单元, 包括:
数据断点寄存器, 与所述接口协议模块连接, 用于从所述接口协议 模块接收断点设置信息即数据断点匹配值;
数据读写总线, 用于读写传输值;
第二比较器, 分别与所述数据断点寄存器和数据读写总线连接, 用 于在所述数据断点匹配值与所述数据读写总线上的传输值相等时, 输出数据 断点信号;
所述标志断点信号产生单元, 包括:
标志断点寄存器, 与所述接口协议模块连接, 用于从所述接口协议 模块接收断点设置信息即状态标志匹配值;
状态寄存器, 存储有状态标志值; 第三比较器, 分别与所述标志断点寄存器和状态寄存器连接, 用于 在所述状态标志匹配值与所述状态标志值相等时, 输出标志断点信号;
所述断点标志信号产生模块还包括:
断点配置寄存器, 与所述接口协议模块连接, 用于从所述接口协议 模块接收断点设置信息即逻辑组合的方式;
断点组合逻辑模块, 分别与所述断点信号产生单元和断点配置寄存 器连接, 用于根据所述逻辑组合的方式对所述断点信号产生单元产生的断点 信号进行逻辑组合得到所述断点标志信号。
本发明提供一种微控制器在线调试方法, 包括:
接收调试数据, 并根据所述调试数据产生断点设置信息;
根据所述断点设置信息产生至少一个断点信号, 所述断点设置信息为所 述程序断点地址值之外的信息, 并根据所述至少一个断点信号得到断点标志 信号;
根据所述断点标志信号控制在线调试断点的实现, 完成在线调试。
本发明提供两种微控制器, 该两种微控制器可以分别包括上述的两种微 控制器在线调试电路。
本发明的微控制器在线调试电路及方法、 微控制器, 通过在原有的程序 断点方式的基础上, 增加数据断点和状态标志断点等方式, 使得该电路增加 了断点的种类, 增强了断点的功能, 相对于目前单一的程序断点方式的断点 实现, 可以更为有效地实现复杂程序的断点调试方法。 附图说明 为了更清楚地说明本发明的技术方案, 下面将对或现有技术描述中所需 要使用的附图作一简单地介绍。 显而易见地, 下面描述中的附图是本发明的 一些, 对于本领域普通技术人员来讲, 在不付出创造性劳动性的前提下, 还 可以根据这些附图获得其他的附图。
图 1为现有技术微控制器在线调试电路的结构示意图;
图 2为本发明微控制器在线调试电路的结构示意图;
图 3为本发明微控制器在线调试方法的流程示意图。 具体实施方式
为使本发明实施例的目的、 技术方案和优点更加清楚, 下面将结合本发 明实施例中的附图, 对本发明实施例中的技术方案进行清楚、 完整地描述, 显然, 所描述的实施例是本发明一部分实施例, 而不是全部的实施例。 基于 本发明中的实施例, 本领域普通技术人员在没有作出创造性劳动前提下所获 得的所有其他实施例, 都属于本发明保护的范围。
本发明的主要技术方案为, 在现有技术的微控制器在线调试电路的基础 上, 对断点标志信号产生模块进行了改进, 增加了断点的种类, 使得该模块 中的用于产生断点信号的断点信号产生单元还可以包括至少一个第一断点信 号产生单元, 该第一断点信号产生单元可以根据程序断点地址值之外的断点 设置信息产生断点信号, 即其可以采用程序地址断点方式之外的方式进行断 点的设置; 从而相对于目前单一的程序断点方式的断点实现, 可以更为有效 地利用其他断点方式实现复杂程序的断点调试方法。
下面通过附图和具体实施例,对本发明的技术方案做进一步的详细描述。 图 2为本发明微控制器在线调试电路实施例的结构示意图,如图 2所示, 本实施例的微控制器在线调试电路主要包括接口协议模块 21、 程序执行控制 模块 22、 数据存储器 /寄存器读写控制模块 13和断点标志信号产生模块 24。
其中,接口协议模块 21可以通过调试时钟线和调试数据线与上位机进行 通讯, 接收调试数据, 解释上位机发送的命令, 产生调试控制信号发送至程 序执行控制模块 22; 还可以设置相关调试寄存器, 控制在线调试器的其他模 块工作, 并将上位机所需的数据信息通过串行协议发送给上位机。 程序执行 控制模块 22可以根据该调试控制信号控制程序指令的执行, 包括实现全速运 行、 暂停运行、 单步、 步跃等功能。 数据存储器 /寄存器读写控制模块 13 通 过数据读 /写总线与接口协议模块 21连接, 可以接收接口协议模块 21发出的 读 /写数据存储器 /寄存器命令, 并通过数据读 /写总线完成数据存储器 /寄存器 的读 /写功能。 断点标志信号产生模块 24与接口协议模块 21连接, 可以接收 接口协议模块 21根据所述调试数据产生的断点设置信息,并根据所述断点设 置信息产生断点标志信号。程序执行控制模块 22可以根据该断点标志信号控 制在线调试断点的实现, 实现断点的功能。
本实施例的在线调试电路与现有技术的主要区别在于: 现有技术中的断 点标志信号产生模块 24只包括程序断点信号产生单元,而本实施例的断点标 志信号产生模块 24 可以包括其他的非程序地址断点方式的断点信号产生单 元。 例如, 该断点标志信号产生模块 24可以包括数据断点信号产生单元, 该 数据断点信号产生单元可以产生数据断点信号; 或者, 也可以包括标志断点 信号产生单元, 该标志断点信号产生单元可以产生标志断点信号。 当采用高 级语言编译的程序无法利用程序地址断点方式实现断点时, 就可以根据数据 断点信号, 在设置的数据断点匹配值的位置进行断点; 或者, 也可以根据标 志断点信号, 在设置的状态标志匹配值的位置进行断点。 从而使得断点的功 能增强, 可以采用多种方式较为灵活地实现程序的断点; 且相对于目前单一 的程序地址断点方式, 能够更有效地进行高级语言程序的断点调试。
其中,在断点标志信号产生模块 24中可以单独设置数据断点信号产生单 元, 也可以单独设置标志断点信号产生单元, 或者, 也可以同时设置上述两 个断点信号产生单元。 此外, 数据断点信号产生单元和标志断点信号产生单 元只是其中的两个例子, 本领域技术人员可以理解, 在实际的程序调试中, 可以根据用户的需要以及所要调试的实际程序, 灵活地设置各种断点种类; 基于多种高级语言类型及各种微控制器的组合, 可以根据实际情况设置多种 组合逻辑方式以及断点实现方式, 在此不再贅述。
断点标志信号产生模块 24 也可以在现有的程序断点信号产生单元的基 础上, 增加多个其他断点种类的第一断点信号产生单元, 该第一断点信号产 生单元的增加可以使得断点的设置更加灵活。
本实施例以图 2所示的微控制器在线调试电路为例, 对其中的一种可行 的结构进行说明。 如图 2所示, 该在线调试电路的断点标志信号产生模块 24 可以包括断点信号产生单元和断点信号组合单元。 断点信号产生单元中可以 包括程序断点信号产生单元、 数据断点信号产生单元和标志断点信号产生单 元。 程序断点信号产生单元用于产生程序断点信号, 数据断点信号产生单元 用于产生数据断点信号, 标志断点信号产生单元用于产生标志断点信号。 断 点信号组合单元可以包括断点配置寄存器 31 和断点组合逻辑模块 32, 该断 点配置寄存器 31与接口协议模块 21连接,可以从接口协议模块 21接收断点 设置信息即逻辑组合的方式, 例如与或非等方式; 断点组合逻辑模块 32可以 根据断点配置寄存器 31 设置的逻辑组合的方式对断点信号产生单元产生的 多个断点信号进行逻辑组合得到断点标志信号。
其中, 程序断点信号产生单元可以包括程序断点寄存器 14、 程序计数器 15和第一比较器 16。 程序断点寄存器 14为与程序计数器位数相等的一组或 多组寄存器, 其与接口协议模块 21连接, 上位机可以通过接口协议模块 21 , 将要设置的断点设置信息即程序断点地址值写入程序断点寄存器 14。 程序计 数器 15中存储有下一条将要执行的程序指令地址值; 第一比较器 16分别与 程序断点寄存器 14和程序计数器 15连接,可以用于对程序断点寄存器 14中 存储的程序断点地址值与程序计数器 15中存储的程序指令地址值进行比较, 在二者相等时, 输出程序断点信号。
进一步的, 该程序断点信号产生单元还可以包括程序断点计数器 36。 该 程序断点计数器 36可以分别与第一比较器 16和断点配置寄存器 31连接。此 时, 第一比较器 16在程序断点地址值与程序指令地址值相等时, 可以输出程 序断点匹配标志, 表示出现了一次匹配事件。 程序断点计数器 36可以对该匹 配事件进行计数。 此时, 断点配置寄存器 31可以设置各种断点的断点匹配次 数, 上位机可以通过接口协议模块 21对其进行设置; 程序断点计数器 36可 以在所述计数值等于所述断点匹配次数时, 输出程序断点信号。
数据断点信号产生单元可以包括数据断点寄存器 37、 数据读写总线和第 二比较器 38。 数据断点寄存器 37为与读 /写数据总线位数相等的一组或多组 寄存器, 其与接口协议模块 21 连接, 上位机可以通过接口协议模块 21 , 将 要设置的断点设置信息即数据断点匹配值写入数据断点寄存器 37。 第二比较 器 38分别与数据断点寄存器 37和数据读写总线连接, 可以用于在所述输出 数据断点信号。
进一步的, 该数据断点信号产生单元还包括数据断点计数器 39。 该数据 断点计数器 39可以分别与第二比较器 38和断点配置寄存器 31连接。 当指定 的数据存储器 /寄存器通过数据总线发生读 /写事件时, 第二比较器 38在数据 断点匹配值与所述数据读写总线上的传输值即向数据存储器 /寄存器中读写 的数据相等时, 可以输出数据断点匹配标志, 表示出现了一次匹配事件; 数 据断点计数器 39可以对该匹配事件进行计数,并在计数值等于断点配置寄存 器 31设置的断点匹配次数时, 输出数据断点信号。
标志断点信号产生单元可以包括标志断点寄存器 40、 状态寄存器 41 和 第三比较器 42。 标志断点寄存器 40用于存储状态标志的匹配值, 与接口协 议模块 21 连接, 上位机可以通过接口协议模块 21, 将要设置的断点设置信 息即状态标志匹配值写入标志断点寄存器 40。 状态寄存器 41 中存储有状态 标志值。第三比较器 42可以分别与标志断点寄存器 40和状态寄存器 41连接, 用于在所述状态标志匹配值与所述状态标志值相等时, 输出标志断点信号。
进一步的, 该标志断点信号产生单元还可以包括标志断点计数器 43。 该 标志断点计数器 43可以分别与第三比较器 42和断点配置寄存器 31连接。此 时, 第三比较器 42在状态标志匹配值与所述状态标志值相等时, 可以输出标 志断点匹配标志, 表示出现了一次匹配事件。 标志断点计数器 43可以用于对 该匹配事件进行计数,并在计数值等于断点配置寄存器 31设置的断点匹配次 数时, 输出标志断点信号。
断点组合逻辑模块 32可以和上述的程序断点计数器 36、 数据断点计数 器 39和标志断点计数器 43连接, 根据断点配置寄存器 31的相关设置, 将其 产生的程序断点信号、 数据断点信号和标志断点信号进行逻辑组合得到总的 断点标志信号。 程序执行控制模块 22在全速运行时, 就可以通过判断此信号 实现各种断点功能。
具体的, 由于用户对其所调试的程序的结构是可预知的, 因此, 用于可 以根据其实际需要以及已知的程序结构, 具体设定断点的条件。 例如, 用户 想在 A指令执行 100次时, 且该指令中包括的数据匹配值等于 a时, 在该指 令地址处进行断点, 则其可以设置程序断点计数器的匹配次数为 100 , 并将 数据断点匹配值设置为 a,二者之间进行逻辑与组合, 即可得到表示上述断点 条件的断点标志信号。再如,用户想在 B指令中的状态标志为 b时进行断点, 则其可以单独采用标志断点方式, 将标志断点寄存器中的状态标志匹配值设 置为 b即可。 以上只是举例说明, 本领域技术人员可以理解, 实际使用中, 还可以灵活的进行各种断点种类的设置。 由于本实施例的断点标志信号产生 模块中设置了多种类的断点信号产生单元, 因此, 用户可以根据实际需要釆 用灵活地断点设置方式, 较为方便。
本实施例的微控制器在线调试电路, 通过设置数据读 /写匹配的断点和状 态标志匹配的断点等方式, 使得该电路增加了断点的种类, 增强了断点的功 能和调试器对微处理器运行情况的实时监控能力, 相对于目前单一的程序断 点方式的断点实现, 可以更为有效地实现复杂程序的断点调试方法。
图 3为本发明微控制器在线调试方法实施例的流程示意图,如图 3所示, 该在线调试方法简写如下, 其具体步骤可以结合参见上述微控制器在线调试 电路实施例。 该方法可以包括: 步骤 401、 接收调试数据, 并根据所述调试数据产生断点设置信息; 可以通过接口协议模块接收调试数据, 解释上位机发送的命令, 并根据 所述调试数据产生断点设置信息。
步骤 402、 根据断点设置信息产生至少一个断点信号, 所述断点设置信 息为所述程序断点地址值之外的信息;
具体的, 断点设置信息可以包括数据断点匹配值。 该步骤中的根据断点 设置信息产生断点信号, 可以包括: 在所述数据断点匹配值与数据读写总线 上的传输值相等时, 输出数据断点信号。
进一步的, 断点设置信息还可以包括状态标志匹配值。 其中的根据断点 设置信息产生断点信号, 还可以包括: 在所述状态标志匹配值与状态寄存器 中存储的状态标志值相等时, 输出标志断点信号。
所述断点设置信息还可以包括程序断点地址值; 其中的根据断点设置信 息产生断点信号, 还可以包括: 在所述程序断点地址值与程序计数器中存储 的程序指令地址值相等时, 输出程序断点信号。
步骤 403、 根据所述至少一个断点信号得到断点标志信号;
进一步的, 当所述断点信号的数量为至少两个时, 还可以包括: 对至少 两个所述断点信号进行逻辑组合, 得到断点标志信号。
此外, 对至少两个所述断点信号进行逻辑组合之前, 还可以包括: 对断 点信号产生单元在满足匹配条件时输出的断点匹配标志进行计数, 并在计数 值等于断点配置寄存器设置的断点匹配次数时,输出至少两个所述断点信号。
具体的, 在所述程序断点地址值与程序指令地址值相等时, 输出程序断 点匹配标志; 在所述数据断点匹配值与数据读写总线上的传输值相等时, 输 出数据断点匹配标志; 在所述状态标志匹配值与状态寄存器中存储的状态标 志值相等时, 输出标志断点匹配标志; 对所述程序断点匹配标志、 数据断点 匹配标志和标志断点匹配标志分别进行计数; 在计数值与断点配置寄存器设 置的断点匹配次数相等时, 分别对应输出程序断点信号、 数据断点信号和标 志断点信号。
步骤 404、 根据所述断点标志信号控制在线调试断点的实现, 完成在线 调试。
本实施例的微控制器在线调试方法, 通过设置数据断点和状态标志断点 等方式, 使得该电路增加了断点的种类, 增强了断点的功能, 相对于目前单 一的程序断点方式的断点实现, 可以更为有效地实现复杂程序的断点调试方 法。
本发明实施例提供了一种微控制器, 该微控制器中的在线调试电路可以 包括程序断点信号产生单元和至少一个第一断点信号产生单元、 断点配置寄 存器和断点组合逻辑模块。 该第一断点信号产生单元可以为数据断点信号产 生单元或标志断点信号产生单元。
本发明实施例还提供了一种微控制器, 该微控制器中的在线调试电路可 以包括数据断点信号产生单元、 标志断点信号产生单元、 断点配置寄存器和 断点组合逻辑模块。
具体的结构可以参见上述实施例所述的微控制器在线调试电路, 在此不 再赘述。 其中, 在该微控制器中, 例如, 程序计数器、 状态寄存器等可以为 设置在 CPU内部的模块, 程序断点寄存器、 程序断点计数器和断点配置寄存 器等可以为设置在微控制器内部、 CPU外部的模块, 该模块之间相连接组成 图示的功能独立的调试电路。
本领域普通技术人员可以理解: 实现上述方法实施例的全部或部分步骤 可以通过程序指令相关的硬件来完成, 前述的程序可以存储于一计算机可读 取存储介质中, 该程序在执行时, 执行包括上述方法实施例的步骤; 而前述 的存储介质包括: ROM、 RAM、 磁碟或者光盘等各种可以存储程序代码的介 质。
最后应说明的是: 以上实施例仅用以说明本发明的技术方案, 而非对其 限制; 尽管参照前述实施例对本发明进行了佯细的说明, 本领域的普通技术 人员应当理解: 其依然可以对前述各实施例所记载的技术方案进行修改, 或 者对其中部分技术特征进行等同替换; 而这些修改或者替换, 并不使相应技 术方案的本质脱离本发明各实施例技术方案的精神和范围。

Claims

权利要求
1、 一种微控制器在线调试电路, 包括:
接口协议模块, 用于接收调试数据, 并根据所述调试数据产生断点设置 信息;
断点标志信号产生模块, 与所述接口协议模块连接, 用于根据所述断点 设置信息, 产生断点标志信号; 包括用于产生断点信号的断点信号产生单元, 所述断点信号产生单元包括程序断点信号产生单元;
程序执行控制模块, 与所述断点标志信号产生模块连接, 用于根据所述 断点标志信号控制在线调试断点的实现;
其特征在于, 所述断点信号产生单元还包括: 至少一个第一断点信号产 生单元, 用于根据所述断点设置信息产生所述断点信号, 所述断点设置信息 为程序断点地址值之外的信息;
所述断点标志信号产生模块还包括:
断点配置寄存器, 与所述接口协议模块连接, 用于从所述接口协议模块 接收断点设置信息即逻辑组合的方式;
断点组合逻辑模块, 分别与所述断点信号产生单元和断点配置寄存器连 接, 用于根据所述逻辑组合的方式对所述断点信号产生单元产生的断点信号 进行逻辑组合得到所述断点标志信号。
2、 根据权利要求 1所述的微控制器在线调试电路, 其特征在于, 所述第 一断点信号产生单元为数据断点信号产生单元, 包括:
数据断点寄存器, 与所述接口协议模块连接, 用于从所述接口协议 模块接收断点设置信息即数据断点匹配值;
数据读写总线, 用于读写传输值; 第二比较器, 分别与所述数据断点寄存器和数据读写总线连接, 用 于在所述数据断点匹配值与所述数据读写总线上的传输值相等时, 输出数据 断点信号。
3、 根据权利要求 1或 2所述的微控制器在线调试电路, 其特征在于, 所 述第一断点信号产生单元为标志断点信号产生单元, 包括:
标志断点寄存器, 与所述接口协议模块连接, 用于从所述接口协议 模块接收断点设置信息即状态标志匹配值;
状态寄存器, 存储有状态标志值;
第三比较器, 分别与所述标志断点寄存器和状态寄存器连接, 用于 在所述状态标志匹配值与所述状态标志值相等时 , 输出标志断点信号。
4、 根据权利要求 3所述的微控制器在线调试电路, 其特征在于, 所述断 点配置寄存器, 还用于设置断点匹配次数;
所述断点标志信号产生模块, 还包括计数器, 所述计数器分别与所述断 点信号产生单元、 断点配置寄存器和断点组合逻辑模块连接, 用于对所述断 点信号产生单元在满足匹配条件时输出的断点匹配标志进行计数, 并在计数 值等于所述断点匹配次数时, 输出断点信号至所述断点组合逻辑模块。
5、 一种微控制器在线调试电路, 包括:
接口协议模块, 用于接收调试数据, 并根据所述调试数据产生断点设置 信息;
断点标志信号产生模块, 与所述接口协议模块连接, 用于根据所述断点 设置信息, 产生断点标志信号; 所述断点标志信号产生模块包括用于产生断 点信号的断点信号产生单元;
程序执行控制模块, 与所述断点标志信号产生模块连接, 用于根据所述 断点标志信号控制在线调试断点的实现;
其特征在于, 所述断点信号产生单元包括数据断点信号产生单元和标志 断点信号产生单元;
所述数据断点信号产生单元, 包括:
数据断点寄存器, 与所述接口协议模块连接, 用于从所述接口协议 模块接收断点设置信息即数据断点匹配值;
数据读写总线, 用于读写传输值;
第二比较器, 分别与所述数据断点寄存器和数据读写总线连接, 用 于在所述数据断点匹配值与所述数据读写总线上的传输值相等时, 输出数据 断点信号;
所述标志断点信号产生单元, 包括:
标志断点寄存器, 与所述接口协议模块连接, 用于从所述接口协议 模块接收断点设置信息即状态标志匹配值;
状态寄存器, 存储有状态标志值;
第三比较器, 分别与所述标志断点寄存器和状态寄存器连接, 用于 在所述状态标志匹配值与所述状态标志值相等时, 输出标志断点信号;
所述断点标志信号产生模块还包括:
断点配置寄存器, 与所述接口协议模块连接, 用于从所述接口协议 模块接收断点设置信息即逻辑组合的方式;
断点组合逻辑模块, 分别与所述断点信号产生单元和断点配置寄存 器连接, 用于根据所述逻辑组合的方式对所述断点信号产生单元产生的断点 信号进行逻辑组合得到所述断点标志信号。
6、 根据权利要求 5所述的微控制器在线调试电路, 其特征在于, 所述断 点配置寄存器, 还用于设置断点匹配次数;
所述断点标志信号产生模块, 还包括计数器, 所述计数器分别与所述断 点信号产生单元、 断点配置寄存器和断点组合逻辑模块连接, 用于对所述断 点信号产生单元在满足匹配条件时输出的断点匹配标志进行计数, 并在计数 值等于所述断点匹配次数时, 输出断点信号至所述断点组合逻辑模块。
7、 一种微控制器在线调试方法, 其特征在于, 包括:
接收调试数据, 并根据所述调试数据产生断点设置信息;
根据所述断点设置信息产生至少一个断点信号, 所述断点设置信息为所 述程序断点地址值之外的信息, 并根据所述至少一个断点信号得到断点标志 信号;
根据所述断点标志信号控制在线调试断点的实现, 完成在线调试。
8、 根据权利要求 7所述的微控制器在线调试方法, 其特征在于, 所述断 点设置信息包括数据断点匹配值; 所述根据所述断点设置信息产生至少一个 断点信号, 包括:
在所述数据断点匹配值与数据读写总线上的传输值相等时, 输出数据断 点信号。
9、 根据权利要求 7或 8所述的微控制器在线调试方法, 其特征在于, 所 述断点设置信息还包括状态标志匹配值; 所述根据所述断点设置信息产生至 少一个断点信号, 包括:
在所述状态标志匹配值与状态寄存器中存储的状态标志值相等时, 输出 标志断点信号。
10、 根据权利要求 9所述的微控制器在线调试方法, 其特征在于, 所述 断点设置信息还包括程序断点地址值; 所述根据所述断点设置信息产生至少 一个断点信号, 包括:
在所述程序断点地址值与程序计数器中存储的程序指令地址值相等时, 输出程序断点信号。
11、 根据权利要求 7所述的微控制器在线调试方法, 其特征在于, 当所 述断点信号的数量为至少两个时, 还包括:
对至少两个所述断点信号进行逻辑组合, 得到断点标志信号。
12、 根据权利要求 11所述的微控制器在线调试方法, 其特征在于, 所述 对至少两个所述断点信号进行逻辑组合之前, 还包括:
对断点信号产生单元在满足匹配条件时输出的断点匹配标志进行计数, 并在计数值等于断点配置寄存器设置的断点匹配次数时, 输出至少两个所述 断点信号。
13、 一种微控制器, 包括微控制器在线调试电路, 其特征在于, 所述微 控制器在线调试电路包括:
接口协议模块, 用于接收调试数据, 并根据所述调试数据产生断点设置 信息;
断点标志信号产生模块, 与所述接口协议模块连接, 用于根据所述断点 设置信息, 产生断点标志信号;
程序执行控制模块, 与所述断点标志信号产生模块连接, 用于根据所述 断点标志信号控制在线调试断点的实现; 包括用于产生断点信号的断点信号 产生单元, 所述断点信号产生单元包括程序断点信号产生单元;
其特征在于, 所述断点信号产生单元还包括: 至少一个第一断点信号产 生单元, 用于根据所述断点设置信息产生所述断点信号, 所述断点设置信息 为程序断点地址值之外的信息; 所述断点标志信号产生模块还包括:
断点配置寄存器, 与所述接口协议模块连接, 用于从所述接口协议模块 接收断点设置信息即逻辑组合的方式;
断点组合逻辑模块, 分别与所述断点信号产生单元和断点配置寄存器连 接, 用于根据所述逻辑组合的方式对所述断点信号产生单元产生的断点信号 进行逻辑组合得到所述断点标志信号。
14、 根据权利要求 13所述的微控制器, 其特征在于, 所述第一断点信号 产生单元为数据断点信号产生单元, 包括:
数据断点寄存器, 与所述接口协议模块连接, 用于从所述接口协议 模块接收断点设置信息即数据断点匹配值;
数据读写总线, 用于读写传输值;
第二比较器, 分别与所述数据断点寄存器和数据读写总线连接, 用 于在所述数据断点匹配值与所述数据读写总线上的传输值相等时, 输出数据 断点信号。
15、 根据权利要求 13或 14所述的微控制器, 其特征在于, 所述第一断 点信号产生单元为标志断点信号产生单元, 包括:
标志断点寄存器, 与所述接口协议模块连接, 用于从所述接口协议 模块接收断点设置信息即状态标志匹配值;
状态寄存器, 存储有状态标志值;
第三比较器, 分别与所述标志断点寄存器和状态寄存器连接, 用于 在所述状态标志匹配值与所述状态标志值相等时 , 输出标志断点信号。
16、 根据权利要求 15所述的微控制器, 其特征在于, 所述断点配置寄存 器, 还用于设置断点匹配次数; 所述断点标志信号产生模块, 还包括计数器, 所述计数器分别与所述断 点信号产生单元、 断点配置寄存器和断点组合逻辑模块连接, 用于对所述断 点信号产生单元产生的断点信号进行计数, 并在计数值等于所述断点匹配次 数时, 输出断点信号至所述断点组合逻辑模块。
17、 一种微控制器, 包括微控制器在线调试电路, 其特征在于, 所述微 控制器在线调试电路包括:
接口协议模块, 用于接收调试数据, 并根据所述调试数据产生断点设置 信息;
断点标志信号产生模块, 与所述接口协议模块连接, 用于根据所述断点 设置信息, 产生断点标志信号; 所述断点标志信号产生模块包括用于产生断 点信号的断点信号产生单元;
程序执行控制模块, 与所述断点标志信号产生模块连接, 用于根据所述 断点标志信号控制在线调试断点的实现;
所述断点信号产生单元包括数据断点信号产生单元和标志断点信号产生 单元;
所述数据断点信号产生单元, 包括:
数据断点寄存器, 与所述接口协议模块连接, 用于从所述接口协议 模块接收断点设置信息即数据断点匹配值;
数据读写总线, 用于读写传输值;
第二比较器, 分别与所述数据断点寄存器和数据读写总线连接, 用 于在所述数据断点匹配值与所述数据读写总线上的传输值相等时, 输出数据 断点信号;
所述标志断点信号产生单元, 包括: 标志断点寄存器, 与所述接口协议模块连接, 用于从所述接口协议 模块接收断点设置信息即状态标志匹配值;
状态寄存器, 存储有状态标志值;
第三比较器, 分别与所述标志断点寄存器和状态寄存器连接, 用于 在所述状态标志匹配值与所述状态标志值相等时 , 输出标志断点信号;
所述断点标志信号产生模块还包括:
断点配置寄存器, 与所述接口协议模块连接, 用于从所述接口协议 模块接收断点设置信息即逻辑组合的方式;
断点组合逻辑模块, 分别与所述断点信号产生单元和断点配置寄存 器连接, 用于根据所述逻辑组合的方式对所述断点信号产生单元产生的断点 信号进行逻辑组合得到所述断点标志信号。
18、 根据权利要求 17所述的微控制器, 其特征在于, 所述断点配置寄存 器, 还用于设置断点匹配次数;
所述断点标志信号产生模块, 还包括计数器, 所述计数器分别与所述断 点信号产生单元、 断点配置寄存器和断点组合逻辑模块连接, 用于对所述断 点信号产生单元在满足匹配条件时输出的断点匹配标志进行计数, 并在计数 值等于所述断点匹配次数时, 输出断点信号至所述断点组合逻辑模块。
PCT/CN2010/074120 2010-03-10 2010-06-21 微控制器在线调试电路及方法、微控制器 WO2011109971A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201010123200.8 2010-03-10
CN201010123200.8A CN102193860B (zh) 2010-03-10 2010-03-10 微控制器在线调试电路及方法、微控制器

Publications (1)

Publication Number Publication Date
WO2011109971A1 true WO2011109971A1 (zh) 2011-09-15

Family

ID=44562809

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2010/074120 WO2011109971A1 (zh) 2010-03-10 2010-06-21 微控制器在线调试电路及方法、微控制器

Country Status (2)

Country Link
CN (1) CN102193860B (zh)
WO (1) WO2011109971A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107305526A (zh) * 2016-04-22 2017-10-31 深圳市博巨兴实业发展有限公司 一种用于微控制器的调试器
TWI854414B (zh) 2022-12-27 2024-09-01 瑞昱半導體股份有限公司 用來進行晶片內部的除錯控制的設備以及方法

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102662847B (zh) * 2012-04-23 2015-01-21 中颖电子股份有限公司 基于闪存应用的嵌入式系统的程序调试系统及方法
US9419621B1 (en) 2015-09-18 2016-08-16 Freescale Semiconductor, Inc. System on chip and method of operating a system on chip
CN107168867A (zh) * 2017-03-22 2017-09-15 深圳市博巨兴实业发展有限公司 一种实现微控制器芯片的用户debug模式的方法
CN112540288B (zh) * 2020-11-30 2023-02-21 海光信息技术股份有限公司 用于硅后芯片验证的方法、系统、设备以及存储介质

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1841338A (zh) * 2005-04-01 2006-10-04 北京清华同方微电子有限公司 一种用于智能卡仿真调试系统的硬件断点电路
US20070226473A1 (en) * 2006-03-13 2007-09-27 Arm Limited Breakpointing on register access events or I/O port access events
CN101458652A (zh) * 2007-12-14 2009-06-17 上海海尔集成电路有限公司 微控制器嵌入式在线仿真调试系统

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100337149B1 (ko) * 2000-07-05 2002-05-18 권 기 홍 프로그램 테스트 및 디버깅이 용이한 중앙처리장치
WO2006079962A2 (en) * 2005-01-28 2006-08-03 Nxp B.V. Means and method for debugging

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1841338A (zh) * 2005-04-01 2006-10-04 北京清华同方微电子有限公司 一种用于智能卡仿真调试系统的硬件断点电路
US20070226473A1 (en) * 2006-03-13 2007-09-27 Arm Limited Breakpointing on register access events or I/O port access events
CN101458652A (zh) * 2007-12-14 2009-06-17 上海海尔集成电路有限公司 微控制器嵌入式在线仿真调试系统

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107305526A (zh) * 2016-04-22 2017-10-31 深圳市博巨兴实业发展有限公司 一种用于微控制器的调试器
CN107305526B (zh) * 2016-04-22 2023-04-11 深圳市博巨兴微电子科技有限公司 一种用于微控制器的调试器
TWI854414B (zh) 2022-12-27 2024-09-01 瑞昱半導體股份有限公司 用來進行晶片內部的除錯控制的設備以及方法

Also Published As

Publication number Publication date
CN102193860B (zh) 2015-04-22
CN102193860A (zh) 2011-09-21

Similar Documents

Publication Publication Date Title
CN110603528B (zh) 调试系统和方法
KR100350568B1 (ko) 디버그기능을수행하기위한데이타처리시스템및방법
TWI588837B (zh) 具除錯控制器的系統單晶片及其操作方法
TWI506397B (zh) 非同步時鐘領域之間的資料傳送
EP3369015B1 (en) Methods and circuits for debugging circuit designs
TWI461908B (zh) 於即時指令追蹤紀錄中之除錯動作的選擇性紀錄技術
CN107907814B (zh) 一种提高芯片量产测试效率的方法
WO2023039988A1 (zh) 一种总线控制器的执行方法、装置、总线控制器、计算机设备和存储介质
KR101547163B1 (ko) 멀티-스레드형 데이터 프로세싱 시스템에서 사용하기 위한 디버그 명령
WO2011109971A1 (zh) 微控制器在线调试电路及方法、微控制器
US8626965B2 (en) Using a DMA engine to automatically validate DMA data paths
CN102147831A (zh) 逻辑验证方法和装置
KR20150008428A (ko) 명령어 트레이스 기능을 갖춘 프로세서 디바이스
CN111177067B (zh) 一种片上系统
US9581643B1 (en) Methods and circuits for testing partial circuit designs
CN111008133B (zh) 粗粒度数据流架构执行阵列的调试方法及装置
JPH10326203A (ja) 複数のハードウェア環境上においてプログラムを別々に動作させつつも、ハードウェア環境間で動作状態を継承し合うことができるデバッグ装置
JP2020140380A (ja) 半導体装置及びデバッグシステム
JP2013109673A (ja) シミュレーション装置、シミュレーション方法、およびシミュレーションプログラム
CN109542698A (zh) 一种基于变异测试的虚拟原型错误检测方法
CN103969574A (zh) 应用FPGA实现ATE测试波形的Verilog编码方法
JP2007156728A (ja) 論理検証方法及び論理検証システム
Shilaskar et al. Post Silicon Validation for I2C (SMBUS) Peripheral
Shveida et al. Implementation of Hardware Trace Buffer Module for RISC-V Processor Core
Valentina et al. Human machine interface for virtual prototyping of industrial instruments

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 10847229

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 10847229

Country of ref document: EP

Kind code of ref document: A1