Page 2
This document is intended only to assist the reader in the use of the product. ARM Limited shall not be liable for any loss or damage arising from the use of any information in this document, or any error or omission in such information, or any incorrect use of the product.
Page 10
Abort Register bit assignments ................12-50 Table 12-16 Identification Code Register bit assignments ............12-52 Table 12-17 JEDEC JEP-106 manufacturer ID code, with ARM Limited values ...... 12-53 Table 12-18 Control/Status Register bit assignments ............... 12-54 Table 12-19 Control of pushed operation comparisons by MASKLANE ........12-56 Table 12-20 Transfer Mode, TRNMODE, bit definitions ............
Read this chapter to learn about the components of the Cortex-M3 processor, and about the processor instruction set. Chapter 2 Programmer’s Model Read this chapter to learn about the Cortex-M3 register set, modes of operation, and other information for programming the Cortex-M3 processor.
Page 22
ARM Limited http://www.arm.com Frequently Asked Questions list. ARM publications This manual contains information that is specific to the Cortex-M3 processor. See the following documents for other relevant information: • ARM Architecture Reference Manual (ARM DDI 0100) •...
Preface Feedback ARM Limited welcomes feedback both on the Cortex-M3 processor, and on the documentation. Feedback on the Cortex-M3 processor If you have any comments or suggestions about this product, please contact your supplier giving: • the product name •...
The processor is a low-power processor that features low gate count, low interrupt latency, and low-cost debug. It is intended for deeply embedded applications that require fast interrupt response features. The processor implements the ARM architecture v7-M. The processor incorporates: •...
Page 27
Low-cost debug solution that features: — Debug access to all memory and registers in the system, including Cortex-M3 register bank when the core is running, halted, or held in reset. — Serial Wire (SW-DP) or JTAG (JTAG-DP) debug access, or both.
The processor components exist in two levels of hierarchy, as shown in Figure 1-1. This represents the RTL hierarchy of the design. Four components, ETM, TPIU, SW/JTAG-DP, and ROM table, are shown outside the Cortex-M3 level because these components are either optional, or there is flexibility in how they are implemented and used.
Page 30
TPIU. • In a production device, the TPIU might have been removed. Note There is no Cortex-M3 trace capability if the TPIU has been removed. SW/JTAG-DP The implementation options for the SW/JTAG-DP are: • Your implementation might contain either or both SW-DP and JTAG-DP.
Page 34
1.2.10 TPIU The TPIU acts as a bridge between the Cortex-M3 trace data from the ITM, and ETM if present, and an off-chip Trace Port Analyzer. The TPIU can be configured to support either serial pin trace for low cost debug, or multi pin trace for higher bandwidth trace.
The number of bits of interrupt priority can be configured at implementation from three to eight bits. 1.3.2 The Cortex-M3 system can be configured at implementation to include an MPU. Chapter 9 Memory Protection Unit describes the MPU. 1.3.3 The Cortex-M3 system can be configured at implementation to include an ETM.
Thumb instruction set and the base Thumb-2 32-bit instruction set architecture. The processor cannot execute ARM instructions. The Thumb instruction set is a subset of the ARM instruction set, re-encoded to 16 bits. It supports higher code density and systems with memory data buses that are 16 bits wide or narrower.
Programmer’s Model Registers The Cortex-M3 processor has the following 32-bit registers: • 13 general-purpose registers, r0-r12 • stack point alias of banked registers, SP_process and SP_main • link register, r14 • program counter, r15 • one program status register, xPSR.
Application PSR The Application PSR (APSR) contains the condition code flags. Before entering an exception, the Cortex-M3 processor saves the condition code flags on the stack. You can access the APSR with the MSR(2) and MRS(2) instructions. Figure 2-2 shows the fields of the APSR.
It always accesses code in little-endian format. Note Little-endian is the default memory format for ARM processors. In little-endian format, the byte with the lowest address in a word is the least-significant byte of the word. The byte with the highest address in a word is the most significant.
Programmer’s Model Instruction set The Cortex-M3 processor does not support ARM instructions. The Cortex-M3 processor supports all ARMv6 Thumb instructions except those listed in Table 2-4. Table 2-4 Nonsupported Thumb instructions Instruction Action if executed BLX(1) Branch with link and exchange BLX(1) always faults.
1MB of the SRAM and Peripheral memory regions respectively. These bit-band regions map each word in an alias region of memory to a bit in a bit-band region of memory. The Cortex-M3 memory map has two 32-MB alias regions that map to two 1-MB bit-band regions: •...
ISRs. • Dynamic reprioritization of interrupts. • Closely-coupled interface between the Cortex-M3 core and the NVIC to enable early processing of interrupts and processing of late-arriving interrupts with higher priority. • Configurable number of interrupts, from 1 to 240.
Exceptions Table 5-4 describes the steps that the Cortex-M3 processor takes before it enters an ISR. Table 5-4 Exception entry steps Action Restartable? Description Push eight Pushes xPSR, PC, r0, r1, r2, r3, r12, and LR on selected stack. registers Read vector table Yes.
FCLK and HCLK are synchronous to each other. FCLK is a free running version of HCLK. For more information, see Chapter 7 Power Management. FCLK and HCLK must be balanced with respect to each other, with equal latencies into Cortex-M3. The processor is integrated with components for debug and trace. Your macrocell may contain some, or all, of the clocks shown in Table 6-2.
Page 125
Clocking and Resets Note Cortex-M3 also contains a STCLK input. This port is not a clock. It is a reference input for the SysTick counter, and it must be less than half the frequency of FCLK. STCLK is synchronized internally by the processor to FCLK.
Clocking and Resets Note LOCKUP from the Cortex-M3 system should be considered for inclusion in any external watchdog circuitry when an external debugger is not attached. Figure 6-3 Internal reset synchronization 6.3.2 System reset A system or warm reset initializes the majority of the macrocell, excluding the NVIC debug logic, Flash Patch and Breakpoint (FPB), Data Watchpoint and Trigger (DWT), and Instruction Trace Macrocell (ITM).
The ARMv7-M architecture supports system sleep modes that enable the Cortex-M3 and system clocks to be stopped for greater power reductions. These are described in System power management on page 7-3.
Power Management System power management Writing to the System Control Register (see System Control Register on page 8-23) controls the Cortex-M3 system power states. Table 7-1 shows the supported sleep modes. Table 7-1 Supported sleep modes Sleep mechanism Description Sleep-now The Wait For Interrupt (WFI) or the Wait For Event (WFE) instructions request the sleep-now model.
SLEEPDEEP in the low-power state. When exiting low-power state, the LOCK signal indicates that the PLL is stable, and it is safe to enable the Cortex-M3 clock, ensuring that the processor is not re-started until the clocks are stable.
= 161...192 b00110 = 193...224 b00111 = 225...256* *Cortex-M3 processor only supports between 1 and 240 external interrupts. SysTick Control and Status Register Use the SysTick Control and Status Register to enable the SysTick features. The register address, access type, and Reset state are:...
Page 159
System Control Register Use the System Control Register for power-management functions: • signal to the system when the Cortex-M3 processor can enter a low power state • control how the processor enters and exits low power states. The register address, access type, and Reset state are:...
SLEEPDEEP Sleep deep bit: 1 = indicates to the system that Cortex-M3 clock can be stopped. Setting this bit causes the SLEEPDEEP port to be asserted when the processor can be stopped. 0 = not OK to turn off system clock.
The processor supports both level and pulse interrupts. A level interrupt is held asserted until it is cleared by the ISR accessing the device. A pulse interrupt is a variant of an edge model. The edge must be sampled on the rising edge of the Cortex-M3 clock, HCLK, instead of being asynchronous.
— Trace Port Interface Unit (TPIU). This component acts as a bridge between the Cortex-M3 trace data (from the ITM, and ETM if present) and an off-chip Trace Port Analyzer. See Chapter 13 Trace Port Interface Unit for more information.
Time stamping. Timestamps are emitted relative to packets. ITM contains a 21-bit counter to generate the timestamp. The counter is clocked using either the Cortex-M3 clock, or the bitclock rate of the SWV output. 11.6.1 Summary and description of the ITM registers...
1 = not Full) in bit 0. The polled FIFO interface does not provide an atomic read-modify-write, so the Cortex-M3 exclusive monitor must be used if a polled printf is used concurrently with ITM usage by interrupts or other threads. The following polled code guarantees stimulus is not lost by polled access to the ITM: ;...
AHB Access Port The Advanced High-performance Bus Access Port (AHB-AP) is a debug access port into Cortex-M3, and provides access to all memory and registers in the system, including processor registers (through the NVIC). System access is independent of the processor status.
This field is zero for the first implementation of an AP design, and is updated for each major revision of the design. [27:24] JEP-106 continuation code For an ARM-designed AP, this field has value 0b0100, [23:17] JEP-106 identity code For an ARM-designed AP, this field has value 0b0111011,...
AHB-AP port. For more information, see AHB Access Port on page 11-35. These alternative DP implementations provide different mechanisms for debug access to Cortex-M3. Your implementation might contain either, or both, of these components. Note • Only one DP can be used at once, and switching between the two debug ports should only be performed when neither DP is in use.
JTAG-DP. It is based closely on the JTAG TAP State Machine, see IEEE Std 1149.1-1990. This chapter describes both the JTAG-DP and its scan chain interface. Figure 12-1 on page 12-4 shows an ARM Debug Interface with a JTAG-DP, including the operation of the scan chain interface.
Debug Port Figure 12-2 The DAP State Machine (JTAG) When using an ARM Debug Interface, for the debug process to work correctly, systems must not remove power from the JTAG-DP during a debug session. If power is removed, the DAP controller state is lost. However, the DAP is designed to enable the rest of the DAP and the core to be powered down and debugged, while maintaining power to the JTAG-DP.
Page 256
Note This is a change from the behavior of previous versions of the ARM Debug Interface based on the IEEE JTAG standard. From ARM Debug Interface v5, debuggers do not have to gate the DAP clock to obtain a true rest state.
IEEE 1149.1 compliance. The required instructions are listed in Table 12-3 on page 12-9. Note • ARM Limited recommends that separate JTAG TAPs are used for boundary scan and debug. • If the IR register is set to an IR instruction value that is not implemented, or reserved, then the Bypass Register is selected.
Page 266
WAIT response if Capture-DR is entered before this limit has expired. Although any debugger must be able to recover successfully from any WAIT response, ARM Limited recommends that debuggers should be able to adapt to any Implementation-defined limit.
12.3 SW-DP This section gives an architectural description of the ARM Serial Wire Debug (SW-DP) interface. In particular, it describes the Serial Wire Debug (SWD) protocol, and how this protocol provides access to the DP registers. These registers are described in detail in Debug Port Programmer’s Model on page 12-47.
Debug Port 12.5 Debug Port Programmer’s Model Every Cortex-M3 system includes one, or both of: • a JTAG Debug Port (JTAG-DP) • a Serial Wire Debug Port (SW-DP). This section contains: • JTAG-DP Registers. This contains a summary of the JTAG-DP registers.
[11:1] MANUFACTURER JEDEC Manufacturer ID, an 11-bit JEDEC code that identifies the manufacturer of the device. See The JEDEC Manufacturer ID. The ARM default value for this field, shown in Figure 12-21 on page 12-52, is 0x23B Designers can change the value of this field. If the DAP is also used for boundary scan then this field must be set to the JEDEC Manufacturer ID assigned to the implementor.
A configuration that supports both ITM and ETM debug trace. Note If your Cortex-M3 system uses the optional ETM component, you must use the TPIU configuration that supports both ITM and ETM debug trace. For a full description of the ETM, see Chapter 15 Embedded Trace Macrocell.
Use the Integration Test Registers to perform topology detection of the TPIU with other devices in a Cortex-M3 system. These registers enable direct control of outputs and the ability to read the value of inputs. The processor provides two Integration Test Registers: •...
Bus Interface 14.6 Access alignment The Cortex-M3 processor supports unaligned data accesses using the ARMv6 model. The DCode and System bus interfaces contain logic that converts unaligned accesses to aligned accesses. The unaligned data accesses are described in Table 14-2. The table shows the unaligned access in the first column, with the remaining columns showing what the access is converted into.
14.9 Write buffer To prevent bus wait cycles from stalling the Cortex-M3 processor during data stores, buffered stores to the DCode and System buses go through a one-entry write buffer. If the write buffer is full, subsequent accesses to the bus stall until the write buffer has drained.
15.2 Data tracing The Cortex-M3 system can perform low-bandwidth data tracing using the Data Watchpoint and Trace (DWT) and Instruction Trace Macrocell (ITM) components. To enable instruction trace to be supported with a low pin-count, data trace is not included in the ETM.
ETM FIFO. However, with an 8-bit ATB port the FIFO always drains which makes AFVALID unnecessary. The Cortex-M3 system is equipped with an optimized TPIU that is designed for use with the ETM and ITM. This TPIU does not support additional trace sources. However, additional trace sources can be added if the TPIU has been replaced with a more complex version, and more trace infrastructure.
Embedded Trace Macrocell 15.5 ETM architecture The ETM is an instruction only ETM that implements ARM ETM architecture v3.4. It is based on the ARM ETM Architecture specification. For full details, see the ARM Embedded Trace Macrocell Architecture Specification. All Thumb-2 instructions are traced as a single instruction. Instructions following an IT instruction are traced as normal conditional instructions.
SW-DP/JTAG-DP. 15.6.2 List of ETM registers The ETM registers are listed in Table 15-3. For full details, see the ARM Embedded Trace Macrocell Architecture Specification. Table 15-3 ETM registers...
Note HADDRICore and HTRANSICore are the address and transaction request signals from the processor, and not the signals on the external Cortex-M3 interface. Figure 16-3 on page 16-6 and Figure 16-4 on page 16-6 show a conditional branch forwards not taken and taken. The branch occurs speculatively in the decode phase of the opcode.
Description LOCKUP Output Indicates that the core is locked up. SLEEPDEEP Output Indicates that the Cortex-M3 clock can be stopped. SLEEPING Output Indicates that the Cortex-M3 clock can be stopped. CURRPRI[7:0] Output Indicates what priority interrupt (or base boost) is currently used. CURRPRI represents the pre-emption priority, and does not indicate the secondary priority.
Page 389
Glossary This glossary describes some of the terms used in technical documents from ARM Limited. A mechanism that indicates to a core that the attempted memory access is invalid or not Abort allowed or that the data returned by the memory access is invalid. An abort can be caused by the external or internal memory system as a result of attempting to access invalid or protected instruction or data memory.
Page 390
A family of protocol specifications that describe a strategy for the interconnect. AMBA is the ARM open standard for on-chip buses. It is an on-chip bus specification that details a strategy for the interconnection and management of functional blocks that make up a System-on-Chip (SoC).
Page 391
An instruction of the ARM Instruction Set Architecture (ISA). These cannot be ARM instruction executed by the Cortex-M3. The processor state in which the processor executes the instructions of the ARM ISA. ARM state The processor only operates in Thumb state, never in ARM state.
Page 393
Glossary The ARM architecture supports byte-invariant systems in ARMv6 and later versions. When byte-invariant support is selected, unaligned halfword and word memory accesses are also supported. Multi-word accesses are expected to be word-aligned. See also Word-invariant. Gating a clock signal for a macrocell with a control signal and using the modified clock Clock gating that results to control the operating state of the macrocell.
Page 398
TDI, TDO, TMS, and TCK. The optional terminal is TRST. This signal is mandatory in ARM cores because it is used to reset the debug logic. A halfword that specifies an operation for an ARM processor in Thumb state to Thumb instruction perform.
Page 399
The change of endianness occurs because of the change to the byte addresses, not because the bytes are rearranged. The ARM architecture supports word-invariant systems in ARMv3 and later versions. When word-invariant support is selected, the behavior of load or store instructions that are given unaligned addresses is instruction-specific, and is in general not the expected behavior for an unaligned access.
Need help?
Do you have a question about the Cortex-M3 and is the answer not in the manual?
Questions and answers