2015-06-04 07:51:24 +02:00
|
|
|
FW_FILE_1:=0x00000.bin
|
|
|
|
FW_FILE_2:=0x40000.bin
|
|
|
|
TARGET_OUT:=image.elf
|
2015-08-16 06:54:18 +02:00
|
|
|
all : $(TARGET_OUT) $(FW_FILE_1) $(FW_FILE_2)
|
2015-07-27 09:34:00 +02:00
|
|
|
|
2015-06-04 07:51:24 +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 \
|
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
|
|
|
|
2015-07-27 09:34:00 +02:00
|
|
|
GCC_FOLDER:=~/esp8266/esp-open-sdk/xtensa-lx106-elf
|
2015-06-04 07:51:24 +02:00
|
|
|
ESPTOOL_PY:=~/esp8266/esptool/esptool.py
|
|
|
|
FW_TOOL:=~/esp8266/other/esptool/esptool
|
2015-08-16 06:54:18 +02:00
|
|
|
SDK:=/home/cnlohr/esp8266/esp_iot_sdk_v1.3.0
|
2015-06-04 07:51:24 +02:00
|
|
|
PORT:=/dev/ttyUSB0
|
|
|
|
#PORT:=/dev/ttyACM0
|
|
|
|
|
|
|
|
XTLIB:=$(SDK)/lib
|
2015-07-27 09:34:00 +02:00
|
|
|
XTGCCLIB:=$(GCC_FOLDER)/lib/gcc/xtensa-lx106-elf/4.8.2/libgcc.a
|
|
|
|
FOLDERPREFIX:=$(GCC_FOLDER)/bin
|
2015-06-04 07:51:24 +02:00
|
|
|
PREFIX:=$(FOLDERPREFIX)/xtensa-lx106-elf-
|
|
|
|
CC:=$(PREFIX)gcc
|
|
|
|
|
2015-07-29 07:54:49 +02:00
|
|
|
CFLAGS:=-mlongcalls -I$(SDK)/include -Imyclib -Iinclude -Iuser -Os -I$(SDK)/include/ -I../embeddedcommon -I. -Icommon -DICACHE_FLASH
|
|
|
|
|
2015-07-27 09:34:00 +02:00
|
|
|
#-DFREQ==12500 seems to work well.
|
2015-06-04 07:51:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
LDFLAGS_CORE:=\
|
|
|
|
-nostdlib \
|
|
|
|
-L$(XTLIB) \
|
|
|
|
-L$(XTGCCLIB) \
|
2015-07-29 07:54:49 +02:00
|
|
|
$(SDK)/lib/libmain.a \
|
2015-06-04 07:51:24 +02:00
|
|
|
$(SDK)/lib/liblwip.a \
|
|
|
|
$(SDK)/lib/libssl.a \
|
|
|
|
$(SDK)/lib/libupgrade.a \
|
|
|
|
$(SDK)/lib/libnet80211.a \
|
|
|
|
$(SDK)/lib/libwpa.a \
|
|
|
|
$(SDK)/lib/libnet80211.a \
|
|
|
|
$(SDK)/lib/libphy.a \
|
2015-07-29 07:54:49 +02:00
|
|
|
$(SDK)/lib/liblwip.a \
|
2015-06-04 07:51:24 +02:00
|
|
|
$(SDK)/lib/libpp.a \
|
2015-07-29 07:54:49 +02:00
|
|
|
$(SDK)/lib/libmain.a \
|
2015-06-04 07:51:24 +02:00
|
|
|
$(XTGCCLIB) \
|
2015-07-29 07:54:49 +02:00
|
|
|
-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
|
|
|
|
|
|
|
LINKFLAGS:= \
|
|
|
|
$(LDFLAGS_CORE) \
|
|
|
|
-B$(XTLIB)
|
|
|
|
|
|
|
|
#image.elf : $(OBJS)
|
|
|
|
# $(PREFIX)ld $^ $(LDFLAGS) -o $@
|
|
|
|
|
|
|
|
$(TARGET_OUT) : $(SRCS)
|
2015-07-29 07:54:49 +02:00
|
|
|
$(PREFIX)gcc $(CFLAGS) $^ $(LINKFLAGS) -o $@
|
2015-06-04 07:51:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$(FW_FILE_1): $(TARGET_OUT)
|
|
|
|
@echo "FW $@"
|
|
|
|
$(FW_TOOL) -eo $(TARGET_OUT) -bo $@ -bs .text -bs .data -bs .rodata -bc -ec
|
|
|
|
|
|
|
|
$(FW_FILE_2): $(TARGET_OUT)
|
|
|
|
@echo "FW $@"
|
|
|
|
$(FW_TOOL) -eo $(TARGET_OUT) -es .irom0.text $@ -ec
|
|
|
|
|
2015-07-29 07:54:49 +02:00
|
|
|
|
|
|
|
IP?=192.168.4.1
|
|
|
|
|
2015-06-04 07:51:24 +02:00
|
|
|
burn : $(FW_FILE_1) $(FW_FILE_2)
|
|
|
|
($(ESPTOOL_PY) --port $(PORT) write_flash 0x00000 0x00000.bin 0x40000 0x40000.bin)||(true)
|
|
|
|
|
|
|
|
|
2015-07-29 07:54:49 +02:00
|
|
|
|
|
|
|
netburn : image.elf $(FW_FILE_1) $(FW_FILE_2)
|
|
|
|
web/execute_reflash $(IP) 0x00000.bin 0x40000.bin
|
|
|
|
|
2015-06-04 07:51:24 +02:00
|
|
|
clean :
|
|
|
|
rm -rf user/*.o driver/*.o $(TARGET_OUT) $(FW_FILE_1) $(FW_FILE_2)
|
|
|
|
|
|
|
|
|