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]

Add ability to flexibly create FIS images (partitions) from a configuration file


For the 80200 (XScale) based hardware port that I am working on, there are
several reserved FIS images for the Angel boot monitor, a hardware
diagnostics utility and another utility.  I needed a way to automatically
have these images created in the FIS table.  I created a method that was
generic and allows anyone to easily create the images from a configuration
file.

Hopefully these changes are small enough that a copyright assignment is not
required.  Please let me know otherwise.

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/  Stephen Goadhouse                 Work: (434) 978-2888 x6 _/
_/  Staff Engineer       stephen.goadhouse@adiengineering.com _/
_/  ADI Engineering             http://www.adiengineering.com _/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/


Index: ecos/packages/redboot/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/redboot/current/ChangeLog,v
retrieving revision 1.81
diff -u -r1.81 ChangeLog
--- ecos/packages/redboot/current/ChangeLog	16 Sep 2002 13:18:40 -0000	1.81
+++ ecos/packages/redboot/current/ChangeLog	25 Sep 2002 00:52:16 -0000
@@ -1,3 +1,16 @@
+2002-09-24  Stephen Goadhouse  <stephen.goadhouse@adiengineering.com>
+
+	* cdl/redboot.cdl: Added CYGNUM_REDBOOT_FIS_RESV_IMAGES, which is
+	the number of reserved FIS images to add, and added
+	CYGDAT_REDBOOT_FIS_RESV_IMAGES, which is a description table of
+	the FIS images to be added.
+
+	* include/fis.h: Added fis_resv_image_desc structure which is used
+	by fis_init() to create compile-time FIS images.
+
+	* src/flash.c (fis_init): Added a flexible way for FIS
+	images to be defined via a build configuration.
+
 2002-09-16  Mark Salter  <msalter@redhat.com>

 	* src/main.c (set_console_baud_rate): Handle CYGPKG_REDBOOT_ANY_CONSOLE.
Index: ecos/packages/redboot/current/cdl/redboot.cdl
===================================================================
RCS file: /cvs/ecos/ecos/packages/redboot/current/cdl/redboot.cdl,v
retrieving revision 1.43
diff -u -r1.43 redboot.cdl
--- ecos/packages/redboot/current/cdl/redboot.cdl	24 Aug 2002 11:34:50 -0000
1.43
+++ ecos/packages/redboot/current/cdl/redboot.cdl	25 Sep 2002 00:52:18 -0000
@@ -549,6 +549,37 @@
                     RedBoot that boots the board."
             }

+            cdl_option CYGNUM_REDBOOT_FIS_RESV_IMAGES {
+                display       "Number of reserved images in Flash"
+                flavor        data
+                default_value 0
+                description "
+                  This option determines the number of reserved images
stored
+                  in Flash (not counting the RedBoot image(s))."
+
+
+            }
+
+	    cdl_option CYGDAT_REDBOOT_FIS_RESV_IMAGES {
+		display       "Names of reserved images in Flash"
+		flavor        data
+		default_value {""}
+		description "
+                   This option determines the entry values of each reserved
+                   image stored in Flash (not counting the RedBoot
image(s)).
+                   The entries are in the same order as the images starting
+                   with the image with the lowest address. The values for
+                   each entry are: name, flash_base, mem_base, size,
+                   entry_point, data_length. Enter N/A's as a 0.
+                   Ex. user_value:
+
+                 user_value \"{\\\"Angel\\\", 0x00040000, 0x00040000,
0x00040000, 0, 0}, \\
+                              {\\\"Diags\\\", 0x00080000, 0x00080000,
0x00040000, 0, 0}, \\
+                              {\\\"Diags\\\[ram\\\]\\\", 0x000C0000,
0xc0020000, 0x00040000, 0xc0020000, 0}, \\
+                              {\\\"Util\\\", 0x00100000, 0x00100000,
0x00040000, 0, 0}\"
+                "
+	    }
+
             cdl_option CYGOPT_REDBOOT_FIS_DIRECTORY_ARM_SIB_ID {
                 display         "Include ARM SIB ID in FIS"
                 default_value   0
Index: ecos/packages/redboot/current/include/fis.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/redboot/current/include/fis.h,v
retrieving revision 1.6
diff -u -r1.6 fis.h
--- ecos/packages/redboot/current/include/fis.h	24 Aug 2002 11:20:55 -0000
1.6
+++ ecos/packages/redboot/current/include/fis.h	25 Sep 2002 00:52:31 -0000
@@ -73,6 +73,18 @@
     unsigned long file_cksum;    // Checksum over image data
 };

+// fis_resv_image_desc is the struct that describes the FIS Reserved
Images.
+// This allows these values to be set in the appropriate CDL file.
+// fis_resv_image_desc is the important entries from fis_image_desc.
+struct fis_resv_image_desc {
+    unsigned char name[16];      // Null terminated name
+    CYG_ADDRESS   flash_base;    // Address within FLASH of image
+    CYG_ADDRESS   mem_base;      // Address in memory where it executes
+    unsigned long size;          // Length of image
+    CYG_ADDRESS   entry_point;   // Execution entry point
+    unsigned long data_length;   // Length of actual data
+};
+
 struct fis_image_desc *fis_lookup(char *name, int *num);

 #endif // CYGOPT_REDBOOT_FIS
Index: ecos/packages/redboot/current/src/flash.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/redboot/current/src/flash.c,v
retrieving revision 1.41
diff -u -r1.41 flash.c
--- ecos/packages/redboot/current/src/flash.c	27 Aug 2002 11:06:48 -0000
1.41
+++ ecos/packages/redboot/current/src/flash.c	25 Sep 2002 00:52:38 -0000
@@ -324,6 +324,33 @@
     img++;
     redboot_flash_start += redboot_image_size;
 #endif
+#if CYGNUM_REDBOOT_FIS_RESV_IMAGES > 0
+    // Add descriptors for each reserved image if there is any
+    {
+       int i;
+       const struct fis_resv_image_desc
+           images[CYGNUM_REDBOOT_FIS_RESV_IMAGES] =
+                        {CYGDAT_REDBOOT_FIS_RESV_IMAGES};
+
+       for(i=0;i<CYGNUM_REDBOOT_FIS_RESV_IMAGES;i++){
+           // clear the destination entry first
+           memset(img, 0, sizeof(*img));
+
+          // Copy only the chars from images[i].name that will fit into
+          // the img structure.  Leave 1 char for the null terminator.
+          // Since the entire structure is set to 0 by memset() above, the
+          // null terminator already exists.
+	  strncpy(img->name, images[i].name, sizeof(img->name)-1);
+	  img->flash_base  = images[i].flash_base;
+	  img->mem_base    = images[i].mem_base;
+	  img->size        = images[i].size;
+	  img->entry_point = images[i].entry_point;
+	  img->data_length = images[i].data_length;
+	  img++;
+	  redboot_flash_start += images[i].size;
+       }
+    }
+#endif
 #ifdef CYGSEM_REDBOOT_FLASH_CONFIG
     // And a descriptor for the configuration data
     memset(img, 0, sizeof(*img));




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