S32K312-Problem with C40CheckLockDomainID function

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

S32K312-Problem with C40CheckLockDomainID function

Jump to solution
1,102 Views
Simon-Liu
Contributor IV

Hello

When I looked at the C40 function, I found that there is such a judgment in the function C40_Ip_CheckLockDomainID: if ((uint32)VirtualSector != FLS_MAX_VIRTUAL_SECTOR)
This judgment means that the parameter VirtualSector passed in cannot be equal to FLS_MAX_VIRTUAL_SECTOR, but the value of the FLS_MAX_VIRTUAL_SECTOR macro is 271, which is a legal Sector. So is this judgment incorrect?
The attachment is a screenshot of the function logic and macro, please check it out.

BestRegards

Simon

0 Kudos
1 Solution
1,084 Views
VaneB
NXP TechSupport
NXP TechSupport

Hi @Simon-Liu 

Sorry for the inconvenience. These are typos, please make sure that FLS_MAX_VIRTUAL_SECTOR located in C40_Ip_Cfg.h has the same value as the C40_UTEST_ARRAY_0_S000 and that C40_SECTOR_ERROR is one value greater than C40_UTEST_ARRAY_0_S000. 

For example instead of:

#define FLS_MAX_VIRTUAL_SECTOR              (271U)
… 
#define C40_UTEST_ARRAY_0_S000              (272U)    
#define C40_SECTOR_ERROR                    (272U)  

Needs to be:

#define FLS_MAX_VIRTUAL_SECTOR              (272U) 
…
#define C40_UTEST_ARRAY_0_S000              (272U)    
#define C40_SECTOR_ERROR                    (273U)    

Note: every time you update the code by ConfigTool these will return to their original value so you will have to change again. 

 

B.R.

VaneB 

View solution in original post

15 Replies
1,085 Views
VaneB
NXP TechSupport
NXP TechSupport

Hi @Simon-Liu 

Sorry for the inconvenience. These are typos, please make sure that FLS_MAX_VIRTUAL_SECTOR located in C40_Ip_Cfg.h has the same value as the C40_UTEST_ARRAY_0_S000 and that C40_SECTOR_ERROR is one value greater than C40_UTEST_ARRAY_0_S000. 

For example instead of:

#define FLS_MAX_VIRTUAL_SECTOR              (271U)
… 
#define C40_UTEST_ARRAY_0_S000              (272U)    
#define C40_SECTOR_ERROR                    (272U)  

Needs to be:

#define FLS_MAX_VIRTUAL_SECTOR              (272U) 
…
#define C40_UTEST_ARRAY_0_S000              (272U)    
#define C40_SECTOR_ERROR                    (273U)    

Note: every time you update the code by ConfigTool these will return to their original value so you will have to change again. 

 

B.R.

VaneB 

1,062 Views
Simon-Liu
Contributor IV

Hello, @VaneB 

There is another problem of this function:

There is such a judgment in the function C40_Ip_CheckLockDomainID (the complete code is as shown in the attached picture):
if ( (0U != (CheckRegister & C40_Ip_u32BitPosition)) && (TempLockMasterRegister != 0U) )
My understanding of this is that if the SETSLOCK of the corresponding Sector is not set to 1, or the value of LOCKMASTER is 0, it means that the Sector is not locked/protected and can be erased.
I have questions about the second condition of this judgment. Why does the value of LOCKMASTER 0 also mean that the Sector is not locked? The MasterID may also be 0 (as shown in the attached picture). Is this judgment condition written wrong?

 

BestRegards

Simon

 

0 Kudos
1,054 Views
VaneB
NXP TechSupport
NXP TechSupport

@Simon-Liu 

You are correct TempLockMasterRegister corresponds to PFCBLKU_LOCKMASTER_S or PFCBLKn_LOCKMASTER_Sn, this register provides the status of the sector program/erase lock bit domain ID owner (PFCBLKn_SPELOCK or PFCBLKU_SPELOCK).

0 Kudos
996 Views
Simon-Liu
Contributor IV

@VaneB 

So what should the logic of this judgment be? How to modify it?

0 Kudos
956 Views
VaneB
NXP TechSupport
NXP TechSupport

Hi @Simon-Liu 

I had consulted the corresponding team about this topic. 

These conditions are considered just when XRDC is enabled and the PFLASH domain has been changed. Otherwise, the domain will always be 0. 

0 Kudos
947 Views
Simon-Liu
Contributor IV

Hi @VaneB 

So if this is the case, would something go wrong:
XRDC is enabled, and the MasterID locking Flash is 0.
In this case, the value of the variable TempLockMasterRegister is also 0.

0 Kudos
428 Views
VaneB
NXP TechSupport
NXP TechSupport

Hi @Simon-Liu 

No, if TempLockMasterRegister is 0, the return value of the function will be STATUS_C40_IP_SUCCESS. You should not have any problems. Unless you enable XRDC and change the domain and this domain does not match the value you gave to DomainIdValue, if this is the case the function will return STATUS_C40_IP_ERROR.

0 Kudos
421 Views
Simon-Liu
Contributor IV

Hi @VaneB 

The situation I mentioned before is that you enable XRDC and change the domain, and the MasterID is 0, then ERROR should be returned the next time you access using another MasterID, but according to the current logic, SUCCESS is returned because TempLockMasterRegister is 0.

0 Kudos
392 Views
VaneB
NXP TechSupport
NXP TechSupport

Hi @Simon-Liu 

The C40_Ip_CheckLockDomainID function will return a STATUS_C40_IP_ERROR if the actual domain obtained by C40_Ip_CheckLockDomainID_CheckRegister() and the operation performed to assign a value to LockDomainIDValue does not match the provided domain ID value (DomainIdValue).

0 Kudos
362 Views
Simon-Liu
Contributor IV

Hi @VaneB 

I have mentioned it many times. According to the current logic, if the actual domain ID obtained through C40_Ip_CheckLockDomainID_CheckRegister() is 0, STATUS_C40_IP_SUCCESS will be returned directly, and it will not be judged at all whether the actual domain ID matches the provided domain ID value.

271 Views
Simon-Liu
Contributor IV

Hi @VaneB 

If my understanding is correct, there is something wrong with the logic in the code now, right? How to modify it?

 

BestRegards

Simon

0 Kudos
236 Views
VaneB
NXP TechSupport
NXP TechSupport

Hi @Simon-Liu 

At the moment we do not have any bug reports related to this function. So, we do not recommend modifying. If you encounter a problem, let us know so the information can be sent to the corresponding team.

0 Kudos
168 Views
Simon-Liu
Contributor IV

Hi @VaneB 

OK, I'll contact you again if I run into problems.

 

BestRegards

Simon

0 Kudos
1,043 Views
Simon-Liu
Contributor IV

Hello @VaneB 

The variable TempLockMasterRegister does not correspond to the value of PFCBLKn_SPELOCK, but the value of PFCBLK_LOCKMASTER_S, so the condition (TempLockMasterRegister!=0U) only means that the value of MasterID is not 0. What can this be used to determine?

 

BestRegards

Simon

0 Kudos
1,071 Views
Simon-Liu
Contributor IV

Hi, @VaneB 

Thank you for your reply. Will this error be corrected in subsequent RTD releases?

BestRegards,

Simon

0 Kudos