STM32U575 - USBPD_CAD_Init error wit Thread-Safe setting
Hello,
I am building an application using ThreadX, FileX, USBX and USBPD. Everyting runs perfectly until I bring USBPD in the game. Whatever I do, I always get an error when the library calls USBPD_CAD_Init().
More precisely, the function fails at a call to malloc when calling _mutex_aquire(mutex_t *lock). The error comes from the fact that the mutex is not initialized. This gives me a hardfault.
After some digging, I found out the mutex is well initialized at startup, but then uninitialized right away. The two related functions are called in this exact order:
- _init_alloc() => _mutex_initialize(mutex_t *lock): initializes the mutex and returns 1.
- __ccp_initialize_aeabi_() => __armlib_thread_safety_init() : mark all mutexes as uninitialized
It this expected?
I am using the "multi-threaded support" option and tried with different strategies (default, #2 and #3), always get the same result.
Environment
STM32CubeMX: v6.8.1
FW Package: STM32Cube FW_U5 V1.2.0
MCU: STM32U575VGTx
IDE: MDK-ARM v5.37
Board: custom
Many thanks in advance for anyone that can help