diff --git a/Makefile b/Makefile index 171d666e..b192f5e6 100644 --- a/Makefile +++ b/Makefile @@ -29,6 +29,7 @@ ifeq ($(OS),Windows_NT) CPP = xtensa-lx106-elf-cpp OBJCOPY = xtensa-lx106-elf-objcopy endif + FIRMWAREDIR = ..\\bin\\ ifeq ($(PROCESSOR_ARCHITECTURE),AMD64) # ->AMD64 endif @@ -44,7 +45,7 @@ else NM = xtensa-lx106-elf-nm CPP = xtensa-lx106-elf-cpp OBJCOPY = xtensa-lx106-elf-objcopy - + FIRMWAREDIR = ../bin/ UNAME_S := $(shell uname -s) ifeq ($(UNAME_S),Linux) # LINUX @@ -136,7 +137,7 @@ endef $(BINODIR)/%.bin: $(IMAGEODIR)/%.out @mkdir -p $(BINODIR) - ../tools/esptool.py elf2image $< -o $(BINODIR)/ + ../tools/esptool.py elf2image $< -o $(FIRMWAREDIR) ############################################################# # Rules base diff --git a/app/.cproject b/app/.cproject index 4ca60d06..84b67d71 100644 --- a/app/.cproject +++ b/app/.cproject @@ -72,27 +72,26 @@ - ${PWD}/gen_misc.bat + make all true - false + true true make - clean true true true - ${PWD}/flash.bat + make - + flash true - false + true true diff --git a/app/Makefile b/app/Makefile index e498fada..ad9a71c2 100644 --- a/app/Makefile +++ b/app/Makefile @@ -157,12 +157,18 @@ sinclude $(PDIR)Makefile # generate bin file # +ifeq ($(OS),Windows_NT) + PORT = com1 +else + PORT = /dev/ttyUSB0 +endif + $(BINODIR)/%.bin: $(IMAGEODIR)/%.out @mkdir -p $(BINODIR) - ../tools/esptool.py elf2image $< -o $(BINODIR)/ + ../tools/esptool.py elf2image $< -o $(FIRMWAREDIR) flash: - ../tools/esptool.py write_flash 0x00000 $(BINODIR)/0x00000.bin 0x10000 $(BINODIR)/0x10000.bin + ../tools/esptool.py -p $(PORT) write_flash 0x00000 ../bin/0x00000.bin 0x10000 ../bin/0x10000.bin .PHONY: FORCE FORCE: diff --git a/tools/esptool.py b/tools/esptool.py index 035c24bb..130e80f0 100755 --- a/tools/esptool.py +++ b/tools/esptool.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2.7 +#!/usr/bin/env python # # ESP8266 ROM Bootloader Utility # https://github.com/themadinventor/esptool @@ -270,9 +270,12 @@ class ELFFile: return self.symbols = {} try: - proc = subprocess.Popen(["xtensa-lx106-elf-nm", self.name], stdout=subprocess.PIPE) + tool_nm = "xtensa-lx106-elf-nm" + if os.getenv('XTENSA_CORE')=='lx106': + tool_nm = "xt-nm" + proc = subprocess.Popen([tool_nm, self.name], stdout=subprocess.PIPE) except OSError: - print "Error calling xtensa-lx106-elf-nm, do you have Xtensa toolchain in PATH?" + print "Error calling "+tool_nm+", do you have Xtensa toolchain in PATH?" sys.exit(1) for l in proc.stdout: fields = l.strip().split() @@ -283,7 +286,10 @@ class ELFFile: return self.symbols[sym] def load_section(self, section): - subprocess.check_call(["xtensa-lx106-elf-objcopy", "--only-section", section, "-Obinary", self.name, ".tmp.section"]) + tool_objcopy = "xtensa-lx106-elf-objcopy" + if os.getenv('XTENSA_CORE')=='lx106': + tool_objcopy = "xt-objcopy" + subprocess.check_call([tool_objcopy, "--only-section", section, "-Obinary", self.name, ".tmp.section"]) f = open(".tmp.section", "rb") data = f.read() f.close()