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

5
Last change on this file since 511dc4b was 511dc4b, checked in by Sebastian Huber <sebastian.huber@…>, on 06/19/18 at 07:09:51

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: 8.3 KB
Line 
1/*
2 * Linker command file for Intec SS555 board
3 *
4 * When debugging, we assume that the internal flash ROM will be replaced by
5 * the external RAM on the SS555 board.  All sections are stacked starting
6 * at address zero.  Nothing is placed in the internal RAM, since it's not
7 * contiguous with the external SRAM when the external RAM is placed at
8 * zero.
9 *
10 * For final production, we assume that the .text section will be burned
11 * into flash ROM starting at address zero.  The .data, .bss, heap, and
12 * workspace will reside in RAM, starting at the beginning of the internal
13 * RAM.  The system startup code will configure the external RAM to begin
14 * where the internal RAM ends, so as to make one large RAM block.
15 */
16
17OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc")
18OUTPUT_ARCH(powerpc)
19ENTRY(start)
20EXTERN(_vectors)
21
22int_ram_org     = 0x003F9800;           /* base of internal RAM */
23int_ram_top     = 0x00400000;           /* top of internal RAM */
24ext_ram_size    = 0x00080000;           /* size of external RAM */
25
26RamBase = DEFINED(_RamBase) ? RamBase : 0x003F9800;
27RamSize = DEFINED(_RamSize) ? RamSize : 0x00486800;
28HeapSize = DEFINED(_HeapSize) ? HeapSize : 0x0;
29
30SECTIONS
31{
32  .vectors 0x0:
33  {
34    /*
35     * For the MPC555, we use the compressed vector table format which puts
36     * all of the exception vectors before 0x100.
37     */
38    *(.vectors)
39  }
40
41  .text 0x100:
42  {
43    /* Read-only sections, merged into text segment: */
44   
45    text.start = .;
46
47    /* Entry point is the .entry section */
48    *(.entry)
49    *(.entry2)
50
51    /* Actual code */
52    *(.text*)
53
54    /* C++ constructors/destructors */
55    *(.gnu.linkonce.t*)
56             
57    /*  Initialization and finalization code.
58     *
59     *  Various files can provide initialization and finalization functions.
60     *  The bodies of these functions are in .init and .fini sections. We
61     *  accumulate the bodies here, and prepend function prologues from
62     *  ecrti.o and function epilogues from ecrtn.o. ecrti.o must be linked
63     *  first; ecrtn.o must be linked last. Because these are wildcards, it
64     *  doesn't matter if the user does not actually link against ecrti.o and
65     *  ecrtn.o; the linker won't look for a file to match a wildcard.  The
66     *  wildcard also means that it doesn't matter which directory ecrti.o
67     *  and ecrtn.o are in.
68     */
69    PROVIDE (_init = .);
70    *ecrti.o(.init)
71    *(.init)
72    *ecrtn.o(.init)
73   
74    PROVIDE (_fini = .);
75    *ecrti.o(.fini)
76    *(.fini)
77    *ecrtn.o(.init)
78
79    /*
80     *  C++ constructors and destructors for static objects.
81     *  PowerPC EABI does not use crtstuff yet, so we build "old-style"
82     *  constructor and destructor lists that begin with the list length
83     *  end terminate with a NULL entry.
84     */
85    PROVIDE (__CTOR_LIST__ = .);             
86    /* LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) */
87    *crtbegin.o(.ctors)
88    *(.ctors)
89    *crtend.o(.ctors)
90    LONG(0)
91    PROVIDE (__CTOR_END__ = .);
92       
93    PROVIDE (__DTOR_LIST__ = .);
94    /* LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) */
95    *crtbegin.o(.dtors)
96    *(.dtors)
97    *crtend.o(.dtors)
98    LONG(0)
99    PROVIDE (__DTOR_END__ = .);
100       
101    /*
102     * Special FreeBSD sysctl sections.
103     */
104    . = ALIGN (16);
105    __start_set_sysctl_set = .;
106    *(set_sysctl_*);
107    __stop_set_sysctl_set = ABSOLUTE(.);
108    *(set_domain_*);
109    *(set_pseudo_*);
110
111    /* Exception frame info */
112    *(.eh_frame)
113
114    /* Miscellaneous read-only data */
115    _rodata_start = . ;
116    *(.gnu.linkonce.r*)
117    *(.lit)
118    *(.shdata)
119    *(.rodata*)
120    *(.rodata1)
121    KEEP (*(SORT(.rtemsroset.*)))
122    *(.descriptors)
123    *(rom_ver)
124    _erodata = .;
125
126    /* Various possible names for the end of the .text section */
127    etext = ALIGN(0x10);
128    _etext = .;
129    _endtext = .;
130    text.end = .;
131    PROVIDE (etext = .);
132    PROVIDE (__etext = .);
133  }
134  text.size = text.end - text.start;
135
136  .tdata : {
137    _TLS_Data_begin = .;
138    *(.tdata .tdata.* .gnu.linkonce.td.*)
139    _TLS_Data_end = .;
140
141    /*
142     * .data section contents, copied to RAM at system startup.
143     */
144    . = ALIGN(0x20);
145    data.contents.start = .;
146  }
147  .tbss : {
148    _TLS_BSS_begin = .;
149    *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon)
150    _TLS_BSS_end = .;
151  }
152  _TLS_Data_size = _TLS_Data_end - _TLS_Data_begin;
153  _TLS_Data_begin = _TLS_Data_size != 0 ? _TLS_Data_begin : _TLS_BSS_begin;
154  _TLS_Data_end = _TLS_Data_size != 0 ? _TLS_Data_end : _TLS_BSS_begin;
155  _TLS_BSS_size = _TLS_BSS_end - _TLS_BSS_begin;
156  _TLS_Size = _TLS_BSS_end - _TLS_Data_begin;
157  _TLS_Alignment = MAX (ALIGNOF (.tdata), ALIGNOF (.tbss));
158
159  /*
160   * If debugging, stack the read/write sections directly after the text
161   * section.  Otherwise, stack the read/write sections starting at base of
162   * internal RAM.
163   */
164  . = DEFINED(RTEMS_DEBUG) ? . : int_ram_org;
165 
166  .data : AT (data.contents.start)
167  {
168    data.start = .;
169   
170    *(.data)
171    *(.data.*)
172    KEEP (*(SORT(.rtemsrwset.*)))
173    *(.data1)
174   
175    PROVIDE (__SDATA_START__ = .);
176    *(.sdata .sdata.* .gnu.linkonce.s.*)
177    PROVIDE (__SDATA_END__ = .);
178   
179    PROVIDE (__EXCEPT_START__ = .);
180    *(.gcc_except_table*)
181    PROVIDE (__EXCEPT_END__ = .);
182   
183    PROVIDE(__GOT_START__ = .);
184    *(.got.plt)
185    *(.got)
186    PROVIDE(__GOT_END__ = .);
187       
188    *(.got1)
189   
190    PROVIDE (__GOT2_START__ = .);
191    PROVIDE (_GOT2_START_ = .);
192    *(.got2)
193    PROVIDE (__GOT2_END__ = .);
194    PROVIDE (_GOT2_END_ = .);
195       
196    PROVIDE (__FIXUP_START__ = .);
197    PROVIDE (_FIXUP_START_ = .);
198    *(.fixup)
199    PROVIDE (_FIXUP_END_ = .);
200    PROVIDE (__FIXUP_END__ = .);
201
202    /*  We want the small data sections together, so single-instruction
203     *   offsets can access them all.
204     */
205    PROVIDE (__SDATA2_START__ = .);
206    *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
207    *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)
208    PROVIDE (__SDATA2_END__ = .);
209
210    data.end = .;
211  }
212  data.size = data.end - data.start;
213
214  bss.start = .;
215  .sbss          :
216  {
217    PROVIDE (__sbss_start = .); PROVIDE (___sbss_start = .);
218    *(.dynsbss)
219    *(.sbss .sbss.* .gnu.linkonce.sb.*)
220    *(.scommon)
221    PROVIDE (__sbss_end = .); PROVIDE (___sbss_end = .);
222  }
223  .bss :
224  {
225    *(.dynbss) 
226    *(.bss .bss* .gnu.linkonce.b*)
227    *(COMMON)
228    . = ALIGN(4);
229  }
230  bss.end = .;
231  bss.size = bss.end - bss.start;
232
233  PROVIDE(_end = bss.end);
234
235  .rtemsstack (NOLOAD) : {
236    *(SORT(.rtemsstack.*))
237  }
238
239  /*
240   * Work Area
241   *
242   * The Work Area is configured at run-time to use all available memory.  It
243   * begins just after the end of the Workspace and continues to the end of
244   * the external RAM.
245   */
246  . = DEFINED(RTEMS_DEBUG) ? 0 + ext_ram_size : int_ram_top + ext_ram_size;
247  WorkAreaBase = .;
248
249 
250  /*
251   * Internal I/O devices
252   */
253  .usiu 0x002FC000:             /* unified system interface unit */
254  {
255    usiu = .;
256  }
257
258  .imb 0x00300000:              /* inter-module bus and devices */
259  {
260    imb = .;
261  }
262
263  .sram 0x00380000:             /* internal SRAM control registers */
264  {
265    sram = .;
266  }
267
268  /*
269   * SS555 external devices managed by on-board CPLD
270   */
271  .cpld 0xFF000000:             /* SS555 external CPLD devices */
272  {
273    cpld = .;
274  }
275
276
277  /* Stabs debugging sections.  */
278  .stab 0 : { *(.stab) }
279  .stabstr 0 : { *(.stabstr) }
280  .stab.excl 0 : { *(.stab.excl) }
281  .stab.exclstr 0 : { *(.stab.exclstr) }
282  .stab.index 0 : { *(.stab.index) }
283  .stab.indexstr 0 : { *(.stab.indexstr) }
284  .comment 0 : { *(.comment) }
285 
286  /* DWARF debug sections.
287     Symbols in the DWARF debugging sections are relative to the beginning
288     of the section so we begin them at 0.  */
289  /* DWARF 1 */
290  .debug          0 : { *(.debug) }
291  .line           0 : { *(.line) }
292 
293  /* GNU DWARF 1 extensions */
294  .debug_srcinfo  0 : { *(.debug_srcinfo) }
295  .debug_sfnames  0 : { *(.debug_sfnames) }
296 
297  /* DWARF 1.1 and DWARF 2 */
298  .debug_aranges  0 : { *(.debug_aranges) }
299  .debug_pubnames 0 : { *(.debug_pubnames) }
300 
301  /* DWARF 2 */
302  .debug_info     0 : { *(.debug_info) }
303  .debug_abbrev   0 : { *(.debug_abbrev) }
304  .debug_line     0 : { *(.debug_line) }
305  .debug_frame    0 : { *(.debug_frame) }
306  .debug_str      0 : { *(.debug_str) }
307  .debug_loc      0 : { *(.debug_loc) }
308  .debug_macinfo  0 : { *(.debug_macinfo) }
309 
310  /* SGI/MIPS DWARF 2 extensions */
311  .debug_weaknames 0 : { *(.debug_weaknames) }
312  .debug_funcnames 0 : { *(.debug_funcnames) }
313  .debug_typenames 0 : { *(.debug_typenames) }
314  .debug_varnames  0 : { *(.debug_varnames) }
315  /* These must appear regardless of  .  */
316}
Note: See TracBrowser for help on using the repository browser.