Binary to update ESP8266 firmware to Espressif firmware. Requires user to press buttons.

Dependencies:   BufferedSerial mbed

Fork of ESPQuickFlash by Christopher Haster

How to Use

This program will update the firmware on a connected ESP8266 to the Espressif Firmware. The user will need to put the ESP8266 board into FW Update mode and follow instructions as given on the serial console.

Between each block transfer power cycle the ESP8266 and put back into FW Update mode. On the Seeed Grove Serial WiFi module this requires a short press followed by a long press on the esp8266 reset button untill the light on the module goes red.

Terminal Settings

9600 baud 8-N-1

Video of how its done

Committer:
mbedAustin
Date:
Mon Apr 18 21:23:56 2016 +0000
Revision:
1:7cb29c3c51ac
Parent:
0:d84cdaf22096
Updated example to use 2wire board (Seeed Grove serial WiFi module) and ask for user input between files.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
geky 0:d84cdaf22096 1 #!/usr/bin/env python
geky 0:d84cdaf22096 2
geky 0:d84cdaf22096 3 import sys
geky 0:d84cdaf22096 4 import time
geky 0:d84cdaf22096 5
geky 0:d84cdaf22096 6
geky 0:d84cdaf22096 7 FILE_TEMPLATE = """
geky 0:d84cdaf22096 8 /*** Auto generated on %s ***/
geky 0:d84cdaf22096 9
geky 0:d84cdaf22096 10 struct flash_page {
geky 0:d84cdaf22096 11 uint32_t address;
geky 0:d84cdaf22096 12 uint32_t size;
geky 0:d84cdaf22096 13 const char *data;
geky 0:d84cdaf22096 14 };
geky 0:d84cdaf22096 15
geky 0:d84cdaf22096 16 #define FLASH_COUNT %d
geky 0:d84cdaf22096 17 struct flash_page FLASH_PAGES[FLASH_COUNT] = {
geky 0:d84cdaf22096 18 %s
geky 0:d84cdaf22096 19 };
geky 0:d84cdaf22096 20 """
geky 0:d84cdaf22096 21
geky 0:d84cdaf22096 22 PAGE_TEMPLATE = """ { 0x%05x, 0x%05x, (const char []){
geky 0:d84cdaf22096 23 %s
geky 0:d84cdaf22096 24 }}"""
geky 0:d84cdaf22096 25
geky 0:d84cdaf22096 26
geky 0:d84cdaf22096 27 def main(*args):
geky 0:d84cdaf22096 28 if len(args) < 2:
geky 0:d84cdaf22096 29 print 'Usage: %s <address> <file> <address> <file>...' % sys.argv[0]
geky 0:d84cdaf22096 30 sys.exit(-1)
geky 0:d84cdaf22096 31
geky 0:d84cdaf22096 32 pages = []
geky 0:d84cdaf22096 33
geky 0:d84cdaf22096 34 for addr, filename in zip(*[iter(args)]*2):
geky 0:d84cdaf22096 35 with open(filename, 'rb') as file:
geky 0:d84cdaf22096 36 addr = int(addr, 0)
geky 0:d84cdaf22096 37 data = file.read()
geky 0:d84cdaf22096 38 size = len(data)
geky 0:d84cdaf22096 39
geky 0:d84cdaf22096 40 lines = zip(*[('0x%02x' % ord(x) for x in data)]*16)
geky 0:d84cdaf22096 41 array = ',\n '.join(','.join(line) for line in lines)
geky 0:d84cdaf22096 42
geky 0:d84cdaf22096 43 pages.append(PAGE_TEMPLATE % (addr, size, array))
geky 0:d84cdaf22096 44
geky 0:d84cdaf22096 45 sys.stdout.write(FILE_TEMPLATE % (
geky 0:d84cdaf22096 46 time.strftime("%d/%m/%Y"),
geky 0:d84cdaf22096 47 len(pages),
geky 0:d84cdaf22096 48 ',\n'.join(pages)
geky 0:d84cdaf22096 49 ))
geky 0:d84cdaf22096 50
geky 0:d84cdaf22096 51 if __name__=="__main__":
geky 0:d84cdaf22096 52 main(*sys.argv[1:])