source: rtems/bsps/v850/gdbv850sim/start/start.S @ 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: 1.4 KB
Line 
1# NEC V850 startup code
2
3        .section .text
4        .global _start
5
6_start:
7
8#if defined(__v850e__) || defined(__v850e2__) || defined(__v850e2v3__)
9
10        movea   255,            r0,     r20
11        mov     65535,          r21
12        mov     hilo(__Configuration_Interrupt_stack_area_end), sp
13        mov     hilo(__ep),     ep
14        mov     hilo(__gp),     gp
15        mov     hilo(__ctbp),   r6
16        ldsr    r6,             ctbp
17        mov     hilo(_edata),   r6
18        mov     hilo(_end),     r7
19.L0:
20        st.w    r0,             0[r6]
21        addi    4,              r6,     r6
22        cmp     r7,             r6
23        bl      .L0
24.L1:
25        jarl    ___main,        r31
26        addi    -16,            sp,     sp
27        mov     0,              r6
28        mov     0,              r7
29        mov     0,              r8
30        /* jarl    _main,               r31 */
31        jarl    _boot_card,             r31
32        mov     r10,            r6
33        jarl    _exit,          r31
34
35# else
36        movea   255,            r0,     r20
37        mov     r0,             r21
38        ori     65535,          r0,     r21
39        movhi   hi(__Configuration_Interrupt_stack_area_end),   r0,     sp
40        movea   lo(__Configuration_Interrupt_stack_area_end),   sp,     sp
41        movhi   hi(__ep),       r0,     ep
42        movea   lo(__ep),       ep,     ep
43        movhi   hi(__gp),       r0,     gp
44        movea   lo(__gp),       gp,     gp
45
46        movhi   hi(_edata),     r0,     r6
47        movea   lo(_edata),     r6,     r6
48        movhi   hi(_end),       r0,     r7
49        movea   lo(_end),       r7,     r7
50.L0:
51        st.b    r0,             0[r6]
52        addi    1,              r6,     r6
53        cmp     r7,             r6
54        bl      .L0
55.L1:
56        /* jarl    ___main,     r31 */
57        addi    -16,            sp,     sp
58        mov     0,              r6
59        mov     0,              r7
60        mov     0,              r8
61        /* jarl    _main,               r31 */
62        jarl    _boot_card,             r31
63        mov     r10,            r6
64.L2:
65        br      .L2
66        /* jarl    _exit,               r31 */
67# endif
68
69        .section .data
70        .global ___dso_handle
71        .weak   ___dso_handle
72___dso_handle:
73        .long   0
Note: See TracBrowser for help on using the repository browser.