2016-08-04 15:50:13 +02:00
|
|
|
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)))
|
|
|
|
|
2016-08-03 20:29:44 +02:00
|
|
|
FW_FILE1 = image.elf-0x00000.bin
|
|
|
|
FW_FILE2 = image.elf-0x40000.bin
|
2016-08-03 16:27:10 +02:00
|
|
|
TARGET = image.elf
|
|
|
|
|
|
|
|
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 \
|
2015-08-03 07:19:11 +02:00
|
|
|
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
|
2015-06-04 07:51:24 +02:00
|
|
|
|
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)
|
2015-06-04 07:51:24 +02:00
|
|
|
|
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
|
2015-06-04 07:51:24 +02:00
|
|
|
|
2016-08-03 16:27:10 +02:00
|
|
|
LINKFLAGS = $(LDFLAGS_CORE) -B$(XTLIB)
|
2015-06-04 07:51:24 +02:00
|
|
|
|
2016-08-03 16:27:10 +02:00
|
|
|
##########################################################################RULES
|
2015-06-04 07:51:24 +02:00
|
|
|
|
2016-08-03 20:29:44 +02:00
|
|
|
all : $(FW_FILE1) $(FW_FILE2)
|
2015-06-04 07:51:24 +02:00
|
|
|
|
2016-08-03 20:29:44 +02:00
|
|
|
$(FW_FILE1) $(FW_FILE2) : $(TARGET)
|
2015-06-04 07:51:24 +02:00
|
|
|
@echo "FW $@"
|
2016-08-04 18:06:01 +02:00
|
|
|
export PATH="$(FOLDERPREFIX):$$PATH"; $(ESPTOOL_PY) elf2image $(TARGET)
|
2016-07-04 22:59:34 +02:00
|
|
|
|
2016-08-03 16:27:10 +02:00
|
|
|
$(TARGET) : $(SRCS)
|
|
|
|
$(CC) $(CFLAGS) $^ $(LINKFLAGS) -o $@
|
2015-06-04 07:51:24 +02:00
|
|
|
|
2016-08-03 16:27:10 +02:00
|
|
|
ifeq ($(CHIP), 8285)
|
2016-08-04 15:50:13 +02:00
|
|
|
burn : $(FW_FILE1) $(FW_FILE2)
|
2016-08-03 16:27:10 +02:00
|
|
|
($(ESPTOOL_PY) --port $(PORT) write_flash -fs 8m -fm dout 0x00000 0x00000.bin 0x40000 0x40000.bin)||(true)
|
|
|
|
else ifeq ($(CHIP), 8266)
|
2016-08-04 15:50:13 +02:00
|
|
|
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
|
2015-06-04 07:51:24 +02:00
|
|
|
|
2016-08-04 15:50:13 +02:00
|
|
|
burnweb :
|
|
|
|
@cd web && $(MAKE) $(MFLAGS) $(MAKEOVERRIDES) page.mpfs
|
2015-08-28 08:36:36 +02:00
|
|
|
($(ESPTOOL_PY) --port $(PORT) write_flash 0x10000 web/page.mpfs)||(true)
|
2016-08-04 15:50:13 +02:00
|
|
|
#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.
|
2015-08-28 08:36:36 +02:00
|
|
|
|
2016-08-04 15:50:13 +02:00
|
|
|
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
|
|
|
|
2015-06-04 07:51:24 +02:00
|
|
|
clean :
|
2016-08-03 16:27:10 +02:00
|
|
|
$(RM) $(patsubst %.c,%.o,$(SRCS)) $(TARGET)
|
2015-06-04 07:51:24 +02:00
|
|
|
|
2016-08-03 16:27:10 +02:00
|
|
|
purge : clean
|
2016-08-04 15:50:13 +02:00
|
|
|
@cd web && $(MAKE) $(MFLAGS) $(MAKEOVERRIDES) clean
|
|
|
|
$(RM) $(FW_FILE1) $(FW_FILE2)
|
|
|
|
|