MX 10 and H563: Generating bad LL code for MPU region ?
When I generate code for the MPU region 0 wit HAL I get:
void MPU_Config(void)
{
MPU_Region_InitTypeDef MPU_InitStruct = {0};
MPU_Attributes_InitTypeDef MPU_AttributesInit = {0};
/* Disables the MPU */
HAL_MPU_Disable();
/** Initializes and configures the Region and the memory to be protected
*/
MPU_InitStruct.Enable = MPU_REGION_ENABLE;
MPU_InitStruct.Number = MPU_REGION_NUMBER0;
MPU_InitStruct.BaseAddress = 0x08fff800;
MPU_InitStruct.LimitAddress = 0x08fff900;
MPU_InitStruct.AttributesIndex = MPU_ATTRIBUTES_NUMBER0;
MPU_InitStruct.AccessPermission = MPU_REGION_ALL_RO;
MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_DISABLE;
MPU_InitStruct.IsShareable = MPU_ACCESS_OUTER_SHAREABLE;
HAL_MPU_ConfigRegion(&MPU_InitStruct);
MPU_AttributesInit.Number = MPU_REGION_NUMBER0;
MPU_AttributesInit.Attributes = MPU_DEVICE_nGnRnE | MPU_WRITE_THROUGH
| MPU_TRANSIENT | MPU_NO_ALLOCATE;
HAL_MPU_ConfigMemoryAttributes(&MPU_AttributesInit);
/* Enables the MPU */
HAL_MPU_Enable(MPU_PRIVILEGED_DEFAULT);
}OK.
With the exact same configuration, when I switch to LL I get:
void MPU_Config(void)
{
/* Disables the MPU */
LL_MPU_Disable();
/** Initializes and configures the Region and the memory to be protected
*/
LL_MPU_ConfigRegion(LL_MPU_REGION_NUMBER0, LL_MPU_INSTRUCTION_ACCESS_DISABLE, LL_MPU_ATTRIBUTES_NUMBER0, 0x08fff800, 0x08fff900);
LL_MPU_EnableRegion(LL_MPU_REGION_NUMBER0);
LL_MPU_ConfigAttributes(LL_MPU_ATTRIBUTES_NUMBER0, LL_MPU_DEVICE_nGnRnE | LL_MPU_WRITE_THROUGH
| LL_MPU_TRANSIENT | LL_MPU_NO_ALLOCATE);
/* Enables the MPU */
LL_MPU_Enable(LL_MPU_CTRL_PRIVILEGED_DEFAULT);
}I think there are not equivalent. There is a missing :
| LL_MPU_REGION_ALL_RO | LL_MPU_ACCESS_OUTER_SHAREABLEin the 2nd parameter of LL_MPU_ConfigRegion().
Is this true?
