Git Product home page Git Product logo

esp8266.dev.box's Introduction

esp8266-dev

A Vagrant-powered virtual machine providing an isolated development environment for the ESP8266 $5 dollar "Internet of Things" WiFi module. It is based on the open-sdk and includes some famous ESP projects like

What you'll need

  1. A way to communicate with the chip's 3.3V TTL serial interface. I've had success with a cable from Adafruit that's based on the PL2303 USB-to-TTL module.

  2. VirtualBox, a free open source virtualization package.

  3. Vagrant, a virtualization management tool geared towards development environments.

Let's Do This

  1. Clone this repository.

  2. If you'll be using a USB-to-TTL device like the Adafruit one I noted above, you'll need to edit the Vagrantfile to include your device's VendorId and ProductId. If you have the exact one I mentioned above, you may be fine with the existing configuration, but you may as well do this step too to be sure. It's an easy one.

    Connect your device to your computer and from the command line, run VBoxManage list usbhost. The output should be a list of entries that look like this:

     $ VBoxManage list usbhost
     Host USB Devices:
     ...
     UUID:               738b44fd-2f57-49dd-a16a-e31a0e7fa46f
     VendorId:           0x067b (067B)
     ProductId:          0x2303 (2303)
     Revision:           3.0 (0300)
     Port:               1
     USB version/speed:  0/1
     Manufacturer:       Prolific Technology Inc.
     Product:            USB-Serial Controller
     Address:            p=0x2303;v=0x067b;s=0x0002653c8cdc2c52;l=0x14100000
     Current State:      Captured
    

    Note the VendorId and ProductId. Set the $vendor_id and $product_id variables in Vagrantfile to those values. They must be strings of the hexadecimal representations.

2a. If you want to create the virtual machine and setup the SDK, without any ESP8266 projects, run in the console the following command:

vagrant up

This command can take 30 or more minutes on a decent hardware. But you should not worry because it is done only once. Most of it is spent building the cross-compiler.

2b. If you want to create the virtual machine, setup the SDK and test only one of the available projects then you can run vagrant with the following command on Linux and MacOS X:

PROJECT="sming" vagrant up

You can replace "sming" in the commands above with any of the available projects, like "micropython", "nodemcu", "frankenstein", "smart.js" or "espruino".

Or the commands below for Windows

set PROJECT=sming
vagrant up

You can replace sming in the commands above with any of the available projects, like micropython, nodemcu, frankenstein, smart.js or espruino.

2c. If you want to create the virtual machine, setup the SDK and test all of the projects then run in the Linux or MacOS X console

PROJECT="all" vagrant up

or the commands below for Windows

set PROJECT=all
vagrant up
  1. That's it! Now you can vagrant ssh and start building your images!

  2. If you want to update the virtual machine you can run:

vagrant provision

Or

PROJECT="sming" vagrant provision

To update the SDK and one of your projects.

The respective syntax for Windows is:

set PROJECT="sming"
vagrant provision

Or

PROJECT="all" vagrant provision

The respective syntax for Windows is:

set PROJECT=all
vagrant provision

To update the SDK and all of your projects.

USB access

Make sure the serial cable is working. With it plugged in, vagrant ssh into the machine and run lsusb to make sure it's in your list of devices. To see where it's attached, run dmesg and somewhere near the bottom you should see something like usb 1-1: pl2303 converter now attached to ttyUSB0. If not, you might try unplugging it and plugging it back in, then running it again -- that way it'll definitely be near the bottom of the log. If your device is attached anywhere besides /dev/ttyUSB0, you'll need to adjust your scripts and Makefiles as appropriate. No big deal.

Make sure that with the user, from which you started vagrant, is able to access /dev/ttyUSB0. If the following command does not produce any results:

$ VBoxManage list usbhost

Then make sure to add that user into the vagrant group. This can be done with:

sudo useradd -G vargrant {username}

Replace {username} with the correct value.

Vagrant tips, for the uninitiated

The project's root directory is mirrored to /vagrant on the virtual machine.

You can sudo from inside the machine without a password.

vagrant ssh - ssh into the machine

vagrant provision - runs the provisioning script. You can run this command every time you want to get the latest version of the SDK and the projects that are in dev.

vagrant halt - shuts down the machine

vagrant suspend - puts the machine to sleep

