ESP8266 esp-open-rtos and esp-open-sdk
Download and Installation
Install esp-open-sdk (to be updated)
Dependencies
If are using Debian GNU/Linux or a Debian based GNU/Linux distribution:
$ sudo apt-get install ncdu 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 python-pip
You need atleast 3GB of free disk space. Compilation may take a lot of time depending on your processing power. Fast internet connection for downloading other dependencies.
Clone the repository
$ git clone --recursive https://github.com/pfalcon/esp-open-sdk.git
Building
To build the self-contained, standalone toolchain+SDK with vendor binary blobs:
$ make STANDALONE=y
The binary blobs are not recommended! You must abide by their licensing terms.
To build the bare Xtensa toolchain and leave ESP8266 SDK separate:
$ make STANDALONE=n
Delete the cached files. Use ncdu to find the largest files and delete them or just use make clean. (NOT TESTED)
Install esptool.py
$ pip install esptool.py
Collecting esptool
Downloading https://files.pythonhosted.org/packages/51/9e/1abfb18922eeab54f0e38e7d0f113f18b285048a8d9b827f56927a848ee5/esptool-2.5.1.tar.gz (75kB)
100% |████████████████████████████████| 81kB 24kB/s
Collecting ecdsa (from esptool)
Downloading https://files.pythonhosted.org/packages/63/f4/73669d51825516ce8c43b816c0a6b64cd6eb71d08b99820c00792cb42222/ecdsa-0.13-py2.py3-none-any.whl (86kB)
100% |████████████████████████████████| 92kB 37kB/s
Collecting pyaes (from esptool)
Downloading https://files.pythonhosted.org/packages/44/66/2c17bae31c906613795711fc78045c285048168919ace2220daa372c7d72/pyaes-1.6.1.tar.gz
Collecting pyserial>=3.0 (from esptool)
Downloading https://files.pythonhosted.org/packages/0d/e4/2a744dd9e3be04a0c0907414e2a01a7c88bb3915cbe3c8cc06e209f59c30/pyserial-3.4-py2.py3-none-any.whl (193kB)
100% |████████████████████████████████| 194kB 43kB/s
Building wheels for collected packages: esptool, pyaes
Running setup.py bdist_wheel for esptool ... done
Stored in directory: /home/user/.cache/pip/wheels/4b/03/99/cb358131acc8e50b6fd724e39e050751464d85245c73de5ea0
Running setup.py bdist_wheel for pyaes ... done
Stored in directory: /home/user/.cache/pip/wheels/bd/cf/7b/ced9e8f28c50ed666728e8ab178ffedeb9d06f6a10f85d6432
Successfully built esptool pyaes
Installing collected packages: ecdsa, pyaes, pyserial, esptool
Successfully installed ecdsa-0.13 esptool-2.5.1 pyaes-1.6.1 pyserial-3.4
user@android-04b5369f14bc47c1:~/Documents/PRJ/PROD/alpha/esp_wnats$ esptool.py
usage: esptool [-h] [--chip {auto,esp8266,esp32}] [--port PORT] [--baud BAUD]
Add the xtensa path and python .local/bin to the .bashrc PATH so you can invoke make anywhere:
replace /home/user/ESP/esp-open-sdk with your esp-open-sdk path
export PATH="/home/user/.local/bin:/home/user/ESP/esp-open-sdk/xtensa-lx106-elf/bin/"
Build the blinky example:
$ cd /home/user/ESP/esp-open-sdk/examples/blinky
$ make
$ make flash
$ sudo esptool.py -p /dev/ttyUSB0 --baud 115200 write_flash -fs 32m -ff 40m -fm dout 0 blinky-0x00000.bin 0x10000 blinky-0x10000.bin
Your GPIO 2 LED should blink! Tested on WeMos D1 mini (NONOS-SDK)
Building and Installing esp-open-rtos
$ git clone --recursive https://github.com/Superhouse/esp-open-rtos.git
$ cd esp-open-rtos
Build and Flashing the blink example:
$ cd examples/blink
$ make
$ sudo esptool.py -p /dev/ttyUSB0 --baud 115200 write_flash -fs 4MB -fm dout -ff 40m 0x0 ../../bootloader/firmware_prebuilt/rboot.bin 0x1000 ../../bootloader/firmware_prebuilt/blank_config.bin 0x2000 ./firmware/blink.bin
Command output:
CC /home/user/ESP/esp-open-rtos/open_esplibs/libmain/user_interface.c
CC /home/user/ESP/esp-open-rtos/open_esplibs/libmain/ets_timer.c
CC /home/user/ESP/esp-open-rtos/open_esplibs/libmain/spi_flash.c
CC /home/user/ESP/esp-open-rtos/open_esplibs/libmain/os_cpu_a.c
CC /home/user/ESP/esp-open-rtos/open_esplibs/libmain/uart.c
CC /home/user/ESP/esp-open-rtos/open_esplibs/libmain/misc.c
CC /home/user/ESP/esp-open-rtos/open_esplibs/libmain/timers.c
AS /home/user/ESP/esp-open-rtos/open_esplibs/libmain/xtensa_context.S
AR build/open_esplibs_libmain.a
CC /home/user/ESP/esp-open-rtos/open_esplibs/libnet80211/ieee80211_hostap.c
CC /home/user/ESP/esp-open-rtos/open_esplibs/libnet80211/wl_cnx.c
CC /home/user/ESP/esp-open-rtos/open_esplibs/libnet80211/ieee80211_ets.c
CC /home/user/ESP/esp-open-rtos/open_esplibs/libnet80211/ieee80211_input.c
CC /home/user/ESP/esp-open-rtos/open_esplibs/libnet80211/ieee80211_sta.c
AR build/open_esplibs_libnet80211.a
CC /home/user/ESP/esp-open-rtos/open_esplibs/libphy/phy_chip_v6.c
CC /home/user/ESP/esp-open-rtos/open_esplibs/libphy/phy.c
CC /home/user/ESP/esp-open-rtos/open_esplibs/libphy/phy_sleep.c
AR build/open_esplibs_libphy.a
CC /home/user/ESP/esp-open-rtos/open_esplibs/libpp/pm.c
CC /home/user/ESP/esp-open-rtos/open_esplibs/libpp/if_hwctrl.c
CC /home/user/ESP/esp-open-rtos/open_esplibs/libpp/pp.c
CC /home/user/ESP/esp-open-rtos/open_esplibs/libpp/esf_buf.c
CC /home/user/ESP/esp-open-rtos/open_esplibs/libpp/lmac.c
CC /home/user/ESP/esp-open-rtos/open_esplibs/libpp/wdev.c
AR build/open_esplibs_libpp.a
CC /home/user/ESP/esp-open-rtos/open_esplibs/libwpa/os_xtensa.c
CC /home/user/ESP/esp-open-rtos/open_esplibs/libwpa/wpa_main.c
AR build/open_esplibs_libwpa.a
CC /home/user/ESP/esp-open-rtos/examples/blink/blink.c
AR build/program.a
CC /home/user/ESP/esp-open-rtos/FreeRTOS/Source/queue.c
CC /home/user/ESP/esp-open-rtos/FreeRTOS/Source/croutine.c
CC /home/user/ESP/esp-open-rtos/FreeRTOS/Source/list.c
CC /home/user/ESP/esp-open-rtos/FreeRTOS/Source/stream_buffer.c
CC /home/user/ESP/esp-open-rtos/FreeRTOS/Source/event_groups.c
CC /home/user/ESP/esp-open-rtos/FreeRTOS/Source/tasks.c
CC /home/user/ESP/esp-open-rtos/FreeRTOS/Source/timers.c
CC /home/user/ESP/esp-open-rtos/FreeRTOS/Source/portable/esp8266/port.c
AR build/freertos.a
CC /home/user/ESP/esp-open-rtos/lwip/sys_arch.c
CC /home/user/ESP/esp-open-rtos/lwip/esp_interface.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/api/netdb.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/api/api_lib.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/api/netifapi.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/api/tcpip.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/api/netbuf.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/api/if_api.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/api/err.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/api/api_msg.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/api/sockets.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/core/mem.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/core/init.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/core/memp.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/core/sys.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/core/tcp.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/core/dns.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/core/timeouts.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/core/ip.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/core/def.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/core/raw.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/core/tcp_in.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/core/pbuf.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/core/netif.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/core/stats.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/core/altcp.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/core/inet_chksum.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/core/altcp_tcp.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/core/udp.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/core/tcp_out.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/core/ipv4/ip4_frag.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/core/ipv4/dhcp.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/core/ipv4/etharp.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/core/ipv4/ip4_addr.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/core/ipv4/igmp.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/core/ipv4/ip4.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/core/ipv4/autoip.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/core/ipv4/icmp.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/core/ipv6/ip6_frag.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/core/ipv6/dhcp6.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/core/ipv6/inet6.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/core/ipv6/ip6_addr.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/core/ipv6/ip6.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/core/ipv6/nd6.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/core/ipv6/mld6.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/core/ipv6/ethip6.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/core/ipv6/icmp6.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/netif/slipif.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/netif/ethernet.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/netif/bridgeif_fdb.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/netif/lowpan6.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/netif/bridgeif.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/netif/ethernetif.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/apps/lwiperf/lwiperf.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/apps/sntp/sntp.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/apps/tftp/tftp_server.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/apps/netbiosns/netbiosns.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/apps/snmp/snmp_threadsync.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/apps/snmp/snmp_scalar.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/apps/snmp/snmp_netconn.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/apps/snmp/snmp_mib2.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/apps/snmp/snmp_asn1.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/apps/snmp/snmp_pbuf_stream.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/apps/snmp/snmp_mib2_tcp.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/apps/snmp/snmp_mib2_system.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/apps/snmp/snmp_mib2_ip.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/apps/snmp/snmpv3_mbedtls.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/apps/snmp/snmpv3.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/apps/snmp/snmp_mib2_snmp.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/apps/snmp/snmp_traps.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/apps/snmp/snmp_mib2_interfaces.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/apps/snmp/snmp_core.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/apps/snmp/snmp_msg.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/apps/snmp/snmp_mib2_icmp.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/apps/snmp/snmp_raw.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/apps/snmp/snmp_table.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/apps/snmp/snmp_snmpv2_framework.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/apps/snmp/snmp_snmpv2_usm.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/apps/snmp/snmp_mib2_udp.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/apps/smtp/smtp.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/apps/mdns/mdns.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/apps/http/http_client.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/apps/http/fsdata.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/apps/http/httpd.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/apps/http/fs.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/apps/mqtt/mqtt.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/apps/altcp_tls/altcp_tls_mbedtls_mem.c
CC /home/user/ESP/esp-open-rtos/lwip/lwip/src/apps/altcp_tls/altcp_tls_mbedtls.c
AR build/lwip.a
CC /home/user/ESP/esp-open-rtos/core/esp_interrupts.c
CC /home/user/ESP/esp-open-rtos/core/app_main.c
CC /home/user/ESP/esp-open-rtos/core/spiflash.c
CC /home/user/ESP/esp-open-rtos/core/esp_spi.c
CC /home/user/ESP/esp-open-rtos/core/sdk_compat.c
CC /home/user/ESP/esp-open-rtos/core/sysparam.c
CC /home/user/ESP/esp-open-rtos/core/esp_gpio.c
CC /home/user/ESP/esp-open-rtos/core/phy_info.c
CC /home/user/ESP/esp-open-rtos/core/esp_phy.c
CC /home/user/ESP/esp-open-rtos/core/newlib_syscalls.c
CC /home/user/ESP/esp-open-rtos/core/esp_iomux.c
CC /home/user/ESP/esp-open-rtos/core/esp_timer.c
CC /home/user/ESP/esp-open-rtos/core/esp_hwrand.c
CC /home/user/ESP/esp-open-rtos/core/debug_dumps.c
AS /home/user/ESP/esp-open-rtos/core/exception_vectors.S
AS /home/user/ESP/esp-open-rtos/core/spiflash-cache-enable.S
C++ /home/user/ESP/esp-open-rtos/core/cplusplus_operators.cpp
AR build/core.a
AR build/open_esplibs.a
Removing unwanted objects from ../../lib/libgcc.a
Removing unwanted objects from ../../libc/xtensa-lx106-elf/lib/libc.a
SDK processing stage 1: Removing unwanted objects from ../../lib/libmain.a
SDK processing stage 2: Renaming symbols in SDK library build/sdklib/libmain_stage1.a -> build/sdklib/libmain.a
SDK processing stage 1: Removing unwanted objects from ../../lib/libnet80211.a
SDK processing stage 2: Renaming symbols in SDK library build/sdklib/libnet80211_stage1.a -> build/sdklib/libnet80211.a
SDK processing stage 1: Removing unwanted objects from ../../lib/libphy.a
SDK processing stage 2: Renaming symbols in SDK library build/sdklib/libphy_stage1.a -> build/sdklib/libphy.a
SDK processing stage 1: Removing unwanted objects from ../../lib/libpp.a
SDK processing stage 2: Renaming symbols in SDK library build/sdklib/libpp_stage1.a -> build/sdklib/libpp.a
SDK processing stage 1: Removing unwanted objects from ../../lib/libwpa.a
SDK processing stage 2: Renaming symbols in SDK library build/sdklib/libwpa_stage1.a -> build/sdklib/libwpa.a
LD build/blink.out
FW firmware/blink.bin
esptool.py v2.5.0
Serial port /dev/ttyUSB0
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
MAC: 6x:xx:xx:xx:xx:xx
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Flash params set to 0x0340
Compressed 3104 bytes to 2169...
Wrote 3104 bytes (2169 compressed) at 0x00000000 in 0.2 seconds (effective 121.1 kbit/s)...
Hash of data verified.
Compressed 2048 bytes to 23...
Wrote 2048 bytes (23 compressed) at 0x00001000 in 0.0 seconds (effective 1833.1 kbit/s)...
Hash of data verified.
Compressed 253972 bytes to 186267...
Wrote 253972 bytes (186267 compressed) at 0x00002000 in 17.1 seconds (effective 119.1 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting via RTS pin...
Your GPIO 2 LED should now blink every 1s! (RTOS-SDK)
References:
https://github.com/pfalcon/esp-open-sdk
https://github.com/SuperHouse/esp-open-rtos
TODO
Upload screenshots
Except where otherwise noted, this work is licensed under Creative Commons Attribution-ShareAlike 4.0 International License (http://creativecommons.org/licenses/by-sa/4.0/).
I hope that this post is useful to you, if you liked this post you may support me via liberapay. Thank you for your support.