diff options
author | Jay Monkman <jtm@smoothsmoothie.com> | 2005-02-25 05:18:07 +0000 |
---|---|---|
committer | Jay Monkman <jtm@smoothsmoothie.com> | 2005-02-25 05:18:07 +0000 |
commit | 7cde240ce85e3f5ffd69e970e36dd722a87c02c5 (patch) | |
tree | bf10fa3feefe87805981929c5a05a6a66c86567b /c/src/lib/libbsp/mips/csb350/startup | |
parent | 2005-02-24 Jay Monkman (diff) | |
download | rtems-7cde240ce85e3f5ffd69e970e36dd722a87c02c5.tar.bz2 |
2005-02-24 Jay Monkman <jtm@lopingdog.com>
* acinclude.m4: Added csb350 to list of BSPs.
* csb350/Makefile.am, csb350/README, csb350/bsp_specs,
csb350/configure.ac, csb350/times, csb350/clock/clockdrv.c,
csb350/console/console-io.c, csb350/include/bsp.h,
csb350/include/tm27.h, csb350/network/network.c, csb350/start/regs.S,
csb350/start/start.S, csb350/startup/bspclean.c,
csb350/startup/bspstart.c, csb350/startup/linkcmds,
csb350/timer/timer.c: New BSP.
Diffstat (limited to 'c/src/lib/libbsp/mips/csb350/startup')
-rw-r--r-- | c/src/lib/libbsp/mips/csb350/startup/bspclean.c | 30 | ||||
-rw-r--r-- | c/src/lib/libbsp/mips/csb350/startup/bspstart.c | 128 | ||||
-rw-r--r-- | c/src/lib/libbsp/mips/csb350/startup/linkcmds | 212 |
3 files changed, 370 insertions, 0 deletions
diff --git a/c/src/lib/libbsp/mips/csb350/startup/bspclean.c b/c/src/lib/libbsp/mips/csb350/startup/bspclean.c new file mode 100644 index 0000000000..783c60f92c --- /dev/null +++ b/c/src/lib/libbsp/mips/csb350/startup/bspclean.c @@ -0,0 +1,30 @@ +/* + * 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.OARcorp.com/rtems/license.html. + * + * $Id$ + */ +#include <rtems.h> +#include <libcpu/au1x00.h> + +void bsp_cleanup( void ) +{ + void (*reset_func)(void); + + reset_func = (void *)0xbfc00000; + + mips_set_sr( 0x00200000 ); /* all interrupts off, boot exception vectors */ + + printk("\nEXECUTIVE SHUTDOWN! Any key to reboot..."); + while (console_inbyte_nonblocking(0) < 0) { + continue; + } + + /* Try to restart bootloader */ + reset_func(); + +} diff --git a/c/src/lib/libbsp/mips/csb350/startup/bspstart.c b/c/src/lib/libbsp/mips/csb350/startup/bspstart.c new file mode 100644 index 0000000000..d17cf943b0 --- /dev/null +++ b/c/src/lib/libbsp/mips/csb350/startup/bspstart.c @@ -0,0 +1,128 @@ +/* + * This routine starts the application. It includes application, + * board, and monitor specific initialization and configuration. + * The generic CPU dependent initialization has been performed + * before this routine is invoked. + * + * COPYRIGHT (c) 1989-2000. + * 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.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include <string.h> + +#include <bsp.h> +#include <libcpu/au1x00.h> +#include <rtems/libio.h> +#include <rtems/libcsupport.h> + +/* + * The original table from the application and our copy of it with + * some changes. + */ + +extern void *_sdram_size; +extern void *_sdram_base; +extern void *_bss_free_start; + +unsigned long free_mem_start; +unsigned long free_mem_end; + +extern rtems_configuration_table Configuration; + +rtems_configuration_table BSP_Configuration; + +rtems_cpu_table Cpu_table; + +char *rtems_progname; + +au1x00_uart_t *uart0 = (au1x00_uart_t *)AU1X00_UART0_ADDR; +au1x00_uart_t *uart3 = (au1x00_uart_t *)AU1X00_UART3_ADDR; + +/* + * Use the shared implementations of the following routines + */ + +void bsp_postdriver_hook(void); +void bsp_libc_init( void *, unsigned32, int ); + +/* + * Function: bsp_pretasking_hook + * Created: 95/03/10 + * + * Description: + * BSP pretasking hook. Called just before drivers are initialized. + * Used to setup libc and install any BSP extensions. + * + * NOTES: + * Must not use libc (to do io) from here, since drivers are + * not yet initialized. + * + */ + +void bsp_pretasking_hook(void) +{ + unsigned32 heap_start; + unsigned32 heap_size; + + /* + * Set up the heap. + */ + heap_start = free_mem_start; + heap_size = free_mem_end - free_mem_start; + + /* call rtems lib init - malloc stuff */ + bsp_libc_init((void *)heap_start, heap_size, 0); + +#ifdef RTEMS_DEBUG + rtems_debug_enable( RTEMS_DEBUG_ALL_MASK ); +#endif + +} + +/* + * bsp_start + * + * This routine does the bulk of the system initialization. + */ + +void bsp_start( void ) +{ + extern void mips_install_isr_entries(void); + unsigned int compare = 0; + /* Configure Number of Register Caches */ + + Cpu_table.pretasking_hook = bsp_pretasking_hook; /* init libc, etc. */ + Cpu_table.postdriver_hook = bsp_postdriver_hook; + Cpu_table.interrupt_stack_size = 8192; + + /* Place RTEMS workspace at beginning of free memory. */ + BSP_Configuration.work_space_start = (void *)&_bss_free_start; + + free_mem_start = ((unsigned32)&_bss_free_start + + BSP_Configuration.work_space_size); + + free_mem_end = ((unsigned32)&_sdram_base + (unsigned32)&_sdram_size); + + mips_set_sr( 0x7f00 ); /* all interrupts unmasked but globally off */ + /* depend on the IRC to take care of things */ + asm volatile ("mtc0 %0, $11\n" :: "r" (compare)); + mips_install_isr_entries(); +} + + +/* These replace the ones in newlib. I'm not sure why the newlib ones + * don't work. + */ +void _init(void) +{ +} + +void _fini(void) +{ +} diff --git a/c/src/lib/libbsp/mips/csb350/startup/linkcmds b/c/src/lib/libbsp/mips/csb350/startup/linkcmds new file mode 100644 index 0000000000..4d598a2684 --- /dev/null +++ b/c/src/lib/libbsp/mips/csb350/startup/linkcmds @@ -0,0 +1,212 @@ +/* + * Linker script for CSB350 AU1100 based board + * + * $Id$ + */ + +/* . = 0x80020000; */ + +/* + * Declare some sizes. + */ + +_StackSize = DEFINED(_StackSize) ? _StackSize : 0x4000; + +_sdram_base = DEFINED(_sdram_base) ? _sdram_base : 0x80400000; +_sdram_size = DEFINED(_sdram_size) ? _sdram_size : 12M; + + +MEMORY +{ + ram : ORIGIN = 0x80400000, LENGTH = 4M +} + +SECTIONS +{ + .text : + { + _ftext = . ; + + */start.o(.text) + + *(.text) + *(.text.*) + *(.gnu.linkonce.t*) + *(.mips16.fn.*) + *(.mips16.call.*) + PROVIDE (__runtime_reloc_start = .); + *(.rel.sdata) + *(.rel.dyn) + PROVIDE (__runtime_reloc_stop = .); + + /* + * Special FreeBSD sysctl sections. + */ + . = ALIGN (16); + __start_set_sysctl_set = .; + *(set_sysctl_*); + __stop_set_sysctl_set = ABSOLUTE(.); + *(set_domain_*); + *(set_pseudo_*); + + *(.gcc_except_table) + *(.eh_frame_hdr) + *(.eh_frame) + } >ram + + .init : + { + KEEP(*(.init)) + + } > ram + + .fini : + { + KEEP(*(.fini)) + + } >ram + + + .ctors : + { + /* 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)) + + /* We don't want to include the .ctor section from + 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) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + } >ram + + .dtors : + { + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + + etext = .; + _etext = .; + } >ram + + + + .rdata : + { + *(.rdata) + *(.rodata) + *(.rodata.*) + *(.gnu.linkonce.r*) + } >ram + + .data : + { + _fdata = ALIGN(16); + + *(.data) + *(.data.*) + *(.gnu.linkonce.d*) + } >ram + + .jcr : + { + . = ALIGN(8); + KEEP (*(.jcr)) + + _gp = ALIGN(16) + 0x7440; + __global = _gp; + } >ram + + .lit8 : + { + *(.lit8) + } >ram + + .lit4 : + { + *(.lit4) + } >ram + + .sdata : + { + *(.sdata) + *(.sdata.*) + *(.gnu.linkonce.s*) + } >ram + + .sbss : + { + edata = .; + _edata = .; + _fbss = .; + *(.sbss) + *(.scommon) + } >ram + + + .bss : + { + _bss_start = . ; + *(.bss) + *(.reginfo) + *(COMMON) + . = ALIGN (64); + _stack_limit = .; + . += _StackSize; + __stack = .; + _stack_init = .; + _clear_end = .; + end = .; + _end = .; + . = ALIGN (1024); + _bss_free_start = .; + + } >ram + + +/* +** DWARF debug sections. +** Symbols in the DWARF debugging sections are relative to +** the beginning of the section so we begin them at 0. +*/ + + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame)} + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } +} |