Sunteți pe pagina 1din 3

10/24/2018 Category:ESP8266 Code Guide - ElectroDragon

Help

Category:ESP8266 Code Guide


From ElectroDragon

Contents
1 Pre-build firmware
2 Custom Interpreter
3 SDK
4 Flash Firmware
4.1 Use ESP Download Tool
4.2 Use arduino IDE
4.3 Firmware Details
4.4 ESPtool
4.5 Batch Flashing Nodemcu, Deploy firmware
5 Debug

Pre-build firmware
Default AT commands firmware ESP8266_AT-Command_firmware

Custom Interpreter
ESP8266 Arduino
ESP8266 NodeMCU Lua
MicroPython ESP8266
Javascript for ESP8266 (https://github.com/espruino/Espruino)
ESP8266 IoT
ESP8266 IoT Firmware
Get ESP8266 firmware flasher to flash the board

SDK
SDK get started guide

ESP Ellipse SDK


ESP8266 GCC SDK
ESP8266 Lubuntu SDK
ESP8266 Open SDK
Get ESP8266 firmware flasher to flash the board

Flash Firmware
Use ESP Download Tool

Use latest ESP Download Tool from espressif or from here (3.6 version.) (https://github.com/Edragon/esp_firmware/tree/master/Tool)

Use arduino IDE


Please see the guideline image on the right, this will be used in esp flash download tool, arduino IDE, etc

Option value Description


flash mode QIO -
flash frequency 40mhz -
upload using "serial" in arduino IDE
CPU frequency 80mhz -
flash size 4MBytes / 32Mbit (3M SPIFSS) old ESP8266 board should use 4Mbit (512Mbytes)
reset mode nodemcu -
upload speed 115200 up to 576000 is fine, speed up the flashing progress
upload port choose your own serial port -
crystal frequency 26mhz in esp flash download tool

Firmware Details

Boot Process

Reset vector is 0x40000080.

https://www.electrodragon.com/w/Category:ESP8266_Code_Guide#Pre-build_firmware 1/3
10/24/2018 Category:ESP8266 Code Guide - ElectroDragon
Boots into Espressif code in IROM0.
Loads SPI ROM data.
Starts executing ESP SDK-code shadowed SPI ROM (unconfirmed).

SPI Flash ROM Layout

Address Size Name Description


00000h 248k app.v6.flash.bin User application
3E000h 8k master_device_key.bin OTA device key
40000h 240K app.v6.irom0text.bin SDK libraries
7C000h 8k esp_init_data_default.bin Default configuration
7E000h 8k blank.bin Filled with FFh. May be WiFi configuration.

ESPtool
ESPTool (https://github.com/themadinventor/esptool/)
Install dependence if necessary, for lubuntu, first install python-pip, than pip install pyserial

apt-get install python-pip


pip install pyserial

More functions by using -h, for specific command try ie esptool.py write_flash -h.:

Run esptool {command} -h for additional help


load_ram Download an image to RAM and execute
dump_mem Dump arbitrary memory to disk
read_mem Read arbitrary memory location
write_mem Read-modify-write to arbitrary memory location
write_flash Write a binary blob to flash
run Run application code in flash
image_info Dump headers from an application image
make_image Create an application image from binary files
elf2image Create an application image from ELF file
read_mac Read MAC address from OTP ROM
flash_id Read SPI flash manufacturer and device ID
read_flash Read SPI flash content
erase_flash Perform Chip Erase on SPI flash

read flash ID:

./esptool.py --baud 115200 --port /dev/ttyUSB0 flash_id


Connecting...
Manufacturer: e0
Device: 4016

Batch Flashing Nodemcu, Deploy firmware

After finish coding, upload your code lua into target board, better be complied
dump out the flash content out and save as firmware.bin file for batch deploy
use this firmware.bin for new products

1. So first setup the esptool.py working environment


2. read out the flash content by command

./esptool.py --baud 115200 --port /dev/ttyUSB0 read_flash 0 4194304 output.bin

1. 4194304 mbits = 4MB, read flash time take at least more than 5 minutes
2. 2097152 mb = 2MB, 1048576 mbits = 1MB, 524288 = 512 KB, 262144 = 256 KB
3. use flash download tool flash normally

Also can try dump mem out, like RAM, etc, dumping the ROM (64 KiB) from the chip:

./esptool.py dump_mem 0x40000000 65536 iram0.bin

Debug
Open arduino IDE, and set baud rate to 74880 on serial, can find esp8266 debug info.

Pages in category "ESP8266 Code Guide"


The following 3 pages are in this category, out of 3 total.

ESP8266 Arduino
ESP8266 IoT

ESP Board Setup

Retrieved from "http://www.electrodragon.com/w/index.php?title=Category:ESP8266_Code_Guide&oldid=17448"

Category: ESP8266

https://www.electrodragon.com/w/Category:ESP8266_Code_Guide#Pre-build_firmware 2/3
10/24/2018 Category:ESP8266 Code Guide - ElectroDragon

This page was last modified on 19 December 2017, at 02:21.

https://www.electrodragon.com/w/Category:ESP8266_Code_Guide#Pre-build_firmware 3/3

S-ar putea să vă placă și