From b4a52b19b95b0418561efdcc7858d74201326b26 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Sun, 14 Sep 2008 23:43:36 +0000 Subject: 2008-09-14 Joel Sherrill * Makefile.am, configure.ac, startup/bspstart.c, startup/linkcmds: Create bsp_get_work_area() into its own file and use BSP Framework to perform more initialization. * startup/bspgetworkarea.c: New file. --- c/src/lib/libbsp/powerpc/mbx8xx/ChangeLog | 7 +++ c/src/lib/libbsp/powerpc/mbx8xx/Makefile.am | 1 + c/src/lib/libbsp/powerpc/mbx8xx/configure.ac | 2 + .../libbsp/powerpc/mbx8xx/startup/bspgetworkarea.c | 39 +++++++++++++++ c/src/lib/libbsp/powerpc/mbx8xx/startup/bspstart.c | 55 ---------------------- c/src/lib/libbsp/powerpc/mbx8xx/startup/linkcmds | 16 ++----- 6 files changed, 53 insertions(+), 67 deletions(-) create mode 100644 c/src/lib/libbsp/powerpc/mbx8xx/startup/bspgetworkarea.c (limited to 'c/src/lib/libbsp/powerpc/mbx8xx') diff --git a/c/src/lib/libbsp/powerpc/mbx8xx/ChangeLog b/c/src/lib/libbsp/powerpc/mbx8xx/ChangeLog index bef5d65acb..23aee2d753 100644 --- a/c/src/lib/libbsp/powerpc/mbx8xx/ChangeLog +++ b/c/src/lib/libbsp/powerpc/mbx8xx/ChangeLog @@ -1,3 +1,10 @@ +2008-09-14 Joel Sherrill + + * Makefile.am, configure.ac, startup/bspstart.c, startup/linkcmds: + Create bsp_get_work_area() into its own file and use BSP Framework to + perform more initialization. + * startup/bspgetworkarea.c: New file. + 2008-09-10 Joel Sherrill * include/bsp.h: Review of all bsp_cleanup() implementations. In this diff --git a/c/src/lib/libbsp/powerpc/mbx8xx/Makefile.am b/c/src/lib/libbsp/powerpc/mbx8xx/Makefile.am index 43d52f0a5b..11ccebce00 100644 --- a/c/src/lib/libbsp/powerpc/mbx8xx/Makefile.am +++ b/c/src/lib/libbsp/powerpc/mbx8xx/Makefile.am @@ -35,6 +35,7 @@ vectors_SOURCES = vectors/vectors.h vectors/vectors_init.c \ vectors/vectors.S startup_SOURCES = ../../shared/bspclean.c ../../shared/bsplibc.c \ ../../shared/bsppost.c ../../shared/bsppredriverhook.c \ + ../../shared/bsppretaskinghook.c startup/bspgetworkarea.c \ startup/bspstart.c ../../shared/bootcard.c \ startup/imbx8xx.c startup/mmutlbtab.c \ ../../shared/sbrk.c ../../shared/gnatinstallhandler.c startup/start.S diff --git a/c/src/lib/libbsp/powerpc/mbx8xx/configure.ac b/c/src/lib/libbsp/powerpc/mbx8xx/configure.ac index ae99eb9af2..fd4fc69029 100644 --- a/c/src/lib/libbsp/powerpc/mbx8xx/configure.ac +++ b/c/src/lib/libbsp/powerpc/mbx8xx/configure.ac @@ -114,6 +114,8 @@ RTEMS_BSPOPTS_SET([DISPATCH_HANDLER_STAT],[*],[]) RTEMS_BSPOPTS_HELP([DISPATCH_HANDLER_STAT], [used by irq/irq.c]) +RTEMS_BSP_BOOTCARD_HANDLES_RAM_ALLOCATION + # Explicitly list a Makefile here AC_CONFIG_FILES([Makefile]) diff --git a/c/src/lib/libbsp/powerpc/mbx8xx/startup/bspgetworkarea.c b/c/src/lib/libbsp/powerpc/mbx8xx/startup/bspgetworkarea.c new file mode 100644 index 0000000000..f77fbb85ad --- /dev/null +++ b/c/src/lib/libbsp/powerpc/mbx8xx/startup/bspgetworkarea.c @@ -0,0 +1,39 @@ +/* + * 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 +#include +#include + +extern void *RamBase; +extern void *RamSize; +extern void *WorkspaceBase; + +/* + * 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)&RamBase + (uintptr_t)&RamSize + - (uintptr_t)&WorkspaceBase; + + *work_area_start = (void *)&WorkspaceBase; + *work_area_size = size; + *heap_start = BSP_BOOTCARD_HEAP_USES_WORK_AREA; + *heap_size = BSP_BOOTCARD_HEAP_SIZE_DEFAULT; +} + diff --git a/c/src/lib/libbsp/powerpc/mbx8xx/startup/bspstart.c b/c/src/lib/libbsp/powerpc/mbx8xx/startup/bspstart.c index 4f1879129a..f81690fe24 100644 --- a/c/src/lib/libbsp/powerpc/mbx8xx/startup/bspstart.c +++ b/c/src/lib/libbsp/powerpc/mbx8xx/startup/bspstart.c @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include @@ -49,13 +48,6 @@ uint32_t bsp_timer_average_overhead; /* Average overhead of timer in ticks */ uint32_t bsp_timer_least_valid; /* Least valid number from timer */ bool bsp_timer_internal_clock; /* TRUE, when timer runs with CPU clk */ -/* - * Use the shared implementations of the following routines. - * Look in rtems/c/src/lib/libbsp/shared/bsppost.c and - * rtems/c/src/lib/libbsp/shared/bsplibc.c. - */ -void bsp_libc_init( void *, uint32_t, int ); - void BSP_panic(char *s) { printk("%s PANIC %s\n",_RTEMS_version, s); @@ -68,39 +60,6 @@ void _BSP_Fatal_error(unsigned int v) __asm__ __volatile ("sc"); } -/* - * bsp_pretasking_hook - * - * Called when RTEMS initialization is complete but before interrupts and - * tasking are enabled. Used to setup libc and install any BSP extensions. - * - * Must not use libc (to do io) from here, since drivers are not yet - * initialized. - * - * Input parameters: NONE - * - * Output parameters: NONE - * - * Return values: NONE - */ -void bsp_pretasking_hook(void) -{ - /* - * These are assigned addresses in the linkcmds file for the BSP. This - * approach is better than having these defined as manifest constants and - * compiled into the kernel, but it is still not ideal when dealing with - * multiprocessor configuration in which each board as a different memory - * map. A better place for defining these symbols might be the makefiles. - * Consideration should also be given to developing an approach in which - * the kernel and the application can be linked and burned into ROM - * independently of each other. - */ - extern unsigned char _HeapStart; - extern unsigned char _HeapEnd; - - bsp_libc_init( &_HeapStart, &_HeapEnd - &_HeapStart, 0 ); -} - /* * bsp_start() * @@ -127,8 +86,6 @@ void bsp_pretasking_hook(void) */ void bsp_start(void) { - extern void *_WorkspaceBase; - ppc_cpu_id_t myCpu; ppc_cpu_revision_t myCpuRevision; register unsigned char* intrStack; @@ -170,18 +127,6 @@ void bsp_start(void) */ initialize_exceptions(); - /* - * 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. - * - * In this case, the memory is not malloc'ed. It is just - * "pulled from the air". - */ - Configuration.work_space_start = (void *)&_WorkspaceBase; - /* * initialize the device driver parameters */ diff --git a/c/src/lib/libbsp/powerpc/mbx8xx/startup/linkcmds b/c/src/lib/libbsp/powerpc/mbx8xx/startup/linkcmds index cb309c27ef..52029ebafc 100644 --- a/c/src/lib/libbsp/powerpc/mbx8xx/startup/linkcmds +++ b/c/src/lib/libbsp/powerpc/mbx8xx/startup/linkcmds @@ -15,8 +15,9 @@ ENTRY(start) * number used there is not constant. If this happens to you, edit * the lines marked XXX below to use a constant value. */ -HeapSize = DEFINED(HeapSize) ? HeapSize : 0x100000; /* 1M Heap */ StackSize = DEFINED(StackSize) ? StackSize : 0x1000; +RamBase = DEFINED(RamBase) ? RamBase : 0; +RamSize = DEFINED(RamSized) ? RamSize : 4M; MEMORY { @@ -262,17 +263,8 @@ SECTIONS intrStack = .; PROVIDE(intrStackPtr = intrStack); - _HeapStart = .; - __HeapStart = .; - . += HeapSize; /* XXX -- Old gld can't handle this */ - /* . += 0x80000; */ /* HeapSize for old gld */ - _HeapEnd = .; - __HeapEnd = .; - clear_end = .; - - _WorkspaceBase = .; - __WorkspaceBase = .; - + WorkspaceBase = .; + dpram : { m8xx = .; -- cgit v1.2.3