Debug circuit and information processing system
The debug circuit efficiently debugs polling programs by measuring polling time and count using an execution command detection circuit and expected value comparison, addressing inefficiencies in conventional debugging methods.
Patent Information
- Application Number
- JP2023071587
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2023-04-25
- Publication Date
- 2024-11-07
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Conventional debugging methods for polling programs in microcontrollers, such as using trace and step execution functions, are inefficient and time-consuming, especially when debugging interrupt processing routines, as they do not accurately reflect the timing of flag changes in special function registers (SFRs) and require manual checking of SFR contents.
A debug circuit with an execution command detection circuit, an expected value comparison circuit, and a polling time measurement circuit that measures the time or number of polling operations until flag values match an expected value, allowing for efficient debugging by visualizing the polling time or count on an external monitor.
Enables efficient debugging of polling programs by accurately determining the timing of flag changes and polling intervals, reducing the time required for debugging compared to traditional methods.
Smart Images

Figure 2024157301000001_ABST
Abstract
Description
[Technical field]
[0001] The present invention relates to a debug circuit and an information processing system for debugging a program. [Background technology]
[0002] Program debugging is performed in computers such as microcomputers. For example, in an information processing system in which data transmission control between a host device and a workstation or the like is performed by a polling process, the program is debugged using a debugging device equipped with a trace function unit that traces a program being executed by the host device (for example, Patent Document 1). [Prior art documents] [Patent documents]
[0003] [Patent Document 1] Japanese Patent Application Publication No. 5-233481 Summary of the Invention [Problem to be solved by the invention]
[0004] Conventionally, debugging of a polling program of a control register of a peripheral function such as a special function register (SFR) built into a microcontroller was performed using the trace function or step execution function installed in an in-circuit emulator (ICE) or on-chip debug emulator. For example, when debugging a program that polls the flag value of an SFR using the trace function, the trace contents (e.g., program counter and SFR contents) are dumped after the program is executed, and the contents until polling starts and the SFR flag value reaches the expected value are extracted, and the polling interval and polling start timing are debugged based on the contents. In addition, in the case of an ICE or the like that does not have a trace function, debugging is performed by repeating step execution from the start of polling until the SFR flag value matches the expected value.
[0005] However, when debugging using the trace function, the contents of the SFR flag are not reflected in the trace results until the contents are read by a read instruction (program), which means that it is not possible to determine the exact timing at which the flag changes.
[0006] In addition, when debugging using the step execution function, it is necessary to execute the program one instruction at a time and check the contents of the SFR each time, which is time-consuming and laborious.
[0007] In addition, in an application program that periodically polls the SFR flag value in an interrupt processing routine that occurs under certain conditions, if you want to check whether the interrupt is delayed or missed, there is a problem that efficient debugging cannot be performed using only the trace function or step execution function.
[0008] SUMMARY OF THE PRESENT INVETION The present invention has been made in consideration of the above problems, and has as its object to provide a debugging circuit that is capable of efficiently debugging a polling program in a short time. [Means for solving the problem]
[0009] The debug circuit of the present invention is a circuit provided in an information processing device and used to debug a polling program that polls a flag of a control register used to control a peripheral function of the information processing device, and is characterized in having an execution instruction detection circuit that detects an execution instruction for the peripheral function and generates a detection signal, an expected value comparison circuit that compares a flag value of a flag read from the control register with an expected value of the flag, and a polling time measurement circuit that measures a polling value related to the polling of the flag of the control register based on the detection signal and the comparison result by the expected value comparison circuit.
[0010] An information processing system according to the present invention is an information processing system comprising an information processing device and an external device connected to the information processing device via a bus line, wherein the information processing device includes a debug circuit that debugs a polling program that polls a flag of a control register used to control a peripheral function of the information processing device, and the debug circuit has an execution command detection circuit that detects an execution command of the peripheral function and generates a detection signal, an expected value comparison circuit that compares a flag value of a flag read from the control register with an expected value of the flag, and a polling time measurement circuit that measures a polling value related to the polling of the flag of the control register based on the detection signal and the comparison result by the expected value comparison circuit, and the external device acquires the measurement result of the polling time measurement circuit via the bus line and visibly displays it. Effect of the Invention
[0011] According to the debugging circuit of the present invention, it is possible to efficiently debug a polling program in a short time. [Brief description of the drawings]
[0012] [Figure 1] 1 is a block diagram showing a configuration of an information processing system according to a first embodiment of the present invention. [Diagram 2] 4 is a flowchart showing a processing routine of the debugging process according to the first embodiment. [Diagram 3] 4 is a flowchart showing a processing routine of the debugging process according to the first embodiment. [Figure 4] FIG. 11 is a block diagram showing a configuration of an information processing system according to a second embodiment of the present invention. [Diagram 5] 13 is a flowchart showing a processing routine of a debugging process according to the second embodiment. [Figure 6] 13 is a flowchart showing a processing routine of a debugging process according to the second embodiment. [Figure 7] FIG. 11 is a block diagram showing a configuration of an information processing system according to a third embodiment of the present invention. [Figure 8] 13 is a flowchart showing a processing routine of a debugging process according to the third embodiment. [Figure 9] 13 is a flowchart showing a processing routine of a debugging process according to the third embodiment. [Figure 10] 13 is a flowchart showing a processing routine of a debugging process according to the third embodiment. [Figure 11] FIG. 11 is a block diagram showing a configuration of an information processing system according to a fourth embodiment of the present invention. [Figure 12] 13 is a flowchart showing a processing routine of a debugging process according to the fourth embodiment. [Figure 13] 13 is a flowchart showing a processing routine of a debugging process according to the fourth embodiment. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0013] Hereinafter, embodiments of the present invention will be described with reference to the drawings. In the following description of each embodiment and the accompanying drawings, substantially the same or equivalent parts are designated by the same reference numerals. EXAMPLES
[0014] 1 is a block diagram showing a configuration of an information processing system according to a first embodiment of the present invention. The information processing system of this embodiment is composed of an external debugging device ED and a microcomputer 100. The microcomputer 100 is composed of an ICE (In Circuit Emulator) circuit 10 and a microcomputer circuit 20.
[0015] The ICE circuit 10 has a trace memory & trace circuit 11, a step / break circuit 12, an executable instruction detection circuit 13, a polling time measurement circuit 14, and a flag expected value comparison circuit 15. These circuits are connected to an external debugging device ED via a communication bus BL.
[0016] The trace memory & trace circuit 11 is a circuit that performs a tracing function for recording the execution history of a program executed by the microcomputer circuit 20. The trace memory & trace circuit 11 receives a CPU clock CLK1 and a program execution address PA1 from the microcomputer circuit 20.
[0017] The step / break circuit 12 is a circuit that performs a step execution function for executing a program one instruction at a time. The step / break circuit 12 is supplied with a CPU clock CLK1 and a program execution address PA1 from the microcomputer circuit 20.
[0018] The execution command detection circuit 13 is a circuit that detects execution commands of control programs for peripheral functions of the microcomputer circuit 20. The execution command detection circuit 13 also detects whether a comparison command (hereinafter referred to as a polling command) that compares a flag value of the SFR 25 (for example, a flag indicating the end of communication that changes from 0 to 1 when communication ends in a control program for UART communication) with an expected value has been executed. The execution command detection circuit 13 is supplied with a CPU clock CLK1, a program execution address PA1, and a program start signal PS1.
[0019] The execution instruction detection circuit 13 has an instruction address register 31 that stores a physical address value in an application program. When the physical address value matches the value of the program execution address PA1, the execution instruction detection circuit 13 outputs a one-shot execution detection trigger pulse signal DTS.
[0020] The polling time measurement circuit 14 is a circuit that measures a polling value related to the polling of the flag of the SFR 25. In this embodiment, the polling time measurement circuit 14 measures, as a polling value, the time from when the execution command detection circuit 13 detects an execution command until when the flag value of the SFR 25 and its expected value change from a mismatched state to a matched state.
[0021] The polling time measurement circuit 14 has a time measurement timer 41, a measurement value register 42, and a maximum value register 43. A CPU clock CLK1 is supplied to the polling time measurement circuit 14. In addition, an expected value match trigger pulse signal MTS is supplied to the polling time measurement circuit 14 from a flag expected value comparison circuit 15.
[0022] The time measurement timer 41 measures the polling time by counting based on the CPU clock CLK1. The measurement value register 42 stores the latest polling time measurement result by the time measurement timer 41. The maximum value register 43 stores the maximum value (maximum value of the polling time) of the measurement values indicating the polling time measurement result. The polling time measurement circuit 14 outputs a one-shot time measurement start trigger pulse signal TTS at the start of polling time measurement.
[0023] The flag expected value comparison circuit 15 has an expected value data register 51 and a bit string mask register 52. The flag expected value comparison circuit 15 is supplied with a bit string FBS consisting of the flag values of the SFR 25.
[0024] The expected value data register 51 stores expected value data having the same bit width as the bit string FBS. The bit string mask register 52 stores a bit mask value for extracting a bit string having the same bit width as the bit string FBS. The flag expected value comparison circuit 15 compares the logical AND value of the bit string FBS and the bit mask value read from the bit string mask register 52 with the expected value data read from the expected value data register 51. The flag expected value comparison circuit 15 outputs a one-shot expected value match trigger pulse signal MTS when the logical AND value and the expected value data change from a mismatch state to a match state.
[0025] The microcomputer circuit 20 includes a CPU 21 , a clock control circuit 22 , a bus bridge 23 , a program memory 24 , and an SFR 25 .
[0026] The CPU (Central Processing Unit) 21 is a processing control unit that controls the overall operation of the microcomputer circuit 20. In this embodiment, the CPU 21 is connected to a program memory 24 and an SFR 25 via a bus bridge 23.
[0027] The clock control circuit 22 outputs a CPU clock CLK1 which is an operating clock of the CPU 21. The CPU clock CLK1 is supplied to the CPU 21, as well as to the trace memory & trace circuit 11, the step / break circuit 12, the executable instruction detection circuit 13, the polling time measurement circuit 14, and the flag expected value comparison circuit 15 of the ICE circuit 10.
[0028] The program memory 24 is a storage device that stores various programs executed by the microcomputer circuit 20. The program memory 24 stores, for example, a polling program for polling the flag value of the SFR 25.
[0029] The SFR 25 is a special function register that stores register values used to control peripheral functions of the microcomputer circuit 20. For example, the SFR 25 stores register values that indicate communication control and status of a UART (Universal Asynchronous Receiver Transmitter) function (not shown) built into the microcomputer circuit 20.
[0030] Next, the processing operation of the debugging process executed by ICE circuit 10 of this embodiment will be described.
[0031] 2 and 3 are flowcharts showing the processing routine of the debugging process in the first embodiment.
[0032] First, ICE circuit 10 acquires the physical address value in program memory 24 where the polling instruction is stored from external debug device ED via communication bus BL, and stores it in instruction address register 31 of execution instruction detection circuit 13 (STEP 101).
[0033] Furthermore, ICE circuit 10 obtains expected value data of the flags of SFR 25 from external debugging device ED via communication bus BL, and stores it in expected value data register 51 of flag expected value comparison circuit 15 (STEP 102).
[0034] ICE circuit 10 also obtains a bit mask value used to mask bit string FBS from external debug device ED via communication bus BL, and stores it in bit string mask register 52 of flag expected value comparison circuit 15 (STEP 103).
[0035] The polling time measurement circuit 14 resets the values of the time measurement timer 41 and the maximum value register 43 to "0" (STEP 104).
[0036] When the application program starts, the execution command detection circuit 13 compares the physical address value stored in the command address register 31 with the value of the program execution address PA1 in synchronization with the CPU clock CLK1 (STEP 105).
[0037] The execution command detection circuit 13 determines whether or not the two address values match as a result of the comparison (STEP 106).
[0038] If it is determined that the address values do not match (STEP 106: NO), the process returns to STEP 105, where the execution instruction detection circuit 13 compares the address values again in synchronization with the CPU clock CLK1.
[0039] On the other hand, if it is determined that the address values match (STEP 106: YES), the execution instruction detection circuit 13 outputs an execution detection trigger pulse signal DTS indicating that an execution instruction has been detected (STEP 107).
[0040] The polling time measurement circuit 14 receives the execution detection trigger pulse signal DTS and, in response, starts counting the time measurement timer 41. The polling time measurement circuit 14 also outputs a time measurement start trigger pulse signal TTS indicating that time measurement has started (STEP 108).
[0041] The flag expected value comparison circuit 15, in synchronization with the CPU clock CLK1, compares the value of the logical AND of the bit string FBS and the bit mask value read from the bit string mask register 52 with the expected value data read from the expected value data register 51 (STEP 109).
[0042] The flag expected value comparison circuit 15 determines whether or not the two values have changed from a mismatched state to a matched state as a result of the comparison (STEP 110).
[0043] If it is determined that the values still do not match (STEP 110: NO), the process returns to STEP 109, where the flag expected value comparison circuit 15 again compares the value of the logical AND with the expected value data in synchronization with the CPU clock CLK1.
[0044] On the other hand, if it is determined that the values match (STEP 110: YES), the flag expected value comparison circuit 15 outputs an expected value match trigger pulse signal MTS indicating that the expected values match (STEP 111).
[0045] Upon receiving the expected value match trigger pulse signal MTS, the polling time measurement circuit 14 stops the count of the time measurement timer 41 and stores the count value of the time measurement timer at that time in the measurement value register 42 as a measurement value (STEP 112).
[0046] The polling time measurement circuit 14 compares the measurement value stored in the measurement value register 42 with the maximum value read from the maximum value register 43, and stores the larger value as the maximum value (i.e., if the measurement value is larger, as a new maximum value) in the maximum value register 43 (STEP 113).
[0047] The external debugging device ED periodically reads out the maximum value stored in the maximum value register 43 of the polling time measurement circuit 14 via the communication bus BL, and displays it on the screen of a monitor PC (not shown in FIG. 1) connected to the external debugging device ED (STEP 114).
[0048] As described above, in the information processing system of this embodiment, ICE circuit 10 is provided with execution instruction detection circuit 13, polling time measurement circuit 14, and flag expected value comparison circuit 15. With this configuration, after polling of the flag value of SFR 25 starts, the time (maximum value) from when the flag value and expected value go from a mismatched state to a matched state can be measured and displayed on the monitor screen.
[0049] This makes it possible to grasp the exact timing at which the flags change from a mismatched state to a matched state, unlike debugging using a trace function in an ICE circuit that does not have the above-mentioned circuits. Also, it makes it possible to complete debugging in a short time, unlike debugging by executing a program one instruction at a time using the step execution function.
[0050] Therefore, with ICE circuit 10 of this embodiment, it becomes possible to debug the polling program efficiently in a short time. EXAMPLES
[0051] Next, a description will be given of a second embodiment of the present invention. The ICE circuit of this embodiment differs from ICE circuit 10 of the first embodiment in that it has a configuration for measuring the time from when the flag values reach a match state until polling starts.
[0052] 4 is a block diagram showing a configuration of an information processing system according to a second embodiment. The information processing system of this embodiment is composed of an external debugging device ED and a microcomputer 100A. The microcomputer 100A is composed of an ICE circuit 10A and a microcomputer circuit 20. Note that the internal configurations of an executable instruction detection circuit 13, a first polling time measurement circuit 14, and a flag expected value comparison circuit 15 are omitted here.
[0053] ICE circuit 10A has a second polling time measurement circuit 16 in addition to a first polling time measurement circuit 14 having the same function as polling time measurement circuit 14 in the first embodiment.
[0054] The second polling time measurement circuit 16 is a circuit that measures, as a polling value, the time until polling of the SFR 25 starts after the flag value of the SFR 25 and its expected value change from a mismatch state to a match state.
[0055] The second polling time measurement circuit 16 has a time measurement timer 61, a measurement value register 62, and a maximum value register 63. A CPU clock CLK1 is supplied to the second polling time measurement circuit 16. In addition, an expected value match trigger pulse signal MTS is supplied to the second polling time measurement circuit 16 from the flag expected value comparison circuit 15.
[0056] The time measurement timer 61 measures the polling time by counting based on the CPU clock CLK1. The measurement value register 62 stores the latest polling time measurement result by the time measurement timer 41. The maximum value register 63 stores the maximum value of the measurement values indicating the polling time measurement result (maximum value of the polling time).
[0057] The second polling time measurement circuit 16 outputs a one-shot time measurement start trigger pulse second signal TTS2 at the start of polling time measurement. The second time measurement start trigger pulse signal TTS2 is supplied to the execution command detection circuit 13.
[0058] Next, the processing operation of the debugging process executed by ICE circuit 10A of this embodiment will be described.
[0059] 5 and 6 are flowcharts showing the processing routine of the debugging process in the second embodiment.
[0060] First, ICE circuit 10A obtains the physical address value in program memory 24 where the polling instruction is stored from external debug device ED via communication bus BL, and stores it in instruction address register 31 of execution instruction detection circuit 13 (STEP 201).
[0061] ICE circuit 10A also obtains expected value data of the flags of SFR 25 from external debugging device ED via communication bus BL, and stores it in expected value data register 51 of flag expected value comparison circuit 15 (STEP 202).
[0062] ICE circuit 10A also obtains a bit mask value used to mask bit string FBS from external debug device ED via communications bus BL, and stores it in bit string mask register 52 of flag expected value comparison circuit 15 (STEP 203).
[0063] The polling time measurement circuit 14 resets the values of the time measurement timer 41 and the maximum value register 43 to "0" (STEP 204).
[0064] When the application program starts, the flag expected value comparison circuit 15 synchronizes with the CPU clock CLK1 and compares the value obtained by masking the bit string FBS with the bit mask value read from the bit string mask register 52 with the expected value data read from the expected value data register 51 (STEP 205).
[0065] The flag expected value comparison circuit 15 determines whether or not the two values have changed from a mismatched state to a matched state as a result of the comparison (STEP 206).
[0066] If it is determined that the values still do not match (STEP 206: NO), the process returns to STEP 205, where the flag expected value comparison circuit 15 again compares the value obtained by masking the bit string FBS with the expected value data in synchronization with the CPU clock CLK1.
[0067] On the other hand, if it is determined that the values match (STEP 206: YES), the flag expected value comparison circuit 15 outputs an expected value match trigger pulse signal MTS indicating that the expected values match (STEP 207).
[0068] The second polling time measurement circuit 16 receives the expected value match trigger pulse signal MTS and starts counting the time measurement timer 61 in response to the signal MTS. The second polling time measurement circuit 16 also outputs a second time measurement start trigger pulse signal TTS2 indicating that time measurement has started (STEP 208).
[0069] The execution instruction detection circuit 13 receives the second time measurement start trigger pulse signal TTS2 and, in response, compares the physical address value stored in the instruction address register 31 with the value of the program execution address PA1 in synchronization with the CPU clock CLK1 (STEP 209).
[0070] The execution command detection circuit 13 determines whether or not the two address values match as a result of the comparison (STEP 210).
[0071] If it is determined that the address values do not match (STEP 210: NO), the process returns to STEP 209, where the execution instruction detection circuit 13 compares the address values again in synchronization with the CPU clock CLK1.
[0072] On the other hand, if it is determined that the address values match (STEP 210: YES), the execution instruction detection circuit 13 outputs an execution detection trigger pulse signal DTS indicating that an execution instruction has been detected (STEP 211).
[0073] The second polling time measurement circuit 16 receives the execution detection trigger pulse signal DTS, stops the count of the time measurement timer 61, and stores the count value of the time measurement timer at that time in the measurement value register 62 as a measurement value (STEP 212).
[0074] The second polling time measurement circuit 16 compares the measured value stored in the measured value register 62 with the maximum value read from the maximum value register 63, and stores the larger value in the maximum value register 63 as the maximum value (i.e., if the measured value is larger, as a new maximum value) (STEP 213).
[0075] The external debugging device ED periodically reads out the maximum value stored in the maximum value register 63 of the second polling time measurement circuit 64 via the communication bus BL, and displays it on the screen of a monitor PC (not shown in FIG. 4) connected to the external debugging device ED (STEP 214).
[0076] As described above, in the information processing system of this embodiment, ICE circuit 10A is provided with execution instruction detection circuit 13, first polling time measurement circuit 14, flag expected value comparison circuit 15, and second polling time measurement circuit 16. With this configuration, it is possible to measure the time (maximum value) from when the flag value and expected value of SFR 25 change from a mismatched state to a matched state until the start of polling, and to display this on the monitor screen.
[0077] This makes it possible to quickly and efficiently debug polling intervals, polling process delays, and processing omissions, unlike when debugging is performed using trace or step functions in an ICE circuit that does not have the above-mentioned circuits.
[0078] Therefore, ICE circuit 10A of this embodiment makes it possible to debug the polling program efficiently in a short time. EXAMPLES
[0079] Next, a description will be given of a third embodiment of the present invention. The ICE circuit of this embodiment differs from ICE circuit 10 of the first embodiment in that it has a configuration for measuring the number of polling operations from when polling starts until the flag value and expected value change from a mismatch state to a match state.
[0080] 7 is a block diagram showing a configuration of an information processing system according to a third embodiment. The information processing system of this embodiment is composed of an external debugging device ED and a microcomputer 100B. The microcomputer 100B is composed of an ICE circuit 10B and a microcomputer circuit 20. Note that the internal configurations of a polling time measurement circuit 14 and a flag expected value comparison circuit 15 are omitted here.
[0081] The execution instruction detection circuit 13 of this embodiment has, in addition to an instruction address register 31, an execution number counter 32, an execution number register 33, and a maximum value register .
[0082] The execution counter 32 is a counter for counting the number of times the polling command is executed. Specifically, the execution command detection circuit 13 compares the physical address value stored in the command address register 31 with the program execution address PA1 in synchronization with the CPU clock CLK1, and the count value of the execution counter 32 is incremented every time the two values match.
[0083] The execution count register 33 is a register that stores the count value of the execution count counter 32. Specifically, the execution count register 33 stores the count value of the execution count counter 32 at the time when the execution instruction detection circuit 13 receives the expected value match trigger pulse signal MTS and stops incrementing the execution count counter 32.
[0084] The maximum value register 34 is a register that stores the maximum value of the count value (maximum number of times an instruction is executed) of the execution count counter 32. The execution instruction detection circuit 13 compares the count value stored in the execution count register 33 with the count value stored in the maximum value register 34, and stores the larger count value in the maximum value register 34 as the maximum value.
[0085] With the above configuration, the execution instruction detection circuit 13 of this embodiment has the function of measuring (counting) the number of pollings performed after polling of SFR25 has started until the flag value of SFR25 and its expected value change from a mismatch state to a match state.
[0086] Next, the processing operation of the debugging process executed by ICE circuit 10B of this embodiment will be described.
[0087] 8, 9 and 10 are flowcharts showing the processing routine of the debugging process of the third embodiment.
[0088] First, ICE circuit 10B acquires the physical address value in program memory 24 where the polling instruction is stored from external debug device ED via communication bus BL, and stores it in instruction address register 31 of execution instruction detection circuit 13 (STEP 301).
[0089] The execution command detection circuit 13 resets the values of the execution counter 32 and the maximum value register 34 to "0" (STEP 302).
[0090] Furthermore, ICE circuit 10B obtains expected value data of the flag of SFR 25 from external debug device ED via communication bus BL, and stores it in expected value data register 51 of flag expected value comparison circuit 15 (STEP 303).
[0091] ICE circuit 10B also obtains a bit mask value used to mask bit string FBS from external debug device ED via communications bus BL, and stores it in bit string mask register 52 of flag expected value comparison circuit 15 (STEP 304).
[0092] The polling time measurement circuit 14 resets the value of the maximum value register 43 to "0" (STEP 305).
[0093] When the application program starts, the execution command detection circuit 13 compares the physical address value stored in the command address register 31 with the address value of the program execution address PA1 in synchronization with the CPU clock CLK1 (STEP 306).
[0094] The execution command detection circuit 13 determines whether or not the two address values match as a result of the comparison (STEP 307).
[0095] If it is determined that the values do not match (STEP 307: NO), the process returns to STEP 306, where the execution instruction detection circuit 13 again compares the physical address value stored in the instruction address register 31 with the address value of the program execution address PA1 in synchronization with the CPU clock CLK1.
[0096] On the other hand, if it is determined that the values match (STEP 307: YES), the execution command detection circuit 13 outputs an execution detection trigger pulse signal DTS (STEP 308).
[0097] The execution command detection circuit 13 increments the count value of the execution counter 32 by +1 (STEP 309).
[0098] The execution instruction detection circuit 13 continues to compare the physical address value stored in the instruction address register 31 with the address value of the program execution address PA1 thereafter, and increments the count value of the execution counter 32 by +1 each time they match.
[0099] The polling time measurement circuit 14 receives the execution detection trigger pulse signal DTS and, in response, starts counting the time measurement timer 41. The polling time measurement circuit 14 also outputs a time measurement start trigger pulse signal TTS indicating that time measurement has started (STEP 310).
[0100] The flag expected value comparison circuit 15, in synchronization with the CPU clock CLK1, compares the value obtained by masking the bit string FBS with the bit mask value read from the bit string mask register 52 with the expected value data read from the expected value data register 51 (STEP 311).
[0101] The flag expected value comparison circuit 15 determines whether or not the two values have changed from a mismatched state to a matched state as a result of the comparison (STEP 312).
[0102] If it is determined that the values still do not match (STEP 312: NO), the process returns to STEP 311, where the flag expected value comparison circuit 15 again compares the value obtained by masking the bit string FBS with the expected value data in synchronization with the CPU clock CLK1.
[0103] On the other hand, if it is determined that the values match (STEP 312: YES), the flag expected value comparison circuit 15 outputs an expected value match trigger pulse signal MTS indicating that the expected values match (STEP 313).
[0104] Upon receiving the expected value match trigger pulse signal MTS, the polling time measurement circuit 14 stops the count of the time measurement timer 41 and stores the count value of the time measurement timer at that time in the measurement value register 42 as a measurement value (STEP 314).
[0105] The execution instruction detection circuit 13 increments the count value of the execution counter 32 in a step, and stores the count value of the execution counter 32 in the execution count register 33 (STEP 315).
[0106] The polling time measurement circuit 14 compares the measurement value stored in the measurement value register 42 with the maximum value read from the maximum value register 43 (STEP 316).
[0107] The polling time measurement circuit 14 stores the larger value as a result of the comparison in the maximum value register 43 (STEP 317).
[0108] The execution command detection circuit 13 compares the count value stored in the execution count register 33 with the maximum value read from the maximum value register 34 (STEP 318).
[0109] The execution instruction detection circuit 13 stores the larger count value as a result of the comparison in the maximum value register 34 (STEP 319).
[0110] The external debugging device ED periodically reads out the maximum value stored in the maximum value register 43 of the polling time measurement circuit 14 and the maximum value stored in the maximum value register 34 of the execution instruction detection circuit 13 via the communication bus BL (STEP 320).
[0111] The external debugging device ED displays the result on the screen of a monitor PC (not shown in FIG. 7) connected to itself (STEP 321).
[0112] As described above, in the information processing system of this embodiment, ICE circuit 10B is provided with execution instruction detection circuit 13, polling time measurement circuit 14, and flag expected value comparison circuit 15. Execution instruction detection circuit 13 has instruction address register 31, execution count counter 32, execution count register 33, and maximum value register 34. With this configuration, it is possible to count the number of pollings (maximum value) executed from the start of polling until the flag value and expected value change from a mismatched state to a matched state, and to display this on a monitor screen.
[0113] In addition, by performing operations similar to those of the information processing system of the first embodiment, after polling of the flag value of SFR25 is started, the time (maximum value) until the flag value and expected value go from a mismatched state to a matched state can be measured and displayed on a monitor screen (e.g., a PC screen).
[0114] Therefore, with ICE circuit 10C of this embodiment, it becomes possible to visually check whether the polling program is operating according to the specifications. EXAMPLES
[0115] Next, a fourth embodiment of the present invention will be described. The ICE circuit of this embodiment differs from ICE circuit 10 of the first embodiment in that it has a configuration for measuring the number of polling operations until the flag value and expected value change from a matched state to a mismatched state.
[0116] 11 is a block diagram showing a configuration of an information processing system according to a fourth embodiment. The information processing system of this embodiment includes an external debugging device ED and a microcomputer 100C. The microcomputer 100C includes an ICE circuit 10C and a microcomputer circuit 20.
[0117] The flag expected value comparison circuit 15 of this embodiment outputs a one-shot expected value mismatch trigger pulse signal UTS when the logical AND value of the bit string FBS and the bit mask value changes from a match state to a mismatch state with the expected value data.
[0118] Next, the processing operation of the debugging process executed by ICE circuit 10C of this embodiment will be described.
[0119] 12 and 13 are flowcharts showing the processing routine of the debugging process in the fourth embodiment.
[0120] First, ICE circuit 10 acquires the physical address value in program memory 24 where the polling command is stored from external debug device ED via communication bus BL, and stores it in command address register 31 of execution command detection circuit 13 (STEP 401).
[0121] ICE circuit 10 also obtains expected value data of the flags of SFR 25 from external debugging device ED via communication bus BL, and stores it in expected value data register 51 of flag expected value comparison circuit 15 (STEP 402).
[0122] ICE circuit 10 also obtains a bit mask value used to mask bit string FBS from external debugging device ED via communications bus BL, and stores it in bit string mask register 52 of flag expected value comparison circuit 15 (STEP 403).
[0123] The polling time measurement circuit 14 resets the values of the time measurement timer 41 and the maximum value register 43 to "0" (STEP 404).
[0124] When the application program starts, the execution command detection circuit 13 compares the physical address value stored in the command address register 31 with the value of the program execution address PA1 in synchronization with the CPU clock CLK1 (STEP 405).
[0125] The execution command detection circuit 13 determines whether or not the two address values match as a result of the comparison (STEP 406).
[0126] If it is determined that the address values do not match (STEP 406: NO), the process returns to STEP 405, where the execution instruction detection circuit 13 compares the address values again in synchronization with the CPU clock CLK1.
[0127] On the other hand, if it is determined that the address values match (STEP 406: YES), the execution instruction detection circuit 13 outputs an execution detection trigger pulse signal DTS indicating that an execution instruction has been detected (STEP 407).
[0128] The polling time measurement circuit 14 receives the execution detection trigger pulse signal DTS and, in response, starts counting the time measurement timer 41. The polling time measurement circuit 14 also outputs a time measurement start trigger pulse signal TTS indicating that time measurement has started (STEP 408).
[0129] The flag expected value comparison circuit 15, in synchronization with the CPU clock CLK1, compares the logical AND value of the bit string FBS and the bit mask value read from the bit string mask register 52 with the expected value data read from the expected value data register 51 (STEP 409).
[0130] The flag expected value comparison circuit 15 determines whether or not the two values have changed from a matched state to a mismatched state as a result of the comparison (STEP 410).
[0131] If it is determined that the values do not mismatch, that is, that the match state remains (STEP 410: NO), the process returns to STEP 409, and the flag expected value comparison circuit 15 again compares the value of the logical AND with the expected value data in synchronization with the CPU clock CLK1.
[0132] On the other hand, when it is determined that the values are in a mismatch state (STEP 410: YES), the flag expected value comparison circuit 15 outputs an expected value mismatch trigger pulse signal UTS indicating that the expected values are in a mismatch state (STEP 411).
[0133] Upon receiving the expected value mismatch trigger pulse signal UTS, the polling time measurement circuit 14 stops the count of the time measurement timer 41 and stores the count value of the time measurement timer at that time in the measurement value register 42 as a measurement value (STEP 412).
[0134] The polling time measurement circuit 14 compares the measurement value stored in the measurement value register 42 with the maximum value read from the maximum value register 43, and stores the larger value as the maximum value (i.e., if the measurement value is larger, as a new maximum value) in the maximum value register 43 (STEP 413).
[0135] The external debugging device ED periodically reads out the maximum value stored in the maximum value register 43 of the polling time measurement circuit 14 via the communication bus BL, and displays it on the screen of a PC (not shown in FIG. 1) connected to the external debugging device ED (STEP 414).
[0136] As described above, in the information processing system of this embodiment, flag expected value comparison circuit 15 in ICE circuit 10C outputs expected value mismatch trigger pulse signal UTS when the flag value and expected value change from a matched state to a mismatched state. With this configuration, the time (maximum value) taken for the flag value and expected value of SFR 25 to change from a matched state to a mismatched state can be measured and displayed on a monitor screen.
[0137] The present invention is not limited to the above-mentioned embodiment. For example, in the above-mentioned embodiment 4, the configuration of embodiment 1 is used as the basic configuration, and the flag expected value comparison circuit 15 outputs the expected value mismatch trigger pulse signal UTS. However, the application is not limited to embodiment 1, and the configuration of embodiment 2 or embodiment 3 may be combined with the flag expected value comparison circuit 15 of embodiment 4.
[0138] For example, in the second embodiment, by configuring the flag expected value comparison circuit 15 to output an expected value mismatch trigger pulse signal UTS, it becomes possible to measure the time from when the flag value and expected value of SFR25 change from a matched state to a mismatched state until polling starts.
[0139] In addition, in the third embodiment, the flag expected value comparison circuit 15 is configured to output an expected value mismatch trigger pulse signal UTS, so that it is possible to count the number of polling operations performed from the start of polling until the flag value and expected value change from a matched state to a mismatched state. [Explanation of symbols]
[0140] 100 Microcomputer 10 ICE circuit 11 Trace memory / trace circuit 12 Step / Break Circuit 13 Execution command detection circuit 14 Polling time measurement circuit 15 Flag expected value comparison circuit 16 Second polling time measurement circuit 20 Microcomputer Circuits 21 CPU 22 Clock control circuit 23 Bus Bridge 24 Program Memory 25 SFR 31 Instruction Address Register 32 Execution counter 33 Execution count register 34 Maximum Value Register 41 Time measurement timer 42 Measurement value register 43 Maximum Value Register 51 Expected Data Register 52-bit string mask register 61 Time measurement timer 62 Measurement value register 63 Maximum Value Register
Claims
1. A circuit for debugging a polling program that is provided in an information processing device and that polls a flag of a control register used to control a peripheral function of the information processing device, comprising: an execution command detection circuit that detects an execution command of the peripheral function and generates a detection signal; an expected value comparison circuit that compares the flag value of the flag read from the control register with an expected value of the flag; a polling time measurement circuit that measures a polling value related to polling of the flag of the control register based on the detection signal and a comparison result by the expected value comparison circuit; A debug circuit comprising:
2. 2. The debug circuit according to claim 1, wherein the polling time measurement circuit measures, as the polling value, the time until the flag value of the flag read from the control register and the expected value of the flag change from a mismatch state to a match state after the execution instruction detection circuit detects the execution instruction.
3. 2. The debug circuit according to claim 1, wherein the polling time measurement circuit measures, as the polling value, the time from when the flag value of the flag read from the control register changes from a mismatch state to a match state with the expected value of the flag until polling of the flag of the control register starts.
4. 2. The debug circuit according to claim 1, wherein the execution instruction detection circuit counts the number of pollings performed from when polling of the flag of the control register starts until the flag value of the flag read from the control register changes from a mismatch state to a match state with the expected value of the flag.
5. 2. The debug circuit according to claim 1, wherein the polling time measurement circuit measures, as the polling value, the time from when the flag value of the flag read from the control register changes from a match state to a mismatch state after the execution instruction detection circuit detects the execution instruction.
6. 6. The debug circuit according to claim 1, wherein the polling time measurement circuit has a register that can be read from outside, and stores the polling value in the register.
7. 5. The debug circuit according to claim 4, wherein said execution instruction detection circuit has a register that can be read from the outside, and stores a count result of said polling count in said register.
8. An information processing system including an information processing device and an external device connected to the information processing device via a bus line, the information processing device includes a debug circuit that debugs a polling program that polls a flag of a control register used to control a peripheral function of the information processing device; The debug circuit includes: an execution command detection circuit that detects an execution command of the peripheral function and generates a detection signal; an expected value comparison circuit that compares the flag value of the flag read from the control register with an expected value of the flag; a polling time measurement circuit that measures a polling value related to polling of the flag of the control register based on the detection signal and a comparison result by the expected value comparison circuit; having The external device acquires the measurement result of the polling time measurement circuit via the bus line and visually displays it.
Citation Information
Patent Citations
Program tracing stop device of debugging device
JP1993233481A
