multicpu support
This commit is contained in:
26
Makefile
26
Makefile
@@ -3,12 +3,25 @@ OBJ = main.o
|
||||
MCU_TARGET = atmega88
|
||||
OPTIMIZE = -Os
|
||||
|
||||
DEFS =
|
||||
ifeq ($(MCU_TARGET), atmega8)
|
||||
BOOTLOADER_START=0x1C00
|
||||
AVRDUDE_MCU=m8
|
||||
endif
|
||||
ifeq ($(MCU_TARGET), atmega88)
|
||||
BOOTLOADER_START=0x1C00
|
||||
AVRDUDE_MCU=m88
|
||||
endif
|
||||
ifeq ($(MCU_TARGET), atmega168)
|
||||
BOOTLOADER_START=0x3C00
|
||||
AVRDUDE_MCU=m168
|
||||
endif
|
||||
|
||||
DEFS = -DAPP_END=$(BOOTLOADER_START)
|
||||
LIBS =
|
||||
|
||||
# Override is only needed by avr-lib build system.
|
||||
override CFLAGS = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) $(DEFS)
|
||||
override LDFLAGS = -Wl,-Map,$(PRG).map,--section-start=.text=0x1C00
|
||||
override LDFLAGS = -Wl,-Map,$(PRG).map,--section-start=.text=$(BOOTLOADER_START)
|
||||
|
||||
CC = avr-gcc
|
||||
OBJCOPY = avr-objcopy
|
||||
@@ -21,6 +34,9 @@ all: $(PRG).elf lst text
|
||||
$(PRG).elf: $(OBJ)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
|
||||
|
||||
%.o: %.c $(MAKEFILE_LIST)
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
clean:
|
||||
rm -rf *.o *.lst *.map $(PRG).elf *.hex *.bin
|
||||
|
||||
@@ -41,7 +57,9 @@ bin: $(PRG).bin
|
||||
$(OBJCOPY) -j .text -j .data -O binary $< $@
|
||||
|
||||
install: text
|
||||
avrdude -c dragon_isp -P usb -p m88 -U flash:w:$(PRG).hex
|
||||
avrdude -c dragon_isp -P usb -p $(AVRDUDE_MCU) -U flash:w:$(PRG).hex
|
||||
|
||||
fuses:
|
||||
avrdude -c dragon_isp -P usb -p m88 -U lfuse:w:0xc2:m -U hfuse:w:0xdd:m -U efuse:w:0xfa:m
|
||||
avrdude -c dragon_isp -P usb -p $(AVRDUDE_MCU) -U lfuse:w:0xc2:m
|
||||
avrdude -c dragon_isp -P usb -p $(AVRDUDE_MCU) -U hfuse:w:0xdd:m
|
||||
avrdude -c dragon_isp -P usb -p $(AVRDUDE_MCU) -U efuse:w:0xfa:m
|
||||
|
||||
Reference in New Issue
Block a user