/make/arduino-mk

To get this branch, use:
bzr branch http://bzr.ed.am/make/arduino-mk

« back to all changes in this revision

Viewing changes to arduino.mk

  • Committer: edam
  • Date: 2013-01-03 19:32:13 UTC
  • Revision ID: tim@ed.am-20130103193213-wk197mwqw0ywqjbh
bootloader may not be specified in boards.txt

Show diffs side-by-side

added added

removed removed

Lines of Context:
257
257
LIBRARYDIRS := $(foreach lib, $(LIBRARIES), \
258
258
        $(firstword $(wildcard $(addsuffix /$(lib), $(LIBRARYPATH)))))
259
259
LIBRARYDIRS += $(addsuffix /utility, $(LIBRARYDIRS))
260
 
BOOTLOADERDIR := \
261
 
        $(ARDUINODIR)/hardware/arduino/bootloaders/$(BOARD_BOOTLOADER_PATH)
262
260
 
263
261
# files
264
262
TARGET := $(if $(TARGET),$(TARGET),a.out)
267
265
ARDUINOLIB := .lib/arduino.a
268
266
ARDUINOLIBOBJS := $(foreach dir, $(ARDUINOCOREDIR) $(LIBRARYDIRS), \
269
267
        $(patsubst %, .lib/%.o, $(wildcard $(addprefix $(dir)/, *.c *.cpp))))
270
 
BOOTLOADERHEX := $(wildcard $(BOOTLOADERDIR)/$(BOARD_BOOTLOADER_FILE))
 
268
BOOTLOADERHEX := $(addprefix \
 
269
        $(ARDUINODIR)/hardware/arduino/bootloaders/$(BOARD_BOOTLOADER_PATH)/, \
 
270
        $(BOARD_BOOTLOADER_FILE))
271
271
 
272
272
# avrdude confifuration
273
273
ifeq "$(AVRDUDECONF)" ""
358
358
 
359
359
bootloader:
360
360
        @echo "Burning bootloader to board..."
361
 
        @test -n "$(BOOTLOADERHEX)" || { \
362
 
                echo "error: bootloader file could not be determined." >&2; \
363
 
                exit 1; }
364
361
        @test -n "$(SERIALDEV)" || { \
365
362
                echo "error: SERIALDEV could not be determined automatically." >&2; \
366
363
                exit 1; }
369
366
                echo; }
370
367
        stty $(STTYFARG) $(SERIALDEV) hupcl
371
368
        $(AVRDUDE) $(AVRDUDEFLAGS) -U lock:w:$(BOARD_BOOTLOADER_UNLOCK):m
372
 
        $(AVRDUDE) $(AVRDUDEFLAGS) -e -U lfuse:w:$(BOARD_BOOTLOADER_LFUSES):m \
373
 
                -U hfuse:w:$(BOARD_BOOTLOADER_HFUSES):m \
374
 
                $(patsubst %, -U efuse:w:%:m, $(BOARD_BOOTLOADER_EFUSES))
 
369
        $(AVRDUDE) $(AVRDUDEFLAGS) -eU lfuse:w:$(BOARD_BOOTLOADER_LFUSES):m
 
370
        $(AVRDUDE) $(AVRDUDEFLAGS) -U hfuse:w:$(BOARD_BOOTLOADER_HFUSES):m
 
371
ifneq "$(BOARD_BOOTLOADER_EFUSES)" ""
 
372
        $(AVRDUDE) $(AVRDUDEFLAGS) -U efuse:w:$(BOARD_BOOTLOADER_EFUSES):m
 
373
endif
 
374
ifneq "$(BOOTLOADERHEX)" ""
375
375
        $(AVRDUDE) $(AVRDUDEFLAGS) -U flash:w:$(BOOTLOADERHEX):i
 
376
endif
376
377
        $(AVRDUDE) $(AVRDUDEFLAGS) -U lock:w:$(BOARD_BOOTLOADER_LOCK):m
377
378
 
378
379
# building the target