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/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 +++++-------------- 22 files changed, 223 insertions(+), 533 deletions(-) (limited to 'c/src/lib/libbsp/m68k') 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 ) { -- cgit v1.2.3