summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2020-03-20 08:10:46 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2020-10-20 17:57:54 +0200
commit79e364c24510f794be3490e0048b61a112eeed0a (patch)
treede69b43569848eb5063b0b77b99f62e882aac88c
parentdaeb0a1881b54f91ad525f0dd70da857d661d209 (diff)
bsps/arm: Add support for MPU region alignment
-rw-r--r--bsps/arm/shared/start/linkcmds.base21
1 files changed, 21 insertions, 0 deletions
diff --git a/bsps/arm/shared/start/linkcmds.base b/bsps/arm/shared/start/linkcmds.base
index 1f5f1ef959..d0663cf97e 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_section_do_mpu_align) ?
+ 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_section_do_mpu_align) ?
+ 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;