avr: automatically generate interrupt vectors

This commit is contained in:
Ayke van Laethem
2018-09-23 20:37:22 +02:00
parent 3850530c88
commit b9638315d2
5 changed files with 61 additions and 15 deletions
+19 -11
View File
@@ -1,14 +1,11 @@
.section .isr
isr:
rjmp reset
.org 0x18 ; WDT
rjmp wdt
; This file provides common code across AVRs that cannot be implemented directly
; in Go.
; The reset vector is device-specific and is generated by tools/gen-device-avr.py.
; Startup code
.section .reset
.org 26
reset:
.section .text.__vector_RESET
.global __vector_RESET
__vector_RESET:
clr r1 ; r1 is expected to be 0 by the C calling convention
; Set up the stack pointer.
@@ -41,10 +38,21 @@ init_data_end:
; need to jump.
; This is the default handler for interrupts, if triggered but not defined.
; Sleep inside so that an accidentally triggered interrupt won't drain the
; battery of a battery-powered device.
.section .text.__vector_default
.global __vector_default
__vector_default:
sleep
rjmp __vector_default
; The only thing this WDT handler really does is disable itself, to get out of
; sleep mode.
.section .text.wdt
wdt:
.section .text.__vector_WDT
.global __vector_WDT
__vector_WDT:
push r16
clr r16