aboutsummaryrefslogtreecommitdiff
path: root/cortex-m-rt/link.x.in
diff options
context:
space:
mode:
authorGravatar Adam Greig <adam@adamgreig.com> 2018-08-12 01:09:21 +0100
committerGravatar Adam Greig <adam@adamgreig.com> 2018-08-12 01:20:18 +0100
commit277436ec86b3e52fe070f54f10cca64e3800177f (patch)
treec82956a7730b299c2cf529ad9919dcd5c996533f /cortex-m-rt/link.x.in
parentb4186cfe5fc9a8e51d73549cddbf0f49db3a49ba (diff)
downloadcortex-m-277436ec86b3e52fe070f54f10cca64e3800177f.tar.gz
cortex-m-277436ec86b3e52fe070f54f10cca64e3800177f.tar.zst
cortex-m-277436ec86b3e52fe070f54f10cca64e3800177f.zip
Update linker script to put .data into FLASH
Previously .data's LMA was specified by a computated address instead of placing it into FLASH explicitly, which means FLASH overflows caused by .data would not be detected by the linker. Fixes #86.
Diffstat (limited to 'cortex-m-rt/link.x.in')
-rw-r--r--cortex-m-rt/link.x.in14
1 files changed, 7 insertions, 7 deletions
diff --git a/cortex-m-rt/link.x.in b/cortex-m-rt/link.x.in
index 5fa7dbf..dfcf262 100644
--- a/cortex-m-rt/link.x.in
+++ b/cortex-m-rt/link.x.in
@@ -84,24 +84,24 @@ SECTIONS
} > FLASH
/* ### .rodata */
- .rodata :
+ .rodata : ALIGN(4)
{
*(.rodata .rodata.*);
- /* 4-byte align the end (VMA) of this section */
- /* WHY? To my knowledge there's no way to indicate the alignment of *LMA* so we align *this*
- section with the goal of using its end address as the LMA of .data */
+ /* 4-byte align the end (VMA) of this section.
+ This is required by LLD to ensure the LMA of the following .data
+ section will have the correct alignment. */
. = ALIGN(4);
} > FLASH
/* ## Sections in RAM */
/* ### .data */
- .data : AT(ADDR(.rodata) + SIZEOF(.rodata)) /* LMA */
+ .data : ALIGN(4)
{
*(.data .data.*);
. = ALIGN(4); /* 4-byte align the end (VMA) of this section */
- } > RAM
+ } > RAM AT > FLASH
/* VMA of .data */
__sdata = ADDR(.data);
@@ -111,7 +111,7 @@ SECTIONS
__sidata = LOADADDR(.data);
/* ### .bss */
- .bss :
+ .bss : ALIGN(4)
{
*(.bss .bss.*);