ESP8266 non-os SDK problems

I’m trying to call os_delay_us from the esp8266 sdk. However, I’m getting the following error:

lib/PCA9685Lib/PCA9685Lib.cpp: In member function 'uint8_t PCA9685::setSleep(bool)':
lib/PCA9685Lib/PCA9685Lib.cpp:39:24: error: 'ets_delay_us' was not declared in this scope
os_delay_us(600);
^
*** [.pioenvs/esp12e/lib/PCA9685Lib/PCA9685Lib.o] Error 1

It apparently is finding the header file “osapi.h” fine, because that is there os_delay_us is defined as ets_delay_us. However, it is missing the .ld file that has the location of that system call.

How do I fix this?

More information!

I’ve figured out that you need to explicitly pass a -T<ld script filename> flag to the linker, however, I don’t know how to do that for private libraries…

You need to create library.json file i nthe root of fodler and specify custom flags. See Redirecting...

Thanks!

For those that come before me, unfortunately this didn’t fix the problem. The problem was fixed by making sure that the esp headers were wrapped in extern "C" context.