2008-09-14 Joel Sherrill <joel.sherrill@oarcorp.com>

* Makefile.am, configure.ac, startup/bspstart.c: Create
	bsp_get_work_area() into its own file and use BSP Framework to
	perform more initialization.
	* startup/bspgetworkarea.c: New file.
	* startup/main.c: Removed.
This commit is contained in:
Joel Sherrill
2008-09-14 22:03:54 +00:00
parent 6f4aa47622
commit eb3923bce5
6 changed files with 55 additions and 87 deletions

View File

@@ -1,3 +1,11 @@
2008-09-14 Joel Sherrill <joel.sherrill@oarcorp.com>
* Makefile.am, configure.ac, startup/bspstart.c: Create
bsp_get_work_area() into its own file and use BSP Framework to
perform more initialization.
* startup/bspgetworkarea.c: New file.
* startup/main.c: Removed.
2008-09-10 Joel Sherrill <joel.sherrill@oarcorp.com>
* include/bsp.h: Review of all bsp_cleanup() implementations. In this

View File

@@ -21,7 +21,8 @@ include_HEADERS += include/coverhd.h
dist_project_lib_DATA += startup/linkcmds
startup_SOURCES = startup/bspclean.c ../../shared/bsplibc.c \
../../shared/bsppost.c startup/bspstart.c startup/main.c \
../../shared/bsppretaskinghook.c ../../shared/bsppredriverhook.c \
startup/bspgetworkarea.c ../../shared/bsppost.c startup/bspstart.c \
../../shared/bootcard.c ../../shared/sbrk.c startup/setvec.c \
../../shared/gnatinstallhandler.c
clock_SOURCES = clock/ckinit.c

View File

@@ -15,6 +15,8 @@ RTEMS_PROG_CC_FOR_TARGET([-ansi -fasm])
RTEMS_CANONICALIZE_TOOLS
RTEMS_PROG_CCAS
RTEMS_BSP_BOOTCARD_HANDLES_RAM_ALLOCATION
# Explicitly list all Makefiles here
AC_CONFIG_FILES([Makefile])
AC_OUTPUT

View File

@@ -0,0 +1,43 @@
/*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#include <bsp.h>
#include <bsp/bootcard.h>
#include <stdint.h>
/*
* Extern some symbols from the linkcmds to use in the math.
*/
#if 0
extern void *_RamBase;
extern void *_RamSize;
extern void *end;
#endif
/*
* This method returns the base address and size of the area which
* is to be allocated between the RTEMS Workspace and the C Program
* Heap.
*/
void bsp_get_work_area(
void **work_area_start,
size_t *work_area_size,
void **heap_start,
size_t *heap_size
)
{
uintptr_t size;
size = (uintptr_t)0;
*work_area_start = (void *)NULL;
*work_area_size = size;
*heap_start = BSP_BOOTCARD_HEAP_USES_WORK_AREA;
*heap_size = BSP_BOOTCARD_HEAP_SIZE_DEFAULT;
}

View File

@@ -17,40 +17,6 @@
#include <string.h>
#include <bsp.h>
#include <rtems/libio.h>
#include <rtems/libcsupport.h>
/*
* Use the shared implementations of the following routines
*/
void bsp_libc_init( void *, uint32_t, int );
/*
* Function: bsp_pretasking_hook
* Created: 95/03/10
*
* Description:
* BSP pretasking hook. Called just before drivers are initialized.
* Used to setup libc and install any BSP extensions.
*
* NOTES:
* Must not use libc (to do io) from here, since drivers are
* not yet initialized.
*
*/
void bsp_pretasking_hook(void)
{
extern int end;
uint32_t heap_start;
heap_start = (uint32_t) &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);
}
/*
* bsp_start
@@ -60,19 +26,4 @@ void bsp_pretasking_hook(void)
void bsp_start( void )
{
/*
* Allocate the memory for the RTEMS Work Space. This can come from
* a variety of places: hard coded address, malloc'ed from outside
* RTEMS world (e.g. simulator or primitive memory manager), or (as
* typically done by stock BSPs) by subtracting the required amount
* of work space from the last physical address on the CPU board.
*/
/*
* Need to "allocate" the memory for the RTEMS Workspace and
* tell the RTEMS configuration where it is. This memory is
* not malloc'ed. It is just "pulled from the air".
*/
Configuration.work_space_start = (void *) 0;
}

View File

@@ -1,37 +0,0 @@
/* main()
*
* This is the entry point for the application. It calls
* the bsp_start routine to the actual dirty work.
*
* COPYRIGHT (c) 1989-1999.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#include <rtems.h>
#include <bsp.h>
int main(
int argc,
char **argv,
char **environp
)
{
extern void bsp_start( int, char**, char ** );
bsp_start( argc, argv, environp );
/*
* May be able to return to the "crt/start.s" code but also
* may not be able to. Do something here which is board dependent.
*/
rtems_fatal_error_occurred( 0 );
return 0; /* just to satisfy the native compiler */
}