cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 4 MCU

Anonymous
Not applicable

Hi everyone,

I wish detect the stack overflow in psoc 4 CY8C4245LQI-483.

I tried this :

1- initialize a stack pointer to the last row of SRAM (i found  SRAM  address range from 0x20000000 to 0x20000FFF in PSOC4 architecture TRM. The stack is in upper SRAM).

      char* stackPtr = (char*) 0x20000FFF.

2- give it a value:

     *stackPtr = 0xAA;

3- during execution, check for changing its value:

     if(*stackPtr != 0xAA)

        {

            flag_stack_overflow = true;

        }

It does not working.

Unfortunately I cannot use the debug mode because the used flash is over the 90% and the debug exceeds the available flash.

Thanks for your help!

0 Likes
Reply
1 Solution
JoMe_264151
Expert II

You still can debug your project, even when compiled as release. When you stop execution you may look at the memory in the debugger. You can fill the memory manually with fixed values and check how much gets altered after a while.

<furthermore to help debugging is: You may set the optimization level on a file basis. So you can allow the debugging for a single file only.

Bob

View solution in original post

1 Reply
JoMe_264151
Expert II

You still can debug your project, even when compiled as release. When you stop execution you may look at the memory in the debugger. You can fill the memory manually with fixed values and check how much gets altered after a while.

<furthermore to help debugging is: You may set the optimization level on a file basis. So you can allow the debugging for a single file only.

Bob

View solution in original post