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

* Makefile.am, configure.ac, include/bsp.h, startup/bspstart.c: Add use
	of bsp_get_work_area() in its own file and rely on BSP Framework to
	perform more initialization.
	* startup/bspgetworkarea.c: New file.
This commit is contained in:
Joel Sherrill
2008-09-15 22:05:12 +00:00
parent 60e3b0032c
commit 8446486f60
6 changed files with 64 additions and 80 deletions

View File

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

View File

@@ -26,10 +26,11 @@ include_HEADERS += include/coverhd.h include/gen2.h
dist_project_lib_DATA += startup/linkcmds
startup_SOURCES = startup/bspclean.c ../../shared/bsplibc.c \
startup/bspstart.c ../../shared/bootcard.c \
../../shared/sbrk.c startup/Hwr_init.c \
startup/bspstart.c startup/bspgetworkarea.c ../../shared/bootcard.c \
startup/Hwr_init.c ../../powerpc/shared/startup/sbrk.c \
startup/genpvec.c ../../shared/gnatinstallhandler.c \
../../powerpc/shared/showbats.c
../../powerpc/shared/showbats.c \
../../shared/bsppretaskinghook.c
pclock_SOURCES = ../../powerpc/shared/clock/p_clock.c
console_SOURCES = console/85c30.c console/85c30.h console/console.c \

View File

@@ -69,6 +69,8 @@ RTEMS_BSPOPTS_HELP([PPC_VECTOR_FILE_BASE],
RTEMS_CHECK_NETWORKING
AM_CONDITIONAL(HAS_NETWORKING,test "$HAS_NETWORKING" = "yes")
RTEMS_BSP_BOOTCARD_HANDLES_RAM_ALLOCATION
# Explicitly list all Makefiles here
AC_CONFIG_FILES([Makefile])

View File

@@ -97,18 +97,16 @@ extern "C" {
* Information placed in the linkcmds file.
*/
extern int RAM_START;
extern int RAM_END;
extern int RAM_SIZE;
extern int PROM_START;
extern int PROM_END;
extern int PROM_SIZE;
extern void *RAM_END;
extern void *end;
extern int CLOCK_SPEED;
extern int CPU_PPC_CLICKS_PER_MS;
extern int end; /* last address in the program */
/*
* system init stack
*/
#define BSP_INIT_STACK_SIZE 0x1000
/*
* How many libio files we want

View File

@@ -0,0 +1,44 @@
/*
* 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 void *RAM_END;
extern void *__rtems_end;
extern uint32_t _bsp_sbrk_init(uint32_t, uint32_t*);
unsigned int BSP_mem_size = (unsigned int)&RAM_END;
/*
* 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;
uintptr_t reserve;
reserve = (uintptr_t)BSP_INIT_STACK_SIZE;
reserve += rtems_configuration_get_interrupt_stack_size();
size = (uintptr_t)&RAM_END - (uintptr_t)&__rtems_end + reserve;
*work_area_start = (void *)(&__rtems_end + reserve);
*work_area_size = size;
_bsp_sbrk_init( *work_area_start, work_area_size );
*heap_start = BSP_BOOTCARD_HEAP_USES_WORK_AREA;
*heap_size = BSP_BOOTCARD_HEAP_SIZE_DEFAULT;
}

View File

@@ -18,8 +18,6 @@
#include <string.h>
#include <bsp.h>
#include <rtems/libio.h>
#include <rtems/libcsupport.h>
#include <rtems/bspIo.h>
#include <libcpu/cpuIdent.h>
#define DEBUG 1
@@ -44,14 +42,8 @@ unsigned int BSP_processor_frequency; /* XXX - Set this based upon the Score boa
*/
unsigned int BSP_time_base_divisor = 1000; /* XXX - Just a guess */
/*
* system init stack
*/
#define INIT_STACK_SIZE 0x1000
extern unsigned long __rtems_end[];
/*
* Driver configuration parameters
*/
@@ -70,47 +62,6 @@ void _BSP_Fatal_error(unsigned int v)
}
/*
* Use the shared implementations of the following routines
*/
void bsp_postdriver_hook(void);
void bsp_libc_init( void *, uint32_t, int );
/*PAGE
*
* 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)
{
extern int end;
uint32_t heap_start;
uint32_t heap_size;
#if DEBUG
printk("bsp_pretasking_hook: Set Heap\n");
#endif
heap_start = (uint32_t) &end;
if (heap_start & (CPU_ALIGNMENT-1))
heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
heap_size = Configuration.work_space_start - (void *)&end;
heap_size &= 0xfffffff0; /* keep it as a multiple of 16 bytes */
#if DEBUG
printk("bsp_pretasking_hook: bsp_libc_init\n");
#endif
bsp_libc_init((void *) heap_start, heap_size, 0);
#if DEBUG
printk("bsp_pretasking_hook: End of routine\n");
#endif
}
/*PAGE
*
* bsp_predriver_hook
*
* Before drivers are setup initialize interupt vectors.
@@ -312,7 +263,7 @@ void bsp_start( void )
/*
* Initialize the interrupt related settings.
*/
intrStackStart = (uint32_t) __rtems_end + INIT_STACK_SIZE;
intrStackStart = (uint32_t) __rtems_end + BSP_INIT_STACK_SIZE;
intrStackSize = rtems_configuration_get_interrupt_stack_size();
BSP_heap_start = intrStackStart + intrStackSize;
@@ -391,25 +342,6 @@ printk("ppc_exc_initialize\n");
_CPU_MSR_SET( msr_value );
/*
* 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".
*/
#if DEBUG
printk("bsp_start: Calculate Wrokspace\n");
#endif
work_space_start =
(unsigned char *)&RAM_END - rtems_configuration_get_work_space_size();
if ( work_space_start <= (unsigned char *)&end ) {
printk( "bspstart: Not enough RAM!!!\n" );
bsp_cleanup();
}
Configuration.work_space_start = work_space_start;
/*
* initialize the device driver parameters
*/