avr: started working on base system vs. main system.

base system will be a base system which can be used to flash and start
the main system.
This commit is contained in:
Martin Preuss
2023-02-20 23:47:30 +01:00
parent a12d6ae133
commit 8119cba750
8 changed files with 446 additions and 363 deletions

View File

@@ -6,6 +6,7 @@
.equ COM_MAXWAIT = 200 ; maximum loop count when waiting for rising/falling clock (TODO: Make frequency-dependant)
.equ COM_MAINTENANCE_ADDR = 0xf1
.equ COM_BUFFER_FLAGS_DONE = 0x80
.equ COM_BUFFER_FLAGS_RECEIVED = 0x40
@@ -36,6 +37,9 @@
.equ COM_MSG_OFFS_DESTADDR = 0
.equ COM_MSG_OFFS_MSGLEN = 1
.equ COM_MSG_OFFS_MSGDATA = 2
.equ COM_MSG_OFFS_CMD = 2 ; first at COM_MSG_OFFS_MSGDATA
.equ COM_MSG_OFFS_SRCADDR = 3
.equ COM_MSG_OFFS_PAYLOAD = 4 ; payload for the cmd follows here
.equ COM_ERR_NOTFORME = 1
.equ COM_ERR_CHECKSUM = 2
@@ -581,6 +585,8 @@ comReceivePacketToSram_acceptAddr:
brcc comReceivePacketToSram_error
eor r1, r16
st X+, r16
cpi r16, (COM_BUFFER_SIZE-3-COM_BUFFER_OFFS_DATA)+1
brcc comReceivePacketToSram_error ; packet too long (TODO: count overruns)
tst r16
breq comReceivePacketToSram_readXOR
mov r17, r16