Cannot get Vagrant Up

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
Post Reply
pmulvey
Posts: 45
Joined: Sun Jul 29, 2018 8:12 am
Location: Athlone, Ireland

Cannot get Vagrant Up

Post by pmulvey » Fri Oct 11, 2019 4:13 pm

I'm trying to get into frozen modules. It seems to be quite a task given that you need to use Virtual Box, GIT, and Vagrant. Is there any simpler way? I would be satisfied with .mpy files because I seem to be up against the blocks with my source code size and compiling on the esp8266.

This the Vagrant output...

Code: Select all

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'ubuntu/trusty64' version '20190429.0.1' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
After a while it times out. VirtualBox shows "esp8266-micropython-vagrant" running and session locked. Any ideas?

It does seem strange that the esp8266 on the one hand has loads of flash (4M) and yet so little RAM for compilation. I would have expected that someone out there would have a turnkey application for precompiling or freezing modules.
Paul Mulvey

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Cannot get Vagrant Up

Post by pythoncoder » Sun Oct 13, 2019 7:29 am

you need to use Virtual Box, GIT, and Vagrant. Is there any simpler way?
You don't need to use virtualisation. I build on native Linux machines but I believe it is also possible to build natively on Windows and OSX. If you ask for advice on your own OS I'm sure someone will assist.

As for Git you only need to invoke it once to clone the sources to your PC. But it is a development tool well worth learning.
Peter Hinch
Index to my micropython libraries.

pmulvey
Posts: 45
Joined: Sun Jul 29, 2018 8:12 am
Location: Athlone, Ireland

Re: Cannot get Vagrant Up

Post by pmulvey » Sun Oct 13, 2019 12:09 pm

Thanks Peter, I actually started to do that on my Linux Mint machine but hit a few more hurdles. I'll google my way through those hopefully. I resolved the situation for now by removing one of the modules. The overall project is a demo of the board's facilities and I suppose in practice my students may not want such an "all up" program anyway. I'm going to sit down now with a YouTube tutorial on Git Hub!
Paul Mulvey

kevinkk525
Posts: 969
Joined: Sat Feb 03, 2018 7:02 pm

Re: Cannot get Vagrant Up

Post by kevinkk525 » Sun Oct 13, 2019 9:01 pm

I'm using ubuntu 18.04 WSL on windows 10 and this is my script for setting up the repositories:

Code: Select all

#!/usr/bin/env bash
sudo apt-get install make unrar-free autoconf automake libtool gcc g++ gperf \
    flex bison texinfo gawk ncurses-dev libexpat-dev python-dev python python-serial \
    sed git unzip bash help2man wget bzip2
sudo apt install python3-dev python3-pip libtool-bin
pip3 install rshell esptool
cd ~/
git clone --recursive https://github.com/pfalcon/esp-open-sdk.git
cd esp-open-sdk
make STANDALONE=y
export PATH=/home/kevin/esp-open-sdk/xtensa-lx106-elf/bin:$PATH
cd ~/
git clone https://github.com/micropython/micropython.git
cd micropython
git submodule update --init
make -C mpy-cross
cd ports/esp8266
make axtls
sed -i 's/irom0_0_seg :  org = 0x40209000, len = 0x8f000/irom0_0_seg :  org = 0x40209000, len = 0xc7000/' ~/micropython/ports/esp8266/esp8266.ld
make -j12
Note that

Code: Select all

sed -i 's/irom0_0_seg :  org = 0x40209000, len = 0x8f000/irom0_0_seg :  org = 0x40209000, len = 0xc7000/' ~/micropython/ports
makes the firmware size bigger because I didn't have enough space for all my frozen modules.

This is my build script:

Code: Select all

#!/usr/bin/env bash
cd ~/micropython/ports/esp8266
export PATH=/home/kevin/esp-open-sdk/xtensa-lx106-elf/bin:$PATH
make clean
make -j12
you'll have to replace "home/kevin" with your username of course.
Hope this'll help.
Kevin Köck
Micropython Smarthome Firmware (with Home-Assistant integration): https://github.com/kevinkk525/pysmartnode

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: Cannot get Vagrant Up

Post by jimmo » Sun Oct 13, 2019 11:23 pm

Another option here is to use Docker. I don't know much about using Docker from Windows, but I understand it is possible. Here's how I build ESP8266 firmware on Linux:

Code: Select all

cd src/github.com/micropython/micropython
cd mpy-cross
docker run --rm -v $HOME:$HOME -u $UID -w $PWD larsks/esp-open-sdk make -j 16
cd ../ports/esp8266
docker run --rm -v $HOME:$HOME -u $UID -w $PWD larsks/esp-open-sdk make -j 16
This uses my host PC's git repo, and writing the output files there, but all the building and running happens inside the docker container.

I'm using "--rm" to throw away the temporary container at the end as all the persistent state (build output, etc) ends up on the host PC. You'll need to adjust the various $HOME etc to work on Windows. If you get this working please let me know and I'll add it to the README.

Post Reply