You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
72 lines
2.7 KiB
72 lines
2.7 KiB
#
|
|
# LUFA Library
|
|
# Copyright (C) Dean Camera, 2012.
|
|
#
|
|
# dean [at] fourwalledcubicle [dot] com
|
|
# www.lufa-lib.org
|
|
#
|
|
|
|
LUFA_BUILD_MODULES += AVRDUDE
|
|
LUFA_BUILD_TARGETS += program program-ee
|
|
LUFA_BUILD_MANDATORY_VARS += MCU TARGET
|
|
LUFA_BUILD_OPTIONAL_VARS += AVRDUDE_PROGRAMMER AVRDUDE_PORT AVRDUDE_FLAGS
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# LUFA AVRDUDE Programmer Buildsystem Makefile Module.
|
|
# -----------------------------------------------------------------------------
|
|
# DESCRIPTION:
|
|
# Provides a set of targets to re-program a device using the open source
|
|
# avr-dude utility.
|
|
# -----------------------------------------------------------------------------
|
|
# TARGETS:
|
|
#
|
|
# program - Program target FLASH with application using
|
|
# avrdude
|
|
# program-ee - Program target EEPROM with application data
|
|
# using avrdude
|
|
#
|
|
# MANDATORY PARAMETERS:
|
|
#
|
|
# MCU - Microcontroller device model name
|
|
# TARGET - Application name
|
|
#
|
|
# OPTIONAL PARAMETERS:
|
|
#
|
|
# AVRDUDE_PROGRAMMER - Name of programming hardware to use
|
|
# AVRDUDE_PORT - Name of communication port to use
|
|
# AVRDUDE_FLAGS - Flags to pass to avr-dude
|
|
#
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# Sanity-check values of mandatory user-supplied variables
|
|
MCU ?= $(error Makefile MCU value not set)
|
|
TARGET ?= $(error Makefile TARGET value not set)
|
|
|
|
ifeq ($(MCU),)
|
|
$(error Makefile MCU option cannot be blank)
|
|
endif
|
|
ifeq ($(TARGET),)
|
|
$(error Makefile TARGET option cannot be blank)
|
|
endif
|
|
|
|
# Default values of optionally user-supplied variables
|
|
AVRDUDE_PROGRAMMER ?= jtagicemkii
|
|
AVRDUDE_PORT ?= usb
|
|
AVRDUDE_FLAGS ?=
|
|
|
|
# Output Messages
|
|
MSG_AVRDUDE_CMD := ' [AVRDUDE] :'
|
|
|
|
AVRDUDE_FLASH_FLAGS = -U flash:w:$< $(AVRDUDE_FLAGS)
|
|
AVRDUDE_EEP_FLAGS = -U eeprom:w:$< $(AVRDUDE_FLAGS)
|
|
|
|
program: $(TARGET).hex $(MAKEFILE_LIST)
|
|
@echo $(MSG_AVRDUDE_CMD) Programming device \"$(MCU)\" with settings \"$(AVRDUDE_FLASH_FLAGS)\" using \"$(AVRDUDE_PROGRAMMER)\" on port \"$(AVRDUDE_PORT)\"
|
|
avrdude -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) $(AVRDUDE_FLASH_FLAGS)
|
|
|
|
program-ee: $(TARGET).eep $(MAKEFILE_LIST)
|
|
@echo $(MSG_AVRDUDE_CMD) Programming device \"$(MCU)\" with settings \"$(AVRDUDE_EEP_FLAGS)\" using \"$(AVRDUDE_PROGRAMMER)\" on port \"$(AVRDUDE_PORT)\"
|
|
avrdude -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) $(AVRDUDE_EEP_FLAGS)
|
|
|
|
# Phony build targets for this module
|
|
.PHONY: program program-ee |