When you want to check for stack overflow while developing and debugging easiest solution would be to set an "Address breakpoint" near top of stack. Configure break on write access and your program gets halted at a stack violation.
Thank you for your reply.
Can I read and write below setting in last 4bytes of stack?
*(reg32 *)(CYDEV_SRAM_BASE + CYDEV_SRAM_SIZE - CYDEV_STACK_SIZE)
Yes, you can.
AN89056 - PSoCR 4 - IEC 60730 Class B and IEC 61508 SIL Safety Software Library, especially for RAM test, could be one of reference.
Please double check the SelfTest_Stack.h file.