2025-10-09 2:39 PM
I'm working with the STM32U5G9, trying to configure access to internal RAM blocks with TrustZone enabled. Part of this configuration uses the HAL_GTZC_MPCBB_ConfigMem() function from stm32u5xx_hal_gtzc.c from STM32CubeU5 v1.7.0.
I see in that function a comment indicating:
/* limitation: code not portable with memory > 512K */
pMPCBB_desc->AttributeConfig.MPCBB_LockConfig_array[0] = READ_REG(mpcbb_ptr->CFGLOCKR1);but the STM32U5G9 has several internal SRAM blocks with size over 512K:
Is TrustZone MPCBB control not fully supported by STMCubeU5 for the STM32U5Gx processors? Am I missing something?
Thanks,
-Rob
2025-10-10 5:48 AM
Hi @rdl_42 ,

To solve this you need to ensure that size_in_superblocks is >= 32 so both CFGLOCKR1 and CFGLOCKR2 are configured
Best regards,
Aime
2025-10-10 1:37 PM
Aime,
Thanks for you quick response.
After looking at the code and Section 5.8 of RM0456 Rev 5 more closely, it looks like the comment just isn't accurate. The code works for the 832 KB and 768 KB SRAM resources supported on the STM32U5G9.
Thanks,
-Rob