]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - keystone-rtos/ibl.git/commitdiff
Bug fix for automatic file format detection
authorMike Line <m-line1@ti.com>
Fri, 12 Nov 2010 20:51:47 +0000 (15:51 -0500)
committerMike Line <m-line1@ti.com>
Fri, 12 Nov 2010 20:51:47 +0000 (15:51 -0500)
The addition of ifdefs around the auto format detection code resulted in
a change in the structure of the if statement. This bug meant only ELF
could be detected, BIS and COFF would be detected and then the change
discarded. The code was restructured to fix this.

src/ethboot/ethboot.c
src/ibl.h
src/main/iblinit.c
src/main/iblmain.c
src/make/Makefile
src/make/ibl_c6472/ibl_common.inc
src/util/i2cConfig/i2cConfig.gel

index e0f7548997a4a761416880edc32f51bc489d4a1e..a8fb492969b1268f75de32d948d6333a04043c7c 100644 (file)
@@ -186,6 +186,7 @@ void iblEthBoot (Int32 eIdx)
 
     }
 
+
     entry = iblBoot (&net_boot_module, format, &ibl.ethConfig[eIdx].blob);
 
 
index 5574d05bf03ad3bb7448a75f8869c094e7152a61..5b0e0b9c62a6a153455f1af82042418f2bc2eb44 100644 (file)
--- a/src/ibl.h
+++ b/src/ibl.h
@@ -463,18 +463,15 @@ typedef struct iblStatus_s
     uint32 mapRetries;      /**<  Number of times the checksum failed on the read of the i2c map */
     uint32 i2cDataRetries;  /**<  Number of retries while reading block data from the i2c */
     
-    int32  tableLoadFail;   /**<  If non-zero then the load of the parameter table from i2c failed */
-    
     int32  heartBeat;       /**<  An increasing value as long as the boot code is running */
-    int32  noMagic;         /**<  A non-zero value here indicates that @ref ibl_MAGIC_VALUE was not found
-                                  in the @ref ibl_t magic field, and default values were loaded. */
+    
     int32  activePeriph;    /**<  Describes the active boot peripheral @ref iblActivePeriph */
     int32  activeFormat;    /**<  Describes the format being decoded */
     
-    int32  autoDetectFailCnt;       /**<  Counts the number of times an auto detect of the data format failed */
-    int32  nameDetectFailCnt;       /**<  Counts the number of times an name detect of the data format failed */
+    uint32  autoDetectFailCnt;      /**<  Counts the number of times an auto detect of the data format failed */
+    uint32  nameDetectFailCnt;      /**<  Counts the number of times an name detect of the data format failed */
     
-    int32 invalidDataFormatSpec;    /**<  Counts the number of times the main boot found an invalid boot format request */
+    uint32 invalidDataFormatSpec;   /**<  Counts the number of times the main boot found an invalid boot format request */
     
     uint32 exitAddress;             /**<  If non-zero the IBL exited and branched to this address */
     
index 3fee3f2ec1984dd2ccb13176deebadc2ceffa76a..a5986eb420ff933eb59f2c3d6cc1a9885a60ad21 100644 (file)
@@ -429,7 +429,8 @@ void main (void)
     iblI2cMap_t  map;
 
     memset (&iblStatus, 0, sizeof(iblStatus_t));
-    iblStatus.iblMagic = ibl_MAGIC_VALUE;
+    iblStatus.iblMagic     = ibl_MAGIC_VALUE;
+    iblStatus.activePeriph = ibl_ACTIVE_PERIPH_I2C;
 
     /* Read the endianness setting of the device */
     littleEndian = deviceIsLittleEndian();
index 2bd7e484b530378675041553b02d454fe85d5d98..c734b02d2e85665eef23067621bdde8a30591990 100644 (file)
@@ -125,14 +125,19 @@ void main (void)
 
 #ifndef EXCLUDE_ETH
             for (j = 0; j < ibl_N_ETH_PORTS; j++)  {
-                if (ibl.ethConfig[j].ethPriority == i)
-                iblEthBoot (j);
+                if (ibl.ethConfig[j].ethPriority == i)  {
+                    iblStatus.activePeriph = ibl_ACTIVE_PERIPH_ETH;
+                    memcpy (&iblStatus.ethParams, &ibl.ethConfig[j].ethInfo, sizeof (iblEthBootInfo_t));
+                    iblEthBoot (j);
+                }
             }
 #endif
 
 #ifndef EXCLUDE_NAND
