eecs 373
play

EECS 373 Homework 2 was posted on 1/13 is due on 1/20 Design of - PDF document

Announcements EECS 373 Homework 2 was posted on 1/13 is due on 1/20 Design of Microprocessor-Based Systems No office hours next week Prabal Dutta University of Michigan Lecture 3: Assembly, Tools, and ABI January 15, 2015 Slides


  1. Announcements EECS 373 • Homework 2 was posted on 1/13 is due on 1/20 Design of Microprocessor-Based Systems • No office hours next week Prabal Dutta University of Michigan Lecture 3: Assembly, Tools, and ABI January 15, 2015 Slides developed in part by Mark Brehob & Prabal Dutta 1 2 Today… The ARM architecture “books” for this class Walk though of the ARM ISA Software Development Tool Flow Application Binary Interface (ABI) 3 4 The ARM software tools “books” for this class Exercise: What is the value of r2 at done? ..." start:" "movs"r0,"#1" "movs"r1,"#1" "movs"r2,"#1" "sub""r0,"r1" "bne""done" "movs"r2,"#2" done:" "b""""done" ..." 5 6

  2. Updating the APSR Application Program Status Register (APSR) • SUB Rx, Ry – Rx = Rx - Ry – APSR unchanged • SUBS – Rx = Rx - Ry – APSR N, Z, C, V updated • ADD Rx, Ry – Rx = Rx + Ry – APSR unchanged • ADDS – Rx = Rx + Ry – APSR N, Z, C, V updated Conditional execution: Solution: Append to many instructions for conditional execution what is the value of r2 at done? ..." start:" "//"r0" ! "1,"Z=0" "movs"r0,"#1 "//"r1" ! "1,"Z=0" "movs"r1,"#1 "//"r2" ! "1,"Z=0" "movs"r2,"#1 "//"r0" ! "r08r1" "sub""r0,"r1 " " " "//"but"Z"flag"untouched " " " " "//"since"sub"vs"subs" "bne""done " "//"NE"true"when"Z==0" " " " "//"So,"take"the"branch" "movs"r2,"#2 "//"not"executed" done:" "b""""done " "//"r2"is"still"1" ..." 10 Real assembly example What’s it all mean? ".equ "STACK_TOP,"0x20000800 "/*"Equates"symbol"to"value"*/" ".equ "STACK_TOP,"0x20000800 "/*"Sets"symbol"to"value"(#define)*/" ".text " " " "/*"Tells"AS"to"assemble"region"*/" ".text " " " "/*"Tells"AS"to"assemble"region"*/" ".syntax"unified" " "/*"Means"language"is"ARM"UAL"*/" ".syntax"unified" " "/*"Means"language"is"ARM"UAL"*/" ".thumb " " " "/*"Means"ARM"ISA"is"Thumb"*/" ".thumb " " " "/*"Means"ARM"ISA"is"Thumb"*/" ".global"_start " " "/*".global"exposes"symbol"*/" ".global"_start " " "/*".global"exposes"symbol"*/" " " " " "/*"_start"label"is"the"beginning"*/" " " " " "/*"_start"label"is"the"beginning"*/" " " " " "/*"...of"the"program"region"*/" " " " " "/*"...of"the"program"region"*/" ".type "start,"%function " "/*"Specifies"start"is"a"function"*/" ".type "start,"%function " "/*"Specifies"start"is"a"function"*/" " " " " "/*"start"label"is"reset"handler"*/" " " " " "/*"start"label"is"reset"handler"*/" _start:" " " " "" _start:" " " " "" ".word "STACK_TOP,"start " "/*"Inserts"word"0x20000800"*/" ".word "STACK_TOP,"start " "/*"Inserts"word"0x20000800"*/" " " " " "/*"Inserts"word"(start)"*/" " " " " "/*"Inserts"word"(start)"*/" start: " " " " "" start: " " " " "" "movs"r0,"#10 " " "/*"We’ve"seen"the"rest"..."*/" "movs"r0,"#10 " " "/*"We’ve"seen"the"rest"..."*/" "movs"r1,"#0 " " "" "movs"r1,"#0 " " "" loop: " " " " "" loop: " " " " "" "adds"r1,"r0 " " "" "adds"r1,"r0 " " "" "subs"r0,"#1 " " "" "subs"r0,"#1 " " "" "bne""loop " " "" "bne""loop " " "" deadloop: " " " "" deadloop: " " " "" "b""""deadloop " " "" "b""""deadloop " " "" ".end" ".end" " " 11 12

  3. What happens after a power-on-reset (POR)? Today… • ARM Cortex-M3 (many others are similar) • Reset procedure Walk though of the ARM ISA – SP ! mem(0x00000000) – PC ! mem(0x00000004) Software Development Tool Flow _start:' Application Binary Interface (ABI) '.word'__STACKTOP ' '/*'Top'of'Stack'*/' '.word'Reset_Handler ' '/*'Reset'Handler'*/' '.word'NMI_Handler ' '/*'NMI'Handler'*/' '.word'HardFault_Handler '/*'Hard'Fault'Handler'*/' '.word'MemManage_Handler '/*'MPU'Fault'Handler'*/' '.word'BusFault_handler '/*'Bus'Fault'Handler'*/' '...' 13 14 How does an assembly language program What are the real GNU executable names for the ARM? get turned into a executable program image? Binary"program " • Just add the prefix “arm-none-eabi-” prefix file"(.bin) " • Assembler (as) – arm-none-eabi-as Assembly " Object " • Linker (ld) Executable " files"(.s) " files"(.o) " image"file " – arm-none-eabi-ld • Object copy (objcopy) ld " (linker) " – arm-none-eabi-objcopy as " (assembler) " • Object dump (objdump) – arm-none-eabi-objdump " • C Compiler (gcc) Memory " layout " – arm-none-eabi-gcc Disassembled " • C++ Compiler (g++) Linker " code"(.lst) " script"(.ld) " – arm-none-eabi-g++ 15 16 Real-world example How are assembly files assembled? • To the terminal! • $ arm-none-eabi-as – Useful options • -mcpu (code at https://github.com/brghena/eecs373_toolchain_examples) • -mthumb • -o $"arm8none8eabi8as"8mcpu=cortex8m3"8mthumb"example1.s"8o"example1.o" " " 17 18

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend