From 75154ebdfbbfe7a04d21d910254058a757d2eef6 Mon Sep 17 00:00:00 2001 From: David Phillips Date: Sun, 20 Dec 2020 22:22:17 +1300 Subject: Use float-enabled printf implementation I hadn't realised there is a float-enabled printf implementation in AVR libc, so let's use that instead of our own hack. --- Makefile | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 3c15800..bb26ce1 100644 --- a/Makefile +++ b/Makefile @@ -5,8 +5,13 @@ QEMU_AVR ?= qemu-system-avr MCU ?= atmega32u4 SIM_MCU ?= atmega2560 -CFLAGS += -Wall -Wextra -DF_CPU=16000000UL -mmcu=$(MCU) -O3 -SIM_CFLAGS += -Wall -Wextra -DF_CPU=16000000UL -mmcu=$(SIM_MCU) -g3 -gdwarf-2 -DWDT_DISABLE +COMMON_CFLAGS += -Wall -Wextra -DF_CPU=16000000UL +CFLAGS += $(COMMON_CFLAGS) -mmcu=$(MCU) -O3 +SIM_CFLAGS += $(COMMON_CFLAGS) -mmcu=$(SIM_MCU) -g3 -gdwarf-2 -DWDT_DISABLE + +COMMON_LDFLAGS += -Wl,-u,vfprintf -lprintf_flt +LDFLAGS += $(COMMON_LDFLAGS) -mmcu=$(MCU) +SIM_LDFLAGS += $(COMMON_LDFLAGS) -mmcu=$(SIM_MCU) $(shell mkdir -p build/{real,sim}) @@ -26,14 +31,14 @@ build/altimeter.elf: \ build/real/display_sim.o \ build/real/altimeter.o \ build/real/util.o - $(CC) -o $@ $^ $(CFLAGS) + $(CC) -o $@ $^ $(LDFLAGS) build/altimeter_sim.elf: \ build/sim/barometer_sim.o \ build/sim/display_sim.o \ build/sim/altimeter.o \ build/sim/util.o - $(CC) -o $@ $^ $(SIM_CFLAGS) + $(CC) -o $@ $^ $(SIM_LDFLAGS) include config.mk -- cgit v1.1