* [U-Boot] printf and R9 in ARM architecture
@ 2015-01-20 6:12 Da Shi Cao
2015-01-20 9:37 ` Albert ARIBAUD
2015-01-20 10:56 ` Marek Vasut
0 siblings, 2 replies; 5+ messages in thread
From: Da Shi Cao @ 2015-01-20 6:12 UTC (permalink / raw)
To: u-boot
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!
My version is U-Boot 2014.10
Regards,
Dashi Cao
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] printf and R9 in ARM architecture
2015-01-20 6:12 [U-Boot] printf and R9 in ARM architecture Da Shi Cao
@ 2015-01-20 9:37 ` Albert ARIBAUD
2015-01-20 11:34 ` Da Shi Cao
2015-01-20 10:56 ` Marek Vasut
1 sibling, 1 reply; 5+ messages in thread
From: Albert ARIBAUD @ 2015-01-20 9:37 UTC (permalink / raw)
To: u-boot
Hello Dashi Cao,
On Tue, 20 Jan 2015 14:12:35 +0800, Da Shi Cao <dscao999@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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] printf and R9 in ARM architecture
2015-01-20 6:12 [U-Boot] printf and R9 in ARM architecture Da Shi Cao
2015-01-20 9:37 ` Albert ARIBAUD
@ 2015-01-20 10:56 ` Marek Vasut
1 sibling, 0 replies; 5+ messages in thread
From: Marek Vasut @ 2015-01-20 10:56 UTC (permalink / raw)
To: u-boot
On Tuesday, January 20, 2015 at 07:12:35 AM, Da Shi Cao 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!
+CC the experts who probably broke it ;-)
Shouldn't you compile your standalone application with something like -ffixed-r9
?
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] printf and R9 in ARM architecture
2015-01-20 9:37 ` Albert ARIBAUD
@ 2015-01-20 11:34 ` Da Shi Cao
2015-01-20 12:20 ` Albert ARIBAUD
0 siblings, 1 reply; 5+ messages in thread
From: Da Shi Cao @ 2015-01-20 11:34 UTC (permalink / raw)
To: u-boot
No, I didn't use that option. This option should fix it.
Thanks a lot.
Thomas
On Tue, Jan 20, 2015 at 5:37 PM, Albert ARIBAUD
<albert.u.boot@aribaud.net> wrote:
> Hello Dashi Cao,
>
> On Tue, 20 Jan 2015 14:12:35 +0800, Da Shi Cao <dscao999@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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] printf and R9 in ARM architecture
2015-01-20 11:34 ` Da Shi Cao
@ 2015-01-20 12:20 ` Albert ARIBAUD
0 siblings, 0 replies; 5+ messages in thread
From: Albert ARIBAUD @ 2015-01-20 12:20 UTC (permalink / raw)
To: u-boot
Hello Thomas,
On Tue, 20 Jan 2015 19:34:32 +0800, Da Shi Cao <dscao999@gmail.com>
wrote:
> No, I didn't use that option. This option should fix it.
Please also look at other options used for hello_world, as you might hit
other compatibility-related issues if you're not using the same ones.
> Thanks a lot.
No problem.
> Thomas
Amicalement,
--
Albert.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-01-20 12:20 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-20 6:12 [U-Boot] printf and R9 in ARM architecture Da Shi Cao
2015-01-20 9:37 ` Albert ARIBAUD
2015-01-20 11:34 ` Da Shi Cao
2015-01-20 12:20 ` Albert ARIBAUD
2015-01-20 10:56 ` Marek Vasut
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox