summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--c/src/lib/libbsp/no_cpu/no_bsp/ChangeLog8
-rw-r--r--c/src/lib/libbsp/no_cpu/no_bsp/Makefile.am3
-rw-r--r--c/src/lib/libbsp/no_cpu/no_bsp/configure.ac2
-rw-r--r--c/src/lib/libbsp/no_cpu/no_bsp/startup/bspgetworkarea.c43
-rw-r--r--c/src/lib/libbsp/no_cpu/no_bsp/startup/bspstart.c49
-rw-r--r--c/src/lib/libbsp/no_cpu/no_bsp/startup/main.c37
6 files changed, 55 insertions, 87 deletions
diff --git a/c/src/lib/libbsp/no_cpu/no_bsp/ChangeLog b/c/src/lib/libbsp/no_cpu/no_bsp/ChangeLog
index 3df102f88e..a856c9c507 100644
--- a/c/src/lib/libbsp/no_cpu/no_bsp/ChangeLog
+++ b/c/src/lib/libbsp/no_cpu/no_bsp/ChangeLog
@@ -1,3 +1,11 @@
+2008-09-14 Joel Sherrill <joel.sherrill@oarcorp.com>
+
+ * Makefile.am, configure.ac, startup/bspstart.c: Create
+ bsp_get_work_area() into its own file and use BSP Framework to
+ perform more initialization.
+ * startup/bspgetworkarea.c: New file.
+ * startup/main.c: Removed.
+
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/no_cpu/no_bsp/Makefile.am b/c/src/lib/libbsp/no_cpu/no_bsp/Makefile.am
index f450c8cd85..5e539c3edc 100644
--- a/c/src/lib/libbsp/no_cpu/no_bsp/Makefile.am
+++ b/c/src/lib/libbsp/no_cpu/no_bsp/Makefile.am
@@ -21,7 +21,8 @@ include_HEADERS += include/coverhd.h
dist_project_lib_DATA += startup/linkcmds
startup_SOURCES = startup/bspclean.c ../../shared/bsplibc.c \
- ../../shared/bsppost.c startup/bspstart.c startup/main.c \
+ ../../shared/bsppretaskinghook.c ../../shared/bsppredriverhook.c \
+ startup/bspgetworkarea.c ../../shared/bsppost.c startup/bspstart.c \
../../shared/bootcard.c ../../shared/sbrk.c startup/setvec.c \
../../shared/gnatinstallhandler.c
clock_SOURCES = clock/ckinit.c
diff --git a/c/src/lib/libbsp/no_cpu/no_bsp/configure.ac b/c/src/lib/libbsp/no_cpu/no_bsp/configure.ac
index 6a52a6a3b4..dda3df3030 100644
--- a/c/src/lib/libbsp/no_cpu/no_bsp/configure.ac
+++ b/c/src/lib/libbsp/no_cpu/no_bsp/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/no_cpu/no_bsp/startup/bspgetworkarea.c b/c/src/lib/libbsp/no_cpu/no_bsp/startup/bspgetworkarea.c
new file mode 100644
index 0000000000..d90a6da9ad
--- /dev/null
+++ b/c/src/lib/libbsp/no_cpu/no_bsp/startup/bspgetworkarea.c
@@ -0,0 +1,43 @@
+/*
+ * 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 some symbols from the linkcmds to use in the math.
+ */
+#if 0
+extern void *_RamBase;
+extern void *_RamSize;
+extern void *end;
+#endif
+
+/*
+ * 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)0;
+
+ *work_area_start = (void *)NULL;
+ *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/no_cpu/no_bsp/startup/bspstart.c b/c/src/lib/libbsp/no_cpu/no_bsp/startup/bspstart.c
index 8ea03ff62b..76b4369311 100644
--- a/c/src/lib/libbsp/no_cpu/no_bsp/startup/bspstart.c
+++ b/c/src/lib/libbsp/no_cpu/no_bsp/startup/bspstart.c
@@ -17,40 +17,6 @@
#include <string.h>
#include <bsp.h>
-#include <rtems/libio.h>
-#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)
-{
- extern int end;
- uint32_t heap_start;
-
- heap_start = (uint32_t) &end;
- if (heap_start & (CPU_ALIGNMENT-1))
- heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
-
- bsp_libc_init((void *) heap_start, 64 * 1024, 0);
-}
/*
* bsp_start
@@ -60,19 +26,4 @@ void bsp_pretasking_hook(void)
void bsp_start( void )
{
- /*
- * 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.
- */
-
- /*
- * 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".
- */
-
- Configuration.work_space_start = (void *) 0;
}
diff --git a/c/src/lib/libbsp/no_cpu/no_bsp/startup/main.c b/c/src/lib/libbsp/no_cpu/no_bsp/startup/main.c
deleted file mode 100644
index ef8d420f3c..0000000000
--- a/c/src/lib/libbsp/no_cpu/no_bsp/startup/main.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* main()
- *
- * This is the entry point for the application. It calls
- * the bsp_start routine to the actual dirty work.
- *
- * COPYRIGHT (c) 1989-1999.
- * On-Line Applications Research Corporation (OAR).
- *
- * 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 <rtems.h>
-#include <bsp.h>
-
-int main(
- int argc,
- char **argv,
- char **environp
-)
-{
- extern void bsp_start( int, char**, char ** );
-
- bsp_start( argc, argv, environp );
-
- /*
- * May be able to return to the "crt/start.s" code but also
- * may not be able to. Do something here which is board dependent.
- */
-
- rtems_fatal_error_occurred( 0 );
-
- return 0; /* just to satisfy the native compiler */
-}