Cortex-M3 Memory Systems

Slides:



Advertisements
Similar presentations
Cortex-M3 Implementation Overview. Chapter 6 in the reference book.
Advertisements

Computer Architecture
Microprocessors A Beginning.
Parul Polytechnic Institute
Dr. Rabie A. Ramadan Al-Azhar University Lecture 3
ARM 2007 Chapter 13 Memory Protection Unit (MPU) Optimization Technique in Embedded System (ARM) 2008 April.
Chapter 2 Data Manipulation Dr. Farzana Rahman Assistant Professor Department of Computer Science James Madison University 1 Some sldes are adapted from.
Developing a Generic Hard Fault handler for ARM Cortex-M3/Cortex-M4
Chapter 2 HARDWARE SUMMARY
8051 Core Specification.
The 8085 Microprocessor Architecture
I/O Unit.
Avishai Wool lecture Introduction to Systems Programming Lecture 8 Input-Output.
The ARM7TDMI Hardware Architecture
1 Hardware and Software Architecture Chapter 2 n The Intel Processor Architecture n History of PC Memory Usage (Real Mode)
Introduction to ARM Architecture, Programmer’s Model and Assembler Embedded Systems Programming.
Recap – Our First Computer WR System Bus 8 ALU Carry output A B S C OUT F 8 8 To registers’ input/output and clock inputs Sequence of control signal combinations.
ARM programmer’s model and assembler Embedded Systems Programming.
I/O Subsystem Organization and Interfacing Cs 147 Peter Nguyen
Embedded Systems Programming
ARM Core Architecture. Common ARM Cortex Core In the case of ARM-based microcontrollers a company named ARM Holdings designs the core and licenses it.
NS Training Hardware. Memory Interface Support for SDRAM, asynchronous SRAM, ROM, asynchronous flash and Micron synchronous flash Support for 8,
Micro controllers A self-contained system in which a processor, support, memory, and input/output (I/O) are all contained in a single package.
3-1 System peripherals & Bus Structure Memory map of the LPC2300 device is one contiguous 32-bit address range. However, the device itself is made up of.
Cortex-M3 Debugging System
Computer Organization
AT91RM9200 Boot strategies This training module describes the boot strategies on the AT91RM9200 including the internal Boot ROM and the U-Boot program.
CORTEX-M0 Structure Discussion 2 – Core Peripherals
Extended Memory Controller and the MPAX registers
Dr. Rabie A. Ramadan Al-Azhar University Lecture 6
MICROPROCESSOR INPUT/OUTPUT
1. Introduction 2. Methods for I/O Operations 3. Buses 4. Liquid Crystal Displays 5. Other Types of Displays 6. Graphics Adapters 7. Optical Discs 10/01/20151Input/Output.
Samsung ARM S3C4510B Product overview System manager
1-1 Embedded Network Interface (ENI) API Concepts Shared RAM vs. FIFO modes ENI API’s.
ECE 265 – LECTURE 3 68HC11 Address Space, Memory, Registers, and data transfers 3/29/ ECE265.
Input-Output Organization
Interrupt driven I/O. MIPS RISC Exception Mechanism The processor operates in The processor operates in user mode user mode kernel mode kernel mode Access.
80386DX functional Block Diagram PIN Description Register set Flags Physical address space Data types.
ARM Assembly Language Programming and Architecture by Mazidi et al
AT91 C-startup. 2 For reasons of modularity and portability most application code for an embedded application is written in C The application entry point.
Introduction to Microprocessors - chapter3 1 Chapter 3 The 8085 Microprocessor Architecture.
Interrupt driven I/O Computer Organization and Assembly Language: Module 12.
بسم الله الرحمن الرحيم MEMORY AND I/O.
1 Basic Processor Architecture. 2 Building Blocks of Processor Systems CPU.
1 Device Controller I/O units typically consist of A mechanical component: the device itself An electronic component: the device controller or adapter.
Chapter 11 System Performance Enhancement. Basic Operation of a Computer l Program is loaded into memory l Instruction is fetched from memory l Operands.
Memory system Kang Min Ju. 01 Memory map NVIC : Nested Vector Interrupt Controller MPU : Memory Protection Unit * This arrangement allows:
ARM7 TDMI INTRODUCTION.
I NTEL 8086 M icroprocessor بسم الله الرحمن الرحيم 1.
ARM Cortex M3 & M4 Chapter 4 - Architecture
Nios II Processor: Memory Organization and Access
Figure 6-1: Memory Byte Addressing in ARM
UNIT – Microcontroller.
ECE 3430 – Intro to Microcomputer Systems
ARM Cortex-M3 RTLAB 박 유 진.
The Cortex-M3/m4 Embedded Systems: Cortex-M3/M4 Instruction Sets
The 8085 Microprocessor Architecture
Chapter 4 Addressing modes
An Introduction to Microprocessor Architecture using intel 8085 as a classic processor
Interfacing Memory Interfacing.
Number Representations and Basic Processor Architecture
AT91RM9200 Boot strategies This training module describes the boot strategies on the AT91RM9200 including the internal Boot ROM and the U-Boot program.
Operating Systems Chapter 5: Input/Output Management
Md. Mojahidul Islam Lecturer Dept. of Computer Science & Engineering
Md. Mojahidul Islam Lecturer Dept. of Computer Science & Engineering
The 8085 Microprocessor Architecture
Introduction to Microprocessor Programming
CORTEX-M0 Structure Discussion 1
Modified from notes by Saeid Nooshabadi
ARM920T Processor This training module provides an introduction to the ARM920T processor embedded in the AT91RM9200 microcontroller.We’ll identify the.
Presentation transcript:

