summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/powerpc/score603e/startup
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2008-09-15 22:05:12 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2008-09-15 22:05:12 +0000
commit8446486f60a16bd60d793ad61d3cc2a9f9a4fc8a (patch)
treea09cf995ff8e58b08841f391bba1ee5cd4252486 /c/src/lib/libbsp/powerpc/score603e/startup
parent2008-09-15 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-8446486f60a16bd60d793ad61d3cc2a9f9a4fc8a.tar.bz2
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.
Diffstat (limited to 'c/src/lib/libbsp/powerpc/score603e/startup')
-rw-r--r--c/src/lib/libbsp/powerpc/score603e/startup/bspgetworkarea.c44
-rw-r--r--c/src/lib/libbsp/powerpc/score603e/startup/bspstart.c70
2 files changed, 45 insertions, 69 deletions
diff --git a/c/src/lib/libbsp/powerpc/score603e/startup/bspgetworkarea.c b/c/src/lib/libbsp/powerpc/score603e/startup/bspgetworkarea.c
new file mode 100644
index 0000000000..a30866ebf3
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/score603e/startup/bspgetworkarea.c
@@ -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;
+}
+
diff --git a/c/src/lib/libbsp/powerpc/score603e/startup/bspstart.c b/c/src/lib/libbsp/powerpc/score603e/startup/bspstart.c
index 8bd9539669..b343a3a6f4 100644
--- a/c/src/lib/libbsp/powerpc/score603e/startup/bspstart.c
+++ b/c/src/lib/libbsp/powerpc/score603e/startup/bspstart.c
@@ -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;
@@ -392,25 +343,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
*/
#if DEBUG