Cypress技术论坛
直播中

楚红梅

8年用户 232经验值
私信 关注
[问答]

怎样才能检测到堆栈溢出?

大家好,
希望在PSoC 4 CY8C4245LQI-43中检测栈溢出。
我试过这个:
1初始化堆栈指针到最后一排的SRAM(我发现SRAM的地址范围从0x20000000到0x20000fff在psoc4建筑技术。堆栈在上部SRAM中。
CHAR*STATKPTR =(CHAR *)0x2000 FFF。
2——赋予它一个价值:
*STACKPTR=0xAA;
3 -在执行期间,检查其值的变化:
如果(*STACKPTR!= 0xAA)
{
FraveStaskIppOrth=真;
}
它不起作用。
不幸的是我不能使用调试模式由于采用Flash 90以上%和调试超过现有的Flash。
谢谢你的帮助!

以上来自于百度翻译


     以下为原文
  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!

回帖(1)

王琳

2018-10-9 11:34:26
您仍然可以调试您的项目,即使编译为发布版。停止执行时,可以查看调试器中的内存。您可以用固定值手动填充内存,并检查一段时间后更改多少。
此外,帮助调试是:您可以在文件基础上设置优化级别。因此,只允许对单个文件进行调试。
鲍勃

以上来自于百度翻译


     以下为原文
  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.
 
Bob
举报

更多回帖

发帖
×
20
完善资料,
赚取积分