diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-04-20 10:35:35 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-04-20 13:52:14 +0200 |
commit | 99648958668d3a33ee57974479b36201fe303f34 (patch) | |
tree | 6f27ea790e2823c6156e71219a4f54680263fac6 /c/src/lib/libbsp/sparc/erc32 | |
parent | bsps: Move start files to bsps (diff) | |
download | rtems-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/erc32')
-rw-r--r-- | c/src/lib/libbsp/sparc/erc32/Makefile.am | 22 | ||||
-rw-r--r-- | c/src/lib/libbsp/sparc/erc32/startup/boardinit.S | 92 | ||||
-rw-r--r-- | c/src/lib/libbsp/sparc/erc32/startup/bsp_specs | 9 | ||||
-rw-r--r-- | c/src/lib/libbsp/sparc/erc32/startup/bspdelay.c | 25 | ||||
-rw-r--r-- | c/src/lib/libbsp/sparc/erc32/startup/bspidle.c | 27 | ||||
-rw-r--r-- | c/src/lib/libbsp/sparc/erc32/startup/erc32mec.c | 15 | ||||
-rw-r--r-- | c/src/lib/libbsp/sparc/erc32/startup/linkcmds | 29 | ||||
-rw-r--r-- | c/src/lib/libbsp/sparc/erc32/startup/setvec.c | 59 | ||||
-rw-r--r-- | c/src/lib/libbsp/sparc/erc32/startup/spurious.c | 194 |
9 files changed, 11 insertions, 461 deletions
diff --git a/c/src/lib/libbsp/sparc/erc32/Makefile.am b/c/src/lib/libbsp/sparc/erc32/Makefile.am index df9aefa8bb..3171e0b697 100644 --- a/c/src/lib/libbsp/sparc/erc32/Makefile.am +++ b/c/src/lib/libbsp/sparc/erc32/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/erc32/start/bsp_specs noinst_PROGRAMS = @@ -14,26 +14,26 @@ 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 += ../../../../../../bsps/sparc/shared/start/linkcmds.base project_lib_LIBRARIES = librtemsbsp.a librtemsbsp_a_SOURCES = # startup librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/bspfatal-default.c -librtemsbsp_a_SOURCES += ../shared/startup/bspgetworkarea.c +librtemsbsp_a_SOURCES += ../../../../../../bsps/sparc/shared/start/bspgetworkarea.c librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/bspreset-empty.c librtemsbsp_a_SOURCES += ../../../../../../bsps/sparc/erc32/start/bspstart.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/erc32mec.c -librtemsbsp_a_SOURCES += startup/boardinit.S -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/erc32/start/setvec.c +librtemsbsp_a_SOURCES += ../../../../../../bsps/sparc/erc32/start/spurious.c +librtemsbsp_a_SOURCES += ../../../../../../bsps/sparc/erc32/start/erc32mec.c +librtemsbsp_a_SOURCES += ../../../../../../bsps/sparc/erc32/start/boardinit.S +librtemsbsp_a_SOURCES += ../../../../../../bsps/sparc/erc32/start/bspidle.c +librtemsbsp_a_SOURCES += ../../../../../../bsps/sparc/erc32/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 librtemsbsp_a_SOURCES += ../shared/irq_asm.S diff --git a/c/src/lib/libbsp/sparc/erc32/startup/boardinit.S b/c/src/lib/libbsp/sparc/erc32/startup/boardinit.S deleted file mode 100644 index 9ced1c3639..0000000000 --- a/c/src/lib/libbsp/sparc/erc32/startup/boardinit.S +++ /dev/null @@ -1,92 +0,0 @@ -/** - * @file - * - * @ingroup sparc_erc32 - * - * @brief Initialise various ERC32 registers - */ - -/* - * COPYRIGHT (c) 2000. - * European Space Agency. - * - * 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 <rtems/asm.h> -#include <erc32.h> - - .global __bsp_board_init -__bsp_board_init: - -/* Check if MEC is initialised. If not, this means that we are - running on the simulator. Initiate some of the parameters - that are done by the boot-prom otherwise. -*/ - - set SYM(ERC32_MEC), %g3 ! g3 = base address of peripherals - ld [%g3], %g2 - set 0xfe080000, %g1 - andcc %g1, %g2, %g0 - bne 2f - - /* Stop the watchdog */ - - st %g0, [%g3 + SYM(ERC32_MEC_WATCHDOG_TRAP_DOOR_SET_OFFSET)] - - /* Set zero waitstates */ - - st %g0, [%g3 + SYM(ERC32_MEC_WAIT_STATE_CONFIGURATION_OFFSET)] - - /* Set the correct memory size in MEC memory config register */ - - set SYM(PROM_SIZE), %l0 - set 0, %l1 - srl %l0, 18, %l0 -1: - tst %l0 - srl %l0, 1, %l0 - bne,a 1b - inc %l1 - sll %l1, 8, %l1 - - set SYM(RAM_SIZE), %l0 - srl %l0, 19, %l0 -1: - tst %l0 - srl %l0, 1, %l0 - bne,a 1b - inc %l1 - sll %l1, 10, %l1 - - ! set the Memory Configuration - st %l1, [ %g3 + ERC32_MEC_MEMORY_CONFIGURATION_OFFSET ] - - set SYM(RAM_START), %l1 ! Cannot use RAM_END due to bug in linker - set SYM(RAM_SIZE), %l2 - add %l1, %l2, %sp - - set SYM(CLOCK_SPEED), %g6 ! Use 14 MHz in simulator - set 14, %g1 - st %g1, [%g6] - -2: - - /* Initialise timer */ - - set SYM(_ERC32_MEC_Timer_Control_Mirror), %l2 - st %g0, [%l2] - st %g0, [%g3 + SYM(ERC32_MEC_TIMER_CONTROL_OFFSET)] - - /* Enable power-down */ - - ld [%g3 + SYM(ERC32_MEC_CONTROL_OFFSET)], %l2 - or %l2, ERC32_CONFIGURATION_POWER_DOWN_ALLOWED, %l2 - st %l2, [%g3 + SYM(ERC32_MEC_CONTROL_OFFSET)] - - retl - nop - -/* end of file */ diff --git a/c/src/lib/libbsp/sparc/erc32/startup/bsp_specs b/c/src/lib/libbsp/sparc/erc32/startup/bsp_specs deleted file mode 100644 index 87638cc027..0000000000 --- a/c/src/lib/libbsp/sparc/erc32/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/erc32/startup/bspdelay.c b/c/src/lib/libbsp/sparc/erc32/startup/bspdelay.c deleted file mode 100644 index afd42cbd6f..0000000000 --- a/c/src/lib/libbsp/sparc/erc32/startup/bspdelay.c +++ /dev/null @@ -1,25 +0,0 @@ -/* - * ERC32 BSP Delay Method - */ - -/* - * COPYRIGHT (c) 1989-2014. - * 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 = ERC32_MEC.Real_Time_Clock_Counter; - then += usecs; - - while (ERC32_MEC.Real_Time_Clock_Counter >= then) - ; -} diff --git a/c/src/lib/libbsp/sparc/erc32/startup/bspidle.c b/c/src/lib/libbsp/sparc/erc32/startup/bspidle.c deleted file mode 100644 index 4b41625e84..0000000000 --- a/c/src/lib/libbsp/sparc/erc32/startup/bspidle.c +++ /dev/null @@ -1,27 +0,0 @@ -/* - * ERC32 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 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> - -void *bsp_idle_thread( uintptr_t ignored ) -{ - while (1) { - ERC32_MEC.Power_Down = 0; /* value is irrelevant */ - } - return NULL; -} diff --git a/c/src/lib/libbsp/sparc/erc32/startup/erc32mec.c b/c/src/lib/libbsp/sparc/erc32/startup/erc32mec.c deleted file mode 100644 index 7b0ccbd309..0000000000 --- a/c/src/lib/libbsp/sparc/erc32/startup/erc32mec.c +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Put this variable in a separate file so it is only linked in when needed. - * - * COPYRIGHT (c) 1989-2002. - * 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 <rtems.h> -#include <bsp.h> - -ERC32_Register_Map ERC32_MEC; diff --git a/c/src/lib/libbsp/sparc/erc32/startup/linkcmds b/c/src/lib/libbsp/sparc/erc32/startup/linkcmds deleted file mode 100644 index 9df3a0d94f..0000000000 --- a/c/src/lib/libbsp/sparc/erc32/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 : 0x02000000; - -/* - * Base address of the on-CPU peripherals - */ - -_ERC32_MEC = 0x01f80000; -ERC32_MEC = _ERC32_MEC; - -/* these are the maximum values */ - -MEMORY -{ - rom : ORIGIN = 0x00000000, LENGTH = 16 - ram : ORIGIN = 0x02000000, LENGTH = 32M -} - -ENTRY(start) - -INCLUDE linkcmds.base diff --git a/c/src/lib/libbsp/sparc/erc32/startup/setvec.c b/c/src/lib/libbsp/sparc/erc32/startup/setvec.c deleted file mode 100644 index d3aa8ed72f..0000000000 --- a/c/src/lib/libbsp/sparc/erc32/startup/setvec.c +++ /dev/null @@ -1,59 +0,0 @@ -/* 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-1999. - * 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> - -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 ( ERC32_Is_MEC_Trap( real_trap ) ) { - - source = ERC32_TRAP_SOURCE( real_trap ); - - ERC32_Clear_interrupt( source ); - ERC32_Unmask_interrupt( source ); - } - - return previous_isr; -} diff --git a/c/src/lib/libbsp/sparc/erc32/startup/spurious.c b/c/src/lib/libbsp/sparc/erc32/startup/spurious.c deleted file mode 100644 index b022f96f5c..0000000000 --- a/c/src/lib/libbsp/sparc/erc32/startup/spurious.c +++ /dev/null @@ -1,194 +0,0 @@ -/* - * ERC32 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 ERC32 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%08" PRIx32 "\n", - ERC32_MEC.First_Failing_Address ); - break; - case 0x0A: - printk( "tag overflow\n" ); - break; - - /* - * Then the ones defined by the ERC32 in particular - */ - - case ERC32_TRAP_TYPE( ERC32_INTERRUPT_MASKED_ERRORS ): - printk( "ERC32_INTERRUPT_MASKED_ERRORS\n" ); - break; - case ERC32_TRAP_TYPE( ERC32_INTERRUPT_EXTERNAL_1 ): - printk( "ERC32_INTERRUPT_EXTERNAL_1\n" ); - break; - case ERC32_TRAP_TYPE( ERC32_INTERRUPT_EXTERNAL_2 ): - printk( "ERC32_INTERRUPT_EXTERNAL_2\n" ); - break; - case ERC32_TRAP_TYPE( ERC32_INTERRUPT_UART_A_RX_TX ): - printk( "ERC32_INTERRUPT_UART_A_RX_TX\n" ); - break; - case ERC32_TRAP_TYPE( ERC32_INTERRUPT_UART_B_RX_TX ): - printk( "ERC32_INTERRUPT_UART_A_RX_TX\n" ); - break; - case ERC32_TRAP_TYPE( ERC32_INTERRUPT_CORRECTABLE_MEMORY_ERROR ): - printk( "ERC32_INTERRUPT_CORRECTABLE_MEMORY_ERROR\n" ); - break; - case ERC32_TRAP_TYPE( ERC32_INTERRUPT_UART_ERROR ): - printk( "ERC32_INTERRUPT_UART_ERROR\n" ); - break; - case ERC32_TRAP_TYPE( ERC32_INTERRUPT_DMA_ACCESS_ERROR ): - printk( "ERC32_INTERRUPT_DMA_ACCESS_ERROR\n" ); - break; - case ERC32_TRAP_TYPE( ERC32_INTERRUPT_DMA_TIMEOUT ): - printk( "ERC32_INTERRUPT_DMA_TIMEOUT\n" ); - break; - case ERC32_TRAP_TYPE( ERC32_INTERRUPT_EXTERNAL_3 ): - printk( "ERC32_INTERRUPT_EXTERNAL_3\n" ); - break; - case ERC32_TRAP_TYPE( ERC32_INTERRUPT_EXTERNAL_4 ): - printk( "ERC32_INTERRUPT_EXTERNAL_4\n" ); - break; - case ERC32_TRAP_TYPE( ERC32_INTERRUPT_GENERAL_PURPOSE_TIMER ): - printk( "ERC32_INTERRUPT_GENERAL_PURPOSE_TIMER\n" ); - break; - case ERC32_TRAP_TYPE( ERC32_INTERRUPT_REAL_TIME_CLOCK ): - printk( "ERC32_INTERRUPT_REAL_TIME_CLOCK\n" ); - break; - case ERC32_TRAP_TYPE( ERC32_INTERRUPT_EXTERNAL_5 ): - printk( "ERC32_INTERRUPT_EXTERNAL_5\n" ); - break; - case ERC32_TRAP_TYPE( ERC32_INTERRUPT_WATCHDOG_TIMEOUT ): - printk( "ERC32_INTERRUPT_WATCHDOG_TIMEOUT\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 = 15; - uint32_t mask; - - level = sparc_disable_interrupts(); - mask = ERC32_MEC.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 ); - } - - ERC32_MEC.Interrupt_Mask = mask; - sparc_enable_interrupts(level); - -} |