Hi Mike,

Let me explain the mental process I follow to fix this kind of error!

The error message in this case is very "clear"

undefined reference to `pthread_key_create'

So let see where it is defined:

$ cd nuttxspace/nuttx

$ git grep pthread_key_create
...
libs/libc/pthread/pthread_keycreate.c:int pthread_key_create(FAR
pthread_key_t *key,
...

Ok, just open libs/libc/pthread/Make.defs and see what symbol we need
to enable to get pthread_keycreate.c compiled:

ifneq ($(CONFIG_TLS_NELEM),0)
CSRCS += pthread_keycreate.c pthread_setspecific.c pthread_getspecific.c
CSRCS += pthread_keydelete.c
endif

Hmm, basically it is testing if CONFIG_TLS_NELEM != 0

So, open menuconfig:

$ make menuconfig

And search for CONFIG_TLS_NELEM (press "/" inside menuconfig and type
TLS_NELEM and press ENTER)

Bingo:
Symbol: TLS_NELEM [=0]

You will need to increase it.

BR,

Alan

On 9/18/23, Mike Moretti <nu...@mordent.com.invalid> wrote:
> Unfortunately, using master seems to come with yet other problems. I'm
> getting a link error:
>
> xtensa-esp32s3-elf-ld:
> nuttx/staging/libxx.a(cxa_exception_storage.o):(.literal._ZN10__cxxabiv112_GLOBAL__N_110construct_Ev+0xc):
>
> undefined reference to `pthread_key_create'
> xtensa-esp32s3-elf-ld:
> nuttx/staging/libxx.a(cxa_exception_storage.o):(.literal._ZN10__cxxabiv112_GLOBAL__N_19destruct_EPv+0x4):
>
> undefined reference to `pthread_setspecific'
> xtensa-esp32s3-elf-ld:
> nuttx/staging/libxx.a(cxa_exception_storage.o):(.literal.__cxa_get_globals_fast+0xc):
>
> undefined reference to `pthread_getspecific'
> xtensa-esp32s3-elf-ld: nuttx/staging/libxx.a(cxa_exception_storage.o):
> in function `std::__1::__libcpp_tls_create(int*, void (*)(void*))':
> nuttx/include/libcxx/__threading_support:551: undefined reference to
> `pthread_key_create'
> xtensa-esp32s3-elf-ld: nuttx/staging/libxx.a(cxa_exception_storage.o):
> in function `std::__1::__libcpp_tls_set(int, void*)':
> nuttx/include/libcxx/__threading_support:561: undefined reference to
> `pthread_setspecific'
> xtensa-esp32s3-elf-ld: nuttx/staging/libxx.a(cxa_exception_storage.o):
> in function `std::__1::__libcpp_tls_get(int)':
> nuttx/include/libcxx/__threading_support:556: undefined reference to
> `pthread_getspecific'
> xtensa-esp32s3-elf-ld: nuttx/staging/libxx.a(cxa_exception_storage.o):
> in function `std::__1::__libcpp_tls_set(int, void*)':
> nuttx/include/libcxx/__threading_support:561: undefined reference to
> `pthread_setspecific'
>
>
> Our custom app uses C++ and these specific config options (because
> they're necessary for the app to compile):
>
> CONFIG_LIBC_LOCALE=y
> CONFIG_HAVE_CXX=y
> CONFIG_HAVE_CXXINITIALIZE=y
> CONFIG_LIBCXX=y
> CONFIG_LIBCXXABI=y
> CONFIG_CXX_STANDARD="gnu++17"
> CONFIG_CXX_EXCEPTION=y
> CONFIG_CXX_RTTI=y
>
> -m
>
> On 9/18/2023 3:19 PM, Petro Karashchenko wrote:
>> Using a released version is usually better, but since EPS32S3 has active
>> feature development using master can give you better features support.
>> That
>> is obviously a tradeoff you need to make.
>> I'm trying to fix all the issues I meet with ESP32S3 as I'm trying to
>> build
>> a product on top of it, but there are still many features that I hope
>> gona
>> be added soon (like USB host support for example), so I'm staying on
>> master
>> currently.
>>
>> Best regards,
>> Petro
>>
>> пн, 18 вер. 2023 р. о 22:15 Mike Moretti <nu...@mordent.com.invalid>
>> пише:
>>
>>> Hi,
>>>
>>> I'm using 12.2.1, the latest release.  The more I work with this chip
>>> the more I'm wondering if I'm going to have to move to using master.
>>> I've been trying to avoid not using an actual release version of NuttX.
>>>
>>> -m
>>>
>>> On 9/18/2023 3:08 PM, Petro Karashchenko wrote:
>>>> Hello Mike,
>>>>
>>>> Which version of nuttx code are you using? Recently I was dealing with
>>>> UART1/2 on ESP32S3 and managed those to be working in
>>>> https://github.com/apache/nuttx/pull/10467
>>>> There were few issues including some clocking configuration problem as
>>> well
>>>> as wrong pin functions used for UART1.
>>>>
>>>> At the end I was able to even run RS485 with EPS32S3 and make a kind of
>>>> a
>>>> loopback test connecting UART1-RS485 <-> UART2-RS485 on the same device
>>> and
>>>> exchange data between those UARTs.
>>>>
>>>> Please check if your code base contains my fixes.
>>>>
>>>> Looking forward to hearing from you,
>>>> Petro
>>>>
>>>> пн, 18 вер. 2023 р. о 21:59 Mike Moretti <nu...@mordent.com.invalid>
>>> пише:
>>>>> Hi,
>>>>>
>>>>> I'm having trouble with NuttX on the ESP32S3 trying to get UART1
>>>>> (configured on the default pins) working via /dev/ttyS1.  The driver
>>>>> code for esp32s3_serial.c seems to configure uart1 as /dev/ttys1 when
>>>>> you enable it in the configs, however, testing via
>>>>> serialblaster/serialrx (and our own custom app) doesn't seem to send
>>>>> or
>>>>> receive anything on uart1.  I've tried swapping my connections to the
>>>>> pins, testing every pin on the devkit board with serialblaster and
>>>>> nothing ever comes out.  I don't have this problem on an esp32 devkit
>>>>> (with either uart1 or uart2).  It seems to only happen on the esp32s3
>>>>> devkit.  I can successfully use serialblaster/serialrx on /dev/ttyS0
>>>>> and
>>>>> see the output/enter text.
>>>>>
>>>>> Is there something I'm missing?
>>>>>
>>>>> Thanks,
>>>>> -m
>>>>>
>>>
>
>

Reply via email to