[U-Boot] [PATCH] omap: spl: fix build break due to changes in FAT

Aneesh V
2011-10-04T16:00:07Z

Dear Wolfgang,

On Tuesday 04 October 2011 09:08 PM, Wolfgang Denk wrote:
> Dear Aneesh V,
>
> In message<1317741066-31121-1-git-send-email-aneesh@ti.com> you wrote:
>> From: a0393566local (none)<a0393566local@ula0393566>
>>
>> FAT library now uses malloc() and free(). But SPL doesn't
>> have heap until now. Setup a heap in SDRAM to fix this issue.
>>
>> However this increases SPL footprint beyond the available SRAM
>> budget. So, compile out some fancy features in the SDARM init
>> bring back footprint under control
>>
>> CC: Sandeep Paulraj<s-paulraj@ti.com>
>> CC: Wolfgang Denk<wd@denx.de>
>> Signed-off-by: Aneesh V<aneesh@ti.com>
>
> I think it is a bad idea to go this way.
>
> We should face the fact that SPL code is running before proper
> relocation to RAM, and thus there are certain limitations.
>
> Certain parts of the code, including file system code, has not been
> written with such limitations in mind. It makes use of functions that
> are not available in SPL code, or of features that are not available
> in SPL code (like a heap, or a virtually unlimited stack).
>
> You may be lucky here, and your test cases with the FFAT code may
> actually work. But I would not bet on it.
>

I have mentioned why FAT is inevitable for us in a separate mail in
this thread.

>
> U-Boot has not been designed to run complex code like file systemes
> before relocation, and SPL code _is_ before relocation.

Please note that SPL is not as restricted as it seems(at least the way
it is now). For instance, OMAP SPL has
1. gd in SRAM
2. .bss in SDRAM and
3. heap in SDRAM(with this patch)
So, we have everything that takes for any driver to function as long as
the .text fits in the SRAM.

I think the same principles apply to all platforms not just OMAP. These
complex drivers are likely to be used only after SDRAM is initialized.
After SDRAM is initialized you have plenty of space for .bss and heap.
So the only limitation for an SPL should be .text and .data size.

best regards,
Aneesh