lab basics - dr jeff software - dr jeff home · comp122 © jeff drobman comp 122 2016-2019 assembly...
TRANSCRIPT
COMP122
© Jeff Drobman2016-2019COMP 122
ASSEMBLY Programming
Lab Basics
email [email protected]
Dr Jeff Drobmanwebsite drjeffsoftware.com/classroom.html
COMP122
© Jeff Drobman2016-2019Index
vLab list à slide 4vKey slides à slide 5vTools: SDK/IDE à slide 14vPlatforms à slide 22vMIPS-MARS à slide 27vARM Sim à slide 44vGNU (gcc) à slide 49vEclipse à slide 53vMisc IDE’s à slide 58
COMP122
© Jeff Drobman2016-2019Digital Systems
ComputerPhoneController
Hardware
LayersLevelsComposition
Software
Hard diskFlash diskFlash EEPROM
External Storage
v CODEv DATAComputer
Engineering
Computer Science
v Architecturev Physical design
v Algorithmsv Theory
COMP122
© Jeff Drobman2016-2019Lab Programs
1. Hello World (I/O)*A. MIPS- basicB. MIPS- add Loops, GUI msgC. MIPS- add Sub, GUI InputD. ARM (port 1C)
2. Fibonacci*3. Factorial*4. Temp Conversion (FP)**5. ISR’s (Interrupt Service)**6. I/O (HW)*
*MIPS and ARM**MIPS or ARM
1. Project 1 – compare ISA’sA. MIPSB. ARM
2. Project 2 – Logic LabA. MIPS/MARSB. ARM/ARMsim
research
simulation
COMP122
© Jeff Drobman2016-2019Section
vInstruction Formats/ClassesvNumbersvASCII Codes
COMP122
© Jeff Drobman2016-2019Instruction Formats
R
I
B
J
COMP122
© Jeff Drobman2016-2019Instruction Set Classes
Computation Memory Program Control I/O
v ALU§ ADD§ SUB§ AND§ OR§ XOR§ NOT
v MULT/DIV§ MUL§ DIV
v BIT§ SET§ CLR§ TEST
v SHIFT§ SHIFT (A, L)§ ROTATE
v Reg-Reg§ MOV
v Reg-Mem§ LOAD§ STORE§ MOV
v Mem-Mem§ MOV
v Stack§ PUSH§ POP
v JUMP§ JUMP/GOTO
v BRANCH§ BRA§ BRCC§ LOOP
v CALL§ CALL/CALR/JAL§ RET/RETFIE
v NOP
v I/O§ IN§ OUT
v Mem Mapped§ MOV PORT§ LOAD/STORE
System Control
v Reset§ RESET
v Power§ SLEEP/HALT
COMP122
© Jeff Drobman2016-2019Ordinals
Ordinal
Powerof 2
Power of 10 Actual
1K 210 103 1024
1M 220 106 1,048,576
1G 230 109 1.074x109
1T 240 1012 1.0995x1012
Name 2n M/G Actual
byte 28 -- 256short 216 64K 65,536word 232 4B 4.3x109
long 264 16 Q 1.84x1019
IPv6 2128 340 uD 3.4x1038
10^(+6) million10^(+9) billion10^(+12) trillion10^(+15) quadrillion10^(+18) quintillion10^(+21) sexillion10^(+24) septillion10^(+27) octillion10^(+30) nonillion10^(+33) decillion10^(+36) undecillion10^(+39) duodecillion10^(+42) tredecillion10^(+45) quattuordecillion10^(+48) quindecillion10^(+51) sexdecillion10^(+54) septendecillion10^(+57) octodecillion10^(+60) novemdecillion10^(+63) vigintillion10^(+100) googol10^(+303) centillion10^(10^(+100)) googolplex
Gazillions
10^(29)/2^(100) geo
COMP122
© Jeff Drobman2016-2019GiB/TiB Ordinals
COMP122
© Jeff Drobman2016-2019ASCII Codes- Letters
1963
COMP122
© Jeff Drobman2016-2019ASCII Codes- 7-bit
IANA encourages use of the name "US-ASCII" for Internet uses of ASCII
\n=\u000Asp=\u0020
char ch=0xAchar sp=0x20
COMP122
© Jeff Drobman2016-2019Old Mac Char Codes
16-bit
unique special chars
COMP122
© Jeff Drobman2016-2019MS Windows (1252)
COMP122
© Jeff Drobman2016-2019Lab
COMP122
© Jeff Drobman2016-2019Software Tool Chain
Source-HLL Source-asm Object
Multiple Source files
COMP122
© Jeff Drobman2016-2019Software Tool Chain
v CompilersØ Compiled languages (C, C++, C#, VB)
² Compile completely: Translate HLL (.c, .h) into ASM (.asm)Ø Interpreted languages (Java, Pascal)
² Compile incompletely (“JIT”) to an “intermediate” language² “Pseudo” code is compiled at run time (slow)
v Assemblers² Translate ASM (.asm) into linkable machine code modules (“LM”)
v Linkers² Combine (“link”) LM modules into a single “executable” (.exe)² Resolve external references² Embed calls to dynamic “link libraries” or “frameworks” (.dll files)
v Debuggers
v SDK contains Compilers + API (Libraries) + IDEv IDE is a development environment w/debugger
COMP122
© Jeff Drobman2016-2019IDE + Platforms
COMPILER
ASM
LINKER/LIB
JAVA IL-bytecode
Abs Obj Mod
ROM
ROM
ROM
C code
.asm
.exe
.bin
.obj
.obj
.obj
HEX
PROMburner
RUN
RUN
Java
JAVA VMJIT
PCB
PC
PC
RUNLIBRARY
COMP122
© Jeff Drobman2016-2019SDK/IDE
SOFTWARE DEV KITINTEGERATED DEV ENVIRONMENT
vCompilerØ JDK*Ø Gcc**
vIDEØ jGrasp*Ø EclipseØ MPlab
vSDK+IDEØ MIPS Mars**Ø ARM sim**Ø MS Visual StudioØ Apple Xcode
*Used for Java (COMP110)
**Used for Assembler (COMP122)
COMP122
© Jeff Drobman2016-2019Development Platforms
vDesignq Microsoft
² OS = Windows (7, 8, 10)² API = .NET Framework² SDK/IDE = Visual Studio Cross Platform² Languages = .NET versions of VB, C#, C++, Java
q Apple² OS = Mac OS X, iOS (mobile)² API = Xcode (Cocoa Touch)² SDK/IDE = Xcode² Languages = Objective C, Swift
q Google² OS = Android² API = Android² SDK/IDE = Android² Languages = C++
Software Applications:Development Platforms
COMP122
© Jeff Drobman2016-2019SDK/IDE
COMPILER - ASSEMBLER
COMP122
© Jeff Drobman2016-2019Dev Boards
COMP122
© Jeff Drobman2016-2019Software
COMP122
© Jeff Drobman2016-2019Software Platforms
v Standalone Applicationsq Native
Ø DesktopØ Mobil apps (phone/tablet)
q WebØ Client (“Front end” via browser)Ø Server (”Back end”)
v Embedded Controlq Appliancesq Cars/airplanesq Phones/tablets
Ø iOSØ Android
q Computer PeripheralsØ Storage devicesØ Printers
COMP122
© Jeff Drobman2016-2019App Types
v NATIVE² Runs directly on the device/computer on its OS
§ Computer (desktop or laptop)§ Mobile (phone or tablet)
v WEB² Runs remotely on the website server and is
displayed on the device/computer via its Browserv Mobile Web Apps
² redesigned websites for display on mobile devices(phones, tablets) that include applications (“Web Apps”)
COMP122
© Jeff Drobman2016-2019Standalone Platforms
v Standalone Applicationsq Native
Ø Desktop§ Universal (“Office”)§ Specialized <- THIS CLASS
Ø Mobil apps (phone/tablet)q Web
Ø Client (“Front end” via browser)§ Desktop§ Mobil
Ø Server (”Back end”)
COMP122
© Jeff Drobman2016-2019Running/Debugging
SIMULATOR EMULATOR HARDWARE
q Debugger runtime environment in (IDE)
q Breakpointsq Watch variablesq Target device
selection§ PC§ Phone/tablet§ Board
q ICE (in-circuit)§ Pods§ Breakpoints§ Trace triggers &
buffersq Memory (known good)
§ R/W (ROM/RAM)§ Wait states
SOFTWARE SubstituteHARDWARE
ActualHARDWARE
q Code burned into ROMq Working RAMq Can use ICEq Board bring-upq Built-in test
§ JTAGq Logic analyzers
RUN
PC PCBPCB
Embedded Systems
§ MIPS Mars§ ARM Sim
Raspberry Pi
COMP122
© Jeff Drobman2016-2019Lab
COMP122
© Jeff Drobman2016-2019MARS
Mac Desktop
https://courses.missouristate.edu/KenVollmar/MARS/download.htm
COMP122
© Jeff Drobman2016-2019MARS
COMP122
© Jeff Drobman2016-2019MARS
Registers
COMP122
© Jeff Drobman2016-2019MARS
Memory Map
COMP122
© Jeff Drobman2016-2019MARS
Key
COMP122
© Jeff Drobman2016-2019MARS
Addr Modes
COMP122
© Jeff Drobman2016-2019MIPS Assembly
MIPS Lab 1
COMP122
© Jeff Drobman2016-2019MIPS Assembly
MIPS Lab 1
COMP122
© Jeff Drobman2016-2019MIPS Assembly
MIPS Lab 1
COMP122
© Jeff Drobman2016-2019MIPS Assembly
MIPS Lab 1
COMP122
© Jeff Drobman2016-2019MIPS Assembly
MIPS Lab 1
System.exit(0)
Break?
COMP122
© Jeff Drobman2016-2019MARS
Tools
X-Ray
COMP122
© Jeff Drobman2016-2019MARS
Tools
COMP122
© Jeff Drobman2016-2019MARS
Tools
COMP122
© Jeff Drobman2016-2019MARS
Tools
COMP122
© Jeff Drobman2016-2019MIPS Dev Board
COMP122
© Jeff Drobman2016-2019Lab
COMP122
© Jeff Drobman2016-2019ARM Sim
Yikes! No code editor!
COMP122
© Jeff Drobman2016-2019ARM Sim
tinyurl.com/armsimcsun
v. 2.0.1
COMP122
© Jeff Drobman2016-2019ARM Sim
tinyurl.com/armsimcsun
NOT available for Mac!
COMP122
© Jeff Drobman2016-2019Mac OS X
NOT available for Mac!
COMP122
© Jeff Drobman2016-2019Mac OS X
Don’t do this!
COMP122
© Jeff Drobman2016-2019ARMsim 2.1
COMP122
© Jeff Drobman2016-2019ARMsim 2.1
Angel SWI
COMP122
© Jeff Drobman2016-2019ARMsim 2.1
Angel SWI
COMP122
© Jeff Drobman2016-2019ARMsim 2.1
Angel SWI
COMP122
© Jeff Drobman2016-2019ARM Sim
Assembly Manual
COMP122
© Jeff Drobman2016-2019Lab
COMP122
© Jeff Drobman2016-2019GNU - MinGW
COMP122
© Jeff Drobman2016-2019ARM GNU-A
COMP122
© Jeff Drobman2016-2019ARM GNU-A
gcc
COMP122
© Jeff Drobman2016-2019Lab
COMP122
© Jeff Drobman2016-2019Eclipse
COMP122
© Jeff Drobman2016-2019Eclipse
COMP122
© Jeff Drobman2016-2019Eclipse Platform
COMP122
© Jeff Drobman2016-2019Eclipse SDK
COMP122
© Jeff Drobman2016-2019Lab
COMP122
© Jeff Drobman2016-2019IAR