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 16
WIC mode enable sequence ..................7-7 Figure 7-4 Power down timing sequence ................... 7-8 Figure 7-5 PMU, WIC, and Cortex-M3 interconnect ..............7-9 Figure 8-1 Interrupt Controller Type Register bit assignments ..........8-7 Figure 8-2 Auxiliary Control Register bit assignments ............... 8-8 Figure 8-3 SysTick Control and Status Register bit assignments ..........
Preface About this book This book is for the Cortex-M3 processor. Product revision status The rnpn identifier indicates the revision status of the product described in this manual, where: Identifies the major revision of the product. Identifies the minor revision or modification status of the product.
Page 24
Denotes AXI read data channel signals. Prefix W Denotes AXI write data channel signals. Further reading This section lists publications by ARM and by third parties. for access to ARM documentation. http://infocenter.arm.com ARM publications This book contains information that is specific to this product. See the following documents for other relevant information: •...
Preface Feedback ARM welcomes feedback on this product and its documentation. Feedback on this product If you have any comments or suggestions about this product, contact your supplier and give: • The product name. • The product revision or version.
Page 36
• In a production device, the TPIU might have been removed. Note There is no Cortex-M3 trace capability if the TPIU is removed. Chapter 17 Trace Port Interface Unit describes the TPIU. 1.2.12 You can configure the implementation to include a Wake-up Interrupt Controller (WIC).
A refinement is to only predict backward conditional branches to accelerate loops. Alternatively, with ARM compilers favouring loops with unconditional branch backwards at the bottom and then conditional branch forward tests on the loop limit, the core fetch queue being ahead at the start of the loop yields good behavior.
Introduction Store buffers The processor contains two store buffers: • Cortex-M3 core LSU store buffer for immediate offset opcode. • Bus-matrix store buffer for wait states and unaligned transactions. The core store buffer optimizes the case of STR rx,[ry,#imm], which is common in compiled code.
CPUID Base Register VARIANT field changed to indicate Rev1. See NVIC register descriptions on page 8-7. • Cortex-M3 Rev0 Bit-band accesses in BE8 mode required access sizes to be byte. Cortex-M3 Rev1 has been changed so that BE8 bit-band accesses function with any access size.
Page 47
— stop IT folding — disable the write buffers in Cortex-M3 for default memory map accesses. For details on the Auxiliary Control Register see Auxiliary Control Register on page 8-8. • The STKALIGN bit reset value in the Configuration and Control Register at...
The processor implements the ARMv7-M architecture. This includes all the 16-bit Thumb instructions and the base 32-bit Thumb instructions. The processor cannot execute ARM instructions. For more information about the ARMv7-M Thumb instruction set see the ARMv7-M Architecture Reference Manual.
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.
• a summary of the processor 16-bit instructions • a summary of the processor 32-bit instructions. Table 2-4 lists the 16-bit Cortex-M3 instructions. Table 2-4 16-bit Cortex-M3 instruction summary Operation Assembler Add register value and C flag to register value ADC <Rd>, <Rm>...
Page 62
Programmer’s Model Table 2-4 16-bit Cortex-M3 instruction summary (continued) Operation Assembler Compare negation of register value with another register value CMN <Rn>, <Rm> Compare immediate 8-bit value CMP <Rn>, #<immed_8> Compare registers CMP <Rn>, <Rm> Compare high register to low or high register CMP <Rn>, <Rm>...
Page 63
Programmer’s Model Table 2-4 16-bit Cortex-M3 instruction summary (continued) Operation Assembler Move immediate 8-bit value to register MOV <Rd>, #<immed_8> Move low register value to low register MOV <Rd>, <Rn> Move high or low register value to high or low register MOV <Rd>, <Rm>...
Programmer’s Model Table 2-4 16-bit Cortex-M3 instruction summary (continued) Operation Assembler Store register halfword [15:0] to register address + register offset STRH <Rd>, [<Rn>, <Rm>] Subtract immediate 3-bit value from register SUB <Rd>, <Rn>, #<immed_3> Subtract immediate 8-bit value from register value SUB <Rd>, #<immed_8>...
Page 65
Programmer’s Model Table 2-5 32-bit Cortex-M3 instruction summary (continued) Operation Assembler Conditional branch B{cond}.W <label> Clear bit field BFC.W <Rd>, #<lsb>, #<width> Insert bit field from one register value into another BFI.W <Rd>, <Rn>, #<lsb>, #<width> Bitwise AND register value with complement of immediate BIC{S}.W <Rd>, <Rn>, #<modify_constant(immed_12)>...
Page 66
Programmer’s Model Table 2-5 32-bit Cortex-M3 instruction summary (continued) Operation Assembler Memory word from base register address + immediate 12-bit LDR.W <Rxf>, [<Rn>, #<offset_12>] offset Memory word to PC from register address + immediate 12-bit LDR.W PC, [<Rn>, #<offset_12>] offset Memory word to PC from base register address immediate LDR.W PC, [Rn], #<+/-<offset_8>...
Page 67
Programmer’s Model Table 2-5 32-bit Cortex-M3 instruction summary (continued) Operation Assembler Load register exclusive calculates an address from a base LDREX<c> <Rt>,[<Rn>{,#<imm>}] register value and an immediate offset, loads a word from memory, writes it to a register Load register exclusive halfword calculates an address from a LDREXH<c>...
Page 68
Programmer’s Model Table 2-5 32-bit Cortex-M3 instruction summary (continued) Operation Assembler Memory signed halfword [15:0] from base register address LDRSH.W <Rxf>, [<Rn>, #<+/–<offset_8>] immediate 8-bit offset, preindexed Memory signed halfword [15:0] from register address shifted LDRSH.W <Rxf>, [<Rn>, <Rm>{, LSL #<shift>}]...
Page 69
Programmer’s Model Table 2-5 32-bit Cortex-M3 instruction summary (continued) Operation Assembler Reverse bytes in each halfword REV16.W <Rd>, <Rn> Reverse bytes in bottom halfword and sign-extend REVSH.W <Rd>, <Rn> Rotate right by number in register ROR{S}.W <Rd>, <Rn>, <Rm> Rotate right with extend RRX{S}.W <Rd>, <Rm>...
Page 70
Programmer’s Model Table 2-5 32-bit Cortex-M3 instruction summary (continued) Operation Assembler Register byte [7:0] to register address immediate 8-bit offset, STRB.W <Rxf>, [<Rn>], #+/–<offset_8> postindexed Register byte [7:0] to register address shifted by 0, 1, 2, or 3 STRB.W <Rxf>, [<Rn>, <Rm>{, LSL #<shift>}]...
Page 71
Programmer’s Model Table 2-5 32-bit Cortex-M3 instruction summary (continued) Operation Assembler Table branch byte TBB [<Rn>, <Rm>] Table branch halfword TBH [<Rn>, <Rm>, LSL #1] Exclusive OR register value with immediate 12-bit value TEQ.W <Rn>, #<modify_constant(immed_12)> Exclusive OR register value with shifted register value TEQ.W <Rn>, <Rm>{, <shift}...
Configurable number of interrupt priorities, from 3 to 8 bits (8 to 256 levels). • Separate stacks and privilege levels for Handler and Thread modes. • ISR control transfer using the calling conventions of the C/C++ standard ARM Architecture Procedure Call Standard (AAPCS). • Priority masking to support critical regions.
I2CIsr Note Vector table entries are ARM/Thumb interworking compatible. This causes bit [0] of the vector value to load into the EPSR T-bit on exception entry. Creating a table entry with bit [0] clear generates an INVSTATE fault on the first instruction of the handler corresponding to this vector.
Clocking and Resets Note You must consider LOCKUP from the Cortex-M3 system for inclusion in any external watchdog circuitry when an external debugger is not attached. CortexM3Integration HCLK CortexM3 PORESETn, SYSRESETn RSTBYPASS 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, FPB, DWT, and ITM.
The ARMv7-M architecture supports system sleep modes that can stop the Cortex-M3 and system clocks 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-25) 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. Cortex M3 processor...
Page 146
WIC functionality. WIC overview The Cortex-M3 NVIC has logic dedicated to determining whether at any point in time a newly received interrupt is of higher priority than the current priority and must therefore be taken over the current execution context or priority. This priority scheme also operates during WFE, WFI, and sleep-on-exit to determine when the core must resume execution of instructions after sleeping.
WICSENSE WICDSACKn WICDSACKn Figure 7-5 PMU, WIC, and Cortex-M3 interconnect The non-clocked circuitry can use the signals out of the WIC to deduce whether a particular interrupt causes the WIC to generate a WAKEUP request, and to provide alternative power reduction methods not supported by the WIC directly. All WIC interrupt related pins are agnostic as to how many, or what combinations of INTISR, NMI, or RXEV are attached as long as the same offset is used throughout the WIC.
Page 169
Number of processor within family: [11:10] b11 = Cortex family [9:8] b00 = version [7:6] b00 = reserved [5:4] b10 = M (v7-M) [3:0] X = family member. Cortex-M3 family is b0011. [3:0] REVISION Implementation defined revision number. Interrupt Control State Register Use the Interrupt Control State Register to: •...
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, FCLK, 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 17 Trace Port Interface Unit for more information.
Hardware trace. The DWT generates these packets, and the ITM emits them. • Time stamping. Timestamps are emitted relative to packets. The ITM contains a 21-bit counter to generate the timestamp. The Cortex-M3 clock or the bitclock rate of the Serial Wire Viewer (SWV) output clocks the counter. 11.6.1...
The polled FIFO interface does not provide an atomic read-modify-write, so you must use the Cortex-M3 exclusive monitor 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: ;...
11.7 AHB-AP AHB-AP is an optional debug access port into the Cortex-M3 system, 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. Either SW-DP or SWJ-DP accesses AHB-AP.
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,...
Note Logic can be implemented external to Cortex-M3 if necessary to achieve total compliance, but this is only required if peripherals require the control information to be maintained through a waited transfer. One way of implementing this is to mask the control information, such as HTRANS, while HREADY is low.
The DCode bus supports exclusive accesses. This is carried out using two sideband signals, EXREQD and EXRESPD. For more information, see DCode interface on page A-9. For more information about semaphores and the local exclusive monitor see the ARM Architecture Memory Model chapter in the ARMv7M ARM Architecture Reference Manual.
The System bus supports exclusive accesses. This is carried out using two sideband signals, EXREQS and EXRESPS. For more information, see System bus interface on page A-10. For more information about semaphores and the local exclusive monitor see the ARM Architecture Memory Model chapter in the ARMv7M ARM Architecture Reference Manual.
Note DNOTITRANS is a static input that must be tied high to enforce this behavior. The external ICode/DCode bus multiplexer can be integrated into a Cortex-M3 system as Figure 12-1 shows. AHBI...
AHB interfaces unregistered. Because of this, the Cortex-M3 AHB outputs are valid approximately 50% into the cycle, and the AHB inputs have a setup requirement of approximately 50% of the clock period.
The SWJ-DP is designed to permit pin sharing of JTAG-TDO and JTAG-TDI when they are not being used for JTAG debug access. When used together with a Cortex-M3 TPIU, there are different options for the connection of Serial Wire Output (SWO), see Serial wire output connection on page 17-21.
Table 14-5 Clocks and resets Name Description Direction FCLK Clock for ETM logic which must be connected to the same FCLK as Cortex-M3. Input PORRESETn Power on reset for the HCLK domain. Must not be the same as core HCLK reset Input (SYSRESETn).
TPIU, where they are combined and usually output over the trace port. DWT is able to provide either focused data trace, or global data trace, subject to FIFO overflow issues. The TPIU is optimized for the requirements of a single core Cortex-M3 system.
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, you can add additional trace sources if the TPIU has been replaced with a more complex version, and more trace infrastructure.
Embedded Trace Macrocell 14.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 32-bit Thumb instructions are traced as a single instruction. Instructions following an IT instruction are traced as normal conditional instructions.
Serial Wire Debug Port/JTAG Debug Port (SW-DP/JTAG-DP). 14.6.2 List of ETM registers The ETM registers are listed in Table 14-9. For full details, see the ARM Embedded Trace Macrocell Architecture Specification. Table 14-9 ETM registers Name...
Page 309
14.6.3 Description of ETM registers An additional description of some of the ETM registers is given in the following sections. See the ARM Embedded Trace Macrocell Architecture Specification for more information. ETM Control Register The ETM Control Register controls general operation of the ETM, such as whether tracing is enabled.
If the implementation requires no trace support then the TPIU might not be present. 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 14 Embedded Trace Macrocell.
Input Global trace synchronization trigger. Inserts synchronization packets into the formatted data stream. Only used when the formatter is active. This signal must be connected to the DSYNC output from Cortex-M3. TRIGGER Input Causes a trigger packet to be inserted into the trace stream when the formatter is active.
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: •...
Trace Port Interface Unit 17.3 Serial wire output connection The Cortex-M3 TPIU provides a serial wire output mode that requires a single external pin. There are three options available to connect this pin: • A dedicated pin can be used for TRACESWO •...
Table A-5 lists the signals of the low power interface. Table A-5 Low power interface signals Name Direction Description SLEEPDEEP Output Indicates that the Cortex-M3 clock can be stopped. SLEEPING Output Indicates that the Cortex-M3 clock can be stopped. SLEEPHOLDACKn Output Acknowledge signal for SLEEPHOLDREQn.
• CID registers Table B-2 Differences between issue F and issue G Change Location Wake-up Interrupt Controller (WIC) added to Cortex-M3 block Figure 1-1 on page 1-5 diagram Section 1-2 and section 1-3 combined Components, hierarchy, and implementation on page 1-4...
Page 399
Glossary This glossary describes some of the terms used in technical documents from ARM. 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 400
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 401
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 403
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.
Page 409
Thread Control Block a single thread of execution. A halfword that specifies an operation for an ARM processor in Thumb state to Thumb instruction perform. Thumb instructions must be halfword-aligned. A processor that is executing Thumb (16-bit) halfword aligned instructions is operating Thumb state in Thumb state.
Page 410
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