startover again and port fd0's loader to the 644

This commit is contained in:
david
2009-07-21 15:28:09 +02:00
parent e45b08a5fb
commit b2bf789b85
23 changed files with 405 additions and 577 deletions

View File

@@ -1,7 +1,7 @@
# microcontroller and project specific settings
TARGET = bootloader
F_CPU = 20000000
F_CPU = 20000000UL
MCU = atmega644
SRC = bootloader.c
@@ -11,7 +11,7 @@ OBJECTS += $(patsubst %.S,%.o,${ASRC})
HEADERS += $(shell echo *.h)
# CFLAGS += -Werror
LDFLAGS += -L/usr/local/avr/avr/lib
CFLAGS += -Iusbdrv -I. -Os
CFLAGS += -Iusbdrv -I.
CFLAGS += -DHARDWARE_REV=$(HARDWARE_REV)
ASFLAGS += -x assembler-with-cpp
ASFLAGS += -Iusbdrv -I.
@@ -36,12 +36,9 @@ else ifeq ($(MCU),atmega88)
# bootloader section starts at 0xc00 (word-address) == 0x1800 (byte-address)
BOOT_SECTION_START = 0x1800
else ifeq ($(MCU),atmega644)
# atmega88 with 1024 words bootloader:
# bootloader section starts at 0x7c00 (word-address) == 0xF800 (byte-address)
# atmega88 with 2024 words bootloader:
# bootloader section starts at 0x7800 (word-address) == 0xF000 (byte-address)
BOOT_SECTION_START = 0xf000
# atmega88 with 2048 words bootloader:
# bootloader section starts at 0x7800 (word-address) == 0xF000 (byte-address)
BOOT_SECTION_START = 0xf000
endif
LDFLAGS += -Wl,--section-start=.text=$(BOOT_SECTION_START)
@@ -57,59 +54,23 @@ all: $(TARGET).hex $(TARGET).lss
@echo "$(TARGET) compiled for: $(MCU)"
@echo -n "size is: "
@$(SIZE) -A $(TARGET).hex | grep "\.sec1" | tr -s " " | cut -d" " -f2
@echo "max size:4096 bytes"
@echo "==============================="
$(TARGET): $(OBJECTS) $(TARGET).o
%.o: $(HEADERS)
.PHONY: install lock fuses-atmega168-unzap bootstrap
.PHONY: clean clean-$(TARGET)
# install: program-serial-$(TARGET) program-serial-eeprom-$(TARGET)
install: program-isp-$(TARGET)
lock:
$(AVRDUDE) $(AVRDUDE_FLAGS) -c $(ISP_PROG) -P $(ISP_DEV) -U lock:w:0x2f:m
fuses-atmega168-unzap:
echo "sck 5" | $(AVRDUDE) $(AVRDUDE_FLAGS) -c $(ISP_PROG) -P $(ISP_DEV) -F -u -t
$(AVRDUDE) $(AVRDUDE_FLAGS) -c $(ISP_PROG) -P $(ISP_DEV) -U lfuse:w:0xe7:m -U hfuse:w:0xd5:m -U efuse:w:0x00:m
echo "sck 0.2" | $(AVRDUDE) $(AVRDUDE_FLAGS) -c $(ISP_PROG) -P $(ISP_DEV) -F -u -t
fuses-atmega168-rumpus:
echo "sck 5" | $(AVRDUDE) $(AVRDUDE_FLAGS) -c $(ISP_PROG) -P $(ISP_DEV) -F -u -t
$(AVRDUDE) $(AVRDUDE_FLAGS) -c $(ISP_PROG) -P $(ISP_DEV) -U lfuse:w:0xe7:m -U efuse:w:0x00:m
echo "sck 0.2" | $(AVRDUDE) $(AVRDUDE_FLAGS) -c $(ISP_PROG) -P $(ISP_DEV) -F -u -t
bootstrap: fuses-atmega168-unzap install lock
.PHONY: clean clean-$(TARGET) clean-uploadtest
clean: clean-$(TARGET) clean-uploadtest
clean: clean-$(TARGET)
clean-$(TARGET):
$(RM) $(TARGET) $(OBJECTS)
clean-uploadtest:
rm -f datatestfile{512,14k}.raw
.PHONY: depend test uploadtest
.PHONY: depend test
depend:
$(CC) $(CFLAGS) -M $(CDEFS) $(CINCS) $(SRC) >> $(MAKEFILE).dep
datatestfile14k.raw:
dd if=/dev/urandom of=datatestfile14k.raw bs=1 count=14336
datatestfile512.raw:
dd if=/dev/urandom of=datatestfile512.raw bs=1 count=512
test/test.hex:
$(MAKE) -C test test.hex
uploadtest: datatestfile14k.raw datatestfile512.raw
$(AVRDUDE) -p $(AVRDUDE_MCU) -c usbasp -P usb -U flash:w:datatestfile14k.raw -U eeprom:w:datatestfile512.raw
$(AVRDUDE) $(AVRDUDE_FLAGS) -c $(ISP_PROG) -P $(ISP_DEV) -U flash:v:datatestfile14k.raw -U eeprom:v:datatestfile512.raw
-include $(MAKEFILE).dep