This is the mail archive of the
mailing list for the eCos project.
RedBoot: use 'workspace' memory region if it exists
- From: David Vrabel <dvrabel at arcom dot com>
- To: eCos Patches <ecos-patches at ecos dot sourceware dot org>
- Date: Thu, 21 Apr 2005 10:42:31 +0100
- Subject: RedBoot: use 'workspace' memory region if it exists
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, Design Engineer
Arcom, Clifton Road Tel: +44 (0)1223 411200 ext. 3233
Cambridge CB1 7EA, UK Web: http://www.arcom.com/
--- 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 <email@example.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 <firstname.lastname@example.org>
* src/decompress.c (zcfree): Remove unnecessary variable
--- 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 );
+ workspace_start = (unsigned char *)CYGMEM_SECTION_workspace;
+ workspace_end = (unsigned char *)(CYGMEM_SECTION_workspace+CYGMEM_SECTION_workspace_SIZE);
workspace_start = (unsigned char *)CYGMEM_SECTION_heap1;
workspace_end = (unsigned char *)(CYGMEM_SECTION_heap1+CYGMEM_SECTION_heap1_SIZE);