ESP8266 SDK 2.0


Catching up with the latest ESP8266_NONOS_SDK_V2.0.0_16_07_19

– got into some issues.

Seems like Espressif integrated some time compatibility functions into libmain.a which i already had into the tree, most likely due mbed tls port

If you have millis(), micros(), mktime() and friends then you may need to comment them out.

There is one exception – open soruce xtensa gcc provides time() which is required by ANSI C so it is in  – platform must provide gettimeofday.
The problem is time() is in libmain from the SDK – so the workaround is to strip time from your libc and use the one in the SDK.

You’ll get an error like:

lib/libmain.a(time.o): In function `time’:
(.irom0.text+0x1dc): multiple definition of `time’
/…/esp-open-sdk/xtensa-lx106-elf/lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/lib/libcirom.a(lib_a-time.o):/…/esp-open-sdk/crosstool-NG/.build/src/newlib-2.0.0/newlib/libc/time/time.c:43: first defined here

To solve:

cd  esp-open-sdk/xtensa-lx106-elf/xtensa-lx106-elf/sysroot/lib/

cp libc.a

xtensa-lx106-elf-objcopy -N time libc.a

and this does the trick.

Firmware booted with sdk 2.0 and looks working.

Happy hacking!


ESP8266 – easy interrupts

While working on a current project i’ve faced an issue with code reuse. Espressif sdk allows only one interrupt handler for all GPIOs. That’s fine for monolithic code but since we like modular code a dispatcher comes handy.

The little inconvenience i’ve had was like this. I wanted to use the drivers/key.c code but it does use the data argument , so i’ve had to modify it to use a global variable. So i can call it from my own interrupt handler. And that is ugly.

So the lab have a brand new GitHub Account – where i’ll share code.

And the remedy for the issue –  new project: esp8266_easyintr .

May need a tweek or two.  I’ve  extracted it from a wip project.


ei_init(); // init easy interrupts
ei_attach(GPIO_NUM, GPIO_MUX, GPIO_FUNC, module_isr, module_data); // setup  handler

You can attach only one per GPIO . You will get your data at the isr and you can have a proper code separation.


KiCad change fields visibility utility

$ open devlog

I’ve back imported footprints for a .cmp file and I’ve misunderstood  kicad’s question about the imported footprints visibility, so all went visible.

And surprise, you can not edit visibility for all fields at once.

So  little utility was born – fixvis.

Usage is pretty simple:

./fixvis file.sch fieldid newval
0 - Reference
1 - Value
2 - Footprint
3 - Datasheet
4+ - custom
newval: 0000 = visible, 0001 = hidden

Example hide all footprints:

./fixvis name.sch 2 0001 > name-nofp.sch

It would be good to have a global toggle option.

$ close devlog