Add burn_bootloader
target
Code to burn fuses is moved from ispload target to this new target, so that fuses are burned only once when needed. Fix #85
This commit is contained in:
parent
7961a86286
commit
4fb3e089bb
2 changed files with 53 additions and 27 deletions
|
@ -8,6 +8,7 @@ I tried to give credit whenever possible. If I have missed anyone, kindly add it
|
||||||
- Don't append port details to avrdude for usbasp. See #123
|
- Don't append port details to avrdude for usbasp. See #123
|
||||||
- Ignore commented lines while parsing boards.txt file. See #124
|
- Ignore commented lines while parsing boards.txt file. See #124
|
||||||
- In ISP mode, read baudrate and programmer from boards.txt. See #125
|
- In ISP mode, read baudrate and programmer from boards.txt. See #125
|
||||||
|
- Add `burn_bootloader` target. See #85
|
||||||
|
|
||||||
### 1.0.1 (2013-09-25)
|
### 1.0.1 (2013-09-25)
|
||||||
- Unconditionally add -D in avrdude options. See #114
|
- Unconditionally add -D in avrdude options. See #114
|
||||||
|
|
|
@ -559,6 +559,14 @@ ifeq ($(strip $(NO_CORE)),)
|
||||||
ISP_EXT_FUSE = $(call PARSE_BOARD,$(BOARD_TAG),bootloader.extended_fuses)
|
ISP_EXT_FUSE = $(call PARSE_BOARD,$(BOARD_TAG),bootloader.extended_fuses)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifndef BOOTLOADER_PATH
|
||||||
|
BOOTLOADER_PATH = $(call PARSE_BOARD,$(BOARD_TAG),bootloader.path)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifndef BOOTLOADER_FILE
|
||||||
|
BOOTLOADER_FILE = $(call PARSE_BOARD,$(BOARD_TAG),bootloader.file)
|
||||||
|
endif
|
||||||
|
|
||||||
ifndef ISP_LOCK_FUSE_POST
|
ifndef ISP_LOCK_FUSE_POST
|
||||||
ISP_LOCK_FUSE_POST = $(call PARSE_BOARD,$(BOARD_TAG),bootloader.lock_bits)
|
ISP_LOCK_FUSE_POST = $(call PARSE_BOARD,$(BOARD_TAG),bootloader.lock_bits)
|
||||||
endif
|
endif
|
||||||
|
@ -991,13 +999,19 @@ ifndef AVRDUDE_ISP_BAUDRATE
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Fuse settings copied from Arduino IDE.
|
||||||
|
# https://github.com/arduino/Arduino/blob/master/app/src/processing/app/debug/AvrdudeUploader.java#L254
|
||||||
|
|
||||||
# Pre fuse settings
|
# Pre fuse settings
|
||||||
ifndef AVRDUDE_ISP_FUSES_PRE
|
ifndef AVRDUDE_ISP_FUSES_PRE
|
||||||
|
|
||||||
ifneq ($(strip $(ISP_LOCK_FUSE_PRE)),)
|
ifneq ($(strip $(ISP_LOCK_FUSE_PRE)),)
|
||||||
AVRDUDE_ISP_FUSES_PRE += -U lock:w:$(ISP_LOCK_FUSE_PRE):m
|
AVRDUDE_ISP_FUSES_PRE += -U lock:w:$(ISP_LOCK_FUSE_PRE):m
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifneq ($(strip $(ISP_EXT_FUSE)),)
|
||||||
|
AVRDUDE_ISP_FUSES_PRE += -U efuse:w:$(ISP_EXT_FUSE):m
|
||||||
|
endif
|
||||||
|
|
||||||
ifneq ($(strip $(ISP_HIGH_FUSE)),)
|
ifneq ($(strip $(ISP_HIGH_FUSE)),)
|
||||||
AVRDUDE_ISP_FUSES_PRE += -U hfuse:w:$(ISP_HIGH_FUSE):m
|
AVRDUDE_ISP_FUSES_PRE += -U hfuse:w:$(ISP_HIGH_FUSE):m
|
||||||
endif
|
endif
|
||||||
|
@ -1005,11 +1019,16 @@ ifndef AVRDUDE_ISP_FUSES_PRE
|
||||||
ifneq ($(strip $(ISP_LOW_FUSE)),)
|
ifneq ($(strip $(ISP_LOW_FUSE)),)
|
||||||
AVRDUDE_ISP_FUSES_PRE += -U lfuse:w:$(ISP_LOW_FUSE):m
|
AVRDUDE_ISP_FUSES_PRE += -U lfuse:w:$(ISP_LOW_FUSE):m
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
ifneq ($(strip $(ISP_EXT_FUSE)),)
|
# Bootloader file settings
|
||||||
AVRDUDE_ISP_FUSES_PRE += -U efuse:w:$(ISP_EXT_FUSE):m
|
# TODO: Handle relative bootloader file path as well
|
||||||
|
ifndef AVRDUDE_ISP_BURN_BOOTLOADER
|
||||||
|
ifneq ($(strip $(BOOTLOADER_PATH)),)
|
||||||
|
ifneq ($(strip $(BOOTLOADER_FILE)),)
|
||||||
|
AVRDUDE_ISP_BURN_BOOTLOADER += -U flash:w:$(BOOTLOADER_PATH)/$(BOOTLOADER_FILE):i
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Post fuse settings
|
# Post fuse settings
|
||||||
|
@ -1102,12 +1121,17 @@ reset_stty:
|
||||||
$$STTYF $(call get_monitor_port) -hupcl
|
$$STTYF $(call get_monitor_port) -hupcl
|
||||||
|
|
||||||
ispload: $(TARGET_EEP) $(TARGET_HEX) verify_size
|
ispload: $(TARGET_EEP) $(TARGET_HEX) verify_size
|
||||||
ifdef AVRDUDE_ISP_FUSES_PRE
|
|
||||||
$(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ISP_OPTS) -e $(AVRDUDE_ISP_FUSES_PRE)
|
|
||||||
endif
|
|
||||||
$(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ISP_OPTS) \
|
$(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ISP_OPTS) \
|
||||||
$(AVRDUDE_ISPLOAD_OPTS)
|
$(AVRDUDE_ISPLOAD_OPTS)
|
||||||
ifdef AVRDUDE_ISP_FUSES_POST
|
|
||||||
|
burn_bootloader:
|
||||||
|
ifneq ($(strip $(AVRDUDE_ISP_FUSES_PRE)),)
|
||||||
|
$(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ISP_OPTS) -e $(AVRDUDE_ISP_FUSES_PRE)
|
||||||
|
endif
|
||||||
|
ifneq ($(strip $(AVRDUDE_ISP_BURN_BOOTLOADER)),)
|
||||||
|
$(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ISP_OPTS) $(AVRDUDE_ISP_BURN_BOOTLOADER)
|
||||||
|
endif
|
||||||
|
ifneq ($(strip $(AVRDUDE_ISP_FUSES_POST)),)
|
||||||
$(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ISP_OPTS) $(AVRDUDE_ISP_FUSES_POST)
|
$(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ISP_OPTS) $(AVRDUDE_ISP_FUSES_POST)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -1146,30 +1170,31 @@ generated_assembly: generate_assembly
|
||||||
|
|
||||||
help:
|
help:
|
||||||
@$(ECHO) "\nAvailable targets:\n\
|
@$(ECHO) "\nAvailable targets:\n\
|
||||||
make - no upload\n\
|
make - no upload\n\
|
||||||
make upload - upload\n\
|
make upload - upload\n\
|
||||||
make clean - remove all our dependencies\n\
|
make clean - remove all our dependencies\n\
|
||||||
make depends - update dependencies\n\
|
make depends - update dependencies\n\
|
||||||
make reset - reset the Arduino by tickling DTR on the serial port\n\
|
make reset - reset the Arduino by tickling DTR on the serial port\n\
|
||||||
make raw_upload - upload without first resetting\n\
|
make raw_upload - upload without first resetting\n\
|
||||||
make show_boards - list all the boards defined in boards.txt\n\
|
make show_boards - list all the boards defined in boards.txt\n\
|
||||||
make monitor - connect to the Arduino's serial port\n\
|
make monitor - connect to the Arduino's serial port\n\
|
||||||
make size - show the size of the compiled output (relative to\n\
|
make size - show the size of the compiled output (relative to\n\
|
||||||
resources, if you have a patched avr-size)\n\
|
resources, if you have a patched avr-size)\n\
|
||||||
make disasm - generate a .lss file in build-cli that contains\n\
|
make disasm - generate a .lss file in build-cli that contains\n\
|
||||||
disassembly of the compiled file interspersed\n\
|
disassembly of the compiled file interspersed\n\
|
||||||
with your original source code.\n\
|
with your original source code.\n\
|
||||||
make verify_size - Verify that the size of the final file is less than\n\
|
make verify_size - Verify that the size of the final file is less than\n\
|
||||||
the capacity of the micro controller.\n\
|
the capacity of the micro controller.\n\
|
||||||
make eeprom - upload the eep file\n\
|
make eeprom - upload the eep file\n\
|
||||||
make raw_eeprom - upload the eep file without first resetting\n\
|
make raw_eeprom - upload the eep file without first resetting\n\
|
||||||
make help - show this help\n\
|
make burn_bootloader - Burn bootloader and/or fuses\n\
|
||||||
|
make help - show this help\n\
|
||||||
"
|
"
|
||||||
@$(ECHO) "Please refer to $(ARDMK_DIR)/arduino-mk/Arduino.mk for more details."
|
@$(ECHO) "Please refer to $(ARDMK_DIR)/arduino-mk/Arduino.mk for more details."
|
||||||
|
|
||||||
.PHONY: all upload raw_upload raw_eeprom error_on_caterina reset reset_stty ispload \
|
.PHONY: all upload raw_upload raw_eeprom error_on_caterina reset reset_stty ispload \
|
||||||
clean depends size show_boards monitor disasm symbol_sizes generated_assembly \
|
clean depends size show_boards monitor disasm symbol_sizes generated_assembly \
|
||||||
generate_assembly verify_size help
|
generate_assembly verify_size burn_bootloader help
|
||||||
|
|
||||||
# added - in the beginning, so that we don't get an error if the file is not present
|
# added - in the beginning, so that we don't get an error if the file is not present
|
||||||
-include $(DEPS)
|
-include $(DEPS)
|
||||||
|
|
Loading…
Reference in a new issue