Cortex-M3 Memory Systems

Chapter 5 in the reference book

8.4 Memory System 8.4.1 Memory System Features Overview 1. A predefined memory map that specifies which bus interface is to be used when a memory location is accessed. 2. Bit-band: This provides atomic operations to bit data in memory or peripherals, only supported in special memory regions 3. Supports unaligned transfers and exclusive accesses as well. 4. the Cortex-M3 supports both little endian and big endian memory configuration

8.4.2 Memory Maps The Cortex-M3 processor has a fixed memory map. Some of the memory locations are allocated for private peripherals such as debugging components. 1. Fetch Patch and BreakPoint Unit (FPB) 2. Data WatchPoint and Trace Unit (DWT) 3. Instrumentation Trace Macrocell (ITM) 4. Embedded Trace Macrocell (ETM) 5. Trace Port Interface Unit (TPIU) 6. ROM Table The Cortex-M3 processor has a total of 4 GB of address space.

A Cortex-M3 Predefined Memory Map

SRAM: 0.5 GB. The SRAM memory range is for connecting internal SRAM. On-chip peripherals: 0.5 GB, supports bit-band alias and is accessed via the system bus interface. External RAM: 1 GB. Program execution is allowed. External devices: 1 GB. Program execution is not allowed. System-level components + internal private peripheral buses + external private peripheral bus + vendor-specific system peripherals: 0.5 GB.

Private peripheral bus: 1. AHB private peripheral bus, for Cortex-M3 internal AHB peripherals only. 2. APB private peripheral bus, for Cortex-M3 internal APB devices as well as external peripherals. The System Control Space

8.4.3 Memory Access Attributes The memory map also defines the memory attributes of accessing each memory block or device: The default memory attribute settings can be overridden if MPU is present and the region is programmed differently from the default. Bufferable Cacheable Sharable Executable

Address Space Division and Attributes Region Address For Cacheable Executable, buffered Code memory region 0x00000000–0x1FFFFFFF Code and data as well cacheable Executable, write buffered SRAM memory region 0x20000000–0x3FFFFFFF On-chip RAM Peripheral region 0x40000000–0x5FFFFFFF Peripherals Noncacheable Nonexecutable External RAM region 0x60000000–0x7FFFFFFF Either on-chip or off-chip memory Executable 0x80000000–0x9FFFFFFF External devices 0xA0000000–0xBFFFFFFF External devices and/or shared memory Nonexecutable, nonbuffered 0xC0000000–0xDFFFFFFF System region 0xE0000000–0xFFFFFFFF Private peripherals and Vendor-specific devices Nonexecutable, nonbuffered (buffered for vendor-specific memory)

