aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAyke van Laethem2017-11-13 22:27:50 +0100
committerDamien George2018-07-18 17:12:25 +1000
commitfcc15685465244525d60d45d9084ed1b8ccbeec5 (patch)
tree8c6ac9fecfb0743ff58881176c5e33989fa9de21
parent83f38a99a9831203a9764986ed7fac8060a875dd (diff)
nrf/boards: Update linker scripts.
* Remove FLASH_ISR and merge .isr_vector into FLASH_TEXT. This saves some code space, especially on nRF52 devices. * Reserve space for nonvolatile storage of data. This is the place for a filesystem (to be added).
-rw-r--r--ports/nrf/boards/common.ld27
-rw-r--r--ports/nrf/boards/feather52/custom_nrf52832_dfu_app.ld10
-rw-r--r--ports/nrf/boards/nrf51x22_256k_16k.ld10
-rw-r--r--ports/nrf/boards/nrf51x22_256k_16k_s110_8.0.0.ld8
-rw-r--r--ports/nrf/boards/nrf51x22_256k_32k.ld10
-rw-r--r--ports/nrf/boards/nrf51x22_256k_32k_s110_8.0.0.ld8
-rw-r--r--ports/nrf/boards/nrf51x22_256k_32k_s120_2.1.0.ld8
-rw-r--r--ports/nrf/boards/nrf51x22_256k_32k_s130_2.0.1.ld6
-rw-r--r--ports/nrf/boards/nrf52832_512k_64k.ld8
-rw-r--r--ports/nrf/boards/nrf52832_512k_64k_s132_2.0.1.ld6
-rw-r--r--ports/nrf/boards/nrf52832_512k_64k_s132_3.0.0.ld6
-rw-r--r--ports/nrf/boards/nrf52840_1M_256k.ld8
12 files changed, 56 insertions, 59 deletions
diff --git a/ports/nrf/boards/common.ld b/ports/nrf/boards/common.ld
index c6e4952b4..6dec17480 100644
--- a/ports/nrf/boards/common.ld
+++ b/ports/nrf/boards/common.ld
@@ -1,28 +1,20 @@
/* define output sections */
SECTIONS
{
- /* The startup code goes first into FLASH */
- .isr_vector :
- {
- . = ALIGN(4);
- KEEP(*(.isr_vector)) /* Startup code */
-
- . = ALIGN(4);
- } >FLASH_ISR
-
/* The program code and other data goes into FLASH */
.text :
{
. = ALIGN(4);
- *(.text) /* .text sections (code) */
- *(.text*) /* .text* sections (code) */
- *(.rodata) /* .rodata sections (constants, strings, etc.) */
- *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
- /* *(.glue_7) */ /* glue arm to thumb code */
- /* *(.glue_7t) */ /* glue thumb to arm code */
+ KEEP(*(.isr_vector)) /* Startup code */
+ *(.text) /* .text sections (code) */
+ *(.text*) /* .text* sections (code) */
+ *(.rodata) /* .rodata sections (constants, strings, etc.) */
+ *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
+ /* *(.glue_7) */ /* glue arm to thumb code */
+ /* *(.glue_7t) */ /* glue thumb to arm code */
. = ALIGN(4);
- _etext = .; /* define a global symbol at end of code */
+ _etext = .; /* define a global symbol at end of code */
} >FLASH_TEXT
/*
@@ -101,3 +93,6 @@ SECTIONS
.ARM.attributes 0 : { *(.ARM.attributes) }
}
+
+_flash_user_start = ORIGIN(FLASH_USER);
+_flash_user_end = ORIGIN(FLASH_USER) + LENGTH(FLASH_USER);
diff --git a/ports/nrf/boards/feather52/custom_nrf52832_dfu_app.ld b/ports/nrf/boards/feather52/custom_nrf52832_dfu_app.ld
index de737e158..442ce19e2 100644
--- a/ports/nrf/boards/feather52/custom_nrf52832_dfu_app.ld
+++ b/ports/nrf/boards/feather52/custom_nrf52832_dfu_app.ld
@@ -3,12 +3,14 @@
*/
/* Specify the memory areas */
+/* Memory map: https://learn.adafruit.com/bluefruit-nrf52-feather-learning-guide/memory-map */
MEMORY
{
- FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x080000 /* entire flash, 512 KiB */
- FLASH_ISR (rx) : ORIGIN = 0x0001c000, LENGTH = 0x001000 /* sector 0, 4 KiB */
- FLASH_TEXT (rx) : ORIGIN = 0x0001c400, LENGTH = 0x026c00 /* 152 KiB - APP - ISR */
- RAM (xrw) : ORIGIN = 0x200039c0, LENGTH = 0x0c640 /* 49.5 KiB, give 8KiB headroom for softdevice */
+ FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 512K /* entire flash */
+ FLASH_TEXT (rx) : ORIGIN = 0x0001C000, LENGTH = 162K /* app */
+ FLASH_TEMP (rx) : ORIGIN = 0x00044800, LENGTH = 162K /* temporary storage area for DFU */
+ FLASH_USER (rx) : ORIGIN = 0x0006D000, LENGTH = 28K /* app data, filesystem */
+ RAM (xrw) : ORIGIN = 0x200039C0, LENGTH = 0x0C640 /* 49.5 KiB, give 8KiB headroom for softdevice */
}
/* produce a link error if there is not this amount of RAM for these sections */
diff --git a/ports/nrf/boards/nrf51x22_256k_16k.ld b/ports/nrf/boards/nrf51x22_256k_16k.ld
index e25ae3b87..c63968191 100644
--- a/ports/nrf/boards/nrf51x22_256k_16k.ld
+++ b/ports/nrf/boards/nrf51x22_256k_16k.ld
@@ -1,15 +1,15 @@
/*
- GNU linker script for NRF52 blank w/ no SoftDevice
+ GNU linker script for NRF51 AA w/ no SoftDevice
*/
/* Specify the memory areas */
SEARCH_DIR(.)
GROUP(-lgcc -lc -lnosys)
MEMORY
{
- FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x040000 /* entire flash, 256 KiB */
- FLASH_ISR (rx) : ORIGIN = 0x00000000, LENGTH = 0x000400 /* sector 0, 1 KiB */
- FLASH_TEXT (rx) : ORIGIN = 0x00000400, LENGTH = 0x03FC00 /* 255 KiB */
- RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 0x004000 /* 16 KiB */
+ FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 256K /* entire flash */
+ FLASH_TEXT (rx) : ORIGIN = 0x00000000, LENGTH = 192K /* app */
+ FLASH_USER (rx) : ORIGIN = 0x00030000, LENGTH = 64K /* app data, filesystem */
+ RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 16K /* use all RAM */
}
/* produce a link error if there is not this amount of RAM for these sections */
diff --git a/ports/nrf/boards/nrf51x22_256k_16k_s110_8.0.0.ld b/ports/nrf/boards/nrf51x22_256k_16k_s110_8.0.0.ld
index aa5ff3f83..2e274920a 100644
--- a/ports/nrf/boards/nrf51x22_256k_16k_s110_8.0.0.ld
+++ b/ports/nrf/boards/nrf51x22_256k_16k_s110_8.0.0.ld
@@ -6,10 +6,10 @@ SEARCH_DIR(.)
GROUP(-lgcc -lc -lnosys)
MEMORY
{
- FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x040000 /* entire flash, 256 KiB */
- FLASH_ISR (rx) : ORIGIN = 0x00018000, LENGTH = 0x000400 /* sector 0, 1 KiB */
- FLASH_TEXT (rx) : ORIGIN = 0x00018400, LENGTH = 0x027c00 /* 159 KiB */
- RAM (xrw) : ORIGIN = 0x20002000, LENGTH = 0x002000 /* 8 KiB */
+ FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 256K /* entire flash */
+ FLASH_TEXT (rx) : ORIGIN = 0x00018000, LENGTH = 140K /* app */
+ FLASH_USER (rx) : ORIGIN = 0x0003B000, LENGTH = 20K /* app data, filesystem */
+ RAM (xrw) : ORIGIN = 0x20002000, LENGTH = 8K /* app RAM */
}
/* produce a link error if there is not this amount of RAM for these sections */
diff --git a/ports/nrf/boards/nrf51x22_256k_32k.ld b/ports/nrf/boards/nrf51x22_256k_32k.ld
index 28f806842..e4aa6f9ca 100644
--- a/ports/nrf/boards/nrf51x22_256k_32k.ld
+++ b/ports/nrf/boards/nrf51x22_256k_32k.ld
@@ -1,15 +1,15 @@
/*
- GNU linker script for NRF52 blank w/ no SoftDevice
+ GNU linker script for NRF51 AC w/ no SoftDevice
*/
/* Specify the memory areas */
SEARCH_DIR(.)
GROUP(-lgcc -lc -lnosys)
MEMORY
{
- FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x040000 /* entire flash, 256 KiB */
- FLASH_ISR (rx) : ORIGIN = 0x00000000, LENGTH = 0x000400 /* sector 0, 1 KiB */
- FLASH_TEXT (rx) : ORIGIN = 0x00000400, LENGTH = 0x03F000 /* 255 KiB */
- RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 0x008000 /* 32 KiB */
+ FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 256K /* entire flash */
+ FLASH_TEXT (rx) : ORIGIN = 0x00000000, LENGTH = 192K /* app */
+ FLASH_USER (rx) : ORIGIN = 0x00030000, LENGTH = 64K /* app data, filesystem */
+ RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 32K /* use all RAM */
}
/* produce a link error if there is not this amount of RAM for these sections */
diff --git a/ports/nrf/boards/nrf51x22_256k_32k_s110_8.0.0.ld b/ports/nrf/boards/nrf51x22_256k_32k_s110_8.0.0.ld
index adee5b4bc..1252710f8 100644
--- a/ports/nrf/boards/nrf51x22_256k_32k_s110_8.0.0.ld
+++ b/ports/nrf/boards/nrf51x22_256k_32k_s110_8.0.0.ld
@@ -6,10 +6,10 @@ SEARCH_DIR(.)
GROUP(-lgcc -lc -lnosys)
MEMORY
{
- FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x040000 /* entire flash, 256 KiB */
- FLASH_ISR (rx) : ORIGIN = 0x00018000, LENGTH = 0x000400 /* sector 0, 1 KiB */
- FLASH_TEXT (rx) : ORIGIN = 0x00018400, LENGTH = 0x027c00 /* 159 KiB */
- RAM (xrw) : ORIGIN = 0x20002000, LENGTH = 0x006000 /* 24 KiB */
+ FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 256K /* entire flash */
+ FLASH_TEXT (rx) : ORIGIN = 0x00018000, LENGTH = 140K /* app */
+ FLASH_USER (rx) : ORIGIN = 0x0003B000, LENGTH = 20K /* app data, filesystem */
+ RAM (xrw) : ORIGIN = 0x20002000, LENGTH = 24K /* app RAM */
}
/* produce a link error if there is not this amount of RAM for these sections */
diff --git a/ports/nrf/boards/nrf51x22_256k_32k_s120_2.1.0.ld b/ports/nrf/boards/nrf51x22_256k_32k_s120_2.1.0.ld
index 3de7083fd..210680ded 100644
--- a/ports/nrf/boards/nrf51x22_256k_32k_s120_2.1.0.ld
+++ b/ports/nrf/boards/nrf51x22_256k_32k_s120_2.1.0.ld
@@ -6,10 +6,10 @@ SEARCH_DIR(.)
GROUP(-lgcc -lc -lnosys)
MEMORY
{
- FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x040000 /* entire flash, 256 KiB */
- FLASH_ISR (rx) : ORIGIN = 0x0001D000, LENGTH = 0x000400 /* sector 0, 1 KiB */
- FLASH_TEXT (rx) : ORIGIN = 0x0001D400, LENGTH = 0x022c00 /* 139 KiB */
- RAM (xrw) : ORIGIN = 0x20002800, LENGTH = 0x005800 /* 22 KiB */
+ FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 256K /* entire flash */
+ FLASH_TEXT (rx) : ORIGIN = 0x0001D000, LENGTH = 130K /* app */
+ FLASH_USER (rx) : ORIGIN = 0x0003D800, LENGTH = 10K /* app data, filesystem */
+ RAM (xrw) : ORIGIN = 0x20002800, LENGTH = 22K /* app RAM */
}
/* produce a link error if there is not this amount of RAM for these sections */
diff --git a/ports/nrf/boards/nrf51x22_256k_32k_s130_2.0.1.ld b/ports/nrf/boards/nrf51x22_256k_32k_s130_2.0.1.ld
index 1845f973f..ba2aec4c4 100644
--- a/ports/nrf/boards/nrf51x22_256k_32k_s130_2.0.1.ld
+++ b/ports/nrf/boards/nrf51x22_256k_32k_s130_2.0.1.ld
@@ -6,9 +6,9 @@ SEARCH_DIR(.)
GROUP(-lgcc -lc -lnosys)
MEMORY
{
- FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x040000 /* entire flash, 256 KiB */
- FLASH_ISR (rx) : ORIGIN = 0x0001b000, LENGTH = 0x000400 /* sector 0, 1 KiB */
- FLASH_TEXT (rx) : ORIGIN = 0x0001b400, LENGTH = 0x024c00 /* 147 KiB */
+ FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 256K /* entire flash */
+ FLASH_TEXT (rx) : ORIGIN = 0x0001B000, LENGTH = 130K /* app */
+ FLASH_USER (rx) : ORIGIN = 0x0003B000, LENGTH = 18K /* app data, filesystem */
RAM (xrw) : ORIGIN = 0x200013c8, LENGTH = 0x006c38 /* 27 KiB */
}
diff --git a/ports/nrf/boards/nrf52832_512k_64k.ld b/ports/nrf/boards/nrf52832_512k_64k.ld
index afd7d359f..e547abe79 100644
--- a/ports/nrf/boards/nrf52832_512k_64k.ld
+++ b/ports/nrf/boards/nrf52832_512k_64k.ld
@@ -5,10 +5,10 @@
/* Specify the memory areas */
MEMORY
{
- FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x080000 /* entire flash, 512 KiB */
- FLASH_ISR (rx) : ORIGIN = 0x00000000, LENGTH = 0x001000 /* sector 0, 4 KiB */
- FLASH_TEXT (rx) : ORIGIN = 0x00001000, LENGTH = 0x07F000 /* 508 KiB */
- RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 0x010000 /* 64 KiB */
+ FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 512K /* entire flash */
+ FLASH_TEXT (rx) : ORIGIN = 0x00000000, LENGTH = 448K /* app */
+ FLASH_USER (rx) : ORIGIN = 0x00070000, LENGTH = 64K /* app data, filesystem */
+ RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 64K /* use all RAM */
}
/* produce a link error if there is not this amount of RAM for these sections */
diff --git a/ports/nrf/boards/nrf52832_512k_64k_s132_2.0.1.ld b/ports/nrf/boards/nrf52832_512k_64k_s132_2.0.1.ld
index 05e1daa89..45dd19dd7 100644
--- a/ports/nrf/boards/nrf52832_512k_64k_s132_2.0.1.ld
+++ b/ports/nrf/boards/nrf52832_512k_64k_s132_2.0.1.ld
@@ -5,9 +5,9 @@
/* Specify the memory areas */
MEMORY
{
- FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x080000 /* entire flash, 512 KiB */
- FLASH_ISR (rx) : ORIGIN = 0x0001c000, LENGTH = 0x001000 /* sector 0, 4 KiB */
- FLASH_TEXT (rx) : ORIGIN = 0x0001d000, LENGTH = 0x060000 /* 396 KiB */
+ FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 512K /* entire flash */
+ FLASH_TEXT (rx) : ORIGIN = 0x0001c000, LENGTH = 336K /* app */
+ FLASH_USER (rx) : ORIGIN = 0x00070000, LENGTH = 64K /* app data, filesystem */
RAM (xrw) : ORIGIN = 0x200039c0, LENGTH = 0x0c640 /* 49.5 KiB, give 8KiB headroom for softdevice */
}
diff --git a/ports/nrf/boards/nrf52832_512k_64k_s132_3.0.0.ld b/ports/nrf/boards/nrf52832_512k_64k_s132_3.0.0.ld
index 159c159b2..68a02a5b0 100644
--- a/ports/nrf/boards/nrf52832_512k_64k_s132_3.0.0.ld
+++ b/ports/nrf/boards/nrf52832_512k_64k_s132_3.0.0.ld
@@ -5,9 +5,9 @@
/* Specify the memory areas */
MEMORY
{
- FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x080000 /* entire flash, 512 KiB */
- FLASH_ISR (rx) : ORIGIN = 0x0001f000, LENGTH = 0x001000 /* sector 0, 4 KiB */
- FLASH_TEXT (rx) : ORIGIN = 0x00020000, LENGTH = 0x060000 /* 396 KiB */
+ FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 512K /* entire flash */
+ FLASH_TEXT (rx) : ORIGIN = 0x0001F000, LENGTH = 324K /* app */
+ FLASH_USER (rx) : ORIGIN = 0x00070000, LENGTH = 64K /* app data, filesystem */
RAM (xrw) : ORIGIN = 0x200039c0, LENGTH = 0x0c640 /* 49.5 KiB, give 8KiB headroom for softdevice */
}
diff --git a/ports/nrf/boards/nrf52840_1M_256k.ld b/ports/nrf/boards/nrf52840_1M_256k.ld
index 43b445831..555ba0bc6 100644
--- a/ports/nrf/boards/nrf52840_1M_256k.ld
+++ b/ports/nrf/boards/nrf52840_1M_256k.ld
@@ -5,10 +5,10 @@
/* Specify the memory areas */
MEMORY
{
- FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x100000 /* entire flash, 1 MiB */
- FLASH_ISR (rx) : ORIGIN = 0x00000000, LENGTH = 0x001000 /* sector 0, 4 KiB */
- FLASH_TEXT (rx) : ORIGIN = 0x00001000, LENGTH = 0x0FF000 /* 1020 KiB */
- RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 0x040000 /* 256 KiB */
+ FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 1M /* entire flash */
+ FLASH_TEXT (rx) : ORIGIN = 0x00000000, LENGTH = 960K /* app */
+ FLASH_USER (rx) : ORIGIN = 0x000F0000, LENGTH = 64K /* app data, filesystem */
+ RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 256K /* use all RAM */
}
/* produce a link error if there is not this amount of RAM for these sections */