-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVagrantfile
87 lines (73 loc) · 2.43 KB
/
Vagrantfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/bionic64"
config.vm.provider "virtualbox" do |vb|
vb.memory = "2048"
end
config.vm.provision "build",
type: "shell",
privileged: false,
inline: <<-SHELL
# Update the OS.
sudo apt-get update
sudo apt-get -y upgrade
# Install needed applications
sudo apt-get -y 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 libtool-bin python-pip cmake
# setup alternatives for pyhon and install needed apps.
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 1
sudo python -m pip install pyserial 'pyparsing<2.4'
#get and install the esp sdk for esp8266
git clone --recursive https://github.com/pfalcon/esp-open-sdk.git
cd esp-open-sdk/
make STANDALONE=y
echo "export PATH=/home/vagrant/esp-open-sdk/xtensa-lx106-elf/bin:$PATH" >> ~/.bashrc
export PATH=/home/vagrant/esp-open-sdk/xtensa-lx106-elf/bin:$PATH
# Install the esp-idf
cd ~
git clone https://github.com/espressif/esp-idf.git
cd esp-idf
git checkout 6ccb4cf5b7d1fdddb8c2492f9cbc926abaf230df
git submodule update --init --recursive
# install the esp32 build tools.
cd ~
wget https://dl.espressif.com/dl/xtensa-esp32-elf-linux64-1.22.0-80-g6c4433a-5.2.0.tar.gz
mkdir -p ~/esp
cd ~/esp
tar -xzf ~/xtensa-esp32-elf-linux64-1.22.0-80-g6c4433a-5.2.0.tar.gz
# Clone the micropython and setup the cross compiler.
cd ~
git clone https://github.com/micropython/micropython.git
cd micropython
git submodule update --init
make -C mpy-cross
SHELL
config.vm.provision "update",
run: 'always',
type: "shell",
privileged: false,
inline: <<-SHELL
# Delete existin bin files
rm -f /vagrant/*.bin
#set variables
export PATH=~/esp/xtensa-esp32-elf/bin:/home/vagrant/esp-open-sdk/xtensa-lx106-elf/bin:$PATH
export ESPIDF=/home/vagrant/esp-idf
# update micropython
cd ~
cd micropython
git pull
#compile esp8266
cd ports/esp8266
sudo chown -r vagrant /vagrant/modules
cp -r /vagrant/modules/* ./modules
make clean
make
cp build-GENERIC/firmware-combined.bin /vagrant/micropython-esp8266.bin
#compile esp32.
cd ~/micropython/ports/esp32
cp -r /vagrant/modules/* ./modules
make clean
make PYTHON=python2
cp build-GENERIC/firmware.bin /vagrant/micropython-esp32.bin
SHELL
end