From 66afcb3b390ffdec0c891ff72adb177f5e3d6846 Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Tue, 10 Mar 2020 18:30:35 +0100 Subject: [PATCH] avr: pass the correct -mmcu flag to the linker It does not appear to be necessary for these devices but might result in more appropriate libraries to be linked in. It is best to _not_ specify the exact MCU because otherwise a few other settings (such as startfiles and some linker script configs) also get set, which we do manually anyway and should not be interfered with. I discovered this while working on support for the atmega1284. --- targets/atmega328p.json | 3 +++ targets/digispark.json | 1 + 2 files changed, 4 insertions(+) diff --git a/targets/atmega328p.json b/targets/atmega328p.json index 79696ed6..64aefc98 100644 --- a/targets/atmega328p.json +++ b/targets/atmega328p.json @@ -6,6 +6,9 @@ "cflags": [ "-mmcu=atmega328p" ], + "ldflags": [ + "-mmcu=avr5" + ], "linkerscript": "src/device/avr/atmega328p.ld", "extra-files": [ "targets/avr.S", diff --git a/targets/digispark.json b/targets/digispark.json index facf1ede..90401283 100644 --- a/targets/digispark.json +++ b/targets/digispark.json @@ -7,6 +7,7 @@ "-mmcu=attiny85" ], "ldflags": [ + "-mmcu=avr25", "-Wl,--defsym=_bootloader_size=2180", "-Wl,--defsym=_stack_size=128" ],