targets: clean up and unify linker scripts
Especially arm.ld needed some cleaning up. Other than that, I've made sure the two linker scripts look similar where possible.
Этот коммит содержится в:
родитель
2122780309
коммит
5b0aaf0d39
3 изменённых файлов: 28 добавлений и 41 удалений
|
@ -10,18 +10,14 @@ _stack_size = 2K;
|
||||||
/* define output sections */
|
/* define output sections */
|
||||||
SECTIONS
|
SECTIONS
|
||||||
{
|
{
|
||||||
/* The program code and other data goes into FLASH */
|
/* Program code and read-only data goes to FLASH_TEXT. */
|
||||||
.text :
|
.text :
|
||||||
{
|
{
|
||||||
_stext = .;
|
|
||||||
. = ALIGN(4);
|
|
||||||
KEEP(*(.isr_vector))
|
KEEP(*(.isr_vector))
|
||||||
*(.text) /* .text sections (code) */
|
*(.text)
|
||||||
*(.text*) /* .text* sections (code) */
|
*(.text*)
|
||||||
*(.rodata) /* .rodata sections (constants, strings, etc.) */
|
*(.rodata)
|
||||||
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
|
*(.rodata*)
|
||||||
. = ALIGN(4);
|
|
||||||
_etext = .; /* define a global symbol at end of code */
|
|
||||||
} >FLASH_TEXT
|
} >FLASH_TEXT
|
||||||
|
|
||||||
/* Put the stack at the bottom of RAM, so that the application will
|
/* Put the stack at the bottom of RAM, so that the application will
|
||||||
|
@ -31,54 +27,41 @@ SECTIONS
|
||||||
{
|
{
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
. += _stack_size;
|
. += _stack_size;
|
||||||
__StackTop = .;
|
_stack_top = .;
|
||||||
} >RAM
|
} >RAM
|
||||||
|
|
||||||
|
/* Start address (in flash) of .data, used by startup code. */
|
||||||
_sidata = LOADADDR(.data);
|
_sidata = LOADADDR(.data);
|
||||||
|
|
||||||
/* This is the initialized data section
|
/* Globals with initial value */
|
||||||
The program executes knowing that the data is in the RAM
|
|
||||||
but the loader puts the initial values in the FLASH (inidata).
|
|
||||||
It is one task of the startup to copy the initial values from FLASH to RAM. */
|
|
||||||
.data :
|
.data :
|
||||||
{
|
{
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
_sdata = .; /* create a global symbol at data start; used by startup code in order to initialise the .data section in RAM */
|
_sdata = .; /* used by startup code */
|
||||||
*(.data) /* .data sections */
|
*(.data)
|
||||||
*(.data*) /* .data* sections */
|
*(.data*)
|
||||||
|
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
_edata = .; /* define a global symbol at data end; used by startup code in order to initialise the .data section in RAM */
|
_edata = .; /* used by startup code */
|
||||||
} >RAM AT>FLASH_TEXT
|
} >RAM AT>FLASH_TEXT
|
||||||
|
|
||||||
/* Uninitialized data section */
|
/* Zero-initialized globals */
|
||||||
.bss :
|
.bss :
|
||||||
{
|
{
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
_sbss = .; /* define a global symbol at bss start; used by startup code */
|
_sbss = .; /* used by startup code */
|
||||||
*(.bss)
|
*(.bss)
|
||||||
*(.bss*)
|
*(.bss*)
|
||||||
*(COMMON)
|
*(COMMON)
|
||||||
|
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
_ebss = .; /* define a global symbol at bss end; used by startup code and GC */
|
_ebss = .; /* used by startup code */
|
||||||
} >RAM
|
} >RAM
|
||||||
|
|
||||||
/DISCARD/ :
|
/DISCARD/ :
|
||||||
{
|
{
|
||||||
*(.ARM.exidx.*)
|
*(.ARM.exidx.*) /* causes spurious 'undefined reference' errors */
|
||||||
*(.ARM.attributes)
|
|
||||||
*(.stack) /* from nrfx */
|
|
||||||
*(.heap) /* from nrfx */
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* For the nrfx startup file. */
|
|
||||||
__etext = _etext;
|
|
||||||
__data_start__ = _sdata;
|
|
||||||
__bss_start__ = _sbss;
|
|
||||||
__bss_end__ = _ebss;
|
|
||||||
|
|
||||||
/* For the memory allocator. */
|
/* For the memory allocator. */
|
||||||
_heap_start = _ebss;
|
_heap_start = _ebss;
|
||||||
_heap_end = ORIGIN(RAM) + LENGTH(RAM);
|
_heap_end = ORIGIN(RAM) + LENGTH(RAM);
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
|
|
||||||
MEMORY
|
MEMORY
|
||||||
{
|
{
|
||||||
FLASH_TEXT (rw) : ORIGIN = 0, LENGTH = 32256
|
FLASH_TEXT (rw) : ORIGIN = 0, LENGTH = 32K - _bootloader_size
|
||||||
RAM (xrw) : ORIGIN = 0, LENGTH = 2K
|
RAM (xrw) : ORIGIN = 0, LENGTH = 2K
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_bootloader_size = 512;
|
||||||
_stack_size = 512;
|
_stack_size = 512;
|
||||||
|
|
||||||
SECTIONS
|
SECTIONS
|
||||||
|
@ -29,19 +30,22 @@ SECTIONS
|
||||||
|
|
||||||
.data :
|
.data :
|
||||||
{
|
{
|
||||||
_sdata = .;
|
_sdata = .; /* used by startup code */
|
||||||
*(.data)
|
*(.data)
|
||||||
*(.data*)
|
*(.data*)
|
||||||
_edata = .;
|
_edata = .; /* used by startup code */
|
||||||
} >RAM AT>FLASH_TEXT
|
} >RAM AT>FLASH_TEXT
|
||||||
|
|
||||||
.bss :
|
.bss :
|
||||||
{
|
{
|
||||||
_sbss = .;
|
_sbss = .; /* used by startup code */
|
||||||
*(.bss)
|
*(.bss)
|
||||||
*(.bss*)
|
*(.bss*)
|
||||||
*(COMMON)
|
*(COMMON)
|
||||||
_ebss = .;
|
_ebss = .; /* used by startup code */
|
||||||
_heap_start = .;
|
|
||||||
} >RAM
|
} >RAM
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* For the memory allocator. */
|
||||||
|
_heap_start = _ebss;
|
||||||
|
_heap_end = ORIGIN(RAM) + LENGTH(RAM);
|
||||||
|
|
|
@ -278,8 +278,8 @@ Default_Handler:
|
||||||
.global __isr_vector
|
.global __isr_vector
|
||||||
// Interrupt vector as defined by Cortex-M, starting with the stack top.
|
// Interrupt vector as defined by Cortex-M, starting with the stack top.
|
||||||
// On reset, SP is initialized with *0x0 and PC is loaded with *0x4, loading
|
// On reset, SP is initialized with *0x0 and PC is loaded with *0x4, loading
|
||||||
// __StackTop and Reset_Handler.
|
// _stack_top and Reset_Handler.
|
||||||
.long __StackTop
|
.long _stack_top
|
||||||
.long Reset_Handler
|
.long Reset_Handler
|
||||||
.long NMI_Handler
|
.long NMI_Handler
|
||||||
.long HardFault_Handler
|
.long HardFault_Handler
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче