aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2018-09-24 13:03:21 +0200
committerAyke van Laethem <[email protected]>2018-09-24 13:03:21 +0200
commitddd4a39cb85a5e652e82edf0d0475f0b5218235b (patch)
tree4965e95d1434f1a56cf4ef66d063363eb8548c78 /tools
parentfd6dda5e4ff4a7645293f6b3b0e4013471a719c7 (diff)
downloadtinygo-ddd4a39cb85a5e652e82edf0d0475f0b5218235b.tar.gz
tinygo-ddd4a39cb85a5e652e82edf0d0475f0b5218235b.zip
avr: fix default handler in interrupt vector
Apparently the target of a weak symbol must be defined in the same file as where it is used as a weak symbol. https://www.avrfreaks.net/forum/using-weak-custom-vector-table#comment-745922
Diffstat (limited to 'tools')
-rwxr-xr-xtools/gen-device-avr.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/gen-device-avr.py b/tools/gen-device-avr.py
index 3517d868e..f2592c1ff 100755
--- a/tools/gen-device-avr.py
+++ b/tools/gen-device-avr.py
@@ -208,6 +208,15 @@ def writeAsm(outdir, device):
; Automatically generated file. DO NOT EDIT.
; Generated by gen-device-avr.py from {file}, see {descriptorSource}
+; 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
+
; Avoid the need for repeated .weak and .set instructions.
.macro IRQ handler
.weak \\handler