]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - keystone-rtos/ibl.git/blobdiff - src/interp/elf/dlw_client.c
Changed the DDR rate to 1333 and fixed the HUA boot from NOR problem
[keystone-rtos/ibl.git] / src / interp / elf / dlw_client.c
index 0d57829bb7547a081a3afae2254bb33bf15948cf..d9c00d332fdc5e0a75d01228a3f704fb373913c6 100644 (file)
 * module.
 *
 * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
-*
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions
-* are met:
-*
-* Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-*
-* Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the
-* distribution.
-*
-* Neither the name of Texas Instruments Incorporated nor the names of
-* its contributors may be used to endorse or promote products derived
-* from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
+ * 
+ *  Redistribution and use in source and binary forms, with or without 
+ *  modification, are permitted provided that the following conditions 
+ *  are met:
+ *
+ *    Redistributions of source code must retain the above copyright 
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ *    Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the 
+ *    documentation and/or other materials provided with the   
+ *    distribution.
+ *
+ *    Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
+ *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
+ *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
 */
 
 #include "types.h"
 #include <string.h>
 #include "file_ovr.h"
 
+/* Eat printfs. */
+#define printf  mprintf
+#define vprintf(x,y) 
+
 #if 0
 #include "dlw_debug.h"
 #include "dlw_dsbt.h"
@@ -107,7 +110,7 @@ int32_t DLIF_fclose(LOADER_FILE_DESC *fd)
 /*****************************************************************************/
 void* DLIF_malloc(size_t size)
 {
-   return malloc(size*sizeof(uint8_t));
+   return iblMalloc(size*sizeof(uint8_t));
 }
 
 /*****************************************************************************/
@@ -115,7 +118,7 @@ void* DLIF_malloc(size_t size)
 /*****************************************************************************/
 void DLIF_free(void* ptr)
 {
-   free(ptr);
+   iblFree(ptr);
 }
 
 /*****************************************************************************/
@@ -156,9 +159,14 @@ BOOL DLIF_allocate(struct DLOAD_MEMORY_REQUEST *targ_req)
    /*   load placement or both load and run placement, then we can do the    */
    /*   copy.                                                                */
    /*------------------------------------------------------------------------*/
-   memset(targ_req->host_address, 0, obj_desc->memsz_in_bytes);
-   fseek(f,targ_req->offset,SEEK_SET);
-   fread(targ_req->host_address,obj_desc->objsz_in_bytes,1,f);
+   if (obj_desc->objsz_in_bytes)
+   {
+       /* Do not clear uninitialized data section, so that the section can 
+          be mapped to the same region IBL uses */ 
+       memset(targ_req->host_address, 0, obj_desc->memsz_in_bytes);
+       fseek(f,targ_req->offset,SEEK_SET);
+       fread(targ_req->host_address,obj_desc->objsz_in_bytes,1,f);
+   }
 
    /*------------------------------------------------------------------------*/
    /* Once we have target address for this allocation, add debug information */