diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..378eac2 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..0ff1a08 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM ubuntu:21.10 + +ENV TZ=Etc/UTC +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +RUN apt-get update +RUN apt-get -y install bash git cmake python3 python3-pip python3-virtualenv python3-cryptography python3-future python3-click python3-serial python3-wheel python3-pyparsing python3-pyelftools +RUN ln -s /usr/bin/python3 /usr/bin/python + +RUN git clone --recursive https://github.com/espressif/ESP8266_RTOS_SDK.git --branch v3.4 +RUN cd /ESP8266_RTOS_SDK && PYTHONPATH=/usr/lib/python3.9/site-packages ./install.sh +RUN echo "source /ESP8266_RTOS_SDK/export.sh" >> ~/.bashrc + diff --git a/README.md b/README.md index a5cc8b8..da18843 100644 --- a/README.md +++ b/README.md @@ -2,38 +2,47 @@ ## How to run this -This implements Linux Wifi NIC on top of UART and ESP8266 +This implements Wifi NIC on top of UART and ESP8266. The NIC can be used either on Linux using provided script or attached to another MCU and integrated with LwIP as network interface. -- Make sure your Linux supports tap devices -- Compile this -- Flash the binary into ESP -- Tune constants in tap/tap.py -- Run tap/tap.py -- Check tap device was created -- (Run dhcp client on tap device) -- Check this works as (terribly slow) network interface +## Build environment + +Either build docker image as described by provided Dockerfile or proceed according to the [ESP8266 RTOS SDK user manual](https://docs.espressif.com/projects/esp8266-rtos-sdk/en/latest/get-started/index.html) +## Build -## Configure the project +This assumes SDK environemnt was sources and current directory is checked out root of the project. + +Build the project and flash it to the board, then run monitor tool to view serial output: ``` -idf.py menuconfig +idf.py all ``` -* Set serial port under Serial Flasher Options. +## Flash from printer -* Set WiFi SSID and WiFi Password and Maximum retry under Example Configuration Options. +Create ESP directory in the root of the USB flash drive. Copy following files to it: -## Build and Flash +- `build/partition_table/partition-table.bin` +- `build/bootloader/bootloader.bin` +- `build/uart_wifi.bin` -Build the project and flash it to the board, then run monitor tool to view serial output: +Insert it into printer and start ESP flash from the menu. + +## Flash using USB "programmer" + +Reset ESP with IO0 down and issue the following command. ``` -idf.py -p PORT flash monitor +idf.py -p /dev/ttyXXX flash ``` -(To exit the serial monitor, type ``Ctrl-]``.) - -See the Getting Started Guide for full steps to configure and use ESP-IDF to build projects. +## Test on Linux -``` +- Make sure your Linux supports tap devices +- Compile this +- Flash the binary into ESP +- Tune constants in tap/tap.py +- Run tap/tap.py +- Check tap device was created +- (Run dhcp client on tap device) +- Check this works as (terribly slow) network interface \ No newline at end of file