Configuring the Raspberry Pi as an ESP8266 Development Environment

The Raspberry Pi is an advantageous platform for developing ESP8266 software, as it can power the ESP with its 3.3V pins, communicate directly with the ESP via its serial GPIO pins, and natively runs the Xtensa cross-compiler on its Linux-based Raspbian OS. We first began using it out of convenience, as it was the only thing that we had on-hand that could power and communicate with the ESP-12. However, we have found that we really like the workflow of coding, compiling and directly pushing firmware onto the ESP.

The first step to developing on a Raspberry Pi is to enable the Pi to communicate with the ESP8266 via its two serial pins. GPIO 14 and 15 are the Pi’s serial port, 14 being transmit and 15 being receive. A fresh installation of Raspbian needs a tiny bit of tweaking to use the port, however. The Wheezy-based version of Raspbian sends boot information to the serial port during the Pi’s startup, and this functionality must be disabled. To do so, open “cmdline.txt” in /boot using superuser privileges (ie “sudo nano /boot/cmdline.txt” in the terminal) and remove this segment:

console=ttyAMA0,115200 kgdboc=ttyAMA0,115200

Raspbian’s default configuration automatically provides a serial login service using getty over the serial port, which must be disabled in both Wheezy and Jessie. To disable this, use the command “sudo raspi-config” in the terminal. It will open a configuration program.


Select “Advanced” (option 9 on the main menu) and then “Serial” (option 8 on the Advanced menu). It will ask if the Raspberry Pi should provide serial login, to which you should select “no.”



You may need to use the “expand filesystem” option while you are in raspi-config (option 1 on the main menu). A freshly-written Raspbian SD card installation is likely not taking full advantage of the space provided to it, making it difficult to install new packages. If you have space issues in this tutorial, run this option before buying a new SD card!

The main menu of raspi-config

Select “Finish” on the main menu and allow the Pi to reboot.

Now you’ll need software to test the serial connection with. Open a terminal and install minicom (“sudo apt-get install minicom”). Connect the transmit pin of your ESP to the Pi’s receive pin and vice versa. Now, in the terminal, open a serial terminal:

minicom -D /dev/ttyAMA0

You should be able to send and receive communications with the ESP8266.

The next portion of the getting started guide covers the toolchain.

It is a good idea to start with updated repositories and upgrading the currently installed software:

sudo apt-get update
sudo apt-get upgrade

Once the update is finished, reboot the Pi. When the system is back on, open a terminal and install the required dependencies for the toolchain:

sudo apt-get install make autoconf automake libtool gcc g++ gperf flex bison texinfo gawk ncurses-dev libexpat-dev python python-serial sed git unzip bash libtool-bin

We are now ready to install the toolchain. You can put install this anywhere, but a good place for it would be the /opt directory:

cd /opt
sudo git clone –recursive
sudo chmod 777 -R esp-open-sdk
sudo chown -R YourRPiUsername esp-open-sdk/
cd esp-open-sdk

This will take approximately forever. Once it finishes, the final piece of the puzzle is adding the compiler to your path variable. We’ll put it at the very end of your ~/.profile:


Placing the Xtensa Tools in the PATH Variable

Reboot the Pi and open a terminal. Check to make sure the PATH variable contains the xtensa toolchain by using the following command:


The path to the compiler should be listed in the output of the PATH variable. You can now compile ESP8266 firmware and flash it to the device. You can test this by pulling the OpenMYR code and using the makefile while your ESP is connected to the serial and booted into write mode:

git clone
cd IoT_Motors
make flash-stepper

Finally, unless you’re all about terminal-based editors, you will want a text editor that is condusive for programming. The Pi’s built-in GUI text editors aren’t that useful, but we found that SciTE was perfect for our needs. It feels a lot like Notepad++ and made coding on the Pi a lot saner. It can be installed with a simple apt-get command:

sudo apt-get install scite

This entry was posted in ESP8266, Raspberry Pi, Raspbian, Reference and tagged , , , , . Bookmark the permalink.

2 Responses to Configuring the Raspberry Pi as an ESP8266 Development Environment

  1. Nan Xie says:

    Hi, Brandon

    Your blog is very useful to me!

    I have a Raspberry Pi 3.And install 2016-05-27-raspbian-jessie and ubuntu-mate-16.04-raspberry in two SD cards.

    But I can’t apt-get autoconf in rasbian, while have a wrong during makeing esp-open-sdk in ubuntu when build Xtensa crosstool-NG.

    the error message in ubuntu is:

    Installing GMP for host
    make[5]:*** [div_qr_1n_pi1.lo] Error 1
    make[4]:*** [all-recurseve] Error 1
    make[3]:*** [all] Error 2
    Error happend in: CTDoExeclog[scripte/[email protected]]
    call from: do_gmp_backen[sceipts/build/companion-libs/[email protected]
    call from: do_gmp_for host[sceipts/build/companion-libs/[email protected]
    call from: do_companion_libs_for_host[sceipts/build/companion-libs/[email protected]

    Do you have idea about this? Would you show me more detail about installing esp-open-sdk?

    Thank you!

    • Brandon Brown says:

      Nan, I’m sorry we haven’t gotten back to you promptly. We’ve been very busy trying to get everything ready for Kickstarter.

      I did some Googling and couldn’t come up with a reason why autoconf is unavailable on raspbian, but you should try doing an apt-get update to make sure you have the latest package lists (you probably already knew this though). I don’t have a Raspberry Pi 3 to recreate the issue, unfortunately. We’re planning on upgrading our infrastructure during the Kickstarter, and hopefully you can figure out this issue before we run into it.

      Good luck and let us know how it turns out!

Leave a Reply

Your email address will not be published. Required fields are marked *