summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/nios2
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2008-09-14 21:57:13 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2008-09-14 21:57:13 +0000
commit6f4aa476223b742248e035167f77c900a5c81dbc (patch)
tree2a70dc7eb0a1d0eb0756ba0d5940b030f1a47881 /c/src/lib/libbsp/nios2
parent2008-09-14 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-6f4aa476223b742248e035167f77c900a5c81dbc.tar.bz2
2008-09-14 Joel Sherrill <joel.sherrill@oarcorp.com>
* Makefile.am, 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.
Diffstat (limited to 'c/src/lib/libbsp/nios2')
-rw-r--r--c/src/lib/libbsp/nios2/nios2_iss/ChangeLog6
-rw-r--r--c/src/lib/libbsp/nios2/nios2_iss/Makefile.am1
-rw-r--r--c/src/lib/libbsp/nios2/nios2_iss/startup/bspgetworkarea.c41
-rw-r--r--c/src/lib/libbsp/nios2/nios2_iss/startup/bspstart.c62
4 files changed, 48 insertions, 62 deletions
diff --git a/c/src/lib/libbsp/nios2/nios2_iss/ChangeLog b/c/src/lib/libbsp/nios2/nios2_iss/ChangeLog
index 39485f21fc..5442e63b57 100644
--- a/c/src/lib/libbsp/nios2/nios2_iss/ChangeLog
+++ b/c/src/lib/libbsp/nios2/nios2_iss/ChangeLog
@@ -1,3 +1,9 @@
+2008-09-14 Joel Sherrill <joel.sherrill@oarcorp.com>
+
+ * Makefile.am, 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.
+
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/nios2/nios2_iss/Makefile.am b/c/src/lib/libbsp/nios2/nios2_iss/Makefile.am
index fe06e60dae..ad453629c6 100644
--- a/c/src/lib/libbsp/nios2/nios2_iss/Makefile.am
+++ b/c/src/lib/libbsp/nios2/nios2_iss/Makefile.am
@@ -31,6 +31,7 @@ dist_project_lib_DATA += startup/linkcmds
startup_SOURCES = startup/bspclean.c ../../shared/bsplibc.c \
../../shared/bsppost.c startup/bspstart.c \
+ ../../shared/bsppretaskinghook.c startup/bspgetworkarea.c \
../../shared/bootcard.c ../../shared/sbrk.c startup/setvec.c \
../../shared/gnatinstallhandler.c
clock_SOURCES = clock/clock.c
diff --git a/c/src/lib/libbsp/nios2/nios2_iss/startup/bspgetworkarea.c b/c/src/lib/libbsp/nios2/nios2_iss/startup/bspgetworkarea.c
new file mode 100644
index 0000000000..ac8c0a0166
--- /dev/null
+++ b/c/src/lib/libbsp/nios2/nios2_iss/startup/bspgetworkarea.c
@@ -0,0 +1,41 @@
+/*
+ * 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 *_RamBase;
+extern void *_RamSize;
+extern void *end;
+
+extern char __alt_heap_start[];
+
+/*
+ * 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)&RAM_BASE + (uintptr_t)&RAM_BYTES
+ - (uintptr_t)&__alt_heap_start;
+
+ *work_area_start = (void *)__alt_heap_start;
+ *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/nios2/nios2_iss/startup/bspstart.c b/c/src/lib/libbsp/nios2/nios2_iss/startup/bspstart.c
index 9abf8bab7e..6ee68883d3 100644
--- a/c/src/lib/libbsp/nios2/nios2_iss/startup/bspstart.c
+++ b/c/src/lib/libbsp/nios2/nios2_iss/startup/bspstart.c
@@ -19,56 +19,6 @@
#include <string.h>
#include <bsp.h>
-#include <rtems/libio.h>
-#include <rtems/libcsupport.h>
-
-/*
- * Use the shared implementations of the following routines
- */
-
-extern void bsp_libc_init( void *, uint32_t, int );
-
-#if 0
-extern char _RAMBase[];
-extern char _RAMSize[];
-extern char _WorkspaceBase[];
-extern char _HeapSize[];
-#else
-extern char __alt_heap_start[];
-#endif
-
-/*
- * 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)
-{
- unsigned long heapStart;
- unsigned long ramSpace;
-
- heapStart = (unsigned long)Configuration.work_space_start
- + rtems_configuration_get_work_space_size();
-
- if (heapStart & (CPU_ALIGNMENT-1))
- heapStart = (heapStart + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
-
- ramSpace = RAM_BASE + RAM_BYTES - heapStart;
-
- /* TODO */
- ramSpace -= 16384; /* Space for initial stack, not to be zeroed */
-
- bsp_libc_init((void *)heapStart, ramSpace, 0);
-}
/*
* bsp_start
@@ -78,16 +28,4 @@ void bsp_pretasking_hook(void)
void bsp_start( void )
{
- /*
- * 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 0
- Configuration.work_space_start = (void *)_WorkspaceBase;
-#else
- Configuration.work_space_start = (void *)__alt_heap_start;
-#endif
-
}