avr: t03 runs in basic mode now, flashing of AtTiny841 finally works!!

This commit is contained in:
Martin Preuss
2025-01-25 03:16:02 +01:00
parent 779b37f195
commit e840bfd9e6
11 changed files with 916 additions and 342 deletions

View File

@@ -25,25 +25,26 @@
; @clobbers: r16, r17, r20, X (r18, r19, r22)
ioWaitForGivenMsg:
ldi r20, 100 ; number of tries
ldi r20, 10 ; number of tries
ioWaitForGivenMsg_loop:
push r16
rcall ioRawWaitForValidMsg ; (r16, r17, r18, r19, r22, X)
pop r16
pop r17 ; pop into r17 (from r16)
brcc ioWaitForGivenMsg_end
ldi xl, LOW(flashRecvBuffer)
ldi xh, HIGH(flashRecvBuffer)
adiw xh:xl, COM2_MSG_OFFS_CMD
ld r17, X
ld r16, X
sbiw xh:xl, COM2_MSG_OFFS_CMD
cp r16, r17
breq ioWaitForGivenMsg_gotIt
cpi r16, CPRO_CMD_FLASH_END
breq ioWaitForGivenMsg_gotIt
mov r16, r17 ; put expected msg code back into r16 for next loop
dec r20
brne ioWaitForGivenMsg_loop
clc
rjmp ioWaitForGivenMsg_end
ret
ioWaitForGivenMsg_gotIt:
sec
ioWaitForGivenMsg_end: