From b6394ae43432a3c69f1737d1ed1e23db8e7896ba Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Wed, 15 Apr 1998 15:13:01 +0000 Subject: Transitioned to shared bsp_libc_init() and cleaned up comments. --- c/src/lib/libbsp/a29k/portsw/startup/Makefile.in | 2 +- c/src/lib/libbsp/a29k/portsw/startup/bspstart.c | 85 +++++-------- .../lib/libbsp/hppa1.1/simhppa/startup/Makefile.in | 2 +- .../lib/libbsp/hppa1.1/simhppa/startup/bspstart.c | 135 +++------------------ c/src/lib/libbsp/i386/force386/startup/Makefile.in | 2 +- c/src/lib/libbsp/i386/force386/startup/bspstart.c | 63 +++------- c/src/lib/libbsp/i386/go32/startup/Makefile.in | 2 +- c/src/lib/libbsp/i386/go32/startup/bspstart.c | 73 ++++------- c/src/lib/libbsp/i386/i386ex/startup/Makefile.in | 2 +- c/src/lib/libbsp/i386/i386ex/startup/bspstart.c | 66 ++++------ c/src/lib/libbsp/i386/pc386/startup/Makefile.in | 2 +- c/src/lib/libbsp/i386/pc386/startup/bspstart.c | 51 ++------ c/src/lib/libbsp/i960/cvme961/startup/Makefile.in | 2 +- c/src/lib/libbsp/i960/cvme961/startup/bspstart.c | 62 +++------- c/src/lib/libbsp/m68k/dmv152/startup/Makefile.in | 2 +- c/src/lib/libbsp/m68k/dmv152/startup/bspstart.c | 62 +++------- c/src/lib/libbsp/m68k/efi332/startup/Makefile.in | 2 +- c/src/lib/libbsp/m68k/efi332/startup/bspstart.c | 77 ++++-------- c/src/lib/libbsp/m68k/efi68k/startup/Makefile.in | 2 +- c/src/lib/libbsp/m68k/efi68k/startup/bspstart.c | 78 ++++-------- c/src/lib/libbsp/m68k/gen68302/startup/Makefile.in | 2 +- c/src/lib/libbsp/m68k/gen68302/startup/bspstart.c | 71 +++-------- c/src/lib/libbsp/m68k/gen68360/startup/Makefile.in | 2 +- c/src/lib/libbsp/m68k/gen68360/startup/bspstart.c | 61 +++------- c/src/lib/libbsp/m68k/idp/startup/Makefile.in | 2 +- c/src/lib/libbsp/m68k/idp/startup/bspstart.c | 62 +++------- c/src/lib/libbsp/m68k/mvme136/startup/Makefile.in | 2 +- c/src/lib/libbsp/m68k/mvme136/startup/bspstart.c | 64 +++------- c/src/lib/libbsp/m68k/mvme147/startup/Makefile.in | 2 +- c/src/lib/libbsp/m68k/mvme147/startup/bspstart.c | 64 +++------- c/src/lib/libbsp/m68k/mvme147s/startup/Makefile.in | 2 +- c/src/lib/libbsp/m68k/mvme147s/startup/bspstart.c | 63 +++------- c/src/lib/libbsp/m68k/mvme162/startup/Makefile.in | 2 +- c/src/lib/libbsp/m68k/mvme162/startup/bspstart.c | 63 +++------- c/src/lib/libbsp/m68k/ods68302/startup/Makefile.in | 2 +- c/src/lib/libbsp/m68k/ods68302/startup/bspstart.c | 69 +++-------- c/src/lib/libbsp/mips/p4000/startup/bspstart.c | 78 ++++-------- .../libbsp/mips64orion/p4000/startup/Makefile.in | 2 +- .../libbsp/mips64orion/p4000/startup/bspstart.c | 78 ++++-------- c/src/lib/libbsp/no_cpu/no_bsp/startup/Makefile.in | 2 +- c/src/lib/libbsp/no_cpu/no_bsp/startup/bspstart.c | 71 +++-------- .../lib/libbsp/powerpc/papyrus/startup/Makefile.in | 2 +- .../lib/libbsp/powerpc/papyrus/startup/bspstart.c | 70 +++-------- c/src/lib/libbsp/powerpc/psim/clock/clock.c | 10 +- c/src/lib/libbsp/powerpc/psim/include/bsp.h | 10 +- c/src/lib/libbsp/powerpc/psim/include/coverhd.h | 10 +- c/src/lib/libbsp/powerpc/psim/shmsupp/README | 3 +- c/src/lib/libbsp/powerpc/psim/shmsupp/addrconv.c | 6 +- c/src/lib/libbsp/powerpc/psim/shmsupp/getcfg.c | 6 +- c/src/lib/libbsp/powerpc/psim/startup/Makefile.in | 2 +- c/src/lib/libbsp/powerpc/psim/startup/bspstart.c | 73 ++++------- c/src/lib/libbsp/powerpc/psim/startup/linkcmds | 13 ++ c/src/lib/libbsp/powerpc/psim/startup/setvec.c | 10 +- c/src/lib/libbsp/powerpc/psim/timer/timer.c | 10 +- c/src/lib/libbsp/powerpc/psim/tools/psim | 8 ++ c/src/lib/libbsp/powerpc/psim/tools/runtest | 12 +- c/src/lib/libbsp/powerpc/psim/vectors/vectors.s | 13 +- c/src/lib/libbsp/sh/gensh1/startup/Makefile.in | 2 +- c/src/lib/libbsp/sh/gensh1/startup/bspstart.c | 56 ++------- c/src/lib/libbsp/sparc/erc32/startup/Makefile.in | 2 +- c/src/lib/libbsp/sparc/erc32/startup/bspstart.c | 66 +++------- c/src/lib/libbsp/unix/posix/startup/Makefile.in | 2 +- c/src/lib/libbsp/unix/posix/startup/bspstart.c | 117 ++++-------------- 63 files changed, 604 insertions(+), 1435 deletions(-) (limited to 'c/src/lib/libbsp') diff --git a/c/src/lib/libbsp/a29k/portsw/startup/Makefile.in b/c/src/lib/libbsp/a29k/portsw/startup/Makefile.in index 2635132eee..2be725234c 100644 --- a/c/src/lib/libbsp/a29k/portsw/startup/Makefile.in +++ b/c/src/lib/libbsp/a29k/portsw/startup/Makefile.in @@ -11,7 +11,7 @@ PROJECT_ROOT = @PROJECT_ROOT@ PGM=${ARCH}/startup.rel # C source names, if any, go here -- minus the .c -C_PIECES=bspclean bsppost bspstart main sbrk setvec iface +C_PIECES=bspclean bsplibc bsppost bspstart main sbrk setvec iface C_FILES=$(C_PIECES:%=%.c) C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) diff --git a/c/src/lib/libbsp/a29k/portsw/startup/bspstart.c b/c/src/lib/libbsp/a29k/portsw/startup/bspstart.c index 0032c417e1..6c5f396f39 100644 --- a/c/src/lib/libbsp/a29k/portsw/startup/bspstart.c +++ b/c/src/lib/libbsp/a29k/portsw/startup/bspstart.c @@ -1,14 +1,9 @@ -/* bsp_start() - * +/* * 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. * - * INPUT: NONE - * - * OUTPUT: NONE - * * COPYRIGHT (c) 1989-1998. * On-Line Applications Research Corporation (OAR). * Copyright assigned to U.S. Government, 1994. @@ -53,49 +48,12 @@ char *rtems_progname; rtems_unsigned32 heap_size = 0; rtems_unsigned32 heap_start; -void bsp_libc_init() -{ - heap_size = 2 * 1024 * 1024; /* allocate a maximum of 2 megabytes for the heap */ - - /* allocate all remaining memory to the heap */ - do { - heap_size -= HEAP_BLOCK_SIZE; - heap_start = _sysalloc( heap_size ); - } while ( !heap_start ); - - if (!heap_start) - rtems_fatal_error_occurred( heap_size ); - - if (heap_start & (CPU_ALIGNMENT-1)) - heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); - - /* - * The last parameter to RTEMS_Malloc_Initialize is the "chunk" - * size which a multiple of will be requested on each sbrk() - * call by malloc(). A value of 0 indicates that sbrk() should - * not be called to extend the heap. - */ - - RTEMS_Malloc_Initialize((void *) heap_start, heap_size, 0); - - /* - * Init the RTEMS libio facility to provide UNIX-like system - * calls for use by newlib (ie: provide __rtems_open, __rtems_close, etc) - * Uses malloc() to get area for the iops, so must be after malloc init - */ - - rtems_libio_init(); - - /* - * Set up for the libc handling. - */ - - if (BSP_Configuration.ticks_per_timeslice > 0) - libc_init(1); /* reentrant if possible */ - else - libc_init(0); /* non-reentrant */ - -} +/* + * Use the shared implementations of the following routines + */ + +void bsp_postdriver_hook(void); +void bsp_libc_init( void *, unsigned32, int ); /* * Function: bsp_pretasking_hook @@ -111,22 +69,37 @@ void bsp_libc_init() * */ -void -bsp_pretasking_hook(void) +void bsp_pretasking_hook(void) { - bsp_libc_init(); + /* allocate a maximum of 2 megabytes for the heap */ + heap_size = 2 * 1024 * 1024; + + /* allocate all remaining memory to the heap */ + do { + heap_size -= HEAP_BLOCK_SIZE; + heap_start = _sysalloc( heap_size ); + } while ( !heap_start ); + + if (!heap_start) + rtems_fatal_error_occurred( heap_size ); + + if (heap_start & (CPU_ALIGNMENT-1)) + heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); + + + bsp_libc_init((void *) heap_start, heap_size, 0); + #ifdef RTEMS_DEBUG rtems_debug_enable( RTEMS_DEBUG_ALL_MASK ); #endif } - /* - * Use the shared bsp_postdriver_hook() implementation + * bsp_start + * + * This routine does the bulk of the system initialization. */ - -void bsp_postdriver_hook(void); int bsp_start( int argc, diff --git a/c/src/lib/libbsp/hppa1.1/simhppa/startup/Makefile.in b/c/src/lib/libbsp/hppa1.1/simhppa/startup/Makefile.in index 05f8abd940..240cf38e4b 100644 --- a/c/src/lib/libbsp/hppa1.1/simhppa/startup/Makefile.in +++ b/c/src/lib/libbsp/hppa1.1/simhppa/startup/Makefile.in @@ -11,7 +11,7 @@ PROJECT_ROOT = @PROJECT_ROOT@ PGM=${ARCH}/startup.rel # C source names, if any, go here -- minus the .c -C_PIECES=bspclean bsppost bspstart main sbrk setvec +C_PIECES=bspclean bsplibc bsppost bspstart main sbrk setvec C_FILES=$(C_PIECES:%=%.c) C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) diff --git a/c/src/lib/libbsp/hppa1.1/simhppa/startup/bspstart.c b/c/src/lib/libbsp/hppa1.1/simhppa/startup/bspstart.c index 8676be3ba6..a84f967504 100644 --- a/c/src/lib/libbsp/hppa1.1/simhppa/startup/bspstart.c +++ b/c/src/lib/libbsp/hppa1.1/simhppa/startup/bspstart.c @@ -1,16 +1,9 @@ -/* bsp_start() - * +/* * 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. * - * Called by RTEMS::RTEMS constructor in startup-ctor.cc - * - * INPUT: NONE - * - * OUTPUT: NONE - * * COPYRIGHT (c) 1989-1998. * On-Line Applications Research Corporation (OAR). * Copyright assigned to U.S. Government, 1994. @@ -56,9 +49,10 @@ rtems_unsigned32 CPU_HPPA_CLICKS_PER_TICK; * Try to speed those tests up by speeding up the clock when in idle */ -rtems_extension -fast_idle_switch_hook(rtems_tcb *current_task, - rtems_tcb *heir_task) +rtems_extension fast_idle_switch_hook( + rtems_tcb *current_task, + rtems_tcb *heir_task +) { static rtems_unsigned32 normal_clock = ~0; static rtems_unsigned32 fast_clock; @@ -86,32 +80,26 @@ fast_idle_switch_hook(rtems_tcb *current_task, #endif /* - * Function: bsp_libc_init - * Created: 94/12/6 + * 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: - * Initialize whatever libc we are using - * called from bsp_postdriver_hook - * - * - * Parameters: - * none - * - * Returns: - * none. - * - * Side Effects: - * + * BSP pretasking hook. Called just before drivers are initialized. + * Used to setup libc and install any BSP extensions. * * Notes: - * - * Deficiencies/ToDo: - * - * + * Must not use libc (to do io) from here, since drivers are + * not yet initialized. */ -void -bsp_libc_init(void) +void bsp_pretasking_hook(void) { extern int end; rtems_unsigned32 heap_start; @@ -120,25 +108,7 @@ bsp_libc_init(void) if (heap_start & (CPU_ALIGNMENT-1)) heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); - RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0); - - /* - * Init the RTEMS libio facility to provide UNIX-like system - * calls for use by newlib (ie: provide __rtems_open, __rtems_close, etc) - * Uses malloc() to get area for the iops, so must be after malloc init - */ - - rtems_libio_init(); - - /* - * Set up for the libc handling. - * XXX; this should allow for case of some other non-clock interrupts - */ - - if (BSP_Configuration.ticks_per_timeslice > 0) - libc_init(1); /* reentrant if possible */ - else - libc_init(0); /* non-reentrant */ + bsp_libc_init((void *) heap_start, 64 * 1024, 0); /* * on MP systems, always use the print buffer @@ -151,39 +121,6 @@ bsp_libc_init(void) #ifdef SIMHPPA_ROM use_print_buffer = 1; #endif -} - - -/* - * 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. - * - * Parameters: - * none - * - * Returns: - * nada - * - * Side Effects: - * installs a few extensions - * - * Notes: - * Must not use libc (to do io) from here, since drivers are - * not yet initialized. - * - * Deficiencies/ToDo: - * - * - */ - -void -bsp_pretasking_hook(void) -{ - bsp_libc_init(); #if SIMHPPA_FAST_IDLE /* @@ -213,38 +150,6 @@ bsp_pretasking_hook(void) #endif } -/* - * Use the shared bsp_postdriver_hook() implementation - */ - -void bsp_postdriver_hook(void); - -/* - * Function: bsp_start - * Created: 94/12/6 - * - * Description: - * called by crt0 as our "main" equivalent - * - * - * - * Parameters: - * - * - * Returns: - * - * - * Side Effects: - * - * - * Notes: - * - * - * Deficiencies/ToDo: - * - * - */ - void bsp_start(void) { /* diff --git a/c/src/lib/libbsp/i386/force386/startup/Makefile.in b/c/src/lib/libbsp/i386/force386/startup/Makefile.in index 3da58a3ab9..bda5bb88da 100644 --- a/c/src/lib/libbsp/i386/force386/startup/Makefile.in +++ b/c/src/lib/libbsp/i386/force386/startup/Makefile.in @@ -11,7 +11,7 @@ PROJECT_ROOT = @PROJECT_ROOT@ PGM=${ARCH}/startup.rel # C source names, if any, go here -- minus the .c -C_PIECES=bspclean bsppost bspstart main sbrk setvec +C_PIECES=bspclean bsplibc bsppost bspstart main sbrk setvec C_FILES=$(C_PIECES:%=%.c) C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) diff --git a/c/src/lib/libbsp/i386/force386/startup/bspstart.c b/c/src/lib/libbsp/i386/force386/startup/bspstart.c index 12fcaa7c4d..f32fc798f1 100644 --- a/c/src/lib/libbsp/i386/force386/startup/bspstart.c +++ b/c/src/lib/libbsp/i386/force386/startup/bspstart.c @@ -1,14 +1,9 @@ -/* bsp_start() - * +/* * 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. * - * INPUT: NONE - * - * OUTPUT: NONE - * * COPYRIGHT (c) 1989-1998. * On-Line Applications Research Corporation (OAR). * Copyright assigned to U.S. Government, 1994. @@ -37,38 +32,12 @@ rtems_cpu_table Cpu_table; char *rtems_progname; -/* Initialize whatever libc we are using - * called from postdriver hook +/* + * Use the shared implementations of the following routines */ - -void bsp_libc_init() -{ - extern int end; - rtems_unsigned32 heap_start; - - heap_start = (rtems_unsigned32) &end; - if (heap_start & (CPU_ALIGNMENT-1)) - heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); - - RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0); - - /* - * Init the RTEMS libio facility to provide UNIX-like system - * calls for use by newlib (ie: provide __rtems_open, __rtems_close, etc) - * Uses malloc() to get area for the iops, so must be after malloc init - */ - - rtems_libio_init(); - - /* - * Set up for the libc handling. - */ - - if (BSP_Configuration.ticks_per_timeslice > 0) - libc_init(1); /* reentrant if possible */ - else - libc_init(0); /* non-reentrant */ -} + +void bsp_postdriver_hook(void); +void bsp_libc_init( void *, unsigned32, int ); /* * Function: bsp_pretasking_hook @@ -84,22 +53,28 @@ void bsp_libc_init() * */ -void -bsp_pretasking_hook(void) +void bsp_pretasking_hook(void) { - bsp_libc_init(); + extern int end; + rtems_unsigned32 heap_start; + + heap_start = (rtems_unsigned32) &end; + if (heap_start & (CPU_ALIGNMENT-1)) + heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); + + bsp_libc_init((void *) heap_start, 64 * 1024, 0); + #ifdef RTEMS_DEBUG rtems_debug_enable( RTEMS_DEBUG_ALL_MASK ); #endif } - /* - * Use the shared bsp_postdriver_hook() implementation + * bsp_start + * + * This routine does the bulk of the system initialization. */ - -void bsp_postdriver_hook(void); void bsp_start( void ) { diff --git a/c/src/lib/libbsp/i386/go32/startup/Makefile.in b/c/src/lib/libbsp/i386/go32/startup/Makefile.in index 86a047cec5..5942446090 100644 --- a/c/src/lib/libbsp/i386/go32/startup/Makefile.in +++ b/c/src/lib/libbsp/i386/go32/startup/Makefile.in @@ -11,7 +11,7 @@ PROJECT_ROOT = @PROJECT_ROOT@ PGM=${ARCH}/startup.rel # C source names, if any, go here -- minus the .c -C_PIECES=bsppost bspstart sbrk setvec +C_PIECES=bsplibc bsppost bspstart sbrk setvec C_FILES=$(C_PIECES:%=%.c) C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) diff --git a/c/src/lib/libbsp/i386/go32/startup/bspstart.c b/c/src/lib/libbsp/i386/go32/startup/bspstart.c index f84d871a35..eeef55eed9 100644 --- a/c/src/lib/libbsp/i386/go32/startup/bspstart.c +++ b/c/src/lib/libbsp/i386/go32/startup/bspstart.c @@ -1,14 +1,9 @@ -/* bsp_start() - * +/* * 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. * - * INPUT: NONE - * - * OUTPUT: NONE - * * COPYRIGHT (c) 1989-1998. * On-Line Applications Research Corporation (OAR). * Copyright assigned to U.S. Government, 1994. @@ -40,44 +35,13 @@ rtems_cpu_table Cpu_table; char *rtems_progname; -/* Initialize whatever libc we are using - * called from postdriver hook +/* + * Use the shared implementations of the following routines */ - -void bsp_libc_init() -{ - rtems_unsigned32 heap_start; - -#if 0 - extern int end; - heap_start = (rtems_unsigned32) &end; -#else - void * sbrk( int ); - heap_start = (rtems_unsigned32) sbrk( 64 * 1024 + CPU_ALIGNMENT ); -#endif - if (heap_start & (CPU_ALIGNMENT-1)) - heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); - - RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0); - - /* - * Init the RTEMS libio facility to provide UNIX-like system - * calls for use by newlib (ie: provide __rtems_open, __rtems_close, etc) - * Uses malloc() to get area for the iops, so must be after malloc init - */ - - rtems_libio_init(); - - /* - * Set up for the libc handling. - */ - - if (BSP_Configuration.ticks_per_timeslice > 0) - libc_init(1); /* reentrant if possible */ - else - libc_init(0); /* non-reentrant */ -} +void bsp_postdriver_hook(void); +void bsp_libc_init( void *, unsigned32, int ); + /* * Function: bsp_pretasking_hook * Created: 95/03/10 @@ -92,22 +56,33 @@ void bsp_libc_init() * */ -void -bsp_pretasking_hook(void) +void bsp_pretasking_hook(void) { - bsp_libc_init(); + rtems_unsigned32 heap_start; + +#if 0 + extern int end; + heap_start = (rtems_unsigned32) &end; +#else + void * sbrk( int ); + heap_start = (rtems_unsigned32) sbrk( 64 * 1024 + CPU_ALIGNMENT ); +#endif + if (heap_start & (CPU_ALIGNMENT-1)) + heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); + + bsp_libc_init((void *) heap_start, 64 * 1024, 0); + #ifdef RTEMS_DEBUG rtems_debug_enable( RTEMS_DEBUG_ALL_MASK ); #endif } - /* - * Use the shared bsp_postdriver_hook() implementation + * main/bsp_start + * + * This routine does the bulk of the system initialization. */ - -void bsp_postdriver_hook(void); /* This is the original command line passed from DOS */ char ** Go32_Argv; diff --git a/c/src/lib/libbsp/i386/i386ex/startup/Makefile.in b/c/src/lib/libbsp/i386/i386ex/startup/Makefile.in index b62746f5bd..9f4b9ae2fb 100644 --- a/c/src/lib/libbsp/i386/i386ex/startup/Makefile.in +++ b/c/src/lib/libbsp/i386/i386ex/startup/Makefile.in @@ -11,7 +11,7 @@ PROJECT_ROOT = @PROJECT_ROOT@ PGM=${ARCH}/startup.rel # C source names, if any, go here -- minus the .c -C_PIECES=bspclean bsppost bspstart main sbrk setvec +C_PIECES=bspclean bsplibc bsppost bspstart main sbrk setvec C_FILES=$(C_PIECES:%=%.c) C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) diff --git a/c/src/lib/libbsp/i386/i386ex/startup/bspstart.c b/c/src/lib/libbsp/i386/i386ex/startup/bspstart.c index 2bda7165fe..9fc13e0262 100644 --- a/c/src/lib/libbsp/i386/i386ex/startup/bspstart.c +++ b/c/src/lib/libbsp/i386/i386ex/startup/bspstart.c @@ -43,45 +43,11 @@ rtems_cpu_table Cpu_table; extern rtems_unsigned32 rdb_start; /* - * bsp_libc_init - * - * Initialize whatever libc we are using called from bsp_postdriver_hook. + * Use the shared implementations of the following routines */ - - -void bsp_libc_init() -{ - extern int heap_bottom; - rtems_unsigned32 heap_start; - rtems_unsigned32 heap_size; - - heap_start = (rtems_unsigned32) &heap_bottom; - if (heap_start & (CPU_ALIGNMENT-1)) - heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); - - heap_size = BSP_Configuration.work_space_start -(void *) heap_start ; - heap_size &= 0xfffffff0; /* keep it as a multiple of 16 bytes */ - - heap_size &= 0xfffffff0; /* keep it as a multiple of 16 bytes */ - RTEMS_Malloc_Initialize((void *) heap_start, heap_size, 0); - - /* - * Init the RTEMS libio facility to provide UNIX-like system - * calls for use by newlib (ie: provide __rtems_open, __rtems_close, etc) - * Uses malloc() to get area for the iops, so must be after malloc init - */ - - rtems_libio_init(); - /* - * Set up for the libc handling. - */ - - if (BSP_Configuration.ticks_per_timeslice > 0) - libc_init(1); /* reentrant if possible */ - else - libc_init(0); /* non-reentrant */ -} +void bsp_postdriver_hook(void); +void bsp_libc_init( void *, unsigned32, int ); /* * Function: bsp_pretasking_hook @@ -97,22 +63,32 @@ void bsp_libc_init() * */ -void -bsp_pretasking_hook(void) +void bsp_pretasking_hook(void) { - bsp_libc_init(); - + extern int heap_bottom; + rtems_unsigned32 heap_start; + rtems_unsigned32 heap_size; + + heap_start = (rtems_unsigned32) &heap_bottom; + if (heap_start & (CPU_ALIGNMENT-1)) + heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); + + heap_size = BSP_Configuration.work_space_start -(void *) heap_start ; + heap_size &= 0xfffffff0; /* keep it as a multiple of 16 bytes */ + + heap_size &= 0xfffffff0; /* keep it as a multiple of 16 bytes */ + bsp_libc_init((void *) heap_start, heap_size, 0); + #ifdef RTEMS_DEBUG rtems_debug_enable( RTEMS_DEBUG_ALL_MASK ); #endif } - /* - * Use the shared bsp_postdriver_hook() implementation + * bsp_start + * + * This routine does the bulk of the system initialization. */ - -void bsp_postdriver_hook(void); void bsp_start( void ) { diff --git a/c/src/lib/libbsp/i386/pc386/startup/Makefile.in b/c/src/lib/libbsp/i386/pc386/startup/Makefile.in index cf3371536c..1c8f298249 100644 --- a/c/src/lib/libbsp/i386/pc386/startup/Makefile.in +++ b/c/src/lib/libbsp/i386/pc386/startup/Makefile.in @@ -11,7 +11,7 @@ PROJECT_ROOT = @PROJECT_ROOT@ PGM=${ARCH}/startup.rel # C source names, if any, go here -- minus the .c -C_PIECES=bspclean bsppost bspstart exit irq main sbrk +C_PIECES=bspclean bsplibc bsppost bspstart exit irq main sbrk C_FILES=$(C_PIECES:%=%.c) C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) diff --git a/c/src/lib/libbsp/i386/pc386/startup/bspstart.c b/c/src/lib/libbsp/i386/pc386/startup/bspstart.c index 18f36d61a1..773d3ba804 100644 --- a/c/src/lib/libbsp/i386/pc386/startup/bspstart.c +++ b/c/src/lib/libbsp/i386/pc386/startup/bspstart.c @@ -66,38 +66,8 @@ char *rtems_progname; /* Program name - from main(). */ | External Prototypes +--------------------------------------------------------------------------*/ extern void _exit(int); /* define in exit.c */ - -/*-------------------------------------------------------------------------+ -| Function: bsp_libc_init -| Description: Initialize whatever libc we are using. Called from -| pretasking hook. -| Global Variables: rtemsFreeMemStart. -| Arguments: None. -| Returns: Nothing. -+--------------------------------------------------------------------------*/ -static void -bsp_libc_init(void) -{ - if (rtemsFreeMemStart & (CPU_ALIGNMENT - 1)) /* not aligned => align it */ - rtemsFreeMemStart = (rtemsFreeMemStart+CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); - - RTEMS_Malloc_Initialize((void *)rtemsFreeMemStart, HEAP_SIZE << 10, 0); - rtemsFreeMemStart += HEAP_SIZE << 10; /* HEAP_SIZE is in KBytes */ - - /* Init the RTEMS libio facility to provide UNIX-like system calls for use by - newlib (ie: provide __rtems_open, __rtems_close, etc). Uses malloc() - to get area for the iops, so must be after malloc initialization. */ - - rtems_libio_init(); - - /* Set up for the libc handling. */ - - if (BSP_Configuration.ticks_per_timeslice > 0) - libc_init(1); /* reentrant if possible */ - else - libc_init(0); /* non-reentrant */ -} /* bsp_libc_init */ - +void bsp_libc_init( void *, unsigned32, int ); +void bsp_postdriver_hook(void); /*-------------------------------------------------------------------------+ | Function: bsp_pretasking_hook @@ -109,10 +79,14 @@ bsp_libc_init(void) | Arguments: None. | Returns: Nothing. +--------------------------------------------------------------------------*/ -void -bsp_pretasking_hook(void) +void bsp_pretasking_hook(void) { - bsp_libc_init(); + if (rtemsFreeMemStart & (CPU_ALIGNMENT - 1)) /* not aligned => align it */ + rtemsFreeMemStart = (rtemsFreeMemStart+CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); + + bsp_libc_init((void *)rtemsFreeMemStart, HEAP_SIZE << 10, 0); + rtemsFreeMemStart += HEAP_SIZE << 10; /* HEAP_SIZE is in KBytes */ + #ifdef RTEMS_DEBUG @@ -122,13 +96,6 @@ bsp_pretasking_hook(void) } /* bsp_pretasking_hook */ -/* - * Use the shared bsp_postdriver_hook() implementation - */ - -void bsp_postdriver_hook(void); - - /*-------------------------------------------------------------------------+ | Function: bsp_start | Description: Called before main is invoked. diff --git a/c/src/lib/libbsp/i960/cvme961/startup/Makefile.in b/c/src/lib/libbsp/i960/cvme961/startup/Makefile.in index d4552cdf00..aa59a2c153 100644 --- a/c/src/lib/libbsp/i960/cvme961/startup/Makefile.in +++ b/c/src/lib/libbsp/i960/cvme961/startup/Makefile.in @@ -11,7 +11,7 @@ PROJECT_ROOT = @PROJECT_ROOT@ PGM=${ARCH}/startup.rel # C source names, if any, go here -- minus the .c -C_PIECES=bspclean bsppost bspstart main sbrk setvec +C_PIECES=bspclean bsplibc bsppost bspstart main sbrk setvec C_FILES=$(C_PIECES:%=%.c) C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) diff --git a/c/src/lib/libbsp/i960/cvme961/startup/bspstart.c b/c/src/lib/libbsp/i960/cvme961/startup/bspstart.c index a9c89819b1..0b9e523f65 100644 --- a/c/src/lib/libbsp/i960/cvme961/startup/bspstart.c +++ b/c/src/lib/libbsp/i960/cvme961/startup/bspstart.c @@ -1,14 +1,9 @@ -/* bsp_start() - * +/* * 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. * - * INPUT: NONE - * - * OUTPUT: NONE - * * COPYRIGHT (c) 1989-1998. * On-Line Applications Research Corporation (OAR). * Copyright assigned to U.S. Government, 1994. @@ -40,38 +35,12 @@ rtems_cpu_table Cpu_table; char *rtems_progname; -/* Initialize whatever libc we are using - * called from postdriver hook +/* + * Use the shared implementations of the following routines */ - -void bsp_libc_init() -{ - extern int end; - rtems_unsigned32 heap_start; - - heap_start = (rtems_unsigned32) &end; - if (heap_start & (CPU_ALIGNMENT-1)) - heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); - - RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0); - - /* - * Init the RTEMS libio facility to provide UNIX-like system - * calls for use by newlib (ie: provide __rtems_open, __rtems_close, etc) - * Uses malloc() to get area for the iops, so must be after malloc init - */ - - rtems_libio_init(); - - /* - * Set up for the libc handling. - */ - - if (BSP_Configuration.ticks_per_timeslice > 0) - libc_init(1); /* reentrant if possible */ - else - libc_init(0); /* non-reentrant */ -} + +void bsp_postdriver_hook(void); +void bsp_libc_init( void *, unsigned32, int ); /* * Function: bsp_pretasking_hook @@ -87,22 +56,27 @@ void bsp_libc_init() * */ -void -bsp_pretasking_hook(void) +void bsp_pretasking_hook(void) { - bsp_libc_init(); + extern int end; + rtems_unsigned32 heap_start; + + heap_start = (rtems_unsigned32) &end; + if (heap_start & (CPU_ALIGNMENT-1)) + heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); + + bsp_libc_init((void *) heap_start, 64 * 1024, 0); #ifdef RTEMS_DEBUG rtems_debug_enable( RTEMS_DEBUG_ALL_MASK ); #endif } - /* - * Use the shared bsp_postdriver_hook() implementation + * bsp_start + * + * This routine does the bulk of the system initialization. */ - -void bsp_postdriver_hook(void); void bsp_start( void ) { diff --git a/c/src/lib/libbsp/m68k/dmv152/startup/Makefile.in b/c/src/lib/libbsp/m68k/dmv152/startup/Makefile.in index c8cbc6c78d..a68bcbb938 100644 --- a/c/src/lib/libbsp/m68k/dmv152/startup/Makefile.in +++ b/c/src/lib/libbsp/m68k/dmv152/startup/Makefile.in @@ -11,7 +11,7 @@ PROJECT_ROOT = @PROJECT_ROOT@ PGM=${ARCH}/startup.rel # C source names, if any, go here -- minus the .c -C_PIECES=bspclean bsppost bspstart main sbrk setvec vmeintr +C_PIECES=bspclean bsplibc bsppost bspstart main sbrk setvec vmeintr C_FILES=$(C_PIECES:%=%.c) C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) diff --git a/c/src/lib/libbsp/m68k/dmv152/startup/bspstart.c b/c/src/lib/libbsp/m68k/dmv152/startup/bspstart.c index 04287c82db..fef39736d1 100644 --- a/c/src/lib/libbsp/m68k/dmv152/startup/bspstart.c +++ b/c/src/lib/libbsp/m68k/dmv152/startup/bspstart.c @@ -1,14 +1,9 @@ -/* bsp_start() - * +/* * 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. * - * INPUT: NONE - * - * OUTPUT: NONE - * * COPYRIGHT (c) 1989-1998. * On-Line Applications Research Corporation (OAR). * Copyright assigned to U.S. Government, 1994. @@ -39,38 +34,12 @@ rtems_cpu_table Cpu_table; char *rtems_progname; -/* Initialize whatever libc we are using - * called from postdriver hook +/* + * Use the shared implementations of the following routines */ - -void bsp_libc_init() -{ - extern int end; - rtems_unsigned32 heap_start; - - heap_start = (rtems_unsigned32) &end; - if (heap_start & (CPU_ALIGNMENT-1)) - heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); - - RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0); - - /* - * Init the RTEMS libio facility to provide UNIX-like system - * calls for use by newlib (ie: provide __rtems_open, __rtems_close, etc) - * Uses malloc() to get area for the iops, so must be after malloc init - */ - - rtems_libio_init(); - - /* - * Set up for the libc handling. - */ - - if (BSP_Configuration.ticks_per_timeslice > 0) - libc_init(1); /* reentrant if possible */ - else - libc_init(0); /* non-reentrant */ -} + +void bsp_postdriver_hook(void); +void bsp_libc_init( void *, unsigned32, int ); /* * Function: bsp_pretasking_hook @@ -86,22 +55,27 @@ void bsp_libc_init() * */ -void -bsp_pretasking_hook(void) +void bsp_pretasking_hook(void) { - bsp_libc_init(); + extern int end; + rtems_unsigned32 heap_start; + + heap_start = (rtems_unsigned32) &end; + if (heap_start & (CPU_ALIGNMENT-1)) + heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); + + bsp_libc_init((void *) heap_start, 64 * 1024, 0); #ifdef RTEMS_DEBUG rtems_debug_enable( RTEMS_DEBUG_ALL_MASK ); #endif } - /* - * Use the shared bsp_postdriver_hook() implementation + * bsp_start + * + * This routine does the bulk of the system initialization. */ - -void bsp_postdriver_hook(void); void bsp_start( void ) { diff --git a/c/src/lib/libbsp/m68k/efi332/startup/Makefile.in b/c/src/lib/libbsp/m68k/efi332/startup/Makefile.in index d28b19db1f..6cacf17587 100644 --- a/c/src/lib/libbsp/m68k/efi332/startup/Makefile.in +++ b/c/src/lib/libbsp/m68k/efi332/startup/Makefile.in @@ -11,7 +11,7 @@ PROJECT_ROOT = @PROJECT_ROOT@ PGM=${ARCH}/startup.rel # C source names, if any, go here -- minus the .c -C_PIECES=bsppost bspstart bspclean main sbrk setvec +C_PIECES=bsplibc bsppost bspstart bspclean main sbrk setvec C_FILES=$(C_PIECES:%=%.c) C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) diff --git a/c/src/lib/libbsp/m68k/efi332/startup/bspstart.c b/c/src/lib/libbsp/m68k/efi332/startup/bspstart.c index 334705c4a3..c2fc402aeb 100644 --- a/c/src/lib/libbsp/m68k/efi332/startup/bspstart.c +++ b/c/src/lib/libbsp/m68k/efi332/startup/bspstart.c @@ -1,14 +1,9 @@ -/* bsp_start() - * +/* * 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. * - * INPUT: NONE - * - * OUTPUT: NONE - * * COPYRIGHT (c) 1989-1998. * On-Line Applications Research Corporation (OAR). * Copyright assigned to U.S. Government, 1994. @@ -38,46 +33,12 @@ rtems_cpu_table Cpu_table; char *rtems_progname; -/* Initialize whatever libc we are using - * called from postdriver hook +/* + * Use the shared implementations of the following routines */ - -void bsp_libc_init() -{ -/* extern int end; */ - rtems_unsigned32 heap_start; - - heap_start = (rtems_unsigned32) BSP_Configuration.work_space_start + - (rtems_unsigned32) BSP_Configuration.work_space_size; - if (heap_start & (CPU_ALIGNMENT-1)) - heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); - - if (heap_start > (rtems_unsigned32) RAM_END) { - /* rtems_fatal_error_occurred can not be used before initalization */ - RAW_PUTS("\n\rRTEMS: Out of memory.\n\r"); - RAW_PUTS("RTEMS: Check RAM_END and the size of the work space.\n\r"); - } - - RTEMS_Malloc_Initialize((void *) heap_start, - (RAM_END - heap_start), 0); - - /* - * Init the RTEMS libio facility to provide UNIX-like system - * calls for use by newlib (ie: provide __rtems_open, __rtems_close, etc) - * Uses malloc() to get area for the iops, so must be after malloc init - */ - - rtems_libio_init(); - - /* - * Set up for the libc handling. - */ - - if (BSP_Configuration.ticks_per_timeslice > 0) - libc_init(1); /* reentrant if possible */ - else - libc_init(0); /* non-reentrant */ -} + +void bsp_postdriver_hook(void); +void bsp_libc_init( void *, unsigned32, int ); /* * Function: bsp_pretasking_hook @@ -93,22 +54,34 @@ void bsp_libc_init() * */ -void -bsp_pretasking_hook(void) +void bsp_pretasking_hook(void) { - bsp_libc_init(); +/* extern int end; */ + rtems_unsigned32 heap_start; + + heap_start = (rtems_unsigned32) BSP_Configuration.work_space_start + + (rtems_unsigned32) BSP_Configuration.work_space_size; + if (heap_start & (CPU_ALIGNMENT-1)) + heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); + + if (heap_start > (rtems_unsigned32) RAM_END) { + /* rtems_fatal_error_occurred can not be used before initalization */ + RAW_PUTS("\n\rRTEMS: Out of memory.\n\r"); + RAW_PUTS("RTEMS: Check RAM_END and the size of the work space.\n\r"); + } + + bsp_libc_init((void *) heap_start, (RAM_END - heap_start), 0); #ifdef RTEMS_DEBUG rtems_debug_enable( RTEMS_DEBUG_ALL_MASK ); #endif } - /* - * Use the shared bsp_postdriver_hook() implementation + * bsp_start + * + * This routine does the bulk of the system initialization. */ - -void bsp_postdriver_hook(void); void bsp_start( void ) { diff --git a/c/src/lib/libbsp/m68k/efi68k/startup/Makefile.in b/c/src/lib/libbsp/m68k/efi68k/startup/Makefile.in index 13e0a5ae50..5925adedb4 100644 --- a/c/src/lib/libbsp/m68k/efi68k/startup/Makefile.in +++ b/c/src/lib/libbsp/m68k/efi68k/startup/Makefile.in @@ -11,7 +11,7 @@ PROJECT_ROOT = @PROJECT_ROOT@ PGM=${ARCH}/startup.rel # C source names, if any, go here -- minus the .c -C_PIECES=bsppost bspstart bspclean efi68k_tcp efi68k_wd main sbrk setvec +C_PIECES=bsplibc bsppost bspstart bspclean efi68k_tcp efi68k_wd main sbrk setvec C_FILES=$(C_PIECES:%=%.c) C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) diff --git a/c/src/lib/libbsp/m68k/efi68k/startup/bspstart.c b/c/src/lib/libbsp/m68k/efi68k/startup/bspstart.c index 6b53e5fc11..8c382683b5 100644 --- a/c/src/lib/libbsp/m68k/efi68k/startup/bspstart.c +++ b/c/src/lib/libbsp/m68k/efi68k/startup/bspstart.c @@ -1,14 +1,9 @@ -/* bsp_start() - * +/* * 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. * - * INPUT: NONE - * - * OUTPUT: NONE - * * COPYRIGHT (c) 1989-1998. * On-Line Applications Research Corporation (OAR). * Copyright assigned to U.S. Government, 1994. @@ -43,47 +38,13 @@ rtems_unsigned32 Timer_interrupts; extern void set_debug_traps(void); extern void breakpoint(void); -/* Initialize whatever libc we are using - * called from postdriver hook +/* + * Use the shared implementations of the following routines */ - -void bsp_libc_init() -{ -/* extern int end; */ - rtems_unsigned32 heap_start; - - heap_start = (rtems_unsigned32) BSP_Configuration.work_space_start + - (rtems_unsigned32) BSP_Configuration.work_space_size; - if (heap_start & (CPU_ALIGNMENT-1)) - heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); - - if (heap_start > (rtems_unsigned32) RAM_END) { - /* rtems_fatal_error_occurred can not be used before initalization */ - RAW_PUTS("\n\rRTEMS: Out of memory.\n\r"); - RAW_PUTS("RTEMS: Check RAM_END and the size of the work space.\n\r"); - } - - RTEMS_Malloc_Initialize((void *) heap_start, - (RAM_END - heap_start), 0); - - /* - * Init the RTEMS libio facility to provide UNIX-like system - * calls for use by newlib (ie: provide __rtems_open, __rtems_close, etc) - * Uses malloc() to get area for the iops, so must be after malloc init - */ - - rtems_libio_init(); - - /* - * Set up for the libc handling. - */ - - if (BSP_Configuration.ticks_per_timeslice > 0) - libc_init(1); /* reentrant if possible */ - else - libc_init(0); /* non-reentrant */ -} +void bsp_postdriver_hook(void); +void bsp_libc_init( void *, unsigned32, int ); + /* * Function: bsp_pretasking_hook * Created: 95/03/10 @@ -98,23 +59,34 @@ void bsp_libc_init() * */ -void -bsp_pretasking_hook(void) +void bsp_pretasking_hook(void) { - bsp_libc_init(); +/* extern int end; */ + rtems_unsigned32 heap_start; + + heap_start = (rtems_unsigned32) BSP_Configuration.work_space_start + + (rtems_unsigned32) BSP_Configuration.work_space_size; + if (heap_start & (CPU_ALIGNMENT-1)) + heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); + + if (heap_start > (rtems_unsigned32) RAM_END) { + /* rtems_fatal_error_occurred can not be used before initalization */ + RAW_PUTS("\n\rRTEMS: Out of memory.\n\r"); + RAW_PUTS("RTEMS: Check RAM_END and the size of the work space.\n\r"); + } + + bsp_libc_init((void *) heap_start, (RAM_END - heap_start), 0); #ifdef RTEMS_DEBUG rtems_debug_enable( RTEMS_DEBUG_ALL_MASK ); #endif } - /* - * Use the shared bsp_postdriver_hook() implementation + * bsp_start + * + * This routine does the bulk of the system initialization. */ - -void bsp_postdriver_hook(void); - void bsp_start( void ) { diff --git a/c/src/lib/libbsp/m68k/gen68302/startup/Makefile.in b/c/src/lib/libbsp/m68k/gen68302/startup/Makefile.in index bc3a786ed5..71bc5a0634 100644 --- a/c/src/lib/libbsp/m68k/gen68302/startup/Makefile.in +++ b/c/src/lib/libbsp/m68k/gen68302/startup/Makefile.in @@ -11,7 +11,7 @@ PROJECT_ROOT = @PROJECT_ROOT@ PGM=${ARCH}/startup.rel # C source names, if any, go here -- minus the .c -C_PIECES=bspclean bsppost bspstart main sbrk setvec +C_PIECES=bspclean bsplibc bsppost bspstart main sbrk setvec C_FILES=$(C_PIECES:%=%.c) C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) diff --git a/c/src/lib/libbsp/m68k/gen68302/startup/bspstart.c b/c/src/lib/libbsp/m68k/gen68302/startup/bspstart.c index fbb787dbb3..ddf6cde530 100644 --- a/c/src/lib/libbsp/m68k/gen68302/startup/bspstart.c +++ b/c/src/lib/libbsp/m68k/gen68302/startup/bspstart.c @@ -1,14 +1,9 @@ -/* bsp_start() - * +/* * 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. * - * INPUT: NONE - * - * OUTPUT: NONE - * * COPYRIGHT (c) 1989-1998. * On-Line Applications Research Corporation (OAR). * Copyright assigned to U.S. Government, 1994. @@ -39,45 +34,12 @@ rtems_cpu_table Cpu_table; char *rtems_progname; -/* Initialize whatever libc we are using - * called from postdriver hook +/* + * Use the shared implementations of the following routines */ - -void bsp_libc_init() -{ - extern int end; - rtems_unsigned32 heap_start; - - heap_start = (rtems_unsigned32) &end; - if (heap_start & (CPU_ALIGNMENT-1)) - heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); - - /* - * The last parameter to RTEMS_Malloc_Initialize is the "chunk" - * size which a multiple of will be requested on each sbrk() - * call by malloc(). A value of 0 indicates that sbrk() should - * not be called to extend the heap. - */ - - RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0); - - /* - * Init the RTEMS libio facility to provide UNIX-like system - * calls for use by newlib (ie: provide __rtems_open, __rtems_close, etc) - * Uses malloc() to get area for the iops, so must be after malloc init - */ - - rtems_libio_init(); - - /* - * Set up for the libc handling. - */ - - if (BSP_Configuration.ticks_per_timeslice > 0) - libc_init(1); /* reentrant if possible */ - else - libc_init(0); /* non-reentrant */ -} + +void bsp_postdriver_hook(void); +void bsp_libc_init( void *, unsigned32, int ); /* * Function: bsp_pretasking_hook @@ -93,23 +55,28 @@ void bsp_libc_init() * */ -void -bsp_pretasking_hook(void) +void bsp_pretasking_hook(void) { - bsp_libc_init(); + extern int end; + rtems_unsigned32 heap_start; + + heap_start = (rtems_unsigned32) &end; + if (heap_start & (CPU_ALIGNMENT-1)) + heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); + + bsp_libc_init((void *) heap_start, 64 * 1024, 0); + #ifdef RTEMS_DEBUG rtems_debug_enable( RTEMS_DEBUG_ALL_MASK ); #endif } - /* - * Use the shared bsp_postdriver_hook() implementation + * bsp_start + * + * This routine does the bulk of the system initialization. */ - -void bsp_postdriver_hook(void); - void bsp_start( void ) { diff --git a/c/src/lib/libbsp/m68k/gen68360/startup/Makefile.in b/c/src/lib/libbsp/m68k/gen68360/startup/Makefile.in index dafab347c9..bebda1d445 100644 --- a/c/src/lib/libbsp/m68k/gen68360/startup/Makefile.in +++ b/c/src/lib/libbsp/m68k/gen68360/startup/Makefile.in @@ -11,7 +11,7 @@ PROJECT_ROOT = @PROJECT_ROOT@ PGM=${ARCH}/startup.rel # C source names, if any, go here -- minus the .c -C_PIECES=alloc360 bspclean bsppost bspstart init68360 main sbrk setvec +C_PIECES=alloc360 bspclean bsplibc bsppost bspstart init68360 main sbrk setvec C_FILES=$(C_PIECES:%=%.c) C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) diff --git a/c/src/lib/libbsp/m68k/gen68360/startup/bspstart.c b/c/src/lib/libbsp/m68k/gen68360/startup/bspstart.c index 8d5ded3b37..3a693e1fe5 100644 --- a/c/src/lib/libbsp/m68k/gen68360/startup/bspstart.c +++ b/c/src/lib/libbsp/m68k/gen68360/startup/bspstart.c @@ -1,14 +1,9 @@ -/* bsp_start() - * +/* * 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. * - * INPUT: NONE - * - * OUTPUT: NONE - * * COPYRIGHT (c) 1989-1998. * On-Line Applications Research Corporation (OAR). * Copyright assigned to U.S. Government, 1994. @@ -39,41 +34,12 @@ rtems_cpu_table Cpu_table; char *rtems_progname; -/* Initialize whatever libc we are using - * called from postdriver hook +/* + * Use the shared implementations of the following routines */ - -void bsp_libc_init() -{ - extern void *_HeapStart; - extern rtems_unsigned32 _HeapSize; - - /* - * The last parameter to RTEMS_Malloc_Initialize is the "chunk" - * size which a multiple of will be requested on each sbrk() - * call by malloc(). A value of 0 indicates that sbrk() should - * not be called to extend the heap. - */ - - RTEMS_Malloc_Initialize(&_HeapStart, _HeapSize, 0); - - /* - * Init the RTEMS libio facility to provide UNIX-like system - * calls for use by newlib (ie: provide __rtems_open, __rtems_close, etc) - * Uses malloc() to get area for the iops, so must be after malloc init - */ - - rtems_libio_init(); - - /* - * Set up for the libc handling. - */ - - if (BSP_Configuration.ticks_per_timeslice > 0) - libc_init(1); /* reentrant if possible */ - else - libc_init(0); /* non-reentrant */ -} + +void bsp_postdriver_hook(void); +void bsp_libc_init( void *, unsigned32, int ); /* * Function: bsp_pretasking_hook @@ -89,22 +55,23 @@ void bsp_libc_init() * */ -void -bsp_pretasking_hook(void) +void bsp_pretasking_hook(void) { - bsp_libc_init(); + extern void *_HeapStart; + extern rtems_unsigned32 _HeapSize; + + bsp_libc_init(&_HeapStart, _HeapSize, 0); #ifdef RTEMS_DEBUG rtems_debug_enable( RTEMS_DEBUG_ALL_MASK ); #endif } - /* - * Use the shared bsp_postdriver_hook() implementation + * bsp_start + * + * This routine does the bulk of the system initialization. */ - -void bsp_postdriver_hook(void); void bsp_start( void ) { diff --git a/c/src/lib/libbsp/m68k/idp/startup/Makefile.in b/c/src/lib/libbsp/m68k/idp/startup/Makefile.in index 709d28ab27..ae12a4c04b 100644 --- a/c/src/lib/libbsp/m68k/idp/startup/Makefile.in +++ b/c/src/lib/libbsp/m68k/idp/startup/Makefile.in @@ -11,7 +11,7 @@ PROJECT_ROOT = @PROJECT_ROOT@ PGM=${ARCH}/startup.rel # C source names, if any, go here -- minus the .c -C_PIECES=bspclean bsppost bspstart main sbrk setvec +C_PIECES=bspclean bsplibc bsppost bspstart main sbrk setvec C_FILES=$(C_PIECES:%=%.c) C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) diff --git a/c/src/lib/libbsp/m68k/idp/startup/bspstart.c b/c/src/lib/libbsp/m68k/idp/startup/bspstart.c index 9213a1442e..8bd79b215e 100644 --- a/c/src/lib/libbsp/m68k/idp/startup/bspstart.c +++ b/c/src/lib/libbsp/m68k/idp/startup/bspstart.c @@ -1,14 +1,9 @@ -/* bsp_start() - * +/* * 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. * - * INPUT: NONE - * - * OUTPUT: NONE - * * COPYRIGHT (c) 1989-1998. * On-Line Applications Research Corporation (OAR). * Copyright assigned to U.S. Government, 1994. @@ -46,39 +41,12 @@ rtems_cpu_table Cpu_table; char *rtems_progname; -/* Initialize whatever libc we are using - * called from postdriver hook +/* + * Use the shared implementations of the following routines */ -void bsp_libc_init() -{ - extern int end; - rtems_unsigned32 heap_start; - - heap_start = (rtems_unsigned32) &end; - if (heap_start & (CPU_ALIGNMENT-1)) - heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); - - /* Create 64 KByte memory region for RTEMS executive */ - RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0); - - /* - * Init the RTEMS libio facility to provide UNIX-like system - * calls for use by newlib (ie: provide __rtems_open, __rtems_close, etc) - * Uses malloc() to get area for the iops, so must be after malloc init - */ - - rtems_libio_init(); - - /* - * Set up for the libc handling. - */ - - if (BSP_Configuration.ticks_per_timeslice > 0) - libc_init(1); /* reentrant if possible */ - else - libc_init(0); /* non-reentrant */ -} +void bsp_postdriver_hook(void); +void bsp_libc_init( void *, unsigned32, int ); /* * Function: bsp_pretasking_hook @@ -94,22 +62,28 @@ void bsp_libc_init() * */ -void -bsp_pretasking_hook(void) +void bsp_pretasking_hook(void) { - bsp_libc_init(); + extern int end; + rtems_unsigned32 heap_start; + + heap_start = (rtems_unsigned32) &end; + if (heap_start & (CPU_ALIGNMENT-1)) + heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); + + /* Create 64 KByte memory region for RTEMS executive */ + bsp_libc_init((void *) heap_start, 64 * 1024, 0); #ifdef RTEMS_DEBUG rtems_debug_enable( RTEMS_DEBUG_ALL_MASK ); #endif } - /* - * Use the shared bsp_postdriver_hook() implementation + * bsp_start + * + * This routine does the bulk of the system initialization. */ - -void bsp_postdriver_hook(void); void bsp_start( void ) { diff --git a/c/src/lib/libbsp/m68k/mvme136/startup/Makefile.in b/c/src/lib/libbsp/m68k/mvme136/startup/Makefile.in index 12fca968bc..c4f1163cf9 100644 --- a/c/src/lib/libbsp/m68k/mvme136/startup/Makefile.in +++ b/c/src/lib/libbsp/m68k/mvme136/startup/Makefile.in @@ -11,7 +11,7 @@ PROJECT_ROOT = @PROJECT_ROOT@ PGM=${ARCH}/startup.rel # C source names, if any, go here -- minus the .c -C_PIECES=bspclean bsppost bspstart main sbrk setvec +C_PIECES=bspclean bsplibc bsppost bspstart main sbrk setvec C_FILES=$(C_PIECES:%=%.c) C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) diff --git a/c/src/lib/libbsp/m68k/mvme136/startup/bspstart.c b/c/src/lib/libbsp/m68k/mvme136/startup/bspstart.c index 4f788eb5de..916aa3accd 100644 --- a/c/src/lib/libbsp/m68k/mvme136/startup/bspstart.c +++ b/c/src/lib/libbsp/m68k/mvme136/startup/bspstart.c @@ -1,14 +1,9 @@ -/* bsp_start() - * +/* * 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. * - * INPUT: NONE - * - * OUTPUT: NONE - * * COPYRIGHT (c) 1989-1998. * On-Line Applications Research Corporation (OAR). * Copyright assigned to U.S. Government, 1994. @@ -40,38 +35,12 @@ rtems_cpu_table Cpu_table; char *rtems_progname; -/* Initialize whatever libc we are using - * called from postdriver hook +/* + * Use the shared implementations of the following routines */ - -void bsp_libc_init() -{ - extern int end; - rtems_unsigned32 heap_start; - - heap_start = (rtems_unsigned32) &end; - if (heap_start & (CPU_ALIGNMENT-1)) - heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); - - RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0); - - /* - * Init the RTEMS libio facility to provide UNIX-like system - * calls for use by newlib (ie: provide __rtems_open, __rtems_close, etc) - * Uses malloc() to get area for the iops, so must be after malloc init - */ - - rtems_libio_init(); - - /* - * Set up for the libc handling. - */ - - if (BSP_Configuration.ticks_per_timeslice > 0) - libc_init(1); /* reentrant if possible */ - else - libc_init(0); /* non-reentrant */ -} + +void bsp_postdriver_hook(void); +void bsp_libc_init( void *, unsigned32, int ); /* * Function: bsp_pretasking_hook @@ -87,21 +56,28 @@ void bsp_libc_init() * */ -void -bsp_pretasking_hook(void) +void bsp_pretasking_hook(void) { - bsp_libc_init(); + extern int end; + rtems_unsigned32 heap_start; + + heap_start = (rtems_unsigned32) &end; + if (heap_start & (CPU_ALIGNMENT-1)) + heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); + + bsp_libc_init((void *) heap_start, 64 * 1024, 0); + #ifdef RTEMS_DEBUG rtems_debug_enable( RTEMS_DEBUG_ALL_MASK ); #endif } - + /* - * Use the shared bsp_postdriver_hook() implementation + * bsp_start + * + * This routine does the bulk of the system initialization. */ - -void bsp_postdriver_hook(void); void bsp_start( void ) { diff --git a/c/src/lib/libbsp/m68k/mvme147/startup/Makefile.in b/c/src/lib/libbsp/m68k/mvme147/startup/Makefile.in index 12fca968bc..c4f1163cf9 100644 --- a/c/src/lib/libbsp/m68k/mvme147/startup/Makefile.in +++ b/c/src/lib/libbsp/m68k/mvme147/startup/Makefile.in @@ -11,7 +11,7 @@ PROJECT_ROOT = @PROJECT_ROOT@ PGM=${ARCH}/startup.rel # C source names, if any, go here -- minus the .c -C_PIECES=bspclean bsppost bspstart main sbrk setvec +C_PIECES=bspclean bsplibc bsppost bspstart main sbrk setvec C_FILES=$(C_PIECES:%=%.c) C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) diff --git a/c/src/lib/libbsp/m68k/mvme147/startup/bspstart.c b/c/src/lib/libbsp/m68k/mvme147/startup/bspstart.c index 84089c17c8..47644874ae 100644 --- a/c/src/lib/libbsp/m68k/mvme147/startup/bspstart.c +++ b/c/src/lib/libbsp/m68k/mvme147/startup/bspstart.c @@ -1,14 +1,9 @@ -/* bsp_start() - * +/* * 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. * - * INPUT: NONE - * - * OUTPUT: NONE - * * COPYRIGHT (c) 1989-1998. * On-Line Applications Research Corporation (OAR). * Copyright assigned to U.S. Government, 1994. @@ -43,38 +38,12 @@ rtems_cpu_table Cpu_table; char *rtems_progname; -/* Initialize whatever libc we are using - * called from postdriver hook +/* + * Use the shared implementations of the following routines */ - -void bsp_libc_init() -{ - extern int end; - rtems_unsigned32 heap_start; - - heap_start = (rtems_unsigned32) &end; - if (heap_start & (CPU_ALIGNMENT-1)) - heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); - - RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0); - - /* - * Init the RTEMS libio facility to provide UNIX-like system - * calls for use by newlib (ie: provide __rtems_open, __rtems_close, etc) - * Uses malloc() to get area for the iops, so must be after malloc init - */ - - rtems_libio_init(); - - /* - * Set up for the libc handling. - */ - - if (BSP_Configuration.ticks_per_timeslice > 0) - libc_init(1); /* reentrant if possible */ - else - libc_init(0); /* non-reentrant */ -} + +void bsp_postdriver_hook(void); +void bsp_libc_init( void *, unsigned32, int ); /* * Function: bsp_pretasking_hook @@ -90,23 +59,28 @@ void bsp_libc_init() * */ -void -bsp_pretasking_hook(void) +void bsp_pretasking_hook(void) { - bsp_libc_init(); + extern int end; + rtems_unsigned32 heap_start; + + heap_start = (rtems_unsigned32) &end; + if (heap_start & (CPU_ALIGNMENT-1)) + heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); + + bsp_libc_init((void *) heap_start, 64 * 1024, 0); + #ifdef RTEMS_DEBUG rtems_debug_enable( RTEMS_DEBUG_ALL_MASK ); #endif } - /* - * Use the shared bsp_postdriver_hook() implementation + * bsp_start + * + * This routine does the bulk of the system initialization. */ - -void bsp_postdriver_hook(void); - void bsp_start( void ) { diff --git a/c/src/lib/libbsp/m68k/mvme147s/startup/Makefile.in b/c/src/lib/libbsp/m68k/mvme147s/startup/Makefile.in index f5cc3ccace..9f66729ad2 100644 --- a/c/src/lib/libbsp/m68k/mvme147s/startup/Makefile.in +++ b/c/src/lib/libbsp/m68k/mvme147s/startup/Makefile.in @@ -11,7 +11,7 @@ PROJECT_ROOT = @PROJECT_ROOT@ PGM=${ARCH}/startup.rel # C source names, if any, go here -- minus the .c -C_PIECES=bspclean bsppost bspstart main sbrk setvec +C_PIECES=bspclean bsplibc bsppost bspstart main sbrk setvec C_FILES=$(C_PIECES:%=%.c) C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) diff --git a/c/src/lib/libbsp/m68k/mvme147s/startup/bspstart.c b/c/src/lib/libbsp/m68k/mvme147s/startup/bspstart.c index 41d65d9ed3..2e61a621c0 100644 --- a/c/src/lib/libbsp/m68k/mvme147s/startup/bspstart.c +++ b/c/src/lib/libbsp/m68k/mvme147s/startup/bspstart.c @@ -1,14 +1,9 @@ -/* bsp_start() - * +/* * 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. * - * INPUT: NONE - * - * OUTPUT: NONE - * * COPYRIGHT (c) 1989-1998. * On-Line Applications Research Corporation (OAR). * Copyright assigned to U.S. Government, 1994. @@ -43,38 +38,12 @@ rtems_cpu_table Cpu_table; char *rtems_progname; -/* Initialize whatever libc we are using - * called from postdriver hook +/* + * Use the shared implementations of the following routines */ - -void bsp_libc_init() -{ - extern int end; - rtems_unsigned32 heap_start; - - heap_start = (rtems_unsigned32) &end; - if (heap_start & (CPU_ALIGNMENT-1)) - heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); - - RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0); - - /* - * Init the RTEMS libio facility to provide UNIX-like system - * calls for use by newlib (ie: provide __rtems_open, __rtems_close, etc) - * Uses malloc() to get area for the iops, so must be after malloc init - */ - - rtems_libio_init(); - - /* - * Set up for the libc handling. - */ - - if (BSP_Configuration.ticks_per_timeslice > 0) - libc_init(1); /* reentrant if possible */ - else - libc_init(0); /* non-reentrant */ -} + +void bsp_postdriver_hook(void); +void bsp_libc_init( void *, unsigned32, int ); /* * Function: bsp_pretasking_hook @@ -90,23 +59,27 @@ void bsp_libc_init() * */ -void -bsp_pretasking_hook(void) +void bsp_pretasking_hook(void) { - bsp_libc_init(); + extern int end; + rtems_unsigned32 heap_start; + + heap_start = (rtems_unsigned32) &end; + if (heap_start & (CPU_ALIGNMENT-1)) + heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); + + bsp_libc_init((void *) heap_start, 64 * 1024, 0); #ifdef RTEMS_DEBUG rtems_debug_enable( RTEMS_DEBUG_ALL_MASK ); #endif } - /* - * Use the shared bsp_postdriver_hook() implementation + * bsp_start + * + * This routine does the bulk of the system initialization. */ - -void bsp_postdriver_hook(void); - void bsp_start( void ) { diff --git a/c/src/lib/libbsp/m68k/mvme162/startup/Makefile.in b/c/src/lib/libbsp/m68k/mvme162/startup/Makefile.in index 181b4e11b7..b84caf0d2e 100644 --- a/c/src/lib/libbsp/m68k/mvme162/startup/Makefile.in +++ b/c/src/lib/libbsp/m68k/mvme162/startup/Makefile.in @@ -11,7 +11,7 @@ PROJECT_ROOT = @PROJECT_ROOT@ PGM=${ARCH}/startup.rel # C source names, if any, go here -- minus the .c -C_PIECES=bspclean bsppost bspstart main page_table sbrk setvec +C_PIECES=bspclean bsplibc bsppost bspstart main page_table sbrk setvec C_FILES=$(C_PIECES:%=%.c) C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) diff --git a/c/src/lib/libbsp/m68k/mvme162/startup/bspstart.c b/c/src/lib/libbsp/m68k/mvme162/startup/bspstart.c index 5fee790444..1e304b1a1d 100644 --- a/c/src/lib/libbsp/m68k/mvme162/startup/bspstart.c +++ b/c/src/lib/libbsp/m68k/mvme162/startup/bspstart.c @@ -1,14 +1,9 @@ -/* bsp_start() - * +/* * 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. * - * INPUT: NONE - * - * OUTPUT: NONE - * * COPYRIGHT (c) 1989-1998. * On-Line Applications Research Corporation (OAR). * Copyright assigned to U.S. Government, 1994. @@ -47,38 +42,12 @@ rtems_cpu_table Cpu_table; char *rtems_progname; -/* Initialize whatever libc we are using - * called from postdriver hook +/* + * Use the shared implementations of the following routines */ - -void bsp_libc_init() -{ - extern int end; - rtems_unsigned32 heap_start; - - heap_start = (rtems_unsigned32) &end; - if (heap_start & (CPU_ALIGNMENT-1)) - heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); - - RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0); - - /* - * Init the RTEMS libio facility to provide UNIX-like system - * calls for use by newlib (ie: provide __rtems_open, __rtems_close, etc) - * Uses malloc() to get area for the iops, so must be after malloc init - */ - - rtems_libio_init(); - - /* - * Set up for the libc handling. - */ - - if (BSP_Configuration.ticks_per_timeslice > 0) - libc_init(1); /* reentrant if possible */ - else - libc_init(0); /* non-reentrant */ -} + +void bsp_postdriver_hook(void); +void bsp_libc_init( void *, unsigned32, int ); /* * Function: bsp_pretasking_hook @@ -94,23 +63,27 @@ void bsp_libc_init() * */ -void -bsp_pretasking_hook(void) +void bsp_pretasking_hook(void) { - bsp_libc_init(); + extern int end; + rtems_unsigned32 heap_start; + + heap_start = (rtems_unsigned32) &end; + if (heap_start & (CPU_ALIGNMENT-1)) + heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); + + bsp_libc_init((void *) heap_start, 64 * 1024, 0); #ifdef RTEMS_DEBUG rtems_debug_enable( RTEMS_DEBUG_ALL_MASK ); #endif } - /* - * Use the shared bsp_postdriver_hook() implementation + * bsp_start + * + * This routine does the bulk of the system initialization. */ - -void bsp_postdriver_hook(void); - void bsp_start( void ) { diff --git a/c/src/lib/libbsp/m68k/ods68302/startup/Makefile.in b/c/src/lib/libbsp/m68k/ods68302/startup/Makefile.in index b93dbf526d..26fa0b954a 100644 --- a/c/src/lib/libbsp/m68k/ods68302/startup/Makefile.in +++ b/c/src/lib/libbsp/m68k/ods68302/startup/Makefile.in @@ -12,7 +12,7 @@ PGM=${ARCH}/startup.rel # C source names, if any, go here -- minus the .c C_PIECES=crc debugport gdb-hooks main m68302scc m68k-stub memcheck trace \ - bsppost bspstart bspclean sbrk setvec + bsplibc bsppost bspstart bspclean sbrk setvec C_FILES=$(C_PIECES:%=%.c) C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) diff --git a/c/src/lib/libbsp/m68k/ods68302/startup/bspstart.c b/c/src/lib/libbsp/m68k/ods68302/startup/bspstart.c index e2d777b326..4b25d1bc96 100644 --- a/c/src/lib/libbsp/m68k/ods68302/startup/bspstart.c +++ b/c/src/lib/libbsp/m68k/ods68302/startup/bspstart.c @@ -1,14 +1,9 @@ -/* bsp_start() - * +/* * 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. * - * INPUT: NONE - * - * OUTPUT: NONE - * * COPYRIGHT (c) 1989-1998. * On-Line Applications Research Corporation (OAR). * Copyright assigned to U.S. Government, 1994. @@ -40,45 +35,12 @@ rtems_interrupt_level bsp_isr_level; char *rtems_progname; -/* Initialize whatever libc we are using - * called from postdriver hook +/* + * Use the shared implementations of the following routines */ - -void bsp_libc_init() -{ - extern int end; - rtems_unsigned32 heap_start; - - heap_start = (rtems_unsigned32) &end; - if (heap_start & (CPU_ALIGNMENT-1)) - heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); - - /* - * The last parameter to RTEMS_Malloc_Initialize is the "chunk" - * size which a multiple of will be requested on each sbrk() - * call by malloc(). A value of 0 indicates that sbrk() should - * not be called to extend the heap. - */ - - RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0); - - /* - * Init the RTEMS libio facility to provide UNIX-like system - * calls for use by newlib (ie: provide __rtems_open, __rtems_close, etc) - * Uses malloc() to get area for the iops, so must be after malloc init - */ - - rtems_libio_init(); - - /* - * Set up for the libc handling. - */ - - if (BSP_Configuration.ticks_per_timeslice > 0) - libc_init(1); /* reentrant if possible */ - else - libc_init(0); /* non-reentrant */ -} + +void bsp_postdriver_hook(void); +void bsp_libc_init( void *, unsigned32, int ); /* * Function: bsp_pretasking_hook @@ -94,22 +56,27 @@ void bsp_libc_init() * */ -void -bsp_pretasking_hook(void) +void bsp_pretasking_hook(void) { - bsp_libc_init(); + extern int end; + rtems_unsigned32 heap_start; + + heap_start = (rtems_unsigned32) &end; + if (heap_start & (CPU_ALIGNMENT-1)) + heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); + + bsp_libc_init((void *) heap_start, 64 * 1024, 0); #ifdef RTEMS_DEBUG rtems_debug_enable( RTEMS_DEBUG_ALL_MASK ); #endif } - /* - * Use the shared bsp_postdriver_hook() implementation + * bsp_start + * + * This routine does the bulk of the system initialization. */ - -void bsp_postdriver_hook(void); void bsp_start( void ) { diff --git a/c/src/lib/libbsp/mips/p4000/startup/bspstart.c b/c/src/lib/libbsp/mips/p4000/startup/bspstart.c index 9df5b4e435..6a3b4378b4 100644 --- a/c/src/lib/libbsp/mips/p4000/startup/bspstart.c +++ b/c/src/lib/libbsp/mips/p4000/startup/bspstart.c @@ -1,14 +1,9 @@ -/* bsp_start() - * +/* * 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. * - * INPUT: NONE - * - * OUTPUT: NONE - * * COPYRIGHT (c) 1989-1998. * On-Line Applications Research Corporation (OAR). * Copyright assigned to U.S. Government, 1994. @@ -48,47 +43,12 @@ rtems_cpu_table Cpu_table; char *rtems_progname; -/* Initialize whatever libc we are using - * called from postdriver hook +/* + * Use the shared implementations of the following routines */ - -#define LIBC_HEAP_SIZE (64 * 1024) - -void bsp_libc_init() -{ - extern int end; - rtems_unsigned32 heap_start; - - heap_start = (rtems_unsigned32) &end; - if (heap_start & (CPU_ALIGNMENT-1)) - heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); - - /* - * The last parameter to RTEMS_Malloc_Initialize is the "chunk" - * size which a multiple of will be requested on each sbrk() - * call by malloc(). A value of 0 indicates that sbrk() should - * not be called to extend the heap. - */ - - RTEMS_Malloc_Initialize((void *) heap_start, LIBC_HEAP_SIZE, 0); - - /* - * Init the RTEMS libio facility to provide UNIX-like system - * calls for use by newlib (ie: provide __rtems_open, __rtems_close, etc) - * Uses malloc() to get area for the iops, so must be after malloc init - */ - - rtems_libio_init(); - - /* - * Set up for the libc handling. - */ - - if (BSP_Configuration.ticks_per_timeslice > 0) - libc_init(1); /* reentrant if possible */ - else - libc_init(0); /* non-reentrant */ -} + +void bsp_postdriver_hook(void); +void bsp_libc_init( void *, unsigned32, int ); /* * Function: bsp_pretasking_hook @@ -104,23 +64,31 @@ void bsp_libc_init() * */ -void -bsp_pretasking_hook(void) +#define LIBC_HEAP_SIZE (64 * 1024) + +void bsp_pretasking_hook(void) { - bsp_libc_init(); - + extern int end; + rtems_unsigned32 heap_start; + + heap_start = (rtems_unsigned32) &end; + if (heap_start & (CPU_ALIGNMENT-1)) + heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); + + bsp_libc_init((void *) heap_start, LIBC_HEAP_SIZE, 0); + #ifdef RTEMS_DEBUG rtems_debug_enable( RTEMS_DEBUG_ALL_MASK ); #endif } +extern int end; /* defined by linker */ + /* - * Use the shared bsp_postdriver_hook() implementation + * bsp_start + * + * This routine does the bulk of the system initialization. */ - -void bsp_postdriver_hook(void); - -extern int end; /* defined by linker */ void bsp_start( void ) { diff --git a/c/src/lib/libbsp/mips64orion/p4000/startup/Makefile.in b/c/src/lib/libbsp/mips64orion/p4000/startup/Makefile.in index 31dd61d319..5a09532841 100644 --- a/c/src/lib/libbsp/mips64orion/p4000/startup/Makefile.in +++ b/c/src/lib/libbsp/mips64orion/p4000/startup/Makefile.in @@ -11,7 +11,7 @@ PROJECT_ROOT = @PROJECT_ROOT@ PGM=${ARCH}/startup.rel # C source names, if any, go here -- minus the .c -C_PIECES=bspclean bsppost bspstart main sbrk setvec inittlb +C_PIECES=bspclean bsplibc bsppost bspstart main sbrk setvec inittlb C_FILES=$(C_PIECES:%=%.c) C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) diff --git a/c/src/lib/libbsp/mips64orion/p4000/startup/bspstart.c b/c/src/lib/libbsp/mips64orion/p4000/startup/bspstart.c index 9df5b4e435..6a3b4378b4 100644 --- a/c/src/lib/libbsp/mips64orion/p4000/startup/bspstart.c +++ b/c/src/lib/libbsp/mips64orion/p4000/startup/bspstart.c @@ -1,14 +1,9 @@ -/* bsp_start() - * +/* * 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. * - * INPUT: NONE - * - * OUTPUT: NONE - * * COPYRIGHT (c) 1989-1998. * On-Line Applications Research Corporation (OAR). * Copyright assigned to U.S. Government, 1994. @@ -48,47 +43,12 @@ rtems_cpu_table Cpu_table; char *rtems_progname; -/* Initialize whatever libc we are using - * called from postdriver hook +/* + * Use the shared implementations of the following routines */ - -#define LIBC_HEAP_SIZE (64 * 1024) - -void bsp_libc_init() -{ - extern int end; - rtems_unsigned32 heap_start; - - heap_start = (rtems_unsigned32) &end; - if (heap_start & (CPU_ALIGNMENT-1)) - heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); - - /* - * The last parameter to RTEMS_Malloc_Initialize is the "chunk" - * size which a multiple of will be requested on each sbrk() - * call by malloc(). A value of 0 indicates that sbrk() should - * not be called to extend the heap. - */ - - RTEMS_Malloc_Initialize((void *) heap_start, LIBC_HEAP_SIZE, 0); - - /* - * Init the RTEMS libio facility to provide UNIX-like system - * calls for use by newlib (ie: provide __rtems_open, __rtems_close, etc) - * Uses malloc() to get area for the iops, so must be after malloc init - */ - - rtems_libio_init(); - - /* - * Set up for the libc handling. - */ - - if (BSP_Configuration.ticks_per_timeslice > 0) - libc_init(1); /* reentrant if possible */ - else - libc_init(0); /* non-reentrant */ -} + +void bsp_postdriver_hook(void); +void bsp_libc_init( void *, unsigned32, int ); /* * Function: bsp_pretasking_hook @@ -104,23 +64,31 @@ void bsp_libc_init() * */ -void -bsp_pretasking_hook(void) +#define LIBC_HEAP_SIZE (64 * 1024) + +void bsp_pretasking_hook(void) { - bsp_libc_init(); - + extern int end; + rtems_unsigned32 heap_start; + + heap_start = (rtems_unsigned32) &end; + if (heap_start & (CPU_ALIGNMENT-1)) + heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); + + bsp_libc_init((void *) heap_start, LIBC_HEAP_SIZE, 0); + #ifdef RTEMS_DEBUG rtems_debug_enable( RTEMS_DEBUG_ALL_MASK ); #endif } +extern int end; /* defined by linker */ + /* - * Use the shared bsp_postdriver_hook() implementation + * bsp_start + * + * This routine does the bulk of the system initialization. */ - -void bsp_postdriver_hook(void); - -extern int end; /* defined by linker */ void bsp_start( void ) { diff --git a/c/src/lib/libbsp/no_cpu/no_bsp/startup/Makefile.in b/c/src/lib/libbsp/no_cpu/no_bsp/startup/Makefile.in index 446b287d3a..73bea20865 100644 --- a/c/src/lib/libbsp/no_cpu/no_bsp/startup/Makefile.in +++ b/c/src/lib/libbsp/no_cpu/no_bsp/startup/Makefile.in @@ -11,7 +11,7 @@ PROJECT_ROOT = @PROJECT_ROOT@ PGM=${ARCH}/startup.rel # C source names, if any, go here -- minus the .c -C_PIECES=bspclean bsppost bspstart main sbrk setvec +C_PIECES=bspclean bsplibc bsppost bspstart main sbrk setvec C_FILES=$(C_PIECES:%=%.c) C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) diff --git a/c/src/lib/libbsp/no_cpu/no_bsp/startup/bspstart.c b/c/src/lib/libbsp/no_cpu/no_bsp/startup/bspstart.c index 4a7829eab5..4d3b896307 100644 --- a/c/src/lib/libbsp/no_cpu/no_bsp/startup/bspstart.c +++ b/c/src/lib/libbsp/no_cpu/no_bsp/startup/bspstart.c @@ -1,14 +1,9 @@ -/* bsp_start() - * +/* * 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. * - * INPUT: NONE - * - * OUTPUT: NONE - * * COPYRIGHT (c) 1989-1998. * On-Line Applications Research Corporation (OAR). * Copyright assigned to U.S. Government, 1994. @@ -40,45 +35,12 @@ rtems_cpu_table Cpu_table; char *rtems_progname; -/* Initialize whatever libc we are using - * called from postdriver hook +/* + * Use the shared implementations of the following routines */ - -void bsp_libc_init() -{ - extern int end; - rtems_unsigned32 heap_start; - - heap_start = (rtems_unsigned32) &end; - if (heap_start & (CPU_ALIGNMENT-1)) - heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); - - /* - * The last parameter to RTEMS_Malloc_Initialize is the "chunk" - * size which a multiple of will be requested on each sbrk() - * call by malloc(). A value of 0 indicates that sbrk() should - * not be called to extend the heap. - */ - - RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0); - - /* - * Init the RTEMS libio facility to provide UNIX-like system - * calls for use by newlib (ie: provide __rtems_open, __rtems_close, etc) - * Uses malloc() to get area for the iops, so must be after malloc init - */ - - rtems_libio_init(); - - /* - * Set up for the libc handling. - */ - - if (BSP_Configuration.ticks_per_timeslice > 0) - libc_init(1); /* reentrant if possible */ - else - libc_init(0); /* non-reentrant */ -} + +void bsp_postdriver_hook(void); +void bsp_libc_init( void *, unsigned32, int ); /* * Function: bsp_pretasking_hook @@ -94,22 +56,27 @@ void bsp_libc_init() * */ -void -bsp_pretasking_hook(void) +void bsp_pretasking_hook(void) { - bsp_libc_init(); - + extern int end; + rtems_unsigned32 heap_start; + + heap_start = (rtems_unsigned32) &end; + if (heap_start & (CPU_ALIGNMENT-1)) + heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); + + bsp_libc_init((void *) heap_start, 64 * 1024, 0); + #ifdef RTEMS_DEBUG rtems_debug_enable( RTEMS_DEBUG_ALL_MASK ); #endif } - /* - * Use the shared bsp_postdriver_hook() implementation + * bsp_start + * + * This routine does the bulk of the system initialization. */ - -void bsp_postdriver_hook(void); int bsp_start( int argc, diff --git a/c/src/lib/libbsp/powerpc/papyrus/startup/Makefile.in b/c/src/lib/libbsp/powerpc/papyrus/startup/Makefile.in index d4552cdf00..aa59a2c153 100644 --- a/c/src/lib/libbsp/powerpc/papyrus/startup/Makefile.in +++ b/c/src/lib/libbsp/powerpc/papyrus/startup/Makefile.in @@ -11,7 +11,7 @@ PROJECT_ROOT = @PROJECT_ROOT@ PGM=${ARCH}/startup.rel # C source names, if any, go here -- minus the .c -C_PIECES=bspclean bsppost bspstart main sbrk setvec +C_PIECES=bspclean bsplibc bsppost bspstart main sbrk setvec C_FILES=$(C_PIECES:%=%.c) C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) diff --git a/c/src/lib/libbsp/powerpc/papyrus/startup/bspstart.c b/c/src/lib/libbsp/powerpc/papyrus/startup/bspstart.c index dc4e8c1f67..0765a0bd8e 100644 --- a/c/src/lib/libbsp/powerpc/papyrus/startup/bspstart.c +++ b/c/src/lib/libbsp/powerpc/papyrus/startup/bspstart.c @@ -1,14 +1,10 @@ -/* bsp_start() +/* * * 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. * - * INPUT: NONE - * - * OUTPUT: NONE - * * Author: Andrew Bray * * COPYRIGHT (c) 1995 by i-cubed ltd. @@ -57,46 +53,12 @@ rtems_cpu_table Cpu_table; char *rtems_progname; -/* Initialize whatever libc we are using - * called from postdriver hook +/* + * Use the shared implementations of the following routines */ - -void bsp_libc_init() -{ - extern int _end; - rtems_unsigned32 heap_start; - - heap_start = (rtems_unsigned32) &_end; - if (heap_start & (CPU_ALIGNMENT-1)) - heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); - - /* - * The last parameter to RTEMS_Malloc_Initialize is the "chunk" - * size which a multiple of will be requested on each sbrk() - * call by malloc(). A value of 0 indicates that sbrk() should - * not be called to extend the heap. - */ - - RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0); - - /* - * Init the RTEMS libio facility to provide UNIX-like system - * calls for use by newlib (ie: provide __rtems_open, __rtems_close, etc) - * Uses malloc() to get area for the iops, so must be after malloc init - */ - - rtems_libio_init(); - - /* - * Set up for the libc handling. - */ - - if (BSP_Configuration.ticks_per_timeslice > 0) - libc_init(1); /* reentrant if possible */ - else - libc_init(0); /* non-reentrant */ - -} + +void bsp_postdriver_hook(void); +void bsp_libc_init( void *, unsigned32, int ); /* * Function: bsp_pretasking_hook @@ -112,23 +74,27 @@ void bsp_libc_init() * */ -void -bsp_pretasking_hook(void) +void bsp_pretasking_hook(void) { - bsp_libc_init(); + extern int _end; + rtems_unsigned32 heap_start; + + heap_start = (rtems_unsigned32) &_end; + if (heap_start & (CPU_ALIGNMENT-1)) + heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); + + bsp_libc_init((void *) heap_start, 64 * 1024, 0); #ifdef RTEMS_DEBUG rtems_debug_enable( RTEMS_DEBUG_ALL_MASK ); #endif } - /* - * Use the shared bsp_postdriver_hook() implementation + * bsp_start + * + * This routine does the bulk of the system initialization. */ - -void bsp_postdriver_hook(void); - void bsp_start( void ) { diff --git a/c/src/lib/libbsp/powerpc/psim/clock/clock.c b/c/src/lib/libbsp/powerpc/psim/clock/clock.c index cc57e3ed7d..282820fafe 100644 --- a/c/src/lib/libbsp/powerpc/psim/clock/clock.c +++ b/c/src/lib/libbsp/powerpc/psim/clock/clock.c @@ -6,13 +6,13 @@ * The tick frequency is directly programmed to the configured number of * microseconds per tick. * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994, 1997. + * COPYRIGHT (c) 1989-1998. * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. + * Copyright assigned to U.S. Government, 1994. * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. + * The license and distribution terms for this file may be + * found in found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. * * $Id$ */ diff --git a/c/src/lib/libbsp/powerpc/psim/include/bsp.h b/c/src/lib/libbsp/powerpc/psim/include/bsp.h index f600579b00..28de2d66dd 100644 --- a/c/src/lib/libbsp/powerpc/psim/include/bsp.h +++ b/c/src/lib/libbsp/powerpc/psim/include/bsp.h @@ -19,13 +19,13 @@ * * Derived from c/src/lib/libbsp/no_cpu/no_bsp/include/bsp.h * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * COPYRIGHT (c) 1989-1998. * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. + * Copyright assigned to U.S. Government, 1994. * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. + * The license and distribution terms for this file may be + * found in found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. * * $Id$ */ diff --git a/c/src/lib/libbsp/powerpc/psim/include/coverhd.h b/c/src/lib/libbsp/powerpc/psim/include/coverhd.h index 4a2fe8b24b..cc279ea56f 100644 --- a/c/src/lib/libbsp/powerpc/psim/include/coverhd.h +++ b/c/src/lib/libbsp/powerpc/psim/include/coverhd.h @@ -14,13 +14,13 @@ * NOTE: If these are all zero, then the times reported include * all calling overhead including passing of arguments. * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * COPYRIGHT (c) 1989-1998. * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. + * Copyright assigned to U.S. Government, 1994. * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. + * The license and distribution terms for this file may be + * found in found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. * * $Id$ */ diff --git a/c/src/lib/libbsp/powerpc/psim/shmsupp/README b/c/src/lib/libbsp/powerpc/psim/shmsupp/README index 3c82078bac..f355851c74 100644 --- a/c/src/lib/libbsp/powerpc/psim/shmsupp/README +++ b/c/src/lib/libbsp/powerpc/psim/shmsupp/README @@ -3,4 +3,5 @@ # This shared memory driver support code works with a modified version -of the PowerPC Sim +of the PowerPC Simulator. The modifications are not yet merged +into the mainsteam distribution. diff --git a/c/src/lib/libbsp/powerpc/psim/shmsupp/addrconv.c b/c/src/lib/libbsp/powerpc/psim/shmsupp/addrconv.c index 3e1f16ec81..05c0b6f6c1 100644 --- a/c/src/lib/libbsp/powerpc/psim/shmsupp/addrconv.c +++ b/c/src/lib/libbsp/powerpc/psim/shmsupp/addrconv.c @@ -8,12 +8,12 @@ * Output parameters: * returns - converted address * - * COPYRIGHT (c) 1989-1997. + * COPYRIGHT (c) 1989-1998. * On-Line Applications Research Corporation (OAR). * Copyright assigned to U.S. Government, 1994. * - * The license and distribution terms for this file may in - * the file LICENSE in this distribution or at + * The license and distribution terms for this file may be + * found in found in the file LICENSE in this distribution or at * http://www.OARcorp.com/rtems/license.html. * * $Id$ diff --git a/c/src/lib/libbsp/powerpc/psim/shmsupp/getcfg.c b/c/src/lib/libbsp/powerpc/psim/shmsupp/getcfg.c index 5f94744a2f..fa37ceb7fa 100644 --- a/c/src/lib/libbsp/powerpc/psim/shmsupp/getcfg.c +++ b/c/src/lib/libbsp/powerpc/psim/shmsupp/getcfg.c @@ -12,12 +12,12 @@ * * NOTES: No interrupt support. * - * COPYRIGHT (c) 1989-1997. + * COPYRIGHT (c) 1989-1998. * On-Line Applications Research Corporation (OAR). * Copyright assigned to U.S. Government, 1994. * - * The license and distribution terms for this file may in - * the file LICENSE in this distribution or at + * The license and distribution terms for this file may be + * found in found in the file LICENSE in this distribution or at * http://www.OARcorp.com/rtems/license.html. * * $Id$ diff --git a/c/src/lib/libbsp/powerpc/psim/startup/Makefile.in b/c/src/lib/libbsp/powerpc/psim/startup/Makefile.in index b7b98d2278..8ae332fa12 100644 --- a/c/src/lib/libbsp/powerpc/psim/startup/Makefile.in +++ b/c/src/lib/libbsp/powerpc/psim/startup/Makefile.in @@ -11,7 +11,7 @@ PROJECT_ROOT = @PROJECT_ROOT@ PGM=${ARCH}/startup.rel # C source names, if any, go here -- minus the .c -C_PIECES=bspclean bsppost bspstart main sbrk setvec +C_PIECES=bspclean bsplibc bsppost bspstart main sbrk setvec C_FILES=$(C_PIECES:%=%.c) C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) diff --git a/c/src/lib/libbsp/powerpc/psim/startup/bspstart.c b/c/src/lib/libbsp/powerpc/psim/startup/bspstart.c index e5ce965b43..9deea041c6 100644 --- a/c/src/lib/libbsp/powerpc/psim/startup/bspstart.c +++ b/c/src/lib/libbsp/powerpc/psim/startup/bspstart.c @@ -1,19 +1,16 @@ -/* bspstart.c - * +/* * This set of routines starts the application. It includes application, * board, and monitor specific initialization and configuration. * The generic CPU dependent initialization has been performed * before any of these are invoked. * - * Called by RTEMS::RTEMS constructor in rtems-ctor.cc - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994, 1997. + * COPYRIGHT (c) 1989-1998. * On-Line Applications Research Corporation (OAR). * All rights assigned to U.S. Government, 1994. * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. + * 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$ */ @@ -68,9 +65,10 @@ rtems_unsigned32 CPU_PPC_CLICKS_PER_TICK; * approximately 5 seconds of wall time. */ -rtems_extension -fast_idle_switch_hook(rtems_tcb *current_task, - rtems_tcb *heir_task) +rtems_extension fast_idle_switch_hook( + rtems_tcb *current_task, + rtems_tcb *heir_task +) { static rtems_unsigned32 normal_clock = ~0; static rtems_unsigned32 fast_clock; @@ -100,12 +98,20 @@ fast_idle_switch_hook(rtems_tcb *current_task, #endif /* - * bsp_libc_init + * Use the shared implementations of the following routines + */ + +void bsp_postdriver_hook(void); +void bsp_libc_init( void *, unsigned32, int ); + +/* + * bsp_pretasking_hook * - * Initialize whatever libc we are using called from bsp_postdriver_hook. + * BSP pretasking hook. Called just before drivers are initialized. + * Used to setup libc and install any BSP extensions. */ -void bsp_libc_init(void) +void bsp_pretasking_hook(void) { extern int end; rtems_unsigned32 heap_start; @@ -118,38 +124,7 @@ void bsp_libc_init(void) heap_size = BSP_Configuration.work_space_start - (void *)&end; heap_size &= 0xfffffff0; /* keep it as a multiple of 16 bytes */ - RTEMS_Malloc_Initialize((void *) heap_start, heap_size, 0); - - /* - * Init the RTEMS libio facility to provide UNIX-like system - * calls for use by newlib (ie: provide __rtems_open, __rtems_close, etc) - * Uses malloc() to get area for the iops, so must be after malloc init - */ - - rtems_libio_init(); - - /* - * Set up for the libc handling. - */ - - if (BSP_Configuration.ticks_per_timeslice > 0) - libc_init(1); /* reentrant if possible */ - else - libc_init(0); /* non-reentrant */ - -} - - -/* - * bsp_pretasking_hook - * - * BSP pretasking hook. Called just before drivers are initialized. - * Used to setup libc and install any BSP extensions. - */ - -void bsp_pretasking_hook(void) -{ - bsp_libc_init(); + bsp_libc_init((void *) heap_start, heap_size, 0); #if PSIM_FAST_IDLE /* @@ -187,12 +162,6 @@ void bsp_pretasking_hook(void) } -/* - * Use the shared bsp_postdriver_hook() implementation - */ - -void bsp_postdriver_hook(void); - /* * bsp_start * diff --git a/c/src/lib/libbsp/powerpc/psim/startup/linkcmds b/c/src/lib/libbsp/powerpc/psim/startup/linkcmds index 467d982812..c43cbee273 100644 --- a/c/src/lib/libbsp/powerpc/psim/startup/linkcmds +++ b/c/src/lib/libbsp/powerpc/psim/startup/linkcmds @@ -1,3 +1,16 @@ +/* + * + * COPYRIGHT (c) 1989-1998. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may be + * found in found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc") OUTPUT_ARCH(powerpc) diff --git a/c/src/lib/libbsp/powerpc/psim/startup/setvec.c b/c/src/lib/libbsp/powerpc/psim/startup/setvec.c index efb3e9d8e0..dcdd94c665 100644 --- a/c/src/lib/libbsp/powerpc/psim/startup/setvec.c +++ b/c/src/lib/libbsp/powerpc/psim/startup/setvec.c @@ -29,13 +29,13 @@ * * Derived from c/src/lib/libbsp/no_cpu/no_bsp/startup/setvec.c: * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * COPYRIGHT (c) 1989-1998. * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. + * Copyright assigned to U.S. Government, 1994. * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. + * The license and distribution terms for this file may be + * found in found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. * * $Id$ */ diff --git a/c/src/lib/libbsp/powerpc/psim/timer/timer.c b/c/src/lib/libbsp/powerpc/psim/timer/timer.c index 43c71103c1..7214de8232 100644 --- a/c/src/lib/libbsp/powerpc/psim/timer/timer.c +++ b/c/src/lib/libbsp/powerpc/psim/timer/timer.c @@ -3,13 +3,13 @@ * This file implements a benchmark timer using the General Purpose Timer on * the MEC. * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * COPYRIGHT (c) 1989-1998. * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. + * Copyright assigned to U.S. Government, 1994. * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. + * The license and distribution terms for this file may be + * found in found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. * * Ported to ERC32 implementation of the SPARC by On-Line Applications * Research Corporation (OAR) under contract to the European Space diff --git a/c/src/lib/libbsp/powerpc/psim/tools/psim b/c/src/lib/libbsp/powerpc/psim/tools/psim index 8ff6b7337c..abd80cbe08 100755 --- a/c/src/lib/libbsp/powerpc/psim/tools/psim +++ b/c/src/lib/libbsp/powerpc/psim/tools/psim @@ -2,6 +2,14 @@ # # Shell script to ease invocation of the powerpc simulator # +# COPYRIGHT (c) 1989-1998. +# On-Line Applications Research Corporation (OAR). +# Copyright assigned to U.S. Government, 1994. +# +# The license and distribution terms for this file may be +# found in found in the file LICENSE in this distribution or at +# http://www.OARcorp.com/rtems/license.html. +# # $Id$ # diff --git a/c/src/lib/libbsp/powerpc/psim/tools/runtest b/c/src/lib/libbsp/powerpc/psim/tools/runtest index eea6b2ac6a..f0aeae0268 100755 --- a/c/src/lib/libbsp/powerpc/psim/tools/runtest +++ b/c/src/lib/libbsp/powerpc/psim/tools/runtest @@ -1,12 +1,20 @@ #!/bin/sh -p # -# $Id$ -# # Run rtems tests on the powerpc simulator # This program generates a simulator script to run each test # Typically the test is then run, although it can be generated # and left as a file using -s # +# COPYRIGHT (c) 1989-1998. +# On-Line Applications Research Corporation (OAR). +# Copyright assigned to U.S. Government, 1994. +# +# The license and distribution terms for this file may be +# found in found in the file LICENSE in this distribution or at +# http://www.OARcorp.com/rtems/license.html. +# +# $Id$ +# # progname=`basename $0` progname=${0##*/} # fast basename hack for ksh, bash diff --git a/c/src/lib/libbsp/powerpc/psim/vectors/vectors.s b/c/src/lib/libbsp/powerpc/psim/vectors/vectors.s index 3384e9929e..448e9117e2 100644 --- a/c/src/lib/libbsp/powerpc/psim/vectors/vectors.s +++ b/c/src/lib/libbsp/powerpc/psim/vectors/vectors.s @@ -1,8 +1,17 @@ /* vectors.s 1.1 - 95/12/04 * * This file contains the assembly code for the PowerPC - * interrupt veneers for RTEMS. + * interrupt vectors for RTEMS. * + * COPYRIGHT (c) 1989-1998. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may be + * found in found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ */ /* @@ -21,8 +30,6 @@ * The variable 'PPC_VECTOR_FILE_BASE' must be defined to be the * offset from 0x????0000 to the first location in the file. This * will usually be 0x0000 or 0x0100. - * - * $Id$ */ #include "asm.h" diff --git a/c/src/lib/libbsp/sh/gensh1/startup/Makefile.in b/c/src/lib/libbsp/sh/gensh1/startup/Makefile.in index bf265a742e..52be4a84fb 100644 --- a/c/src/lib/libbsp/sh/gensh1/startup/Makefile.in +++ b/c/src/lib/libbsp/sh/gensh1/startup/Makefile.in @@ -11,7 +11,7 @@ PROJECT_ROOT = @PROJECT_ROOT@ PGM=${ARCH}/startup.rel # C source names, if any, go here -- minus the .c -C_PIECES=bsppost bspstart bspclean sbrk setvec main +C_PIECES=bsplibc bsppost bspstart bspclean sbrk setvec main C_FILES=$(C_PIECES:%=%.c) C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) diff --git a/c/src/lib/libbsp/sh/gensh1/startup/bspstart.c b/c/src/lib/libbsp/sh/gensh1/startup/bspstart.c index 72c2ec8bf0..dc25759d47 100644 --- a/c/src/lib/libbsp/sh/gensh1/startup/bspstart.c +++ b/c/src/lib/libbsp/sh/gensh1/startup/bspstart.c @@ -1,14 +1,9 @@ -/* bsp_start() - * +/* * 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. * - * INPUT: NONE - * - * OUTPUT: NONE - * * Authors: Ralf Corsepius (corsepiu@faw.uni-ulm.de) and * Bernd Becker (becker@faw.uni-ulm.de) * @@ -50,39 +45,12 @@ rtems_cpu_table Cpu_table; char *rtems_progname; -/* Initialize whatever libc we are using - * called from postdriver hook +/* + * Use the shared implementations of the following routines */ - - -void bsp_libc_init() -{ - /* - * The last parameter to RTEMS_Malloc_Initialize is the "chunk" - * size which a multiple of will be requested on each sbrk() - * call by malloc(). A value of 0 indicates that sbrk() should - * not be called to extend the heap. - */ - - RTEMS_Malloc_Initialize(&HeapStart, sizeof(unsigned32) * (&HeapEnd - &HeapStart), 0); - - /* - * Init the RTEMS libio facility to provide UNIX-like system - * calls for use by newlib (ie: provide __rtems_open, __rtems_close, etc) - * Uses malloc() to get area for the iops, so must be after malloc init - */ - - rtems_libio_init(); - - /* - * Set up for the libc handling. - */ - - if (BSP_Configuration.ticks_per_timeslice > 0) - libc_init(1); /* reentrant if possible */ - else - libc_init(0); /* non-reentrant */ -} + +void bsp_postdriver_hook(void); +void bsp_libc_init( void *, unsigned32, int ); /* * Function: bsp_pretasking_hook @@ -97,10 +65,9 @@ void bsp_libc_init() * */ -void -bsp_pretasking_hook(void) +void bsp_pretasking_hook(void) { - bsp_libc_init(); + bsp_libc_init((&HeapStart, sizeof(unsigned32) * (&HeapEnd - &HeapStart), 0); #ifdef RTEMS_DEBUG rtems_debug_enable( RTEMS_DEBUG_ALL_MASK ); @@ -108,11 +75,10 @@ bsp_pretasking_hook(void) } /* - * Use the shared bsp_postdriver_hook() implementation + * bsp_start + * + * This routine does the bulk of the system initialization. */ - -void bsp_postdriver_hook(void); - void bsp_start(void) { diff --git a/c/src/lib/libbsp/sparc/erc32/startup/Makefile.in b/c/src/lib/libbsp/sparc/erc32/startup/Makefile.in index bf4fcf17f4..1ef823537b 100644 --- a/c/src/lib/libbsp/sparc/erc32/startup/Makefile.in +++ b/c/src/lib/libbsp/sparc/erc32/startup/Makefile.in @@ -11,7 +11,7 @@ PROJECT_ROOT = @PROJECT_ROOT@ PGM=${ARCH}/startup.rel # C source names, if any, go here -- minus the .c -C_PIECES=bspclean bsppost bspstart main sbrk setvec spurious +C_PIECES=bspclean bsplibc bsppost bspstart main sbrk setvec spurious C_FILES=$(C_PIECES:%=%.c) C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) diff --git a/c/src/lib/libbsp/sparc/erc32/startup/bspstart.c b/c/src/lib/libbsp/sparc/erc32/startup/bspstart.c index 6c5e466889..166fe3cfac 100644 --- a/c/src/lib/libbsp/sparc/erc32/startup/bspstart.c +++ b/c/src/lib/libbsp/sparc/erc32/startup/bspstart.c @@ -1,12 +1,9 @@ -/* bspstart.c - * +/* * This set of routines starts the application. It includes application, * board, and monitor specific initialization and configuration. * The generic CPU dependent initialization has been performed * before any of these are invoked. * - * Called by RTEMS::RTEMS constructor in rtems-ctor.cc - * * COPYRIGHT (c) 1989-1998. * On-Line Applications Research Corporation (OAR). * Copyright assigned to U.S. Government, 1994. @@ -41,7 +38,6 @@ extern rtems_configuration_table Configuration; rtems_configuration_table BSP_Configuration; rtems_cpu_table Cpu_table; -rtems_unsigned32 bsp_isr_level; /* * Tells us where to put the workspace in case remote debugger is present. @@ -72,9 +68,10 @@ rtems_unsigned32 CPU_SPARC_CLICKS_PER_TICK; * approximately 5 seconds of wall time. */ -rtems_extension -fast_idle_switch_hook(rtems_tcb *current_task, - rtems_tcb *heir_task) +rtems_extension fast_idle_switch_hook( + rtems_tcb *current_task, + rtems_tcb *heir_task +) { static rtems_unsigned32 normal_clock = ~0; static rtems_unsigned32 fast_clock; @@ -101,12 +98,20 @@ fast_idle_switch_hook(rtems_tcb *current_task, #endif /* - * bsp_libc_init + * Use the shared implementations of the following routines + */ + +void bsp_postdriver_hook(void); +void bsp_libc_init( void *, unsigned32, int ); + +/* + * bsp_pretasking_hook * - * Initialize whatever libc we are using called from bsp_postdriver_hook. + * BSP pretasking hook. Called just before drivers are initialized. + * Used to setup libc and install any BSP extensions. */ -void bsp_libc_init(void) +void bsp_pretasking_hook(void) { extern int end; rtems_unsigned32 heap_start; @@ -119,39 +124,9 @@ void bsp_libc_init(void) heap_size = BSP_Configuration.work_space_start - (void *)&end; heap_size &= 0xfffffff0; /* keep it as a multiple of 16 bytes */ - RTEMS_Malloc_Initialize((void *) heap_start, heap_size, 0); - - /* - * Init the RTEMS libio facility to provide UNIX-like system - * calls for use by newlib (ie: provide __rtems_open, __rtems_close, etc) - * Uses malloc() to get area for the iops, so must be after malloc init - */ - - rtems_libio_init(); - - /* - * Set up for the libc handling. - */ - - if (BSP_Configuration.ticks_per_timeslice > 0) - libc_init(1); /* reentrant if possible */ - else - libc_init(0); /* non-reentrant */ - -} + bsp_libc_init((void *) heap_start, heap_size, 0); -/* - * bsp_pretasking_hook - * - * BSP pretasking hook. Called just before drivers are initialized. - * Used to setup libc and install any BSP extensions. - */ - -void bsp_pretasking_hook(void) -{ - bsp_libc_init(); - #if SIMSPARC_FAST_IDLE /* * Install the fast idle task switch extension @@ -188,13 +163,6 @@ void bsp_pretasking_hook(void) } -/* - * Use the shared bsp_postdriver_hook() implementation - */ - -void bsp_postdriver_hook(void); - - /* * bsp_start * diff --git a/c/src/lib/libbsp/unix/posix/startup/Makefile.in b/c/src/lib/libbsp/unix/posix/startup/Makefile.in index a6117e64d4..a64f68a673 100644 --- a/c/src/lib/libbsp/unix/posix/startup/Makefile.in +++ b/c/src/lib/libbsp/unix/posix/startup/Makefile.in @@ -12,7 +12,7 @@ PGM=${ARCH}/startup.rel NO_CTOR_LIB=${ARCH}/libno-ctor.a # C source names, if any, go here -- minus the .c -C_PIECES=bspclean bspstart setvec +C_PIECES=bspclean bsplibc bspstart setvec C_FILES=$(C_PIECES:%=%.c) C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) diff --git a/c/src/lib/libbsp/unix/posix/startup/bspstart.c b/c/src/lib/libbsp/unix/posix/startup/bspstart.c index 11b9b67e19..4e0955e32a 100644 --- a/c/src/lib/libbsp/unix/posix/startup/bspstart.c +++ b/c/src/lib/libbsp/unix/posix/startup/bspstart.c @@ -1,5 +1,4 @@ -/* bsp_start() - * +/* * This routine starts the application. It includes application, * board, and monitor specific initialization and configuration. * The generic CPU dependent initialization has been performed @@ -7,10 +6,6 @@ * * Called by RTEMS::RTEMS constructor in startup-ctor.cc * - * INPUT: NONE - * - * OUTPUT: NONE - * * COPYRIGHT (c) 1989-1998. * On-Line Applications Research Corporation (OAR). * Copyright assigned to U.S. Government, 1994. @@ -68,55 +63,11 @@ char **rtems_argv; rtems_unsigned32 CPU_CLICKS_PER_TICK; /* - * Function: bsp_libc_init - * Created: 94/12/6 - * - * Description: - * Initialize whatever libc we are using - * called from bsp_postdriver_hook - * - * - * Parameters: - * none - * - * Returns: - * none. - * - * Side Effects: - * - * - * Notes: - * - * Deficiencies/ToDo: - * - * + * Use the shared implementations of the following routines */ - -void -bsp_libc_init(void) -{ - void *heap_start; - - if (getenv("RTEMS_HEAPSPACE_SIZE")) - Heap_size = strtol(getenv("RTEMS_HEAPSPACE_SIZE"), 0, 0); - else - Heap_size = DEFAULT_HEAPSPACE_SIZE; - heap_start = 0; - - RTEMS_Malloc_Initialize((void *)heap_start, Heap_size, 1024 * 1024); - - /* - * Init the RTEMS libio facility to provide UNIX-like system - * calls for use by newlib (ie: provide __rtems_open, __rtems_close, etc) - * Uses malloc() to get area for the iops, so must be after malloc init - */ - - rtems_libio_init(); - - libc_init(1); -} - +void bsp_postdriver_hook(void); +void bsp_libc_init( void *, unsigned32, int ); /* * Function: bsp_pretasking_hook @@ -126,28 +77,24 @@ bsp_libc_init(void) * BSP pretasking hook. Called just before drivers are initialized. * Used to setup libc and install any BSP extensions. * - * Parameters: - * none - * - * Returns: - * nada - * - * Side Effects: - * installs a few extensions - * - * Notes: + * NOTES: * Must not use libc (to do io) from here, since drivers are * not yet initialized. - * - * Deficiencies/ToDo: - * - * */ -void -bsp_pretasking_hook(void) +void bsp_pretasking_hook(void) { - bsp_libc_init(); + void *heap_start; + + if (getenv("RTEMS_HEAPSPACE_SIZE")) + Heap_size = strtol(getenv("RTEMS_HEAPSPACE_SIZE"), 0, 0); + else + Heap_size = DEFAULT_HEAPSPACE_SIZE; + + heap_start = 0; + + bsp_libc_init((void *)heap_start, Heap_size, 1024 * 1024); + #ifdef RTEMS_DEBUG rtems_debug_enable( RTEMS_DEBUG_ALL_MASK ); @@ -165,40 +112,18 @@ bsp_pretasking_hook(void) * DO NOT Use the shared bsp_postdriver_hook() implementation */ -void -bsp_postdriver_hook(void) +void bsp_postdriver_hook(void) { return; } /* - * Function: bsp_start - * Created: 94/12/6 - * - * Description: - * called by crt0 as our "main" equivalent - * - * - * - * Parameters: - * - * - * Returns: - * - * - * Side Effects: - * - * - * Notes: - * - * - * Deficiencies/ToDo: - * + * bsp_start * + * This routine does the bulk of the system initialization. */ -void -bsp_start(void) +void bsp_start(void) { unsigned32 workspace_ptr; -- cgit v1.2.3