Skip to content

In mpu_armv7.h, why while loop is used in ARM_MPU_Load function which runs at every 4th iteration? #1265

Answered by JonatanAntoni
nirajgandhi asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @nirajgandhi,

ARM_MPU_Load has been implemented to load as many MPU regions as required with the least amount of CPU cycles.
Depending on the amount of region aliases of the MPU (MPU_TYPE_RALIASES) one can load as many regions with subsequent memory accesses at once.

Loading more MPU regions than MPU_TYPE_RALIASES one needs to split the load into junks. Hence your code won't work. It will only load the first 4 regions and the remaining 8 regions are written elsewhere into the memory. This gives basically undefined behaviour!

Cheers,
Jonatan

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by nirajgandhi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
2 participants