Skip to content
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,armv7-r,armv8-m:MPU Add mpu_reset and ARM_MPU_EARLY_RESET #4702

Merged
merged 4 commits into from Oct 23, 2021

Conversation

davids5
Copy link
Contributor

@davids5 davids5 commented Oct 19, 2021

Summary

   When NuttX is booted from a foreign (non NuttX)
   bootloader. There as a possibility that the
   bootloader configured the MPU, in an
   incompatible way for the NuttX memory usage.

   The option to reset the MPU before it is initialized
   may not succeed if the bss and data initialization
   code violated the previous MPU configurations.

   Added herein are ARM_MPU_RESET and
   ARM_MPU_EARLY_RESET. The former can be used
   If the system is capable of booting and running
   NuttX MPU configuration code without an MPU
   violation. The latter is used if the system can
   not run the bss and data initialization code.

   These are options so that a NuttX may be configured to
   not clobber a bootloader MPU configuration in a system
   that is architected to share the MPU configuration task.

Impact

Allows systems with bootloader that configures MPU to boot NuttX.

No impact on existing system as settings Kconfig.

Testing

PX4:
cuav_nora
cuav_x7pro
cubepilot_cubeorange
holybro_durandal-v1
mro_ctrl-zero-h7-oem
mro_ctrl-zero-h7
mro_pixracerpro

@davids5
Copy link
Contributor Author

davids5 commented Oct 21, 2021

@xiaoxiang781216 would you have time to review this?

@patacongo
Copy link
Contributor

@davids5
Copy link
Contributor Author

davids5 commented Oct 22, 2021

@patacongo - thank you for the reference. Given some of the current code, I am still unclear as the the correct choice.

Should the following mpu_xxx functions be prefixed to `arm_mpu_xx

image

What would you use in this situation for the naming?

@davids5
Copy link
Contributor Author

davids5 commented Oct 22, 2021

@xiaoxiang781216 - changed the interface as you suggested. I believe all your concerns are addressed.

@davids5
Copy link
Contributor Author

davids5 commented Oct 22, 2021

@xiaoxiang781216 last FP was fixing unused warning

   When NuttX is booted from a foreign (non NuttX)
   bootloader. There as a possibility that the
   bootloader configured the MPU, in an
   incompatible way for the NuttX memory usage.

   The option to reset the MPU before it is initialized
   may not succeed if the bss and data initialization
   code violated the previous MPU configurations.

   Added herein are ARM_MPU_RESET and
   ARM_MPU_EARLY_RESET. The former can be used
   If the system is capable of booting and running
   NuttX MPU configuration code without an MPU
   violation. The latter is used if the system can
   not run the bss and data initialization code.

   These are options so that a NuttX may be configured to
   not clobber a bootloader MPU configuration in a system
   that is architected to share the MPU configuration task.
@xiaoxiang781216 xiaoxiang781216 merged commit e1a0a11 into apache:master Oct 23, 2021
@hartmannathan
Copy link
Contributor

I recently (a few months ago) ran into a dilemma with a bootloader that leaves the MCU in a non-reset state and wondered what to do about it. But then other work happened.

Thanks for adding this.

@jerpelea jerpelea added this to To-Add in Release Notes - 10.3.0 Mar 15, 2022
@jerpelea jerpelea moved this from To-Add to In Progress in Release Notes - 10.3.0 Mar 15, 2022
@jerpelea jerpelea moved this from In Progress to added in Release Notes - 10.3.0 Mar 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

4 participants