Merge pull request #16 from con-f-use/master
Add VERIFY_FLASH_WRITE as remedy for #15
This commit is contained in:
commit
1dd31cc7c3
Binary file not shown.
Binary file not shown.
|
@ -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)
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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; jj<datlen; jj+=VFW_SIZE) {
|
||||
spi_flash_read( nr+jj, (uint32*)buf, VFW_SIZE );
|
||||
if( ets_memcmp( buf, buffer+jj, jj+VFW_SIZE>datlen ? 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; jj<datlen; jj+=VFW_SIZE) {
|
||||
spi_flash_read( nr+jj, (uint32*)buf, VFW_SIZE );
|
||||
if( ets_memcmp( buf, buffer+jj, jj+VFW_SIZE>datlen ? datlen%VFW_SIZE : VFW_SIZE ) != 0 ) goto failfx;
|
||||
}
|
||||
#endif
|
||||
|
||||
buffend += ets_sprintf(buffend, "FX%d\t%d\r\n", nr, siz );
|
||||
break;
|
||||
}
|
||||
|
|
Binary file not shown.
BIN
embedded8266/image.elf-0x00000.bin
Normal file
BIN
embedded8266/image.elf-0x00000.bin
Normal file
Binary file not shown.
BIN
embedded8266/image.elf-0x40000.bin
Normal file
BIN
embedded8266/image.elf-0x40000.bin
Normal file
Binary file not shown.
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue