All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Wozniak <awozniak@mc.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] printf with u-boot-1.1.2
Date: Thu, 13 Oct 2005 09:43:42 -0400	[thread overview]
Message-ID: <434E648E.4010200@mc.com> (raw)
In-Reply-To: <20051013075119.42975.qmail@web30712.mail.mud.yahoo.com>

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
> 

      reply	other threads:[~2005-10-13 13:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=434E648E.4010200@mc.com \
    --to=awozniak@mc.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.