vagrant destroy - removes every trace of the machine. NOTE: after a destroy, the next vagrant up will have to reprovision the machine from scratch, meaning it'll take a while.

vagrant up - spins up the machine, bringing it back up from halt, suspend, or destroy

ESP8266 Resources

A final note

This box started as a fork of that project: https://github.com/mziwisky/esp8266-dev Thanks to mziwiski for his initial work.

esp8266.dev.box's People

Contributors

slaff avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

esp8266.dev.box's Issues

provision fails missing help2man

Am trying to download and get this running from Windows 10. I got the VM to run in VirtualBox and did a "vagrant provision" which ended with the following in the log. It seems that a new tool "help2man" needs to be installed?

I'm going looking, but I don't recall any mention of what the username and password is to log into the VM?

==> default: configure: error: missing required tool: help2man
==> default: make[1]:
==> default: *** [_ct-ng] Error 1
==> default: make[1]: Leaving directory `/opt/Espressif/crosstool-NG'
==> default: make:
==> default: *** [crosstool-NG/ct-ng] Error 2
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.

vagrant up fails

Here is the end of the output:

Now configured for "xtensa-lx106-elf"
make[2]: Leaving directory `/opt/Espressif/crosstool-NG'
sed -r -i.org s%CT_PREFIX_DIR=.*%CT_PREFIX_DIR="/opt/Espressif/xtensa-lx106-elf"% .config
sed -r -i s%CT_INSTALL_DIR_RO=y%"#"CT_INSTALL_DIR_RO=y% .config
cat ../crosstool-config-overrides >> .config
./ct-ng build
make[2]: Entering directory `/opt/Espressif/crosstool-NG'
[INFO ]  Performing some trivial sanity checks
[ERROR]  Your file system in '/opt/Espressif/crosstool-NG/.build' is *not* case-sensitive!
[ERROR]   
[ERROR]  >>
[ERROR]  >>  Build failed in step '(top-level)'
[ERROR]  >>
[ERROR]  >>  Error happened in: CT_Abort[scripts/functions@331]
[ERROR]  >>        called from: CT_TestAndAbort[scripts/functions@351]
[ERROR]  >>        called from: main[scripts/crosstool-NG.sh@93]
[ERROR]  >>
[ERROR]  >>  For more info on this error, look at the file: 'build.log'
[ERROR]  >>  There is a list of known issues, some with workarounds, in:
[ERROR]  >>      'share/doc/crosstool-ng/ct-ng.1.20.0/B - Known issues.txt'
[ERROR]   
[ERROR]  (elapsed: 24095287:11.58)
[00:00] / make[2]: Leaving directory `/opt/Espressif/crosstool-NG'
make[1]: Leaving directory `/opt/Espressif/crosstool-NG'


Stderr from the command:

+ PROJECT=
+ SDK_VERSION=
+ sudo apt-get update
+ sudo apt-get -y install git autoconf build-essential gperf bison flex texinfo libtool libncurses5-dev wget gawk libc6-dev-amd64 python-serial libexpat-dev unzip
dpkg-preconfigure: unable to re-open stdin: No such file or directory

Creating config file /etc/perl/XML/SAX/ParserDetails.ini with new version
Replacing config file /etc/perl/XML/SAX/ParserDetails.ini with new version
Replacing config file /etc/perl/XML/SAX/ParserDetails.ini with new version
+ '[' '!' -d /opt/Espressif ']'
+ sudo chown vagrant /opt/Espressif
+ cd /opt/
++ ls -d Espressif/.git/
ls: cannot access Espressif/.git/: No such file or directory
++ :
+ HAS_GIT=
+ '[' '' == '' ']'
+ rm -f Espressif/.empty
+ git clone https://github.com/pfalcon/esp-open-sdk.git Espressif
Cloning into 'Espressif'...
+ cd Espressif
+ git pull
+ git submodule sync
+ git submodule update
+ '[' -z '' ']'
+ make STANDALONE=y
Cloning into 'crosstool-NG'...
Cloning into 'esptool'...
Cloning into 'lx106-hal'...
make[2]: *** [build] Error 1
make[1]: *** [_toolchain] Error 2
make: *** [/opt/Espressif/xtensa-lx106-elf/bin/xtensa-lx106-elf-gcc] Error 2

The toolchain cannot be built under Windows

Symptom: Got new error while starting vagrant Your file system in '/opt/Espressif/crosstool-NG/.build' is not case-sensitive!

Possible solution will be not to share the Espressif folder between the host and the dev box. The disadvantage is that the toolchain will not be available under the Windows host :(. Second disadvantage is that rebuilding the box will mean rebuilding the toolchain which will result in 30 - 45 mins compilation time.

Shared folders not mounted

In a freshly constructed vagrant vm, the Shared Folders are not mounted. I see them in the VirtualBox Manager, but there's nothing actually mounted. Where should the following actually be mounted?

home_vagrant_dev - maybe ~/dev?
opt_provision_project - Got no clue
vagrant - maybe /vagrant?

Toolchain build error... may be VirtualBox 5 related

The first "vagrant up" command and the "vagrant provision" command fails with error compiling the EspressIF toolchain.

Watching the build.log I found the error in symlink creation:

 libtool: link: i686-build_pc-linux-gnu-ar cq .libs/libmpn.a  fib_table.o mp_bases.o add.o add_1.o add_n.o sub.o sub_1.o sub_n.o addcnd_n.o subcnd_n.o neg.o com.o mul_1.o addmul_1.o submul_1.o add_err1_n.o add_err2_n.o add_err3_n.o sub_err1_n.o sub_err2_n.o sub_err3_n.o lshift.o rshift.o dive_1.o diveby3.o divis.o divrem.o divrem_1.o divrem_2.o fib2_ui.o mod_1.o mod_34lsub1.o mode1o.o pre_divrem_1.o pre_mod_1.o dump.o mod_1_1.o mod_1_2.o mod_1_3.o mod_1_4.o lshiftc.o mul.o mul_fft.o mul_n.o sqr.o mul_basecase.o sqr_basecase.o nussbaumer_mul.o mulmid_basecase.o toom42_mulmid.o mulmid_n.o mulmid.o random.o random2.o pow_1.o rootrem.o sqrtrem.o get_str.o set_str.o scan0.o scan1.o popcount.o hamdist.o cmp.o perfsqr.o perfpow.o gcd_1.o gcd.o gcdext_1.o gcdext.o gcd_subdiv_step.o gcdext_lehmer.o div_q.o tdiv_qr.o jacbase.o jacobi_2.o jacobi.o get_d.o matrix22_mul.o matrix22_mul1_inverse_vector.o hgcd_matrix.o hgcd2.o hgcd_step.o hgcd_reduce.o hgcd.o hgcd_appr.o hgcd2_jacobi.o hgcd_jacobi.o mullo_n.o mullo_basecase.o toom22_mul.o toom32_mul.o toom42_mul.o toom52_mul.o toom62_mul.o toom33_mul.o toom43_mul.o toom53_mul.o toom54_mul.o toom63_mul.o toom44_mul.o toom6h_mul.o toom6_sqr.o toom8h_mul.o toom8_sqr.o toom_couple_handling.o toom2_sqr.o toom3_sqr.o toom4_sqr.o toom_eval_dgr3_pm1.o toom_eval_dgr3_pm2.o toom_eval_pm1.o toom_eval_pm2.o toom_eval_pm2exp.o toom_eval_pm2rexp.o toom_interpolate_5pts.o toom_interpolate_6pts.o toom_interpolate_7pts.o toom_interpolate_8pts.o toom_interpolate_12pts.o toom_interpolate_16pts.o invertappr.o invert.o binvert.o mulmod_bnm1.o sqrmod_bnm1.o div_qr_2.o div_qr_2n_pi1.o div_qr_2u_pi1.o sbpi1_div_q.o sbpi1_div_qr.o sbpi1_divappr_q.o dcpi1_div_q.o dcpi1_div_qr.o dcpi1_divappr_q.o mu_div_qr.o mu_divappr_q.o mu_div_q.o bdiv_q_1.o sbpi1_bdiv_q.o sbpi1_bdiv_qr.o dcpi1_bdiv_q.o dcpi1_bdiv_qr.o mu_bdiv_q.o mu_bdiv_qr.o bdiv_q.o bdiv_qr.o broot.o brootinv.o bsqrt.o bsqrtinv.o divexact.o bdiv_dbm1c.o redc_1.o redc_2.o redc_n.o powm.o powlo.o powm_sec.o sb_div_qr_sec.o sb_div_r_sec.o sbpi1_div_qr_sec.o sbpi1_div_r_sec.o trialdiv.o remove.o and_n.o andn_n.o nand_n.o ior_n.o iorn_n.o nior_n.o xor_n.o xnor_n.o copyi.o copyd.o zero.o tabselect.o comb_tables.o umul.o udiv.o add_n_sub_n.o
[ALL  ]    libtool: link: i686-build_pc-linux-gnu-ranlib .libs/libmpn.a
[ALL  ]    libtool: link: ( cd ".libs" && rm -f "libmpn.la" && ln -s "../libmpn.la" "libmpn.la" )
[ALL  ]    ln: failed to create symbolic link 'libmpn.la': Protocol error
[ERROR]    make[5]: *** [libmpn.la] Error 1

I found some post related to VBox5 and problems creating symlinks on shared folders.
I found some commands to enable symlinks on shared folders, but they don't work.

VBoxManage setextradata "ESP8266-Dev-Box" VBoxInternal2/SharedFoldersEnableSymlinksCreate/home_vagrant_dev 1
VBoxManage setextradata "ESP8266-Dev-Box" VBoxInternal2/SharedFoldersEnableSymlinksCreate/opt_EspressIf 1
VBoxManage setextradata "ESP8266-Dev-Box" VBoxInternal2/SharedFoldersEnableSymlinksCreate/vagrant 1
VBoxManage setextradata "ESP8266-Dev-Box" VBoxInternal2/SharedFoldersEnableSymlinksCreate/opt_provision_project 1

Have you some tips as workaround for that?
Unmounting shared folders and working directly on VM file system works, but is not a great solution
I'm using vagrant on Debian testing 64bit and using VirtualBox 5.0.4 and vagrant 1.7.4

spiffy: not found

When trying to compile a Sming sample project Basic_WebSkeletonApp using spiffy or by setting DISABLE_SPIFFS = 0 in Basic_Blink Makefile-user.mk I get an error:

/bin/sh: 3: /home/vagrant/dev/Sming/Sming//spiffy/spiffy: not found

It seems like spiffy is not being compiled during provisioning. Running make in /home/vagrant/dev/Sming/Sming/spiffy will resolve the issue.

What is the password?

I am trying to use this virtual machine in VMWare and I need to install the VMWare tools. I need to do this using sudo but the machine is requesting a password. What is the password for the esp8266 user?

esptool2 no longer in raburton/esp8266 repository

$ PROJECT="sming" vagrant up

fails with

==> default: ++ cd /home/vagrant/dev/raburton-esp8266/esptool2
==> default: /opt/provision/project/sming/provision.sh: line 36: cd: /home/vagrant/dev/raburton-esp8266/esptool2: No such file or directory
The SSH command responded with a non-zero exit status.

The esptool2 can now be found at https://github.com/raburton/esptool2.git and rboot at https://github.com/raburton/rboot.

So in sming/provision.sh after line 34 there needs to be:

git clone https://github.com/raburton/esptool2.git
git clone https://github.com/raburton/rboot

Projects provision problem on Windows

Hi, every time I stuck like this. Any suggestions how to solve this problem ? Thanks

==> default: ++ export XTENSA_TOOLS_ROOT=/opt/Espressif/xtensa-lx106-elf/bin/
==> default: ++ XTENSA_TOOLS_ROOT=/opt/Espressif/xtensa-lx106-elf/bin/
==> default: ++ export CROSS_COMPILE=xtensa-lx106-elf-
==> default: ++ CROSS_COMPILE=xtensa-lx106-elf-
==> default: ++ export SDK_BASE=/opt/Espressif/sdk/
==> default: ++ SDK_BASE=/opt/Espressif/sdk/
==> default: ++ export SDK_EXTRA_INCLUDES=/opt/Espressif/sdk/include/
==> default: ++ SDK_EXTRA_INCLUDES=/opt/Espressif/sdk/include/
==> default: ++ export FW_TOOL=/usr/bin/esptool
==> default: ++ FW_TOOL=/usr/bin/esptool
==> default: ++ export ESPTOOL=/usr/local/bin/esptool.py
==> default: ++ ESPTOOL=/usr/local/bin/esptool.py
==> default: ++ export ESPPORT=/dev/ttyUSB0
==> default: ++ ESPPORT=/dev/ttyUSB0
==> default: + '[' '!' -z sming ']'
==> default: + '[' sming == all ']'
==> default: ++ sort
==> default: ++ find /opt/provision/project/sming -name provision.sh
==> default: + FILES=/opt/provision/project/sming/provision.sh
==> default: + echo /opt/provision/project/sming/provision.sh
==> default: /opt/provision/project/sming/provision.sh
==> default: + for i in '$FILES'
==> default: + source /opt/provision/project/sming/provision.sh
==> default: ++ $'\r'
==> default: /opt/provision/project/sming/provision.sh: line 2: $'\r': command n
ot found
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.

Vagrant provisioning fails to pull SDK repo on d13d4ed

This commit adds a "README.md" in the Espressif folder, which makes the vm-boostrap script fail because it relies on an empty folder to indicate a git clone is required.

Fix by removing the README.md file out of Espressif folder before starting the vagrant provisioning.

Cannot compile Sming example

I'm trying to compile the Basic_Blink project for Sming but I get an error. Here is what I did.

I ran $ PROJECT="sming" vagrant provision

Then
$ export ESP_HOME=/opt/Espressif/
$ export SMING_HOME=~/dev/Sming/Sming

I go to the Basic_Blink directory:
$ cd ~/dev/Sming/Samples/Basic_Blink

and $ make

But it fails:
LD out/build/app.out
/opt/Espressif/xtensa-lx106-elf/lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld: cannot find -lsming
collect2: error: ld returned 1 exit status
make: *** [out/build/app.out] Error 1

I haven't found anyone online running into the same problem. Thank you for your help.

make: esptool2: Command not found

I'm trying to build the esp8266/Basic_Blink example but I'm getting the following error:

# Generating image...
make: esptool2: Command not found
make: *** [out/build/app.out] Error 127

I'm running a fresh vagrant provisioned with Sming as per the project wiki and this article

I've patched my provision.sh file to pull in esptools2 as per issue #12

cd ~/dev
if [ ! -e ~/dev/raburton-esp8266 ]; then
  git clone https://github.com/raburton/esp8266 raburton-esp8266
fi

if [ ! -e ~/dev/raburton-esp8266/esptool2 ]; then
  cd ~/dev/raburton-esp8266
  git clone https://github.com/raburton/esptool2.git
  git clone https://github.com/raburton/rboot
fi

cd ~/dev/raburton-esp8266/esptool2
export XTENSA_BINDIR=$XTENSA_TOOLS_ROOT
make 

So I'm assuming there is something wrong with the environment variables. I've updated them manually in Makefile-user.mk:

ESP_HOME = /opt/Espressif
SMING_HOME = /home/vagrant/dev/Sming/Sming

But i'm guessing something is off - seeing that I was pulling esptool2 into ~/dev/raburton-esp8266/

Any suggestions?

Feature Request: Add support for guests with case-insensitive file systems

The shared Expressif folder should be disabled by default for file systems on the guest OS that are case insensitive. This is always the case on Windows and most of the times the case on Mac OS X.

If the guest filesystem is case insensitive then the provisioning script should try to copy from the host to the guest after the SDK is build the assembler, header and c/c++ files so that development on the guest is easier.

Dev directory stays empty

Hello!
First of all thanks for sharing your project!

I must admit though that I have some troubles. When I try to get one of the available projects using the commands below (I am using Windows), the dev directory stays empty.

set PROJECT=sming

vagrant up --provision

How to reproduce

Just pull the current repo and follow the steps of this tutorial and the README.

The initial provisioning did not go as smooth as the tutorial suggests because some tarball repos were down and a python dev package was not installed, but in the end after extensive googling I got it to build gcc and gdb successfully.

Altough I seemingly don't get sming to work.
Could you tell me what I did wrong and how I can solve it?

Edit: I just realized that the command above throws an error when I try to get the project:

default: /opt/provision/project/sming/provision.sh: line 2: $'\r': command not found

The SSH command responded with a non-zero exit status. Vagrant assumes that this means the command failed. The output for this command should be in the log above. Please read the output to determine what went wrong.

Still I don't know what fails and why, so if somebody could help me I would be very glad!

Q A
Version 90f1ae7 on 12 Sep 2016

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.