Hello,
I am working on the MPU module of S912XEP768BVAG .
I have applied write and execution protection ,but I am not able to get the violation while trying to write or execute at address in between the configured protected range .
CPU User is configured as the master.
Please could you help me in verifying if the below is correct.
Pasting the test code below:
Start address : 0x7E3620 /**< global start address */
End address : 0x7E8595 /**< global end address */
Read only access for CPU user only, writing and execution protection.
/*Test code start*/
FAR_DATA GLOBALADR tUI32 *address_test_gConst = (FAR_DATA GLOBALADR tUI32 *)(0x7E3800);
/*usage in execute testcase*/
funcptr1 funct1_gConst = (FAR_DATA GLOBALADR funcptr1) 0x7E3800;
switch(TestSection_Num)
{
case 1:
AddressUnderTest = 0x7E3800 ;
/*Testcases for MPU testing */
if(Testcase_Num==1)
{
Read_Successful = FALSE;
/* read */
data_read1 = *(FAR_DATA GLOBALADR tUI16*)address_test_gConst;
if(data_read1 == *(FAR_DATA GLOBALADR tUI16*)address_test_gConst)
{
Read_Successful = TRUE;
}
}
else if(Testcase_Num==2)
{
Write_Successful = FALSE;
/*write */
*(FAR_DATA GLOBALADR tUI16*)address_test_gConst =0x1234;
if( *(FAR_DATA GLOBALADR tUI16*)address_test_gConst == 0x1234)
{
Write_Successful = TRUE;
}
}
else if(Testcase_Num==3)
{
Exe_Successful = FALSE;
*(FAR_DATA GLOBALADR tUI16*)address_test_gConst =0x0A00;
funct1_gConst();
Exe_Successful = TRUE;
}
break;
}
/*Test code end*/
Please let know if you need more information from me .
Regards,
Krutika
Hi,
do you think that attached examples will help you to implement MPU?
For more examples from my drawer please visit https://community.nxp.com/t5/S12-MagniV-Microcontrollers/LAMA-s-S12XE-unofficial-examples/ta-p/11007...
Best regards,
Ladislav