summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2008-09-17 18:38:05 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2008-09-17 18:38:05 +0000
commit1986152ec9eb574dab779deb6c041bfc2e3024c3 (patch)
tree9954ad31d950de6765fd0d30d1042128b5cf560c /c/src/lib/libbsp
parent2008-09-17 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-1986152ec9eb574dab779deb6c041bfc2e3024c3.tar.bz2
2008-09-17 Joel Sherrill <joel.sherrill@oarcorp.com>
* bootcard.c: Add support for optionally having a unified work area. In other words, the RTEMS Workspace and C Program Heap are the same pool of memory.
Diffstat (limited to 'c/src/lib/libbsp')
-rw-r--r--c/src/lib/libbsp/shared/ChangeLog6
-rw-r--r--c/src/lib/libbsp/shared/bootcard.c27
2 files changed, 23 insertions, 10 deletions
diff --git a/c/src/lib/libbsp/shared/ChangeLog b/c/src/lib/libbsp/shared/ChangeLog
index 0d2c86ee02..e412505775 100644
--- a/c/src/lib/libbsp/shared/ChangeLog
+++ b/c/src/lib/libbsp/shared/ChangeLog
@@ -1,3 +1,9 @@
+2008-09-17 Joel Sherrill <joel.sherrill@oarcorp.com>
+
+ * bootcard.c: Add support for optionally having a unified work area. In
+ other words, the RTEMS Workspace and C Program Heap are the same pool
+ of memory.
+
2008-09-17 Miao Yan <yanmiaobest@gmail.com>
* bsplibc.c, bsppost.c: Merge GSOC project code to add simple device
diff --git a/c/src/lib/libbsp/shared/bootcard.c b/c/src/lib/libbsp/shared/bootcard.c
index 78b04ecde6..5fa922c83d 100644
--- a/c/src/lib/libbsp/shared/bootcard.c
+++ b/c/src/lib/libbsp/shared/bootcard.c
@@ -53,6 +53,11 @@
char *rtems_progname;
/*
+ * Are we using a single heap for the RTEMS Workspace and C Program Heap?
+ */
+extern bool rtems_unified_work_area;
+
+/*
* These are the prototypes and helper routines which are used
* when the BSP lets the framework handle RAM allocation between
* the RTEMS Workspace and C Program Heap.
@@ -67,7 +72,8 @@ char *rtems_progname;
{
size_t heap_size_default = 0;
- if (heap_start == BSP_BOOTCARD_HEAP_USES_WORK_AREA) {
+ if ( !rtems_unified_work_area &&
+ heap_start == BSP_BOOTCARD_HEAP_USES_WORK_AREA) {
/* Use the work area start as heap start */
heap_start = work_area_start;
@@ -165,8 +171,6 @@ int boot_card(
*/
#if defined(BSP_BOOTCARD_HANDLES_RAM_ALLOCATION)
{
- void *work_space_start = NULL;
-
bsp_get_work_area(
&work_area_start,
&work_area_size,
@@ -174,17 +178,20 @@ int boot_card(
&heap_size
);
- work_space_start = (char *) work_area_start + work_area_size
- - rtems_configuration_get_work_space_size();
-
- if ((uintptr_t) work_space_start <= (uintptr_t) work_area_start) {
- printk( "bootcard: Work space to big for work area!\n");
+ if ( work_area_size <= Configuration.work_space_size ) {
+ printk( "bootcard: Work space too big for work area!\n");
bsp_cleanup();
return -1;
}
- Configuration.work_space_start = work_space_start;
-
+ if ( rtems_unified_work_area ) {
+ Configuration.work_space_start = work_area_start;
+ Configuration.work_space_size = work_area_size;
+ } else {
+ Configuration.work_space_start = (char *) work_area_start +
+ work_area_size - rtems_configuration_get_work_space_size();
+ }
+
#if (BSP_DIRTY_MEMORY == 1)
memset( work_area_start, 0xCF, work_area_size);
#endif