ARM Memory.

Slides:



Advertisements
Similar presentations
Embedded Systems Programming
Advertisements

Lecture 13: 10/8/2002CS170 Fall CS170 Computer Organization and Architecture I Ayman Abdel-Hamid Department of Computer Science Old Dominion University.
Review of the MIPS Instruction Set Architecture. RISC Instruction Set Basics All operations on data apply to data in registers and typically change the.
Run-time Environment for a Program different logical parts of a program during execution stack – automatically allocated variables (local variables, subdivided.
ECE 15B Computer Organization Spring 2010 Dmitri Strukov Lecture 5: Data Transfer Instructions / Control Flow Instructions Partially adapted from Computer.
The University of Adelaide, School of Computer Science
2.3) Example of program execution 1. instruction  B25 8 Op-code B means to change the value of the program counter if the contents of the indicated register.
COMP3221 lec-12-mem-II.1 Saeid Nooshabadi COMP 3221 Microprocessors and Embedded Systems Lecture 12: Memory Access - II
Elec2041 lec-11-mem-I.1 Saeid Nooshabadi COMP 3221 Microprocessors and Embedded Systems Lecture 4: Memory Access March,
Lecture 5 Sept 14 Goals: Chapter 2 continued MIPS assembly language instruction formats translating c into MIPS - examples.
Topics covered: ARM Instruction Set Architecture CSE 243: Introduction to Computer Architecture and Hardware/Software Interface.
ARM Instructions I Prof. Taeweon Suh Computer Science Education Korea University.
Topic 8: Data Transfer Instructions CSE 30: Computer Organization and Systems Programming Winter 2010 Prof. Ryan Kastner Dept. of Computer Science and.
CSC 3210 Computer Organization and Programming Chapter 9 EXTERNAL DATA AND TEXT D.M. Rasanjalee Himali.
Topic 10: Instruction Representation CSE 30: Computer Organization and Systems Programming Winter 2011 Prof. Ryan Kastner Dept. of Computer Science and.
Memory and Addressing How and Where Information is Stored.
Working With Main Memory. Why Main Memory Register space limited Used for communication.
More on Assembly 1 CSE 2312 Computer Organization and Assembly Language Programming Vassilis Athitsos University of Texas at Arlington.
Memory Addressing Techniques. Immediate Addressing involves storing data in pairs with immediate values register pairs:
Chapter 2 — Instructions: Language of the Computer — 1 Memory Operands Main memory used for composite data – Arrays, structures, dynamic data To apply.
More on Assembly 1 CSE 2312 Computer Organization and Assembly Language Programming Vassilis Athitsos University of Texas at Arlington.
Lecture 8: Loading and Storing to Memory CS 2011 Fall 2014, Dr. Rozier.
Address alignment When a word (4-bytes) is loaded or stored the memory address must be a multiple of four. This is called an alignment restriction. Addresses.
©2000 Addison Wesley Little- and big-endian memory organizations.
Assembly Variables: Registers Unlike HLL like C or Java, assembly cannot use variables – Why not? Keep Hardware Simple Assembly Operands are registers.
Memory Access Instructions Load and Store Addressing Modes Memory Addressing. Base addressing mode. Load byte and store byte: lb, lbu, sb Address alignment.
MIPS Arithmetic is 32 bits
Displacement (Indexed) Stack
Data in Memory variables have multiple attributes symbolic name
ECE 3430 – Intro to Microcomputer Systems
Memory Access Instructions
Chapter 4 Copying Data.
ECE 3430 – Intro to Microcomputer Systems
Assembly Language Assembly Language
Morgan Kaufmann Publishers
The Cortex-M3/m4 Embedded Systems: Cortex-M3/M4 Instruction Sets
Chapter 4 Addressing modes
RISC Concepts, MIPS ISA Logic Design Tutorial 8.
Computer Science 210 Computer Organization
The Stack.
Computer Architecture (CS 207 D) Instruction Set Architecture ISA
Computer Science 210 Computer Organization
ARM Arrays.
Systems Architecture I (CS ) Lecture 5: MIPS Instruction Set*
CSCI206 - Computer Organization & Programming
The University of Adelaide, School of Computer Science
MIPS assembly.
Architecture CH006.
MIPS Instructions.
Instruction Set Architectures Continued
Instruction encoding The ISA defines Format = Encoding
Architecture Overview
Figure 2- 1: ARM Registers Data Size
Computer Instructions
Computer Architecture
LC-2: The Little Computer 2
Instruction encoding The ISA defines Format = Encoding
COMS 361 Computer Organization
Instruction encoding The ISA defines Format = Encoding
Optimizing ARM Assembly
Overheads for Computers as Components 2nd ed.
MIPS Instruction Set Architecture
ARM Memory.
8051 ASSEMBLY LANGUAGE PROGRAMMING
Computer Architecture and System Programming Laboratory
Instruction encoding The ISA defines Format = Encoding
Systems Architecture I (CS ) Lecture 5: MIPS Instruction Set*
Introduction to Assembly Chapter 2
ARM Load/Store Instructions
An Introduction to the ARM CORTEX M0+ Instructions
Presentation transcript:

