wat gaan we doen?
DESCRIPTION
Wat gaan we doen?. herhaling ARM assembler instructies assembler formaat gebruik van het ARM ontwikkelbordje gebruik van de PSPad ontwikkelomgeving assembler programmeren!. herhaling ARM instructie set. meestal 3-address formaat (soms 2 of 4) - PowerPoint PPT PresentationTRANSCRIPT
Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology
1Computertechniek
herhaling ARM assembler instructies assembler formaat gebruik van het ARM ontwikkelbordjegebruik van de PSPad ontwikkelomgevingassembler programmeren!
Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology
2Computertechniek
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
3Computertechniek
assembler instructie formaat : rekenen
ADD R0, R1, R2ADD R0, R1, #1ADD R0, R1, R2, LSL R3ADD R0, R1, R2, LSR #2ADDS R0, R1, R2ADDNE R0, R1, R2ADDNES R0, R1, R2
Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology
4Computertechniek
assembler instructie formaat : vergelijken en verplaatsen
CMP R2, R3CMP R2, #2CMP R2, R3, LSL R4CMP R2, R3, LSL #2CMPE R2, R3MOV R1, R2MOV R1, #2MVN R1, R2
Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology
5Computertechniek
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
6Computertechniek
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
7Computertechniek
Assembly statements
Label:
Symbol (optional)
Opcode Expression(s) @ Comment
Operation, pseudo operation or directive
Operand, symbol
CR
One line (record)
Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology
8Computertechniek
ARM assembly language
Fairly standard assembly language:The general form of assembler input lines is:
{ label} { instruction} {; comment}
LDR r0,[r8] @ a comment
Label: ADD r4,r0,r1
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
9Computertechniek
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
10Computertechniek
Knipperen
.global main
main:
@ configureer de hardware om de LEDs te gebruiken
bl USE_LEDS
loop:
ldr r0, =0xFF
bl SET_LEDS
ldr r0, =( 500 * 1000 )
bl WAIT_uS
ldr r0, =0x00
bl SET_LEDS
ldr r0, =( 500 * 1000 )
bl WAIT_uS
b loop
Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology
11Computertechniek
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
12Computertechniek
zet onder file > target settings:Target = Remote/TCPHostname = 127.0.0.1Port = 8888
(als je netjes afsluit blijft zou dit moeten blijven staan)
Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology
13Computertechniek
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
14Computertechniek
continue
Zoals het een embedded programma betaamt eindigt ons programma nooit.
stop
Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology
15Computertechniek
Als je dit krijgt moet je onder control panel > system > hardware > device manager (select view > show hidden devices) > non plug-and-pray devices > MAC_MOT > driver instellen op status = started, type = automatic
Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology
16Computertechniek
Als je dit krijgt heb je debugger/loader niet afgesloten
Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology
17Computertechniek
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
18Computertechniek
doen• Laat de LEDs anders knipperen: iedere 2
seconden even (bv 200ms) aan• Laat de LEDs ‘kitt’-style heen-en-weer aan
gaan.