aboutsummaryrefslogtreecommitdiff
path: root/ld/scripttempl
diff options
context:
space:
mode:
authorSenthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com>2015-02-24 11:26:28 +0000
committerNick Clifton <nickc@redhat.com>2015-02-24 11:26:28 +0000
commitcb0728165e282be2ad9b121c8c1e9da98c9784e4 (patch)
treeadd743d75d0f02985262cd0062ec3b7dd1710eac /ld/scripttempl
parent0821d5b14efc2fb0c929ba077855cbc5e7a0932a (diff)
downloadgdb-cb0728165e282be2ad9b121c8c1e9da98c9784e4.zip
gdb-cb0728165e282be2ad9b121c8c1e9da98c9784e4.tar.gz
gdb-cb0728165e282be2ad9b121c8c1e9da98c9784e4.tar.bz2
This patch modifies the AVR linker script templates to use __<name>_REGION_LENGTH__ symbols, if provided, for setting memory region lengths, defaulting to the current constant values otherwise.
ld * scripttempl/avr.sc: Add new user_signatures region. Define and Use symbols for all region lengths. * scripttempl/avrtiny.sc: Define and use symbols for all region lengths. testsuite * ld-avr/region_overflow.d: New test. * ld-avr/region_overflow.s: Likewise.
Diffstat (limited to 'ld/scripttempl')
-rw-r--r--ld/scripttempl/avr.sc21
-rw-r--r--ld/scripttempl/avrtiny.sc16
2 files changed, 26 insertions, 11 deletions
diff --git a/ld/scripttempl/avr.sc b/ld/scripttempl/avr.sc
index cc4561f..038e7ab 100644
--- a/ld/scripttempl/avr.sc
+++ b/ld/scripttempl/avr.sc
@@ -14,14 +14,23 @@ cat <<EOF
OUTPUT_FORMAT("${OUTPUT_FORMAT}","${OUTPUT_FORMAT}","${OUTPUT_FORMAT}")
OUTPUT_ARCH(${ARCH})
+__TEXT_REGION_LENGTH__ = DEFINED(__TEXT_REGION_LENGTH__) ? __TEXT_REGION_LENGTH__ : $TEXT_LENGTH;
+__DATA_REGION_LENGTH__ = DEFINED(__DATA_REGION_LENGTH__) ? __DATA_REGION_LENGTH__ : $DATA_LENGTH;
+__EEPROM_REGION_LENGTH__ = DEFINED(__EEPROM_REGION_LENGTH__) ? __EEPROM_REGION_LENGTH__ : 64K;
+__FUSE_REGION_LENGTH__ = DEFINED(__FUSE_REGION_LENGTH__) ? __FUSE_REGION_LENGTH__ : 1K;
+__LOCK_REGION_LENGTH__ = DEFINED(__LOCK_REGION_LENGTH__) ? __LOCK_REGION_LENGTH__ : 1K;
+__SIGNATURE_REGION_LENGTH__ = DEFINED(__SIGNATURE_REGION_LENGTH__) ? __SIGNATURE_REGION_LENGTH__ : 1K;
+__USER_SIGNATURE_REGION_LENGTH__ = DEFINED(__USER_SIGNATURE_REGION_LENGTH__) ? __USER_SIGNATURE_REGION_LENGTH__ : 1K;
+
MEMORY
{
- text (rx) : ORIGIN = 0, LENGTH = $TEXT_LENGTH
- data (rw!x) : ORIGIN = $DATA_ORIGIN, LENGTH = $DATA_LENGTH
- eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 64K
- fuse (rw!x) : ORIGIN = 0x820000, LENGTH = 1K
- lock (rw!x) : ORIGIN = 0x830000, LENGTH = 1K
- signature (rw!x) : ORIGIN = 0x840000, LENGTH = 1K
+ text (rx) : ORIGIN = 0, LENGTH = __TEXT_REGION_LENGTH__
+ data (rw!x) : ORIGIN = $DATA_ORIGIN, LENGTH = __DATA_REGION_LENGTH__
+ eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = __EEPROM_REGION_LENGTH__
+ fuse (rw!x) : ORIGIN = 0x820000, LENGTH = __FUSE_REGION_LENGTH__
+ lock (rw!x) : ORIGIN = 0x830000, LENGTH = __LOCK_REGION_LENGTH__
+ signature (rw!x) : ORIGIN = 0x840000, LENGTH = __SIGNATURE_REGION_LENGTH__
+ user_signatures (rw!x) : ORIGIN = 0x850000, LENGTH = __USER_SIGNATURE_REGION_LENGTH__
}
SECTIONS
diff --git a/ld/scripttempl/avrtiny.sc b/ld/scripttempl/avrtiny.sc
index 6e8b09d..a4cf5db 100644
--- a/ld/scripttempl/avrtiny.sc
+++ b/ld/scripttempl/avrtiny.sc
@@ -14,17 +14,23 @@ cat <<EOF
OUTPUT_FORMAT("${OUTPUT_FORMAT}","${OUTPUT_FORMAT}","${OUTPUT_FORMAT}")
OUTPUT_ARCH(${ARCH})
+__TEXT_REGION_LENGTH__ = DEFINED(__TEXT_REGION_LENGTH__) ? __TEXT_REGION_LENGTH__ : $TEXT_LENGTH;
+__DATA_REGION_LENGTH__ = DEFINED(__DATA_REGION_LENGTH__) ? __DATA_REGION_LENGTH__ : $DATA_LENGTH;
+__FUSE_REGION_LENGTH__ = DEFINED(__FUSE_REGION_LENGTH__) ? __FUSE_REGION_LENGTH__ : 2;
+__LOCK_REGION_LENGTH__ = DEFINED(__LOCK_REGION_LENGTH__) ? __LOCK_REGION_LENGTH__ : 2;
+__SIGNATURE_REGION_LENGTH__ = DEFINED(__SIGNATURE_REGION_LENGTH__) ? __SIGNATURE_REGION_LENGTH__ : 4;
+
MEMORY
{
- text (rx) : ORIGIN = $TEXT_ORIGIN, LENGTH = $TEXT_LENGTH
- data (rw!x) : ORIGIN = $DATA_ORIGIN, LENGTH = $DATA_LENGTH
+ text (rx) : ORIGIN = $TEXT_ORIGIN, LENGTH = __TEXT_REGION_LENGTH__
+ data (rw!x) : ORIGIN = $DATA_ORIGIN, LENGTH = __DATA_REGION_LENGTH__
/* Provide offsets for config, lock and signature to match
production file format. Ignore offsets in datasheet. */
- config (rw!x) : ORIGIN = 0x820000, LENGTH = 2
- lock (rw!x) : ORIGIN = 0x830000, LENGTH = 2
- signature (rw!x) : ORIGIN = 0x840000, LENGTH = 4
+ config (rw!x) : ORIGIN = 0x820000, LENGTH = __FUSE_REGION_LENGTH__
+ lock (rw!x) : ORIGIN = 0x830000, LENGTH = __LOCK_REGION_LENGTH__
+ signature (rw!x) : ORIGIN = 0x840000, LENGTH = __SIGNATURE_REGION_LENGTH__
}
SECTIONS