ARM Memory

Sections Programs = Code Data

Sections Compiled program stored in sections .text : Executable code read/executable .rodata : Read Only Data read .data : Data read/write .bss : Uninitialized Data read/write

Sections Compile C++

Identifiers Identifier: Placed at name the next location (rest or or next line)

Data Directives .word X Store 32 bit value X in memory .space X Reserve X bytes in memory

Sections Sections placed in memory for execution:

Simplified .data Things to place into memory after code .text Code

Same Segment Access Can place data in .text Make sure doesn’t get executed!!!

Same Segment Access LDR : Load Register LDR rd, identifier Pseudo instruction LDR rd, identifier Load value at identifier

Same Segment Access Fun Fact LDR : Calculates location as currentLocation + 8 + immediate 1000 + 8 + C (810 + 1210) 1000 + 14 (2010) 1014

Same Segment Access Fun Fact LDR : Calculates location as currentLocation + 8 + immediate 1000 + 8 + 64 (810 + 10010) 1000 + 6C (10810) 106C

LDR Immediate LDR rd, =longConstant Puts immediate at end of .text Automatically loads that address

Cross Segment Access Can not directly load identifier in other segment May be too far

Cross Segment Access LDR rd, =identifier Load address of identifier

Cross Segment Access LDR rd, =identifier Load address of identifier

How It Works LDR rd, =identifier Stores address of target at end of current .text Calculates location as current + 8 + offset 1000 + 8 + C (810 + 1210) 1000 + 14 (2010) 1014 Loads real address from that location

Cross Segment Access LDR rd, [rs] Load value at the address stored in rs

Cross Segment Access LDR rd, [rs] : always second step First load address into rs Then load data from that address

STR STR rs, [rd] Store value from rs to address in rd NOTE: Reverse order of operands

STR Notes Process: Load address in register Store other register to that address

Memory Address Word = 32 bits = 4 bytes Word addresses = multiples of 4 C = 1210 10 = 1610 14 = 2010

Memory Address Bytes in word numbered right to left 1000 = 64 aka “Little Endian” 1000 = 64 1001 = FF 1003 = 00 1012 = 81 +3 +2 +1 +0

Memory Address Bytes in word numbered right to left 1000 = 64 1005 = 89 100F = 81 1010 = 81 +11 +10 +9 +8 +15 +14 +13 +12 +3 +2 +1 +0 +7 +6 +5 +4

Other Memory Directives .byte : Store 8 bit value .hword : Store 16 bit value (half-word)

Alignment .word should be at multiple of 4 .hword should be at multiple of 2 .byte anywhere BAD Alignment: D = 13!!!

Align .align : pad with 0’s until next word boundary

Alignment Tips Load/Store to unaligned address = silent failure! Unneeded .align’s ignored When in doubt, .align

Byte Packing Byte packing : ordering class/struct members for proper alignment

Load/Store Bytes LDRB rd, [rs] STRB rs, [rd] Load one byte from address rs into rd STRB rs, [rd] Store value in rs to address in rd

Sign Issues 34 + -1 = 289???? -1 as byte = 0xFF 0xFF as 32 bit value = 255 34 + -1 = 289????

Sign Extension LDRSB rd, [rs] Load one byte from address rs into rd; extend sign bit

LDR Variants LDR rd, identifier LDR rd, [rs] LDR rd, =immediate Load value at identifier; same section only Load value at address in rs LDR r3, [r2] LDR r1, x LDR rd, =immediate LDR rd, =identifier Put constant into .text; Load that constant Load address of identifier LDR r2, =x LDR r3, =0x1234ABCD