Refactor and combine STM32H7 linker scripts #356
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary of changes
Up until now, the linker scripts for STM32H7 have been quite difficult to maintain, because there were 10+ different MCUs with their own linker scripts, and each of these linker scripts was slightly different from the others. This caused a number of issues, such as:
To fix those issues, and to make maintenance easier going forward, I combined all of those linker scripts together into just four scripts:
(refer to here if you need a refresher on what the different families mean).
As part of this, I also reworked how memory is handled in the STM32H7 ethernet driver. Instead of relying on rickety absolute addresses and fixed MPU regions (that also conflicted with the Mbed MPU code, oops), it now uses a dynamically sized MPU region that's set up the same in all of the linker scripts to handle the descriptors. And for the buffers, those don't need an MPU region, so we can just stick those in normal memory and use CacheAlignedBuffer to handle the cache-DMA coherency.
To be honest, I am proud of this refactor and I would really like to start doing more linker scripts in this manner. It is much cleaner and more resilient to config changes!
Impact of changes
Migration actions required
Documentation
None
Pull request type
Test results
Working on running tests...