8.4.4 Default Memory Access Permissions The Cortex-M3 memory map has a default configuration for memory access permissions Prevents user program from accessing system control memory spaces The default memory access permission is used when either: 1. No MPU is present 2. MPU is present but disabled Otherwise, the MPU will determine whether user accesses are allowed When a user access is blocked, the fault exception takes place immediately.

Default Memory Access Permissions Memory Region Address Access in User Program Vendor specific 0xE0100000–0xFFFFFFFF Full access ETM 0xE0041000–0xE0041FFF Blocked; user access results in bus fault TPIU 0xE0040000–0xE0040FFF Internal PPB 0xE000F000–0xE003FFFF NVIC 0xE000E000–0xE000EFFF FPB 0xE0002000–0xE0003FFF DWT 0xE0001000–0xE0001FFF ITM 0xE0000000–0xE0000FFF Read allowed; write ignored except for stimulus ports with user access enabled External Ram 0x60000000–0x9FFFFFFF Peripheral 0x40000000–0x5FFFFFFF SRAM 0x20000000–0x3FFFFFFF Code 0x00000000–0x1FFFFFFF

8.4.5 Bit-Band Operations Bit-band operation support allows a single load/store (read/write) operation to access a single data bit. Bit-band regions: 1. The first 1 MB of the SRAM region 2. The first 1 MB of the peripheral region They can be accessed via a separate memory region called the bit-band alias.

Bit-Band Region and Bit-Band Alias

Remapping of Bit-Band Addresses in SRAM Region Remapping of Bit-Band Addresses in Peripheral Memory Region Bit-Band Region Aliased Equivalent 0x20000000 bit[0] 0x22000000 bit[0] 0x20000000 bit[1] 0x22000004 bit[0] 0x20000000 bit[2] 0x22000008 bit[0] … 0x20000000 bit[31] 0x2200007C bit[0] 0x20000004 bit[0] 0x22000080 bit[0] 0x20000004 bit[31] 0x220000FC bit[0] 0x200FFFFC bit[31] 0x23FFFFFC bit[0] Bit-Band Region Aliased Equivalent 0x40000000 bit[0] 0x42000000 bit[0] 0x40000000 bit[1] 0x42000004 bit[0] 0x40000000 bit[2] 0x42000008 bit[0] … 0x40000000 bit[31] 0x4200007C bit[0] 0x40000004 bit[0] 0x42000080 bit[0] 0x40000004 bit[31] 0x420000FC bit[0] 0x400FFFFC bit[31] 0x43FFFFFC bit[0]

Bit Accesses to Bit-Band Region Via the Bit-Band Alias

Write to Bit-Band Alias To set bit 2 in word data in address 0x20000000: Write:

The assembler sequence to Write: 1. Without Bit-Band: LDR R0, =0x20000000 ; Setup address LDR R1, [R0] ; Read ORR.W R1, #0x4 ; Modify bit STR R1, [R0] ; Write back result 2. With Bit-Band: LDR R0, =0x22000008 ; Setup address MOV R1, #1 ; Setup data STR R1, [R0] ; Write

Read from the Bit-Band Alias

The assembler sequence to read: 1. With Bit-Band: LDR R0, =0x20000000 ; Setup address LDR R1, [R0] ; Read UBFX.W R1, R1, #2, #1 ; Extract bit[2] 2. With Bit-Band: LDR R0, =0x22000008 ; Setup address

For read operations, the word is read and the chosen bit location is shifted to the LSB of the read return data. For write operations, the written bit data is shifted to the required bit position, and a READ-MODIFY-WRITE is performed.

