From ddd4a39cb85a5e652e82edf0d0475f0b5218235b Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Mon, 24 Sep 2018 13:03:21 +0200 Subject: [PATCH] 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 --- targets/avr.S | 10 ---------- tools/gen-device-avr.py | 9 +++++++++ 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/targets/avr.S b/targets/avr.S index 1c32fa19..acc6a6ea 100644 --- a/targets/avr.S +++ b/targets/avr.S @@ -38,16 +38,6 @@ 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.__vector_WDT diff --git a/tools/gen-device-avr.py b/tools/gen-device-avr.py index 3517d868..f2592c1f 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