Skip to content

Support region padding for MPU programming#146

Merged
jonathanpallant merged 4 commits intorust-embedded:mainfrom
thejpster:support-padding
Apr 14, 2026
Merged

Support region padding for MPU programming#146
jonathanpallant merged 4 commits intorust-embedded:mainfrom
thejpster:support-padding

Conversation

@thejpster
Copy link
Copy Markdown
Contributor

@thejpster thejpster commented Mar 6, 2026

Make it easier to set up the MPU

  • Add an API to get the various linker output sections (aarch32_rt::region)
  • Adjust link.x to allow for adjustable alignment of regions
  • Adjust link.x to allow for adjustable padding between stacks
  • Add an example that programs the MPU

The MPS3-AN536 padding is set at 64K, so that the normal build and the +d32 build end up with the same memory map (otherwise their output for the mpu_region example would be different).

@thejpster thejpster changed the title Support region padding for MPU programming Support region padding for MPU programming (requires #127) Mar 6, 2026
@thejpster thejpster changed the title Support region padding for MPU programming (requires #127) Support region padding for MPU programming Mar 20, 2026
Copy link
Copy Markdown

@wt wt left a comment

Choose a reason for hiding this comment

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

Everything I didn't mention looks okay assuming all the magic numbers in the reference files are correct.

Comment thread aarch32-rt/src/regions.rs Outdated
wt
wt previously requested changes Mar 29, 2026
Copy link
Copy Markdown

@wt wt left a comment

Choose a reason for hiding this comment

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

I think there is a bug as per my comment. PTAL.

I think we were both trying to be a half step too clever to avoid the Option.

Comment thread aarch32-rt/src/regions.rs Outdated
@wt
Copy link
Copy Markdown

wt commented Apr 1, 2026

LGTM

@jonathanpallant
Copy link
Copy Markdown
Contributor

I want to rename Region to Section, because these are output sections from the Linker, rather than MPU regions (an MPU region might cover one or more linker output sections, for example).

@jonathanpallant
Copy link
Copy Markdown
Contributor

@jonathanpallant jonathanpallant marked this pull request as draft April 1, 2026 16:06
@thejpster
Copy link
Copy Markdown
Contributor Author

@thejpster thejpster marked this pull request as ready for review April 1, 2026 20:35
* Add an API to get the various linker output sections (aarch32_rt::region)
* Adjust link.x to allow for adjustable alignment of regions
* Adjust link.x to allow for adjustable padding between stacks
* Add an example that programs the MPU
As suggested in code review, now we're less likely to forget to update the
Iterator when adding new regions/stacks.
@thejpster
Copy link
Copy Markdown
Contributor Author

thejpster commented Apr 3, 2026

rebased

@jonathanpallant jonathanpallant added this pull request to the merge queue Apr 14, 2026
Merged via the queue into rust-embedded:main with commit 9807cc9 Apr 14, 2026
50 checks passed
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.

4 participants