summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/sparc/leon2
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2018-04-20 10:35:35 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-04-20 13:52:14 +0200
commit99648958668d3a33ee57974479b36201fe303f34 (patch)
tree6f27ea790e2823c6156e71219a4f54680263fac6 /c/src/lib/libbsp/sparc/leon2
parentbsps: Move start files to bsps (diff)
downloadrtems-99648958668d3a33ee57974479b36201fe303f34.tar.bz2
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.
Diffstat (limited to 'c/src/lib/libbsp/sparc/leon2')
-rw-r--r--c/src/lib/libbsp/sparc/leon2/Makefile.am24
-rw-r--r--c/src/lib/libbsp/sparc/leon2/startup/bsp_specs9
-rw-r--r--c/src/lib/libbsp/sparc/leon2/startup/bspdelay.c27
-rw-r--r--c/src/lib/libbsp/sparc/leon2/startup/bspidle.c35
-rw-r--r--c/src/lib/libbsp/sparc/leon2/startup/bspstart.c127
-rw-r--r--c/src/lib/libbsp/sparc/leon2/startup/linkcmds29
-rw-r--r--c/src/lib/libbsp/sparc/leon2/startup/linkcmds.at697f1
-rw-r--r--c/src/lib/libbsp/sparc/leon2/startup/linkcmds.leon229
-rw-r--r--c/src/lib/libbsp/sparc/leon2/startup/setvec.c65
-rw-r--r--c/src/lib/libbsp/sparc/leon2/startup/spurious.c184
10 files changed, 12 insertions, 518 deletions
diff --git a/c/src/lib/libbsp/sparc/leon2/Makefile.am b/c/src/lib/libbsp/sparc/leon2/Makefile.am
index 1b15b0249f..34cd6fcd12 100644
--- a/c/src/lib/libbsp/sparc/leon2/Makefile.am
+++ b/c/src/lib/libbsp/sparc/leon2/Makefile.am
@@ -3,7 +3,7 @@ ACLOCAL_AMFLAGS = -I ../../../../aclocal
include $(top_srcdir)/../../../../automake/compile.am
include $(top_srcdir)/../../bsp.am
-dist_project_lib_DATA = startup/bsp_specs
+dist_project_lib_DATA = ../../../../../../bsps/sparc/leon2/start/bsp_specs
noinst_PROGRAMS =
@@ -14,9 +14,9 @@ start.$(OBJEXT): ../../../../../../bsps/sparc/shared/start/start.S
project_lib_DATA = start.$(OBJEXT)
project_lib_DATA += linkcmds
-dist_project_lib_DATA += ../shared/startup/linkcmds.base
-dist_project_lib_DATA += startup/linkcmds.at697f
-dist_project_lib_DATA += startup/linkcmds.leon2
+dist_project_lib_DATA += ../../../../../../bsps/sparc/shared/start/linkcmds.base
+dist_project_lib_DATA += ../../../../../../bsps/sparc/leon2/start/linkcmds.at697f
+dist_project_lib_DATA += ../../../../../../bsps/sparc/leon2/start/linkcmds.leon2
project_lib_LIBRARIES = librtemsbsp.a
librtemsbsp_a_SOURCES =
@@ -24,16 +24,16 @@ librtemsbsp_a_SOURCES =
# startup
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/bspfatal-default.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/bspreset-empty.c
-librtemsbsp_a_SOURCES += startup/bspstart.c
-librtemsbsp_a_SOURCES += ../shared/startup/bspgetworkarea.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/sparc/leon2/start/bspstart.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/sparc/shared/start/bspgetworkarea.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/getentropy/getentropy-cpucounter.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/sbrk.c
-librtemsbsp_a_SOURCES += startup/setvec.c
-librtemsbsp_a_SOURCES += startup/spurious.c
-librtemsbsp_a_SOURCES += startup/bspidle.c
-librtemsbsp_a_SOURCES += startup/bspdelay.c
-librtemsbsp_a_SOURCES += ../shared/startup/bsp_fatal_exit.c
-librtemsbsp_a_SOURCES += ../shared/startup/bsp_fatal_halt.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/sparc/leon2/start/setvec.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/sparc/leon2/start/spurious.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/sparc/leon2/start/bspidle.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/sparc/leon2/start/bspdelay.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/sparc/shared/start/bsp_fatal_exit.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/sparc/shared/start/bsp_fatal_halt.c
# ISR Handler
librtemsbsp_a_SOURCES += ../shared/cpu.c
diff --git a/c/src/lib/libbsp/sparc/leon2/startup/bsp_specs b/c/src/lib/libbsp/sparc/leon2/startup/bsp_specs
deleted file mode 100644
index 87638cc027..0000000000
--- a/c/src/lib/libbsp/sparc/leon2/startup/bsp_specs
+++ /dev/null
@@ -1,9 +0,0 @@
-%rename endfile old_endfile
-%rename startfile old_startfile
-
-*startfile:
-%{!qrtems: %(old_startfile)} \
-%{!nostdlib: %{qrtems: crti.o%s crtbegin.o%s}}
-
-*endfile:
-%{!qrtems: %(old_endfile)} %{qrtems: crtend.o%s crtn.o%s}
diff --git a/c/src/lib/libbsp/sparc/leon2/startup/bspdelay.c b/c/src/lib/libbsp/sparc/leon2/startup/bspdelay.c
deleted file mode 100644
index 5ee8123157..0000000000
--- a/c/src/lib/libbsp/sparc/leon2/startup/bspdelay.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * @file
- * @ingroup sparc_leon2
- * @brief LEON2 BSP Delay Method
- */
-
-/*
- * COPYRIGHT (c) 1989-2011.
- * 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.
- */
-
-#include <bsp.h>
-
-void rtems_bsp_delay(int usecs)
-{
- uint32_t then;
-
- then = LEON_REG.Timer_Counter_1;
- then += usecs;
-
- while (LEON_REG.Timer_Counter_1 >= then)
- ;
-}
diff --git a/c/src/lib/libbsp/sparc/leon2/startup/bspidle.c b/c/src/lib/libbsp/sparc/leon2/startup/bspidle.c
deleted file mode 100644
index 8f11f66fb1..0000000000
--- a/c/src/lib/libbsp/sparc/leon2/startup/bspidle.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * @file
- * @ingroup sparc_leon2
- * @brief LEON2 Idle Thread
- */
-
-/*
- * LEON2 Idle Thread with power-down function
- *
- * COPYRIGHT (c) 1989-2009.
- * 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.
- *
- * Ported to LEON implementation of the SPARC by On-Line Applications
- * Research Corporation (OAR) under contract to the European Space
- * Agency (ESA).
- *
- * LEON modifications of respective RTEMS file: COPYRIGHT (c) 1995.
- * European Space Agency.
- */
-
-#include <bsp.h>
-
-void *bsp_idle_thread( uintptr_t ignored )
-{
- while (1) {
- /* make sure on load follows store to power-down reg */
- LEON_REG.Power_Down = LEON_REG.Power_Down;
- }
- return NULL;
-}
-
diff --git a/c/src/lib/libbsp/sparc/leon2/startup/bspstart.c b/c/src/lib/libbsp/sparc/leon2/startup/bspstart.c
deleted file mode 100644
index f2ed8ae16c..0000000000
--- a/c/src/lib/libbsp/sparc/leon2/startup/bspstart.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/**
- * @file
- * @ingroup sparc_leon2
- * @brief LEON2 Cache Snooping Support
- */
-
-/*
- * LEON2 Cache Snooping Support
- *
- * COPYRIGHT (c) 2011
- * Aeroflex Gaisler
- *
- * COPYRIGHT (c) 1989-2009.
- * 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.
- *
- * Ported to ERC32 implementation of the SPARC by On-Line Applications
- * Research Corporation (OAR) under contract to the European Space
- * Agency (ESA).
- *
- * ERC32 modifications of respective RTEMS file: COPYRIGHT (c) 1995.
- * European Space Agency.
- */
-
-#include <bsp.h>
-#include <bsp/bootcard.h>
-#include <rtems/sysinit.h>
-
-/*
- * Tells us if data cache snooping is available
- */
-int CPU_SPARC_HAS_SNOOPING;
-
-/*
- * set_snooping
- *
- * Read the data cache configuration register to determine if
- * bus snooping is available. This is needed for some drivers so
- * that they can select the most efficient copy routines.
- */
-static inline int set_snooping(void)
-{
- unsigned int tmp = *(unsigned int *)0x80000014; /* Cache control register */
- return ((tmp>>23) & 1); /* Data cache snooping enabled */
-}
-
-void bsp_start( void )
-{
- CPU_SPARC_HAS_SNOOPING = set_snooping();
-}
-
-/* If RTEMS_DRVMGR_STARTUP is defined extra code is added that
- * registers the LEON2 AMBA bus driver as root driver into the
- * driver manager.
- *
- * The structues here are declared weak so that the user can override
- * the configuration and add custom cores in the RTEMS project.
- */
-#ifdef RTEMS_DRVMGR_STARTUP
-#include <drvmgr/drvmgr.h>
-#include <drvmgr/leon2_amba_bus.h>
-
-/* All drivers included by BSP, this is overridden by the user by including
- * the devmgr_confdefs.h. No specifc drivers needed by BSP since IRQ/TIMER/UART
- * is not drvmgr drivers.
- */
-drvmgr_drv_reg_func drvmgr_drivers[] __attribute__((weak)) =
-{
- NULL /* End array with NULL */
-};
-
-/* Defines what cores are avilable on the bus in addition to the standard
- * LEON2 peripherals.
- */
-struct leon2_core leon2_amba_custom_cores[] __attribute__((weak)) =
-{
- EMPTY_LEON2_CORE
-};
-
-/* Configure LEON2 Root bus driver */
-struct leon2_bus leon2_bus_config __attribute__((weak)) =
-{
- &leon2_std_cores[0], /* The standard cores, defined by driver */
- &leon2_amba_custom_cores[0], /* custom cores, defined by us */
- DRVMGR_TRANSLATE_ONE2ONE,
- DRVMGR_TRANSLATE_ONE2ONE,
-};
-
-/* Driver resources on LEON2 AMBA bus. Used to set options for particular
- * LEON2 cores, it is up to the driver to look at the configuration paramters
- * once started.
- */
-struct drvmgr_bus_res leon2_amba_res __attribute__((weak)) =
-{
- .next = NULL,
- .resource = {
- DRVMGR_RES_EMPTY
- },
-};
-#endif /* RTEMS_DRVMGR_STARTUP */
-
-/*
- * Called just before drivers are initialized. Is used to initialize shared
- * interrupt handling.
- */
-static void leon2_pre_driver_hook( void )
-{
- bsp_spurious_initialize();
-
- /* Initialize shared interrupt handling, must be done after IRQ
- * controller has been found and initialized.
- */
- BSP_shared_interrupt_init();
-
-#ifdef RTEMS_DRVMGR_STARTUP
- leon2_root_register(&leon2_bus_config, &leon2_amba_res);
-#endif
-}
-
-RTEMS_SYSINIT_ITEM(
- leon2_pre_driver_hook,
- RTEMS_SYSINIT_BSP_PRE_DRIVERS,
- RTEMS_SYSINIT_ORDER_MIDDLE
-);
diff --git a/c/src/lib/libbsp/sparc/leon2/startup/linkcmds b/c/src/lib/libbsp/sparc/leon2/startup/linkcmds
deleted file mode 100644
index f1c7b9ce3e..0000000000
--- a/c/src/lib/libbsp/sparc/leon2/startup/linkcmds
+++ /dev/null
@@ -1,29 +0,0 @@
-/* linkcmds
- */
-
-/* Default values, can be overridden */
-
-_PROM_SIZE = DEFINED (_PROM_SIZE) ? _PROM_SIZE : 2M;
-_PROM_START = DEFINED (_PROM_START) ? _PROM_START : 0x00000000;
-
-_RAM_SIZE = DEFINED (_RAM_SIZE) ? _RAM_SIZE : 4M;
-_RAM_START = DEFINED (_RAM_START) ? _RAM_START : 0x40000000;
-
-/*
- * Base address of the on-CPU peripherals
- */
-
-_LEON_REG = 0x80000000;
-LEON_REG = _LEON_REG;
-
-/* these are the maximum values */
-
-MEMORY
-{
- rom : ORIGIN = 0x00000000, LENGTH = 256M
- ram : ORIGIN = 0x40000000, LENGTH = 1024M
-}
-
-ENTRY(start)
-
-INCLUDE linkcmds.base
diff --git a/c/src/lib/libbsp/sparc/leon2/startup/linkcmds.at697f b/c/src/lib/libbsp/sparc/leon2/startup/linkcmds.at697f
deleted file mode 100644
index 36e6ec49cb..0000000000
--- a/c/src/lib/libbsp/sparc/leon2/startup/linkcmds.at697f
+++ /dev/null
@@ -1 +0,0 @@
-INCLUDE linkcmds.leon2
diff --git a/c/src/lib/libbsp/sparc/leon2/startup/linkcmds.leon2 b/c/src/lib/libbsp/sparc/leon2/startup/linkcmds.leon2
deleted file mode 100644
index f1c7b9ce3e..0000000000
--- a/c/src/lib/libbsp/sparc/leon2/startup/linkcmds.leon2
+++ /dev/null
@@ -1,29 +0,0 @@
-/* linkcmds
- */
-
-/* Default values, can be overridden */
-
-_PROM_SIZE = DEFINED (_PROM_SIZE) ? _PROM_SIZE : 2M;
-_PROM_START = DEFINED (_PROM_START) ? _PROM_START : 0x00000000;
-
-_RAM_SIZE = DEFINED (_RAM_SIZE) ? _RAM_SIZE : 4M;
-_RAM_START = DEFINED (_RAM_START) ? _RAM_START : 0x40000000;
-
-/*
- * Base address of the on-CPU peripherals
- */
-
-_LEON_REG = 0x80000000;
-LEON_REG = _LEON_REG;
-
-/* these are the maximum values */
-
-MEMORY
-{
- rom : ORIGIN = 0x00000000, LENGTH = 256M
- ram : ORIGIN = 0x40000000, LENGTH = 1024M
-}
-
-ENTRY(start)
-
-INCLUDE linkcmds.base
diff --git a/c/src/lib/libbsp/sparc/leon2/startup/setvec.c b/c/src/lib/libbsp/sparc/leon2/startup/setvec.c
deleted file mode 100644
index e2d839c2e4..0000000000
--- a/c/src/lib/libbsp/sparc/leon2/startup/setvec.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * @file
- * @ingroup sparc_leon2
- * @brief Installs an interrupt vector on the SPARC simulator
- */
-
-/* set_vector
- *
- * This routine installs an interrupt vector on the SPARC simulator.
- *
- * INPUT PARAMETERS:
- * handler - interrupt handler entry point
- * vector - vector number
- * type - 0 indicates raw hardware connect
- * 1 indicates RTEMS interrupt connect
- *
- * OUTPUT PARAMETERS: NONE
- *
- * RETURNS:
- * address of previous interrupt handler
- *
- * COPYRIGHT (c) 1989-1998.
- * 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.
- *
- * Ported to LEON implementation of the SPARC by On-Line Applications
- * Research Corporation (OAR) under contract to the European Space
- * Agency (ESA).
- *
- * LEON modifications of respective RTEMS file: COPYRIGHT (c) 1995.
- * European Space Agency.
- */
-
-#include <bsp.h>
-
-rtems_isr_entry set_vector( /* returns old vector */
- rtems_isr_entry handler, /* isr routine */
- rtems_vector_number vector, /* vector number */
- int type /* RTEMS or RAW intr */
-)
-{
- rtems_isr_entry previous_isr;
- uint32_t real_trap;
- uint32_t source;
-
- if ( type )
- rtems_interrupt_catch( handler, vector, &previous_isr );
- else
- _CPU_ISR_install_raw_handler( vector, handler, (void *)&previous_isr );
-
- real_trap = SPARC_REAL_TRAP_NUMBER( vector );
-
- if ( LEON_INT_TRAP( real_trap ) ) {
-
- source = LEON_TRAP_SOURCE( real_trap );
-
- LEON_Clear_interrupt( source );
- LEON_Unmask_interrupt( source );
- }
-
- return previous_isr;
-}
diff --git a/c/src/lib/libbsp/sparc/leon2/startup/spurious.c b/c/src/lib/libbsp/sparc/leon2/startup/spurious.c
deleted file mode 100644
index 971c3cd44b..0000000000
--- a/c/src/lib/libbsp/sparc/leon2/startup/spurious.c
+++ /dev/null
@@ -1,184 +0,0 @@
-/**
- * @file
- * @ingroup sparc_leon2
- * @brief LEON Spurious Trap Handler
- */
-
-/*
- * LEON Spurious Trap Handler
- *
- * This is just enough of a trap handler to let us know what
- * the likely source of the trap was.
- *
- * Developed as part of the port of RTEMS to the LEON implementation
- * of the SPARC by On-Line Applications Research Corporation (OAR)
- * under contract to the European Space Agency (ESA).
- *
- * COPYRIGHT (c) 1995. European Space Agency.
- *
- * This terms of the RTEMS license apply to this file.
- */
-
-#include <bsp.h>
-#include <rtems/bspIo.h>
-#include <inttypes.h>
-
-void _CPU_Exception_frame_print( const CPU_Exception_frame *frame )
-{
- uint32_t trap;
- uint32_t real_trap;
- const CPU_Interrupt_frame *isf;
-
- trap = frame->trap;
- real_trap = SPARC_REAL_TRAP_NUMBER(trap);
- isf = frame->isf;
-
- printk(
- "Unexpected trap (%2" PRId32 ") at address 0x%08" PRIx32 "\n",
- real_trap,
- isf->tpc
- );
-
- switch (real_trap) {
-
- /*
- * First the ones defined by the basic architecture
- */
-
- case 0x00:
- printk( "reset\n" );
- break;
- case 0x01:
- printk( "instruction access exception\n" );
- break;
- case 0x02:
- printk( "illegal instruction\n" );
- break;
- case 0x03:
- printk( "privileged instruction\n" );
- break;
- case 0x04:
- printk( "fp disabled\n" );
- break;
- case 0x07:
- printk( "memory address not aligned\n" );
- break;
- case 0x08:
- printk( "fp exception\n" );
- break;
- case 0x09:
- printk("data access exception at 0x%08x\n", LEON_REG.Failed_Address );
- break;
- case 0x0A:
- printk( "tag overflow\n" );
- break;
-
- /*
- * Then the ones defined by the LEON in particular
- */
-
- case LEON_TRAP_TYPE( LEON_INTERRUPT_CORRECTABLE_MEMORY_ERROR ):
- printk( "LEON_INTERRUPT_CORRECTABLE_MEMORY_ERROR\n" );
- break;
- case LEON_TRAP_TYPE( LEON_INTERRUPT_UART_2_RX_TX ):
- printk( "LEON_INTERRUPT_UART_2_RX_TX\n" );
- break;
- case LEON_TRAP_TYPE( LEON_INTERRUPT_UART_1_RX_TX ):
- printk( "LEON_INTERRUPT_UART_1_RX_TX\n" );
- break;
- case LEON_TRAP_TYPE( LEON_INTERRUPT_EXTERNAL_0 ):
- printk( "LEON_INTERRUPT_EXTERNAL_0\n" );
- break;
- case LEON_TRAP_TYPE( LEON_INTERRUPT_EXTERNAL_1 ):
- printk( "LEON_INTERRUPT_EXTERNAL_1\n" );
- break;
- case LEON_TRAP_TYPE( LEON_INTERRUPT_EXTERNAL_2 ):
- printk( "LEON_INTERRUPT_EXTERNAL_2\n" );
- break;
- case LEON_TRAP_TYPE( LEON_INTERRUPT_EXTERNAL_3 ):
- printk( "LEON_INTERRUPT_EXTERNAL_3\n" );
- break;
- case LEON_TRAP_TYPE( LEON_INTERRUPT_TIMER1 ):
- printk( "LEON_INTERRUPT_TIMER1\n" );
- break;
- case LEON_TRAP_TYPE( LEON_INTERRUPT_TIMER2 ):
- printk( "LEON_INTERRUPT_TIMER2\n" );
- break;
-
- default:
- break;
- }
-}
-
-static rtems_isr bsp_spurious_handler(
- rtems_vector_number trap,
- CPU_Interrupt_frame *isf
-)
-{
- CPU_Exception_frame frame = {
- .trap = trap,
- .isf = isf
- };
-
-#if !defined(SPARC_USE_LAZY_FP_SWITCH)
- if ( SPARC_REAL_TRAP_NUMBER( trap ) == 4 ) {
- _Internal_error( INTERNAL_ERROR_ILLEGAL_USE_OF_FLOATING_POINT_UNIT );
- }
-#endif
-
- rtems_fatal(
- RTEMS_FATAL_SOURCE_EXCEPTION,
- (rtems_fatal_code) &frame
- );
-}
-
-/*
- * bsp_spurious_initialize
- *
- * Install the spurious handler for most traps. Note that set_vector()
- * will unmask the corresponding asynchronous interrupt, so the initial
- * interrupt mask is restored after the handlers are installed.
- */
-
-void bsp_spurious_initialize()
-{
- uint32_t trap;
- uint32_t level;
- uint32_t mask;
-
- level = sparc_disable_interrupts();
- mask = LEON_REG.Interrupt_Mask;
-
- for ( trap=0 ; trap<256 ; trap++ ) {
-
- /*
- * Skip window overflow, underflow, and flush as well as software
- * trap 0,9,10 which we will use as a shutdown, IRQ disable, IRQ enable.
- * Also avoid trap 0x70 - 0x7f which cannot happen and where some of the
- * space is used to pass parameters to the program.
- */
-
- if (( trap == 5 || trap == 6 ) ||
-#if defined(SPARC_USE_LAZY_FP_SWITCH)
- ( trap == 4 ) ||
-#endif
- (( trap >= 0x11 ) && ( trap <= 0x1f )) ||
- (( trap >= 0x70 ) && ( trap <= 0x83 )) ||
- ( trap == 0x80 + SPARC_SWTRAP_IRQDIS ) ||
-#if defined(SPARC_USE_SYNCHRONOUS_FP_SWITCH)
- ( trap == 0x80 + SPARC_SWTRAP_IRQDIS_FP ) ||
-#endif
- ( trap == 0x80 + SPARC_SWTRAP_IRQEN ))
- continue;
-
- set_vector(
- (rtems_isr_entry) bsp_spurious_handler,
- SPARC_SYNCHRONOUS_TRAP( trap ),
- 1
- );
- }
-
- LEON_REG.Interrupt_Mask = mask;
- sparc_enable_interrupts(level);
-
-}