For the ARMv8M mpu, there is only two bits for the AP(access permission), another
XN bit for executable.
I wan't to mark a region (e.g. from 0~4096) with no any access, mainly used for NULL pointer
read/write check. For ARMv7M, the mpu has 3 bits in AP field(RASR register), and I can select 000
to mark this region no any access, but for ARMv8M, there is only two bits in the register
MPU_RBAR,
"
00 – read/write by privileged code only01 – read/write by any privilege level10 – Read only by privileged code only11 – Read only by any privilege level
So, how should I do with the new MPU? any advice will be appreciated.
Thank you
you mean I can clear the PRIVDEFENA of register mpu_ctrl
and then map all the memory I need, and unmap any region I don't
need? then any access to these unmaped regions will generate the fault?
Yes, you need to map MPU regions to only to the memory that you need. Any access to un-mapped regions will generate fault.