|
|
@ -5,11 +5,13 @@ REVISION ?= v0.2.1 |
|
|
|
TARGETS = A B C D E F G H I J K L M N O P Q R S T U V W |
|
|
|
MCUS = H L |
|
|
|
FETON_DELAYS = 0 5 10 15 20 25 30 40 50 70 90 |
|
|
|
PWM_FREQUENCIES = 24 48 |
|
|
|
|
|
|
|
# example single target
|
|
|
|
TARGET ?= F |
|
|
|
MCU ?= H |
|
|
|
FETON_DELAY ?= 40 |
|
|
|
PWM_FREQUENCY ?= 24 |
|
|
|
|
|
|
|
WINE_BIN ?= /usr/local/bin/wine |
|
|
|
|
|
|
@ -49,13 +51,14 @@ DUMMYVAR := $(foreach exec, $(EXECUTABLES), \ |
|
|
|
OBJS = |
|
|
|
|
|
|
|
define MAKE_OBJ |
|
|
|
OBJS += $(1)_$(2)_$(3)_$(REVISION).OBJ |
|
|
|
$(OUTPUT_DIR)/$(1)_$(2)_$(3)_$(REVISION).OBJ : $(ASM_SRC) $(ASM_INC) |
|
|
|
OBJS += $(1)_$(2)_$(3)_$(4)_$(REVISION).OBJ |
|
|
|
$(OUTPUT_DIR)/$(1)_$(2)_$(3)_$(4)_$(REVISION).OBJ : $(ASM_SRC) $(ASM_INC) |
|
|
|
$(eval _ESC := $(1)) |
|
|
|
$(eval _ESC_INT := $(shell printf "%d" "'${_ESC}")) |
|
|
|
$(eval _ESCNO := $(shell echo $$(( $(_ESC_INT) - 65 + 1)))) |
|
|
|
$(eval _MCU_48MHZ := $(subst L,0,$(subst H,1,$(2)))) |
|
|
|
$(eval _FETON_DELAY := $(3)) |
|
|
|
$(eval _PWM_48KHZ := $(subst 24,0,$(subst 48,1,$(4)))) |
|
|
|
$(eval _LOG := $(LOG_DIR)/$(1)_$(2)_$(3)_$(REVISION).log) |
|
|
|
@mkdir -p $(OUTPUT_DIR) |
|
|
|
@mkdir -p $(LOG_DIR) |
|
|
@ -64,6 +67,7 @@ $(OUTPUT_DIR)/$(1)_$(2)_$(3)_$(REVISION).OBJ : $(ASM_SRC) $(ASM_INC) |
|
|
|
"DEFINE(ESCNO=$(_ESCNO)) " \
|
|
|
|
"DEFINE(MCU_48MHZ=$(_MCU_48MHZ)) "\
|
|
|
|
"DEFINE(FETON_DELAY=$(_FETON_DELAY)) "\
|
|
|
|
"DEFINE(PWM_48KHZ=$(_PWM_48KHZ)) "\
|
|
|
|
"OBJECT($$@) "\
|
|
|
|
"$(AX51_FLAGS)" > $(_LOG) 2>&1; test $$$$? -lt 2 || (mv ./Bluejay.LST $(OUTPUT_DIR)/; tail $(_LOG); exit 1) |
|
|
|
@mv ./Bluejay.LST $(OUTPUT_DIR)/ |
|
|
@ -76,7 +80,7 @@ EFM8_LOAD_BIN ?= efm8load.py |
|
|
|
EFM8_LOAD_PORT ?= /dev/ttyUSB0 |
|
|
|
EFM8_LOAD_BAUD ?= 57600 |
|
|
|
|
|
|
|
SINGLE_TARGET_HEX = $(OUTPUT_DIR_HEX)/$(TARGET)_$(MCU)_$(FETON_DELAY)_$(REVISION).hex |
|
|
|
SINGLE_TARGET_HEX = $(OUTPUT_DIR_HEX)/$(TARGET)_$(MCU)_$(FETON_DELAY)_$(PWM_FREQUENCY)_$(REVISION).hex |
|
|
|
|
|
|
|
single_target : $(SINGLE_TARGET_HEX) |
|
|
|
|
|
|
@ -84,10 +88,11 @@ all : $$(HEX_TARGETS) |
|
|
|
@echo "\nbuild finished. built $(shell ls -l $(OUTPUT_DIR_HEX) | wc -l) hex targets\n" |
|
|
|
|
|
|
|
# create all obj targets using macro expansion
|
|
|
|
$(foreach _e,$(TARGETS), \ |
|
|
|
$(foreach _t,$(TARGETS), \ |
|
|
|
$(foreach _m, $(MCUS), \
|
|
|
|
$(foreach _f, $(FETON_DELAYS), \
|
|
|
|
$(eval $(call MAKE_OBJ,$(_e),$(_m),$(_f)))))) |
|
|
|
$(foreach _p, $(PWM_FREQUENCIES), \
|
|
|
|
$(eval $(call MAKE_OBJ,$(_t),$(_m),$(_f),$(_p))))))) |
|
|
|
|
|
|
|
|
|
|
|
$(OUTPUT_DIR)/%.OMF : $(OUTPUT_DIR)/%.OBJ |
|
|
|