* [U-Boot-Users] printf with u-boot-1.1.2
@ 2005-10-11 16:38 Shakthi Kannan
2005-10-11 18:56 ` Andrew Wozniak
0 siblings, 1 reply; 4+ messages in thread
From: Shakthi Kannan @ 2005-10-11 16:38 UTC (permalink / raw)
To: u-boot
Greetings!
I am using u-boot-1.1.2 with CodeSourcery's 3.4.3
cross-toolchain for ARM on the Versatile PB-ARM926EJ-S
board.
u-boot compiles fine. The hello_world.c in examples/
compiles fine. From the given example, I have removed
all statements except the printf statement. It
compiles fine.
I load it address 04000000 (SDRAM on board, top bank).
I execute it using "go 04000000", it runs and exits
with rc=0x0. But, I don't see the printf string being
printed. Only one character gets printed. I am
wondering if printf uses \r after every character gets
printed, so it basically overwrites.
I am able to display a character, using putc(). getc()
also works fine. These work if I load it a SDRAM
address, say, 0x05000000, and give the entry point as
05000000 itself (go 05000000). But, the documentation
mentions offset 0x4 as entry point.
I'd appreciate any feedback on what I am doing wrong
and how I can get the printf working.
Thanks,
SK
--
Shakthi Kannan, MS
Software Engineer, Specsoft (Hexaware Technologies)
[E]: shakthimaan at yahoo.com [M]: (91) 98407-87007
[W]: http://www.shakthimaan.com [L]: Chennai, India
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot-Users] printf with u-boot-1.1.2
2005-10-11 16:38 [U-Boot-Users] printf with u-boot-1.1.2 Shakthi Kannan
@ 2005-10-11 18:56 ` Andrew Wozniak
2005-10-13 7:51 ` Shakthi Kannan
0 siblings, 1 reply; 4+ messages in thread
From: Andrew Wozniak @ 2005-10-11 18:56 UTC (permalink / raw)
To: u-boot
Andrew Wozniak | Mercury Computer Systems
978.967.1895 | System SW, ICS Group
Shakthi Kannan wrote:
> Greetings!
>
> I am using u-boot-1.1.2 with CodeSourcery's 3.4.3
> cross-toolchain for ARM on the Versatile PB-ARM926EJ-S
> board.
>
> u-boot compiles fine. The hello_world.c in examples/
> compiles fine. From the given example, I have removed
> all statements except the printf statement. It
> compiles fine.
>
> I load it address 04000000 (SDRAM on board, top bank).
> I execute it using "go 04000000", it runs and exits
> with rc=0x0. But, I don't see the printf string being
> printed. Only one character gets printed. I am
> wondering if printf uses \r after every character gets
> printed, so it basically overwrites.
>
> I am able to display a character, using putc(). getc()
> also works fine. These work if I load it a SDRAM
> address, say, 0x05000000, and give the entry point as
> 05000000 itself (go 05000000). But, the documentation
> mentions offset 0x4 as entry point.
Why not try running with the offset - works for me.
> I'd appreciate any feedback on what I am doing wrong
> and how I can get the printf working.
Assuming you compiled with -g, take a look at hello_world.o for the
generated assembly code. See anything obvious?
$ ppc_405-objdump -S hello_world.o
hello_world.o: file format elf32-powerpc
Disassembly of section .text:
00000000 <hello_world-0x4>:
0: 00 00 7f e8 .long 0x7fe8
00000004 <hello_world>:
int hello_world(int argc, char *argv[])
{
4: 94 21 fe 48 stwu r1,-440(r1)
8: 7c 08 02 a6 mflr r0
c: be c1 01 90 stmw r22,400(r1)
10: 90 01 01 bc stw r0,444(r1)
14: 48 00 00 05 bl 18 <hello_world.c+0x14>
18: 7f c8 02 a6 mflr r30
1c: 80 1e ff e8 lwz r0,-24(r30)
20: 7f c0 f2 14 add r30,r0,r30
DECLARE_GLOBAL_DATA_PTR;
bd_t *bd = gd->bd;
24: 83 9d 00 00 lwz r28,0(r29)
<snip>
> Thanks,
>
> SK
>
> --
> Shakthi Kannan, MS
> Software Engineer, Specsoft (Hexaware Technologies)
> [E]: shakthimaan at yahoo.com [M]: (91) 98407-87007
> [W]: http://www.shakthimaan.com [L]: Chennai, India
>
>
>
>
> __________________________________
> Yahoo! Mail - PC Magazine Editors' Choice 2005
> http://mail.yahoo.com
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by:
> Power Architecture Resource Center: Free content, downloads, discussions,
> and more. http://solutions.newsforge.com/ibmarch.tmpl
> _______________________________________________
> U-Boot-Users mailing list
> U-Boot-Users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/u-boot-users
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot-Users] printf with u-boot-1.1.2
2005-10-11 18:56 ` Andrew Wozniak
@ 2005-10-13 7:51 ` Shakthi Kannan
2005-10-13 13:43 ` Andrew Wozniak
0 siblings, 1 reply; 4+ messages in thread
From: Shakthi Kannan @ 2005-10-13 7:51 UTC (permalink / raw)
To: u-boot
Hi Andrew,
Thanks for your reply.
Here is the hello_world compilation output:
make[1]: Entering directory
`/home/shaks/docs/monitor/u-boot/u-boot-1.1.2/examples'
/usr/local/arm/3.4.3/bin/arm-none-linux-gnueabi-gcc -g
-Os -fno-strict-aliasing -fno-common -ffixed-r8
-msoft-float -D__KERNEL__ -DTEXT_BASE=0x01000000
-I/home/shaks/docs/monitor/u-boot/u-boot-1.1.2/include
-fno-builtin -ffreestanding -nostdinc -isystem
/usr/local/arm/3.4.3/bin/../lib/gcc/arm-none-linux-gnueabi/3.4.3/include
-pipe -DCONFIG_ARM -D__ARM__ -march=armv4 -Wall
-Wstrict-prototypes -c -o stubs.o stubs.c
/usr/local/arm/3.4.3/bin/arm-none-linux-gnueabi-ar crv
libstubs.a stubs.o
a - stubs.o
/usr/local/arm/3.4.3/bin/arm-none-linux-gnueabi-gcc -g
-Os -fno-strict-aliasing -fno-common -ffixed-r8
-msoft-float -D__KERNEL__ -DTEXT_BASE=0x01000000
-I/home/shaks/docs/monitor/u-boot/u-boot-1.1.2/include
-fno-builtin -ffreestanding -nostdinc -isystem
/usr/local/arm/3.4.3/bin/../lib/gcc/arm-none-linux-gnueabi/3.4.3/include
-pipe -DCONFIG_ARM -D__ARM__ -march=armv4 -Wall
-Wstrict-prototypes -c -o hello_world.o hello_world.c
/usr/local/arm/3.4.3/bin/arm-none-linux-gnueabi-ld -g
-Ttext 0xc100000 \
-o hello_world -e hello_world hello_world.o
libstubs.a \
-L/usr/local/arm/3.4.3/bin/../lib/gcc/arm-none-linux-gnueabi/3.4.3
-lgcc
/usr/local/arm/3.4.3/bin/arm-none-linux-gnueabi-objcopy
-O srec hello_world hello_world.srec 2>/dev/null
/usr/local/arm/3.4.3/bin/arm-none-linux-gnueabi-objcopy
-O binary hello_world hello_world.bin 2>/dev/null
make[1]: Leaving directory
`/home/shaks/docs/monitor/u-boot/u-boot-1.1.2/examples'
C code
-------
#include <common.h>
#include <exports.h>
int hello_world (int argc, char *argv[])
{
char str[] = "foobar";
printf ("%s\n", str);
return 0;
}
Disassembly code
-----------------
hello_world.o: file format elf32-littlearm
Disassembly of section .text:
00000000 <hello_world>:
#include <exports.h>
int hello_world (int argc, char *argv[])
{
0: e52de004 str lr, [sp, #-4]!
char str[]="foobar";
4: e59f302c ldr r3, [pc, #44] ; 38 <.text+0x38>
8: e8930003 ldmia r3, {r0, r1}
c: e1a03821 mov r3, r1, lsr #16
10: e24dd00c sub sp, sp, #12 ; 0xc
14: e58d0000 str r0, [sp]
printf ("%s\n", str);
18: e59f001c ldr r0, [pc, #28] ; 3c <.text+0x3c>
1c: e1cd10b4 strh r1, [sp, #4]
20: e1a0100d mov r1, sp
24: e5cd3006 strb r3, [sp, #6]
28: ebfffffe bl 0 <printf>
return 0;
}
2c: e3a00000 mov r0, #0 ; 0x0
30: e28dd00c add sp, sp, #12 ; 0xc
34: e8bd8000 ldmia sp!, {pc}
38: 00000000 andeq r0, r0, r0
3c: 00000008 andeq r0, r0, r8
I still don't get printf output. Only a single
character gets printed. Any thoughts?
Thanks,
SK
--
Shakthi Kannan, MS
Software Engineer, Specsoft (Hexaware Technologies)
[E]: shakthimaan at yahoo.com [M]: (91) 98407-87007
[W]: http://www.shakthimaan.com [L]: Chennai, India
__________________________________
Start your day with Yahoo! - Make it your home page!
http://www.yahoo.com/r/hs
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot-Users] printf with u-boot-1.1.2
2005-10-13 7:51 ` Shakthi Kannan
@ 2005-10-13 13:43 ` Andrew Wozniak
0 siblings, 0 replies; 4+ messages in thread
From: Andrew Wozniak @ 2005-10-13 13:43 UTC (permalink / raw)
To: u-boot
I'm not familiar with the ARM platform, but in general, this compile
looks ok.
Shakthi Kannan wrote:
> Hi Andrew,
>
> Thanks for your reply.
>
> Here is the hello_world compilation output:
>
> make[1]: Entering directory
> `/home/shaks/docs/monitor/u-boot/u-boot-1.1.2/examples'
> /usr/local/arm/3.4.3/bin/arm-none-linux-gnueabi-gcc -g
> -Os -fno-strict-aliasing -fno-common -ffixed-r8
> -msoft-float -D__KERNEL__ -DTEXT_BASE=0x01000000
-DTEXT_BASE=0x01000000 is where U-Boot should be installed.
> -I/home/shaks/docs/monitor/u-boot/u-boot-1.1.2/include
> -fno-builtin -ffreestanding -nostdinc -isystem
> /usr/local/arm/3.4.3/bin/../lib/gcc/arm-none-linux-gnueabi/3.4.3/include
> -pipe -DCONFIG_ARM -D__ARM__ -march=armv4 -Wall
> -Wstrict-prototypes -c -o stubs.o stubs.c
> /usr/local/arm/3.4.3/bin/arm-none-linux-gnueabi-ar crv
> libstubs.a stubs.o
> a - stubs.o
> /usr/local/arm/3.4.3/bin/arm-none-linux-gnueabi-gcc -g
> -Os -fno-strict-aliasing -fno-common -ffixed-r8
> -msoft-float -D__KERNEL__ -DTEXT_BASE=0x01000000
> -I/home/shaks/docs/monitor/u-boot/u-boot-1.1.2/include
> -fno-builtin -ffreestanding -nostdinc -isystem
> /usr/local/arm/3.4.3/bin/../lib/gcc/arm-none-linux-gnueabi/3.4.3/include
> -pipe -DCONFIG_ARM -D__ARM__ -march=armv4 -Wall
> -Wstrict-prototypes -c -o hello_world.o hello_world.c
> /usr/local/arm/3.4.3/bin/arm-none-linux-gnueabi-ld -g
> -Ttext 0xc100000 \
-Ttext 0xc100000 is the "load" and "run" address of hello_world.
Forget about the 0x4 offset mentioned in the docs, it is for PPC only.
> -o hello_world -e hello_world hello_world.o
> libstubs.a \
>
> -L/usr/local/arm/3.4.3/bin/../lib/gcc/arm-none-linux-gnueabi/3.4.3
> -lgcc
> /usr/local/arm/3.4.3/bin/arm-none-linux-gnueabi-objcopy
> -O srec hello_world hello_world.srec 2>/dev/null
> /usr/local/arm/3.4.3/bin/arm-none-linux-gnueabi-objcopy
> -O binary hello_world hello_world.bin 2>/dev/null
> make[1]: Leaving directory
> `/home/shaks/docs/monitor/u-boot/u-boot-1.1.2/examples'
>
> C code
> -------
>
> #include <common.h>
> #include <exports.h>
>
> int hello_world (int argc, char *argv[])
> {
> char str[] = "foobar";
>
app_startup(argv);
The original hello_world source code and doc/README.standalone says that
app_startup() is required for proper access to imported functions, such
as printf().
> printf ("%s\n", str);
> return 0;
> }
>
> Disassembly code
> -----------------
>
> hello_world.o: file format elf32-littlearm
>
> Disassembly of section .text:
>
> 00000000 <hello_world>:
> #include <exports.h>
>
>
> int hello_world (int argc, char *argv[])
> {
> 0: e52de004 str lr, [sp, #-4]!
> char str[]="foobar";
> 4: e59f302c ldr r3, [pc, #44] ; 38 <.text+0x38>
> 8: e8930003 ldmia r3, {r0, r1}
> c: e1a03821 mov r3, r1, lsr #16
> 10: e24dd00c sub sp, sp, #12 ; 0xc
> 14: e58d0000 str r0, [sp]
>
> printf ("%s\n", str);
> 18: e59f001c ldr r0, [pc, #28] ; 3c <.text+0x3c>
> 1c: e1cd10b4 strh r1, [sp, #4]
> 20: e1a0100d mov r1, sp
> 24: e5cd3006 strb r3, [sp, #6]
> 28: ebfffffe bl 0 <printf>
> return 0;
> }
> 2c: e3a00000 mov r0, #0 ; 0x0
> 30: e28dd00c add sp, sp, #12 ; 0xc
> 34: e8bd8000 ldmia sp!, {pc}
> 38: 00000000 andeq r0, r0, r0
> 3c: 00000008 andeq r0, r0, r8
>
> I still don't get printf output. Only a single
> character gets printed. Any thoughts?
>
> Thanks,
>
> SK
>
>
> --
> Shakthi Kannan, MS
> Software Engineer, Specsoft (Hexaware Technologies)
> [E]: shakthimaan at yahoo.com [M]: (91) 98407-87007
> [W]: http://www.shakthimaan.com [L]: Chennai, India
>
>
>
> __________________________________
> Start your day with Yahoo! - Make it your home page!
> http://www.yahoo.com/r/hs
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by:
> Power Architecture Resource Center: Free content, downloads, discussions,
> and more. http://solutions.newsforge.com/ibmarch.tmpl
> _______________________________________________
> U-Boot-Users mailing list
> U-Boot-Users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/u-boot-users
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-10-13 13:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-11 16:38 [U-Boot-Users] printf with u-boot-1.1.2 Shakthi Kannan
2005-10-11 18:56 ` Andrew Wozniak
2005-10-13 7:51 ` Shakthi Kannan
2005-10-13 13:43 ` Andrew Wozniak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox