source: rtems/bsps/powerpc/virtex4/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: 10.7 KB
Line 
1/*
2 *  This file contains directives for the GNU linker which are specific to the
3 *  Virtex 4 PPC 405.  No assumptions are made on the firmware in the FPGA.
4 *  This file is intended to be used together with start.S to generate
5 *  downloadable code.
6 */
7
8OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc")
9OUTPUT_ARCH(powerpc)
10
11ENTRY(download_entry)
12EXTERN(download_entry)
13EXTERN(__vectors)
14
15MsgAreaSize       = DEFINED(MsgAreaSize)   ? MsgAreaSize   : 1M;
16RamBase           = DEFINED(RamBase)       ? RamBase       : 0x0;
17RamSize           = DEFINED(RamSize)       ? RamSize       : 128M - MsgAreaSize;
18HeapSize          = DEFINED(HeapSize)      ? HeapSize      : 0; /* 0=Use def */
19
20
21MEMORY
22{
23  VECTORS         : ORIGIN = 0x00000000, LENGTH = 12K
24  RAM             : ORIGIN = 0x00003000, LENGTH = 128M - 12K
25}
26
27
28SECTIONS
29{
30  bsp_exc_vector_base = 0x100;
31  __exeentry          = download_entry;
32  __exestart          = bsp_exc_vector_base;
33  .vectors bsp_exc_vector_base : { *(.vectors)                  } > VECTORS
34
35  /* Read-only sections, merged into text segment: */
36  .interp         : { *(.interp)                                } > RAM
37  .hash           : { *(.hash)                                  } > RAM
38  .dynsym         : { *(.dynsym)                                } > RAM
39  .dynstr         : { *(.dynstr)                                } > RAM
40  .gnu.version    : { *(.gnu.version)                           } > RAM
41  .gnu.version_d  : { *(.gnu.version_d)                         } > RAM
42  .gnu.version_r  : { *(.gnu.version_r)                         } > RAM
43  .rela.text      : { *(.rela.text) *(.rela.gnu.linkonce.t*)    } > RAM
44  .rela.data      : { *(.rela.data) *(.rela.gnu.linkonce.d*)    } > RAM
45  .rela.rodata    : { *(.rela.rodata*) *(.rela.gnu.linkonce.r*) } > RAM
46  .rela.got       : { *(.rela.got)                              } > RAM
47  .rela.got1      : { *(.rela.got1)                             } > RAM
48  .rela.got2      : { *(.rela.got2)                             } > RAM
49  .rela.ctors     : { *(.rela.ctors)                            } > RAM
50  .rela.dtors     : { *(.rela.dtors)                            } > RAM
51  .rela.init      : { *(.rela.init)                             } > RAM
52  .rela.fini      : { *(.rela.fini)                             } > RAM
53  .rela.bss       : { *(.rela.bss)                              } > RAM
54  .rela.plt       : { *(.rela.plt)                              } > RAM
55  .rela.sdata     : { *(.rela.sdata)                            } > RAM
56  .rela.sbss      : { *(.rela.sbss)                             } > RAM
57  .rela.sdata2    : { *(.rela.sdata2)                           } > RAM
58  .rela.sbss2     : { *(.rela.sbss2)                            } > RAM
59  .rela.dyn       : { *(.rela.dyn)                              } > RAM
60
61  /* Initialization code */
62  .init           : { PROVIDE (_init = .);
63                      *ecrti.o(.init)
64                      KEEP(*(.init))
65                      *ecrtn.o(.init)
66                    } > RAM
67
68  .text           : { *(.entry)
69                      *(.text)
70                      *(.text.*)
71
72                      /* Special FreeBSD sysctl sections */
73                      . = ALIGN (16);
74                      __start_set_sysctl_set = .;
75                      *(set_sysctl_*);
76                      __stop_set_sysctl_set = ABSOLUTE(.);
77                      *(set_domain_*);
78                      *(set_pseudo_*);
79
80                      /* .gnu.warning sections are handled specially by elf32.em
81                       */
82                      *(.gnu.warning)
83                      *(.gnu.linkonce.t*)
84                    } > RAM
85
86  /* Finalization code */
87  .fini           : { PROVIDE (_fini = .);
88                      *ecrti.o(.fini)
89                      KEEP(*(.fini))
90                      *ecrtn.o(.fini)
91                    } > RAM
92
93  /* Miscellaneous read-only data */
94  .rodata         : { *(.rodata.* .gnu.linkonce.r*) KEEP (*(SORT(.rtemsroset.*))) } > RAM
95  .rodata1        : { *(.rodata1)                                      } > RAM
96
97  .tdata : {
98    _TLS_Data_begin = .;
99    *(.tdata .tdata.* .gnu.linkonce.td.*)
100    _TLS_Data_end = .;
101  } >RAM
102
103  .tbss : {
104    _TLS_BSS_begin = .;
105    *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon)
106    _TLS_BSS_end = .;
107  } >RAM
108
109  _TLS_Data_size = _TLS_Data_end - _TLS_Data_begin;
110  _TLS_Data_begin = _TLS_Data_size != 0 ? _TLS_Data_begin : _TLS_BSS_begin;
111  _TLS_Data_end = _TLS_Data_size != 0 ? _TLS_Data_end : _TLS_BSS_begin;
112  _TLS_BSS_size = _TLS_BSS_end - _TLS_BSS_begin;
113  _TLS_Size = _TLS_BSS_end - _TLS_Data_begin;
114  _TLS_Alignment = MAX (ALIGNOF (.tdata), ALIGNOF (.tbss));
115
116  /* Initialised small data addressed as offsets from r2 */
117  .sdata2         : { PROVIDE (_SDA2_BASE_ = 32768); *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)          } > RAM
118
119  /* Zeroed small data addressed as offsets from r2 */
120  .sbss2          : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)
121
122                      /* Avoid empty sdata2/sbss2 area: __eabi would not set up
123                       * r2 which may be important if run-time loading is used
124                       */
125                      . += 1;
126
127                      PROVIDE (__SBSS2_END__ = .);
128                    } > RAM
129
130  /* Exception frame info */
131  .eh_frame       : { *(.eh_frame .eh_frame.*)                         } > RAM
132  .eh_frame_hdr   : { *(.eh_frame_hdr)                                 } > RAM
133
134  /*  Declares where the .text section ends */
135  _etext          = .;
136  PROVIDE (etext  = .);
137
138  /* Initialized R/W Data section goes in RAM */
139  .data           : { PROVIDE(__DATA_START__ = ABSOLUTE(.) );
140                      *(.data)
141                      *(.data.*)
142                      KEEP (*(SORT(.rtemsrwset.*)))
143                      *(.gnu.linkonce.d*)
144                    } > RAM
145
146  .data1          : { *(.data1)                                        } > RAM
147
148                        PROVIDE (__EXCEPT_START__ = .);
149  .gcc_except_table : { *(.gcc_except_table .gcc_except_table.*)       } > RAM
150                        PROVIDE (__EXCEPT_END__ = .);
151
152  .got1           : { *(.got1)                                         } > RAM
153
154  /* Put .ctors and .dtors next to the .got2 section, so that the pointers
155   * get relocated with -mrelocatable. Also put in the .fixup pointers.
156   * The current compiler no longer needs this, but keep it around for 2.7.2.
157   */
158                      PROVIDE (_GOT2_START_ = .);
159  .got2           : { *(.got2)                                         } > RAM
160
161  .dynamic        : { *(.dynamic)                                      } > RAM
162
163  .ctors          : { /* gcc uses crtbegin.o to find the start of
164                       * the constructors, so we make sure it is
165                       * first.  Because this is a wildcard, it
166                       * doesn't matter if the user does not
167                       * actually link against crtbegin.o; the
168                       * linker won't look for a file to match a
169                       * wildcard.  The wildcard also means that it
170                       * doesn't matter which directory crtbegin.o
171                       * is in.
172                       */
173                      KEEP (*crtbegin.o(.ctors))
174                      /* We don't want to include the .ctor section from
175                       * the crtend.o file until after the sorted ctors.
176                       * The .ctor section from the crtend file contains the
177                       * end of ctors marker and it must be last.
178                       */
179                      KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))
180                      KEEP (*(SORT(.ctors.*)))
181                      KEEP (*(.ctors))
182                    } > RAM
183
184  .dtors          : { KEEP (*crtbegin.o(.dtors))
185                      KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
186                      KEEP (*(SORT(.dtors.*)))
187                      KEEP (*(.dtors))
188                    } > RAM
189
190                      PROVIDE (_FIXUP_START_ = .);
191  .fixup          : { *(.fixup)                                        } > RAM
192                      PROVIDE (_FIXUP_END_ = .);
193
194                      PROVIDE (_GOT2_END_ = .);
195
196                      PROVIDE (_GOT_START_ = .);
197  .got            : { __got_start = .;
198                      *(.got)
199                    } > RAM
200
201  .got.plt        : { *(.got.plt)                                      } > RAM
202                      PROVIDE (_GOT_END_ = .);
203
204  .jcr            : { KEEP (*(.jcr))                                   } > RAM
205
206  /* We want the small data sections together, so single-instruction offsets
207   * can access them all, and initialized data all before uninitialized, so
208   * we can shorten the on-disk segment size.
209   */
210  /* Initialised small data addressed as offsets from r13 */
211  .sdata          : { PROVIDE (_SDA_BASE_ = 32768); *(.sdata* .gnu.linkonce.s.*)                     } > RAM
212
213  _edata          = .;
214  PROVIDE (edata  = .);
215
216  /* Zeroed small data addressed as offsets from r13 */
217  .sbss           : { PROVIDE (__sbss_start = .);
218                      *(.dynsbss)
219                      *(.sbss*)
220                      *(.gnu.linkonce.sb.*)
221                      *(.scommon)
222
223                      /* Avoid empty sdata/sbss area: __eabi would not set up
224                       * r13, which may be important if run-time loading is used
225                       */
226                      . += 1;
227
228                      PROVIDE (__SBSS_END__ = .);
229                      PROVIDE (__sbss_end   = .);
230                    } > RAM
231
232  .plt            : { *(.plt)                                          } > RAM
233  .iplt           : { *(.iplt)                                         } > RAM
234
235  /* Zeroed large data */
236  .bss            : { PROVIDE (__bss_start = .);
237                      *(.dynbss)
238                      *(.bss)
239                      *(.bss.*)
240                      *(.gnu.linkonce.b*)
241                      *(COMMON)
242
243                      PROVIDE (__bss_end = ALIGN(4));
244                      __bss_size = __bss_end - __bss_start;
245                    } > RAM
246
247  __exeend        = ALIGN(4);
248  __rtems_end     = .;
249  .               = ALIGN(0x10);        /* Align to a cache-line boundary */
250  PROVIDE(__bsp_ram_start = .);
251
252  .rtemsstack (NOLOAD) : {
253    *(SORT(.rtemsstack.*))
254  } >RAM
255
256  WorkAreaBase = .;
257
258  /* The heap comes after the work space */
259
260   .              = RamBase + RamSize;
261  PROVIDE(__bsp_ram_end = .);
262
263  /* Message area for capturing early printk output */
264  /* Placed here to be easily findable with a debugger */
265  MsgAreaBase     = .;
266  .              += MsgAreaSize;
267
268  __phy_ram_end   = .;                  /* True end of physical memory */
269
270  /DISCARD/ :
271  {
272    *(.comment)
273  }
274
275  /* Some configuration constants: Not clear why they're placed here */
276  __dccr          = 0x80000000;
277  __iccr          = 0x80000000;
278  __sgr           = 0x7fffffff;
279  __vectors       = 0;
280}
Note: See TracBrowser for help on using the repository browser.