AnsweredAssumed Answered

S32K144 System MPU fails to write protect Flash memory region

Question asked by Karnik Somani on Mar 3, 2020
Latest reply on Mar 24, 2020 by Karnik Somani

Dear Community members,

I have been working on NXP S32K144 System MPU.

I have successfully,

1] Read protect flash memory region.[0x10000800 - 0x1000081F]

2] Read/Write protect SRAM memory region.[0x0100 0001 - 0x0100 0020]

For every memory access violations exception is thrown.

But for,

3] Write protect flash memory region.[0x10000800 - 0x1000081F] there is no exception generated and the memory 

gets written successfully. 

 

Following is the profile i have initialized MPU with.

/*! Master access rights configuration 0 */
const mpu_master_access_right_t memProtect1_AccessRightConfig0[] =
{
/*! CORE */
{
.masterNum = FEATURE_MPU_MASTER_CORE, /*!< Master number */
.accessRight = MPU_SUPERVISOR_USER_NONE, /*!< Access right */
.processIdentifierEnable = false /*!< Process identifier enable */
},
/*! DEBUGGER */
{
.masterNum = FEATURE_MPU_MASTER_DEBUGGER, /*!< Master number */
.accessRight = MPU_SUPERVISOR_USER_RWX, /*!< Access right */
.processIdentifierEnable = false /*!< Process identifier enable */
},
/*! DMA */
{
.masterNum = FEATURE_MPU_MASTER_DMA, /*!< Master number */
.accessRight = MPU_SUPERVISOR_USER_RWX, /*!< Access right */
.processIdentifierEnable = false /*!< Process identifier enable */
}
};


/*! Master access rights configuration 1 */
const mpu_master_access_right_t memProtect1_AccessRightConfig1[] =
{
/*! CORE */
{
.masterNum = FEATURE_MPU_MASTER_CORE, /*!< Master number */
.accessRight = MPU_SUPERVISOR_USER_RWX, /*!< Access right */
.processIdentifierEnable = false /*!< Process identifier enable */
},
/*! DEBUGGER */
{
.masterNum = FEATURE_MPU_MASTER_DEBUGGER, /*!< Master number */
.accessRight = MPU_SUPERVISOR_USER_RWX, /*!< Access right */
.processIdentifierEnable = false /*!< Process identifier enable */
},
/*! DMA */
{
.masterNum = FEATURE_MPU_MASTER_DMA, /*!< Master number */
.accessRight = MPU_SUPERVISOR_USER_RWX, /*!< Access right */
.processIdentifierEnable = false /*!< Process identifier enable */
}
};


/*! Master access rights configuration 2 */
const mpu_master_access_right_t memProtect1_AccessRightConfig2[] =
{
/*! CORE */
{
.masterNum = FEATURE_MPU_MASTER_CORE, /*!< Master number */
.accessRight = MPU_SUPERVISOR_USER_R, /*!< Access right */
.processIdentifierEnable = false /*!< Process identifier enable */
},
/*! DEBUGGER */
{
.masterNum = FEATURE_MPU_MASTER_DEBUGGER, /*!< Master number */
.accessRight = MPU_SUPERVISOR_USER_RWX, /*!< Access right */
.processIdentifierEnable = false /*!< Process identifier enable */
},
/*! DMA */
{
.masterNum = FEATURE_MPU_MASTER_DMA, /*!< Master number */
.accessRight = MPU_SUPERVISOR_USER_RWX, /*!< Access right */
.processIdentifierEnable = false /*!< Process identifier enable */
}
};

 

/*! User configuration */
const mpu_user_config_t mpu_memConfig[] =
{
/*! Region number 0 */
{
.startAddr = 0x00000000U, /*!< Memory region start address */
.endAddr = 0xFFFFFFFFU, /*!< Memory region end address */
.masterAccRight = memProtect1_AccessRightConfig0, /*!< Master access right */
.processIdentifier = 0x00U, /*!< Process identifier */
.processIdMask = 0x00U /*!< Process identifier mask */
},
/*! Region number 1 */
{
.startAddr = MPU_REG1_START_ADDR,//0x00000000U, /*!< Memory region start address */
.endAddr = MPU_REG1_END_ADDR,//0x0007FEFFU, /*!< Memory region end address */
.masterAccRight = memProtect1_AccessRightConfig2, /*!< Master access right */
.processIdentifier = 0x00U, /*!< Process identifier */
.processIdMask = 0x00U /*!< Process identifier mask */
},
/*! Region number 2 */
{
.startAddr = 0x00000000U, /*!< Memory region start address */
.endAddr = 0x100007FFU, /*!< Memory region end address */
.masterAccRight = memProtect1_AccessRightConfig1, /*!< Master access right */
.processIdentifier = 0x00U, /*!< Process identifier */
.processIdMask = 0x00U /*!< Process identifier mask */
},
/*! Region number 3 */
{
.startAddr = 0x10000820U, /*!< Memory region start address */
.endAddr = 0xFFFFFFFFU, /*!< Memory region end address */
.masterAccRight = memProtect1_AccessRightConfig1, /*!< Master access right */
.processIdentifier = 0x00U, /*!< Process identifier */
.processIdMask = 0x00U /*!< Process identifier mask */
},
/*! Region number 4 */
{
.startAddr = 0x0007FF20U, /*!< Memory region start address */
.endAddr = 0xFFFFFFFFU, /*!< Memory region end address */
.masterAccRight = memProtect1_AccessRightConfig1, /*!< Master access right */
.processIdentifier = 0x00U, /*!< Process identifier */
.processIdMask = 0x00U /*!< Process identifier mask */
}
};

Outcomes