diff --git a/targets/attiny85.json b/targets/attiny85.json index d1bea7c5..0e0abda5 100644 --- a/targets/attiny85.json +++ b/targets/attiny85.json @@ -3,7 +3,9 @@ "cpu": "attiny85", "build-tags": ["attiny85", "attiny", "avr2", "avr25"], "cflags": [ - "-mmcu=attiny85" + "-mmcu=attiny85", + "-D__AVR_ARCH__=25", + "-Qunused-arguments" ], "ldflags": [ "-mmcu=avr25" diff --git a/targets/avr.S b/targets/avr.S index c5881c82..934b8e42 100644 --- a/targets/avr.S +++ b/targets/avr.S @@ -2,6 +2,15 @@ ; in Go. ; The reset vector is device-specific and is generated by tools/gen-device-avr.py. +; These definitions are necessary because LLVM does not yet know these register +; aliases. See: https://reviews.llvm.org/D96492 +#define xl r26 +#define xh r27 +#define yl r28 +#define yh r29 +#define zl r30 +#define zh r31 + ; Startup code .section .text.__vector_RESET .global __vector_RESET diff --git a/targets/avr.json b/targets/avr.json index 31c2d9a7..6c465176 100644 --- a/targets/avr.json +++ b/targets/avr.json @@ -3,11 +3,14 @@ "build-tags": ["avr", "baremetal", "linux", "arm"], "goos": "linux", "goarch": "arm", - "compiler": "avr-gcc", + "compiler": "clang", "gc": "conservative", "linker": "avr-gcc", "scheduler": "none", "default-stack-size": 256, + "cflags": [ + "--target=avr-unknown-unknown" + ], "ldflags": [ "-T", "targets/avr.ld", "-Wl,--gc-sections"