diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -2,11 +2,14 @@ include config.mk CC ?= gcc AVR_CC ?= avr-gcc +AVR_SIZE ?= avr-size GDB ?= avr-gdb OBJCOPY ?= avr-objcopy AVRDUDE ?= avrdude QEMU ?= qemu-system-avr +REAL_ELF = build/altimeter.elf + # options for native (i.e. unit test) UNITY_SRC ?= unity/src UNITY_O = $(UNITY_SRC)/unity.o @@ -29,7 +32,7 @@ SIM_LDFLAGS += $(AVR_COMMON_LDFLAGS) -mmcu=$(SIM_MCU) $(shell mkdir -p build/{real,sim,native}) -all: build/altimeter_sim.elf build/altimeter.hex test +all: build/altimeter_sim.elf build/altimeter.hex test size # Run the sim build software in qemu, halted ready for `make gdb` to attach and # continue. Note that sim build mocks out some hardware components @@ -62,6 +65,9 @@ build/altimeter.elf: \ build/real/util.o $(AVR_CC) $(AVR_LDFLAGS) -o $@ $^ +size: + [ -f "$(REAL_ELF)" ] && $(AVR_SIZE) "$(REAL_ELF)" + # ELF for simulator/emu. Note that whever I/O is required, the *_sim.{o,c} # versions of each component will provide a mocked interface. This allows for # operation in QEMU (see `emu` recipe) without requring SPI, I²C and @@ -85,7 +91,4 @@ build/native/%.o: %.c build/%.hex: build/%.elf $(OBJCOPY) -O ihex -R .eeprom $< $@ -build/%.elf: - $(AVR_CC) $(AVR_CFLAGS) -o $@ $^ - -.PHONY: all emu gdb flash clean test +.PHONY: all emu gdb flash clean test size |