ESP8266: Sming Framework on Arch Linux
Sming is an open source Framework for ESP8266 Wi-Fi Module. It simplifies development my allowing advanced features to be implemented with trivial amount of code compared to low level programming. Sming and Eclipse IDE can also be used to write, compile and flash Sming projects instead of using command line tools.
Install common dependencies.
sudo pacman -S git gperf help2man
Missing dependencies will result in configure: error: missing required tool: gperf
and configure: error: missing required tool: help2man
errors respectively when attempting to compile.
Install Espressif SDK
Change current directory to the installation directory.
cd /opt
Clone the esp-open-sdk repository from Git.
sudo git clone --recursive https://github.com/pfalcon/esp-open-sdk.git
Change file ownership to match the current user.
sudo chown -R dom:users /opt/esp-open-sdk
By default /opt
directory is owned by root and would result in error: could not lock config file .git/config: Permission denied
message when attempting to compile. Since root is not allowed to execute make command in this case, write permissions must be granted to an unprivileged user.
Change current directory to the newly downloaded repository.
cd /opt/esp-open-sdk
Compile the SDK.
make STANDALONE=y
Compiling will take quite a while and stress the CPU significantly.
Install Sming Framework
Change current directory to the installation directory.
cd /opt
Clone the Sming repository from Git.
sudo git clone https://github.com/SmingHub/Sming.git
By default a Develop branch is cloned. This can be changed to master branch with git checkout origin/master command. Develop branch is recommended since there may actually be more issues with master branch.
Change current directory to the downloaded repository.
cd /opt/Sming/Sming
Change file ownership to match the current user.
sudo chown -R dom:users /opt/Sming
This is optional but allows to compile without root privileges.
Compile Sming.
make
Compile spiffy file system if desired.
make spiffy
Install esptools
Install the required dependencies.
sudo pacman -S python2 python python2-pyserial python-pyserial unzip
Both python 2 and python 3 serial packages are required or compilation will fail with an /usr/bin/python: Error while finding spec for 'serial.tools.miniterm' (<
class ‘ImportError’>: No module named ‘serial’) error message.
Change current directory to the installation directory.
cd /opt/esp-open-sdk/esptool
Clone the Sming repository from Git.
sudo git clone https://github.com/themadinventor/esptool.git
Open the esptool python script.
nano /opt/esp-open-sdk/esptool/esptool.py
Change the default python version that esptool uses and save the file.
#!/usr/bin/env python2
On Arch Linux python 3 is the default interpreter and so it needs to be changed from the default python
to python2
.
Install esptools2
Change current directory to the SDK installation directory.
cd /opt/esp-open-sdk
Clone the esptool2 repository from Git.
git clone https://github.com/raburton/esptool2
Change current directory to the downloaded repository.
cd esptool2
Compile esptool2.
sudo make
Set Environmental Variables
Open the configuration file that will be executed every time an interactive non-login shell is started.
sudo nano ~/.bashrc
Append the environmental variables and save the file.
# esptool export ESP_HOME=/opt/esp-open-sdk export PATH=$PATH:$ESP_HOME/esptool2 # Sming Framework export SMING_HOME=/opt/Sming/Sming export ESP_HOME=/opt/esp-open-sdk
The first two variables set the esptool
and esptool2
paths respectively. Failing to set environmental variables will lead to compilation failure with make: esptool2: Command not found
error.
Remaining two variables the SMING_HOME
and ESP_HOME
paths which otherwise would need to be set in the project’s Makefile-user.mk
file. When the variables are not set an error message Makefile:13: *** SMING_HOME is not set. Please configure it in Makefile-user.mk. Stop.
is returned.
Flash ESP8266 with Sming Code
Add current user to uucp group.
sudo usermod -a -G uucp dom
USB devices are owned by root owner and uucp group by default. Adding the user to the group is the ideal way to get access to USB devices. For changes to take effect the user needs to re-login or serial.serialutil.SerialException: [Errno 13] could not open port /dev/ttyUSB0: [Errno 13] Permission denied: '/dev/ttyUSB0'
message will be displayed when attempting to compile projects.
Change the current directory to the sample project directory.
cd /opt/Sming/samples/Basic_Blink
Edit the user makefile to set required variables.
nano Makefile-user.mk
Uncomment and if necessary change ESP_HOME
variable value to /opt/esp-open-sdk
and SMING_HOME
to /opt/Sming/Sming
. This step must be carried out for each project unless the environmental variables are being set automatically when interactive shell is started.
Compile.
make
Clean if needed.
make clean
Cleaning removes leftover files from previously compiled projects and resolves make: Nothing to be done for 'all'
error.
Flash ESP8266 module.
make flash
After successful flashing exit miniterm with CTRL
+ ]
command.
The following error will be generated if the ESP8266 module is disconnected or not in flash mode.
Not connected or Not reconnected after flash A fatal error occurred: Failed to connect to ESP8266 /home/dom/Sming/Sming/Makefile-project.mk:331: recipe for target 'flash' failed make: *** [flash] Error 2
Depending on the hardware configuration this may happen when device has not been power cycled after flashing.
For a more integrated and streamlined workflow configure Sming Framework with Eclipse.