diff --git a/embedded8266/0x00000.bin b/embedded8266/0x00000.bin deleted file mode 100644 index fadf7a1..0000000 Binary files a/embedded8266/0x00000.bin and /dev/null differ diff --git a/embedded8266/0x40000.bin b/embedded8266/0x40000.bin deleted file mode 100644 index bcccc35..0000000 Binary files a/embedded8266/0x40000.bin and /dev/null differ diff --git a/embedded8266/Makefile b/embedded8266/Makefile index 844cdc4..eddbf21 100644 --- a/embedded8266/Makefile +++ b/embedded8266/Makefile @@ -3,9 +3,9 @@ include makeconf.inc # Look here for user configuration .PHONY : all clean cleanall netburn burnweb burn uniq = $(if $1,$(firstword $1) $(call uniq,$(filter-out $(firstword $1),$1))) -FW_FILE1 = image.elf-0x00000.bin -FW_FILE2 = image.elf-0x40000.bin TARGET = image.elf +FW_FILE1 = $(TARGET)-0x00000.bin +FW_FILE2 = $(TARGET)-0x40000.bin SRCS = \ driver/uart.c \ @@ -49,7 +49,7 @@ $(TARGET) : $(SRCS) ifeq ($(CHIP), 8285) burn : $(FW_FILE1) $(FW_FILE2) - ($(ESPTOOL_PY) --port $(PORT) write_flash -fs 8m -fm dout 0x00000 0x00000.bin 0x40000 0x40000.bin)||(true) + ($(ESPTOOL_PY) --port $(PORT) write_flash -fs 8m -fm dout 0x00000 $(FW_FILE1) 0x40000 $(FW_FILE2))||(true) else ifeq ($(CHIP), 8266) burn : $(FW_FILE1) $(FW_FILE2) ($(ESPTOOL_PY) --port $(PORT) write_flash 0x00000 $(FW_FILE1) 0x40000 $(FW_FILE2))||(true) @@ -68,10 +68,12 @@ netburn : $(FW_FILE1) $(FW_FILE2) @cd web && $(MAKE) $(MFLAGS) $(MAKEOVERRIDES) execute_reflash web/execute_reflash $(IP) $(FW_FILE1) $(FW_FILE2) +netweb : + @cd web && $(MAKE) $(MFLAGS) $(MAKEOVERRIDES) push + clean : $(RM) $(patsubst %.c,%.o,$(SRCS)) $(TARGET) purge : clean @cd web && $(MAKE) $(MFLAGS) $(MAKEOVERRIDES) clean $(RM) $(FW_FILE1) $(FW_FILE2) - diff --git a/embedded8266/README.md b/embedded8266/README.md index 8aadd1f..aaddba7 100644 --- a/embedded8266/README.md +++ b/embedded8266/README.md @@ -7,7 +7,7 @@ This project is based off of the I2S interface for the mp3 player found here: https://github.com/espressif/esp8266_mp3_decoder/ -If you want more information about the build environment, etc. You should +If you want more information about the build environment, etc. You should check out the regular WS2812 driver, found here: https://github.com/cnlohr/ws2812esp8266 WARNING: This subproject is very jankey! It's about stable, but I don't think it's quite there yet. @@ -20,7 +20,14 @@ The audio data is taken from TOUT, but must be kept between 0 and 1V. ## Notes -./makeconf.inc has a few variables that make uses for building and flashing the firmware. +./makeconf.inc has a few variables that Make uses for building and flashing the firmware. Most notably the location of the toolchain for the esp8266/85 on your system. You should edit them according to your preferences or better add `export ESP_ROOT='/path/to/the/esp-open-sdk'` to your bashrc. +If you have problems with burning the firmware or transfering page data over network (`make netburn` or `make netweb`), you should try uncommenting + + OPTS += -DVERIFY_FLASH_WRITE + +in `makeconf.inc`. This way the esp checks if the flash is written correctly. +Especially with some ESP-01 modules there has been a problem with the flash +not being written correctly. diff --git a/embedded8266/common/commonservices.c b/embedded8266/common/commonservices.c index 9627cf1..70adc5a 100644 --- a/embedded8266/common/commonservices.c +++ b/embedded8266/common/commonservices.c @@ -36,8 +36,8 @@ struct totalscan_t int scanplace = 0; static void ICACHE_FLASH_ATTR scandone(void *arg, STATUS status) { - scaninfo *c = arg; - struct bss_info *inf; + scaninfo *c = arg; + struct bss_info *inf; if( need_to_switch_back_to_soft_ap == 1 ) need_to_switch_back_to_soft_ap = 2; @@ -143,11 +143,23 @@ int ICACHE_FLASH_ATTR issue_command(char * buffer, int retsize, char *pusrdata, spi_flash_write( nr, (uint32*)buffer, (datlen/4)*4 ); ExitCritical(); + #ifdef VERIFY_FLASH_WRITE + #define VFW_SIZE 128 + printf( "FW%d\r\n", nr ); + int jj; + uint8_t __attribute__ ((aligned (32))) buf[VFW_SIZE]; + for(jj=0; jjdatlen ? datlen%VFW_SIZE : VFW_SIZE ) != 0 ) goto failw; + } + #endif + buffend += ets_sprintf(buffend, "FW%d\r\n", nr ); break; } } - buffend += ets_sprintf(buffend, "!FW\r\n" ); + failw: + buffend += ets_sprintf(buffend, "!FW\r\n" ); break; case 'x': case 'X': //Flash Write Hex (FX#\t#\tDATTAAAAA) <- a = byte pos. b = length (in hex-pairs). Generally used for web-browser. if( colon ) @@ -184,6 +196,21 @@ int ICACHE_FLASH_ATTR issue_command(char * buffer, int retsize, char *pusrdata, spi_flash_write( nr, (uint32*)buffend, (datlen/4)*4 ); ExitCritical(); + #ifdef VERIFY_FLASH_WRITE + // uint8_t __attribute__ ((aligned (32))) buf[1300]; + // spi_flash_read( nr, (uint32*)buf, (datlen/4)*4 ); + // if( ets_memcmp( buf, buffer, (datlen/4)*4 ) != 0 ) break; + // Rather do it in chunks, to avoid allocationg huge buf + #define VFW_SIZE 128 + printf( "FW%d\r\n", nr ); + int jj; + uint8_t __attribute__ ((aligned (32))) buf[VFW_SIZE]; + for(jj=0; jjdatlen ? datlen%VFW_SIZE : VFW_SIZE ) != 0 ) goto failfx; + } + #endif + buffend += ets_sprintf(buffend, "FX%d\t%d\r\n", nr, siz ); break; } @@ -248,10 +275,10 @@ failfx: { bssid_set = ets_str2macaddr( mac, colon3 )?1:0; if( ( mac[0] == 0x00 || mac[0] == 0xff ) && - ( mac[1] == 0x00 || mac[1] == 0xff ) && - ( mac[2] == 0x00 || mac[2] == 0xff ) && - ( mac[3] == 0x00 || mac[3] == 0xff ) && - ( mac[4] == 0x00 || mac[4] == 0xff ) && + ( mac[1] == 0x00 || mac[1] == 0xff ) && + ( mac[2] == 0x00 || mac[2] == 0xff ) && + ( mac[3] == 0x00 || mac[3] == 0xff ) && + ( mac[4] == 0x00 || mac[4] == 0xff ) && ( mac[5] == 0x00 || mac[5] == 0xff ) ) bssid_set = 0; } @@ -330,9 +357,9 @@ failfx: { if( strcmp( colon3, enctypes[k] ) == 0 ) config.authmode = k; - } + } } - + #endif int chan = (colon4)?my_atoi(colon4):config.channel; @@ -426,10 +453,10 @@ failfx: int i, r; buffend += ets_sprintf( buffend, "WR%d\n", scanplace ); - + for( i = 0; i < scanplace && buffend - buffer < retsize - 64; i++ ) { - buffend += ets_sprintf( buffend, "#%s\t%s\t%d\t%d\t%s\n", + buffend += ets_sprintf( buffend, "#%s\t%s\t%d\t%d\t%s\n", totalscan[i].name, totalscan[i].mac, totalscan[i].rssi, totalscan[i].channel, enctypes[totalscan[i].encryption] ); } diff --git a/embedded8266/image.elf b/embedded8266/image.elf index 991f7c8..2338d7e 100755 Binary files a/embedded8266/image.elf and b/embedded8266/image.elf differ diff --git a/embedded8266/image.elf-0x00000.bin b/embedded8266/image.elf-0x00000.bin new file mode 100644 index 0000000..d808ee6 Binary files /dev/null and b/embedded8266/image.elf-0x00000.bin differ diff --git a/embedded8266/image.elf-0x40000.bin b/embedded8266/image.elf-0x40000.bin new file mode 100644 index 0000000..7277e78 Binary files /dev/null and b/embedded8266/image.elf-0x40000.bin differ diff --git a/embedded8266/makeconf.inc b/embedded8266/makeconf.inc index a690826..766dae5 100644 --- a/embedded8266/makeconf.inc +++ b/embedded8266/makeconf.inc @@ -11,6 +11,8 @@ SDK_DEFAULT ?= $(HOME)/esp8266/esp-open-sdk ESP_GCC_VERS ?= 4.8.5 OPTS += -DICACHE_FLASH +#OPTS += THIS_DEBUG +#OPTS += -DVERIFY_FLASH_WRITE #OPTS += -DFREQ=12500 ###########################################################################VARS @@ -32,3 +34,4 @@ ifeq ($(strip $(ESP_ROOT)),) $(warning Warning: No shell variable 'ESP_ROOT', using '$(SDK_DEFAULT)') ESP_ROOT := $(SDK_DEFAULT) endif +