[U-Boot] [U-BOOT] [PATCH] env: reduce the stack footprint for the env buf
Wolfgang Denk
wd at denx.de
Sat Feb 5 09:30:50 CET 2011
Dear Lei Wen,
In message <AANLkTin-EBt+PA0TmdLBPAqo3pBjwmbNLdFUj2K-JOnX at mail.gmail.com> you wrote:
>
> > In which way do you think this will save any memory?
>
> This patch is not intend to save memory...
Then I don't understand at all what the benefit of that patch would
be.
> One of our project need to confine the ddr usage of uboot in the smallest case,
> not to pollute other area. So for us, the small stack is good one...
So it is still about saving memory...
> For now the uboot is relocated to the end of the dram, and malloc area is
> almost a fix value, uboot would live happily in this area. But for env case,
> it allocate a range which could be large, due to the CONFIG_ENV_SIZE
> could be a big one, in the stack range. Because the stack is grown downwards,
> so it takes more memory range than it is allocated in the malloc method.
malloc arena and stack are adjacent. If you have enough free room in
the malloc arena for the environment buffers, but cannot afford to
have them on your stack, then this means your malloc arena has lots of
unused space. Decrease the size of your malloc arena by the size of
the environment buffer, and you reach the same goal as with your
patch - actually you save more memory, as the code size of u-boot
shrinks.
Can you please provide exact numbers? How big is your RAM? What is
the debug output of arch/*/lib/board.c without and with this patch on
your system? How big is your environment resp. the environment
sectors?
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Voodoo Programming: Things programmers do that they know shouldn't
work but they try anyway, and which sometimes actually work, such as
recompiling everything. - Karl Lehenbauer
More information about the U-Boot
mailing list