ets_delay_us uint16_t changed to uint32_t in >= SDK 2.2.x [SOLVED]

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
User avatar
mcauser
Posts: 492
Joined: Mon Jun 15, 2015 8:03 am

ets_delay_us uint16_t changed to uint32_t in >= SDK 2.2.x [SOLVED]

Post by mcauser » Sat Aug 22, 2020 2:54 am

On a fresh macOS Mojave install, with pfalcon's esp-open-sdk built in a case sensitive dmg with VENDOR_SDK = 2.2.1
I hit an issue when trying to make in /ports/esp8266.

Code: Select all

./etshal.h:9:6: error: conflicting types for 'ets_delay_us'
 void ets_delay_us(uint16_t us);
If I change it to uint32_t it works. In micropython/ports/esp8266/etshal.h:

Code: Select all

- void ets_delay_us(uint16_t us);
+ void ets_delay_us(uint32_t us);
Has anyone come across this?
Last edited by mcauser on Mon Aug 24, 2020 11:24 pm, edited 2 times in total.

User avatar
mcauser
Posts: 492
Joined: Mon Jun 15, 2015 8:03 am

Re: ets_delay_us uint16_t vs uint32_t

Post by mcauser » Sat Aug 22, 2020 2:55 am

Full error:

Code: Select all

Mikes-MacBook-Pro:esp8266 mike$ make
Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.
GEN build-GENERIC/genhdr/mpversion.h
GEN build-GENERIC/genhdr/qstr.i.last
GEN build-GENERIC/genhdr/qstr.split
GEN build-GENERIC/genhdr/qstrdefs.collected.h
QSTR updated
GEN build-GENERIC/genhdr/qstrdefs.generated.h
GEN build-GENERIC/genhdr/compressed.split
GEN build-GENERIC/genhdr/compressed.collected
Compressed data updated
GEN build-GENERIC/genhdr/compressed.data.h
mkdir -p build-GENERIC/build-GENERIC
mkdir -p build-GENERIC/drivers/bus
mkdir -p build-GENERIC/drivers/dht
mkdir -p build-GENERIC/extmod
mkdir -p build-GENERIC/lib/axtls/crypto
mkdir -p build-GENERIC/lib/axtls/ssl
mkdir -p build-GENERIC/lib/berkeley-db-1.xx/btree
mkdir -p build-GENERIC/lib/berkeley-db-1.xx/mpool
mkdir -p build-GENERIC/lib/embed
mkdir -p build-GENERIC/lib/libc
mkdir -p build-GENERIC/lib/libm
mkdir -p build-GENERIC/lib/littlefs
mkdir -p build-GENERIC/lib/mp-readline
mkdir -p build-GENERIC/lib/netutils
mkdir -p build-GENERIC/lib/oofatfs
mkdir -p build-GENERIC/lib/timeutils
mkdir -p build-GENERIC/lib/utils
mkdir -p build-GENERIC/py
CC ../../py/mpstate.c
CC ../../py/nlr.c
CC ../../py/nlrx86.c
CC ../../py/nlrx64.c
CC ../../py/nlrthumb.c
CC ../../py/nlrpowerpc.c
CC ../../py/nlrxtensa.c
CC ../../py/nlrsetjmp.c
CC ../../py/malloc.c
CC ../../py/gc.c
CC ../../py/pystack.c
CC ../../py/qstr.c
CC ../../py/vstr.c
CC ../../py/mpprint.c
In file included from ./esp_mphal.h:80:0,
                 from ../../py/mphal.h:32,
                 from ../../py/mpprint.c:33:
./etshal.h:9:6: error: conflicting types for 'ets_delay_us'
 void ets_delay_us(uint16_t us);
      ^
In file included from /Volumes/case-sensitive/esp-open-sdk/xtensa-lx106-elf/xtensa-lx106-elf/sysroot/usr/include/arch/cc.h:40:0,
                 from /Volumes/case-sensitive/esp-open-sdk/xtensa-lx106-elf/xtensa-lx106-elf/sysroot/usr/include/lwip/arch.h:43,
                 from /Volumes/case-sensitive/esp-open-sdk/xtensa-lx106-elf/xtensa-lx106-elf/sysroot/usr/include/lwip/debug.h:35,
                 from /Volumes/case-sensitive/esp-open-sdk/xtensa-lx106-elf/xtensa-lx106-elf/sysroot/usr/include/lwip/opt.h:46,
                 from /Volumes/case-sensitive/esp-open-sdk/xtensa-lx106-elf/xtensa-lx106-elf/sysroot/usr/include/lwip/ip_addr.h:35,
                 from /Volumes/case-sensitive/esp-open-sdk/xtensa-lx106-elf/xtensa-lx106-elf/sysroot/usr/include/user_interface.h:30,
                 from ./esp_mphal.h:27,
                 from ../../py/mphal.h:32,
                 from ../../py/mpprint.c:33:
/Volumes/case-sensitive/esp-open-sdk/xtensa-lx106-elf/xtensa-lx106-elf/sysroot/usr/include/osapi.h:33:6: note: previous declaration of 'ets_delay_us' was here
 void ets_delay_us(uint32_t us);
      ^
make: *** [build-GENERIC/py/mpprint.o] Error 1
Mikes-MacBook-Pro:esp8266 mike$


User avatar
mcauser
Posts: 492
Joined: Mon Jun 15, 2015 8:03 am

Re: ets_delay_us uint16_t vs uint32_t

Post by mcauser » Mon Aug 24, 2020 12:52 pm

Interesting...

When I make using docker, it needs to be void ets_delay_us(uint16_t us);. As it is currently in the repo:
https://github.com/micropython/micropyt ... tshal.h#L9

Code: Select all

cd ports/esp8266
docker run --rm -v $HOME:$HOME -u $UID -w $PWD larsks/esp-open-sdk make
When I make using esp-open-sdk in a case-sensitive.dmg, it needs to be void ets_delay_us(uint32_t us);.

Code: Select all

export PATH=$PATH:/Volumes/case-sensitive/esp-open-sdk/xtensa-lx106-elf/bin
cd ports/esp8266
make

User avatar
mcauser
Posts: 492
Joined: Mon Jun 15, 2015 8:03 am

Re: ets_delay_us uint16_t vs uint32_t

Post by mcauser » Mon Aug 24, 2020 12:57 pm

OK so, I have figured out why now.
In my case-sensitive.dmg "on the metal" esp-open-sdk, I was bumping the VENDOR_SDK from 2.1.0 to 2.2.1
However... In >= 2.2.0, ets_delay_us() was updated to use a uint32_t!

ESP8266_NONOS_SDK-2.1.0 /include/osapi.h

Code: Select all

void ets_delay_us(uint16_t us);
ESP8266_NONOS_SDK-2.2.0 /include/osapi.h

Code: Select all

void ets_delay_us(uint32_t us);
ESP8266_NONOS_SDK-2.2.1 /include/osapi.h

Code: Select all

void ets_delay_us(uint32_t us);

Post Reply