[U-Boot-Users] print problem on ARM, toolchain 3.4.3

Greetings!
This is a followup on use of printf with u-boot-1.1.2 with cross-toolchains 2.95.3 and Codesourcery's 3.4.3 on ARM.
http://sourceforge.net/mailarchive/message.php?msg_id=13329626
I am now trying to write a standalone code to be run with u-boot. This is the simple foo.c file:
/* * foo.c * */
#include <common.h> #include <exports.h>
int main (int argc, char *argv[]) { /* Print the ABI version */ app_startup(argv); putc ('c'); return (0); }
The Makefile for cross-compilation:
# Makefile # Tools
CROSS = /usr/local/arm/3.4.3/bin/arm-none-linux-gnueabi- CC = $(CROSS)gcc AS = $(CROSS)as LD = $(CROSS)ld OBJCOPY = $(CROSS)objcopy
TARGET = foo BASE = 0x04000000
CFLAGS = -fno-strict-aliasing -fno-common -ffixed-r8 -msoft-float -D__KERNEL__ -fno-builtin -ffreestanding -nostdinc -isystem /usr/local/arm/3.4.3/bin/../lib/gcc/arm-non-linux-gnueabi/3.4.3/include -pipe -DCONFIG_ARM -D__ARM__ -march=armv4 -Wall -Wstrict-prototypes
INCLUDE = -I/home/shaks/docs/monitor/u-boot/u-boot-1.1.2/include -I/usr -I$(LIBSTUB_INCLUDE)
LIBSTUB_INCLUDE = /usr/local/arm/3.4.3/bin/../lib/gcc/arm-none-linux-gnueabi/3.4.3/include LDFLAGS = -Ttext $(BASE) -e main
all: $(CC) $(CFLAGS) $(INCLUDE) -c $(TARGET).c -o $(TARGET).o $(LD) $(LDFLAGS) $(TARGET).o -o $(TARGET)
objcopy: $(OBJCOPY) -O binary $(TARGET) $(TARGET).bin 2>/dev/null
clean: rm -f *~ *.o *.bin $(TARGET)
On running make clean; make, I get this output:
/usr/local/arm/3.4.3/bin/arm-none-linux-gnueabi-gcc -fno-strict-aliasing -fno-common -ffixed-r8 -msoft-float -D__KERNEL__ -fno-builtin -ffreestanding -nostdinc -isystem /usr/local/arm/3.4.3/bin/../lib/gcc/arm-non-linux-gnueabi/3.4.3/include -pipe -DCONFIG_ARM -D__ARM__ -march=armv4 -Wall -Wstrict-prototypes -I/home/shaks/docs/monitor/u-boot/u-boot-1.1.2/include -I/usr -I/usr/local/arm/3.4.3/bin/../lib/gcc/arm-none-linux-gnueabi/3.4.3/include -c foo.c -o foo.o
/usr/local/arm/3.4.3/bin/arm-none-linux-gnueabi-ld -Ttext 0x04000000 -e main foo.o -o foo foo.c:1: warning: target CPU does not support interworking foo.o: In function `main': foo.c:(.text+0x1c): undefined reference to `app_startup' foo.c:(.text+0x24): undefined reference to `putc' make: *** [all] Error 1
foo.o gets created. putc is declard in common.h, but, where is the actual definition? I'd appreciate any input from folks who have done similar style of firmware development with u-boot.
Thanks,
SK
-- Shakthi Kannan, MS Software Engineer, Specsoft (Hexaware Technologies) [E]: shakthimaan@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

