ARM 2007 Chapter 13 Memory Protection Unit (MPU) Optimization Technique in Embedded System (ARM) 2008 April.

Slides:



Advertisements
Similar presentations
Memory Management Unit
Advertisements

EZ-COURSEWARE State-of-the-Art Teaching Tools From AMS Teaching Tomorrow’s Technology Today.
Memory Management: Overlays and Virtual Memory
Lecture 8: Memory Hierarchy Cache Performance Kai Bu
Memory Management Unit
Cortex-M3 Memory Systems
Unit 4 Chapter-1 Multitasking. The Task State Segment.
Memory Management Unit
CS 153 Design of Operating Systems Spring 2015
COMP3221: Microprocessors and Embedded Systems Lecture 15: Interrupts I Lecturer: Hui Wu Session 1, 2005.
1 Lecture 2: Review of Computer Organization Operating System Spring 2007.
CE6105 Linux 作業系統 Linux Operating System 許 富 皓. Chapter 2 Memory Addressing.
Introduction To The ARM Microprocessor
Reducing Cache Misses (Sec. 5.3) Three categories of cache misses: 1.Compulsory –The very first access to a block cannot be in the cache 2.Capacity –Due.
Virtual Memory and Paging J. Nelson Amaral. Large Data Sets Size of address space: – 32-bit machines: 2 32 = 4 GB – 64-bit machines: 2 64 = a huge number.
ARM programmer’s model and assembler Embedded Systems Programming.
1 COMP 206: Computer Architecture and Implementation Montek Singh Wed, Nov 9, 2005 Topic: Caches (contd.)
1 COMP 206: Computer Architecture and Implementation Montek Singh Wed., Oct. 30, 2002 Topic: Caches (contd.)
Review for Midterm 2 CPSC 321 Computer Architecture Andreas Klappenecker.
Microprocessor Systems Design I Instructor: Dr. Michael Geiger Fall 2012 Lecture 15: Protected mode intro.
Lect 13-1 Lect 13: and Pentium. Lect Microprocessor Family  Microprocessor  Introduced in 1989  High Integration  On-chip 8K.
Caches Hakim Weatherspoon CS 3410, Spring 2012 Computer Science Cornell University See P&H 5.1, 5.2 (except writes)
Cortex-M3 Debugging System
Memory Management in Windows and Linux &. Windows Memory Management Virtual memory manager (VMM) –Executive component responsible for managing memory.
Exception and Interrupt Handling
CORTEX-M0 Structure Discussion 2 – Core Peripherals
Extended Memory Controller and the MPAX registers
Chapter 1 Computer System Overview Dave Bremer Otago Polytechnic, N.Z. ©2008, Prentice Hall Operating Systems: Internals and Design Principles, 6/E William.
Introduction of Intel Processors
Lecture 19: Virtual Memory
1 Linux Operating System 許 富 皓. 2 Memory Addressing.
Chapter 8 CPU and Memory: Design, Implementation, and Enhancement The Architecture of Computer Hardware and Systems Software: An Information Technology.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
Introduction to Virtual Memory and Memory Management
Multilevel Caches Microprocessors are getting faster and including a small high speed cache on the same chip.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
Lecture 1: Review of Computer Organization
1 Chapter Seven CACHE MEMORY AND VIRTUAL MEMORY. 2 SRAM: –value is stored on a pair of inverting gates –very fast but takes up more space than DRAM (4.
Memory Management: Overlays and Virtual Memory. Agenda Overview of Virtual Memory –Review material based on Computer Architecture and OS concepts Credits.
LECTURE 12 Virtual Memory. VIRTUAL MEMORY Just as a cache can provide fast, easy access to recently-used code and data, main memory acts as a “cache”
ARM 7 & ARM 9 MICROCONTROLLERS AT91 1 ARM920T Processor.
Memory Hierarchy— Five Ways to Reduce Miss Penalty.
Memory Hierarchy and Cache Design (3). Reducing Cache Miss Penalty 1. Giving priority to read misses over writes 2. Sub-block placement for reduced miss.
Memory Hierarchy and Cache. A Mystery… Memory Main memory = RAM : Random Access Memory – Read/write – Multiple flavors – DDR SDRAM most common 64 bit.
CS161 – Design and Architecture of Computer
CMSC 611: Advanced Computer Architecture
Lecture 11 Virtual Memory
Protection in Virtual Mode
Chapter 8: Main Memory.
CS161 – Design and Architecture of Computer
Lecture 12 Virtual Memory.
Virtual Memory Use main memory as a “cache” for secondary (disk) storage Managed jointly by CPU hardware and the operating system (OS) Programs share main.
The University of Adelaide, School of Computer Science
Memory Management References text: Tanenbaum ch.4.
QuickPath interconnect GB/s GB/s total To I/O
5.2 Eleven Advanced Optimizations of Cache Performance
Architecture Background
Lecture 14 Virtual Memory and the Alpha Memory Hierarchy
Memory Management References text: Tanenbaum ch.4.
Introduction to the Intel x86’s support for “virtual” memory
Morgan Kaufmann Publishers Memory Hierarchy: Virtual Memory
Computer Architecture
Summary 3 Cs: Compulsory, Capacity, Conflict Misses Reducing Miss Rate
COMP3221: Microprocessors and Embedded Systems
CSE 471 Autumn 1998 Virtual memory
COMP3221: Microprocessors and Embedded Systems
Virtual Memory Use main memory as a “cache” for secondary (disk) storage Managed jointly by CPU hardware and the operating system (OS) Programs share main.
Synonyms v.p. x, process A v.p # index Map to same physical page
CP15 register transfer instructions
ARM920T Processor This training module provides an introduction to the ARM920T processor embedded in the AT91RM9200 microcontroller.We’ll identify the.
Presentation transcript:

ARM 2007 Chapter 13 Memory Protection Unit (MPU) Optimization Technique in Embedded System (ARM) 2008 April

ARM 2007 Overview MPU –Overlapping regions –Background regions Initialize MPU, Cache, Write-Buffer Case: MPU

ARM 2007 Memory Protection In a protected system (ARM MPU) –There are two major classes of resources that need monitoring: »Memory, I/O (maybe memory-mapping) –Uses regions to manage system regions. A “region” is a set of attributes (stored in CP15 registers) associated with an area of memory: »Area Scope = {start_addr, len}, 2^N (4KB~4GB) »Access rights –.

ARM 2007 Memory Access Sequence When ARM core generates an address, –MPU will check if it falls into any region »If NOT, the memory access is aborted; »If YES, the C, B and AP bits associated with this region are read out. C: Cacheable B: Buffered AP: Access Permission While MPU is disabled –All memory access are treated as uncachable, unbufferable, and non-aborting.

ARM Protected Regions There are 7 rules that govern regions –Overlay Regions »regions can overlap each other. –Priority Region »Region is assigned a priority number that is independent of privilege assigned to the region. –Attributes Conflict »When regions overlay, attributes of the region with higher priority take precedence over the other regions. –Starting address »Region’s start address = N x Size –Size = 2^N (4KB ~ 4GB); –Exception »Accessing an area of main memory outside a defined region results in an “abort” exception (Prefetch or Data Abort).

ARM Overlapping Regions Overlapping regions –The protection unit can be programmed with two or more overlapping regions. –When overlapping regions are programmed, a fixed priority scheme is applied to determine the region whose attributes are applied to memory access. Overlapping vs. Nonoverlapping –More flexibility

ARM 2007 region 0 region Background Regions Another useful feature provided by overlapping regions is background region –Background region with low-priority region used to assign the same attributes to a larger memory area. –Other regions with higher priority are then placed over this background region to change the attributes of a smaller subset of the defined background region. For example –task1 cannot access the regions outside it. task3 task2 task1 (lower priority)

ARM Initializing the MPU The following steps are required to initialize the MPU, Cache and Write-buffer –Define the regions »In order to initialize the MPU, cache, and write buffer, the control system must define the protection regions required during the target operation. »At a minimum the control system must define at least one data region and one instruction region before or at the same time as the caches and write buffer are enabled. –Set attributes “AP, Cache and Write Buffer “ of each region. –Enable MPU and cache/write buffer.

ARM 2007 MPU & CP15 registers Initialization with CP15 registers –Define the size and location of instruction and data regions using CP15:c6; –Set the access permission for each region using CP15:c5; –Set the cache and WB attributes for each region using CP15:c2 for cache and CP15:c3 for the write buffer; –Enable the caches and the MPU using CP15:c1.

ARM Define Region Size and Location Set up 8 regions’ size and location –via CP15:c6:c0:0/1 ~ CP15:c6:c7:0/1 (note: Location should be the multiple of its size) »Size = 2^(N+1) »E: 1=enable, 0=disable For example: Set up Region 3 –start_addr = 0x300000, size =256KB, DATA –Code »MOV r1, #0x300000; »ORR r1, r1, #0x11<<1; size = 256KB »MCR p15, 0, r1, c6, c3, 0

ARM Access Permission Four primary Access Permissions (APs) – MCRp15, 0, Rx, c5, c0, [0|1|2|3] »0 = standard Data Region AP »1= standard Data Region AP »2/3 = extended Data/Instr. AP SupervisorUserAP Code N/A 00 R/WN/A01 R/WRO10 R/W 11

ARM 2007 Why not the op2?

ARM Set Region’s cache & WB Three Control Registers in CP15 –CP15:c2:c0:0 —— all data regions Cache enable bits –CP15:c2:c0:1 —— all instruction regions Cache –CP15:c3:c0:0 —— Write Buffer applied data regions

ARM 2007 Region Attributes Control region’s Cache and Write-buffer Instr. Cache Data Cache Instr. need no WB

ARM Enable Region & MPU Last 2 steps –Enable regions; –via CP15:c6:c0:0~CP15:c6:c7:0 –Enable MPU hardware (MPU, Cache, WB); »via CP15:c1:c0:0 I (I-Cache): 0=disable, 1=enable C (D-Cache): 0=disable, 1=enable M (MPU): 0=disable, 1=enable SBZ[31:13] C2C 10M0M 12 I Start_addr[31:12]SBZ[11:6]N[5:1]E

ARM 2007 Summary Region based MPU –A region is a memory set with specific attribution; –Regions can be overlapped (with priority); Initialize MPU units (steps) –1) Set up Start_addr & Size (CP15:c6); –2) Set up APs (CP15:c5); –3) Set attribute of regions: »cache (CP15:c2), write buffer (CP15:c3) –4-a) Enable regions (CP15:c6, again) –4-b) Enable cache, WB and MPU (CP15:c1)