flashing a device via boot loader works now!!

- use a simple rjmp to start main firmware
- add buffer size as a parameter for com2ReceivePacketRaw
- fixed bugs in
  - Flash_StartPage
  - Flash_FinishPage
  - Flash_ReadPageIntoPageBuffer
- assume irqs disabled in flash routines
- increase flash receive buffer size to 128
This commit is contained in:
Martin Preuss
2023-04-20 23:57:13 +02:00
parent 9b568393cd
commit 82c7626783
7 changed files with 56 additions and 71 deletions

View File

@@ -15,12 +15,14 @@
;
; IN:
; - R16: COM address to listen to
; - R17: maximum value for accepted msg data (i.e. buffersize minus 3)
; - X : buffer to receive to
; OUT:
; - CFLAG: set if okay (packet received), cleared on error
; - R16: error code if CFLAG is cleared
; REGS: r16, r17, X (r18, r19, r20, r21, r22)
; REGS: r16, r17, r18, X (r19, r20, r21, r22)
com2ReceivePacketRaw:
mov r18, r17
push r16
; read destination address
rcall com2ReceiveByte ; read byte (R16, R17, R20, R21, R22)
@@ -37,11 +39,11 @@ com2ReceivePacketRaw:
com2ReceivePacketRaw_acceptAddr:
st X+, r16 ; store dest address, lock buffer
; read msg length
rcall com2ReceiveByte ; read packet length (R16, R17, R20, R21, R22)
rcall com2ReceiveByte ; read packet length (R16, R17, R20, R21, R22)
brcc com2ReceivePacketRaw_ioError
st X+, r16
cpi r16, (COM2_BUFFER_SIZE-3)
brcc com2ReceivePacketRaw_contentError ; packet too long
cp r16, r18 ; (COM2_BUFFER_SIZE-3)
brcc com2ReceivePacketRaw_contentError ; packet too long
inc r16 ; account for checksum byte
mov r17, r16
com2ReceivePacketRaw_loop: