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 (CY_USING_HAL defined) the time function returns the time in seconds from microcontroller Real-Time Clock (RTC). Additionally, functions cy_set_rtc_instance and cy_get_rtc_instance are provided to interact with the RTC instance used. There are two ways to set this up.
NOTE: In either flow, until the application calls cyhal_rtc_write the RTC will only be initialized with a default time. This means that time deltas will be accurate, but absolute times will not have any relation to the real time.
Use the following links for more information, as needed:
© Cypress Semiconductor Corporation (an Infineon company) or an affiliate of Cypress Semiconductor Corporation, 2020-2021.