source: rtems/bsps/powerpc/haleakala/start/linkcmds @ 511dc4b

Last change on this file since 511dc4b was 511dc4b, checked in by Sebastian Huber <sebastian.huber@…>, on Jun 19, 2018 at 7:09:51 AM

Rework initialization and interrupt stack support

Statically initialize the interrupt stack area
(_Configuration_Interrupt_stack_area_begin,
_Configuration_Interrupt_stack_area_end, and
_Configuration_Interrupt_stack_size) via <rtems/confdefs.h>. Place the
interrupt stack area in a special section ".rtemsstack.interrupt". Let
BSPs define the optimal placement of this section in their linker
command files (e.g. in a fast on-chip memory).

This change makes makes the CPU_HAS_SOFTWARE_INTERRUPT_STACK and
CPU_HAS_HARDWARE_INTERRUPT_STACK CPU port defines superfluous, since the
low level initialization code has all information available via global
symbols.

This change makes the CPU_ALLOCATE_INTERRUPT_STACK CPU port define
superfluous, since the interrupt stacks are allocated by confdefs.h for
all architectures. There is no need for BSP-specific linker command
file magic (except the section placement), see previous ARM linker
command file as a bad example.

Remove _CPU_Install_interrupt_stack(). Initialize the hardware
interrupt stack in _CPU_Initialize() if necessary (e.g.
m68k_install_interrupt_stack()).

The optional _CPU_Interrupt_stack_setup() is still useful to customize
the registration of the interrupt stack area in the per-CPU information.

The initialization stack can reuse the interrupt stack, since

  • interrupts are disabled during the sequential system initialization, and
  • the boot_card() function does not return.

This stack resuse saves memory.

Changes per architecture:

arm:

  • Mostly replace the linker symbol based configuration of stacks with the standard <rtems/confdefs.h> configuration via CONFIGURE_INTERRUPT_STACK_SIZE. The size of the FIQ, ABT and UND mode stack is still defined via linker symbols. These modes are rarely used in applications and the default values provided by the BSP should be sufficient in most cases.
  • Remove the bsp_processor_count linker symbol hack used for the SMP support. This is possible since the interrupt stack area is now allocated by the linker and not allocated from the heap. This makes some configure.ac stuff obsolete. Remove the now superfluous BSP variants altcycv_devkit_smp and realview_pbx_a9_qemu_smp.

bfin:

  • Remove unused magic linker command file allocation of initialization stack. Maybe a previous linker command file copy and paste problem? In the start.S the initialization stack is set to a hard coded value.

lm32, m32c, mips, nios2, riscv, sh, v850:

  • Remove magic linker command file allocation of initialization stack. Reuse interrupt stack for initialization stack.

m68k:

  • Remove magic linker command file allocation of initialization stack. Reuse interrupt stack for initialization stack.

powerpc:

  • Remove magic linker command file allocation of initialization stack. Reuse interrupt stack for initialization stack.
  • Used dedicated memory region (REGION_RTEMSSTACK) for the interrupt stack on BSPs using the shared linkcmds.base (replacement for REGION_RWEXTRA).

sparc:

  • Remove the hard coded initialization stack. Use the interrupt stack for the initialization stack on the boot processor. This saves 16KiB of RAM.

Update #3459.

  • Property mode set to 100644
