From f86582c8148b1046a8a2cdf366db03bb63f8b047 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Fri, 11 May 2001 16:51:25 +0000 Subject: 2001-05-10 Ralf Corsepius * configure.in: Use RTEMS_PROG_CC_FOR_TARGET([-ansi -fasm]), adapt bspopts.h handling to other sh-BSPs. * include/.cvsignore: Add stamp-h*, bspopts.h*. * include/Makefile.am: Use include_HEADERS instead of H_FILES. * startup/bspstart.c: Reworked, based on the amos BSP. --- c/src/lib/libbsp/sh/shsim/ChangeLog | 8 ++ c/src/lib/libbsp/sh/shsim/configure.in | 9 ++- c/src/lib/libbsp/sh/shsim/include/Makefile.am | 25 +++---- c/src/lib/libbsp/sh/shsim/startup/Makefile.am | 6 +- c/src/lib/libbsp/sh/shsim/startup/bspstart.c | 101 ++++++++++++++------------ 5 files changed, 81 insertions(+), 68 deletions(-) (limited to 'c/src/lib/libbsp/sh/shsim') diff --git a/c/src/lib/libbsp/sh/shsim/ChangeLog b/c/src/lib/libbsp/sh/shsim/ChangeLog index 51dd0081d3..ac83affef0 100644 --- a/c/src/lib/libbsp/sh/shsim/ChangeLog +++ b/c/src/lib/libbsp/sh/shsim/ChangeLog @@ -1,3 +1,11 @@ +2001-05-10 Ralf Corsepius + + * configure.in: Use RTEMS_PROG_CC_FOR_TARGET([-ansi -fasm]), adapt + bspopts.h handling to other sh-BSPs. + * include/.cvsignore: Add stamp-h*, bspopts.h*. + * include/Makefile.am: Use include_HEADERS instead of H_FILES. + * startup/bspstart.c: Reworked, based on the amos BSP. + 2001-05-09 Ralf Corsepius * scitab/.cvsignore: Add. diff --git a/c/src/lib/libbsp/sh/shsim/configure.in b/c/src/lib/libbsp/sh/shsim/configure.in index b1bee213ce..1e2eaf60be 100644 --- a/c/src/lib/libbsp/sh/shsim/configure.in +++ b/c/src/lib/libbsp/sh/shsim/configure.in @@ -11,7 +11,7 @@ RTEMS_CANONICAL_TARGET_CPU AM_INIT_AUTOMAKE(rtems-c-src-lib-libbsp-sh-shsim,$RTEMS_VERSION,no) AM_MAINTAINER_MODE -RTEMS_PROG_CC_FOR_TARGET +RTEMS_PROG_CC_FOR_TARGET([-ansi -fasm]) RTEMS_CANONICALIZE_TOOLS RTEMS_ENV_RTEMSBSP @@ -60,17 +60,18 @@ AC_DEFINE_UNQUOTED( [whether support for functional IOMEM in shsim/gdb shall be enabled]) fi -## setup environment variable +## bsp-specific options CPU_CLOCK_RATE_HZ=${CPU_CLOCK_RATE_HZ-20000000} AC_SUBST(CPU_CLOCK_RATE_HZ) -## Propagate option to config header AC_DEFINE_UNQUOTED( [CPU_CLOCK_RATE_HZ], [$CPU_CLOCK_RATE_HZ], [cpu clock rate in HZ]) -AM_CONFIG_HEADER(include/bspopts.h) +## Used in scitab/Makefile.am +AC_SUBST(CPU_CLOCK_RATE_HZ) +AM_CONFIG_HEADER(include/bspopts.h) RTEMS_PROJECT_ROOT # Explicitly list all Makefiles here diff --git a/c/src/lib/libbsp/sh/shsim/include/Makefile.am b/c/src/lib/libbsp/sh/shsim/include/Makefile.am index 48b2bb0130..328f7d6b5b 100644 --- a/c/src/lib/libbsp/sh/shsim/include/Makefile.am +++ b/c/src/lib/libbsp/sh/shsim/include/Makefile.am @@ -4,29 +4,22 @@ AUTOMAKE_OPTIONS = foreign 1.4 -H_FILES = bsp.h gdbsci.h ../../../shared/include/coverhd.h +include_HEADERS = bsp.h gdbsci.h coverhd.h bspopts.h -$(PROJECT_INCLUDE): - $(mkinstalldirs) $@ - -$(PROJECT_INCLUDE)/bsp.h: bsp.h - $(INSTALL_DATA) $< $@ +coverhd.h: $(top_srcdir)/../../shared/include/coverhd.h + cp $< $@ -$(PROJECT_INCLUDE)/bspopts.h: bspopts.h - $(INSTALL_DATA) $< $@ +CLEANFILES += coverhd.h -$(PROJECT_INCLUDE)/sh/gdbsci.h: gdbsci.h - $(INSTALL_DATA) $< $@ +$(PROJECT_INCLUDE): + $(mkinstalldirs) $@ -$(PROJECT_INCLUDE)/coverhd.h: ../../../shared/include/coverhd.h +$(PROJECT_INCLUDE)/%.h: %.h $(INSTALL_DATA) $< $@ -TMPINSTALL_FILES += $(PROJECT_INCLUDE) $(PROJECT_INCLUDE)/bsp.h \ - $(PROJECT_INCLUDE)/coverhd.h $(PROJECT_INCLUDE)/sh/gdbsci.h \ - $(PROJECT_INCLUDE)/bspopts.h +PREINSTALL_FILES += $(PROJECT_INCLUDE) \ + $(include_HEADERS:%=$(PROJECT_INCLUDE)/%) all-local: $(TMPINSTALL_FILES) -EXTRA_DIST = bsp.h - include $(top_srcdir)/../../../../../../automake/local.am diff --git a/c/src/lib/libbsp/sh/shsim/startup/Makefile.am b/c/src/lib/libbsp/sh/shsim/startup/Makefile.am index 4dd270fbea..95d1a2a31e 100644 --- a/c/src/lib/libbsp/sh/shsim/startup/Makefile.am +++ b/c/src/lib/libbsp/sh/shsim/startup/Makefile.am @@ -4,11 +4,11 @@ AUTOMAKE_OPTIONS = foreign 1.4 -VPATH = @srcdir@:@srcdir@/../../../shared +VPATH = @srcdir@:@srcdir@/../../shared:@srcdir@/../../../shared PGM = $(ARCH)/startup.rel -C_FILES = bspclean.c bsplibc.c bsppost.c bspstart.c bootcard.c main.c sbrk.c \ +C_FILES = bsplibc.c bsppost.c bspstart.c bspclean.c sbrk.c bootcard.c main.c \ gnatinstallhandler.c C_O_FILES = $(C_FILES:%.c=$(ARCH)/%.o) @@ -35,6 +35,6 @@ all-local: $(ARCH) $(OBJS) $(PGM) $(TMPINSTALL_FILES) .PRECIOUS: $(PGM) -EXTRA_DIST = bspclean.c bspstart.c exit.c linkcmds setvec.c +EXTRA_DIST = bspstart.c linkcmds include $(top_srcdir)/../../../../../../automake/local.am diff --git a/c/src/lib/libbsp/sh/shsim/startup/bspstart.c b/c/src/lib/libbsp/sh/shsim/startup/bspstart.c index 1143386ada..39ce17834e 100644 --- a/c/src/lib/libbsp/sh/shsim/startup/bspstart.c +++ b/c/src/lib/libbsp/sh/shsim/startup/bspstart.c @@ -4,7 +4,14 @@ * The generic CPU dependent initialization has been performed * before this routine is invoked. * - * COPYRIGHT (c) 1989-2000. + * COPYRIGHT (c) 2001. + * Ralf Corsepius (corsepiu@faw.uni-ulm.de). + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * COPYRIGHT (c) 2001. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -42,7 +49,6 @@ 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. @@ -56,20 +62,13 @@ void bsp_libc_init( void *, unsigned32, int ); void bsp_pretasking_hook(void) { - extern int HeapBase; - extern int HeapSize; - void *heapStart = &HeapBase; - unsigned long heapSize = (unsigned long)&HeapSize; - unsigned long ramSpace; - - bsp_libc_init(heapStart, (unsigned32) heapSize, 0); - + bsp_libc_init(&HeapStart, sizeof(unsigned32) * (&HeapEnd - &HeapStart), 0); + #ifdef RTEMS_DEBUG rtems_debug_enable( RTEMS_DEBUG_ALL_MASK ); #endif - } - + /* * bsp_start * @@ -78,40 +77,52 @@ void bsp_pretasking_hook(void) void bsp_start( void ) { - extern int _end; - extern int WorkspaceBase; - /* Configure Number of Register Caches */ + /* + For real boards you need to setup the hardware + and need to copy the vector table from rom to ram. + + Depending on the board this can either be done from inside the rom + startup code, rtems startup code or here. + */ + + /* + * Allocate the memory for the RTEMS Work Space. This can come from + * a variety of places: hard coded address, malloc'ed from outside + * RTEMS world (e.g. simulator or primitive memory manager), or (as + * typically done by stock BSPs) by subtracting the required amount + * of work space from the last physical address on the CPU board. + */ + + /* + * Need to "allocate" the memory for the RTEMS Workspace and + * tell the RTEMS configuration where it is. This memory is + * not malloc'ed. It is just "pulled from the air". + */ + + BSP_Configuration.work_space_start = (void *) &WorkSpaceStart ; + BSP_Configuration.work_space_size = + (unsigned32) &WorkSpaceEnd - + (unsigned32) &WorkSpaceStart ; + + /* + * initialize the CPU table for this BSP + */ + +#if ( CPU_ALLOCATE_INTERRUPT_STACK == FALSE ) + _CPU_Interrupt_stack_low = &CPU_Interrupt_stack_low ; + _CPU_Interrupt_stack_high = &CPU_Interrupt_stack_high ; + + Cpu_table.interrupt_stack_size = + (unsigned32) (&CPU_Interrupt_stack_high) - + (unsigned32) (&CPU_Interrupt_stack_low) ; +#endif + Cpu_table.pretasking_hook = bsp_pretasking_hook; /* init libc, etc. */ Cpu_table.postdriver_hook = bsp_postdriver_hook; - Cpu_table.interrupt_stack_size = 4096; - - if ( BSP_Configuration.work_space_size >(512*1024) ) - _sys_exit( 1 ); - - BSP_Configuration.work_space_start = (void *) &WorkspaceBase; -} - -/* XXX */ -void clear_cache( void *address, size_t n ) -{ -} - -/* Structure filled in by get_mem_info. Only the size field is - actually used (to clear bss), so the others aren't even filled in. */ - -struct s_mem -{ - unsigned int size; - unsigned int icsize; - unsigned int dcsize; -}; - - -void -get_mem_info (mem) - struct s_mem *mem; -{ - mem->size = 0x1000000; /* XXX figure out something here */ + +#if ( CPU_ALLOCATE_INTERRUPT_STACK == TRUE ) + Cpu_table.interrupt_stack_size = CONFIGURE_INTERRUPT_STACK_MEMORY; +#endif + Cpu_table.clicks_per_second = CPU_CLOCK_RATE_HZ ; } - -- cgit v1.2.3