How to create stack overflow/underflow exception ?

Thread Starter


Joined Jan 4, 2017
I'm programming Infineon TC29x Aurix Tricore Microcontroller based embedded system in 'C' language.

Consider stack starting address 0x5000 0000. The stack size is 0x2000.

If I take current stack pointer minus 0x2000, will that create stack exception? If yes, what might be 'C' or assembly language code that will achieve this?

My thought is if I subtract negative 0x2000 from current stack pointer or add 0x2000 to current stack pointer, I'll be outside stack and stack exception will occur ?