From f804beb36f795cd833e49d5f2a50d584ae63e81b Mon Sep 17 00:00:00 2001 From: Ain <41307858+nero@users.noreply.github.com> Date: Sun, 28 Jan 2018 20:41:35 +0000 Subject: [PATCH] Replace makefile by generic board definition --- Makefile | 63 --------------------------------------------- boards/relaycard.mk | 7 +++++ 2 files changed, 7 insertions(+), 63 deletions(-) delete mode 100644 Makefile create mode 100644 boards/relaycard.mk diff --git a/Makefile b/Makefile deleted file mode 100644 index e71e046..0000000 --- a/Makefile +++ /dev/null @@ -1,63 +0,0 @@ -MCU_TARGET = atmega328p -MCU_FREQ = 16000000UL -MCU_TTY = /dev/ttyUSB0 -MCU_TTY_BAUD = 57600 -MCU_PROGRAMMER = arduino - -PRG = main -OBJ = main.o - -OPTIMIZE = -O2 -DEFS = -DF_CPU=$(MCU_FREQ) -DBAUDRATE=$(MCU_TTY_BAUD) -LIBS = -# You should not have to change anything below here. -CC = avr-gcc -# Override is only needed by avr-lib build system. -override CFLAGS = -g --std=c99 -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) $(DEFS) -override LDFLAGS = -Wl,-Map,$(PRG).map -OBJCOPY = avr-objcopy -OBJDUMP = avr-objdump - -all: $(PRG).elf $(PRG).asm - -$(PRG).elf: $(OBJ) - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) - -# dependencies: - -clean: - rm -rf *.o $(PRG).elf *.eps *.png *.pdf *.bak *.asm *.hex - rm -rf *.lst *.map $(EXTRA_CLEAN_FILES) - -lst: $(PRG).lst - -%.lst: %.elf - $(OBJDUMP) -h -S $< > $@ - -# Rules for building the .text rom images -text: hex bin srec - -hex: $(PRG).hex - -bin: $(PRG).bin - -%.hex: %.elf - $(OBJCOPY) -j .text -j .data -O ihex $< $@ - -%.bin: %.elf - $(OBJCOPY) -j .text -j .data -O binary $< $@ - -# to get the final asm code - -%.asm: %.elf - $(OBJDUMP) -z -j .text -m avr5 -d $< > $@ - -reset: - avrdude -v -p$(MCU_TARGET) -c$(MCU_PROGRAMMER) -P$(MCU_TTY) -b$(MCU_TTY_BAUD) - -flash: $(PRG).hex - avrdude -v -p$(MCU_TARGET) -c$(MCU_PROGRAMMER) -P$(MCU_TTY) -b$(MCU_TTY_BAUD) -u -U flash:w:$(PRG).hex - -screen: - screen $(MCU_TTY) $(MCU_TTY_BAUD) - diff --git a/boards/relaycard.mk b/boards/relaycard.mk new file mode 100644 index 0000000..682c7e7 --- /dev/null +++ b/boards/relaycard.mk @@ -0,0 +1,7 @@ +include boards/nano.mk + +CPPFLAGS += -DBAUDRATE=$(AVRDUDE_BAUD) + +ifndef PROG +PROG = uart-relaycard +endif