[U-Boot] U-Boot memory allocation problems with ast2500

Simon Glass sjg at chromium.org
Sat Sep 10 01:18:59 CEST 2016


Hi Maxim,

On 9 September 2016 at 15:53, Maxim Sloyko <maxims at google.com> wrote:
>
> Hi all,
>
> First, disclaimer: this is the first time I'm doing something with U-Boot or the part (ast2500), so any claim I make below can be false or just plain nonsense.

Welcome!

>
> I'm working on expanding support of Aspeed ast2500 part in U-Boot.
>
> I ran into some problems, when I tried to use Linux Kernel device tree for this part in U-Boot. Looking at diagnostic messages (http://pastebin.ca/3713876) I figured out that the problem is that U-Boot continues to use malloc_simple, even after it has been relocated to RAM. As a result, it fails to allocate 130k needed for environment, because it is larger than the configured size of a memory chunk for simple malloc.

The test for this is in dlmalloc.c - the GD_FLG_FULL_MALLOC_INIT flag.
The flag is set in initr_reloc() after relocation.

I wonder if your global_data (the 'gd' pointer) is not set up
correctly, so it cannot write to the flag.

What version of U-Boot is it? Is the tree available somewhere?

>
> I suspect that this has something to do with memory configuration, do you know what I may be missing? Also, it looks like lowlevel_init has been called twice, i.e. again after relocation -- is this expected? This might be what is causing the problem, because lowlevel_init does a lot of RAM related configuration, but I don't know what to do about it.

I would expect lowlevel_init() to be called only once (or perhaps once
in SPL and once in U-Boot proper).

>
> There is some very basic support for this part in U-Boot, provided by manufacturer, but it is basically a single platform.S assembly file that does everything, like RAM configuration and some other peripherals support in lowlevel_init procedure.
>
> So, if I want to add proper support for this part, i.e. with device tree and all, is there a way to make this a gradual process? I mean, is it possible to leave existing RAM initialization procedure in lowlevel_init and just add new drivers for something I'm interested in or  is this all or nothing kind of thing?

Yes you can do things gradually. If you have a sane early memory
environment then you shouldn't have much trouble.

>
> Thank you.
>
> --
> Maxim Sloyko

Regards,
Simon


More information about the U-Boot mailing list