source: rtems/bsps/mips/hurricane/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: 3.8 KB
Line 
1/*
2 *   linkcmds
3 */
4
5/*
6 * Declare some sizes.
7 */
8RamBase = DEFINED(RamBase) ? RamBase : 0x80000000;
9RamSize = DEFINED(RamSize) ? RamSize : 4M;
10HeapSize = DEFINED(HeapSize) ? HeapSize : 0x0;
11
12ENTRY(start)
13STARTUP(start.o)
14
15SECTIONS
16{
17  /* 0x80000000 - 0x8001FFFF used by PMON (with 0x80010000 - 0x8001FFFF as heap for symbol storage)
18        0x80020000 - 0x8002FFFF reserved for shared memory
19        0x80030000 beginning of text (code) section
20   */
21  .text 0x80030000  :
22  {
23    _ftext = . ;
24    eprol = .;
25    *(.text)
26    *(.text.*)
27    *(.gnu.linkonce.t*)
28    *(.mips16.fn.*)
29    *(.mips16.call.*)
30    PROVIDE (__runtime_reloc_start = .);
31    *(.rel.sdata)
32    PROVIDE (__runtime_reloc_stop = .);
33
34      /*
35       * Special FreeBSD sysctl sections.
36       */
37      . = ALIGN (16);
38      __start_set_sysctl_set = .;
39      *(set_sysctl_*);
40      __stop_set_sysctl_set = ABSOLUTE(.);
41      *(set_domain_*);
42      *(set_pseudo_*);
43
44      *(.gcc_except_table*)
45      *(.eh_frame_hdr)
46      *(.eh_frame)
47  }
48
49  .init :
50  {
51        KEEP(*crti.o(.init))
52        KEEP(*(.init))
53        KEEP(*crtn.o(.init))
54  }
55
56  .fini :
57  {
58        KEEP(*crti.o(.fini))
59        KEEP(*(.fini))
60        KEEP(*crtn.o(.fini))
61  }
62
63  .ctors    :
64  {
65    /* gcc uses crtbegin.o to find the start of
66       the constructors, so we make sure it is
67       first.  Because this is a wildcard, it
68       doesn't matter if the user does not
69       actually link against crtbegin.o; the
70       linker won't look for a file to match a
71       wildcard.  The wildcard also means that it
72       doesn't matter which directory crtbegin.o
73       is in.  */
74
75    KEEP (*crtbegin.o(.ctors))
76
77    /* We don't want to include the .ctor section from
78       from the crtend.o file until after the sorted ctors.
79       The .ctor section from the crtend file contains the
80       end of ctors marker and it must be last */
81
82    KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
83    KEEP (*(SORT(.ctors.*)))
84    KEEP (*(.ctors))
85  }
86
87  .dtors    :
88  {
89    KEEP (*crtbegin.o(.dtors))
90    KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
91    KEEP (*(SORT(.dtors.*)))
92    KEEP (*(.dtors))
93
94    etext  =  .;
95    _etext  =  .;
96  }
97
98  .rdata : {
99    *(.rdata)
100    *(.rodata)
101    *(.rodata.*)
102    KEEP (*(SORT(.rtemsroset.*)))
103    *(.gnu.linkonce.r*)
104  }
105
106  .tdata : {
107    _TLS_Data_begin = .;
108    *(.tdata .tdata.* .gnu.linkonce.td.*)
109    _TLS_Data_end = .;
110  }
111
112  .tbss : {
113    _TLS_BSS_begin = .;
114    *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon)
115    _TLS_BSS_end = .;
116  }
117
118  _TLS_Data_size = _TLS_Data_end - _TLS_Data_begin;
119  _TLS_Data_begin = _TLS_Data_size != 0 ? _TLS_Data_begin : _TLS_BSS_begin;
120  _TLS_Data_end = _TLS_Data_size != 0 ? _TLS_Data_end : _TLS_BSS_begin;
121  _TLS_BSS_size = _TLS_BSS_end - _TLS_BSS_begin;
122  _TLS_Size = _TLS_BSS_end - _TLS_Data_begin;
123  _TLS_Alignment = MAX (ALIGNOF (.tdata), ALIGNOF (.tbss));
124
125   _fdata = ALIGN(16);
126
127  .data : {
128    *(.data)
129    *(.data.*)
130    KEEP (*(SORT(.rtemsrwset.*)))
131    *(.gnu.linkonce.d*)
132    SORT(CONSTRUCTORS)
133  }
134  . = ALIGN(8);
135
136  .jcr : {
137        KEEP (*(.jcr))
138  }
139
140  _gp = ALIGN(16) + 0x8000;
141  __global = _gp;
142
143  .sdata : {
144    *(.sdata)
145    *(.sdata.*)
146    *(.gnu.linkonce.s*)
147  }
148  .lit8 : {
149    *(.lit8)
150  }
151  .lit4 : {
152    *(.lit4)
153  }
154
155   edata  =  .;
156   _edata  =  .;
157   _fbss = .;
158
159  .sbss : {
160    *(.sbss)
161    *(.scommon)
162  }
163  .bss : {
164    _bss_start = . ;
165    *(.bss)
166    *(COMMON)
167    . = ALIGN (64);
168     end = .;
169    _end = .;
170  }
171
172  .rtemsstack (NOLOAD) : {
173    *(SORT(.rtemsstack.*))
174    WorkAreaBase = .;
175  }
176
177  /* Debug sections.  These should never be loadable, but they must have
178     zero addresses for the debuggers to work correctly.  */
179  .line                 0 : { *(.line)                  }
180  .debug                0 : { *(.debug)                 }
181  .debug_sfnames        0 : { *(.debug_sfnames)         }
182  .debug_srcinfo        0 : { *(.debug_srcinfo)         }
183  .debug_macinfo        0 : { *(.debug_macinfo)         }
184  .debug_pubnames       0 : { *(.debug_pubnames)        }
185  .debug_aranges        0 : { *(.debug_aranges)         }
186}
Note: See TracBrowser for help on using the repository browser.