S32K312 - a MCAL pointer variable point to a self-defined variable

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S32K312 - a MCAL pointer variable point to a self-defined variable

521 Views
yumi
Contributor III

Hi, I am using s32k312 and MCAL version is 5.0.0, the startup and linker files is based on MCAL package.

I defined a bool variable named LibDiagCom_Initialized, and I found in the LiveWatch and memory it was changed unexpectedly. I set a data breakpoint and found a struct variable with a pointer was changing the memory. 

So is this pointer a wilder pointer?

0 Kudos
Reply
3 Replies

431 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@yumi

From the screenshot you provided, I don't see any relationship between "LibDiagCom_Initialized" and "Lpspi_Ip_axStateStructure". Is there a problem?

My understanding of a "dangling pointer"(野指针) is usually that it points to an unknown, random location. I don't see that problem here.

0 Kudos
Reply

330 Views
yumi
Contributor III

Hi Selent,

From the Live Watch, you can see the location of 'LibDiagCom_Initialized' is 0x2040 37df, and the pointer RxBuffer in Lpspi_Ip_axStateStructure point to 0x204037DC. 

I set a data breakpoint for LibDiagCom_Initialized, the scenery is LibDiagCom_Initialized value is changed by the RxBuffer at the data breakpoint, as shows in another picture.

So my question is:

Shouldn't the RxBuffer in Lpspi_Ip_axStateStructure point to somewhere at initialization? If not, is it a dangling pointer? 

0 Kudos
Reply

306 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@yumi

In the image you provided, I did not see that the value of "LibDiagCom_Initialized" had changed.

You'd better provide me with your test routine, because I still don't understand it. I don't see any problems in the images you provided.

0 Kudos
Reply