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 ++++++++---------------- 2 files changed, 30 insertions(+), 57 deletions(-) (limited to 'c/src/lib/libbsp/a29k') 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, -- cgit v1.2.3