diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2008-09-15 22:05:14 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2008-09-15 22:05:14 +0000 |
commit | 0f70711148e464d5e2e09b44e6c2f82909c083e3 (patch) | |
tree | 8a618540fbeaacf1ddc3a016a0b48a22f03fb5bb /c/src/lib/libbsp/powerpc/ss555/startup | |
parent | 2008-09-15 Joel Sherrill <joel.sherrill@oarcorp.com> (diff) | |
download | rtems-0f70711148e464d5e2e09b44e6c2f82909c083e3.tar.bz2 |
2008-09-15 Joel Sherrill <joel.sherrill@oarcorp.com>
* Makefile.am, configure.ac, startup/bspstart.c, startup/linkcmds: 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.
Diffstat (limited to 'c/src/lib/libbsp/powerpc/ss555/startup')
-rw-r--r-- | c/src/lib/libbsp/powerpc/ss555/startup/bspgetworkarea.c | 33 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/ss555/startup/bspstart.c | 59 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/ss555/startup/linkcmds | 9 |
3 files changed, 36 insertions, 65 deletions
diff --git a/c/src/lib/libbsp/powerpc/ss555/startup/bspgetworkarea.c b/c/src/lib/libbsp/powerpc/ss555/startup/bspgetworkarea.c new file mode 100644 index 0000000000..fad31053c8 --- /dev/null +++ b/c/src/lib/libbsp/powerpc/ss555/startup/bspgetworkarea.c @@ -0,0 +1,33 @@ +/* + * 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 *RamEnd; +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 +) +{ + *work_area_start = (void *)&WorkspaceBase; + *work_area_size = (uintptr_t)&RamEnd - (uintptr_t)&WorkspaceBase; + *heap_start = BSP_BOOTCARD_HEAP_USES_WORK_AREA; + *heap_size = BSP_BOOTCARD_HEAP_SIZE_DEFAULT; +} + diff --git a/c/src/lib/libbsp/powerpc/ss555/startup/bspstart.c b/c/src/lib/libbsp/powerpc/ss555/startup/bspstart.c index 0949bccca2..df2c17dc57 100644 --- a/c/src/lib/libbsp/powerpc/ss555/startup/bspstart.c +++ b/c/src/lib/libbsp/powerpc/ss555/startup/bspstart.c @@ -25,10 +25,6 @@ #warning The interrupt disable mask is now stored in SPRG0, please verify that this is compatible to this BSP (see also bootcard.c). -#include <string.h> - -#include <rtems/libio.h> -#include <rtems/libcsupport.h> #include <rtems/bspIo.h> #include <rtems/powerpc/powerpc.h> @@ -50,12 +46,6 @@ uint32_t bsp_clock_speed; /* Serial clocks per second */ uint32_t bsp_timer_least_valid; uint32_t bsp_timer_average_overhead; -/* - * Use the shared implementations of the following routines. - * Look in 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); @@ -69,41 +59,6 @@ void _BSP_Fatal_error(unsigned int v) } /* - * 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. - */ - uint8_t *_HeapStart = - (uint8_t *)Configuration.work_space_start - + rtems_configuration_get_work_space_size(); - extern uint8_t _HeapEnd[]; - - bsp_libc_init( _HeapStart, _HeapEnd - _HeapStart, 0 ); -} - -/* * bsp_start() * * Board-specific initialization code. Called from the generic boot_card() @@ -125,8 +80,6 @@ void bsp_pretasking_hook(void) */ void bsp_start(void) { - extern char _WorkspaceBase[]; - ppc_cpu_id_t myCpu; ppc_cpu_revision_t myCpuRevision; register unsigned char* intrStack; @@ -151,18 +104,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 = _WorkspaceBase; - - /* * initialize the device driver parameters */ bsp_clicks_per_usec = BSP_CRYSTAL_HZ / 4 / 1000000; diff --git a/c/src/lib/libbsp/powerpc/ss555/startup/linkcmds b/c/src/lib/libbsp/powerpc/ss555/startup/linkcmds index 1f79cf0eea..3ed886c36c 100644 --- a/c/src/lib/libbsp/powerpc/ss555/startup/linkcmds +++ b/c/src/lib/libbsp/powerpc/ss555/startup/linkcmds @@ -235,9 +235,8 @@ SECTIONS intrStack = .; PROVIDE(intrStackPtr = intrStack); - _WorkspaceBase = .; - __WorkspaceBase = .; - + WorkspaceBase = .; + /* * Heap * @@ -246,10 +245,8 @@ SECTIONS * the external RAM. */ . = DEFINED(RTEMS_DEBUG) ? 0 + ext_ram_size : int_ram_top + ext_ram_size; - _HeapEnd = .; - __HeapEnd = .; + RamEnd = .; - /* * Internal I/O devices */ |