[U-Boot] show_boot_progess @ ppc not working

Graeme Russ graeme.russ at gmail.com
Wed Dec 10 11:58:04 CET 2008


Hi All,

I had some 'fun' with weak functions a little while ago, and I'm wondering
if maybe we should fix up a few inconsistencies...

Andre Schwarz wrote:
> Heiko Schocher schrieb:
>> Hello Andre,
>>
>> Andre Schwarz wrote:
>>   
>>> All,
>>>
>>> can someone tell me why the board specific function "void
>>> show_boot_progress(int arg)"
>>> is no longer called (at least on MPC5200).

<snip>

>>
>> Can you try the following patch? (This patch solved it
>> on my boards ...)
>>

<snip>

>> -void __attribute__((weak)) show_boot_progress (int val);
>> +void show_boot_progress (int val);

This makes show_boot_progress () consistent with nearly every other weak
function (see below)

Interesting that this is the only function defined weak in this way. All
other weak functions are defined normally (no attributes) and then declared
weak with an alias. Good examples can be found in /include/status_led.h
lines 391-396 and /lib_arm/board.c lines 125-138

<snip>

> Heiko,
> 
> of course this patch makes it work again.

This patch leaves only a handful of inconsistent weak functions:

/include/asm-avr32/arch-at32ap700x/clk.h line 85:

extern void gclk_init(void) __attribute__((weak));

But this is not designed to be overridable - It is designed to not require
a declaration - See /cpu/at32ap/cpu.c lines 68-69:

	if(gclk_init)
		gclk_init();

/common/cmd_boot.c lines 32-36: (/common/cmd_elf.c lines 31-54 and
/cpu/mips/cpu.c lines 41-43 are same semantics)

__attribute__((weak))
unsigned long do_go_exec (ulong (*entry)(int, char *[]), int argc, char
*argv[])
{
	return entry (argc, argv);
}

<snip>

> But the question is : Why is this specific weak function not replaced by
> the board specific one ?

Good question - maybe because this function is inlined? (just a wild guess)
- could be any of a number of reasons as far as I can tell.

> 
> This gives me some pain when looking at the other weak functions....

Is there any reason _not_ to fix up these last four weak functions so that
all weak functions are defined and declared the same way? I can do up a
patch if the consensus is to make them consistent.

Regards,

Graeme


More information about the U-Boot mailing list