[U-Boot] printf and R9 in ARM architecture

Albert ARIBAUD albert.u.boot at aribaud.net
Tue Jan 20 10:37:38 CET 2015


Hello Dashi Cao,

On Tue, 20 Jan 2015 14:12:35 +0800, Da Shi Cao <dscao999 at gmail.com>
wrote:
> In standalone applications, it seems that the execution of printf
> function in U-Boot is dependent on the value of register R9, which is
> setup in app_startup. But r9 can be used by your program at the
> decision of gcc compilation which is not aware of this dependence.
> This is especially the case if +O2 is used!

U-Boot follows the ARM EABI, in which ""The role of register r9 is
platform specific". In U-Boot r9 is specifically used for the global
data structure, and the standalone programs must follow this EABI.

If your standalone program is built with the same options as U-Boot
example standalone programs are (see hellow_world), then it should
have gcc option -ffixed-r9 which will prevent the compiler from ever
touching r9.

How exactly do you build your standalone application?

> My version is U-Boot 2014.10
> 
> Regards,
> Dashi Cao

Amicalement,
-- 
Albert.


More information about the U-Boot mailing list