August 11, 2018

The ESP8266 -- Updating the SDK

On August 10, 2018 I recevied an email from Paulo. He had cloned some of my ESP8266 stuff from Github and was getting compile errors. In particular, his setup was unable to find the routine uart_div_modify() in the SDK libraries. I can build my example just fine, so my theory is that he is using a more up to date version of the SDK and they have made changes to some of the API calls. So I figured it might be worth my while to find out what is currently available and what I am actually using.

My old SDK

A quick peek shows that I am running version 1.5.0, which is no longer available. The dates on the zip file I have stashed suggest that I installed this in November of 2015. A lot has changed (and improved!) since then, particularly documentation. The Espressif web site offers 2.2.1 (with June, 2018 dates) as the latest thing in the NONOS version. I have never done anything with the FreeRTOS version.

The compiler I am running is /opt/esp-open-sdk/xtensa-lx106-elf/bin/xtensa-lx106-elf-gcc which I access by having /opt/esp-open-sdk/xtensa-lx106-elf/bin on my search path.

xtensa-lx106-elf-gcc --version
xtensa-lx106-elf-gcc (crosstool-NG 1.20.0) 4.8.2

What should I do?

For now I am not going to install the new SDK. What I did in 2015 was to use the pfalcon scheme, which as I remember built things from source pulling from a variety of sources. It would no doubt be worth repeating this and updating my setup, but not just right now.

What about Paulo and his missing uart_div_modify() ?

As it turns out this routine is in the bootrom at address 0x400039d8. The same is true of the symbol ets_delay_us() at address 0x40002ecc -- which his setup apparently finds just fine.

The linker finds symbols like this via "provide" statements in the file /opt/esp-open-sdk/sdk/ld/eagle.app.v6.ld. On my system, the last line in this file is INCLUDE "../ld/eagle.rom.addr.v6.ld" which pulls in the definitions, which look like:

PROVIDE ( uart_div_modify = 0x400039d8 );
PROVIDE ( ets_delay_us = 0x40002ecc );
I download the latest tarball for the SDK, extract files from it, and take a look at ESP8266_NONOS_SDK-2.2.1/ld/eagle.rom.addr.v6.ld. Indeed, for one reason or other the provide statement for uart_div_modify() has been deleted from the file in the current SDK -- it would be easy enough to use and editor and add the following line:
PROVIDE ( uart_div_modify = 0x400039d8 );