From 21db68e71b1bf64d274c3bff1c7d8d2e2fde8561 Mon Sep 17 00:00:00 2001 From: CNLohr Date: Thu, 25 Aug 2016 02:49:50 -0400 Subject: [PATCH] Revert "Support for Docker and OSX for esp-open-sdk toolchain" --- README.md | 26 +------------ common.mf | 7 ---- main.mf | 87 +++++++++++++------------------------------ user.cfg.example | 9 +---- web/Makefile | 16 ++++---- web/compat.h | 4 -- web/execute_reflash.c | 5 ++- web/mfsmaker.c | 1 - web/pushtodev.c | 1 - 9 files changed, 41 insertions(+), 115 deletions(-) delete mode 100644 web/compat.h diff --git a/README.md b/README.md index 42001e8..39b0fa9 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,7 @@ It is excellent! - [esp82XX-basic](https://github.com/con-f-use/esp82XX-basic) - [Colorchord](https://github.com/cnlohr/colorchord) - - [esp8266ws8212i2c](https://github.com/cnlohr/esp8266ws8212i2s) + - [esp8266ws2812i2c](https://github.com/cnlohr/esp8266ws2812i2s) - [espusb](https://github.com/cnlohr/espusb) - Migration of others in progress @@ -177,29 +177,7 @@ To make a release, just tag a commit with `git tag -a 'v1.3.3.7' -m 'Your releas After that, the github web-interface will allow you to make a release out of the new tag and include the binary file. To make the zip file invoke `make projectname-version-binaries.tgz` (Tab-autocomplete is your friend). -## Docker support - -Docker support for esp82xx is experimental and makes the following assumptions: - - 1. You have a working and relatively recent (>1.12) Docker installation. - 2. You have a copy of esptool.py installed **in your base system** (`pip install esptool`) and accessible in your `$PATH`. - 3. **You ran `docker pull brainstorm/dockcross-esp-open-sdk` before the next lines.** - -To enable cross-compiling inside docker (disabled by default in esp82xx), it should be sufficient to enable -the following configuration directive in `user.cfg`: - -``` -#DOCKER=no -DOCKER=yes -``` - -Then run: - - 1. `docker pull brainstorm/dockcross-esp-open-sdk` - 2. `make burn`, `make netburn`, etc... the usual suspects. - ## ToDo - Include libraries for usb, ws2812s and ethernet as soon as they are stable - - Switch to a more convenient, flexible and optimized docker image: https://hub.docker.com/r/vowstar/esp8266/ - - Include libraries for usb, ws8212s and ethernet as soon as they are stable + diff --git a/common.mf b/common.mf index bfb54ef..6521c3e 100644 --- a/common.mf +++ b/common.mf @@ -24,13 +24,6 @@ CP = cp SDK_DEFAULT = $(HOME)/esp8266/esp-open-sdk OPTS += -DWEB_PORT=$(WEB_PORT) -DCOM_PORT=$(COM_PORT) -DBACKEND_PORT=$(BACKEND_PORT) $(EXTRAOPTS) ESP_ROOT := $(shell echo "$$ESP_ROOT") -ifeq ($(strip $(DOCKER)), yes) - ESP_ROOT := $(DOCKER_SDK_DEFAULT) -else ifeq ($(strip $(ESP_ROOT)),) - $(warning Warning: No shell variable 'ESP_ROOT', using '$(SDK_DEFAULT)') - ESP_ROOT := $(SDK_DEFAULT) - DOCKCROSS = -endif ifeq ($(strip $(ESP_ROOT)),) $(warning Warning: No shell variable 'ESP_ROOT', using '$(SDK_DEFAULT)') ESP_ROOT := $(SDK_DEFAULT) diff --git a/main.mf b/main.mf index 4f89405..d08a324 100644 --- a/main.mf +++ b/main.mf @@ -16,72 +16,45 @@ getips ... Get a list with IPs of esp82xxs connected to your network usbburn .. Burn via PRE-RELEASE USB loader (will probably change) usbweb ... Burn webpage by PRE-RELEASE USB loader (will probably change) -More commands: all, clean, purge -endef -define inside_docker -# Cross-compile toolchain in a docker image - ifeq ($(strip $(DOCKER)), yes) - INCL += $(DOCKER_PREFIX)/esp82xx/include $(DOCKER_PREFIX) - $(eval SRCS:=$(addprefix $(DOCKER_PREFIX), $(SRCS))) - $(eval FW_FILE1:=$(addprefix $(DOCKER_PREFIX), $(FW_FILE1))) - $(eval FW_FILE2:=$(addprefix $(DOCKER_PREFIX), $(FW_FILE2))) - $(eval TARGET:=$(addprefix $(DOCKER_PREFIX), $(TARGET))) - $(eval CC:=$(DOCKCROSS) $(CC)) - $(eval ESP_ROOT:=$(DOCKER_SDK_DEFAULT)) - $(eval ESPTOOL_PY:=$(DOCKCROSS) $(ESPTOOL_PY)) - else - DOCKCROSS= - DOCKER_PREFIX= - endif -endef - -define outside_docker -# Make sure the actual burning of the chip is done with the system-wide esptool.py -# since it's the only one that has working (privileged) /dev/*USB access. - ifeq ($(strip $(DOCKER)), yes) - $(warning Warning: Docker cannot flash via in-docker esptool.py (yet) due to USB issues, see: http://bit.ly/2b9qFY2) - $(eval ESPTOOL_PY:=$(shell which esptool.py)) - $(eval FW_FILE1:= image.elf-0x00000.bin) - $(eval FW_FILE2:= image.elf-0x40000.bin) - endif +More commands: all, clean, purge endef - .PHONY : all clean cleanall netburn burnweb burn $(BIN_TARGET) netweb getips help uniq = $(if $1,$(firstword $1) $(call uniq,$(filter-out $(firstword $1),$1))) -LIBS = main lwip ssl upgrade net80211 wpa phy lwip pp crypto -INCL = $(SDK)/include esp82xx/include . - FW_FILE1 = image.elf-0x00000.bin FW_FILE2 = image.elf-0x40000.bin TARGET = image.elf + SRCS = esp82xx/fwsrc/uart.c \ - esp82xx/fwsrc/esp82xxutil.c \ - esp82xx/fwsrc/flash_rewriter.c \ - esp82xx/fwsrc/http.c \ - esp82xx/fwsrc/commonservices.c \ - esp82xx/fwsrc/http_custom.c \ - esp82xx/fwsrc/mdns.c \ - esp82xx/fwsrc/mfs.c \ - user/custom_commands.c \ - user/user_main.c + esp82xx/fwsrc/esp82xxutil.c \ + esp82xx/fwsrc/flash_rewriter.c \ + esp82xx/fwsrc/http.c \ + esp82xx/fwsrc/commonservices.c \ + esp82xx/fwsrc/http_custom.c \ + esp82xx/fwsrc/mdns.c \ + esp82xx/fwsrc/mfs.c \ + user/custom_commands.c \ + user/user_main.c + +LIBS = main lwip ssl upgrade net80211 wpa phy lwip pp crypto +INCL = $(SDK)/include esp82xx/include . CFLAGS = -mlongcalls -Os $(addprefix -I,$(INCL) $(call uniq, $(patsubst %/,%,$(dir $(SRCS))))) $(OPTS) -DVERSSTR='$(VERSSTR)' LDFLAGS_CORE = -Wl,--relax -Wl,--gc-sections -nostdlib -L$(XTLIB) \ - -L$(XTGCCLIB) $(addprefix $(SDK)/lib/lib,$(addsuffix .a,$(LIBS))) \ - $(XTGCCLIB) -T $(SDK)/ld/eagle.app.v6.ld -# -flto -Wl,--relax -Wl,--gc-sections + -L$(XTGCCLIB) $(addprefix $(SDK)/lib/lib,$(addsuffix .a,$(LIBS))) \ + $(XTGCCLIB) -T $(SDK)/ld/eagle.app.v6.ld +# -flto -Wl,--relax -Wl,--gc-sections LINKFLAGS = $(LDFLAGS_CORE) -B$(XTLIB) BIN_TARGET = $(PROJECT_NAME)-$(VERSION)-binaries.zip ifneq (,$(findstring -DDEBUG,$(OPTS))) - $(warning Debug is enabled!) - FLASH_WRITE_FLAGS += --verify +$(warning Debug is enabled!) +FLASH_WRITE_FLAGS += --verify endif ##########################################################################RULES @@ -93,42 +66,34 @@ help : all : $(FW_FILE1) $(FW_FILE2) $(FW_FILE1) $(FW_FILE2) : $(TARGET) - $(ESPTOOL_PY) elf2image $(TARGET) + PATH=$(PATH):$(FOLDERPREFIX) $(ESPTOOL_PY) elf2image $(TARGET) $(TARGET) : $(SRCS) Makefile - $(eval $(call inside_docker)) - $(CC) $(CFLAGS) $(SRCS) -flto $(LINKFLAGS) -o $(TARGET) + $(CC) $(CFLAGS) $(SRCS) -flto $(LINKFLAGS) -o $@ debug : $(TARGET) nm -S -n $(TARGET) > image.map $(PREFIX)objdump -S $(TARGET) > image.lst $(PREFIX)size -A $(TARGET) | grep -v debug - - ifeq ($(CHIP), 8285) -burn : $(FW_FILE1) $(FW_FILE2) - $(eval $(call outside_docker)) - ($(ESPTOOL_PY) $(FWBURNFLAGS) --port $(PORT) write_flash $(FLASH_WRITE_FLAGS) 0x00000 $(FW_FILE1) 0x40000 $(FW_FILE2))||(true) +burn : $(FW_FILE1) $(FW_FILE2) + ($(ESPTOOL_PY) $(FWBURNFLAGS) --port $(PORT) write_flash $(FLASH_WRITE_FLAGS) -fs 8m -fm dout 0x00000 $(FW_FILE1) 0x40000 $(FW_FILE2))||(true) else ifeq ($(CHIP), 8266) burn : $(FW_FILE1) $(FW_FILE2) - $(eval $(call outside_docker)) ($(ESPTOOL_PY) $(FWBURNFLAGS) --port $(PORT) write_flash $(FLASH_WRITE_FLAGS) 0x00000 $(FW_FILE1) 0x40000 $(FW_FILE2))||(true) else $(error Error: Unknown chip '$(CHIP)') endif burnweb : - $(eval $(call outside_docker)) - @cd web && $(MAKE) $(MFLAGS) $(MAKEOVERRIDES) clean page.mpfs #Always rebuild page.mpfs - ($(ESPTOOL_PY) $(FWBURNFLAGS) --port $(PORT) write_flash $(PAGE_OFFSET) web/page.mpfs)||(true) - + @cd web && $(MAKE) $(MFLAGS) $(MAKEOVERRIDES) clean page.mpfs #Always rebuild page.mpfs + ($(ESPTOOL_PY) $(FWBURNFLAGS) --port $(PORT) write_flash $(PAGE_OFFSET) 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, or 1M ESP variant. netburn : $(FW_FILE1) $(FW_FILE2) - $(eval $(call outside_docker)) @cd web && $(MAKE) $(MFLAGS) $(MAKEOVERRIDES) execute_reflash web/execute_reflash $(IP) $(FW_FILE1) $(FW_FILE2) @@ -152,7 +117,7 @@ $(BIN_TARGET): $(FW_FILE1) $(FW_FILE2) getips: $(info Detecting possible IPs for ESP82XX modules...) - $(info Needs 'nmap' and takes some time especially if none are connected) + $(info Needs 'nmap' and takes some time especiallay if none are connected) sudo nmap -sP 192.168.0.0/24 | grep -iP "espressif|esp" -B2 | grep -oP "(\d{1,3}\.){3,3}\d\d{1,3}" clean : diff --git a/user.cfg.example b/user.cfg.example index 2330ece..6252301 100644 --- a/user.cfg.example +++ b/user.cfg.example @@ -4,8 +4,7 @@ CHIP = 8266 IP = 192.168.4.1 # does not actually set the IP in firmware -PORT = /dev/ttyUSB0 # could also be, i.e: /dev/ttyACM0 or /dev/cu.usbserial-xxxxxxxx -FWBURNFLAGS = # things like "--baud 940200" to be passed to esptool.py +PORT = /dev/ttyUSB0 # could also be /dev/ttyACM0 WEB_PORT = 80 COM_PORT = 7777 BACKEND_PORT = 7878 @@ -14,11 +13,6 @@ PAGE_OFFSET = 65536 # 1048576 SDK_DEFAULT = $(HOME)/esp8266/esp-open-sdk ESP_GCC_VERS = 4.8.5 -DOCKER = no -DOCKER_PREFIX = /work/ -DOCKER_SDK_DEFAULT = /home/espbuild/esp-open-sdk -DOCKCROSS = $(HOME)/bin/dockcross-xtensa - OPTS += -DICACHE_FLASH #OPTS += -DVERIFY_FLASH_WRITE #OPTS += -DDEBUG @@ -30,3 +24,4 @@ PAGE_TITLE = esp82xx-basic PAGE_SCRIPT = PAGE_HEADING = Welcome to the basic Web-GUI PAGE_INFO = This is the basic web interface for esp82xx-series chips + diff --git a/web/Makefile b/web/Makefile index 0b8e7a8..73c00af 100644 --- a/web/Makefile +++ b/web/Makefile @@ -18,14 +18,14 @@ page.mpfs : mfsmaker $(wildcard page/*) Makefile $(RM) -r tmp $(CP) -r page tmp $(info $(PROJECT_URL)) - sed -ie 's/{{PAGE_TITLE}}/$(subst /,\/,$(PAGE_TITLE))/' tmp/index.html - sed -ie 's/{{PAGE_SCRIPT}}/$(subst /,\/,$(PAGE_SCRIPT))/' tmp/index.html - sed -ie 's/{{PAGE_HEADING}}/$(subst /,\/,$(PAGE_HEADING))/' tmp/index.html - sed -ie 's/{{PAGE_INFO}}/$(subst /,\/,$(PAGE_INFO))/' tmp/index.html - sed -ie 's/{{VERSSTR}}/$(subst ",,$(VERSSTR))/' tmp/index.html - sed -ie 's/{{PROJECT_URL}}/$(subst ",,$(subst /,\/,$(PROJECT_URL)))/' tmp/index.html - sed -ie 's/{{PROJECT_NAME}}/$(subst ",,$(PROJECT_NAME))/' tmp/index.html - sed -ie 's/{{PAGE_JQUERYFL}}/$(subst page/,,$(wildcard page/jquery*gz))/' tmp/index.html + sed -i 's/{{PAGE_TITLE}}/$(subst /,\/,$(PAGE_TITLE))/' tmp/index.html + sed -i 's/{{PAGE_SCRIPT}}/$(subst /,\/,$(PAGE_SCRIPT))/' tmp/index.html + sed -i 's/{{PAGE_HEADING}}/$(subst /,\/,$(PAGE_HEADING))/' tmp/index.html + sed -i 's/{{PAGE_INFO}}/$(subst /,\/,$(PAGE_INFO))/' tmp/index.html + sed -i 's/{{VERSSTR}}/$(subst ",,$(VERSSTR))/' tmp/index.html + sed -i 's/{{PROJECT_URL}}/$(subst ",,$(subst /,\/,$(PROJECT_URL)))/' tmp/index.html + sed -i 's/{{PROJECT_NAME}}/$(subst ",,$(PROJECT_NAME))/' tmp/index.html + sed -i 's/{{PAGE_JQUERYFL}}/$(subst page/,,$(wildcard page/jquery*gz))/' tmp/index.html ./mfsmaker tmp page.mpfs push : pushtodev page.mpfs diff --git a/web/compat.h b/web/compat.h deleted file mode 100644 index 350f1f3..0000000 --- a/web/compat.h +++ /dev/null @@ -1,4 +0,0 @@ -// This definition does not exist in OSX, it's a Linuxism -#ifndef MSG_NOSIGNAL - #define MSG_NOSIGNAL 0 -#endif diff --git a/web/execute_reflash.c b/web/execute_reflash.c index dd21671..c6491a8 100644 --- a/web/execute_reflash.c +++ b/web/execute_reflash.c @@ -13,13 +13,13 @@ #include #include #include -#include -#include "compat.h" #include "md5.h" +#include struct libusb_device_handle *devh = NULL; + #define BLOCK_SIZE 65536 #define SECTOR_SIZE 4096 #define PADDING 1024 @@ -33,6 +33,7 @@ struct libusb_device_handle *devh = NULL; int sendsize_max = PADDING; int use_usb = 0; + int sockfd; struct sockaddr_in servaddr,cliaddr; diff --git a/web/mfsmaker.c b/web/mfsmaker.c index f6e6d1b..f2915c2 100644 --- a/web/mfsmaker.c +++ b/web/mfsmaker.c @@ -7,7 +7,6 @@ #include #include #include -#include "compat.h" #define SPI_FLASH_SEC_SIZE 4096 #define MFS_STARTFLASHSECTOR 0x100 diff --git a/web/pushtodev.c b/web/pushtodev.c index 6167128..71124df 100644 --- a/web/pushtodev.c +++ b/web/pushtodev.c @@ -11,7 +11,6 @@ #include #include #include -#include "compat.h" struct libusb_device_handle *devh = NULL;