Skip to content

ESP SDK Differences

Angus Gratton edited this page Jul 10, 2016 · 1 revision

Espressif RTOS SDK vs esp-open-rtos

esp-open-rtos is different in some significant ways to Espressif's official RTOS SDK. This document covers the main differences.

Functions stored in flash

In Espressif's SDK, function code is stored in instruction RAM by default. As there is only 32KB of instruction RAM, most functions need annotating with the ICACHE_FLASH_ATTR attribute in order to move them to flash.

In esp-open-rtos, function code is stored in flash by default. Code which need to be called very often with high performance, or which need to be called while flash is unmapped, can be annotated with the IRAM attribute defined in common_macros.h to store it in instruction RAM.

const data stored in flash

In Espressif's SDK, constant data (including all string literals) is stored in data RAM by default. As there is only 80KB of data RAM total (including for stack/heap/etc), this can have a large impact on available RAM. The ICACHE_RODATA_ATTR attribute can be used to move some data to flash, but accessing this data can only be done via 32-bit word reads.

In esp-open-rtos, constant data (including all string literals) is stored in flash by default to save RAM. An exception handler works around the issue of requiring 32-bit word reads, so data stored in flash can be read as if it were stored in RAM.

Reading data from flash is still slower than reading from RAM, however most applications do not notice significant slowdowns overall (see some worst-case benchmarks/discussion here). If you have constant data that you need to access at maximum speed, you can annotate it with the RAM attribute defined in common_macros.h - or memcpy it into a non-const memory buffer before you need to use it.

mbedTLS library

Espressif's SDK uses the axTLS library for encrypted TLS communication. esp-open-rtos uses the more up to date mbedTLS library, and no longer bundles axTLS. See the examples directory for some examples of code using mbedTLS.

DHCP server

esp-open-rtos bundles a different DHCP server to the one included with Espressif's SDK. Find it under extras/dhcpserver.

The access_point example includes sample code for initialising and using the DHCP server.

Newer SDK functions missing

esp-open-rtos still uses Espressif's binary RTOS SDK for many low-level features, such as WiFi radio internals.

For licensing reasons, it is based on Espressif RTOS SDK 0.9.9 rather than newer versions of the SDK (where the license changed). This means that some of the newer features in Espressif's SDK are not found in esp-open-rtos.

If you're missing a particular feature, feel free to a raise a feature request on the Issues page to keep track of it.