The CLib Support Library provides the necessary hooks to make C library functions such as malloc and free thread safe. This implementation supports FreeRTOS and ThreadX and requires the appropriate RTOS to be present to build. For details on what this library provides see the toolchain specific documentation at:
The startup code must call cy_toolchain_init (for GCC and IAR). This must occur after static data initialization and before static constructors. This is done automatically for PSoC™ devices. See the PSoC™ startup files for an example.
In FreeRTOS to enable Thread Local Storage, configUSE_NEWLIB_REENTRANT must be enabled.
While this is specific to FreeRTOS and ThreadX, it can be used as a basis for supporting other RTOSes as well.
To use this library, the following configuration options must be enabled in FreeRTOSConfig.h:
To use this library, the following configuration option must be enabled:
When building with IAR, the '–threaded_lib' argument must be provided when linking. This is done automatically with psoc6make 1.3.1 and later. Also, 'TX_ENABLE_IAR_LIBRARY_SUPPORT' must be defined in the application when building with IAR. This enables the ThreadX IAR-specific port for clib thread safety. For more information about porting with ThreadX, see the ThreadX GitHub: https://github.com/azure-rtos/threadx/tree/master/ports
When using the HAL the time function returns the time in seconds from microcontroller Real-Time Clock (RTC). Additionally, functions mtb_clib_support_init and mtb_clib_support_get_rtc are provided to interact with the CLIB support RTC handle used. Follow below steps to set this up.
NOTE: For MTB_HAL_API_VERSION >= 3
, mtb_clib_support_init must be called before time is invoked. Otherwise, time will assert and (if asserts are enabled) and return a default time value.
Use the following links for more information, as needed:
© Cypress Semiconductor Corporation (an Infineon company) or an affiliate of Cypress Semiconductor Corporation, 2020-2021.