cancel
Showing results for 
Search instead for 
Did you mean: 

HAL-Lib MPU Configuration Question

Floki.1
Associate II

Hello,

I would like to know if there is a possibility to readback the MPU confiugration for each configured region? HAL only provides a setter function.

If I take a look into the internal implementation, it seems that regions get overwritten, when I configure I new region.

I was expecting to see an OR operation but instead the region number is directly updated.

void HAL_MPU_ConfigRegion(MPU_Region_InitTypeDef *MPU_Init)

{

 /* Set the Region number */

 MPU->RNR = MPU_Init->Number;

 if ((MPU_Init->Enable) != 0UL)

 {

  MPU->RBAR = MPU_Init->BaseAddress;

  MPU->RASR = ((uint32_t)MPU_Init->DisableExec       << MPU_RASR_XN_Pos)  |

        ((uint32_t)MPU_Init->AccessPermission    << MPU_RASR_AP_Pos)  |

        ((uint32_t)MPU_Init->TypeExtField      << MPU_RASR_TEX_Pos) |

        ((uint32_t)MPU_Init->IsShareable       << MPU_RASR_S_Pos)  |

        ((uint32_t)MPU_Init->IsCacheable       << MPU_RASR_C_Pos)  |

        ((uint32_t)MPU_Init->IsBufferable      << MPU_RASR_B_Pos)  |

        ((uint32_t)MPU_Init->SubRegionDisable    << MPU_RASR_SRD_Pos) |

        ((uint32_t)MPU_Init->Size          << MPU_RASR_SIZE_Pos) |

        ((uint32_t)MPU_Init->Enable         << MPU_RASR_ENABLE_Pos);

 }

 else

 {

  MPU->RBAR = 0x00;

  MPU->RASR = 0x00;

 }

}

Is there a way to simply read out the complete MPU confiugration for all regions with its specific confiugration ?

0 REPLIES 0