[U-Boot] [PATCH] powerpc/83xx: increment malloc heap size for the MPC832x MDS boards

Scott Wood scottwood at freescale.com
Tue Mar 20 19:40:48 CET 2012


On 03/18/2012 04:07 AM, Wolfgang Denk wrote:
> Dear Tabi Timur-B04825,
> 
> In message <CAOZdJXUem_-mgDSqF+p4R0npZQ6qu14G1yexQCBUe2G=nr2-1Q at mail.gmail.com> you wrote:
>>
>>> Doubling it is kind of aggressive strategy.  You know exactly how much
>>> free room needs to be guaranteed, so why don't you auto-adjust the
>>> size?
>>>
>>>> -#define CONFIG_SYS_MALLOC_LEN        (128 * 1024)    /* Res=
>> erved for malloc */
>>>> +#define CONFIG_SYS_MALLOC_LEN        (256 * 1024)    /* Res=
>> erved for malloc */
>>>
>>> How about:
>>>
>>> #define CONFIG_SYS_MALLOC_LEN   (128 * 1024 + CONFIG_ENV_SECT_SIZE)
>>
>> That's the same thing.  CONFIG_ENV_SECT_SIZE is 128KB.  Plus, as you
> 
> No, it's not the same thing.

You really want CONFIG_SYS_MALLOC_LEN to be a list of everything that
could be mallocked -- or worse, a list of just the things that people
have noticed breaking in the past (even though other things could later
be depending on that increase in size)?  You want to answer questions
about why NAND breaks on a board with a smaller NOR sector size? :-P

> Your code is static an either wasted moemory on systems with smaller sector size,

Come on, you're worried about a 128K increase in memory reserved for the
use of the bootloader?  It's not "wasted".  The only thing that area
of memory could otherwise be used for is loading images and such, and it
is very unlikely that this small change is going to matter there.

> or needs to be readjusted on systems with bigger sectors.
> 
> Don;t just think about your current situation, but also what happens
> when you (or somebody else) copies that code for other systems.
> 
> Make your code more robust.

The robust thing to do would be to not be stingy with the malloc size,
and change all boards to have at least 1 MiB for malloc (except ones
with very small amounts of RAM).  Maybe have a debug command to print
max memory usage since boot, to see if a board is getting anywhere near
the limit.

-Scott



More information about the U-Boot mailing list