Skip to contentSkip to conversation

improve printf behavior on arm/pxa after enabling 64bit support in printf by default.

PATCH New Mikhail Kshevetskiy 3 participants 4 messages Mar 29, 2010 – Apr 15, 2010 1 message not in the archive Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 improve printf behavior on arm/pxa after enabling 64bit support in printf by default.

commit 4b142febff71eabdb7ddbb125c7b583b24ddc434 (common: delete CONFIG_SYS_64BIT_VSPRINTF and CONFIG_SYS_64BIT_STRTOUL) breaks printf on my arm/pxa270 board. For example, the code

	int a = 128;
	printf("a= %d\n", a);

will print zero on the console. The problem reproduced on gcc 4.1.1, 4.3.3, 4.4.1 and 4.4.2.

This patch fix printf unless you'll need printing 64-bit values.

---
 cpu/pxa/config.mk |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
cpu/pxa/config.mk +1 -1
index a05d69c..d87b5e0 100644
@@ -24,7 +24,7 @@
 
 PLATFORM_RELFLAGS += -fno-common -ffixed-r8 -msoft-float
 
-PLATFORM_CPPFLAGS += -march=armv5te -mtune=xscale
+PLATFORM_CPPFLAGS += -march=armv5t -mtune=xscale
 # =========================================================================
 #
 # Supply options according to compiler version
Signature · 1 line
1.7.0
#1 lore raw

PATCH 1/2 improve printf behavior on arm/pxa after enabling 64bit support in printf by default.

Dear Mikhail Kshevetskiy,

Quoted 11 lines · In message <[email protected]> you wrote:

commit 4b142febff71eabdb7ddbb125c7b583b24ddc434 (common: delete CONFIG_SYS_64BIT_VSPRINTF and CONFIG_SYS_64BIT_STRTOUL) breaks printf on my arm/pxa270 board. For example, the code

	int a = 128;
	printf("a= %d\n", a);

will print zero on the console. The problem reproduced on gcc 4.1.1, 4.3.3, 4.4.1 and 4.4.2.

This patch fix printf unless you'll need printing 64-bit values.

I doubt that your patch addresses the real cause of the problem. Did you check if the stack alignment problem discussed here earlier has been fixed for your architecture?

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Die Scheu vor Verantwortung ist die Krankheit unserer Zeit.
                                                 -- Otto von Bismarck
#2 lore raw

PATCH 1/2 improve printf behavior on arm/pxa after enabling 64bit support in printf by default.

Dne P? 9. dubna 2010 23:40:11 Wolfgang Denk napsal(a):

Quoted 15 lines

Dear Mikhail Kshevetskiy,

Quoted 11 lines · In message <[email protected]> you wrote:

commit 4b142febff71eabdb7ddbb125c7b583b24ddc434 (common: delete CONFIG_SYS_64BIT_VSPRINTF and CONFIG_SYS_64BIT_STRTOUL) breaks printf on my arm/pxa270 board. For example, the code

	int a = 128;
	printf("a= %d\n", a);

will print zero on the console. The problem reproduced on gcc 4.1.1, 4.3.3, 4.4.1 and 4.4.2.

This patch fix printf unless you'll need printing 64-bit values.

Quoted 7 lines

I doubt that your patch addresses the real cause of the problem. Did you check if the stack alignment problem discussed here earlier has been fixed for your architecture?

Best regards,

Wolfgang Denk

Yes, this is a NAK, sorry. The real problem is addressed by "[PATCH] PXA: Align stack to 8 bytes". LDRD and STRD need the memory address aligned to 8 bytes.

Besides my patch also fixes the NAND driver, which didn't work as well and possibly various other issues.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

PATCH 1/2 improve printf behavior on arm/pxa after enabling 64bit support in printf by default.

Dne ?t 15. dubna 2010 01:12:30 Mikhail Kshevetskiy napsal(a):

Quoted 2 lines

Yes, you was right. This is definitely an alignment issue. Here is a patch to fix this issue.

Thanks, actually, I pushed a different patch that fixed the stack alignment issue, but forgot to reserve the space for abort stack in my patch. Therefore I pushed a patch on top of mine based on your patch. The patch is attached below.

Ah also please, keep track of the u-boot-pxa.git repo, that should contain most recent fixes for xscale. http://git.denx.de/?p=u-boot/u-boot-pxa.git;a=summary

Quoted 3 lines

Sorry for attaching file. I am in a trip and use web browser for sending mail

Fine by me.

But please, stop top posting (post below the mail or into the body). It's some rule that improves readability. Thanks!

Quoted 21 lines

2010/4/10 Wolfgang Denk <[email protected]>:

Quoted 19 lines

Dear Mikhail Kshevetskiy,

Quoted 11 lines · In message <[email protected]> you wrote:

commit 4b142febff71eabdb7ddbb125c7b583b24ddc434 (common: delete CONFIG_SYS_64BIT_VSPRINTF and CONFIG_SYS_64BIT_STRTOUL) breaks printf on my arm/pxa270 board. For example, the code

      int a = 128;
      printf("a= %d\n", a);

will print zero on the console. The problem reproduced on gcc 4.1.1, 4.3.3, 4.4.1 and 4.4.2.

This patch fix printf unless you'll need printing 64-bit values.

I doubt that your patch addresses the real cause of the problem. Did you check if the stack alignment problem discussed here earlier has been fixed for your architecture?
From: Marek Vasut <[email protected]>

Date: Thu, 15 Apr 2010 09:35:04 +0200
Subject: [PATCH] PXA: Fix abort stack

The stack alignment patch didn't reserve space for abort stack anymore. This patch fixes the problem.

Original patch that pointed this issue out was by Mikhail Kshevetskiy.

---
 arch/arm/cpu/pxa/start.S |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/cpu/pxa/start.S +2 -2
index f7236bf..3989fa6 100644
@@ -140,8 +140,8 @@ stack_setup:
 #ifdef CONFIG_USE_IRQ
        sub     r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ)
 #endif /* CONFIG_USE_IRQ */
-       bic     sp, r0, #7              /* leave 4 words for abort-stack    */
-                                       /* NOTE: stack MUST be aligned to   */
+       sub     r0, r0, #12             /* leave 3 words for abort-stack    */
+       bic     sp, r0, #7              /* NOTE: stack MUST be aligned to   */
                                        /* 8 bytes in case we want to use   */
                                        /* 64bit datatypes (eg. VSPRINTF64) */
 
Signature · 1 line
1.7.0
Quoted 10 lines
Quoted 10 lines

Best regards,

Wolfgang Denk

--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Die Scheu vor Verantwortung ist die Krankheit unserer Zeit.
-- Otto von Bismarck