[U-Boot] [U-BOOT] [PATCH] env: reduce the stack footprint for the env buf
Graeme Russ
graeme.russ at gmail.com
Mon Feb 7 06:04:04 CET 2011
On Mon, Feb 7, 2011 at 3:38 PM, Lei Wen <adrian.wenl at gmail.com> wrote:
> Hi Wolfgang,
>
> On Mon, Feb 7, 2011 at 12:08 AM, Wolfgang Denk <wd at denx.de> wrote:
>> Dear Lei Wen,
>>
>> In message <AANLkTin1U7WZnVKhOaTzkW4UEDQ1iZtLZBo6-qBMoUzY at mail.gmail.com> you wrote:
>>>
> My current implementation is to do a memory dump by using the uboot,
> while uboot's only task is to compress and write the memory to the sd card.
> For the compress and write part need a lot of heap, 350k+, if still keep the
> env buf in the stack, it would increase the total memory touched by uboot...
>
> As dump usage need uboot touch the least memory, so this is the purpose
> I submit this patch... Reuse the heap area at its best, and don't increase stack
> much in the runtime...
>
Ah, so with the env buffer on the stack, the bottom of the stack is being
pushed into the memory you want to dump and corrupting it - Makes sense to
me now that you would resort to moving the env buffer to the heap.
There are probably a number of other areas in u-boot where large buffers
are put on the stack while the malloc pool is relatively empty with the
end result being that u-boot is using more memory than strictly required.
It would be an interesting profiling excercise
Regards,
Graeme
More information about the U-Boot
mailing list