File size: 7.1 KB
Line 
1/*
2 *  This file contains directives for the GNU linker which are specific
3 *  to the 405GP/EX
4 *  This file is intended to be used together with dlentry.s
5 *  it will generate downloadable code
6 *
7 *  Modifications for gen405 by Dennis Ehlin
8 *  Modifications for virtex by Keith, Greg, and Bob
9 *  Modifications for 405GP/EX by Michael Hamel
10 */
11
12OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc")
13OUTPUT_ARCH(powerpc)
14ENTRY(download_entry)
15EXTERN(__vectors)
16
17RamBase = DEFINED(RamBase) ? RamBase : 0;
18RamSize = DEFINED(RamSize) ? RamSize : 256M;
19HeapSize = DEFINED(HeapSize) ? HeapSize : 0x0;
20
21MEMORY {
22        RAM : ORIGIN = 0, LENGTH = 256M
23        /*FLASH : ORIGIN = 0xFFE00000, LENGTH = 16M*/
24}
25
26
27SECTIONS
28{
29  /* First 16K is occupied by exception vectors and anything else we want to put there */
30  .text 0x4000:
31  {
32     text.start = . ;
33     *(.entry)
34     *(.entry2)
35     *(.text*)
36     *(.rodata*)
37     *(.rodata1)
38     KEEP (*(SORT(.rtemsroset.*)))
39
40     /*
41      * Special FreeBSD sysctl sections.
42      */
43     . = ALIGN (16);
44     __start_set_sysctl_set = .;
45     *(set_sysctl_*);
46     __stop_set_sysctl_set = ABSOLUTE(.);
47     *(set_domain_*);
48     *(set_pseudo_*);
49
50    /* C++ constructors/destructors */
51    *(.gnu.linkonce.t*)
52
53    /*  Initialization and finalization code.
54     *
55     *  Various files can provide initialization and finalization functions.
56     *  The bodies of these functions are in .init and .fini sections. We
57     *  accumulate the bodies here, and prepend function prologues from
58     *  ecrti.o and function epilogues from ecrtn.o. ecrti.o must be linked
59     *  first; ecrtn.o must be linked last. Because these are wildcards, it
60     *  doesn't matter if the user does not actually link against ecrti.o and
61     *  ecrtn.o; the linker won't look for a file to match a wildcard.  The
62     *  wildcard also means that it doesn't matter which directory ecrti.o
63     *  and ecrtn.o are in.
64     */
65    PROVIDE (_init = .);
66    *ecrti.o(.init)
67    *(.init)
68    *ecrtn.o(.init)
69   
70    PROVIDE (_fini = .);
71    *ecrti.o(.fini)
72    *(.fini)
73    *ecrtn.o(.init)
74
75    /*
76     *  C++ constructors and destructors for static objects.
77     *  PowerPC EABI does not use crtstuff yet, so we build "old-style"
78     *  constructor and destructor lists that begin with the list length
79     *  end terminate with a NULL entry.
80     */
81     
82    PROVIDE (__CTOR_LIST__ = .);             
83    *crtbegin.o(.ctors)
84    *(.ctors)
85    *crtend.o(.ctors)
86    LONG(0)
87    PROVIDE (__CTOR_END__ = .);
88       
89    PROVIDE (__DTOR_LIST__ = .);
90    *crtbegin.o(.dtors)
91    *(.dtors)
92    *crtend.o(.dtors)
93    LONG(0)
94    PROVIDE (__DTOR_END__ = .);
95       
96    /* Exception frame info */
97     *(.eh_frame)
98    /* Miscellaneous read-only data */
99    _rodata_start = . ;
100    *(.gnu.linkonce.r*)
101    *(.lit)
102    *(.shdata)
103    *(.rodata)
104    *(.rodata1)
105    *(.descriptors)
106    *(rom_ver)
107    _erodata = .;
108
109    PROVIDE (__EXCEPT_START__ = .);
110    *(.gcc_except_table*)
111    PROVIDE (__EXCEPT_END__ = .);
112    __GOT_START__ = .;
113    s.got = .;
114    *(.got.plt)
115    *(.got)
116    *(.got1)
117    PROVIDE (__GOT2_START__ = .);
118    PROVIDE (_GOT2_START_ = .);
119    *(.got2)
120    PROVIDE (__GOT2_END__ = .);
121    PROVIDE (_GOT2_END_ = .);
122   
123    PROVIDE (__FIXUP_START__ = .);
124    PROVIDE (_FIXUP_START_ = .);
125    *(.fixup)
126    PROVIDE (_FIXUP_END_ = .);
127    PROVIDE (__FIXUP_END__ = .);
128   
129
130    /* Various possible names for the end of the .text section */
131     etext = ALIGN(0x10);
132     _etext = .;
133
134     *(.lit)
135     *(.shdata)
136     _endtext = ALIGN(0x10);
137     text.end = .;
138     text.size = text.end - text.start;
139  } >RAM
140
141  text.size = text.end - text.start;
142
143  .tdata : {
144    _TLS_Data_begin = .;
145    *(.tdata .tdata.* .gnu.linkonce.td.*)
146    _TLS_Data_end = .;
147  } >RAM
148
149  .tbss : {
150    _TLS_BSS_begin = .;
151    *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon)
152    _TLS_BSS_end = .;
153  } >RAM
154
155  _TLS_Data_size = _TLS_Data_end - _TLS_Data_begin;
156  _TLS_Data_begin = _TLS_Data_size != 0 ? _TLS_Data_begin : _TLS_BSS_begin;
157  _TLS_Data_end = _TLS_Data_size != 0 ? _TLS_Data_end : _TLS_BSS_begin;
158  _TLS_BSS_size = _TLS_BSS_end - _TLS_BSS_begin;
159  _TLS_Size = _TLS_BSS_end - _TLS_Data_begin;
160  _TLS_Alignment = MAX (ALIGNOF (.tdata), ALIGNOF (.tbss));
161
162  .jcr : { KEEP (*(.jcr)) } >RAM
163
164    .rel.dyn : {
165      *(.rel.init)
166      *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
167      *(.rel.fini)
168      *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
169      *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*)
170      *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
171      *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
172      *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
173      *(.rel.ctors)
174      *(.rel.dtors)
175      *(.rel.got)
176      *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*)
177      *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*)
178      *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*)
179      *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*)
180      *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
181    } >RAM
182    .rela.dyn : {
183      *(.rela.init)
184      *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
185      *(.rela.fini)
186      *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
187      *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
188      *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
189      *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
190      *(.rela.ctors)
191      *(.rela.dtors)
192      *(.rela.got)
193      *(.rela.got1)
194      *(.rela.got2)
195      *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*)
196      *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*)
197      *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*)
198      *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*)
199      *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
200    } >RAM
201
202
203    /* Initialised large data */
204    .data ( . ) :
205    {
206      . = ALIGN (4);
207      data.start = .;
208      *(.data)
209      *(.data1)
210      KEEP (*(SORT(.rtemsrwset.*)))
211      *(.data.* .gnu.linkonce.d.*)
212      data.end = .;
213    } > RAM
214
215        /* Initialised small data addressed as offsets from r13 */
216        .sdata : {
217      . = ALIGN (4);
218          PROVIDE (__SDATA_START__ = .);
219      sdata.start = .;
220          *(.sdata*)
221      *(.gnu.linkonce.s.*)
222          sdata.end = .;
223        } > RAM
224
225        /* Zeroed small data addressed as offsets from r13 */
226   .sbss : {
227      . = ALIGN (4);
228          PROVIDE(__SBSS_START__ = .);
229          sbss.start = .;
230      *(.sbss .sbss.* *.gnu.linkonce.sb.*);
231          sbss.end = .;
232    } > RAM
233    PROVIDE(__SBSS_END__ = .);
234
235        /* Zeroed large data */
236        .bss : {
237      . = ALIGN (4);
238          bss.start = .;
239      *(.bss .bss* .gnu.linkonce.b*)
240      . = ALIGN(4);
241      bss.end = .;
242    } > RAM
243
244    bss.size = bss.end - bss.start;
245    sbss.size = sbss.end - sbss.start;
246
247    .rtemsstack (NOLOAD) : {
248        *(SORT(.rtemsstack.*))
249    } >RAM
250
251    WorkAreaBase = .;
252
253        /* Debugging information */
254    .line 0 : { *(.line) }
255    .debug 0 : { *(.debug) }
256    .debug_sfnames 0 : { *(.debug_sfnames) }
257    .debug_srcinfo 0 : { *(.debug_srcinfo) }
258    .debug_pubnames 0 : { *(.debug_pubnames) }
259    .debug_aranges 0 : { *(.debug_aranges) }
260    .debug_aregion 0 : { *(.debug_aregion) }
261    .debug_macinfo 0 : { *(.debug_macinfo) }
262    .stab 0 : { *(.stab) }
263    .stabstr 0 : { *(.stabstr) }
264}
Note: See TracBrowser for help on using the repository browser.