[rtems commit] bsps/arm: Add support for MPU region alignment

Sebastian Huber sebh at rtems.org
Wed Oct 21 05:59:30 UTC 2020


Module:    rtems
Branch:    master
Commit:    3fccdc956c298a3f8942e83f3c933ade447e3c16
Changeset: http://git.rtems.org/rtems/commit/?id=3fccdc956c298a3f8942e83f3c933ade447e3c16

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Mar 20 08:10:46 2020 +0100

bsps/arm: Add support for MPU region alignment

Update #3910.

---

 bsps/arm/shared/start/linkcmds.base | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/bsps/arm/shared/start/linkcmds.base b/bsps/arm/shared/start/linkcmds.base
index 1f5f1ef..9b24429 100644
--- a/bsps/arm/shared/start/linkcmds.base
+++ b/bsps/arm/shared/start/linkcmds.base
@@ -81,6 +81,17 @@ SECTIONS {
 	} > REGION_TEXT AT > REGION_TEXT_LOAD
 	.fini : ALIGN_WITH_INPUT {
 		KEEP (*(.fini))
+
+		/*
+		 * If requested, align the size of the combined start and text
+		 * section to the next power of two to meet MPU region
+		 * alignment requirements.
+		 */
+		. = DEFINED (bsp_align_text_and_rodata_end_to_power_of_2) ?
+		    bsp_section_start_begin
+		    + ALIGN (. - bsp_section_start_begin,
+		    1 << LOG2CEIL (. - bsp_section_start_begin)) : .;
+
 		bsp_section_text_end = .;
 	} > REGION_TEXT AT > REGION_TEXT_LOAD
 	bsp_section_text_size = bsp_section_text_end - bsp_section_text_begin;
@@ -248,6 +259,16 @@ SECTIONS {
 		*(set_pseudo_*);
 
 		KEEP (*(SORT(.rtemsroset.*)))
+
+		/*
+		 * If requested, align the size of the rodata section to the
+		 * next power of two to meet MPU region alignment requirements.
+		 */
+		. = DEFINED (bsp_align_text_and_rodata_end_to_power_of_2) ?
+		    bsp_section_rodata_begin
+		    + ALIGN (. - bsp_section_rodata_begin,
+		    1 << LOG2CEIL (. - bsp_section_rodata_begin)) : .;
+
 		bsp_section_rodata_end = .;
 	} > REGION_RODATA AT > REGION_RODATA_LOAD
 	bsp_section_rodata_size = bsp_section_rodata_end - bsp_section_rodata_begin;



More information about the vc mailing list