Replace makefile by generic board definition
This commit is contained in:
parent
54aa55a902
commit
f804beb36f
63
Makefile
63
Makefile
@ -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)
|
|
||||||
|
|
7
boards/relaycard.mk
Normal file
7
boards/relaycard.mk
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
include boards/nano.mk
|
||||||
|
|
||||||
|
CPPFLAGS += -DBAUDRATE=$(AVRDUDE_BAUD)
|
||||||
|
|
||||||
|
ifndef PROG
|
||||||
|
PROG = uart-relaycard
|
||||||
|
endif
|
Loading…
Reference in New Issue
Block a user