-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
armv7-m/arm_mpu.c: MPU regions >= 2GB cannot be configured #12734
Comments
Hi @danielappiagyei-bc nice finding! Thank you very much? I think the second option is a better approach, because will work for all cases without special cases or other inconveniences. @anchao what do you think? |
I also agree with the second option, could we add the uint64_t only for this function to handle the case of |
@danielappiagyei-bc please submit a PR with your fix |
for sure, will do |
@anchao The other issue is that because the argument
To fix this, I need to make |
This is a programming error and the compiler will report corresponding warning like |
Fair enough, I guess my point is that the architecture supports configuring a 4GiB region whereas this API (and zephyr's apparently) does not. But I understand we can't handle every special case while keeping the API generic, consistent between architectures, and simple. I'll make the requested changes 🙂 |
Will get back to this in a few weeks, appreciate the patience, am busy with work and personal |
Hi, minor bug to report regarding the MPU configuration in armv7-m:
The cortex-M7 MPU supports configuring regions up to 4GB in size (see ARMv7-M Arch. Reference Manual, System Address Map :: B3.5 Protected Memory System Architecture). (Download link here)
In arm_mpu.c, say you want to configure a 2 GiB sized region 2GiB offset from address 0:
When we make it to the
DEBUG_ASSERT
s in the function, we'll have:The first assert,
DEBUGASSERT(alignedbase + (1 << l2size) >= base + size);
,will expand to
DEBUGASSERT( 0 >= 0)
(due to unsigned integer overflow) and pass. The second assert, however,will expand to
and fail because only the right-hand-side will overflow. The workaround for this would be:
base
andsize
>= 2GiB are handled differently, orThe text was updated successfully, but these errors were encountered: