Skip to content

Commit

Permalink
Add make variables to Makefiles on test
Browse files Browse the repository at this point in the history
+ I want to build using a specific avr-gcc binary.
  • Loading branch information
ricardocosme committed Sep 22, 2023
1 parent b60238b commit c90595c
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 23 deletions.
19 changes: 11 additions & 8 deletions test/atmega328p/Makefile
Original file line number Diff line number Diff line change
@@ -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

19 changes: 11 additions & 8 deletions test/attiny13a/Makefile
Original file line number Diff line number Diff line change
@@ -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

18 changes: 11 additions & 7 deletions test/attiny85/Makefile
Original file line number Diff line number Diff line change
@@ -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:
Expand Down

0 comments on commit c90595c

Please sign in to comment.