Debug peripheral for microcomputers, microprocessors and core processor integrated circuits and system using the same

Abstract: A debug peripheral (16) is provided for real-time in-circuit emulation for high speed microcontrollers and microprocessors. The debug perhipheral (16) is a single-word dual-port memory with parallel read-write access on one side, and synchronous, full-duplex serial read-write access on the other side. A shift register (22) in the debug peripheral (16) functions as an instruction memory for a core central processing unit (CPU) (12). Three-­ pins (28,30,32) on the debug peripheral (16) provide the serial interface to an external development system, while parallel access is via a normal connection to the CPU internal bus (18). The debug peripheral (16) is addressed at a number of adjacent locations in the CPU (12) memory space. During emulation (debug) mode, the CPU (12) fetches instructions from the debug peripheral (16), rather than the memory (14). Instructions are serially loaded into the shift register (22) from the development system, via the serial interface, and transferred to the CPU via the parallel interface.

Description: Field of the Invention This invention relates to development systems tools, and more particularly to a standard debug peripheral for providing development systems support. Background of the Invention Today's high-performance microprocessors and microcomputers place ever increasing demands on the development system tools used for debugging these sophisticated integrated circuits. Moreover, the increasing variety of standard and custom/core microcomputer (MCU) designs, necessitates a fundamental change in the design of development system tools. New microprocessors (MPU), designed to operate at clock speeds upwards of 33MHz, push development system technology to its limit. Meanwhile, the widespread usage of existing central processing unit (CPU) designs for the processor core in MCUs imposes constraints on the design of development system tools. As the design cycle for these standard and custom/core MCUs shortens, concurrent availability of development system tools becomes increasingly problematic. Consequently, the problem is one of timely availability of high performance development system tools to support the wide variety of microprocessors and microcomputers entering the marketplace. The traditional design approach for development system support relies upon in-circuit emulation to debug the MCU/MPU prototype software/hardware. Typically, in-circuit emulation allows the software designer to trace the execution of the software by stopping the program execution, at various intervals, and examining the contents of the internal registers, memory locations, and the like. In some designs the in-circuit emulator operates in a foreground and background mode, whereby the emulator processes the application program (non-emulation) in the foreground mode and the debugging program (emulation) in the background mode. Accordingly, the in-circuit emulator switches banks between foreground and background memory space during the execution and debugging of the user program, therefore, the MCU must operate in an expanded mode, necessitating the reconstruction of I/O ports which are lost to the external bus interface. Generally, the switch back and forth between the foreground (user) and background (debugging) memory banks requires substantial amounts of external buffer circuitry, to facilitate the operation of the MCU in an expanded mode. Often this additional buffer circuitry degrades the performance of the emulator, and thus prevents real-time circuit emulation. Since the implementation of the foreground/background memory bank switch requires a substantial amount of external circuitry, an emulator pod is used rather than a small daughter-board probe. The design of the resultant emulator pod is time consuming, and costly due to the required development system engineering expenses. European patent application no. EP-A-0191632 teaches the use of a ROM emulator for diagnostic testing of a microprocessor-based system. The ROM emulator gains control of the microprocessor in the device under test (DUT), and then causes the microprocessor to run a series of diagnostic tests that are controlled by an external computer (i.e. development system). In the user mode, a ROM provides operating instructions to the microprocessor. In the debugging mode, the ROM emulator provides the operating instructions to the microprocessor. Thus, the arrangement described in this European patent application essentially disables the ROM in the DUT and inserts a ROM emulator that is connected via a ribbon cable to the DUT through a parallel I/O port. The ROM emulator of this application illustrates the above referenced problems; the switch back and forth between the foreground (user) memory bank and the background (debugging) memory bank requires substantial amounts of external buffer circuitry, to facilitate the operation of the DUT in an expanded mode. In the prior art, system designers employed port-replacement devices or bond out devices, in an effort to reduce the amount of external circuitry required. The primary disadvantage of using a port-replacement or bond out device is the requirement for additional design and maintenance resources. Essentially, the system designer must allocate design resources for the port-replace or bond out device, in addition to those resources required for the MCU/MPU design. Yet another approach, disclosed in EP-A-0313848 of Motorola Inc., is to integrate a background mode into the CPU core. This solution is optimal in some cases, however, it is often infeasible to make anything other than minor modifications to existing CPU cores. Summary of the Invention An object of the present invention is to provide the capability for back ground mode processing in an existing CPU core without modification to the core design. Another object of the present invention is to provide real-time in-circuit emulators for MCUs or MPUs of arbitrarily high clock speeds. Yet another object of the present invention is to provide a method for substantially reducing the design cycle time for development systems tools. In accordance with a present invention there is provided a debug peripheral for a data processing system, said data processing system being coupled to an external source, and having a data processor for executing a first sequence of instructions received from an instruction memory, via an internal communications bus, and for executing a sequence of debugging instructions received from the debug peripheral, via said internal communications bus, said debug peripheral comprising: a plurality of external terminals; control means, coupled to at least one of said plurality of external terminals, for receiving a debug initiation signal from said external source, and for assuming control of said processor, by providing a debug interrupt signal to said processor, in response to said debug initiation signal; register means coupled to said internal communications bus for storing information received from said processor and for storing said alternate sequence of instructions received from said external source, said register means comprising: a serial interface, coupled to said external source via at least one of said plurality of external terminals, for receiving said externally provided debugging instructions, and for simultaneously providing data received from said processor, to said external source, via said control means, in a debug mode; a parallel interface coupled to said processor via said internal communications bus, for providing said externally provided debugging instructions to said processor, and for receiving data from said processor, in said debug mode; and address decoder means, coupled to said register means, for enabling said register means, in response to an alternate sequence of instruction addresses received from said processor, via said parallel interface, said alternate sequence of instruction addresses corresponding in number to a predefined number of memory addresses designated for said debug peripheral. A data processing system comprising a debug peripheral in accordance with the invention is also disclosed and claimed in claim 2 of the accompanying claims. Brief Description of the Drawings FIG. 1 is a block diagram illustrating a preferred embodiment of a core integrated circuit data processing system. FIG. 2 is a block diagram illustrating a preferred embodiment of the internal architecture of the debug peripheral. Description of the Invention The term "assert", "assertion", "negate" and "negation" will be used to avoid confusion when dealing with a mixture of "active high" and "active low" signals. "Assert" and "assertion" are used to indicate that a signal is rendered active, or logically true. "Negate" and "negation" are used to indicate that a signal is rendered inactive, or logically false. Shown in FIG. 1 is a block diagram of a core integrated circuit (IC) data processing system 10, according to a preferred embodiment of the present invention. The data processing system 10 is comprised generally of a central processing unit (CPU) 12, a memory 14, and a debug peripheral 16. A CPU internal bus 18 facilitates the communication between the CPU 12, and the debug peripheral 16, and memory 14. A development system 20 operates in conjunction with data processing system 10, to assist in the "debugging" of the software and hardware of data processing system 10. The external emulator circuitry of the development system 20 allows the user to perform various functions, such as the insertion of and response to breakpoints, halting the execution of the CPU 12 to examine and alter the contents of various internal registers, and to trace software execution. In the preferred embodiment, data processing system 10 operates in two modes, a user mode and a debug mode. In the user mode, data processing system 10 operates in a conventional manner. The CPU 12 fetches an instruction from the memory 14, decodes the instruction, executes the instruction, and fetches the next instruction in the sequence for execution. Typically, the execution of the program continues in a sequential manner until CPU 12 receives a conditional instruction or an interrupt. The manner in which the CPU 12 handles an interrupt is a function of the processor design. Generally, the occurrence of an interrupt causes CPU 12 to suspend its normal operation, and commence executing an exception processing or interrupt service routine. In the present invention, CPU 12 enters the debug (emulation) mode in response to an interrupt request, which may be the result of an internal event recognizer, or from an external source, such as the development system 20. During emulation (debug mode), CPU 12 fetches instructions from the debug peripheral 16, rather than the memory 14. Accordingly, CPU 12 suspends execution of the user (application) program, stored in memory 14, and commences executing instructions received from debug peripheral 16. Essentially, the debug peripheral 16 functions as an alternate memory in the data processing system 10. Shown in Fig. 2 is a block diagram illustrating a preferred embodiment of the internal architecture of the debug peripheral 16. Debug peripheral 16 is a single-word, dual port memory, with parallel read-write access on one side, and synchronous, full-duplex serial read-write access on the other side. In the preferred embodiment, debug peripheral 16 is comprised of a shift register 22, an address decoder 24, and a controller 26. The serial side of debug peripheral 16 is connected to the development system 20 via serial input pad (S1) 28, serial clock /breakpoint input pad (SCLK/BRK*) 30, and serial output/attention pad (SO/ATTN*) 32, which provide respective signals SERIAL IN, SCLK/BRK*, and SERIAL OUT/ATTN*. Accordingly, the SERIAL IN, SCLK/BRK* and SERIAL OUT/ATTN* signals control the serial transfer of data between the debug peripheral 16 and the development system 20. Parallel access to the debug peripheral 16 is provided by the connection of the instruction/data bus 34 to the CPU internal bus 18, and the debug peripheral 16 is essentially accessed in the same manner as any other on-chip peripheral. Since the instructions may be several words in length, the debug peripheral 16 is addressed at 16 adjacent locations in the CPU 12 memory space. For convenience, the initial address of the debug peripheral 16 is hereafter referred to as DEBUG, and thus, the addresses at which CPU 12 may access the debug peripheral 16 are DEBUG to DEBUG+$F. Data processing system 10 enters the debug mode upon the occurrence of a breakpoint condition, which results in an interrupt to the CPU 12. The breakpoint may be the result of the assertion of the BRK signal externally (by development system 20), or the result of an internal event recognizer consisting of a register and comparator (not shown). In the case where the interrupt is caused by an external BRK signal, controller 26 responds by asserting a debug interrupt request (DEBUG IRQ*) signal to CPU 12. The controller 26 places the DEBUG IRQ* signal on the CPU internal bus 18, causing the CPU 12 to respond, by asserting a debug interrupt acknowledge signal (DEBUG IACK*), and begins execution of a debug interrupt service routine. CPU 12 autovectors to the debug peripheral 16, at address DEBUG, by placing the DEBUG address on the CPU internal bus 18. In response to receiving the DEBUG address, address decoder 24 enables shift register 22, via a SELECT input signal. CPU 12 begins an instruction fetch cycle, from the debug peripheral 16, at address DEBUG. As the instruction cycle begins, the shift register 22 responds by asserting a serial out (SO) signal. The controller 26, which is coupled to the shift register 22, receives the SO signal and asserts the ATTN* signal, thereby indicating that the peripheral requires attention, and notifying the development system 20 of the commencement of the debug instruction cycle. Essentially, the start of the instruction fetch cycle is reflected externally by driving the SO pin from its quiescent high level to a low level. The development system 20 responds by writing an instruction, from the CPU 12 instruction set, into the shift register 22, via SI input 28. The controller 26 receives the SCLK signal from the development system 20, and provides the SCLK signal to the shift register 22. Consequently, the instruction provided by the development system 20 is clocked, with the SCLK signal, into the shift register 22 via the SI input pad 28. As the data is written into the shift register 22, any previous write which the CPU 12 made to the debug peripheral 16 may be simultaneously shifted out, to development system 20, via the SO output pad 32. Consequently, if the CPU 12 performs a write to the debug peripheral 16 before fetching the current instruction or data resident in the debug peripheral 16, the CPU 12 will invalidate the current word in debug peripheral 16. In the event that this occurs, the debug peripheral 16 will notify the development system 20, via a status bit in the serial out stream, to reload that word. Once the instruction is fully assembled in the shift register 22 (without error), the current instruction is placed on the instruction / data bus 34, via the parallel I/O port. The controller 26 then asserts a READY signal, thereby notifying the CPU 12 that the instruction may be transferred. CPU 12 transfers the instruction from the instruction/data bus 34, and completes the instruction fetch cycle. CPU 12 proceeds with execution of the instruction. In order to keep the program execution within the 16 byte DEBUG address space, the subsequent instruction fetched by CPU 12 is either a jump or branch instructions back to DEBUG. The design of the addressing scheme is such that each of the 16 adjacent addresses refers the CPU 12 back to the shift register 22 of debug peripheral 16. Thus, the CPU 12 continues to fetch instructions from debug peripheral 16 at the designated addresses DEBUG to $F, until the debug interlude is complete, and the user wishes to resume executing the application code. Consequently, the mode of operation, normal or debug, is transparent to the CPU 12 since in either mode of operation (normal or debug) the CPU 12 executes the same instruction set. Essentially, the CPU 12 can not discern the difference between the instruction types in either mode of operation. Upon termination of the debug interlude, the final instruction written into debug peripheral 16, via SI input pad 28, is a return from interrupt. The instructions executed during the duration of the debug interlude are used to read and write internal registers, memory, or for any other operation associated with system debugging. Accordingly, the development system 20 may implement the usual in-circuit emulation primitives, including the insertion of and response to breakpoints, halting the execution of the data processor to examine the contents of system registers, and tracing software execution. The serial protocol for debug peripheral 16 supports a simple error detection by employing start, stop, and parity bits. The protocol requires N+7 bits per transfer, therefore, the serial clock is counted by the development system 20 to provide the N+7 clocks required to complete the transfer. The following table illustrates the function of each bit in the serial in and out bit streams. Debug peripheral 16 eliminates the need for large amounts of complex, external emulator circuitry, therefore, the size of the emulation probe is substantially reduced in size. The probe may be a daughter board which plugs directly into or clips onto the MCU/MPU, in the user's circuit board. For example, a typical emulation probe with dimensions 9 x 12 x 2 inches is reduced to 3 x 4 x 1 inches (or less) by using the debug peripheral 16. The elimination of the emulator cable, generally required in conventional in-circuit emulators, alleviates the need to completely buffer the processor. The reduction in the amount of buffer circuitry facilitates real-time emulation with high-speed MPU/MCU chips, without significant timing degradation. The debug peripheral 16 provides a load path to the on-chip memory 14 (RAM), thereby eliminating the need for a bootstrap ROM. When the BRK* input signal is asserted, upon the negation of the RESET signal (not shown) of the CPU 12, the CPU 12 will fetch its first instruction from the debug peripheral 16. This feature allows the development system 20 to write any program into the on-chip memory 14, via the shift register 22 of the debug peripheral 16. Once the program is loaded, the debug peripheral 16 may pass control to the program. The debug peripheral 16 enhances the testability of the MCU/MPU under test in a variety of ways. For example, the contents of a masked ROM may be verified through the serial interface, without entering any special test mode. Furthermore, processor registers, on-chip RAM, and other on-chip peripherals may be tested without the need for entering a special test mode. Accordingly, the debug peripheral 16 provides a flexible, efficient standard design, which is easily ported from one integrated circuit to another, at a minimum cost. While the invention has been described in a preferred embodiment, it will be apparent to those skilled in the art that the disclosed invention may be modified in numerous ways and may assume many embodiments other than that specifically set out and described above. For example, CPU 12 can obtain the interrupt vector directly from the debug peripheral 16, as opposed to the preferred embodiment, wherein the interrupt signal causes the CPU 12 to autovector to the address (DEBUG) of the debug peripheral 16. Accordingly, it is intended by the appended claims to cover all modifications of the invention which fall within the scope of the invention.

Claims: A debug peripheral for a data processing system (10), said data processing system being coupled to an external source (20), and having a data processor (12) for executing a first sequence of instructions received from an instruction memory (14), via an internal communications bus (18), and for executing a sequence of debugging instructions received from the debug peripheral (16), via said internal communications bus (18), said debug peripheral (16) comprising: a plurality of external terminals (30, 32); control means (26), coupled to at least one of said plurality of external terminals (30, 32), for receiving a debug initiation signal from said external source (20), and for assuming control of said processor (12), by providing a debug interrupt signal to said processor (12), in response to said debug initiation signal; register means (22, 28, 34) coupled to said internal communication bus (18) for storing information received from said processor and for storing said alternate sequence of instructions received from said external source, said register means comprising: a serial interface (28), coupled to said external source (20) via at least one of said plurality of external terminals (30, 32), for receiving said externally provided debugging instructions, and for simultaneously providing data received from said processor (12), to said external source (20), via said control means (26), in a debug mode; a parallel interface (34) coupled to said processor (12) via said internal communications bus (18), for providing said externally provided debugging instructions to said processor (12), and for receiving data from said processor (12), in said debug mode; and address decoder means (24), coupled to said register means (22, 28, 34), for enabling said register means (22, 28, 34), in response to an alternate sequence of instruction addresses received from said processor (12), via said parallel interface (34), said alternate sequence of instruction addresses corresponding in number to a predefined number of memory addresses designated for said debug peripheral. A data processing system (10) coupled to an external source (20), said data processing system (10) having: a processor (12) for executing a first sequence of instructions received by the processor (12), in response to a first sequence of instruction addresses, and for executing an alternate sequence of externally provided instructions received by the processor (12), in response to an alternate sequence of instruction addresses; a processor internal communications bus (18) coupled to said processor (12); a memory (14) coupled to said processor internal communications bus (18) for storing a plurality of instructions and for providing said first sequence of instructions to said processor (12), in response to said first sequence of instruction addresses received from said processor (12); and a debug peripheral (16), coupled to said processor internal communications bus (18) for assuming control of said processor (12), in response to a debug initiation signal provided by an external source (20), said debug peripheral (16) receiving said alternate sequence of externally provided instructions from said external source (20), and for providing said alternate sequence of externally provided instructions to said processor (12), in response to said alternate sequence of instruction addresses, said debug peripheral (16) further storing data received by said processor (12) and providing data to said external source (20), said debug peripheral (16) comprising: a plurality of external terminals (30, 32); control means (26), coupled to at least one of said plurality of external terminals (30, 32), for assuming control of said processor (12) by providing a debug interrupt signal to said processor (12), in response to said debug initiation signal; register means (22, 28, 34), coupled to said processor internal communications bus (18) and said control means (26), for storing information received from said processor and for storing said alternate sequence of instructions received from said external source, said register means comprising: a serial interface (28), coupled to said external source (20) for receiving said alternate sequence of externally provided instructions, and for providing data received from said processor (12) to said control means (26), in a debug mode; a parallel interface (34), coupled to said processor (12) via said internal communications bus (18), for providing said alternate sequence of externally provided instructions to said processor (12), and for receiving data from said processor, in said debug mode; and address decoder means (24) coupled to said processor internal communications bus (18) for enabling said register means (22, 28, 34), in response to said alternate sequence of instruction addresses received from said processor (12), said alternate sequence of instruction addresses corresponding in number to a predefined number of memory addresses designated for said debug peripheral (16).

Inventors: ALLISON NIGEL JOHN, GRAY RAND LEE, HARTVIGSEN JAY ALAN, ALLISON, NIGEL JOHN, GRAY, RAND LEE, HARTVIGSEN, JAY ALAN
Applicants: MOTOROLA INC, MOTOROLA INC.
Application year: 1990
Main classification: G06F11
IPC codes: G06F11