source: rtems/bsps/m68k/mcf5225x/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: 5.0 KB
Line 
1/*
2 *  This file contains directives for the GNU linker which are specific
3 *  to the Freescale ColdFire mcf52258
4 *
5 *  COPYRIGHT (c) 1989-1999.
6 *  On-Line Applications Research Corporation (OAR).
7 *
8 *  The license and distribution terms for this file may be
9 *  found in the file LICENSE in this distribution or at
10 *  http://www.rtems.org/license/LICENSE.e
11 */
12
13/*
14 * Declare some sizes.
15 */
16RamBase = DEFINED(RamBase) ? RamBase : 0x20000000;
17RamSize = DEFINED(RamSize) ? RamSize : 64K;
18HeapSize = DEFINED(HeapSize) ? HeapSize : 0x0;
19_FlashBase = DEFINED(_FlashBase) ? _FlashBase : 0x00000000;
20
21_VBR = 0x20000000;
22
23ENTRY(start)
24STARTUP(start.o)
25
26
27MEMORY
28{
29    sram : ORIGIN = 0x20000000, LENGTH = 64K
30    flash : ORIGIN = 0x00000000, LENGTH = 512K
31}
32
33SECTIONS
34{
35    /*
36    * Text, data and bss segments
37    */
38    .text : {
39
40        *(.text*)
41        *(.ram_code)
42
43        /*
44        * C++ constructors/destructors
45        */
46        *(.gnu.linkonce.t.*)
47
48        /*
49        * Initialization and finalization code.
50        *
51        * Various files can provide initialization and finalization
52        * functions.  crtbegin.o and crtend.o are two instances. The
53        * body of these functions are in .init and .fini sections. We
54        * accumulate the bodies here, and prepend function prologues
55        * from crti.o and function epilogues from crtn.o. crti.o must
56        * be linked first; crtn.o must be linked last.  Because these
57        * are wildcards, it doesn't matter if the user does not
58        * actually link against crti.o and crtn.o; the linker won't
59        * look for a file to match a wildcard.  The wildcard also
60        * means that it doesn't matter which directory crti.o and
61        * crtn.o are in.
62        */
63        PROVIDE (_init = .);
64        *crti.o(.init)
65        *(.init)
66        *crtn.o(.init)
67        PROVIDE (_fini = .);
68        *crti.o(.fini)
69        *(.fini)
70        *crtn.o(.fini)
71
72        /*
73            * Special FreeBSD sysctl sections.
74            */
75        . = ALIGN (16);
76        __start_set_sysctl_set = .;
77        *(set_sysctl_*);
78        __stop_set_sysctl_set = ABSOLUTE(.);
79        *(set_domain_*);
80        *(set_pseudo_*);
81
82        /*
83        * C++ constructors/destructors
84        *
85        * gcc uses crtbegin.o to find the start of the constructors
86        * and destructors so we make sure it is first.  Because this
87        * is a wildcard, it doesn't matter if the user does not
88        * actually link against crtbegin.o; the linker won't look for
89        * a file to match a wildcard.  The wildcard also means that
90        * it doesn't matter which directory crtbegin.o is in. The
91        * constructor and destructor list are terminated in
92        * crtend.o.  The same comments apply to it.
93        */
94        . = ALIGN (16);
95        *crtbegin.o(.ctors)
96        *(.ctors)
97        *crtend.o(.ctors)
98        *crtbegin.o(.dtors)
99        *(.dtors)
100        *crtend.o(.dtors)
101
102        /*
103        * Exception frame info
104        */
105        . = ALIGN (16);
106        *(.eh_frame)
107
108        /*
109        * Read-only data
110        */
111        . = ALIGN (16);
112        _rodata_start = . ;
113        *(.rodata*)
114        KEEP (*(SORT(.rtemsroset.*)))
115        *(.gnu.linkonce.r*)
116
117        . = ALIGN (16);
118
119        *(.console_gdb_xfer)
120        *(.bootstrap_data)
121    } >flash
122
123    .tdata : {
124        _TLS_Data_begin = .;
125        *(.tdata .tdata.* .gnu.linkonce.td.*)
126        _TLS_Data_end = .;
127        . = ALIGN(16);
128        _estuff = .;
129        PROVIDE (_etext = .);
130    } >flash
131
132    .tbss : {
133        _TLS_BSS_begin = .;
134        *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon)
135        _TLS_BSS_end = .;
136    } >flash
137
138    _TLS_Data_size = _TLS_Data_end - _TLS_Data_begin;
139    _TLS_Data_begin = _TLS_Data_size != 0 ? _TLS_Data_begin : _TLS_BSS_begin;
140    _TLS_Data_end = _TLS_Data_size != 0 ? _TLS_Data_end : _TLS_BSS_begin;
141    _TLS_BSS_size = _TLS_BSS_end - _TLS_BSS_begin;
142    _TLS_Size = _TLS_BSS_end - _TLS_Data_begin;
143    _TLS_Alignment = MAX (ALIGNOF (.tdata), ALIGNOF (.tbss));
144
145    .data 0x20000400 : AT (_estuff)
146    {
147        PROVIDE( _data_dest_start = . );
148        PROVIDE( _copy_start = .);
149        *(.data*)
150        KEEP (*(SORT(.rtemsrwset.*)))
151        *(.gnu.linkonce.d*)
152        *(.gcc_except_table*)
153        *(.jcr)
154        . = ALIGN (16);
155        PROVIDE (_edata = .);
156        PROVIDE (_copy_end = .);
157        PROVIDE (_data_dest_end = . );
158    } >sram
159
160    _data_src_start = _estuff;
161    _data_src_end = _data_dest_start + SIZEOF(.data);
162
163    .bss :
164    {
165        PROVIDE (_clear_start = .);
166        *(.bss*)
167        *(COMMON)
168        . = ALIGN (16);
169        PROVIDE (_end = .);
170        PROVIDE (_clear_end = .);
171    } >sram
172
173    .rtemsstack (NOLOAD) : {
174        *(SORT(.rtemsstack.*))
175        PROVIDE(WorkAreaBase = .);
176    } >sram
177
178    /* Stabs debugging sections.  */
179    .stab 0 : { *(.stab) }
180    .stabstr 0 : { *(.stabstr) }
181    .stab.excl 0 : { *(.stab.excl) }
182    .stab.exclstr 0 : { *(.stab.exclstr) }
183    .stab.index 0 : { *(.stab.index) }
184    .stab.indexstr 0 : { *(.stab.indexstr) }
185    .comment 0 : { *(.comment) }
186
187    PROVIDE (end_of_all = .);
188}
Note: See TracBrowser for help on using the repository browser.