Hi pavelgrasblum !
Thank you for answer in details !
About MPU.
You mean IDAU/SAU/MPC can be set area as privileged or nonprivileged but MPU is "overwrite" their settings
and area follow MPU one. The same is applicable for PPC area. Is this so ? Or this is valid only when extra privileges checks are disabled ?
Also if MPU sections are not cover whole memory e,g. portMPU_PRIV_BACKGROUND_ENABLE is not set.
What attributes are set for remain areas ? Completely invisible or areas follow IDAU/SAU/MPC/PPC ?
Basically due limited amount of MPU sections, PPC peripherals should be accessed via SVC calls in privileged mode, because default settings of MPU ( FreeRTOS for example), set all this area as privileged.
I have face one more phenomena in case if both MPU_S and NS are active. No glue if this the feature or side effect.
On secure side , I have check for buffer what given by API from nonsecure side :
int *p = cmse_check_address_range(data, size, CMSE_NONSECURE | CMSE_MPU_UNPRIV | CMSE_MPU_READWRITE);
Looks like area what covered by data+size should be provisioned in Secure MPU by using nonsecure address range,
secure address alias is not enough.
Buffer allocated on nonsecure side at address 0x20000000 and Secure MPU cover this area with start address 0x30000000 and cmse check cause memalign secure fault !
It means that Secure MPU should have 2 sections for those 2 SRAM areas if I would like to copy data from secure side to nonsecure. Even physically memory is the same. Is this OK ?
How I should handle callback when secure side call some function on nonsecure side ? If extra privileges check is enabled ? Callback called from ISR and looks like both code should be in privileged mode.
Looks like I should rearrange some code/data a lot if i would like to have both privileged/nonprivileged bit enabled.
On nonsecure side I have FreeRTOS and it cause some problems as well.
But I think to have both bits in misc enabled and it give extra security.
I should design SVC call what can be called from nonprivileged code and access privilege peripherals and return in correct way back.
Regards,
Eugene