PowerPoint-presentatie
Download
Report
Transcript PowerPoint-presentatie
Computertechniek
herhaling ARM assembler instructies
assembler formaat
gebruik van het ARM ontwikkelbordje
gebruik van de PSPad ontwikkelomgeving
assembler programmeren!
Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology
1
Computertechniek
herhaling ARM instructie set
•
•
•
•
•
meestal 3-address formaat (soms 2 of 4)
bewerkingen altijd van registers naar registers
een instructie kan de conditie flags zetten
iedere instructie is conditioneel
caching
Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology
2
Computertechniek
assembler instructie formaat : rekenen
ADD R0, R1, R2
ADD R0, R1, #1
ADD R0, R1, R2, LSL R3
ADD R0, R1, R2, LSR #2
ADDS R0, R1, R2
ADDNE R0, R1, R2
ADDNES R0, R1, R2
Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology
3
Computertechniek
assembler instructie formaat :
vergelijken en verplaatsen
CMP R2, R3
CMP R2, #2
CMP R2, R3, LSL R4
CMP R2, R3, LSL #2
CMPE R2, R3
MOV R1, R2
MOV R1, #2
MVN R1, R2
Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology
4
Computertechniek
assembler instructie formaat :
van en naar geheugen 1
LDR R1, [ R2 ]
LDR R1, [ R2, R3 ]
LDR R1, [ R2, #2 ]
LDRB R1, [ R2, R3 ]
LDRSB R1, [ R2, R3 ]
LDRH R1, [ R2, R3 ]
LDRNE R1, [ R2, R3 ]
Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology
5
Computertechniek
assembler instructie formaat :
van en naar geheugen 2
LDR R1, [ R2, R3 ] !
LDR R1, [ R2, #2 ] !
LDR R1, [ R2 ] R3
LDR R1, [ R2 ] #2
STR ... (no signed version)
Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology
6
Computertechniek
7
Assembly statements
One line (record)
Label:
Opcode
Expression(s) @ Comment
CR
Operand, symbol
Operation, pseudo operation or directive
Symbol (optional)
Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology
Computertechniek
8
ARM assembly language
Fairly standard assembly language:
The general form of assembler input lines is:
{ label} { instruction} {; comment}
Label:
LDR r0,[r8]
ADD r4,r0,r1
@ a comment
Max: 255 characters long.
Instruction mnemonics and register names may be written
in upper or lower case (but not mixed).
Directives must be written in upper case.
Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology
Computertechniek
Predeclared register names
By default the following register names
(symbols) are predeclared:
• R0-R15
• r0-r15
• sp and SP (== R13)
• lr and LR (== R14)
• pc and PC (== R15)
Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology
9
Computertechniek
10
Knipperen
.global main
main:
@ configureer de hardware om de LEDs te gebruiken
bl
USE_LEDS
loop:
ldr
bl
ldr
bl
ldr
bl
ldr
bl
b
r0, =0xFF
SET_LEDS
r0, =( 500 * 1000 )
WAIT_uS
r0, =0x00
SET_LEDS
r0, =( 500 * 1000 )
WAIT_uS
loop
Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology
Computertechniek
sluit een bordje aan (parallel + USB)
installeer de files uit blink.zip
in een lege directory
let op: geen spaties in de pathname
dubbel-klik op de .ppr file
build
start debugger
Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology
11
Computertechniek
zet onder file > target settings:
Target = Remote/TCP
Hostname = 127.0.0.1
Port = 8888
(als je netjes afsluit blijft zou dit moeten blijven staan)
Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology
12
Computertechniek
evt. kan je breakpoints zetten of verwijderen
run
als het goed is kom je nu op een breakpoint
aan het begin van main
Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology
13
Computertechniek
continue
Zoals het een embedded programma betaamt
eindigt ons programma nooit.
stop
Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology
14
Computertechniek
15
Als je dit krijgt moet je onder control panel >
system > hardware > device manager (select
view > show hidden devices) > non plug-andpray devices > MAC_MOT > driver instellen
op status = started, type = automatic
Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology
Computertechniek
Als je dit krijgt heb je debugger/loader niet
afgesloten
Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology
16
Computertechniek
Als het echt niet werkt: de USB aansluiting er
even uithalen om het bordje te resetten.
Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology
17
Computertechniek
18
doen
• Laat de LEDs anders knipperen: iedere 2
seconden even (bv 200ms) aan
• Laat de LEDs ‘kitt’-style heen-en-weer aan
gaan.
Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology