diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-06-19 09:09:51 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-06-27 08:58:16 +0200 |
commit | 511dc4b2bee78ce0714e83838644429a29d325b1 (patch) | |
tree | 228b552c0917f74c29a298ff2e4df488368914f1 /bsps/mips | |
parent | bsps: Support .rtemsstack.* linker input sections (diff) | |
download | rtems-511dc4b2bee78ce0714e83838644429a29d325b1.tar.bz2 |
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.
Diffstat (limited to 'bsps/mips')
-rw-r--r-- | bsps/mips/csb350/start/linkcmds | 5 | ||||
-rw-r--r-- | bsps/mips/csb350/start/start.S | 2 | ||||
-rw-r--r-- | bsps/mips/hurricane/start/linkcmds | 5 | ||||
-rw-r--r-- | bsps/mips/jmr3904/start/linkcmds | 8 | ||||
-rw-r--r-- | bsps/mips/jmr3904/start/start.S | 2 | ||||
-rw-r--r-- | bsps/mips/malta/start/linkcmds | 8 | ||||
-rw-r--r-- | bsps/mips/malta/start/start.S | 2 | ||||
-rw-r--r-- | bsps/mips/rbtx4925/start/linkcmds | 5 | ||||
-rw-r--r-- | bsps/mips/rbtx4938/start/linkcmds | 5 | ||||
-rw-r--r-- | bsps/mips/shared/irq/exception.S | 10 |
10 files changed, 6 insertions, 46 deletions
diff --git a/bsps/mips/csb350/start/linkcmds b/bsps/mips/csb350/start/linkcmds index d9d2d1c815..961ada650e 100644 --- a/bsps/mips/csb350/start/linkcmds +++ b/bsps/mips/csb350/start/linkcmds @@ -15,7 +15,6 @@ _sdram_size = DEFINED(_sdram_size) ? _sdram_size : 12M; RamBase = _sdram_base; RamSize = _sdram_size; HeapSize = DEFINED(HeapSize) ? HeapSize : 0x0; -_StackSize = DEFINED(_StackSize) ? _StackSize : 0x4000; ENTRY(_start) STARTUP(start.o) @@ -187,10 +186,6 @@ SECTIONS *(.bss .bss.* .gnu.linkonce.b.*) *(COMMON) . = ALIGN (64); - _stack_limit = .; - . += _StackSize; - __stack = .; - _stack_init = .; _clear_end = .; end = .; _end = .; diff --git a/bsps/mips/csb350/start/start.S b/bsps/mips/csb350/start/start.S index 9aea3f4cae..dc92f1a430 100644 --- a/bsps/mips/csb350/start/start.S +++ b/bsps/mips/csb350/start/start.S @@ -67,7 +67,7 @@ zerobss: bltu v0,v1,3b addiu v0,v0,4 /* executed in delay slot */ - la t0, _stack_init /* initialize stack so we */ + la t0, _Configuration_Interrupt_stack_area_end /* initialize stack so we */ /* We must subtract 24 bytes for the 3 8 byte arguments to main, in case main wants to write them back to the stack. The caller is supposed to allocate stack space for parameters in registers in diff --git a/bsps/mips/hurricane/start/linkcmds b/bsps/mips/hurricane/start/linkcmds index 3ffaf52710..51e47158d3 100644 --- a/bsps/mips/hurricane/start/linkcmds +++ b/bsps/mips/hurricane/start/linkcmds @@ -8,7 +8,6 @@ RamBase = DEFINED(RamBase) ? RamBase : 0x80000000; RamSize = DEFINED(RamSize) ? RamSize : 4M; HeapSize = DEFINED(HeapSize) ? HeapSize : 0x0; -_StackSize = DEFINED(_StackSize) ? _StackSize : 0x1000; ENTRY(start) STARTUP(start.o) @@ -166,10 +165,6 @@ SECTIONS *(.bss) *(COMMON) . = ALIGN (64); - _stack_limit = .; - . += _StackSize; - __stack = .; - _stack_init = .; end = .; _end = .; } diff --git a/bsps/mips/jmr3904/start/linkcmds b/bsps/mips/jmr3904/start/linkcmds index a3d64a4284..0becab1e6f 100644 --- a/bsps/mips/jmr3904/start/linkcmds +++ b/bsps/mips/jmr3904/start/linkcmds @@ -8,7 +8,6 @@ RamBase = DEFINED(RamBase) ? RamBase : 0x88000000; RamSize = DEFINED(RamSize) ? RamSize : 4M; HeapSize = DEFINED(HeapSize) ? HeapSize : 0x0; -_StackSize = DEFINED(_StackSize) ? _StackSize : 0x1000; ENTRY(_start) STARTUP(start.o) @@ -164,10 +163,6 @@ SECTIONS *(.bss*) *(COMMON) . = ALIGN (64); - _stack_limit = .; - . += _StackSize; - __stack = .; - _stack_init = .; _clear_end = .; } @@ -181,9 +176,6 @@ SECTIONS _end = .; -/* Put starting stack in SRAM (8 Kb); this size is the same as the stack from - the original script (when everything was in SRAM). */ - /* __stack = 0x8000A000; */ /* DWARF debug sections. Symbols in the DWARF debugging sections are relative to the beginning of the section so we begin them at 0. */ diff --git a/bsps/mips/jmr3904/start/start.S b/bsps/mips/jmr3904/start/start.S index 92c0ddd956..9e1fa4182b 100644 --- a/bsps/mips/jmr3904/start/start.S +++ b/bsps/mips/jmr3904/start/start.S @@ -139,7 +139,7 @@ zerobss: bltu v0,v1,3b addiu v0,v0,4 # executed in delay slot - la t0, _stack_init # initialize stack so we + la t0, _Configuration_Interrupt_stack_area_end # initialize stack so we /* We must subtract 24 bytes for the 3 8 byte arguments to main, in case main wants to write them back to the stack. The caller is supposed to allocate stack space for parameters in registers in diff --git a/bsps/mips/malta/start/linkcmds b/bsps/mips/malta/start/linkcmds index 4e44bce110..1d6745cfe1 100644 --- a/bsps/mips/malta/start/linkcmds +++ b/bsps/mips/malta/start/linkcmds @@ -8,7 +8,6 @@ RamBase = DEFINED(RamBase) ? RamBase : 0x80000000; RamSize = DEFINED(RamSize) ? RamSize : 128M; HeapSize = DEFINED(HeapSize) ? HeapSize : 0x0; -_StackSize = DEFINED(_StackSize) ? _StackSize : 0x2000; ENTRY(_start) STARTUP(start.o) @@ -165,10 +164,6 @@ SECTIONS *(.bss*) *(COMMON) . = ALIGN (64); - _stack_limit = .; - . += _StackSize; - __stack = .; - _stack_init = .; _clear_end = .; } @@ -182,9 +177,6 @@ SECTIONS _end = .; -/* Put starting stack in SRAM (8 Kb); this size is the same as the stack from - the original script (when everything was in SRAM). */ - /* __stack = 0x8000A000; */ /* DWARF debug sections. Symbols in the DWARF debugging sections are relative to the beginning of the section so we begin them at 0. */ diff --git a/bsps/mips/malta/start/start.S b/bsps/mips/malta/start/start.S index 8f5f96489f..d437575cca 100644 --- a/bsps/mips/malta/start/start.S +++ b/bsps/mips/malta/start/start.S @@ -166,7 +166,7 @@ zerobss: bltu v0,v1,3b addiu v0,v0,4 # executed in delay slot - la t0, _stack_init # initialize stack so we + la t0, _Configuration_Interrupt_stack_area_end # initialize stack so we /* We must subtract 24 bytes for the 3 8 byte arguments to main, in case main wants to write them back to the stack. The caller is supposed to allocate stack space for parameters in registers in diff --git a/bsps/mips/rbtx4925/start/linkcmds b/bsps/mips/rbtx4925/start/linkcmds index 7c75cb5d59..3042176adf 100644 --- a/bsps/mips/rbtx4925/start/linkcmds +++ b/bsps/mips/rbtx4925/start/linkcmds @@ -8,7 +8,6 @@ RamBase = DEFINED(RamBase) ? RamBase : 0x80000000; RamSize = DEFINED(RamSize) ? RamSize : 4M; HeapSize = DEFINED(HeapSize) ? HeapSize : 0x0; -_StackSize = DEFINED(_StackSize) ? _StackSize : 0x1000; ENTRY(start) STARTUP(start.o) @@ -166,10 +165,6 @@ SECTIONS *(.bss) *(COMMON) . = ALIGN (64); - _stack_limit = .; - . += _StackSize; - __stack = .; - _stack_init = .; end = .; _end = .; } diff --git a/bsps/mips/rbtx4938/start/linkcmds b/bsps/mips/rbtx4938/start/linkcmds index a9deef8cd9..e11d1dcee2 100644 --- a/bsps/mips/rbtx4938/start/linkcmds +++ b/bsps/mips/rbtx4938/start/linkcmds @@ -8,7 +8,6 @@ RamBase = DEFINED(RamBase) ? RamBase : 0x80000000; RamSize = DEFINED(RamSize) ? RamSize : 4M; HeapSize = DEFINED(HeapSize) ? HeapSize : 0x0; -_StackSize = DEFINED(_StackSize) ? _StackSize : 0x1000; ENTRY(start) STARTUP(start.o) @@ -166,10 +165,6 @@ SECTIONS *(.bss) *(COMMON) . = ALIGN (64); - _stack_limit = .; - . += _StackSize; - __stack = .; - _stack_init = .; end = .; _end = .; } diff --git a/bsps/mips/shared/irq/exception.S b/bsps/mips/shared/irq/exception.S index e916ae55fe..30c733b05e 100644 --- a/bsps/mips/shared/irq/exception.S +++ b/bsps/mips/shared/irq/exception.S @@ -214,10 +214,8 @@ _chk_int: /* * - * #if ( CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE ) - * if ( _ISR_Nest_level == 0 ) - * switch to software interrupt stack - * #endif + * if ( _ISR_Nest_level == 0 ) + * switch to software interrupt stack */ /* @@ -307,9 +305,7 @@ _ISR_Handler_cleanup: /* - * #if ( CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE ) - * restore stack - * #endif + * restore stack * * if ( !_Thread_Dispatch_necessary ) * goto the label "exit interrupt (simple case)" |