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

@@ -49,6 +49,8 @@
#define MODULES_LCD
#define MODULES_SI7021
#define LCD_MINIMAL_FONT
.equ VALUE_ID_TEMP1 = 0x01
.equ VALUE_ID_HUM1 = 0x02
@@ -132,37 +134,33 @@
; ---------------------------------------------------------------------------
; Reset and interrupt vectors
rjmp main ; Reset vector
reti ; EXT_INT0
rjmp comIsrPcint0 ; PCI0
reti ; PCI1
reti ; WATCHDOG
reti ; ICP1
reti ; OC1A
reti ; OC1B
reti ; OVF1
rjmp timerIrqOC0A ; OC0A
reti ; OC0B
reti ; OVF0
reti ; ACI
reti ; ADCC
reti ; ERDY
reti ; USI_STR
reti ; USI_OVF
; Reset and interrupt vectors (will be removed as soon as we can flash data over COM)
rjmp PC+0x500 ; Reset vector
rjmp PC+0x500 ; EXT_INT0
rjmp PC+0x500 ; PCI0
rjmp PC+0x500 ; PCI1
rjmp PC+0x500 ; WATCHDOG
rjmp PC+0x500 ; ICP1
rjmp PC+0x500 ; OC1A
rjmp PC+0x500 ; OC1B
rjmp PC+0x500 ; OVF1
rjmp PC+0x500 ; OC0A
rjmp PC+0x500 ; OC0B
rjmp PC+0x500 ; OVF0
rjmp PC+0x500 ; ACI
rjmp PC+0x500 ; ADCC
rjmp PC+0x500 ; ERDY
rjmp PC+0x500 ; USI_STR
rjmp PC+0x500 ; USI_OVF
; ---------------------------------------------------------------------------
; maintenance system starts here.
; working system starts here.
.org 0x50
.org 0x0500
realInterruptTable:
rjmp main ; Reset vector
reti ; EXT_INT0
rjmp comIsrPcint0 ; PCI0
@@ -193,7 +191,6 @@ realInterruptTable:
.include "comproto_addr.asm"
.include "twimaster.asm"
.include "lcd.asm"
;.include "bmp280.asm"
.include "si7021.asm"
@@ -208,14 +205,6 @@ ledA3Sram: .byte LED_SRAM_SIZE
; ***************************************************************************
; data in EEPROM
.eseg
; ***************************************************************************
; data in FLASH
@@ -223,7 +212,7 @@ ledA3Sram: .byte LED_SRAM_SIZE
ledA3Flash: .db DDRA+0x20, PORTA+0x20, PINA+0x20, (1<<PORTA3)
blinkPattern: .db 5, 5, 5, 5, 5, 10, 0xff, 0xff ; 3 short blinks, 1s pause, restart
blinkPattern2: .db 10, 20, 0xff, 0xff ; 1 long blink, 2s pause, restart
;blinkPattern2: .db 10, 20, 0xff, 0xff ; 1 long blink, 2s pause, restart
.include "main.asm"
@@ -231,15 +220,7 @@ blinkPattern2: .db 10, 20, 0xff, 0xff ; 1 long blink, 2s pause, restart
; ---------------------------------------------------------------------------
; onSystemStart
;
; Called on first time run, i.e. on system start.
;
; IN:
; - nothing
; OUT:
; - nothing
; USED: depending on called routines
; Called on first time run, i.e. on system start. No arguments, no results.
onSystemStart:
rcall Utils_SetupUid
@@ -253,15 +234,7 @@ onSystemStart:
; ---------------------------------------------------------------------------
; onEvery100ms
;
; Called every 100ms. Add your routine calls here.
;
; IN:
; - nothing
; OUT:
; - nothing
; USED: depending on called routines
; Called every 100ms. Add your routine calls here. No arguments, no results.
onEvery100ms:
#ifdef MODULES_LED
@@ -272,23 +245,12 @@ onEvery100ms:
ldi yh, HIGH(ledA3Sram)
rcall Led_Tick
#endif
; add more calls here
ret
; ---------------------------------------------------------------------------
; onEverySecond
;
; Called every second. Add your routine calls here.
;
; IN:
; - nothing
; OUT:
; - nothing
; USED: depending on called routines
; Called every second. Add your routine calls here. No arguments, no results.
onEverySecond:
; rcall TWI_Master_ScanNext
@@ -298,15 +260,7 @@ onEverySecond:
; ---------------------------------------------------------------------------
; onEvery10s
;
; Called every 10 seconds. Add your routine calls here.
;
; IN:
; - nothing
; OUT:
; - nothing
; USED: depending on called routines
; Called every 10 seconds. Add your routine calls here. No arguments, no results.
onEvery10s:
rcall printSendStats
@@ -315,15 +269,7 @@ onEvery10s:
; ---------------------------------------------------------------------------
; onEvery30s
;
; Called every 10 seconds. Add your routine calls here.
;
; IN:
; - nothing
; OUT:
; - nothing
; USED: depending on called routines
; Called every 30 seconds. Add your routine calls here. No arguments, no results.
onEvery30s:
#ifdef MODULES_SI7021
@@ -340,15 +286,7 @@ onEvery30s:
; ---------------------------------------------------------------------------
; onEveryMinute
;
; Called every minute. Add your routine calls here.
;
; IN:
; - nothing
; OUT:
; - nothing
; USED: depending on called routines
; Called every minute. Add your routine calls here. No arguments, no results.
onEveryMinute:
#ifdef MODULES_COM
@@ -364,6 +302,46 @@ onEveryMinute_l1:
; ---------------------------------------------------------------------------
; Called every 15 minutes. Add your routine calls here. No arguments, no results.
onEvery15m:
ret
; ---------------------------------------------------------------------------
; Called every 30 minutes. Add your routine calls here. No arguments, no results.
onEvery30m:
ret
; ---------------------------------------------------------------------------
; Called every hour. Add your routine calls here. No arguments, no results.
onEvery1h:
ret
; ---------------------------------------------------------------------------
; Called every 12 hours. Add your routine calls here. No arguments, no results.
onEvery12h:
ret
; ---------------------------------------------------------------------------
; Called every day. Add your routine calls here. No arguments, no results.
onEvery1d:
ret
; ---------------------------------------------------------------------------
; onPacketReceived:
;