From c90595c18aefef4e0b532a680e3f176011b24a1d Mon Sep 17 00:00:00 2001 From: Ricardo Cosme Date: Thu, 21 Sep 2023 21:54:18 -0300 Subject: [PATCH] Add make variables to Makefiles on `test` + I want to build using a specific avr-gcc binary. --- test/atmega328p/Makefile | 19 +++++++++++-------- test/attiny13a/Makefile | 19 +++++++++++-------- test/attiny85/Makefile | 18 +++++++++++------- 3 files changed, 33 insertions(+), 23 deletions(-) diff --git a/test/atmega328p/Makefile b/test/atmega328p/Makefile index f9d5944..a69698c 100644 --- a/test/atmega328p/Makefile +++ b/test/atmega328p/Makefile @@ -1,22 +1,25 @@ stdcxx=c++17 mcu=atmega328p +CXX=avr-g++ +CC=avr-gcc +OBJCOPY=avr-objcopy +OBJDUMP=avr-objdump +INCLUDE=-I../../include +CXXFLAGS=-std=$(stdcxx) -mmcu=$(mcu) -Wall -Os $(INCLUDE) + all: pins.diff regs.diff %.diff: pins.hex expected_pins.hex regs.hex expected_regs.hex diff pins.hex expected_pins.hex > pins.diff diff regs.hex expected_regs.hex > regs.diff -%.hex: %.o - avr-objcopy -O ihex $< $@ - -%.s: %.o - avr-objdump -d $< > $@ +%.s: %.cpp + $(CXX) $(CXXFLAGS) -S $^ -%.o: %.cpp - avr-g++ -std=$(stdcxx) -Os -mmcu=$(mcu) -Wall -I../../include -c $< +%.hex: %.o + $(OBJCOPY) -j .text -j .data -O ihex $< $@ .PHONY: clean clean: rm -f *.hex *.o *.s *.diff - diff --git a/test/attiny13a/Makefile b/test/attiny13a/Makefile index f7b61a0..aae0c16 100644 --- a/test/attiny13a/Makefile +++ b/test/attiny13a/Makefile @@ -1,22 +1,25 @@ stdcxx=c++17 mcu=attiny13a +CXX=avr-g++ +CC=avr-gcc +OBJCOPY=avr-objcopy +OBJDUMP=avr-objdump +INCLUDE=-I../../include +CXXFLAGS=-std=$(stdcxx) -mmcu=$(mcu) -Wall -Os $(INCLUDE) + all: pins.diff regs.diff %.diff: pins.hex expected_pins.hex regs.hex expected_regs.hex diff pins.hex expected_pins.hex > pins.diff diff regs.hex expected_regs.hex > regs.diff -%.hex: %.o - avr-objcopy -O ihex $< $@ - -%.s: %.o - avr-objdump -d $< > $@ +%.s: %.cpp + $(CXX) $(CXXFLAGS) -S $^ -%.o: %.cpp - avr-g++ -std=$(stdcxx) -Os -mmcu=$(mcu) -Wall -I../../include -c $< +%.hex: %.o + $(OBJCOPY) -j .text -j .data -O ihex $< $@ .PHONY: clean clean: rm -f *.hex *.o *.s *.diff - diff --git a/test/attiny85/Makefile b/test/attiny85/Makefile index baf62bb..289f9f1 100644 --- a/test/attiny85/Makefile +++ b/test/attiny85/Makefile @@ -1,20 +1,24 @@ stdcxx=c++17 mcu=attiny85 +CXX=avr-g++ +CC=avr-gcc +OBJCOPY=avr-objcopy +OBJDUMP=avr-objdump +INCLUDE=-I../../include +CXXFLAGS=-std=$(stdcxx) -mmcu=$(mcu) -Wall -Os $(INCLUDE) + all: pins.diff regs.diff %.diff: pins.hex expected_pins.hex regs.hex expected_regs.hex diff pins.hex expected_pins.hex > pins.diff diff regs.hex expected_regs.hex > regs.diff -%.hex: %.o - avr-objcopy -O ihex $< $@ - -%.s: %.o - avr-objdump -d $< > $@ +%.s: %.cpp + $(CXX) $(CXXFLAGS) -S $^ -%.o: %.cpp - avr-g++ -std=$(stdcxx) -Os -mmcu=$(mcu) -Wall -I../../include -c $< +%.hex: %.o + $(OBJCOPY) -j .text -j .data -O ihex $< $@ .PHONY: clean clean: