[U-Boot-Users] printf with u-boot-1.1.2

Andrew Wozniak awozniak at mc.com
Thu Oct 13 15:43:42 CEST 2005


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
> 




More information about the U-Boot mailing list