source: rtems/bsps/m68k/mrm332/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: 4.8 KB
Line 
1/*  linkcmds
2 */
3
4OUTPUT_ARCH(m68k)
5ENTRY(start)
6STARTUP(start.o)
7__DYNAMIC  =  0;
8
9/*
10 * ROM:
11 * +--------------------+ <- low memory
12 * | .text              |
13 * |        etext       |
14 * |        ctor list   | the ctor and dtor lists are for
15 * |        dtor list   | C++ support
16 * |        _endtext    |
17 * | temporary .data    | .data is moved to RAM by crt0
18 * |                    |
19 * +--------------------+ <- high memory
20 *
21 *
22 * RAM:
23 * +--------------------+ <- low memory
24 * | .data              | initialized data goes here
25 * |        _sdata      |
26 * |        _edata      |
27 * +--------------------+
28 * | .bss               |
29 * |        __bss_start | start of bss, cleared by crt0
30 * |        _end        | start of heap, used by sbrk()
31 * +--------------------+
32 * |    heap space      |
33 * |        _ENDHEAP    |
34 * |    stack space     |
35 * +--------------------+ <- high memory
36 */
37
38/*
39 * Declare some sizes.
40 */
41RomBase = DEFINED(RomBase) ? RomBase : 0x90000;
42RamBase = DEFINED(RamBase) ? RamBase : 0x03000;
43RamSize = DEFINED(RamSize) ? RamSize : 0x7d000;
44_RamEnd = RamBase + RamSize;
45
46MEMORY
47{
48  rom     : ORIGIN = 0x90000, LENGTH = 0x70000
49  ram     : ORIGIN = 0x03000, LENGTH = 0x7d000
50}
51
52_copy_data_from_rom = 1;
53HeapSize = DEFINED(HeapSize) ? HeapSize : 0x0;
54
55
56/*
57 *
58 */
59SECTIONS
60{
61  .text :
62  {
63    . = .;
64    text_start = .;
65    _text_start = .;
66    *(.text*)
67    . = ALIGN (16);
68
69        /*
70         * C++ constructors/destructors
71         */
72        *(.gnu.linkonce.t.*)
73
74    /*
75     * Initialization and finalization code.
76     *
77     * Various files can provide initialization and finalization
78     * functions.  crtbegin.o and crtend.o are two instances. The
79     * body of these functions are in .init and .fini sections. We
80     * accumulate the bodies here, and prepend function prologues
81     * from crti.o and function epilogues from crtn.o. crti.o must
82     * be linked first; crtn.o must be linked last.  Because these
83     * are wildcards, it doesn't matter if the user does not
84     * actually link against crti.o and crtn.o; the linker won't
85     * look for a file to match a wildcard.  The wildcard also
86     * means that it doesn't matter which directory crti.o and
87     * crtn.o are in.
88     */
89    PROVIDE (_init = .);
90    *crti.o(.init)
91    *(.init)
92    *crtn.o(.init)
93    PROVIDE (_fini = .);
94    *crti.o(.fini)
95    *(.fini)
96    *crtn.o(.fini)
97
98    /*
99     * Special FreeBSD sysctl sections.
100     */
101    . = ALIGN (16);
102    __start_set_sysctl_set = .;
103    *(set_sysctl_*);
104    __stop_set_sysctl_set = ABSOLUTE(.);
105    *(set_domain_*);
106    *(set_pseudo_*);
107
108    /*
109     * C++ constructors/destructors
110     *
111     * gcc uses crtbegin.o to find the start of the constructors
112     * and destructors so we make sure it is first.  Because this
113     * is a wildcard, it doesn't matter if the user does not
114     * actually link against crtbegin.o; the linker won't look for
115     * a file to match a wildcard.  The wildcard also means that
116     * it doesn't matter which directory crtbegin.o is in. The
117     * constructor and destructor list are terminated in
118     * crtend.o.  The same comments apply to it.
119     */
120    . = ALIGN (16);
121    *crtbegin.o(.ctors)
122    *(.ctors)
123    *crtend.o(.ctors)
124    *crtbegin.o(.dtors)
125    *(.dtors)
126    *crtend.o(.dtors)
127
128        /*
129         * Exception frame info
130         */
131        . = ALIGN (16);
132        *(.eh_frame)
133
134    /*
135     * Read-only data
136     */
137    . = ALIGN (16);
138    _rodata_start = . ;
139    *(.rodata*)
140    KEEP (*(SORT(.rtemsroset.*)))
141    *(.gnu.linkonce.r*)
142
143    . = ALIGN (16);
144    PROVIDE (_etext = .);
145    _endtext = .;
146    __data_start_rom = .;
147  } > rom
148  .tdata : {
149    _TLS_Data_begin = .;
150    *(.tdata .tdata.* .gnu.linkonce.td.*)
151    _TLS_Data_end = .;
152  } > rom
153  .tbss : {
154    _TLS_BSS_begin = .;
155    *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon)
156    _TLS_BSS_end = .;
157  } > rom
158  _TLS_Data_size = _TLS_Data_end - _TLS_Data_begin;
159  _TLS_Data_begin = _TLS_Data_size != 0 ? _TLS_Data_begin : _TLS_BSS_begin;
160  _TLS_Data_end = _TLS_Data_size != 0 ? _TLS_Data_end : _TLS_BSS_begin;
161  _TLS_BSS_size = _TLS_BSS_end - _TLS_BSS_begin;
162  _TLS_Size = _TLS_BSS_end - _TLS_Data_begin;
163  _TLS_Alignment = MAX (ALIGNOF (.tdata), ALIGNOF (.tbss));
164  .gcc_exc :
165  AT ( ADDR(.tdata) + SIZEOF( .tdata ) )
166  {
167    *(.gcc_exc)
168  } > ram
169  .data : AT(__data_start_rom)
170  {
171        PROVIDE (_copy_start = .);
172    *(.data*)
173        KEEP (*(SORT(.rtemsrwset.*)))
174        *(.gnu.linkonce.d*)
175        *(.gcc_except_table*)
176        *(.jcr)
177    . = ALIGN (16);
178    PROVIDE (_edata = .);
179    PROVIDE (_copy_end = .);
180  } > ram
181  .shbss :
182  {
183    *(.shbss)
184  } > ram
185  .bss :
186  {
187    M68Kvec = .;
188    . += (256 * 4);
189    _clear_start = .;
190    *(.dynbss)
191    *(.bss* .gnu.linkonce.b.*)
192    *(COMMON)
193    . = ALIGN (16);
194    PROVIDE (end = .);
195    _clear_end = .;
196  } > ram
197  .rtemsstack (NOLOAD) : {
198    *(SORT(.rtemsstack.*))
199    WorkAreaBase = .;
200  } > ram
201  .stab . (NOLOAD) :
202  {
203    [ .stab ]
204  }
205  .stabstr . (NOLOAD) :
206  {
207    [ .stabstr ]
208  }
209}
Note: See TracBrowser for help on using the repository browser.