I'll summarize the list of steps I've taken to prepare a Linux VirtualBox on Windows as a development environment for ESP8266 . Prerequisites
- Laptop with Windows (mine with with Windows 8.1)
- ESP-12 module, this with it's "IO adapter plate Expansion" can fit nicely on two connected breadboards
- Any USB to Serial / TTL Converter, like this one.
- I'm not going to cover ESP wiring in this wirting.
- Download and Install VirtualBox 5.0.0
- Install Ubuntu 14.04 from an ISO image
- Install Guest Additions for Ubuntu. I did it from an ISO image.
- This fixes the screen resolution problem. After the installation you can resize to any dimension.
- Install esp-open-sdk. Follow the instructions there for Ubuntu 14.04, for installing dependencies, cloning git repository and building.
I installed the SDK under/home/amirg/projects/esp-open-sdk
- I chose to build it in "separate" mode -
make STANDALONE=y
.
- I chose to build it in "separate" mode -
- Clone the esp-source-code-examples
- Since the open-sdk based Makefiles expect the Espressif toolchain to be under /opt/Espressif, I created these symbolic links:
/opt/Espressif/ESP8266_SDK -> /home/amirg/projects/esp-open-sdk/sdk
/opt/Espressif/crosstool-NG/builds/xtensa-lx106-elf -> /home/amirg/projects/esp-open-sdk/xtensa-lx106-elf/
Of course I had to create the sub directories where I put these links in. make
onsource-code-examples/blinky
directory should pass smoothly now, generating0x00000.bin
and0x40000.bin
underfirmware/
- Add USB filter on the VM --> settings --> USB menu. If the FTDI drivers were installed on Windows, you can just select
FTDI FT232R USB UART
. Unfortunately, this doesn't work out of the box and require some hassle:- Follow the procedure described here to fix the VirtualBox USB filter driver installation. Yes... edit registery, reboot etc.
- At this point the USB driver should work. Check it by running
lsusb
on the Linux console. You should get something like:
Bus 001 Device 007: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC
- How to set baud rate???
Currently I use the
spd_cust divisor
ofsetserial
. It's a trick to set a custom baud rate of the serial port when connecting to it with the 38400 baud rate. For example:
sudo setserial -v /dev/ttyUSB0 spd_cust divisor $((24000000/74880))
would set the serial port to 74880. Then connect withPuTTY
setting the Serial Line to/dev/ttyUSB0
and Speed to38400
. 38400 just tells the serial driver to use the custom speed.- 74880 is the default when in
boot mode:(3,7)
. See more details here. - Need to change the Makefile to set the 38400 baud rate:
$(ESPTOOL) -b 38400
- 74880 is the default when in
make flash
should work smoothly now. I was able to flash with baud rate up to 460800. Higher rates such as 921600 didn't work for me.
With screen
utility:
sudo setserial -v /dev/ttyUSB0 spd_cust divisor $((24000000/74880))
screen /dev/ttyUSB0 38400
Escape key is CTRL-a
, exiting: CTRL-a \
So it seems Espressif makefile expects very specific directory structure. Described here:
- /home/my_at
- --at .......... copy from SDK/examples
- Makefile ....... copy or link from SDK/, this is the master makefile
- include ........ link to SDK/include
- ld ............. link to SDK/ld
- tools .......... link to SDK/tools
- bin ............ create empty, output will be placed here
- --upgrade ..... create empty
/opt/esp-open-sdk/esptool/esptool.py --port /dev/ttyUSB0 write_flash 0x00000 ../bin/eagle.flash.bin 0x40000 ../bin/eagle.irom0text.bin
Written with StackEdit.