2025-09-25 12:25 AM - edited 2025-09-25 12:27 AM
I have problems with using Memory Management Tool (MMT) in CubeMX v6.15.0 and CubeIDE is v1.19.0. MCU is STM32H7R3L8H6H.
Here's the MMT view and DTCM area of Boot in focus:
As you can see, DTCM area is 64 KB.
But in CORTEX_M7_BOOT MPU peripheral view it is 128 MB:
Same thing goes into Boot\Core\Src\main.c function MPU_Config:
/** Initializes and configures the Region and the memory to be protected
*/
MPU_InitStruct.Number = MPU_REGION_NUMBER2;
MPU_InitStruct.BaseAddress = 0x20000000;
MPU_InitStruct.Size = MPU_REGION_SIZE_128MB;
MPU_InitStruct.SubRegionDisable = 0xEE;
MPU_InitStruct.AccessPermission = MPU_REGION_FULL_ACCESS;
MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_DISABLE;
MPU_InitStruct.IsShareable = MPU_ACCESS_SHAREABLE;
MPU_InitStruct.IsBufferable = MPU_ACCESS_BUFFERABLE;
HAL_MPU_ConfigRegion(&MPU_InitStruct);
But this next thing is complete nonsense. Here's MMT view of external PSRAM area at 0x91E00000:
Generated MPU config code is:
/** Initializes and configures the Region and the memory to be protected
*/
MPU_InitStruct.Number = MPU_REGION_NUMBER6;
MPU_InitStruct.BaseAddress = 0x91E00000;
MPU_InitStruct.Size = MPU_REGION_SIZE_2MB;
MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_ENABLE;
MPU_InitStruct.IsShareable = MPU_ACCESS_NOT_SHAREABLE;
HAL_MPU_ConfigRegion(&MPU_InitStruct);
/** Initializes and configures the Region and the memory to be protected
*/
MPU_InitStruct.Number = MPU_REGION_NUMBER7;
MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_DISABLE;
MPU_InitStruct.IsShareable = MPU_ACCESS_SHAREABLE;
MPU_InitStruct.IsCacheable = MPU_ACCESS_NOT_CACHEABLE;
HAL_MPU_ConfigRegion(&MPU_InitStruct);
/** Initializes and configures the Region and the memory to be protected
*/
MPU_InitStruct.Number = MPU_REGION_NUMBER8;
HAL_MPU_ConfigRegion(&MPU_InitStruct);
/* Enables the MPU */
HAL_MPU_Enable(MPU_PRIVILEGED_DEFAULT);
What happens is that same area gets configured 3 times.
I thought its a bug in generator but after checking IOC file I saw this area defined 3 times. I did fiddle around with areas in MMT editor and maybe it broke down and created this mess? I also see wrong DTCM area size in IOC. So maybe it's a bug in MMT editor instead? IOC file is attached.
I have a related question also:
Why is all MPU config done (generated) in boot code? I actually don't want boot to define all the MPU areas because in that case future application releases would be forced to use the setup that boot does. I would prefer if boot configures those areas that are defined in MMT Boot column and App configures those that are in App column.
In MMT wiki I have seen pretty complex pictures when security features are enabled. Maybe some features open up with that? But right now I prefer to keep things simple and do security part later.
2025-09-25 1:28 AM
Hello @mkrk
I'm currently investigating this. I will get back to you as soon as possible.
THX
Ghofrane
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.