Have you called from a task or from the main loop?
If you called this before starting the scheduler, you would get stuck in there.
I called it from the main loop. Even though I don't include "freertos" library, which means no scheduler start is needed, it still doesn't work.
Your application didn't include freertos.h, but the implementation of cyhal_system_delay does. You just need to have one of the MACROs defined - CY_RTOS_AWARE or COMPONENT_RTOS_AWARE to execute that function with RTOS hooks. Look at your your Makefile. You probably included the RTOS_AWARE component or added the CY_RTOS_AWARE define.