eecs 373 design of microprocessor-based systems prabal dutta university of michigan
DESCRIPTION
EECS 373 Design of Microprocessor-Based Systems Prabal Dutta University of Michigan Lecture 2: Architecture, Assembly, and ABI September 9, 2010. Announcements. Q&A website for class discussion http://nuclear.eecs.umich.edu Good for discussion outside of class - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: EECS 373 Design of Microprocessor-Based Systems Prabal Dutta University of Michigan](https://reader034.vdocuments.us/reader034/viewer/2022051402/56815e63550346895dcce207/html5/thumbnails/1.jpg)
1
EECS 373Design of Microprocessor-Based Systems
Prabal DuttaUniversity of Michigan
Lecture 2: Architecture, Assembly, and ABISeptember 9, 2010
![Page 2: EECS 373 Design of Microprocessor-Based Systems Prabal Dutta University of Michigan](https://reader034.vdocuments.us/reader034/viewer/2022051402/56815e63550346895dcce207/html5/thumbnails/2.jpg)
2
Announcements
• Q&A website for class discussion– http://nuclear.eecs.umich.edu– Good for discussion outside of class– Strongly encourage you to log issues there
• Actel Eval Boards– Yes, you keep them for the term!– This is an experiment to see what you do with them– Enables students to explore ideas, labs, etc outside
class– Encourage you to install tool chain and try out Actel
tutorials
• Will drop lowest minute quiz (only one)
![Page 3: EECS 373 Design of Microprocessor-Based Systems Prabal Dutta University of Michigan](https://reader034.vdocuments.us/reader034/viewer/2022051402/56815e63550346895dcce207/html5/thumbnails/3.jpg)
3
Recap of the last lecture
• What distinguishes embedded systems?– Application-specific– Resource-constrained– Real-time operations– Software runs “forever”
• Technology scaling is driving “embedded everywhere”– Microprocessors– Memory (RAM and Flash)– Imagers and MEMS sensors– Energy storage
• Embedded platforms and software– How does a phone boot? HW, SW, INT, and drivers– What are the components of a DSL modem? 18 major parts– Why the ARM architecture? 90%+ of 32-bit embedded CPUs– How do ARM licensees differentiate products? Peripherals
![Page 4: EECS 373 Design of Microprocessor-Based Systems Prabal Dutta University of Michigan](https://reader034.vdocuments.us/reader034/viewer/2022051402/56815e63550346895dcce207/html5/thumbnails/4.jpg)
4
Architecture
![Page 5: EECS 373 Design of Microprocessor-Based Systems Prabal Dutta University of Michigan](https://reader034.vdocuments.us/reader034/viewer/2022051402/56815e63550346895dcce207/html5/thumbnails/5.jpg)
5
In the context of computers,what does architecture mean?
![Page 6: EECS 373 Design of Microprocessor-Based Systems Prabal Dutta University of Michigan](https://reader034.vdocuments.us/reader034/viewer/2022051402/56815e63550346895dcce207/html5/thumbnails/6.jpg)
6
Architecture has many meanings
• Computer Organization (or Microarchitecture)– Control and data paths– I/D pipeline design– Cache design– …
• System Design (or Platform Architecture)– Memory and I/O buses– Memory controllers– Direct memory access– …
• Instruction Set Architecture (ISA)
![Page 7: EECS 373 Design of Microprocessor-Based Systems Prabal Dutta University of Michigan](https://reader034.vdocuments.us/reader034/viewer/2022051402/56815e63550346895dcce207/html5/thumbnails/7.jpg)
7
What is anInstruction Set Architecture (ISA)?
![Page 8: EECS 373 Design of Microprocessor-Based Systems Prabal Dutta University of Michigan](https://reader034.vdocuments.us/reader034/viewer/2022051402/56815e63550346895dcce207/html5/thumbnails/8.jpg)
8
An ISA defines the hardware/software interface
• A “contract” between architects and programmers• Instruction set• Register set• Memory and addressing modes• Word sizes• Data formats• Operating modes• Condition codes• Calling conventions
![Page 9: EECS 373 Design of Microprocessor-Based Systems Prabal Dutta University of Michigan](https://reader034.vdocuments.us/reader034/viewer/2022051402/56815e63550346895dcce207/html5/thumbnails/9.jpg)
ARM Architecture roadmap
9
![Page 10: EECS 373 Design of Microprocessor-Based Systems Prabal Dutta University of Michigan](https://reader034.vdocuments.us/reader034/viewer/2022051402/56815e63550346895dcce207/html5/thumbnails/10.jpg)
10
ARM Cortex-M3 ISA
Register Set Address Space
BranchingData processing
Load/StoreExceptions
Miscellaneous
Instruction Set
32-bits 32-bitsEndianess Endianess
![Page 11: EECS 373 Design of Microprocessor-Based Systems Prabal Dutta University of Michigan](https://reader034.vdocuments.us/reader034/viewer/2022051402/56815e63550346895dcce207/html5/thumbnails/11.jpg)
11
Mode dependent
Registers
![Page 12: EECS 373 Design of Microprocessor-Based Systems Prabal Dutta University of Michigan](https://reader034.vdocuments.us/reader034/viewer/2022051402/56815e63550346895dcce207/html5/thumbnails/12.jpg)
12
Address Space
![Page 13: EECS 373 Design of Microprocessor-Based Systems Prabal Dutta University of Michigan](https://reader034.vdocuments.us/reader034/viewer/2022051402/56815e63550346895dcce207/html5/thumbnails/13.jpg)
13
Instruction EncodingADD immediate
![Page 14: EECS 373 Design of Microprocessor-Based Systems Prabal Dutta University of Michigan](https://reader034.vdocuments.us/reader034/viewer/2022051402/56815e63550346895dcce207/html5/thumbnails/14.jpg)
14
Branch
![Page 15: EECS 373 Design of Microprocessor-Based Systems Prabal Dutta University of Michigan](https://reader034.vdocuments.us/reader034/viewer/2022051402/56815e63550346895dcce207/html5/thumbnails/15.jpg)
15
Data processing instructions
Many, Many More!
![Page 16: EECS 373 Design of Microprocessor-Based Systems Prabal Dutta University of Michigan](https://reader034.vdocuments.us/reader034/viewer/2022051402/56815e63550346895dcce207/html5/thumbnails/16.jpg)
16
Load/Store instructions
![Page 17: EECS 373 Design of Microprocessor-Based Systems Prabal Dutta University of Michigan](https://reader034.vdocuments.us/reader034/viewer/2022051402/56815e63550346895dcce207/html5/thumbnails/17.jpg)
17
Miscellaneous instructions
![Page 18: EECS 373 Design of Microprocessor-Based Systems Prabal Dutta University of Michigan](https://reader034.vdocuments.us/reader034/viewer/2022051402/56815e63550346895dcce207/html5/thumbnails/18.jpg)
Addressing Modes
• Offset Addressing– Offset is added or subtracted from base register– Result used as effective address for memory access– [<Rn>, <offset>]
• Pre-indexed Addressing– Offset is applied to base register– Result used as effective address for memory access– Result written back into base register– [<Rn>, <offset>]!
• Post-indexed Addressing– The address from the base register is used as the EA– The offset is applied to the base and then written back– [<Rn>], <offset>
![Page 19: EECS 373 Design of Microprocessor-Based Systems Prabal Dutta University of Michigan](https://reader034.vdocuments.us/reader034/viewer/2022051402/56815e63550346895dcce207/html5/thumbnails/19.jpg)
<offset> options
• An immediate constant– #10
• An index register– <Rm>
• A shifted index register– <Rm>, LSL #<shift>
![Page 20: EECS 373 Design of Microprocessor-Based Systems Prabal Dutta University of Michigan](https://reader034.vdocuments.us/reader034/viewer/2022051402/56815e63550346895dcce207/html5/thumbnails/20.jpg)
Application Program Status Register (APSR)
![Page 21: EECS 373 Design of Microprocessor-Based Systems Prabal Dutta University of Michigan](https://reader034.vdocuments.us/reader034/viewer/2022051402/56815e63550346895dcce207/html5/thumbnails/21.jpg)
Updating the APSR
• SUB Rx, Ry– Rx = Rx - Ry– APSR unchanged
• SUBS– Rx = Rx - Ry– APSR N or Z bits might be set
• ADD Rx, Ry– Rx = Rx + Ry– APSR unchanged
• ADDS– Rx = Rx + Ry– APSR C or V bits might be set
![Page 22: EECS 373 Design of Microprocessor-Based Systems Prabal Dutta University of Michigan](https://reader034.vdocuments.us/reader034/viewer/2022051402/56815e63550346895dcce207/html5/thumbnails/22.jpg)
Conditional execution:Append to many instructions for conditional execution
![Page 23: EECS 373 Design of Microprocessor-Based Systems Prabal Dutta University of Michigan](https://reader034.vdocuments.us/reader034/viewer/2022051402/56815e63550346895dcce207/html5/thumbnails/23.jpg)
23
The ARM architecture “books” for this class
![Page 24: EECS 373 Design of Microprocessor-Based Systems Prabal Dutta University of Michigan](https://reader034.vdocuments.us/reader034/viewer/2022051402/56815e63550346895dcce207/html5/thumbnails/24.jpg)
24
The ARM software tools “books” for this class
![Page 25: EECS 373 Design of Microprocessor-Based Systems Prabal Dutta University of Michigan](https://reader034.vdocuments.us/reader034/viewer/2022051402/56815e63550346895dcce207/html5/thumbnails/25.jpg)
25
.equ STACK_TOP, 0x20000800
.text
.syntax unified
.thumb
.global _start
.type start, %function
_start:.word STACK_TOP, start
start:movs r0, #10movs r1, #0
loop:adds r1, r0subs r0, #1bne loop
deadloop:b deadloop.end
An ARM assembly language program for GNU
![Page 26: EECS 373 Design of Microprocessor-Based Systems Prabal Dutta University of Michigan](https://reader034.vdocuments.us/reader034/viewer/2022051402/56815e63550346895dcce207/html5/thumbnails/26.jpg)
26
all:arm-none-eabi-as -mcpu=cortex-m3 -mthumb example1.s -o example1.oarm-none-eabi-ld -Ttext 0x0 -o example1.out example1.oarm-none-eabi-objcopy -Obinary example1.out example.binarm-none-eabi-objdump -S example1.out > example1.list
A simple Makefile
![Page 27: EECS 373 Design of Microprocessor-Based Systems Prabal Dutta University of Michigan](https://reader034.vdocuments.us/reader034/viewer/2022051402/56815e63550346895dcce207/html5/thumbnails/27.jpg)
27
.equ STACK_TOP, 0x20000800
.text
.syntax unified
.thumb
.global _start
.type start, %function
_start:.word STACK_TOP, start
start:movs r0, #10movs r1, #0
loop:adds r1, r0subs r0, #1bne loop
deadloop:b deadloop.end
An ARM assembly language program for GNU
![Page 28: EECS 373 Design of Microprocessor-Based Systems Prabal Dutta University of Michigan](https://reader034.vdocuments.us/reader034/viewer/2022051402/56815e63550346895dcce207/html5/thumbnails/28.jpg)
28
example1.out: file format elf32-littlearm
Disassembly of section .text:
00000000 <_start>: 0: 20000800 .word 0x20000800 4: 00000009 .word 0x00000009
00000008 <start>: 8: 200a movs r0, #10 a: 2100 movs r1, #0
0000000c <loop>: c: 1809 adds r1, r1, r0 e: 3801 subs r0, #1 10: d1fc bne.n c <loop>
00000012 <deadloop>: 12: e7fe b.n 12 <deadloop>
Disassembled object code
![Page 29: EECS 373 Design of Microprocessor-Based Systems Prabal Dutta University of Michigan](https://reader034.vdocuments.us/reader034/viewer/2022051402/56815e63550346895dcce207/html5/thumbnails/29.jpg)
29
Questions?
Comments?
Discussion?