In message 20051114063916.10876.qmail@web30715.mail.mud.yahoo.com you wrote:
This is a followup on use of printf with u-boot-1.1.2 with cross-toolchains 2.95.3 and Codesourcery's 3.4.3 on ARM.
Let me remember that working toolchains have NO problems with all this. In other works, this is not an U-Boot problem per se.
The Makefile for cross-compilation:
Please check exactly what the U-Boot Makefiles are doing. Then fix your Makefile.
On running make clean; make, I get this output:
....
/usr/local/arm/3.4.3/bin/arm-none-linux-gnueabi-ld -Ttext 0x04000000 -e main foo.o -o foo foo.c:1: warning: target CPU does not support interworking
Fix your toolchain problems.
foo.o: In function `main': foo.c:(.text+0x1c): undefined reference to `app_startup' foo.c:(.text+0x24): undefined reference to `putc' make: *** [all] Error 1
foo.o gets created. putc is declard in common.h, but, where is the actual definition? I'd appreciate any input from folks who have done similar style of firmware development with u-boot.
You fail to compile and link examples/stubs.c
It seems you also missed to readthe documentation (i. e. "doc/README.standalone").
Best regards,
Wolfgang Denk

Hi Wolfgang Denk,
Thanks for your inputs. Appreciate it.
--- Wolfgang Denk wd@denx.de wrote:
It seems you also missed to readthe documentation (i. e. "doc/README.standalone").
Oops. Sorry about that. Will have a look at it.
SK
-- Shakthi Kannan, MS Software Engineer, Specsoft (Hexaware Technologies) [E]: shakthimaan@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

Hi again,
I have got the build working. Here is a foo.c and a simple Makefile that runs with CodeSourcery's 3.4.3 toolchain:
/* * foo.c */
#include <common.h> #include <exports.h>
int main (int argc, char *argv[]) { app_startup(argv); printf ("Voila! Voila!"); return (0); }
The Makefile:
# Makefile # Tools
CROSS = /usr/local/arm/3.4.3/bin/arm-none-linux-gnueabi- CC = $(CROSS)gcc AS = $(CROSS)as LD = $(CROSS)ld OBJCOPY = $(CROSS)objcopy
TARGET = foo BASE = 0x04000000
CFLAGS = -g -Os -fno-strict-aliasing -fno-common -ffixed-r8 -msoft-float -D__KERNEL__ -fno-builtin -ffreestanding -nostdinc -isystem /usr/local/arm/3.4.3/bin/../lib/gcc/arm-non-linux-gnueabi/3.4.3/include -pipe -DCONFIG_ARM -D__ARM__ -march=armv4 -Wall -Wstrict-prototypes
INCLUDE = -I/home/shaks/docs/monitor/u-boot/u-boot-1.1.2/include -I/usr/local/arm/3.4.3/lib/gcc/arm-none-linux-gnueabi/3.4.3/include
LIBSTUBS = /home/shaks/docs/monitor/u-boot/u-boot-1.1.2/examples/libstubs.a LGCC = -L/usr/local/arm/3.4.3/bin/../lib/gcc/arm-none-linux-gnueabi/3.4.3 -lgcc -L/home/shaks/docs/monitor/u-boot/u-boot-1.1.2/examples -lstubs
LIBSTUB_INCLUDE = /usr/local/arm/3.4.3/bin/../lib/gcc/arm-none-linux-gnueabi/3.4.3/include LDFLAGS = -g -Ttext $(BASE) -e main
all: $(CC) $(CFLAGS) $(INCLUDE) -c $(TARGET).c -o $(TARGET).o $(LD) $(INCLUDE) $(LDFLAGS) $(TARGET).o -o $(TARGET) $(LIBSTUBS) $(LGCC) $(OBJCOPY) -O binary $(TARGET) $(TARGET).bin 2>/dev/null
clean: rm -f *~ *.o *.bin $(TARGET)
Voila! Voila!
SK
-- Shakthi Kannan, MS Software Engineer, Specsoft (Hexaware Technologies) [E]: shakthimaan@yahoo.com [M]: (91) 98407-87007 [W]: http://www.shakthimaan.com [L]: Chennai, India
__________________________________ Yahoo! FareChase: Search multiple travel sites in one click. http://farechase.yahoo.com
participants (2)
-
Shakthi Kannan
-
Wolfgang Denk