colorchord/embedded8266/Makefile

80 lines
2.4 KiB
Makefile
Raw Normal View History

include makeconf.inc # Look here for user configuration
2016-08-03 16:27:10 +02:00
.PHONY : all clean cleanall netburn burnweb burn
uniq = $(if $1,$(firstword $1) $(call uniq,$(filter-out $(firstword $1),$1)))
TARGET = image.elf
FW_FILE1 = $(TARGET)-0x00000.bin
FW_FILE2 = $(TARGET)-0x40000.bin
2016-08-03 16:27:10 +02:00
SRCS = \
driver/uart.c \
2015-07-29 07:54:49 +02:00
common/mystuff.c \
common/flash_rewriter.c \
common/http.c \
common/http_custom.c \
common/mfs.c \
2015-07-27 09:34:00 +02:00
user/ws2812_i2s.c \
user/hpatimer.c \
user/custom_commands.c \
2015-07-27 09:34:00 +02:00
driver/adc.c \
../embeddedcommon/DFT32.c \
../embeddedcommon/embeddednf.c \
../embeddedcommon/embeddedout.c \
2015-07-29 07:54:49 +02:00
user/user_main.c \
common/commonservices.c
2016-08-03 16:27:10 +02:00
LIBS = main lwip ssl upgrade net80211 wpa net80211 phy lwip pp crypto
INCL = $(SDK)/include myclib include .
2015-07-29 07:54:49 +02:00
2016-08-03 16:27:10 +02:00
CFLAGS = -mlongcalls -Os $(addprefix -I,$(INCL) $(call uniq, $(patsubst %/,%,$(dir $(SRCS))))) $(OPTS)
2016-08-03 16:27:10 +02:00
LDFLAGS_CORE = -nostdlib -L$(XTLIB) -L$(XTGCCLIB) \
$(addprefix $(SDK)/lib/lib,$(addsuffix .a,$(LIBS))) \
$(XTGCCLIB) -T $(SDK)/ld/eagle.app.v6.ld -Wl,-Map,output.map
# -flto -Wl,--relax -Wl,--gc-sections
2016-08-03 16:27:10 +02:00
LINKFLAGS = $(LDFLAGS_CORE) -B$(XTLIB)
2016-08-03 16:27:10 +02:00
##########################################################################RULES
2016-08-03 20:29:44 +02:00
all : $(FW_FILE1) $(FW_FILE2)
2016-08-03 20:29:44 +02:00
$(FW_FILE1) $(FW_FILE2) : $(TARGET)
@echo "FW $@"
2016-08-04 18:06:01 +02:00
export PATH="$(FOLDERPREFIX):$$PATH"; $(ESPTOOL_PY) elf2image $(TARGET)
2016-08-03 16:27:10 +02:00
$(TARGET) : $(SRCS)
$(CC) $(CFLAGS) $^ $(LINKFLAGS) -o $@
2016-08-03 16:27:10 +02:00
ifeq ($(CHIP), 8285)
burn : $(FW_FILE1) $(FW_FILE2)
($(ESPTOOL_PY) --port $(PORT) write_flash -fs 8m -fm dout 0x00000 $(FW_FILE1) 0x40000 $(FW_FILE2))||(true)
2016-08-03 16:27:10 +02:00
else ifeq ($(CHIP), 8266)
burn : $(FW_FILE1) $(FW_FILE2)
2016-08-03 20:29:44 +02:00
($(ESPTOOL_PY) --port $(PORT) write_flash 0x00000 $(FW_FILE1) 0x40000 $(FW_FILE2))||(true)
2016-08-03 16:27:10 +02:00
else
$(error Error: Unknown chip '$(CHIP)')
endif
burnweb :
@cd web && $(MAKE) $(MFLAGS) $(MAKEOVERRIDES) page.mpfs
($(ESPTOOL_PY) --port $(PORT) write_flash 0x10000 web/page.mpfs)||(true)
#If you have space, MFS should live at 0x100000. It can also live at
#0x10000. But, then it is limited to 180kB. You might need to do this if
# you have a 512kB ESP variant.
netburn : $(FW_FILE1) $(FW_FILE2)
@cd web && $(MAKE) $(MFLAGS) $(MAKEOVERRIDES) execute_reflash
2016-08-03 20:29:44 +02:00
web/execute_reflash $(IP) $(FW_FILE1) $(FW_FILE2)
2015-07-29 07:54:49 +02:00
netweb :
@cd web && $(MAKE) $(MFLAGS) $(MAKEOVERRIDES) push
clean :
2016-08-03 16:27:10 +02:00
$(RM) $(patsubst %.c,%.o,$(SRCS)) $(TARGET)
2016-08-03 16:27:10 +02:00
purge : clean
@cd web && $(MAKE) $(MFLAGS) $(MAKEOVERRIDES) clean
$(RM) $(FW_FILE1) $(FW_FILE2)