summaryrefslogtreecommitdiffstats
path: root/c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2008-09-14 21:02:10 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2008-09-14 21:02:10 +0000
commitff32644ed51d74e411be22aa5b10c0526e03fa19 (patch)
tree88f61845da1a894ac0fd573e71a8f66c8ffa33d9 /c
parent2008-09-14 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-ff32644ed51d74e411be22aa5b10c0526e03fa19.tar.bz2
2008-09-14 Joel Sherrill <joel.sherrill@oarcorp.com>
* Makefile.am, configure.ac, startup/__main.c, startup/bspstart.c: Split out bsp_get_work_area() into its own file and user BSP Framework to perform more initialization. * startup/bspgetworkarea.c: New file.
Diffstat (limited to 'c')
-rw-r--r--c/src/lib/libbsp/h8300/h8sim/ChangeLog7
-rw-r--r--c/src/lib/libbsp/h8300/h8sim/Makefile.am7
-rw-r--r--c/src/lib/libbsp/h8300/h8sim/configure.ac2
-rw-r--r--c/src/lib/libbsp/h8300/h8sim/startup/__main.c21
-rw-r--r--c/src/lib/libbsp/h8300/h8sim/startup/bspgetworkarea.c32
-rw-r--r--c/src/lib/libbsp/h8300/h8sim/startup/bspstart.c42
6 files changed, 56 insertions, 55 deletions
diff --git a/c/src/lib/libbsp/h8300/h8sim/ChangeLog b/c/src/lib/libbsp/h8300/h8sim/ChangeLog
index 2a39543f83..cebaa67471 100644
--- a/c/src/lib/libbsp/h8300/h8sim/ChangeLog
+++ b/c/src/lib/libbsp/h8300/h8sim/ChangeLog
@@ -1,3 +1,10 @@
+2008-09-14 Joel Sherrill <joel.sherrill@oarcorp.com>
+
+ * Makefile.am, configure.ac, startup/__main.c, startup/bspstart.c:
+ Split out bsp_get_work_area() into its own file and user 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
diff --git a/c/src/lib/libbsp/h8300/h8sim/Makefile.am b/c/src/lib/libbsp/h8300/h8sim/Makefile.am
index 5ae51d37de..19ded92a9a 100644
--- a/c/src/lib/libbsp/h8300/h8sim/Makefile.am
+++ b/c/src/lib/libbsp/h8300/h8sim/Makefile.am
@@ -26,9 +26,10 @@ project_lib_DATA = start.$(OBJEXT)
dist_project_lib_DATA += startup/linkcmds
startup_SOURCES = ../../shared/bspclean.c ../../shared/bsplibc.c \
- ../../shared/bsppredriverhook.c \
- ../../shared/bsppost.c startup/bspstart.c ../../shared/bootcard.c \
- ../../shared/sbrk.c ../../shared/gnatinstallhandler.c startup/__main.c
+ ../../shared/bsppredriverhook.c ../../shared/bsppretaskinghook.c \
+ startup/bspgetworkarea.c ../../shared/bsppost.c startup/bspstart.c \
+ ../../shared/bootcard.c ../../shared/sbrk.c \
+ ../../shared/gnatinstallhandler.c startup/__main.c
clock_SOURCES = ../../shared/clock_driver_stub.c
console_SOURCES = ../../shared/console-polled.c console/console-io.c
timer_SOURCES = ../../shared/timerstub.c
diff --git a/c/src/lib/libbsp/h8300/h8sim/configure.ac b/c/src/lib/libbsp/h8300/h8sim/configure.ac
index daa9c66528..7d53b0efd8 100644
--- a/c/src/lib/libbsp/h8300/h8sim/configure.ac
+++ b/c/src/lib/libbsp/h8300/h8sim/configure.ac
@@ -15,6 +15,8 @@ RTEMS_PROG_CC_FOR_TARGET([-ansi -fasm])
RTEMS_CANONICALIZE_TOOLS
RTEMS_PROG_CCAS
+RTEMS_BSP_BOOTCARD_HANDLES_RAM_ALLOCATION
+
# Explicitly list all Makefiles here
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
diff --git a/c/src/lib/libbsp/h8300/h8sim/startup/__main.c b/c/src/lib/libbsp/h8300/h8sim/startup/__main.c
index fcc2432d12..17a58c9a5f 100644
--- a/c/src/lib/libbsp/h8300/h8sim/startup/__main.c
+++ b/c/src/lib/libbsp/h8300/h8sim/startup/__main.c
@@ -4,19 +4,20 @@
* $Id$
*/
+typedef void (*pfunc) (void);
+extern pfunc __ctors[];
+extern pfunc __ctors_end[];
+
void __main (void)
{
static int initialized;
- if (! initialized)
- {
- typedef void (*pfunc) (void);
- extern pfunc __ctors[];
- extern pfunc __ctors_end[];
- pfunc *p;
+ pfunc *p;
+
+ if (initialized)
+ return;
- initialized = 1;
- for (p = __ctors_end; p > __ctors; )
- (*--p) ();
+ initialized = 1;
+ for (p = __ctors_end; p > __ctors; )
+ (*--p) ();
- }
}
diff --git a/c/src/lib/libbsp/h8300/h8sim/startup/bspgetworkarea.c b/c/src/lib/libbsp/h8300/h8sim/startup/bspgetworkarea.c
new file mode 100644
index 0000000000..286b37e362
--- /dev/null
+++ b/c/src/lib/libbsp/h8300/h8sim/startup/bspgetworkarea.c
@@ -0,0 +1,32 @@
+/*
+ * 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 *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 = (256 * 1024) - - (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/h8300/h8sim/startup/bspstart.c b/c/src/lib/libbsp/h8300/h8sim/startup/bspstart.c
index 285a0de8f5..2132e4a9fb 100644
--- a/c/src/lib/libbsp/h8300/h8sim/startup/bspstart.c
+++ b/c/src/lib/libbsp/h8300/h8sim/startup/bspstart.c
@@ -21,40 +21,6 @@
#include <rtems/libcsupport.h>
/*
- * Use the shared implementations of the following routines
- */
-
-void bsp_libc_init( void *, uint32_t, int );
-
-/*
- * Function: bsp_pretasking_hook
- * Created: 95/03/10
- *
- * Description:
- * BSP pretasking hook. Called just before drivers are initialized.
- * Used to setup libc and install any BSP extensions.
- *
- * NOTES:
- * Must not use libc (to do io) from here, since drivers are
- * not yet initialized.
- *
- */
-
-void bsp_pretasking_hook(void)
-{
- void *heapStart;
- unsigned long heapSize;
- extern int WorkspaceBase;
-
- heapStart = (void *)
- ((unsigned long)&WorkspaceBase + rtems_configuration_get_work_space_size());
- if ( (unsigned long) heapStart > (256 * 1024) )
- rtems_fatal_error_occurred (('H'<<24) | ('E'<<16) | ('A'<<8) | 'P');
- heapSize = (256 * 1024) - (unsigned long)(heapStart);
- bsp_libc_init(heapStart, heapSize, 0);
-}
-
-/*
* bsp_start
*
* This routine does the bulk of the system initialization.
@@ -62,14 +28,6 @@ void bsp_pretasking_hook(void)
void bsp_start( void )
{
- extern int WorkspaceBase;
-
-/*
- if ( rtems_configuration_get_work_space_size() >(512*1024) )
- _sys_exit( 1 );
-*/
-
- Configuration.work_space_start = (void *) &WorkspaceBase;
}
void H8BD_Install_IRQ(