I can't debug with lpcxpresso

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

I can't debug with lpcxpresso

1,417 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by elisiojsj on Tue Sep 24 16:23:08 MST 2013
Hi,

I'm trying to start debugging with LPCXpresso but I'm having some problems.
Have an LPC-Link LPC1769.
Tried this on linux and windows and LPCXpresso 5 and 6 for both plataforms.

I'm able to connect e run a simple program I made just for test, but I can't use watchpoints (that is the most important for me).
My code is below, it works fine, just a led blink.

int main(void)
{
  SystemInit();
  int a=5;
  int b=1;
  LPC_GPIO0 ->FIODIR |= (1 << 22);
  LPC_GPIO0 ->FIOCLR |= (1 << 22);
  while(1)
  {
    a++;
    b++;
    LPC_GPIO0 ->FIOCLR |= (1 << 22);
    delayMs(1,1000);
    a++;
    b++;
    LPC_GPIO0 ->FIOSET |= (1 << 22);
    delayMs(1,1000);
  }
}

If I just init the debug the led blinks ok, but if I add an watchpoint with an expression like a==10 (or something else) it stops the execution at any point that there is b++. Even if a delete the watchpoint it continues to do that.

I've already tried to add an Expression but the field value show the message "Error: Target not available".

Can someone help me?

Thanks.
0 项奖励
回复
4 回复数

1,310 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by elisiojsj on Wed Sep 25 10:55:26 MST 2013
Thank you again for the answer.

I did exactly as you said, but I still have the same problem:
The program stop running at any change of the variable 'a' and not when it has the certain value that I need.

Doing as you said I put the expression a==10 in the field "Expression to watch:".
What is wrong?
0 项奖励
回复

1,310 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Wed Sep 25 06:29:49 MST 2013
To set a watchpoint on a variable changing, you need to:
1. Show the Outline view
2. Select the global variable you want to watch
3. Right-click and select "Toggle watchpoint". You can set whether this is a write (default) or a read watchpoint.

Using the watchpoint mechanism to look for a value becoming a certain value is not a good idea - the debugger will stop on every access to that variable, examine its value and if it does not meet the condition, will restart the program. This will slow down your application, probably to the point of it becoming unusable.
0 项奖励
回复

1,310 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by elisiojsj on Wed Sep 25 05:58:23 MST 2013
Thank you for the answer.

So, I changed the variables to global.
What should I do to stop the program running when my variable 'a' reaches an certain value, like 10 for example?
I tried to use the options "Add Watchpoint" and "Add Event Breakpoint", but I couldn't get it work.
0 项奖励
回复

1,310 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Wed Sep 25 00:20:44 MST 2013
1. Watchpoints work by monitoring the memory location where the variable is stored. Local variables often do not have a memory location as they will be kept in registers. It is not possible to have a watchpoint on a register.
2. A write watchpoint will only be triggered AFTER the write has occurred. So, the line displayed in the debugger will often be the line following the line where the write occurred. In your example above, you will stop on the "b++" lines

Local variable are shown in the "Variables" view. You will get the error you report, if you try to add an Expression of local variable when it is out of scope. i.e. if you try to set the Expression on the SystemInit() line, "a" will not be in scope and so you will not be able to display it.
0 项奖励
回复