* [U-Boot-Users] problem of malloc return 0
@ 2007-06-21 8:20 朱洪亮
2007-06-21 16:49 ` [U-Boot-Users] Fwd: " 朱洪亮
0 siblings, 1 reply; 5+ messages in thread
From: 朱洪亮 @ 2007-06-21 8:20 UTC (permalink / raw)
To: u-boot
Hi
i am new to uboot,
I am porting uboot to lpc2220 on my board,and when run at env_relocate()
in start_armboot(void), i get sometrouble.
/**** code from lib_arm/board.c ***/
void env_relocate (void)
{
DEBUGF ("%s[%d] offset = 0x%lx\n", __FUNCTION__,__LINE__,
gd->reloc_off);
#ifdef CONFIG_AMIGAONEG3SE
enable_nvram();
#endif
#ifdef ENV_IS_EMBEDDED
/*
* The environment buffer is embedded with the text segment,
* just relocate the environment pointer
*/
env_ptr = (env_t *)((ulong)env_ptr + gd->reloc_off);
DEBUGF ("%s[%d] embedded ENV at %p\n", __FUNCTION__,__LINE__,env_ptr);
#else
/*
* We must allocate a buffer for the environment
*/
env_ptr = (env_t *)malloc (CFG_ENV_SIZE);
DEBUGF ("%s[%d] malloced ENV at %p\n", __FUNCTION__,__LINE__,env_ptr);
#endif
/* ****** code end *******/
after the code "env_ptr = (env_t *)malloc (CFG_ENV_SIZE)" the env_ptr is
0x0;
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,
and I don't know why we call mem_malloc_init,
/******** code from lib_arm/borad.c ***/
static ulong mem_malloc_start = 0;
static ulong mem_malloc_end = 0;
static ulong mem_malloc_brk = 0;
static
void mem_malloc_init (ulong dest_addr)
{
mem_malloc_start = dest_addr;
mem_malloc_end = dest_addr + CFG_MALLOC_LEN;
mem_malloc_brk = mem_malloc_start;
memset ((void *) mem_malloc_start, 0,
mem_malloc_end - mem_malloc_start);
}
/********* **/
the variables are all static, does it have any relation with malloc();
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
/***** code from common/dlmalloc.c ****/
void malloc_bin_reloc (void)
{
unsigned long *p = (unsigned long *)(&av_[2]);
int i;
for (i=2; i<(sizeof(av_)/sizeof(mbinptr)); ++i) {
*p++ += gd->reloc_off;
}
}
/***** code end ****/
looking for some help,thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.denx.de/pipermail/u-boot/attachments/20070621/6b1cdb2a/attachment.htm
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot-Users] Fwd: problem of malloc return 0
2007-06-21 8:20 [U-Boot-Users] problem of malloc return 0 朱洪亮
@ 2007-06-21 16:49 ` 朱洪亮
2007-06-21 16:58 ` Markus Klotzbücher
0 siblings, 1 reply; 5+ messages in thread
From: 朱洪亮 @ 2007-06-21 16:49 UTC (permalink / raw)
To: u-boot
who should i post this mail to??
---------- Forwarded message ----------
From: ??? <aspirefhaha@gmail.com>
Date: 2007-6-21 ??4:20
Subject: [U-Boot-Users]problem of malloc return 0
To: u-boot-users at lists.sourceforge.net
Hi
i am new to uboot,
I am porting uboot to lpc2220 on my board,and when run at env_relocate()
in start_armboot(void), i get sometrouble.
/**** code from lib_arm/board.c ***/
void env_relocate (void)
{
DEBUGF ("%s[%d] offset = 0x%lx\n", __FUNCTION__,__LINE__,
gd->reloc_off);
#ifdef CONFIG_AMIGAONEG3SE
enable_nvram();
#endif
#ifdef ENV_IS_EMBEDDED
/*
* The environment buffer is embedded with the text segment,
* just relocate the environment pointer
*/
env_ptr = (env_t *)((ulong)env_ptr + gd->reloc_off);
DEBUGF ("%s[%d] embedded ENV at %p\n", __FUNCTION__,__LINE__,env_ptr);
#else
/*
* We must allocate a buffer for the environment
*/
env_ptr = (env_t *)malloc (CFG_ENV_SIZE);
DEBUGF ("%s[%d] malloced ENV at %p\n", __FUNCTION__,__LINE__,env_ptr);
#endif
/* ****** code end *******/
after the code "env_ptr = (env_t *)malloc (CFG_ENV_SIZE)" the env_ptr is
0x0;
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,
and I don't know why we call mem_malloc_init,
/******** code from lib_arm/borad.c ***/
static ulong mem_malloc_start = 0;
static ulong mem_malloc_end = 0;
static ulong mem_malloc_brk = 0;
static
void mem_malloc_init (ulong dest_addr)
{
mem_malloc_start = dest_addr;
mem_malloc_end = dest_addr + CFG_MALLOC_LEN;
mem_malloc_brk = mem_malloc_start;
memset ((void *) mem_malloc_start, 0,
mem_malloc_end - mem_malloc_start);
}
/********* **/
the variables are all static, does it have any relation with malloc();
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
/***** code from common/dlmalloc.c ****/
void malloc_bin_reloc (void)
{
unsigned long *p = (unsigned long *)(&av_[2]);
int i;
for (i=2; i<(sizeof(av_)/sizeof(mbinptr)); ++i) {
*p++ += gd->reloc_off;
}
}
/***** code end ****/
looking for some help,thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.denx.de/pipermail/u-boot/attachments/20070622/2d9ab9e0/attachment.htm
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot-Users] Fwd: problem of malloc return 0
2007-06-21 16:49 ` [U-Boot-Users] Fwd: " 朱洪亮
@ 2007-06-21 16:58 ` Markus Klotzbücher
2007-06-21 17:19 ` fhaha
0 siblings, 1 reply; 5+ messages in thread
From: Markus Klotzbücher @ 2007-06-21 16:58 UTC (permalink / raw)
To: u-boot
"???" <aspirefhaha@gmail.com> writes:
> who should i post this mail to??
The list is the right place for patches, but before sending anything you
should (have) carefully read
http://www.denx.de/wiki/UBoot/Patches
Especially you should avoid sending HTML mail.
Best regards
Markus Klotzbuecher
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot-Users] Fwd: problem of malloc return 0
2007-06-21 16:58 ` Markus Klotzbücher
@ 2007-06-21 17:19 ` fhaha
2007-06-21 21:09 ` Wolfgang Denk
0 siblings, 1 reply; 5+ messages in thread
From: fhaha @ 2007-06-21 17:19 UTC (permalink / raw)
To: u-boot
Hi
thanks for replying my mail
i just want to ask some questions,before call malloc(),what should i
do first,because now i can only get address 0x00000000 when i malloc
some memory from heap,
and I don't know why we call mem_malloc_init,
the variables are all static in file lib_arm/board.c, does it have any
relation with malloc();
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
Best regards
fhaha
2007/6/22, Markus Klotzb?cher <mk@denx.de>:
>
> "???" <aspirefhaha@gmail.com> writes:
>
> > who should i post this mail to??
>
> The list is the right place for patches, but before sending anything you
> should (have) carefully read
>
> http://www.denx.de/wiki/UBoot/Patches
>
> Especially you should avoid sending HTML mail.
>
> Best regards
>
> Markus Klotzbuecher
>
> --
> DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot-Users] Fwd: problem of malloc return 0
2007-06-21 17:19 ` fhaha
@ 2007-06-21 21:09 ` Wolfgang Denk
0 siblings, 0 replies; 5+ messages in thread
From: Wolfgang Denk @ 2007-06-21 21:09 UTC (permalink / raw)
To: u-boot
In message <8b6f882b0706211019g43928ffxb5e76e6f7e16a6@mail.gmail.com> you wrote:
> --===============0471934854==
> Content-Type: text/plain; charset=GB2312; format=flowed
> Content-Transfer-Encoding: base64
> Content-Disposition: inline
>
> SGkKICB0aGFua3MgZm9yIHJlcGx5aW5nIG15IG1haWwKICBpIGp1c3Qgd2FudCB0byBhc2sgc29t
> ZSBxdWVzdGlvbnMsYmVmb3JlIGNhbG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BhdGNoZXMK
> Pgo+IEVzcGVjaWFsbHkgeW91IHNob3VsZCBhdm9pZCBzZW5kaW5nIEhUTUwgbWFpbC4KPgo+IEJl
> c3QgcmVnYXJkcwo+Cj4gTWFya3VzIEtsb3R6YnVlY2hlcgo+Cj4gLS0KPiBERU5YIFNvZnR3YXJl
> IEVuZ2luZWVyaW5nIEdtYkgsICAgICBNRDogV29sZmdhbmcgRGVuayAmIERldGxldiBadW5kZWwK
> PiBIUkIgMTY1MjM1IE11bmljaCwgT2ZmaWNlOiBLaXJjaGVuc3RyLjUsIEQtODIxOTQgR3JvZWJl
> bnplbGwsIEdlcm1hbnkKPiBQaG9uZTogKzQ5LTgxNDItNjY5ODktMCBGYXg6ICs0OS04MTQyLTY2
> OTg5LTgwICBFbWFpbDogb2ZmaWNlQGRlbnguZGUKPgo=
Please do not send base 64 encoded messages.
Please send plain text only.
Message unreadable, ignored. Sorry.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-06-21 21:09 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-21 8:20 [U-Boot-Users] problem of malloc return 0 朱洪亮
2007-06-21 16:49 ` [U-Boot-Users] Fwd: " 朱洪亮
2007-06-21 16:58 ` Markus Klotzbücher
2007-06-21 17:19 ` fhaha
2007-06-21 21:09 ` Wolfgang Denk
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.