Guest User

Untitled

a guest
Sep 11th, 2015
917
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.85 KB | None | 0 0
  1. static void MPU_Config(void)
  2. {
  3.   MPU_Region_InitTypeDef MPU_InitStruct;
  4.  
  5.   /* Disable the MPU */
  6.   HAL_MPU_Disable();
  7.  
  8.   /* Configure the MPU attributes as WT for SRAM */
  9.   MPU_InitStruct.Enable = MPU_REGION_ENABLE;
  10.   MPU_InitStruct.BaseAddress = 0x68000000;
  11.   MPU_InitStruct.Size = MPU_REGION_SIZE_8MB;
  12.   MPU_InitStruct.AccessPermission = MPU_REGION_FULL_ACCESS;
  13.   MPU_InitStruct.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE;
  14.   MPU_InitStruct.IsCacheable = MPU_ACCESS_NOT_CACHEABLE;
  15.   MPU_InitStruct.IsShareable = MPU_ACCESS_NOT_SHAREABLE;
  16.   MPU_InitStruct.Number = MPU_REGION_NUMBER1;
  17.   MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0;
  18.   MPU_InitStruct.SubRegionDisable = 0x00;
  19.   MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_DISABLE;
  20.  
  21.   HAL_MPU_ConfigRegion(&MPU_InitStruct);
  22.  
  23.   /* Enable the MPU */
  24.   HAL_MPU_Enable(MPU_PRIVILEGED_DEFAULT);
  25. }
Advertisement
Add Comment
Please, Sign In to add comment