summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/powerpc/psim/startup/bspstart.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2008-05-15 15:54:15 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2008-05-15 15:54:15 +0000
commit4c94ffff2c016186c24911def5951445c9273c59 (patch)
treec6ffa6f7bf79fd35acd6d26286a6bde9fa6154cc /c/src/lib/libbsp/powerpc/psim/startup/bspstart.c
parent2008-05-15 Joel Sherrill <joel.sherrill@OARcorp.com> (diff)
downloadrtems-4c94ffff2c016186c24911def5951445c9273c59.tar.bz2
2008-05-15 Joel Sherrill <joel.sherrill@OARcorp.com>
* Makefile.am, configure.ac, startup/bspstart.c: Add capability for bootcard.c BSP Initialization Framework to ask the BSP where it has memory for the RTEMS Workspace and C Program Heap. These collectively are referred to as work area. If the BSP supports this, then it does not have to include code to split the available memory between the two areas. This reduces the amount of code in the BSP specific bspstart.c file. Additionally, the shared framework can initialize the C Library, call rtems_debug_enable(), and dirty the work area memory. Until most/all BSPs support this new capability, if the BSP supports this, it should call RTEMS_BSP_BOOTCARD_HANDLES_RAM_ALLOCATION from its configure.ac. When the transition is complete, this autoconf macro can be removed.
Diffstat (limited to 'c/src/lib/libbsp/powerpc/psim/startup/bspstart.c')
-rw-r--r--c/src/lib/libbsp/powerpc/psim/startup/bspstart.c64
1 files changed, 13 insertions, 51 deletions
diff --git a/c/src/lib/libbsp/powerpc/psim/startup/bspstart.c b/c/src/lib/libbsp/powerpc/psim/startup/bspstart.c
index be9f217223..77e5cd4c9f 100644
--- a/c/src/lib/libbsp/powerpc/psim/startup/bspstart.c
+++ b/c/src/lib/libbsp/powerpc/psim/startup/bspstart.c
@@ -4,7 +4,7 @@
* The generic CPU dependent initialization has been performed
* before any of these are invoked.
*
- * COPYRIGHT (c) 1989-2007.
+ * COPYRIGHT (c) 1989-2008.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -30,8 +30,6 @@
SPR_RW(SPRG0)
SPR_RW(SPRG1)
-extern unsigned long __rtems_end[];
-
void initialize_exceptions(void);
/* On psim, each click of the decrementer register corresponds
@@ -41,7 +39,6 @@ void initialize_exceptions(void);
* per cycle at 100 Mhz. Whether this is a good guess or not
* is anyone's guess.
*/
-
extern int PSIM_INSTRUCTIONS_PER_MICROSECOND;
/*
@@ -55,12 +52,6 @@ unsigned int BSP_bus_frequency;
unsigned int BSP_time_base_divisor;
/*
- * Use the shared implementations of the following routines
- */
-
-void bsp_libc_init( void *, uint32_t, int );
-
-/*
* system init stack
*/
#define INIT_STACK_SIZE 0x1000
@@ -78,30 +69,19 @@ void _BSP_Fatal_error(unsigned int v)
}
/*
- * bsp_pretasking_hook
- *
- * BSP pretasking hook. Called just before drivers are initialized.
- * Used to setup libc and install any BSP extensions.
+ * 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_pretasking_hook(void)
+void bsp_get_workarea(
+ void **workarea_base,
+ size_t *workarea_size,
+ size_t *requested_heap_size
+)
{
- extern int end;
- uint32_t heap_start;
- uint32_t heap_size;
-
- 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 */
-
- bsp_libc_init((void *) heap_start, heap_size, 0);
-
-#ifdef RTEMS_DEBUG
- rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
-#endif
+ *workarea_base = &end;
+ *workarea_size = (void *)&RAM_END - (void *)&end;
+ *requested_heap_size = 0;
}
/*
@@ -112,7 +92,7 @@ void bsp_pretasking_hook(void)
void bsp_start( void )
{
- unsigned char *work_space_start;
+ extern unsigned long __rtems_end[];
register uint32_t intrStack;
register uint32_t *intrStackPtr;
@@ -134,23 +114,6 @@ void bsp_start( void )
bsp_exceptions_in_RAM = FALSE;
- rtems_configuration_get_work_space_size() += 1024;
-
- 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;
- #if (BSP_DIRTY_MEMORY == 1)
- {
- memset(&end, 0xCF, (unsigned char *)&RAM_END - (unsigned char *)&end );
- }
- #endif
-
/*
* Initialize the interrupt related settings
* SPRG1 = software managed IRQ stack
@@ -196,5 +159,4 @@ void bsp_start( void )
_write_MSR(_read_MSR() | MSR_DR | MSR_IR);
asm volatile("sync; isync");
-
}