
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