S32K144 Debug Breakpoint Qustions

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

S32K144 Debug Breakpoint Qustions

1,743 次查看
Raphael2
Contributor III

Hi,

I got some questions about the breakpoints in debug mode. Below is a simple program to explain.

Putting breakpoints before the first 3 lines in main just works as expected, but aren't declarations like  counter, and counter_limit able to stop the program? Is there a reason?

I tried putting a breakpoint before the LED toggle point PTD->PTOR = 1<<0; but it just gets ignored..?

And if I put it next line when counter is set to 0 again the program stops at this point every single cycle of the for loop (even if the if-request isn't true), and that confuses me most..

 

I hope someone can enlighten me

 

Best regards

Raphael

 

The Code:

 

#include "sdk_project_config.h"
#include "s32K144.h"

volatile int exit_code = 0;

int main(void)
{

PCC->PCCn[PCC_PORTD_INDEX] = PCC_PCCn_CGC_MASK; //enabling clock for PORT D
PORTD->PCR[0] = PORT_PCR_MUX(1); //set pin as GPIO
PTD->PDDR = 1<<0; // pin 0 is configured as output
int counter = 0;
int counter_limit = 100000;


for(;;)
{
counter++;

if(counter > counter_limit)
{
PTD->PTOR = 1<<0;
counter = 0;
}

if(exit_code != 0)
{

break;
}
}
return exit_code;
}

0 项奖励
回复
1 回复

1,732 次查看
Senlent
NXP TechSupport
NXP TechSupport

Hi@Raphael2

              This may be caused by the different locations of variables in memory, and the debugger cannot access this storage space.

The shaded part on the left is where breakpoints can be placed.(I use KEIL to port you code.)

Here is you code,

Senlent_0-1627957493747.pngSenlent_0-1627957493747.png

Turn it into a global variable

Senlent_1-1627957638630.pngSenlent_1-1627957638630.png

That's all I know, and I hope this answer is useful to you.

BR!

Jim.

 

 

0 项奖励
回复