mirror of
https://github.com/esp8266/Arduino.git
synced 2025-08-09 22:24:14 +03:00
One bootloader for the Diecimila and NG - just different makefile targets to pass in slightly different defines.
This commit is contained in:
@@ -78,7 +78,8 @@
|
|||||||
/* 20060803: hacked by DojoCorp */
|
/* 20060803: hacked by DojoCorp */
|
||||||
/* 20070626: hacked by David A. Mellis to decrease waiting time for auto-reset */
|
/* 20070626: hacked by David A. Mellis to decrease waiting time for auto-reset */
|
||||||
/* set the waiting time for the bootloader */
|
/* set the waiting time for the bootloader */
|
||||||
#define MAX_TIME_COUNT (F_CPU>>4)
|
/* get this from the Makefile instead */
|
||||||
|
/* #define MAX_TIME_COUNT (F_CPU>>4) */
|
||||||
|
|
||||||
/* 20070707: hacked by David A. Mellis - after this many errors give up and launch application */
|
/* 20070707: hacked by David A. Mellis - after this many errors give up and launch application */
|
||||||
#define MAX_ERROR_COUNT 5
|
#define MAX_ERROR_COUNT 5
|
||||||
@@ -357,9 +358,9 @@ int main(void)
|
|||||||
/* flash onboard LED to signal entering of bootloader */
|
/* flash onboard LED to signal entering of bootloader */
|
||||||
#ifdef __AVR_ATmega128__
|
#ifdef __AVR_ATmega128__
|
||||||
// 4x for UART0, 5x for UART1
|
// 4x for UART0, 5x for UART1
|
||||||
flash_led(3 + bootuart);
|
flash_led(NUM_LED_FLASHES + bootuart);
|
||||||
#else
|
#else
|
||||||
flash_led(1);
|
flash_led(NUM_LED_FLASHES);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* 20050803: by DojoCorp, this is one of the parts provoking the
|
/* 20050803: by DojoCorp, this is one of the parts provoking the
|
||||||
|
@@ -2,6 +2,18 @@
|
|||||||
# E.Lins, 18.7.2005
|
# E.Lins, 18.7.2005
|
||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
|
# Instructions
|
||||||
|
#
|
||||||
|
# To build the bootloader for the Diecimila:
|
||||||
|
# make diecimila
|
||||||
|
#
|
||||||
|
# To build the bootloader for the NG/Mini:
|
||||||
|
# make ng
|
||||||
|
#
|
||||||
|
# To burn the bootloader:
|
||||||
|
# make TARGET=diecimila isp
|
||||||
|
# make TARGET=ng isp
|
||||||
|
|
||||||
# program name should not be changed...
|
# program name should not be changed...
|
||||||
PROGRAM = ATmegaBOOT_168
|
PROGRAM = ATmegaBOOT_168
|
||||||
|
|
||||||
@@ -26,13 +38,13 @@ LDSECTION = --section-start=.text=0x3800
|
|||||||
# lock it), but since the high two bits of the lock byte are
|
# lock it), but since the high two bits of the lock byte are
|
||||||
# unused, avrdude would get confused.
|
# unused, avrdude would get confused.
|
||||||
ISPFUSES = avrdude -c $(ISPTOOL) -p m168 -P $(ISPPORT) $(ISPSPEED) -e -u -U lock:w:0x3f:m -U efuse:w:0x00:m -U hfuse:w:0xdf:m -U lfuse:w:0xff:m
|
ISPFUSES = avrdude -c $(ISPTOOL) -p m168 -P $(ISPPORT) $(ISPSPEED) -e -u -U lock:w:0x3f:m -U efuse:w:0x00:m -U hfuse:w:0xdf:m -U lfuse:w:0xff:m
|
||||||
ISPFLASH = avrdude -c $(ISPTOOL) -p m168 -P $(ISPPORT) $(ISPSPEED) -U flash:w:$(PROGRAM).hex -U lock:w:0x0f:m
|
ISPFLASH = avrdude -c $(ISPTOOL) -p m168 -P $(ISPPORT) $(ISPSPEED) -U flash:w:$(PROGRAM)_$(TARGET).hex -U lock:w:0x0f:m
|
||||||
|
|
||||||
|
|
||||||
OBJ = $(PROGRAM).o
|
OBJ = $(PROGRAM).o
|
||||||
OPTIMIZE = -O2
|
OPTIMIZE = -O2
|
||||||
|
|
||||||
DEFS =
|
DEFS =
|
||||||
LIBS =
|
LIBS =
|
||||||
|
|
||||||
CC = avr-gcc
|
CC = avr-gcc
|
||||||
@@ -41,37 +53,35 @@ CC = avr-gcc
|
|||||||
# Override is only needed by avr-lib build system.
|
# Override is only needed by avr-lib build system.
|
||||||
|
|
||||||
override CFLAGS = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) -DF_CPU=$(AVR_FREQ) $(DEFS)
|
override CFLAGS = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) -DF_CPU=$(AVR_FREQ) $(DEFS)
|
||||||
override LDFLAGS = -Wl,-Map,$(PROGRAM).map,$(LDSECTION)
|
override LDFLAGS = -Wl,$(LDSECTION)
|
||||||
|
#override LDFLAGS = -Wl,-Map,$(PROGRAM).map,$(LDSECTION)
|
||||||
|
|
||||||
OBJCOPY = avr-objcopy
|
OBJCOPY = avr-objcopy
|
||||||
OBJDUMP = avr-objdump
|
OBJDUMP = avr-objdump
|
||||||
|
|
||||||
all: $(PROGRAM).elf lst text
|
all:
|
||||||
|
|
||||||
isp: $(PROGRAM).hex
|
diecimila: TARGET = diecimila
|
||||||
|
diecimila: CFLAGS += '-DMAX_TIME_COUNT=F_CPU>>4' '-DNUM_LED_FLASHES=1'
|
||||||
|
diecimila: $(PROGRAM)_diecimila.hex
|
||||||
|
|
||||||
|
ng: TARGET = ng
|
||||||
|
ng: CFLAGS += '-DMAX_TIME_COUNT=F_CPU>>1' '-DNUM_LED_FLASHES=3'
|
||||||
|
ng: $(PROGRAM)_ng.hex
|
||||||
|
|
||||||
|
isp: $(PROGRAM)_$(TARGET).hex
|
||||||
$(ISPFUSES)
|
$(ISPFUSES)
|
||||||
$(ISPFLASH)
|
$(ISPFLASH)
|
||||||
|
|
||||||
$(PROGRAM).elf: $(OBJ)
|
%.elf: $(OBJ)
|
||||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf *.o *.elf *.lst *.map *.sym *.lss *.eep
|
rm -rf *.o *.elf *.lst *.map *.sym *.lss *.eep *.srec *.bin *.hex
|
||||||
rm -rf $(PROGRAM).hex $(PROGRAM).srec $(PROGRAM).bin
|
|
||||||
|
|
||||||
lst: $(PROGRAM).lst
|
|
||||||
|
|
||||||
%.lst: %.elf
|
%.lst: %.elf
|
||||||
$(OBJDUMP) -h -S $< > $@
|
$(OBJDUMP) -h -S $< > $@
|
||||||
|
|
||||||
# Rules for building the .text rom images
|
|
||||||
|
|
||||||
text: hex bin srec
|
|
||||||
|
|
||||||
hex: $(PROGRAM).hex
|
|
||||||
bin: $(PROGRAM).bin
|
|
||||||
srec: $(PROGRAM).srec
|
|
||||||
|
|
||||||
%.hex: %.elf
|
%.hex: %.elf
|
||||||
$(OBJCOPY) -j .text -j .data -O ihex $< $@
|
$(OBJCOPY) -j .text -j .data -O ihex $< $@
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user