Toolchain for development of RTOS applications for ESP8266 using WSL 1 (Windows Subsystem for Linux) and programming using USB-UART converter. Using WSL makes it portable across multiple Windows devices.
- WSL 1 directly maps connected COMX devices to /dev/ttySX files
- WSL 2 works using usbipd, but:
- After disconnecting the device you have to attach it manually again
- Interacting with files that are being stored on Windows filesystem is slow (stackoverflow)
- Oracle VirtualBox provide COM ports mapping for virtual machines, but:
- After testing it using AntiX 23.1 Core virtual machine, there is a significant delay that made it impossible to program an ESP
- While receiving longer messages by UART (using monitor tool), part of the message is being lost
- Docker cannot be used on Windows, because as of today (15.07.2024) it doesn't support mapping USB devices to containers
For example Documents/WSL_Distros/
You can use this folder or create another one to manage multiple toolchain WSL's.
You can open command line in given folder by typing cmd in file explorer url tab.
It can be achieved by using command below or by installing it using Windows Store.
wsl --install -d Debian
Go through installation steps, newly created account doesn't matter as is the next step the machine is going to be exported and it will lose all users accounts.
Export Debian image to debianExport file.
wsl --export Debian debianExport
Import previously exported image here to machine named Debian_ESP8266 using WSL 1.
wsl --import Debian_ESP8266 . debianExport --version 1
(Optional) You can delete debianExport file.
del debianExport
Espressif provides Get Started guide where every configuration step is done manually, but there are installation scripts inside of ESP8266 RTOS SDK repository which are going to be used in this guide.
Open WSL in current folder.
wsl -d Debian_ESP8266
Get updates and install them.
sudo apt-get update
sudo apt-get upgrade
Slightly modified prompt from here.
sudo apt-get install gcc git wget make libncurses-dev flex bison gperf python3 python3-pip virtualenv python-is-python3
Now you can download ESP8266 RTOS SDK.
git clone --recursive https://github.com/espressif/ESP8266_RTOS_SDK.git
cd ESP8266_RTOS_SDK
sudo ./install.sh
And then export environmental variables using export.sh
script. It has to be sourced.
source export.sh
They will persist until you close current login session.
Modify .bashrc
file to execute export script everytime you login into WSL.
sudo nano ~/.bashrc
Add following lines to the end of the file. IDF_PATH is a path to previously cloned repository on your machine.
export IDF_PATH="$HOME/ESP8266_RTOS_SDK"
source $IDF_PATH/export.sh > /dev/null
Source command output is redirected to /dev/null
as export.sh
would print some information everytime you login to the system.