USB controlled relay
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.
usb-relay/Makefile

60 lines
1.7 KiB

# https://github.com/jkent/caterina-promicro
VID = 0xbeef
PID = 0x0001
2 years ago
LUFA_PATH = src/lufa-LUFA-210130/LUFA
LD_FLAGS = -Wl,--gc-sections -Wl,--relax
MCU = atmega32u4
F_CPU = 16000000
ARCH = AVR8
TARGET = App
SRC = src/main.c src/Descriptors.c $(LUFA_SRC_USB) $(LUFA_SRC_USBCLASS)
F_USB = $(F_CPU)
OPTIMIZATION = s
BOARD = USER
2 years ago
CDEFS = -DDEVICE_VID=$(VID)UL
CDEFS += -DDEVICE_PID=$(PID)UL
CC_FLAGS = -Isrc -DUSE_LUFA_CONFIG_HEADER -IConfig/ $(CDEFS) -I$(LUFA_PATH)/
CC_FLAGS += -std=gnu99 -mmcu=$(MCU) -DF_CPU=$(F_CPU)UL $(CDEFS)
CC_FLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
CC_FLAGS += -Wall -Wno-main -Wno-strict-prototypes -Wno-comment
CC_FLAGS += -g2 -Wextra -Wfatal-errors -Wno-unused-but-set-variable
CC_FLAGS += -ffunction-sections -fdata-sections -Os $(LUFA_OPTS)
include $(LUFA_PATH)/Build/lufa_core.mk
include $(LUFA_PATH)/Build/lufa_sources.mk
include $(LUFA_PATH)/Build/lufa_build.mk
#include $(LUFA_PATH)/Build/lufa_cppcheck.mk
#include $(LUFA_PATH)/Build/lufa_doxygen.mk
#include $(LUFA_PATH)/Build/lufa_dfu.mk
#include $(LUFA_PATH)/Build/lufa_hid.mk
#include $(LUFA_PATH)/Build/lufa_avrdude.mk
#include $(LUFA_PATH)/Build/lufa_atprogram.mk
PROGRAMMER_TYPE = avr109
PROGRAMMER_ARGS = -P /dev/ttyACM0
AVRDUDE = avrdude
.PHONY: eeprom flash flashe shell
eeprom: $(TARGET).eeprom
%.eeprom: %.elf
$(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O ihex $< $@
flash: $(TARGET).hex
2 years ago
#stty -F /dev/ttyACM0 speed 1200
#stty -F /dev/ttyACM0 speed 115200
$(AVRDUDE) -c $(PROGRAMMER_TYPE) -p $(MCU) $(PROGRAMMER_ARGS) -U flash:w:$<
flashe: $(TARGET).eeprom
$(AVRDUDE) -c $(PROGRAMMER_TYPE) -p $(MCU) $(PROGRAMMER_ARGS) -U eeprom:w:$<
shell:
$(AVRDUDE) -c $(PROGRAMMER_TYPE) -p $(MCU) $(PROGRAMMER_ARGS) -nt