1/*
2 * linker script for LPC842 with GNU ld
3 */
4
5/* Program Entry, set to mark it as "used" and avoid gc */
6MEMORY
7{
8    CODE (rx) : ORIGIN = 0x00000000, LENGTH = 32k /* 32k flash */
9    DATA (rw) : ORIGIN = 0x10000000, LENGTH =  8k /*  8k sram */
10}
11ENTRY(Reset_Handler)
12_system_stack_size = 0x100;
13
14SECTIONS
15{
16    .text :
17    {
18        . = ALIGN(4);
19        _stext = .;
20        KEEP(*(.isr_vector))            /* Startup code */
21        . = ALIGN(4);
22        *(.text)                        /* remaining code */
23        *(.text.*)                      /* remaining code */
24        *(.rodata)                      /* read-only data (constants) */
25        *(.rodata*)
26        *(.glue_7)
27        *(.glue_7t)
28        *(.gnu.linkonce.t*)
29
30        /* section information for finsh shell */
31        . = ALIGN(4);
32        __fsymtab_start = .;
33        KEEP(*(FSymTab))
34        __fsymtab_end = .;
35        . = ALIGN(4);
36        __vsymtab_start = .;
37        KEEP(*(VSymTab))
38        __vsymtab_end = .;
39        . = ALIGN(4);
40
41        /* section information for initial. */
42        . = ALIGN(4);
43        __rt_init_start = .;
44        KEEP(*(SORT(.rti_fn*)))
45        __rt_init_end = .;
46        . = ALIGN(4);
47
48        . = ALIGN(4);
49        __etext = .;
50    } > CODE = 0
51
52    /* .ARM.exidx is sorted, so has to go in its own output section.  */
53    __exidx_start = .;
54    .ARM.exidx :
55    {
56        *(.ARM.exidx* .gnu.linkonce.armexidx.*)
57
58        /* This is used by the startup in order to initialize the .data secion */
59        _sidata = .;
60    } > CODE
61    __exidx_end = .;
62
63    /* .data section which is used for initialized data */
64
65
66    .data : AT (_sidata)
67    {
68        . = ALIGN(4);
69        /* This is used by the startup in order to initialize the .data secion */
70        __data_start__ = . ;
71
72        *(.data)
73        *(.data.*)
74        *(.gnu.linkonce.d*)
75
76        . = ALIGN(4);
77        /* This is used by the startup in order to initialize the .data secion */
78        __data_end__ = . ;
79    } >DATA
80
81    .stack :
82    {
83        . = . + _system_stack_size;
84        . = ALIGN(4);
85        _estack = .;
86    } >DATA
87
88    __bss_start = .;
89    .bss :
90    {
91        . = ALIGN(4);
92        /* This is used by the startup in order to initialize the .bss secion */
93        _sbss = .;
94
95        *(.bss)
96        *(.bss.*)
97        *(COMMON)
98
99        . = ALIGN(4);
100        /* This is used by the startup in order to initialize the .bss secion */
101        _ebss = . ;
102
103        *(.bss.init)
104    } > DATA
105    __bss_end = .;
106
107    _end = .;
108
109    /* Stabs debugging sections.  */
110    .stab          0 : { *(.stab) }
111    .stabstr       0 : { *(.stabstr) }
112    .stab.excl     0 : { *(.stab.excl) }
113    .stab.exclstr  0 : { *(.stab.exclstr) }
114    .stab.index    0 : { *(.stab.index) }
115    .stab.indexstr 0 : { *(.stab.indexstr) }
116    .comment       0 : { *(.comment) }
117    /* DWARF debug sections.
118     * Symbols in the DWARF debugging sections are relative to the beginning
119     * of the section so we begin them at 0.  */
120    /* DWARF 1 */
121    .debug          0 : { *(.debug) }
122    .line           0 : { *(.line) }
123    /* GNU DWARF 1 extensions */
124    .debug_srcinfo  0 : { *(.debug_srcinfo) }
125    .debug_sfnames  0 : { *(.debug_sfnames) }
126    /* DWARF 1.1 and DWARF 2 */
127    .debug_aranges  0 : { *(.debug_aranges) }
128    .debug_pubnames 0 : { *(.debug_pubnames) }
129    /* DWARF 2 */
130    .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
131    .debug_abbrev   0 : { *(.debug_abbrev) }
132    .debug_line     0 : { *(.debug_line) }
133    .debug_frame    0 : { *(.debug_frame) }
134    .debug_str      0 : { *(.debug_str) }
135    .debug_loc      0 : { *(.debug_loc) }
136    .debug_macinfo  0 : { *(.debug_macinfo) }
137    /* SGI/MIPS DWARF 2 extensions */
138    .debug_weaknames 0 : { *(.debug_weaknames) }
139    .debug_funcnames 0 : { *(.debug_funcnames) }
140    .debug_typenames 0 : { *(.debug_typenames) }
141    .debug_varnames  0 : { *(.debug_varnames) }
142}
143