mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-19 20:14:04 +00:00
avr: automatically generate interrupt vectors
This commit is contained in:
+19
-11
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user