avr: optimize for space.
This commit is contained in:
@@ -83,10 +83,12 @@ bootLoader:
|
|||||||
cbi LED_PORT, LED_PINNUM ; on
|
cbi LED_PORT, LED_PINNUM ; on
|
||||||
|
|
||||||
rcall flashReadUid
|
rcall flashReadUid
|
||||||
sts flashUid, r18
|
ldi xh, HIGH(flashUid)
|
||||||
sts flashUid+1, r19
|
ldi xl, LOW(flashUid)
|
||||||
sts flashUid+2, r20
|
st X+, r18
|
||||||
sts flashUid+3, r21
|
st X+, r19
|
||||||
|
st X+, r20
|
||||||
|
st X+, r21
|
||||||
|
|
||||||
; wait for 3 secs before doing anything else
|
; wait for 3 secs before doing anything else
|
||||||
ldi r16, 30
|
ldi r16, 30
|
||||||
@@ -130,13 +132,13 @@ bootLoader_waitAndRestartBootLoader:
|
|||||||
; OUT:
|
; OUT:
|
||||||
; - CFLAG: set if incoming flash request received, cleared otherwise
|
; - CFLAG: set if incoming flash request received, cleared otherwise
|
||||||
; - R16: message type received (if CFLAG set)
|
; - R16: message type received (if CFLAG set)
|
||||||
; REGS: R16, R17, X (R1, R2, R18, R19, R20, R21, R22, R24, R25)
|
; REGS: R16, R17, X, Y, (R1, R2, R18, R19, R20, R21, R22, R24, R25)
|
||||||
|
|
||||||
bootCheckFlash:
|
bootCheckFlash:
|
||||||
; send flash ready message
|
; send flash ready message
|
||||||
ldi xl, LOW(flashSendBuffer)
|
ldi xl, LOW(flashSendBuffer)
|
||||||
ldi xh, HIGH(flashSendBuffer)
|
ldi xh, HIGH(flashSendBuffer)
|
||||||
rcall flashWriteFlashReady ; (R16, R17, R18, R19, R20, Z)
|
rcall flashWriteFlashReady ; (R16, R17, R18, R19, R20, Y, Z)
|
||||||
rcall flashSendPacketUntilSuccess ; (R16, R17, R18, R21, R22, R24, R25, X)
|
rcall flashSendPacketUntilSuccess ; (R16, R17, R18, R21, R22, R24, R25, X)
|
||||||
|
|
||||||
bootCheckFlash_loop:
|
bootCheckFlash_loop:
|
||||||
|
|||||||
@@ -25,13 +25,15 @@
|
|||||||
; - X : buffer containing the message
|
; - X : buffer containing the message
|
||||||
; OUT:
|
; OUT:
|
||||||
; - CFLAG: set if message is for us, cleared otherwise
|
; - CFLAG: set if message is for us, cleared otherwise
|
||||||
; REGS: r16, r18. r19. r20, r21, X (R15, R17, R22)
|
; REGS: r16, r18, r19, r20, r21, X, Y (R15, R17, R22)
|
||||||
|
|
||||||
flashHandleFlashStart:
|
flashHandleFlashStart:
|
||||||
lds r18, flashUid
|
ldi yh, HIGH(flashUid)
|
||||||
lds r19, flashUid+1
|
ldi yl, LOW(flashUid)
|
||||||
lds r20, flashUid+2
|
ld r18, Y+
|
||||||
lds r21, flashUid+3
|
ld r19, Y+
|
||||||
|
ld r20, Y+
|
||||||
|
ld r21, Y
|
||||||
adiw xh:xl, FLASH_PACKET_START_OFFS_UID
|
adiw xh:xl, FLASH_PACKET_START_OFFS_UID
|
||||||
ld r16, X+
|
ld r16, X+
|
||||||
cp r16, r18
|
cp r16, r18
|
||||||
|
|||||||
Reference in New Issue
Block a user