This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RedBoot: use 'workspace' memory region if it exists


Hi,

RedBoot currently use the heap1 memory region as its workspace.  This
can cause problems if some RedBoot feature (such as JFFS2 fileystem
support) uses the heap (since the heap is defined by the heal1 memory
region).  The problem is that RedBoot can overwrite the heap when
loading images (e.g., from a JFFS2 filesystem) which can cause loads to
fail (e.g., JFFS2 gets completely confused since it's fileystem data in
the heap gets trashed).

The trivial solution presented in this patch is to use a second memory
region ('workspace') as the region of RAM where it is safe to load
images. The platform must, of course, provide suitable memory layout
linker scripts and header files that define such a region.

If no workspace memory region is defined RedBoot will continue to use
heap1 as before, thus this patch won't change any existing platforms.

The layout we use for ROM images is heap1 being the region from the end
of the application (.data etc.) to 4 Mibyte and workspace being the rest
of RAM. RAM images are linked to run at 4 Mibyte (so they can be loaded
into the workspace) and have a heap1 ending a 8 Mibyte with workspace
again extending to the end of RAM.

David Vrabel
-- 
David Vrabel, Design Engineer

Arcom, Clifton Road           Tel: +44 (0)1223 411200 ext. 3233
Cambridge CB1 7EA, UK         Web: http://www.arcom.com/
%status
pending
%patch
Index: packages/redboot/current/ChangeLog
===================================================================
--- packages/redboot/current/ChangeLog.orig	2005-04-21 10:04:40.000000000 +0100
+++ packages/redboot/current/ChangeLog	2005-04-21 10:17:36.000000000 +0100
@@ -1,3 +1,9 @@
+2005-04-21  David Vrabel  <dvrabel@arcom.com>
+
+	* src/main.c (cyg_start): Use the workspace memory section
+	(CYGMEM_SECTION_workspace) as the workspace if it is defined.
+	This prevents the user from trampling over the heap1 section.
+
 2005-04-21  Ian Campbell  <icampbell@arcom.com>
 
 	* src/decompress.c (zcfree): Remove unnecessary variable
Index: packages/redboot/current/src/main.c
===================================================================
--- packages/redboot/current/src/main.c.orig	2005-04-21 10:02:09.000000000 +0100
+++ packages/redboot/current/src/main.c	2005-04-21 10:15:32.000000000 +0100
@@ -284,7 +284,11 @@
         ram_end = HAL_MEM_REAL_REGION_TOP( ram_end_tmp );
     }
 #endif
-#ifdef CYGMEM_SECTION_heap1
+
+#if defined(CYGMEM_SECTION_workspace)
+    workspace_start = (unsigned char *)CYGMEM_SECTION_workspace;
+    workspace_end = (unsigned char *)(CYGMEM_SECTION_workspace+CYGMEM_SECTION_workspace_SIZE);
+#elif defined(CYGMEM_SECTION_heap1)
     workspace_start = (unsigned char *)CYGMEM_SECTION_heap1;
     workspace_end = (unsigned char *)(CYGMEM_SECTION_heap1+CYGMEM_SECTION_heap1_SIZE);
 #else

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]