Sming Esp8266 Architecture

Support building Sming for the Esp8266 architecture.

This is the SOC for which Sming was originally developed, so many of the low-level API calls reflect those in the SDK. These include functions such as system_get_free_heap_size(), system_update_cpu_freq(), system_get_cpu_freq(), esp_get_ccount() and others.

The Esp8266 is the device which popularised 32-bit microcontrollers with integrated WiFi capability, the so-called System on a chip (SoC).

Features

Characteristics

Compared with more recent offerings such as the ESP32 and RP2040, it has characteristics which require special consideration:

Limited RAM

Typically around 50 KiB of RAM is available for user applications, compared with over 200 KiB for the Rp2040 and 300 KiB for the Esp32. Although applications not requiring WiFi can recover another 30 KiB via esp_no_wifi, careful use of RAM is a primary consideration. See Memory.

Word-aligned SPI flash accesses

Flash memory is relatively plentiful, provided via high-speed serial SPI. Because it is not internal to the SoC, the Esp8266 (and others) have hardware which supports mapping areas of external memory into the address space so that code and data can be accessed using standard machine instructions. The Esp8266 has a particular quirk in that all such accesses must be properly aligned to 32-bit word boundaries; failure to do this crashes the system. Other microcontrollers have better caching which handles misaligned accesses without issue. See :doc:`/information/flash’.

Weak hardware peripheral support

Even compared to older Atmel or Microchip 8-bit microcontrollers, hardware support for interfaces such as I2C and PWM is lacking and these must be implemented in software.

ESP Quick Toolchain

In Sming 4.0.1 support was added for the ESP Quick Toolchain. This is the required toolchain for compiling Sming for the Esp8266.

At time of writing the current release is 3.0.0-newlib4.0.0-gnu20 for GCC 10.2.

The toolchain is consistent across development platforms which also use the standard C/C++ NewLib runtime libraries.

Installation

The easiest way to get started is with the Sming installer - see Getting Started.

  • Linux and MacOS: Tools/install.sh esp8266.

  • Windows: Tools\install esp8266.

Configuration Variables

ESP_HOME

This contains the base directory for the toolchain used to build the framework. See ESP Quick Toolchain.

The Sming installer extracts the toolchain to:

  • /opt/esp-quick-toolchain for linux and MadOS

  • C:\tools\esp-quick-toolchain for Windows

Components