Example: 1. Set address 0x20000000 to a value of 0x3355AACC. 2. Read address 0x22000008. This read access is remapped into read access to 0x20000000. The return value is 1 (bit[2] of 0x3355AACC). 3. Write 0x0 to 0x22000008. 4. Now read 0x20000000. That gives you a return value of 0x3355AAC8 (bit[2] =0).

Advantages of using bit-band operations: Faster bit operations with fewer instructions Exclusive read/write operations (by hardware) Store and handle Boolean data in the SRAM region (packed together and can be accessed separately)

8.4.6 Unaligned Transfers The Cortex-M3 supports unaligned transfers on single accesses. Data memory accesses can be defined as aligned or unaligned. 1. Word size, the address is not a multiple of 4. Byte 3 Byte 2 Byte 1 Byte 0 Address N+4 [31:24] Address N [23:16] [15:8] [7:0] Unaligned Transfer Example 1 Byte 3 Byte 2 Byte 1 Byte 0 Address N+4 [31:24] [23:16] Address N [15:8] [7:0] Unaligned Transfer Example 2 Byte 3 Byte 2 Byte 1 Byte 0 Address N+4 [31:24] [23:16] [15:8] Address N [7:0] Unaligned Transfer Example 3

2. Half word size, and the address is not a multiple of 2. Byte 3 Byte 2 Byte1 Byte 0 Address N+4 Address N [15:8] [7:0] Unaligned Transfer Example 4 Byte 3 Byte 2 Byte 1 Byte 0 Address N+4 [15:8] Address N [7:0] Unaligned Transfer Example 5

There are a number of limitations: 1. Not supported in Load/Store multiple instructions. 2. Stack operations (PUSH/POP) must be aligned. 3. Exclusive accesses must be aligned. 4. Unaligned transfers are not supported in bit-band operations. When unaligned transfers are used, they are actually converted into multiple aligned transfers by the processor’s bus interface unit Transparent to application programmers. It takes more clock cycles for a single data access

8.4.7 Exclusive Accesses(LDREX,STREX) SWP instruction (swap) was used to check semaphore status in early ARM processors. But Cortex-M3 cannot support SWP any more. 1. What is semaphore? Semaphores are commonly used for allocating shared resources to applications. When a resource is being used by one process, it is locked to that process and exclusive to others. A semaphore is the lock flag. 2. Why is exclusive access used instead of SWP instruction? When a process or application want to use a resource, it needs to check whether the resource has been locked first. In ARM V7 architecture, the read/write access can be carried out on separated buses. Therefore, the SWP instructions (requiring the read and write in a locked transfer sequence must be on the same bus) can no longer be used to make the memory access atomic. Therefore, the locked transfers are replaced by exclusive accesses.

3. The difference between SWP instructions and exclusive access. The concept of exclusive access operation is quite simple but different from SWP, which allows the possibility that the memory location for a semaphore could be accessed by multiple buses.

Exclusive access instructions include: 1. LDREX (word) 2. LDREXB (byte) 3. LDREXH (half word) 4. STREX (word) 5. STREXB (byte) 6. STREXH (half word)

8.4.8 Endian Mode The Cortex-M3 supports both little endian(recommended) and big endian modes. However, the supported memory type also depends on the design of the rest of the microcontroller (bus connections, memory controllers, peripherals, and so on). Make sure that you check your microcontroller datasheets in detail before developing your software The definition of big endian in the Cortex-M3 is different from the ARM7’s. In the ARM7TDMI, the big endian scheme is called word-invariant big endian, whereas in the Cortex-M3, the big endian scheme is called byte-invariant big endian.

The Cortex-M3 (Byte-Invariant Big Endian): Data in memory Address, Size Bits 31-24 Bits 23-16 Bits 15-8 Bits 7-0 0x1000, word Data[7:0] Data[15:8] Data[23:16] Data[31:24] 0x1000, half word -- 0x1000, byte 0x1001, byte 0x1002, byte 0x1003, byte

The endian mode is set when the processor exits reset and it cannot be changed afterward. Instruction fetches are always in little endian, as are data accesses in the configuration control memory space and the external PPB memory range. The data can be easily converted between little endian and big endian using instructions REV/REVH.