# US 2012/0254668 A1 · Mechanism For Storing And Extracting Trace Information Using Internal Memory In Micro Controllers

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2012/0254668 A1
- Document ID: US20120254668A1
- Status: Published application
- Kind: A1
- Application number: 13/527,502
- Filed: 2012-06-19
- Published: 2012-10-04
- Earliest claimed: 2005-06-07
- Assignees: Atmel Corporation
- Inventors: Frode Milch Pedersen; Are Arseth
- Web page: https://patentgrep.com/patent/US20120254668A1

## CPC

- G06F 11/3636: {by tracing the execution of the program}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

This document relates to apparatus and methods to store and retrieve trace information in on-chip system memory of microcontrollers. A microcontroller comprises a microprocessor and a memory device accessible through a data bus and an address bus coupled to the microprocessor. The microcontroller includes on-chip debug logic coupled to the microprocessor. Trace data can be retrieved from system memory using a debug port of the debug logic. A system in accordance with the present invention will lower the cost of implementation of trace features in microcontrollers, and strongly reduce the cost of supporting such features in debug tools.

## Claims

### Claim at position 1

1-20. (canceled)

### Claim 21

A method comprising:
storing trace data in a trace buffer portion of system memory, where the system memory is coupled to a microprocessor using a data bus;
retrieving, by a trace extractor module, the trace data from the trace buffer;
communicating the retrieved trace data to a debug port, where the debug port is included with on-chip debug logic coupled to the microprocessor and the system memory; and
identifying, by a trace buffer protection module in communication with the trace extractor module, illegal microprocessor access to system memory locations within the trace buffer.

### Claim 22 (depends on 21)

The method of claim 21, wherein the system memory resides on-chip and the system memory includes memory accessible by the microprocessor that is distinct from the trace buffer.

### Claim 23 (depends on 21)

The method of claim 21, wherein the debug port includes a low speed debug port.

### Claim 24 (depends on 21)

The method of claim 21, further comprising determining a behavior of the trace extractor module based on a plurality of debug registers included with the trace extractor module.

### Claim 25 (depends on 24)

The method of claim 24, wherein the plurality of debug registers includes:
a first register indicative of a next system memory address for storing trace data;
a second register to collect frames into bus-sized units;
a third register to store the size of the trace buffer; a fourth register to indicate a control method when the trace buffer is full; and
a plurality of status registers, wherein each of the plurality of status registers are single-bit, read-only registers indicating the status of the trace buffer.

### Claim 26 (depends on 21)

The method of claim 21, wherein the on-chip debug logic includes:
a bus matrix coupled to the trace extractor module and in communication with the trace buffer protection module, the bus matrix configured to communicate with the system memory.

### Claim 27 (depends on 21)

The method of claim 21, further comprising:
identifying, by the trace buffer protection module, illegal microprocessor access to system memory locations within the trace buffer based on the status of a comparator; and
halting the microprocessor when an illegal access is identified.

### Claim 28

A microcontroller comprising:
a shared memory device;
a microprocessor configured to read and write microcontroller data from and to the shared memory device;
on-chip debug logic configured to:
accumulate trace frames into a frame register; and
provide the contents of the frame register to the shared memory device when the frame register is full; and
a debug port configured to facilitate communication of trace frames from the shared memory.

### Claim 29 (depends on 28)

The microcontroller of claim 28, wherein the on-chip debug logic is configured to provide the contents of the first register to a trace buffer of the shared memory device when the first register is full.

### Claim 30 (depends on 29)

The microcontroller of claim 29, wherein the trace buffer is a circular trace buffer of the shared memory device.

### Claim 31 (depends on 30)

The microcontroller of claim 30, wherein the circular trace buffer includes a status register indicative of whether the circular trace buffer has been overwritten at least once during the trace capture sequence.

### Claim 32 (depends on 29)

The microcontroller of claim 29, wherein the on-chip debug logic is configured to stop the trace capture sequence when the trace buffer is full.

### Claim 33 (depends on 32)

The microcontroller of claim 32 wherein the on-chip debug logic is configured to suspend execution of the microprocessor at a buffer full breakpoint.

### Claim 34 (depends on 33)

The microcontroller of claim 33, wherein the on-chip debug logic is configured to set a trace buffer full status bit to identify the cause of the buffer full breakpoint.

### Claim 35 (depends on 29)

The microcontroller of claim 29, wherein the on-ship debug logic is configured to:
identify illegal microprocessor access to memory locations within the trace buffer; and
generate an illegal access breakpoint when an illegal access is identified.

### Claim 36 (depends on 35)

The microcontroller of claim 35, wherein the on-chip debug logic is configured to set an illegal access status bit.

### Claim 37 (depends on 28)

The microcontroller of claim 28, wherein the on-chip debug logic is configured to determine if the frame register includes an unsaved trace frame.
