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).
This commit is contained in:
Ayke van Laethem 2017-11-13 22:27:50 +01:00 committed by Damien George
parent 83f38a99a9
commit fcc1568546
12 changed files with 56 additions and 59 deletions

View File

@ -1,28 +1,20 @@
/* define output sections */ /* define output sections */
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 */ /* The program code and other data goes into FLASH */
.text : .text :
{ {
. = ALIGN(4); . = ALIGN(4);
*(.text) /* .text sections (code) */ KEEP(*(.isr_vector)) /* Startup code */
*(.text*) /* .text* sections (code) */ *(.text) /* .text sections (code) */
*(.rodata) /* .rodata sections (constants, strings, etc.) */ *(.text*) /* .text* sections (code) */
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */ *(.rodata) /* .rodata sections (constants, strings, etc.) */
/* *(.glue_7) */ /* glue arm to thumb code */ *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
/* *(.glue_7t) */ /* glue thumb to arm code */ /* *(.glue_7) */ /* glue arm to thumb code */
/* *(.glue_7t) */ /* glue thumb to arm code */
. = ALIGN(4); . = ALIGN(4);
_etext = .; /* define a global symbol at end of code */ _etext = .; /* define a global symbol at end of code */
} >FLASH_TEXT } >FLASH_TEXT
/* /*
@ -101,3 +93,6 @@ SECTIONS
.ARM.attributes 0 : { *(.ARM.attributes) } .ARM.attributes 0 : { *(.ARM.attributes) }
} }
_flash_user_start = ORIGIN(FLASH_USER);
_flash_user_end = ORIGIN(FLASH_USER) + LENGTH(FLASH_USER);

View File

@ -3,12 +3,14 @@
*/ */
/* Specify the memory areas */ /* Specify the memory areas */
/* Memory map: https://learn.adafruit.com/bluefruit-nrf52-feather-learning-guide/memory-map */
MEMORY MEMORY
{ {
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x080000 /* entire flash, 512 KiB */ FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 512K /* entire flash */
FLASH_ISR (rx) : ORIGIN = 0x0001c000, LENGTH = 0x001000 /* sector 0, 4 KiB */ FLASH_TEXT (rx) : ORIGIN = 0x0001C000, LENGTH = 162K /* app */
FLASH_TEXT (rx) : ORIGIN = 0x0001c400, LENGTH = 0x026c00 /* 152 KiB - APP - ISR */ FLASH_TEMP (rx) : ORIGIN = 0x00044800, LENGTH = 162K /* temporary storage area for DFU */
RAM (xrw) : ORIGIN = 0x200039c0, LENGTH = 0x0c640 /* 49.5 KiB, give 8KiB headroom for softdevice */ 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 */ /* produce a link error if there is not this amount of RAM for these sections */

View File

@ -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 */ /* Specify the memory areas */
SEARCH_DIR(.) SEARCH_DIR(.)
GROUP(-lgcc -lc -lnosys) GROUP(-lgcc -lc -lnosys)
MEMORY MEMORY
{ {
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x040000 /* entire flash, 256 KiB */ FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 256K /* entire flash */
FLASH_ISR (rx) : ORIGIN = 0x00000000, LENGTH = 0x000400 /* sector 0, 1 KiB */ FLASH_TEXT (rx) : ORIGIN = 0x00000000, LENGTH = 192K /* app */
FLASH_TEXT (rx) : ORIGIN = 0x00000400, LENGTH = 0x03FC00 /* 255 KiB */ FLASH_USER (rx) : ORIGIN = 0x00030000, LENGTH = 64K /* app data, filesystem */
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 0x004000 /* 16 KiB */ RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 16K /* use all RAM */
} }
/* produce a link error if there is not this amount of RAM for these sections */ /* produce a link error if there is not this amount of RAM for these sections */

View File

@ -6,10 +6,10 @@ SEARCH_DIR(.)
GROUP(-lgcc -lc -lnosys) GROUP(-lgcc -lc -lnosys)
MEMORY MEMORY
{ {
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x040000 /* entire flash, 256 KiB */ FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 256K /* entire flash */
FLASH_ISR (rx) : ORIGIN = 0x00018000, LENGTH = 0x000400 /* sector 0, 1 KiB */ FLASH_TEXT (rx) : ORIGIN = 0x00018000, LENGTH = 140K /* app */
FLASH_TEXT (rx) : ORIGIN = 0x00018400, LENGTH = 0x027c00 /* 159 KiB */ FLASH_USER (rx) : ORIGIN = 0x0003B000, LENGTH = 20K /* app data, filesystem */
RAM (xrw) : ORIGIN = 0x20002000, LENGTH = 0x002000 /* 8 KiB */ RAM (xrw) : ORIGIN = 0x20002000, LENGTH = 8K /* app RAM */
} }
/* produce a link error if there is not this amount of RAM for these sections */ /* produce a link error if there is not this amount of RAM for these sections */

View File

@ -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 */ /* Specify the memory areas */
SEARCH_DIR(.) SEARCH_DIR(.)
GROUP(-lgcc -lc -lnosys) GROUP(-lgcc -lc -lnosys)
MEMORY MEMORY
{ {
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x040000 /* entire flash, 256 KiB */ FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 256K /* entire flash */
FLASH_ISR (rx) : ORIGIN = 0x00000000, LENGTH = 0x000400 /* sector 0, 1 KiB */ FLASH_TEXT (rx) : ORIGIN = 0x00000000, LENGTH = 192K /* app */
FLASH_TEXT (rx) : ORIGIN = 0x00000400, LENGTH = 0x03F000 /* 255 KiB */ FLASH_USER (rx) : ORIGIN = 0x00030000, LENGTH = 64K /* app data, filesystem */
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 0x008000 /* 32 KiB */ RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 32K /* use all RAM */
} }
/* produce a link error if there is not this amount of RAM for these sections */ /* produce a link error if there is not this amount of RAM for these sections */

View File

@ -6,10 +6,10 @@ SEARCH_DIR(.)
GROUP(-lgcc -lc -lnosys) GROUP(-lgcc -lc -lnosys)
MEMORY MEMORY
{ {
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x040000 /* entire flash, 256 KiB */ FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 256K /* entire flash */
FLASH_ISR (rx) : ORIGIN = 0x00018000, LENGTH = 0x000400 /* sector 0, 1 KiB */ FLASH_TEXT (rx) : ORIGIN = 0x00018000, LENGTH = 140K /* app */
FLASH_TEXT (rx) : ORIGIN = 0x00018400, LENGTH = 0x027c00 /* 159 KiB */ FLASH_USER (rx) : ORIGIN = 0x0003B000, LENGTH = 20K /* app data, filesystem */
RAM (xrw) : ORIGIN = 0x20002000, LENGTH = 0x006000 /* 24 KiB */ RAM (xrw) : ORIGIN = 0x20002000, LENGTH = 24K /* app RAM */
} }
/* produce a link error if there is not this amount of RAM for these sections */ /* produce a link error if there is not this amount of RAM for these sections */

View File

@ -6,10 +6,10 @@ SEARCH_DIR(.)
GROUP(-lgcc -lc -lnosys) GROUP(-lgcc -lc -lnosys)
MEMORY MEMORY
{ {
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x040000 /* entire flash, 256 KiB */ FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 256K /* entire flash */
FLASH_ISR (rx) : ORIGIN = 0x0001D000, LENGTH = 0x000400 /* sector 0, 1 KiB */ FLASH_TEXT (rx) : ORIGIN = 0x0001D000, LENGTH = 130K /* app */
FLASH_TEXT (rx) : ORIGIN = 0x0001D400, LENGTH = 0x022c00 /* 139 KiB */ FLASH_USER (rx) : ORIGIN = 0x0003D800, LENGTH = 10K /* app data, filesystem */
RAM (xrw) : ORIGIN = 0x20002800, LENGTH = 0x005800 /* 22 KiB */ RAM (xrw) : ORIGIN = 0x20002800, LENGTH = 22K /* app RAM */
} }
/* produce a link error if there is not this amount of RAM for these sections */ /* produce a link error if there is not this amount of RAM for these sections */

View File

@ -6,9 +6,9 @@ SEARCH_DIR(.)
GROUP(-lgcc -lc -lnosys) GROUP(-lgcc -lc -lnosys)
MEMORY MEMORY
{ {
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x040000 /* entire flash, 256 KiB */ FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 256K /* entire flash */
FLASH_ISR (rx) : ORIGIN = 0x0001b000, LENGTH = 0x000400 /* sector 0, 1 KiB */ FLASH_TEXT (rx) : ORIGIN = 0x0001B000, LENGTH = 130K /* app */
FLASH_TEXT (rx) : ORIGIN = 0x0001b400, LENGTH = 0x024c00 /* 147 KiB */ FLASH_USER (rx) : ORIGIN = 0x0003B000, LENGTH = 18K /* app data, filesystem */
RAM (xrw) : ORIGIN = 0x200013c8, LENGTH = 0x006c38 /* 27 KiB */ RAM (xrw) : ORIGIN = 0x200013c8, LENGTH = 0x006c38 /* 27 KiB */
} }

View File

@ -5,10 +5,10 @@
/* Specify the memory areas */ /* Specify the memory areas */
MEMORY MEMORY
{ {
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x080000 /* entire flash, 512 KiB */ FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 512K /* entire flash */
FLASH_ISR (rx) : ORIGIN = 0x00000000, LENGTH = 0x001000 /* sector 0, 4 KiB */ FLASH_TEXT (rx) : ORIGIN = 0x00000000, LENGTH = 448K /* app */
FLASH_TEXT (rx) : ORIGIN = 0x00001000, LENGTH = 0x07F000 /* 508 KiB */ FLASH_USER (rx) : ORIGIN = 0x00070000, LENGTH = 64K /* app data, filesystem */
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 0x010000 /* 64 KiB */ RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 64K /* use all RAM */
} }
/* produce a link error if there is not this amount of RAM for these sections */ /* produce a link error if there is not this amount of RAM for these sections */

View File

@ -5,9 +5,9 @@
/* Specify the memory areas */ /* Specify the memory areas */
MEMORY MEMORY
{ {
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x080000 /* entire flash, 512 KiB */ FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 512K /* entire flash */
FLASH_ISR (rx) : ORIGIN = 0x0001c000, LENGTH = 0x001000 /* sector 0, 4 KiB */ FLASH_TEXT (rx) : ORIGIN = 0x0001c000, LENGTH = 336K /* app */
FLASH_TEXT (rx) : ORIGIN = 0x0001d000, LENGTH = 0x060000 /* 396 KiB */ FLASH_USER (rx) : ORIGIN = 0x00070000, LENGTH = 64K /* app data, filesystem */
RAM (xrw) : ORIGIN = 0x200039c0, LENGTH = 0x0c640 /* 49.5 KiB, give 8KiB headroom for softdevice */ RAM (xrw) : ORIGIN = 0x200039c0, LENGTH = 0x0c640 /* 49.5 KiB, give 8KiB headroom for softdevice */
} }

View File

@ -5,9 +5,9 @@
/* Specify the memory areas */ /* Specify the memory areas */
MEMORY MEMORY
{ {
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x080000 /* entire flash, 512 KiB */ FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 512K /* entire flash */
FLASH_ISR (rx) : ORIGIN = 0x0001f000, LENGTH = 0x001000 /* sector 0, 4 KiB */ FLASH_TEXT (rx) : ORIGIN = 0x0001F000, LENGTH = 324K /* app */
FLASH_TEXT (rx) : ORIGIN = 0x00020000, LENGTH = 0x060000 /* 396 KiB */ FLASH_USER (rx) : ORIGIN = 0x00070000, LENGTH = 64K /* app data, filesystem */
RAM (xrw) : ORIGIN = 0x200039c0, LENGTH = 0x0c640 /* 49.5 KiB, give 8KiB headroom for softdevice */ RAM (xrw) : ORIGIN = 0x200039c0, LENGTH = 0x0c640 /* 49.5 KiB, give 8KiB headroom for softdevice */
} }

View File

@ -5,10 +5,10 @@
/* Specify the memory areas */ /* Specify the memory areas */
MEMORY MEMORY
{ {
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x100000 /* entire flash, 1 MiB */ FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 1M /* entire flash */
FLASH_ISR (rx) : ORIGIN = 0x00000000, LENGTH = 0x001000 /* sector 0, 4 KiB */ FLASH_TEXT (rx) : ORIGIN = 0x00000000, LENGTH = 960K /* app */
FLASH_TEXT (rx) : ORIGIN = 0x00001000, LENGTH = 0x0FF000 /* 1020 KiB */ FLASH_USER (rx) : ORIGIN = 0x000F0000, LENGTH = 64K /* app data, filesystem */
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 0x040000 /* 256 KiB */ RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 256K /* use all RAM */
} }
/* produce a link error if there is not this amount of RAM for these sections */ /* produce a link error if there is not this amount of RAM for these sections */