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

@@ -173,62 +173,6 @@ flashDoSpm_wait: ; wait for possibly previous SPM to complete
; ---------------------------------------------------------------------------
; flashReadEepromIncr
;
; Read a byte from EEPROM (see example in ATtiny24/44/84 manual p.19).
;
; IN:
; - X: EEPROM Address to read from
; OUT:
; - R16: byte read
; - X: EEPROM Address incremented
; REGS: R16
flashReadEepromIncr:
sbic EECR, EEPE ; wait for previous write to complete (if any)
rjmp flashReadEepromIncr
out EEARH, xh ; set EEPROM address
out EEARL, xl
sbi EECR, EERE ; start EEPROM read by writing EERE
in r16, EEDR ; read data from data register
adiw xh:xl, 1
ret
; ---------------------------------------------------------------------------
; @routine flashReadUidIntoSdram
;
; Read UID from EEPROM.
;
; @clobbers R16, X, Y
flashReadUidIntoSdram:
ldi yh, HIGH(flashUid)
ldi yl, LOW(flashUid)
push r15
in r15, SREG
cli
ldi xl, LOW(EEPROM_OFFS_UUID)
ldi xh, HIGH(EEPROM_OFFS_UUID)
rcall flashReadEepromIncr ; (R16)
st Y+, r16
rcall flashReadEepromIncr ; (R16)
st Y+, r16
rcall flashReadEepromIncr ; (R16)
st Y+, r16
rcall flashReadEepromIncr ; (R16)
st Y+, r16
out SREG, r15
pop r15
ret
; @end
FLASH_END:
.equ MODULE_SIZE_FLASH = FLASH_END-FLASH_BEGIN