Skip to content

new Cortex_M MPU config facility#460

Open
pat-rogers wants to merge 3 commits intoAdaCore:masterfrom
pat-rogers:add_mpu_configuration
Open

new Cortex_M MPU config facility#460
pat-rogers wants to merge 3 commits intoAdaCore:masterfrom
pat-rogers:add_mpu_configuration

Conversation

@pat-rogers
Copy link
Copy Markdown
Contributor

Note that when used this will fix the LTDC "slew" problem too.

@pat-rogers pat-rogers changed the title new general MPU config facility; also fixes LTDC slew new Cortex_M MPU config facility; also fixes LTDC slew Mar 28, 2026
@pat-rogers pat-rogers changed the title new Cortex_M MPU config facility; also fixes LTDC slew new Cortex_M MPU config facility Mar 28, 2026
@pat-rogers pat-rogers force-pushed the add_mpu_configuration branch from a5a0c7b to 875ea06 Compare April 12, 2026 20:42
@pat-rogers
Copy link
Copy Markdown
Contributor Author

Looks like the Microbit build is failing. I guess that is not V2, ie not Cortex M4, and is instead an M0 and so doesn't have MPU support. But that's just a guess.

Comment thread arch/ARM/cortex_m/src/cortex_m-mpu.ads Outdated
Comment on lines +32 to +40
-- This package provides subprograms to configure the Memory Protection
-- Unit (MPU) on the Cortex-M7 family of CPU.
--
-- On Cortex-M7, the MPU is required when the D-cache is enabled in order
-- to prevent speculative reads from causing bus contention on external
-- memory interfaces (e.g., FMC/SDRAM). Without MPU configuration, the
-- default memory map treats all external memory as Normal, allowing the
-- CPU to issue speculative reads that can starve bus masters such as the
-- LTDC display controller.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this is specific to the Cortex-M7 I suggest to move the file to arch/ARM/cortex_m/src/cm7. This should also fix the build failure. The failure is caused by the builds using Cortex-M0 failing as they pull this unit but don't provide an SVD for that.

If that unit is supposed to work on other Cortex-M I suggest to add the MPU SVD for Cortex-M0. According to the documentation I could find the M0 should also come with an MPU.

@pat-rogers
Copy link
Copy Markdown
Contributor Author

pat-rogers commented Apr 14, 2026 via email

@pat-rogers
Copy link
Copy Markdown
Contributor Author

As far as I can see, the M0+ does support an MPU, but the M0 does not. Therefore I propose that we take the same approach as was used for the nvic_cm4_cm7 directory, and so create an mpu_cm4_cm7 directory that the gpr files reference for those MCUs, omitting the M0.

@jklmnn
Copy link
Copy Markdown
Member

jklmnn commented May 8, 2026

As far as I can see, the M0+ does support an MPU, but the M0 does not. Therefore I propose that we take the same approach as was used for the nvic_cm4_cm7 directory, and so create an mpu_cm4_cm7 directory that the gpr files reference for those MCUs, omitting the M0.

That sounds like a good solution!

pat-rogers added 2 commits May 8, 2026 12:23
…d Cortex-M families.

Created new directory arch/ARM/cortex_m/src/mpu_cm4_cm7/ and moved the
two source files defining the MPU facility into that directory.

Updated the scripts/config/archs.py file to include that new source directory for the supported
MCU families (all the M4 and M7 boards, excluding the M0).

Manually updated all the relevant gpr files to reference that new directory.
…d Cortex-M families.

Created new directory arch/ARM/cortex_m/src/mpu_cm4_cm7/ and moved the
two source files defining the MPU facility into that directory.

Updated the scripts/config/archs.py file to include that new source directory for the supported
MCU families (all the M4 and M7 boards, excluding the M0).

Manually updated all the relevant gpr files to reference that new directory.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants