forked from Imagelibrary/rtems
bsps: Move startup files to bsps
Adjust build support files to new directory layout. This patch is a part of the BSP source reorganization. Update #3285.
This commit is contained in:
22
bsps/sparc/shared/start/bsp_fatal_exit.c
Normal file
22
bsps/sparc/shared/start/bsp_fatal_exit.c
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* @file
|
||||
* @ingroup sparc_bsp
|
||||
* @brief ERC32/LEON2/LEON3 BSP specific exit handler.
|
||||
*/
|
||||
|
||||
/*
|
||||
* COPYRIGHT (c) 2014.
|
||||
* Aeroflex Gaisler AB.
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rtems.org/license/LICENSE.
|
||||
*/
|
||||
|
||||
#include <bsp.h>
|
||||
#include <rtems/score/cpu.h>
|
||||
|
||||
void BSP_fatal_exit(uint32_t error)
|
||||
{
|
||||
sparc_syscall_exit(RTEMS_FATAL_SOURCE_BSP, error);
|
||||
}
|
||||
38
bsps/sparc/shared/start/bsp_fatal_halt.c
Normal file
38
bsps/sparc/shared/start/bsp_fatal_halt.c
Normal file
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* @file
|
||||
* @ingroup sparc_bsp
|
||||
* @brief ERC32/LEON2 BSP Fatal_halt handler.
|
||||
*
|
||||
* COPYRIGHT (c) 2014.
|
||||
* Aeroflex Gaisler AB.
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rtems.org/license/LICENSE.
|
||||
*/
|
||||
|
||||
#include <bsp.h>
|
||||
|
||||
#ifdef BSP_POWER_DOWN_AT_FATAL_HALT
|
||||
|
||||
/* Spin CPU on fatal error exit */
|
||||
void _CPU_Fatal_halt(uint32_t source, uint32_t error)
|
||||
{
|
||||
uint32_t level = sparc_disable_interrupts();
|
||||
|
||||
__asm__ volatile ( "mov %0, %%g1 " : "=r" (level) : "0" (level) );
|
||||
|
||||
while (1) ; /* loop forever */
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/* return to debugger, simulator, hypervisor or similar by exiting
|
||||
* with an error code. g1=1, g2=FATAL_SOURCE, G3=error-code.
|
||||
*/
|
||||
void _CPU_Fatal_halt(uint32_t source, uint32_t error)
|
||||
{
|
||||
sparc_syscall_exit(source, error);
|
||||
}
|
||||
|
||||
#endif
|
||||
63
bsps/sparc/shared/start/bspgetworkarea.c
Normal file
63
bsps/sparc/shared/start/bspgetworkarea.c
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* This set of routines are the BSP specific initialization
|
||||
* support routines.
|
||||
*
|
||||
* COPYRIGHT (c) 1989-2008.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rtems.org/license/LICENSE.
|
||||
*/
|
||||
|
||||
/* #define BSP_GET_WORK_AREA_DEBUG */
|
||||
#include <bsp.h>
|
||||
#include <bsp/bootcard.h>
|
||||
#ifdef BSP_GET_WORK_AREA_DEBUG
|
||||
#include <rtems/bspIo.h>
|
||||
#endif
|
||||
|
||||
/* Tells us where to put the workspace in case remote debugger is present. */
|
||||
extern uint32_t rdb_start;
|
||||
|
||||
/*
|
||||
* This method returns the base address and size of the area which
|
||||
* is to be allocated between the RTEMS Workspace and the C Program
|
||||
* Heap.
|
||||
*/
|
||||
void bsp_work_area_initialize(void)
|
||||
{
|
||||
/* must be identical to STACK_SIZE in start.S */
|
||||
#define STACK_SIZE (16 * 1024)
|
||||
|
||||
/* Early dynamic memory allocator is placed just above _end */
|
||||
void *work_area_start = (void *)&end;
|
||||
uintptr_t work_area_size =
|
||||
(uintptr_t)rdb_start - (uintptr_t)&end - STACK_SIZE;
|
||||
|
||||
/*
|
||||
* The following may be helpful in debugging what goes wrong when
|
||||
* you are allocating the Work Area in a new BSP.
|
||||
*/
|
||||
#ifdef BSP_GET_WORK_AREA_DEBUG
|
||||
{
|
||||
void *sp = __builtin_frame_address(0);
|
||||
void *end = *work_area_start + *work_area_size;
|
||||
printk(
|
||||
"work_area_start = 0x%p\n"
|
||||
"work_area_size = %d 0x%08x\n"
|
||||
"end = 0x%p\n"
|
||||
"current stack pointer = 0x%p%s\n",
|
||||
work_area_start,
|
||||
work_area_size, /* decimal */
|
||||
work_area_size, /* hexadecimal */
|
||||
end,
|
||||
sp,
|
||||
((sp >= *work_area_start && sp <= end) ? " OVERLAPS!" : "")
|
||||
);
|
||||
printk( "rdb_start = 0x%08x\n", rdb_start );
|
||||
}
|
||||
#endif
|
||||
|
||||
bsp_work_area_initialize_default(work_area_start, work_area_size);
|
||||
}
|
||||
207
bsps/sparc/shared/start/linkcmds.base
Normal file
207
bsps/sparc/shared/start/linkcmds.base
Normal file
@@ -0,0 +1,207 @@
|
||||
/* linkcmds
|
||||
*/
|
||||
|
||||
OUTPUT_ARCH(sparc)
|
||||
__DYNAMIC = 0;
|
||||
|
||||
/*
|
||||
* The memory map looks like this:
|
||||
* +--------------------+ <- low memory
|
||||
* | .text |
|
||||
* | etext |
|
||||
* | ctor list | the ctor and dtor lists are for
|
||||
* | dtor list | C++ support
|
||||
* | _endtext |
|
||||
* +--------------------+
|
||||
* | .data | initialized data goes here
|
||||
* | _sdata |
|
||||
* | _edata |
|
||||
* +--------------------+
|
||||
* | .bss |
|
||||
* | __bss_start | start of bss, cleared by crt0
|
||||
* | _end | start of heap, used by sbrk()
|
||||
* +--------------------+
|
||||
* | heap space |
|
||||
* | _ENDHEAP |
|
||||
* | stack space |
|
||||
* | __stack | top of stack
|
||||
* +--------------------+ <- high memory
|
||||
*/
|
||||
|
||||
_RAM_END = _RAM_START + _RAM_SIZE;
|
||||
|
||||
_PROM_END = _PROM_START + _PROM_SIZE;
|
||||
|
||||
/*
|
||||
* Alternate names without leading _.
|
||||
*/
|
||||
|
||||
PROM_START = _PROM_START;
|
||||
PROM_SIZE = _PROM_SIZE;
|
||||
PROM_END = _PROM_END;
|
||||
|
||||
RAM_START = _RAM_START;
|
||||
RAM_SIZE = _RAM_SIZE;
|
||||
RAM_END = _RAM_END;
|
||||
|
||||
/*
|
||||
* SPARC monitor assumes this is present to provide proper RTEMS awareness.
|
||||
*/
|
||||
EXTERN(rtems_get_version_string);
|
||||
|
||||
STARTUP(start.o)
|
||||
|
||||
/*
|
||||
* stick everything in ram (of course)
|
||||
*/
|
||||
SECTIONS
|
||||
{
|
||||
.text :
|
||||
{
|
||||
CREATE_OBJECT_SYMBOLS
|
||||
text_start = .;
|
||||
_text_start = .;
|
||||
*(.text*)
|
||||
. = ALIGN (16);
|
||||
|
||||
KEEP(*(.eh_frame*))
|
||||
. = ALIGN (16);
|
||||
|
||||
*(.gnu.linkonce.t*)
|
||||
|
||||
/*
|
||||
* C++ constructors
|
||||
*/
|
||||
/* gcc uses crtbegin.o to find the start of
|
||||
the constructors, so we make sure it is
|
||||
first. Because this is a wildcard, it
|
||||
doesn't matter if the user does not
|
||||
actually link against crtbegin.o; the
|
||||
linker won't look for a file to match a
|
||||
wildcard. The wildcard also means that it
|
||||
doesn't matter which directory crtbegin.o
|
||||
is in. */
|
||||
KEEP (*crtbegin.o(.ctors))
|
||||
KEEP (*crtbegin?.o(.ctors))
|
||||
/* We don't want to include the .ctor section from
|
||||
the crtend.o file until after the sorted ctors.
|
||||
The .ctor section from the crtend file contains the
|
||||
end of ctors marker and it must be last */
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
|
||||
KEEP (*(SORT(.ctors.*)))
|
||||
KEEP (*(.ctors))
|
||||
KEEP (*crtbegin.o(.dtors))
|
||||
KEEP (*crtbegin?.o(.dtors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
|
||||
KEEP (*(SORT(.dtors.*)))
|
||||
KEEP (*(.dtors))
|
||||
|
||||
_rodata_start = . ;
|
||||
*(.rodata*)
|
||||
*(.gnu.linkonce.r*)
|
||||
_erodata = ALIGN( 0x10 ) ;
|
||||
|
||||
etext = ALIGN(0x10);
|
||||
_etext = .;
|
||||
KEEP(*(.init*))
|
||||
KEEP(*(.fini*))
|
||||
*(.lit)
|
||||
*(.shdata)
|
||||
. = ALIGN (16);
|
||||
} > ram
|
||||
.tdata : {
|
||||
_TLS_Data_begin = .;
|
||||
*(.tdata .tdata.* .gnu.linkonce.td.*)
|
||||
_TLS_Data_end = .;
|
||||
} > ram
|
||||
.tbss : {
|
||||
_TLS_BSS_begin = .;
|
||||
*(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon)
|
||||
_TLS_BSS_end = .;
|
||||
} > ram
|
||||
_TLS_Data_size = _TLS_Data_end - _TLS_Data_begin;
|
||||
_TLS_Data_begin = _TLS_Data_size != 0 ? _TLS_Data_begin : _TLS_BSS_begin;
|
||||
_TLS_Data_end = _TLS_Data_size != 0 ? _TLS_Data_end : _TLS_BSS_begin;
|
||||
_TLS_BSS_size = _TLS_BSS_end - _TLS_BSS_begin;
|
||||
_TLS_Size = _TLS_BSS_end - _TLS_Data_begin;
|
||||
_TLS_Alignment = MAX (ALIGNOF (.tdata), ALIGNOF (.tbss));
|
||||
.rtemsroset : {
|
||||
/* for pre rtems-libbsd FreeBSD code */
|
||||
__start_set_sysctl_set = .;
|
||||
KEEP(*(set_sysctl_*));
|
||||
__stop_set_sysctl_set = .;
|
||||
KEEP(*(set_domain_*));
|
||||
KEEP(*(set_pseudo_*));
|
||||
|
||||
KEEP (*(SORT(.rtemsroset.*)))
|
||||
|
||||
. = ALIGN (16);
|
||||
_endtext = .;
|
||||
} >ram
|
||||
.rela.dyn :
|
||||
{
|
||||
*(.rela.init)
|
||||
*(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
|
||||
*(.rela.fini)
|
||||
*(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
|
||||
*(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
|
||||
*(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
|
||||
*(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
|
||||
*(.rela.ctors)
|
||||
*(.rela.dtors)
|
||||
*(.rela.got)
|
||||
*(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
|
||||
*(.rela.rtemsroset*)
|
||||
*(.rela.rtemsrwset*)
|
||||
} >ram
|
||||
.data :
|
||||
{
|
||||
data_start = .;
|
||||
_data_start = .;
|
||||
_sdata = . ;
|
||||
*(.data*)
|
||||
*(.gnu.linkonce.d*)
|
||||
. = ALIGN(0x10);
|
||||
*(.gcc_except_table*)
|
||||
. = ALIGN(0x10);
|
||||
edata = .;
|
||||
_edata = .;
|
||||
} > ram
|
||||
_data_load_start = LOADADDR (.data);
|
||||
.rtemsrwset : {
|
||||
KEEP (*(SORT(.rtemsrwset.*)))
|
||||
} >ram
|
||||
.dynamic : { *(.dynamic) } >ram
|
||||
.jcr : { *(.jcr) } >ram
|
||||
.got : { *(.got) } >ram
|
||||
.plt : { *(.plt) } >ram
|
||||
.hash : { *(.hash) } >ram
|
||||
.dynrel : { *(.dynrel) } >ram
|
||||
.dynsym : { *(.dynsym) } >ram
|
||||
.dynstr : { *(.dynstr) } >ram
|
||||
.hash : { *(.hash) } >ram
|
||||
.shbss :
|
||||
{
|
||||
*(.shbss)
|
||||
} > ram
|
||||
.bss :
|
||||
{
|
||||
__bss_start = ALIGN(0x8);
|
||||
_bss_start = .;
|
||||
bss_start = .;
|
||||
*(.bss .bss* .gnu.linkonce.b*)
|
||||
*(COMMON)
|
||||
. = ALIGN (16);
|
||||
end = .;
|
||||
_end = ALIGN(0x8);
|
||||
__end = ALIGN(0x8);
|
||||
} > ram
|
||||
.stab . (NOLOAD) :
|
||||
{
|
||||
[ .stab ]
|
||||
}
|
||||
.stabstr . (NOLOAD) :
|
||||
{
|
||||
[ .stabstr ]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user