-            if (ibl.nandConfig.nandPriority == i)
+            if (ibl.nandConfig.nandPriority == i)  {
+                iblStatus.activePeriph = ibl_ACTIVE_PERIPH_NAND;
                 iblNandBoot ();
+            }
 #endif
 
             iblStatus.heartBeat += 1;
@@ -159,45 +164,44 @@ void main (void)
  */
 Uint32 iblBoot (BOOT_MODULE_FXN_TABLE *bootFxn, Int32 dataFormat, void *formatParams)
 { 
-    Uint32 entry = 0;
-
-    union  {
-
-        Uint8   dataBuf[4];   /* Place holder */
-        Uint32  bisValue;
-        Uint16  coffVer;    
-
-    } fid;
-
+    Uint32  entry = 0;
+    Uint32  value32;
+    Uint8   dataBuf[4];   
+    Uint16  value16;
 
     /* Determine the data format if required */
     if (dataFormat == ibl_BOOT_FORMAT_AUTO)  {
 
-        (*bootFxn->peek)((Uint8 *)&fid, sizeof(fid));
+        (*bootFxn->peek)(dataBuf, sizeof(dataBuf));
+        value32 = (dataBuf[0] << 24) | (dataBuf[1] << 16) | (dataBuf[2] << 8) | (dataBuf[3] << 0);
+        value16 = (dataBuf[0] <<  8) | (dataBuf[1] <<  0);
 
         /* BIS */
 #ifndef EXCLUDE_BIS
-        if (fid.bisValue == BIS_MAGIC_NUMBER)
+        if (value32 == BIS_MAGIC_NUMBER)
             dataFormat = ibl_BOOT_FORMAT_BIS;
 #endif
 
 #ifndef EXCLUDE_COFF
-        if (iblIsCoff (fid.coffVer))
+        if (iblIsCoff (value16))
             dataFormat = ibl_BOOT_FORMAT_COFF;
 #endif
 
 #ifndef EXCLUDE_ELF
-        if (iblIsElf (fid.dataBuf))
+        if (iblIsElf (dataBuf))
             dataFormat = ibl_BOOT_FORMAT_ELF;
 #endif
 
-        else  {
+        if (dataFormat == ibl_BOOT_FORMAT_AUTO)  {
             iblStatus.autoDetectFailCnt += 1;
             return (0);
         }
     }        
 
 
+    iblStatus.activeFormat = dataFormat;
+
+
     /* Invoke the parser */
     switch (dataFormat)  {
 
index c24fcd041b2052dad6a465b4279cb3744c22b8a5..b894e3e9598141510c63d8c7b860702cd472deac 100644 (file)
@@ -5,7 +5,7 @@
 #*
 #* DESCRIPTION: Builds the Intermediate Boot Loader (IBL)
 #*
-#*  Usage:  make c6455 | c6472 | c6474 | c6474l | c6457 [DEBUG=yes] [ETH=no] [NAND=no]  \
+#*  Usage:  make c6455 | c6472 | c6474 | c6457 [DEBUG=yes] [ETH=no] [NAND=no]  \
 #*          [BIS=no] [COFF=no] [BLOB=no] [ELF=no] [ENDIAN= both | big | little] [I2C_BUS_ADDR= 0x50 | 0x51] \
 #*                     [COMPACT_I2C=yes]
 #*
@@ -15,7 +15,7 @@
 #*
 #* or to test the builds by making all the devices and testing excludes
 #*
-#*                     make test
+#*                     make test_build
 #*******************************************************************************************
 
 IBLS_C6X= c6455 c6472 c6474 c6474l c6457
@@ -108,7 +108,7 @@ evm_c6474:
 
 
 # Test - builds all the targets, with single component exclusion
-test:
+test_build:
        make -f makestg1 ARCH=c64x TARGET=c6455 I2C_BUS_ADDR=0x50 COMPACT_I2C=no ENDIAN_MODE=both EXCLUDES=     c6455
        make -f makestg1 ARCH=c64x TARGET=c6455 I2C_BUS_ADDR=0x50 COMPACT_I2C=no ENDIAN_MODE=both EXCLUDES=ETH  c6455
        make -f makestg1 ARCH=c64x TARGET=c6455 I2C_BUS_ADDR=0x50 COMPACT_I2C=no ENDIAN_MODE=both EXCLUDES=NAND c6455
index f663967b9084ea4d769eedf1c98721e51f75dc51..8c3c3d30ef24157e81758df18333efa62e4985d3 100644 (file)
@@ -15,8 +15,8 @@
 
 MEMORY
 {
-       TEXT_INIT :  origin = 0x800000, length = 0x2800
-       TEXT      :  origin = 0x802800, length = 0xd800
+       TEXT_INIT :  origin = 0x800000, length = 0x2900
+       TEXT      :  origin = 0x802900, length = 0xd700
        STACK     :  origin = 0x810000, length = 0x0800
        HEAP      :  origin = 0x810800, length = 0x6000
        DATA_INIT :  origin = 0x816800, length = 0x0200
index 744b2306bbe38b757a9182776bb22f3062c7d926..b0f3a7f910aa123f2bcbc059049e779f534c19f4 100644 (file)
@@ -60,7 +60,7 @@ hotmenu setConfig_c6472()
     ibl.ethConfig[0].doBootp          = FALSE;\r
     ibl.ethConfig[0].useBootpServerIp = FALSE;\r
     ibl.ethConfig[0].useBootpFileName = FALSE;\r
-    ibl.ethConfig[0].bootFormat       = ibl_BOOT_FORMAT_BBLOB;\r
+    ibl.ethConfig[0].bootFormat       = ibl_BOOT_FORMAT_AUTO;\r
 \r
 \r
     SETIP(ibl.ethConfig[0].ethInfo.ipAddr,    10,218,109,21);\r
@@ -78,10 +78,10 @@ hotmenu setConfig_c6472()
     ibl.ethConfig[0].ethInfo.fileName[2]  = 's';\r
     ibl.ethConfig[0].ethInfo.fileName[3]  = 't';\r
     ibl.ethConfig[0].ethInfo.fileName[4]  = '.';\r
-    ibl.ethConfig[0].ethInfo.fileName[5]  = 'b';\r
-    ibl.ethConfig[0].ethInfo.fileName[6]  = 'l';\r
-    ibl.ethConfig[0].ethInfo.fileName[7]  = 'o';\r
-    ibl.ethConfig[0].ethInfo.fileName[8]  = 'b';\r
+    ibl.ethConfig[0].ethInfo.fileName[5]  = 'o';\r
+    ibl.ethConfig[0].ethInfo.fileName[6]  = 'u';\r
+    ibl.ethConfig[0].ethInfo.fileName[7]  = 't';\r
+    ibl.ethConfig[0].ethInfo.fileName[8]  = '\0';\r
     ibl.ethConfig[0].ethInfo.fileName[9]  = '\0';\r
     ibl.ethConfig[0].ethInfo.fileName[10] = '\0';\r
     ibl.ethConfig[0].ethInfo.fileName[11] = '\0';\r
@@ -104,7 +104,7 @@ hotmenu setConfig_c6472()
     ibl.ethConfig[1].doBootp          = TRUE;\r
     ibl.ethConfig[1].useBootpServerIp = TRUE;\r
     ibl.ethConfig[1].useBootpFileName = TRUE;\r
-    ibl.ethConfig[1].bootFormat       = ibl_BOOT_FORMAT_BBLOB;\r
+    ibl.ethConfig[1].bootFormat       = ibl_BOOT_FORMAT_AUTO;\r
 \r
 \r
     /* SGMII not present */\r
@@ -161,6 +161,25 @@ hotmenu setConfig_c6472()
     /* Nand boot is disabled */\r
     ibl.nandConfig.nandPriority = ibl_DEVICE_NOBOOT;\r
 \r
+    ibl.nandConfig.bootFormat   = ibl_BOOT_FORMAT_AUTO;\r
+\r
+    ibl.nandConfig.nandInfo.busWidthBits  = 8;\r
+    ibl.nandConfig.nandInfo.pageSizeBytes = 2048;\r
+    ibl.nandConfig.nandInfo.pageEccBytes  = 64;\r
+    ibl.nandConfig.nandInfo.pagesPerBlock = 64;\r
+    ibl.nandConfig.nandInfo.totalBlocks   = 1024;\r
+\r
+    ibl.nandConfig.nandInfo.addressBytes  = 4;\r
+    ibl.nandConfig.nandInfo.lsbFirst      = TRUE;\r
+    ibl.nandConfig.nandInfo.blockOffset   = 22;\r
+    ibl.nandConfig.nandInfo.pageOffset    = 16;\r
+    ibl.nandConfig.nandInfo.columnOffset  = 0;\r
+\r
+    ibl.nandConfig.nandInfo.resetCommand    = 0xff;\r
+    ibl.nandConfig.nandInfo.readCommandPre  = 0;\r
+    ibl.nandConfig.nandInfo.readCommandPost = 0x30;\r
+    ibl.nandConfig.nandInfo.postCommand     = TRUE;\r
+\r
 }\r
 \r
 \r