MPU_Region_InitTypeDef MPU_InitStruct_SDRAM;
MPU_Region_InitTypeDef MPU_InitStruct_FPGAKBD;
В 746-м, сразу после настройки FMC, возможен только доступ по четным (выровненным на 4 байта адресам). Для доступа к нечетным адресам надо еще настраивать MPU на эти области адресов. Иначе проц выпадает в Hard Fault exception handler.
/* Disable the MPU */
HAL_MPU_Disable();
/* Configure the MPU attributes as WT for SDRAM */
MPU_InitStruct_SDRAM.Number = MPU_REGION_NUMBER0;
MPU_InitStruct_SDRAM.BaseAddress = 0xD0000000;
MPU_InitStruct_SDRAM.Size = MPU_REGION_SIZE_8MB;
MPU_InitStruct_SDRAM.Enable = MPU_REGION_ENABLE;
MPU_InitStruct_SDRAM.AccessPermission = MPU_REGION_FULL_ACCESS;
MPU_InitStruct_SDRAM.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE;
MPU_InitStruct_SDRAM.IsCacheable = MPU_ACCESS_CACHEABLE;
MPU_InitStruct_SDRAM.IsShareable = MPU_ACCESS_NOT_SHAREABLE;
MPU_InitStruct_SDRAM.TypeExtField = MPU_TEX_LEVEL0;
MPU_InitStruct_SDRAM.SubRegionDisable = 0x00;
MPU_InitStruct_SDRAM.DisableExec = MPU_INSTRUCTION_ACCESS_ENABLE;
HAL_MPU_ConfigRegion(&MPU_InitStruct_SDRAM);
MPU_InitStruct_FPGAKBD.Number = MPU_REGION_NUMBER1;
MPU_InitStruct_FPGAKBD.BaseAddress = 0x60000000;
MPU_InitStruct_FPGAKBD.Size = MPU_REGION_SIZE_512MB;
MPU_InitStruct_FPGAKBD.Enable = MPU_REGION_ENABLE;
MPU_InitStruct_FPGAKBD.AccessPermission = MPU_REGION_FULL_ACCESS;
MPU_InitStruct_FPGAKBD.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE;
MPU_InitStruct_FPGAKBD.IsCacheable = MPU_ACCESS_CACHEABLE;
MPU_InitStruct_FPGAKBD.IsShareable = MPU_ACCESS_NOT_SHAREABLE;
MPU_InitStruct_FPGAKBD.TypeExtField = MPU_TEX_LEVEL0;
MPU_InitStruct_FPGAKBD.SubRegionDisable = 0x00;
MPU_InitStruct_FPGAKBD.DisableExec = MPU_INSTRUCTION_ACCESS_ENABLE;
HAL_MPU_ConfigRegion(&MPU_InitStruct_FPGAKBD);
/* Enable the MPU */
HAL_MPU_Enable(MPU_PRIVILEGED_DEFAULT);
MPU_Region_InitTypeDef MPU_InitStruct_FPGAKBD;
В 746-м, сразу после настройки FMC, возможен только доступ по четным (выровненным на 4 байта адресам). Для доступа к нечетным адресам надо еще настраивать MPU на эти области адресов. Иначе проц выпадает в Hard Fault exception handler.
/* Disable the MPU */
HAL_MPU_Disable();
/* Configure the MPU attributes as WT for SDRAM */
MPU_InitStruct_SDRAM.Number = MPU_REGION_NUMBER0;
MPU_InitStruct_SDRAM.BaseAddress = 0xD0000000;
MPU_InitStruct_SDRAM.Size = MPU_REGION_SIZE_8MB;
MPU_InitStruct_SDRAM.Enable = MPU_REGION_ENABLE;
MPU_InitStruct_SDRAM.AccessPermission = MPU_REGION_FULL_ACCESS;
MPU_InitStruct_SDRAM.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE;
MPU_InitStruct_SDRAM.IsCacheable = MPU_ACCESS_CACHEABLE;
MPU_InitStruct_SDRAM.IsShareable = MPU_ACCESS_NOT_SHAREABLE;
MPU_InitStruct_SDRAM.TypeExtField = MPU_TEX_LEVEL0;
MPU_InitStruct_SDRAM.SubRegionDisable = 0x00;
MPU_InitStruct_SDRAM.DisableExec = MPU_INSTRUCTION_ACCESS_ENABLE;
HAL_MPU_ConfigRegion(&MPU_InitStruct_SDRAM);
MPU_InitStruct_FPGAKBD.Number = MPU_REGION_NUMBER1;
MPU_InitStruct_FPGAKBD.BaseAddress = 0x60000000;
MPU_InitStruct_FPGAKBD.Size = MPU_REGION_SIZE_512MB;
MPU_InitStruct_FPGAKBD.Enable = MPU_REGION_ENABLE;
MPU_InitStruct_FPGAKBD.AccessPermission = MPU_REGION_FULL_ACCESS;
MPU_InitStruct_FPGAKBD.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE;
MPU_InitStruct_FPGAKBD.IsCacheable = MPU_ACCESS_CACHEABLE;
MPU_InitStruct_FPGAKBD.IsShareable = MPU_ACCESS_NOT_SHAREABLE;
MPU_InitStruct_FPGAKBD.TypeExtField = MPU_TEX_LEVEL0;
MPU_InitStruct_FPGAKBD.SubRegionDisable = 0x00;
MPU_InitStruct_FPGAKBD.DisableExec = MPU_INSTRUCTION_ACCESS_ENABLE;
HAL_MPU_ConfigRegion(&MPU_InitStruct_FPGAKBD);
/* Enable the MPU */
HAL_MPU_Enable(MPU_PRIVILEGED_DEFAULT);
Комментариев нет:
Отправить комментарий