Cypress技术论坛
直播中

蒋牛钱

7年用户 281经验值
私信 关注
[问答]

套件CY5672调试意外退出运行

嗨,我用cy5672过程可远程控制参考设计工具包,我试图理解代码到底。所以我的想法是做调试,看代码是如何工作的。但是,当我在调试模式,并尝试做的一步一步,我落在系统中断的一部分。我在这里的这个问题,认为这是“正常的”(这是一个已知的行为),如果我想我必须使用这一解决方案的调试(看到这个解决方案案例:调试系统中断的问题):“出路:当在断点、单步中断时禁用,前执行Run命令再次启用它们。菜单中有一个图标用于中断。或删除断点,设置一个新的在你想停止下一行,然后执行运行命令“虽然,当我试图实现的第一个解决方案,我在断点处(与中断现在禁用),我要一步一步做,碰巧代码跳转到另一名解放军总工程师。而且,如果我继续一步一步给我这个错误做一步:“调试程序意外退出运行期间。遇到错误(目标分离的更多信息见。输出窗口)”的其他解决方案,我将断点设置一个新的接近前一个代码应该去,但是当我执行运行命令不能到达那里。例如,在附件的图当我执行运行命令应该停止在断点设置,但从来没有到达那里。只有到如果一个键被按下了,但应该已经到了在前面的情况下(因变量i***atterylow有价值0、变isactivitiydetected有价值1)。我使用的试剂盒提供远程控制,没有任何变化的代码。你能帮助我解决这些问题吗?我该怎么办?
捕获2.PNG
8 K
捕获1.PNG
52.9 K

以上来自于百度翻译


     以下为原文
  Hi,

I'm using the CY5672 PRoC BLE Remote Control Reference Design Kit, and I'm trying to understand what the code exactly does.
So my idea was to do debugging, and see how the code works.

But, when i'm in debugging mode, and try to do step by step, i fall on system interrupt part. I searched here by this problem and see this is "normal" (it was a known behaviour), and if I want to do debug I have to use one of this solutions (saw this solutions on case: System interrupt problem in debugging):

"Ways out: When at the breakpoint, disable interrupts when single-stepping, before executing a run-command enable them again. There is an icon in the menu for interrupts.

Or

remove Breakpoint and set a new one at the next line you want to stop, then execute a Run-command"

Although, when I'm trying to implement the first solution, and I'm at the breakpoint (with the interrupts now disabled), I try to do step by step and it happens that the code jumps to another place. Also, If I continue to do step by step it give me this error:

"Debugger exited unexpectedly during run. Encountered error (Target disconnected See output window for more information.)"

The other solution, I remove the breakpoint and set a new one close to the previous one where the code should go, but when I execute Run-command it doesn't reach there. For example, on the figure in annex when I execute the Run-command it should stop in the breakpoint that I set, but never has arrived there. Only arrives if a key is pressed again, but it should had arrived in the previous case (because the variable isBatteryLow had the value 0 and the variable isActivitiyDetected had the value 1).

I'm using the code provided with the kit for remote control without any changes.

Could you help me about these problem? What should I have do?


回帖(9)

王琳

2019-1-11 10:42:03
欢迎来到论坛,沃尔特。
通常调试是恰恰相反:如果检查程序运行如预期;-)
我已经放弃调试任何生成的代码模块。没有必要去了解它是如何工作的,我认为它会工作。
一些提示:在项目建设设置>;>;ARM GCC - >;编译器设置优化为“无”。这将确保程序的流程是完全一样的代码反映了。此设置将消耗更多的闪光但你可以设定一个文件库。
睡眠模式会影响调试,因为芯片和USB之间的通信不再。所以要通过代码检查是否需要禁用睡眠模式。
了解程序和程序流程可以以不同的方式来做:左键单击函数调用并选择“转到定义”。这会为你带来的功能本身,你可以看看它。“<;Ctrl & gt;”(控制减)将带你回到你来自哪里。学习这些东西的好方法。要知道你有机会显示调用堆栈,所以你可以看到在你进入函数断点所在。
快乐编码
鲍勃

以上来自于百度翻译


     以下为原文
  Welcome in the forum, Walter.
    Usually debugging is just the other way: checking if a program runs as expected ;-)
    I have given up to debug any of the generated code modules. There is no need to understand how it works, my assumption is that it will work.
    Some more tip: in Project -> Build settings -> ARM GCC -> Compiler set the optimization to "none". This will ensure that the program flow is exactly the same as your code reflects. This setting will consume more flash but you may set that on a file base.
    Sleep modes will interfere with debugging, because the communication between the chip and USB ceases. So go through the code and check whether you need to disable sleep modes.
    Understanding programs and program flow can be done in a different way: left click on a function call and choose "Go to Definition". This will bring you to the function itself and you may see what it does. A "-" (Control minus) will bring you back to where you came from. Good way to study these things. Be aware that you have got the opportunity to display the call stack, so you can see from where you entered the function where your breakpoint resides.
     
    Happy coding
    Bob
举报

付雯瑶

2019-1-11 10:54:52
请张贴您的代码,以便我们可以测试它。

以上来自于百度翻译


     以下为原文
          Please post your code so we can test it.   
举报

蒋牛钱

2019-1-11 11:13:00
你好,
鲍伯当我说我需要了解这个工作是因为我想做一些修改的代码,如果有问题的代码,我需要做调试明白我是错的。做“去定义“不要帮我检查哪里是我的错误。所以,首先,我想做调试不改变代码来理解这个我上面解释的。
所以,我想实现你给我的提示,但仍继续给我,我上面提到的问题。我将把我的项目,看看你能不能帮我,看我做错了什么。这个项目包含了你告诉我做提示(禁用睡眠模式和设置优化为'无'我感兴趣的一些文件),和我做的一些评论。
我用Psoc Creator 3.3。
如果可以的话,请帮帮我。
当做,
沃尔特
CY5672A遥控器
5.4兆字节

以上来自于百度翻译


     以下为原文
  Hi,
    Bob when I said that I need to understand how this works it's because I want to do some adaptations to the code, and if have a problem in the code I need to do debug to understand where I did it wrong. Doing "Go to definition" don't help me to check where is my error. 
So, in first, I tried to do debugging without change the code to understand how this works as I explained above.
    So, I tried to implement the tips that you gave to me, but still continues to give me that problems that I mentioned above. I will attach my project to see if you can help me with this,  and see what I'm doing wrong. This project contains the tips that you told me to do (disabled sleep mode and set the optimization to 'none' in some files of my interest), and some comments done by me.  
    I'm using Psoc Creator 3.3.
    Please help me if you can.
    Regards,
    Walter


举报

王琳

2019-1-11 11:22:30
“我用Psoc Creator 3.3”
这是主要问题,升级到创建者4并更新项目的组件。
在生成一个新的版本之后,对生成代码的更改会被改写,所以最好避免这样做。
鲍勃

以上来自于百度翻译


     以下为原文
  "I'm using Psoc Creator 3.3"
    This is the main problem, upgrade to Creator 4.0 and update your project's components.
    Making changes in the generated code will get overwritten after a new build, so it's better to avoid that.
     
    Bob
举报

更多回帖

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