who should i post this mail to??<br><br>---------- Forwarded message ----------<br><span class="gmail_quote">From: <b class="gmail_sendername">ÖìºéÁÁ</b> <<a href="mailto:aspirefhaha@gmail.com">aspirefhaha@gmail.com</a>>
<br>Date: 2007-6-21 ÏÂÎç4:20<br>Subject: [U-Boot-Users]problem of malloc return 0<br>To: <a href="mailto:u-boot-users@lists.sourceforge.net">u-boot-users@lists.sourceforge.net</a><br><br></span>Hi<br> i am new to uboot,<br>
I am porting uboot to lpc2220 on my board,and when run at env_relocate() in start_armboot(void), i get sometrouble.<br><br>/**** code from lib_arm/board.c ***/<br>void env_relocate (void)
<br>{<br> DEBUGF ("%s[%d] offset = 0x%lx\n", __FUNCTION__,__LINE__,<br> gd->reloc_off);<br><br>#ifdef CONFIG_AMIGAONEG3SE<br> enable_nvram();<br>#endif<br><br>#ifdef ENV_IS_EMBEDDED<br> /*<br>
* The environment buffer is embedded with the text segment,<br> * just relocate the environment pointer<br> */<br> env_ptr = (env_t *)((ulong)env_ptr + gd->reloc_off);<br> DEBUGF ("%s[%d] embedded ENV at %p\n", __FUNCTION__,__LINE__,env_ptr);
<br>#else<br> /*<br> * We must allocate a buffer for the environment<br> */<br> env_ptr = (env_t *)malloc (CFG_ENV_SIZE);<br> DEBUGF ("%s[%d] malloced ENV at %p\n", __FUNCTION__,__LINE__,env_ptr);
<br>#endif<br>/* ****** code end *******/<br><br>after the code "env_ptr = (env_t *)malloc (CFG_ENV_SIZE)" the env_ptr is 0x0;<br>i change the toolchain from arm-linux to arm-elf and the return value is also 0x0,so what should i do if i want to initial for malloc,
<br>and I don't know why we call mem_malloc_init,<br><br>/******** code from lib_arm/borad.c ***/<br>static ulong mem_malloc_start = 0;<br>
static ulong mem_malloc_end = 0;<br>
static ulong mem_malloc_brk = 0;<br>
<br>
static<br>
void mem_malloc_init (ulong dest_addr)<br>
{<br>
mem_malloc_start = dest_addr;<br>
mem_malloc_end = dest_addr + CFG_MALLOC_LEN;<br>
mem_malloc_brk = mem_malloc_start;<br>
<br>
memset ((void *) mem_malloc_start, 0,<br>
mem_malloc_end - mem_malloc_start);<br>
}<br>
/********* **/<br><br>the variables are all static, does it have any relation with malloc();<br>and I find there is a function malloc_bin_reloc in dlmalloc.c , and the change the "static mbinptr av_[NAV * 2 + 2] " with the gd->reloc_off,what i should set the gd->reloc_off if there are something relation,the code below
<br><br>/***** code from common/dlmalloc.c ****/<br>void malloc_bin_reloc (void)<br>{<br> unsigned long *p = (unsigned long *)(&av_[2]);<br> int i;<br> for (i=2; i<(sizeof(av_)/sizeof(mbinptr)); ++i) {<br>
*p++ += gd->reloc_off;<br> }<br>}<br>/***** code end ****/<br><br>looking for some help,thanks<br><br> <br>