From 5db8c67f4455bd6ae6655db88dfbd635fa18ba03 Mon Sep 17 00:00:00 2001 From: Robin Krens Date: Wed, 18 May 2022 19:24:19 +0200 Subject: [PATCH] makefile: flag changes --- Makefile | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 403b201..9abe973 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ AVRSIZE = avr-size AVRDUDE = avrdude CPPFLAGS = -DF_CPU=$(F_CPU) -DBAUD=$(BAUD) -I. -CFLAGS = -Os -g -Wall +CFLAGS = -O -g -Wall CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums LDFLAGS = -Wl,-Map,hbc.map @@ -30,11 +30,17 @@ $(ODIR)/%.o: %.c $(DEPS) $(CC) -c $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) $< -o $@ %.elf: $(OBJ) - $(CC) $(LDFLAGS) $(TARGET_ARCH) $^ -o $@ + $(CC) $(CFLAGS) $(LDFLAGS) $(TARGET_ARCH) $^ -o $@ %.hex: %.elf $(OBJCOPY) -j .text -j .data -O ihex $< $@ +# +# for binary output +# +#%.bin: %.elf +# $(OBJCOPY) -j .text -j .data -O binary $< $@ + all: hbc.hex .PHONY: clean @@ -42,13 +48,18 @@ all: hbc.hex clean: rm -rf $(ODIR)/*.o *.hex *.elf *.map - check-dev: - $(AVRDUDE) -p t25 -c $(PROGRAMMER_TYPE) -b $(BAUD) + $(AVRDUDE) -p t25 -c $(PROGRAMMER_TYPE) -b $(BAUD) flash: $(AVRDUDE) -p t25 -c $(PROGRAMMER_TYPE) -b $(BAUD) -U flash:w:hbc.hex:i read-flash-bin: - $(AVRDUDE) -p t25 -c $(PROGRAMMER_TYPE) -b $(BAUD) -P /dev/ttyUSB0 -U flash:r:flash.bin:r + $(AVRDUDE) -p t25 -c $(PROGRAMMER_TYPE) -b $(BAUD) -P /dev/ttyUSB0 -U flash:r:flash.bin:r + +# simulator runs on localhost:1234 +# load .elf file with avr-sim hex.elf +# and start debugging +sim: + simavr -f $(F_CPU) -m $(MCU) -g -t hbc.hex -- 2.7.4