source: rtems/bsps/m68k/mrm332/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_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

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.

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:


  • 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 stuff obsolete. Remove the now superfluous BSP variants altcycv_devkit_smp and realview_pbx_a9_qemu_smp.


  • 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.


  • Remove magic linker command file allocation of initialization stack. Reuse interrupt stack for initialization stack.


  • 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).


  • 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.7 KB
2 *  @file
3 *
4 *  MRM332 Assembly Start Up Code
5 */
8 *  COPYRIGHT (c) 2000.
9 *  Matt Cross <>
10 *
11 *  The license and distribution terms for this file may be
12 *  found in the file LICENSE in this distribution or at
13 *
14 *
15 */
17#include "mrm332.h"
18#include <rtems/asm.h>
19#include <rtems/m68k/sim.h>
23  /* Put the header necessary for the modified CPU32bug to automatically
24     start up rtems: */
25#if 1
26.long 0xbeefbeef ;
28.long 0 ;
29.long start ;
30 start
32        start:
34        oriw   #0x0700,sr                       /* Mask off interupts */
36        // Set VBR to CPU32Bug vector table address
37        movel   #0x0,d0                         /* Use the initial vectors until we get going */
38        movecl  d0,vbr
40        /* Set stack pointer */
41        movel   #_Configuration_Interrupt_stack_area_end,d0
42        movel   d0,sp
43        movel   d0,a6
45  /* include in ram_init.S */
46  /*
47   * Initalize the SIM module.
48   * The stack pointer is not usable until the RAM chip select lines
49   * are configured. The following code must remain inline.
50   */
52  /* Module Configuration Register */
53  /*    see section(s) 3.1.3-3.1.6 of the SIM Reference Manual */
54  /* SIMCR etc and SAM macro all defined in sim.h found at     */
55  /* /cpukit/score/cpu/m68k/rtems/m68k/sim.h                               */
56  /* The code below does the following:                                            */
57  /*    - Sets Freeze Software Enable                                              */
58  /*    - Turns off Show Cycle Enable                                              */
59  /*    - Sets the location of SIM module mapping                          */
60  /*    - Sets the SIM Interrupt Arbitration Field                         */
61        lea     SIMCR, a0
62        movew   #FRZSW,d0
63        oriw    #SAM(0,8,SHEN),d0
64        oriw    #(MM*SIM_MM),d0
65        oriw    #SAM(SIM_IARB,0,IARB),d0
66        movew   d0, a0@
68        jsr     start_c /* Jump to the C startup code */
Note: See TracBrowser for help on using the repository browser.