source: rtems/bsps/m68k/gen68340/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: 6.4 KB
Line 
1/*
2 * This file contains GNU linker directives for a generic MC68340/349 board.
3 * Variations in hardware type and dynamic memory size can be made
4 * by overriding some values with linker command-line arguments.
5 *
6 * ATTENTION: RAM and ROM placement must accord those in start340.S!!
7 *            (next time I'll use some shared variables :) )
8 *
9 * Geoffroy Montel
10 * France Telecom - CNET/DSM/TAM/CAT
11 * 4, rue du Clos Courtel
12 * 35512 CESSON-SEVIGNE
13 * FRANCE
14 *
15 * e-mail: g_montel@yahoo.com
16 */
17
18/*
19 * Declare some sizes.
20 */
21RamBase = DEFINED(RamBase) ? RamBase : 0x10000000;
22RamSize = DEFINED(RamSize) ? RamSize : 4M;
23HeapSize = DEFINED(HeapSize) ? HeapSize : 0x0;
24
25/*
26 * Declare on-board memory.
27 * It would be nice if the ram length could be given as
28 * LENGTH=RamSize, but gld doesn't allow non-constant
29 * values in the LENGTH expression. 
30 */
31MEMORY {
32          ram : ORIGIN = 0x10000000, LENGTH = 4M
33          rom : ORIGIN = 0x01000000, LENGTH = 4M
34/*        dpram : ORIGIN = 0xFE000000, LENGTH = 8k */
35}
36
37ENTRY(start)
38STARTUP(start.o)
39
40/*
41 * Declare low-order three octets of Ethernet address.
42 */
43ETHERNET_ADDRESS = DEFINED(ETHERNET_ADDRESS) ? ETHERNET_ADDRESS : 0xDEAD12;
44
45/*
46 * Load objects
47 */
48SECTIONS {
49
50        /*
51         * Boot PROM
52         */
53        rom : {
54                _RomBase = .;
55                __RomBase = .;
56        } >rom
57
58        /*
59         * Dynamic RAM
60         */
61        ram : {
62                . = .;
63        } >ram
64
65        /*
66         * Text, data and bss segments
67         */
68        .text : {
69                *(.text*)
70
71                /*
72                 * C++ constructors/destructors
73                 */
74                *(.gnu.linkonce.t.*)
75
76                /*
77                 * Initialization and finalization code.
78                 *
79                 * Various files can provide initialization and finalization
80                 * functions.  crtbegin.o and crtend.o are two instances. The
81                 * body of these functions are in .init and .fini sections. We
82                 * accumulate the bodies here, and prepend function prologues
83                 * from crti.o and function epilogues from crtn.o. crti.o must
84                 * be linked first; crtn.o must be linked last.  Because these
85                 * are wildcards, it doesn't matter if the user does not
86                 * actually link against crti.o and crtn.o; the linker won't
87                 * look for a file to match a wildcard.  The wildcard also
88                 * means that it doesn't matter which directory crti.o and
89                 * crtn.o are in.
90                 */
91                PROVIDE (_init = .);
92                *crti.o(.init)
93                *(.init)
94                *crtn.o(.init)
95                PROVIDE (_fini = .);
96                *crti.o(.fini)
97                *(.fini)
98                *crtn.o(.fini)
99
100                /*
101                 * Special FreeBSD sysctl sections.
102                 */
103                . = ALIGN (16);
104                __start_set_sysctl_set = .;
105                *(set_sysctl_*);
106                __stop_set_sysctl_set = ABSOLUTE(.);
107                *(set_domain_*);
108                *(set_pseudo_*);
109
110                /*
111                 * C++ constructors/destructors
112                 *
113                 * gcc uses crtbegin.o to find the start of the constructors
114                 * and destructors so we make sure it is first.  Because this
115                 * is a wildcard, it doesn't matter if the user does not
116                 * actually link against crtbegin.o; the linker won't look for
117                 * a file to match a wildcard.  The wildcard also means that
118                 * it doesn't matter which directory crtbegin.o is in. The
119                 * constructor and destructor list are terminated in
120                 * crtend.o.  The same comments apply to it.
121                 */
122                . = ALIGN (16);
123                *crtbegin.o(.ctors)
124                *(.ctors)
125                *crtend.o(.ctors)
126                *crtbegin.o(.dtors)
127                *(.dtors)
128                *crtend.o(.dtors)
129
130                /*
131                 * Exception frame info
132                 */
133                . = ALIGN (16);
134                *(.eh_frame)
135
136                /*
137                 * Read-only data
138                 */
139                . = ALIGN (16);
140                _rodata_start = . ;
141                *(.rodata*)
142                KEEP (*(SORT(.rtemsroset.*)))
143                *(.gnu.linkonce.r*)
144
145                 . = ALIGN (16);
146                PROVIDE (_etext = .);
147        } >ram
148
149        .tdata : {
150                _TLS_Data_begin = .;
151                *(.tdata .tdata.* .gnu.linkonce.td.*)
152                _TLS_Data_end = .;
153        } >ram
154
155        .tbss : {
156                _TLS_BSS_begin = .;
157                *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon)
158                _TLS_BSS_end = .;
159        } >ram
160
161        _TLS_Data_size = _TLS_Data_end - _TLS_Data_begin;
162        _TLS_Data_begin = _TLS_Data_size != 0 ? _TLS_Data_begin : _TLS_BSS_begin;
163        _TLS_Data_end = _TLS_Data_size != 0 ? _TLS_Data_end : _TLS_BSS_begin;
164        _TLS_BSS_size = _TLS_BSS_end - _TLS_BSS_begin;
165        _TLS_Size = _TLS_BSS_end - _TLS_Data_begin;
166        _TLS_Alignment = MAX (ALIGNOF (.tdata), ALIGNOF (.tbss));
167
168        .data : {
169                PROVIDE (_copy_start = .);
170                *(.data*)
171                KEEP (*(SORT(.rtemsrwset.*)))
172                *(.gnu.linkonce.d*)
173                *(.gcc_except_table*)
174                *(.jcr)
175                . = ALIGN (16);
176                PROVIDE (_edata = .);
177                PROVIDE (_copy_end = .);
178        } >ram
179        .bss : {
180                M68Kvec = .;
181                . += (256 * 4);
182                _clear_start = .;
183                *(.dynbss)
184                *(.bss* .gnu.linkonce.b.*)
185                *(COMMON)
186                . = ALIGN (16);
187                PROVIDE (end = .);
188                _clear_end = .;
189        } >ram
190
191        .rtemsstack (NOLOAD) : {
192                *(SORT(.rtemsstack.*))
193                WorkAreaBase = .;
194        } >ram
195
196       /*
197        * On-chip memory/peripherals
198        *
199        */
200        dpram : {
201                m340 = .;
202                _m340 = .;
203                . += (8 * 1024);
204        } >ram
205
206
207  /* Stabs debugging sections.  */
208  .stab 0 : { *(.stab) }
209  .stabstr 0 : { *(.stabstr) }
210  .stab.excl 0 : { *(.stab.excl) }
211  .stab.exclstr 0 : { *(.stab.exclstr) }
212  .stab.index 0 : { *(.stab.index) }
213  .stab.indexstr 0 : { *(.stab.indexstr) }
214  .comment 0 : { *(.comment) }
215
216  /* DWARF debug sections.
217     Symbols in the DWARF debugging sections are relative to the beginning
218     of the section so we begin them at 0.  */
219  /* DWARF 1 */
220  .debug          0 : { *(.debug) }
221  .line           0 : { *(.line) }
222 
223  /* GNU DWARF 1 extensions */
224  .debug_srcinfo  0 : { *(.debug_srcinfo) }
225  .debug_sfnames  0 : { *(.debug_sfnames) }
226 
227  /* DWARF 1.1 and DWARF 2 */
228  .debug_aranges  0 : { *(.debug_aranges) }
229  .debug_pubnames 0 : { *(.debug_pubnames) }
230 
231  /* DWARF 2 */
232  .debug_info     0 : { *(.debug_info) }
233  .debug_abbrev   0 : { *(.debug_abbrev) }
234  .debug_line     0 : { *(.debug_line) }
235  .debug_frame    0 : { *(.debug_frame) }
236  .debug_str      0 : { *(.debug_str) }
237  .debug_loc      0 : { *(.debug_loc) }
238  .debug_macinfo  0 : { *(.debug_macinfo) }
239 
240  /* SGI/MIPS DWARF 2 extensions */
241  .debug_weaknames 0 : { *(.debug_weaknames) }
242  .debug_funcnames 0 : { *(.debug_funcnames) }
243  .debug_typenames 0 : { *(.debug_typenames) }
244  .debug_varnames  0 : { *(.debug_varnames) }
245  /* These must appear regardless of  .  */
246}
Note: See TracBrowser for help on using the repository browser.