ESP8266 chipset is widely used in IoT, also in my projects. There are multiple ways to flash chipset, you may use https://platformio.org/, Arduino IDE, or simply flasher esptool available here: https://github.com/espressif/esptool
Writing ESP8266 there are multiple versions of boards (eg. ESP-12, ESP-12E and ESP-12F, ESP-01, ESP32 ) that may differ in Flash size. It is worth to check first if there is enough available memory to flash an image.
For flashing we require FDTDI USB/UART adapter and correct connections like this:
The most important is connect GPIO0 with GND for the time of flashing. Later you remove this connection.
Very convenient is using dedicated adapter 2in1: Geekcreit® USB To ESP8266 Serial Adapter Wireless WIFI Develoment Board Transfer Module It has already UART chip on board.
It might be used later to power up your esp board and what is important you do not have to solder CH-PD with VCC to start microprocessor.
You may also use similar to these, they allows to program also different devices that have RX/TX communication. Also you may select between 5V and 3V3:
How to flash
To flash I short GPIO0 and GND like below, before puting ESP8266 to the board.
Assuming that we have already image. you run the following command
esptool.py --port /dev/ttyUSB0 write_flash -fs 1MB -fm dout 0x0 sonoff.bin
Another interesting adapter however it does not have USB/UART interface but have stabilized VCC and you may use 5V input voltage.