1#### Preparation 2 3##### Accessories 4 5You need, 6* 3.3V power supply. You can use bread board power (+5V, +3.3V). I used LM317 like this; 7 * Use [LM317](http://www.ti.com/lit/ds/symlink/lm317.pdf) 8 * R1 = 330 Ohm, R2 = 545 Ohm (1K + 1.2K in parallel) 9 * 5V 2A adaptor 10* USB to RS-232 Serial + RS-232 Serial to Digital or USB-to-RS232 TTL converter 11 12#### Tools 13 14The rest of this document will assume that you download all necessary tools into 15a common directory structure. For the sake of simplicity, `$HOME/Espressif` will 16be used as the root of this structure. Feel free to deviate from this but then 17adapt all the paths accordingly. 18 19``` 20mkdir $HOME/Espressif 21``` 22 23##### Toolchain 24 25Download the [toolchain](https://github.com/espressif/ESP8266_RTOS_SDK/tree/v3.0.1#get-toolchain) 26pre-built for your development platform to `$HOME/Espressif` and untar it. E.g., 27on Linux/x86-64: 28 29``` 30cd $HOME/Espressif 31tar xvfz xtensa-lx106-elf-linux64-1.22.0-88-gde0bdc1-4.8.5.tar.gz 32``` 33 34##### Espressif SDK: use Espressif official 35 36``` 37cd $HOME/Esprissif 38git clone https://github.com/espressif/ESP8266_RTOS_SDK.git -b v2.1.0 39``` 40 41This version is tested and works properly. 42 43##### ESP image tool 44``` 45cd $HOME/Espressif 46wget -O esptool_0.0.2-1_i386.deb https://github.com/esp8266/esp8266-wiki/raw/master/deb/esptool_0.0.2-1_i386.deb 47sudo dpkg -i esptool_0.0.2-1_i386.deb 48``` 49 50##### ESP upload tool 51``` 52cd $HOME/Espressif 53git clone https://github.com/themadinventor/esptool 54``` 55 56##### Set environment variables 57 58Set environment variables, might also go in your `.profile`: 59``` 60export PATH=$HOME/Espressif/xtensa-lx106-elf/bin:$PATH 61export SDK_PATH=$HOME/Espressif/ESP8266_RTOS_SDK 62export ESPTOOL_PATH=$HOME/Espressif/esptool 63export BIN_PATH=(to output folder path) 64``` 65 66#### Test writing with Blinky example 67 68##### Get the source 69 70found one example that works with SDK V1.2 (which is based on FreeRTOS, as of writing) 71 72* https://github.com/mattcallow/esp8266-sdk/tree/master/rtos_apps/01blinky 73 74 75##### Compile 76 77Read `2A-ESP8266__IOT_SDK_User_Manual_EN` document in 78[this](http://bbs.espressif.com/viewtopic.php?f=51&t=1024) link. 79 80It's configured 2048KB flash 81``` 82BOOT=new APP=1 SPI_SPEED=80 SPI_MODE=QIO SPI_SIZE_MAP=5 make 83BOOT=new APP=2 SPI_SPEED=80 SPI_MODE=QIO SPI_SIZE_MAP=5 make 84``` 85 86or old way... this works not sure this is ok. 87``` 88make BOOT=new APP=0 SPI_SPEED=80 SPI_MODE=QIO SPI_SIZE_MAP=2 89``` 90 91##### Flashing 92 93* power off ESP8266 board 94* connect GPIO0 to GND, connect GPIO2 to VCC 95* power on 96* write 97 98``` 99sudo $HOME/Espressif/esptool/esptool.py \ 100 --port /dev/ttyUSB0 write_flash \ 101 0x00000 $SDK_PATH/bin/"boot_v1.7.bin" \ 102 0x01000 $BIN_PATH/upgrade/user1.2048.new.5.bin \ 103 0x101000 $BIN_PATH/upgrade/user2.2048.new.5.bin \ 104 0x3FE000 $SDK_PATH/bin/blank.bin \ 105 0x3FC000 $SDK_PATH/bin/esp_init_data_default.bin 106``` 107_change `/dev/ttyUSB1` to whatever you have._ 108 109or the old way...this works not sure this is ok. 110``` 111cd $BIN_PATH 112sudo $HOME/Espressif/esptool/esptool.py \ 113--port /dev/ttyUSB0 write_flash \ 1140x00000 eagle.flash.bin 0x40000 eagle.irom0text.bin 115``` 116 117* power off 118* disconnect GPIO0 so that it is floating 119* connect GPIO2 with serial of 470 Ohm + LED and to GND 120* power On 121