Skip to contentSkip to conversation

*.lds for examples

U-Boot-Users Robin Getz 2 participants 2 messages Oct 7, 2004 – Oct 8, 2004

lore
Share & tools
lore

Robin Getz

author
#0 lore raw

I noticed there was linker files for the examples directory for two architectures (mips and nios), but was struggling to figure out where the default came from. If I have architecture specific examples, do I need to add lds file for the examples?

I was trying to add an example, and was unable to get things to work properly. To start I tried just copying the hello_world.c to a smc91111_eeprom.c, and making what I thought were the correct entries in the examples/Makefile and top level Makefile (for make clean only).

However, if smc91111_eeprom and hello_world.c are exactly the same, I end up with different object files, because the entry point is different. The following linker error occurs

/home/rgetz/uClinux/toolchainoutput/bin/bfin-elf-ld.real: warning: cannot find entry symbol smc91111_eeprom; defaulting to 00001000

So, where is the entry point set?

The actual make looked OK to me (sorry for the long lines):
bfin-elf-gcc -O0 -ffixed-P5 -D__KERNEL__ -DTEXT_BASE=0x20000000 -I/home/rgetz/u-boot/u-boot_1.1.1/include -fno-built in -ffreestanding -nostdinc -isystem /home/rgetz/uClinux/toolchainoutput/lib/gcc-lib/bfin-elf/3.3.3/include -pipe -D_
_BLACKFIN__ -mno-underscore -DCONFIG_blackfin -D__blackfin__ -I/home/rgetz/u-boot/u-boot_1.1.1 -Wall -Wstrict-prototyp es -c -o

hello_world.o hello_world.c bfin-elf-ld -g  -Ttext 0x1000 \
         -o hello_world -e hello_world hello_world.o libstubs.a \
         -L/home/rgetz/uClinux/toolchainoutput/lib/gcc-lib/bfin-elf/3.3.3

-lgcc
bfin-elf-objcopy -O srec hello_world hello_world.srec 2>/dev/null bfin-elf-gcc -O0 -ffixed-P5 -D__KERNEL__ -DTEXT_BASE=0x20000000 -I/home/rgetz/u-boot/u-boot_1.1.1/include -fno-built in -ffreestanding -nostdinc -isystem /home/rgetz/uClinux/toolchainoutput/lib/gcc-lib/bfin-elf/3.3.3/include -pipe -D_
_BLACKFIN__ -mno-underscore -DCONFIG_blackfin -D__blackfin__ -I/home/rgetz/u-boot/u-boot_1.1.1 -Wall -Wstrict-prototyp es -c -o

smc91111_eeprom.o smc91111_eeprom.c bfin-elf-ld -g  -Ttext 0x1000 \
         -o smc91111_eeprom -e smc91111_eeprom smc91111_eeprom.o libstubs.a \
         -L/home/rgetz/uClinux/toolchainoutput/lib/gcc-lib/bfin-elf/3.3.3

-lgcc
bfin-elf-objcopy -O srec smc91111_eeprom smc91111_eeprom.srec 2>/dev/null bfin-elf-objcopy -O binary hello_world hello_world.bin 2>/dev/null bfin-elf-objcopy -O binary smc91111_eeprom smc91111_eeprom.bin 2>/dev/null

Any thoughts?

pointers appreciated.

Thanks
-Robin

#1 lore raw

Hi Robin,

Quoted 4 lines

I was trying to add an example, and was unable to get things to work properly. To start I tried just copying the hello_world.c to a smc91111_eeprom.c, and making what I thought were the correct entries in the examples/Makefile and top level Makefile (for make clean only).

Did you change the function name to smc9111_eeprom too?

Quoted 10 lines

So, where is the entry point set?

The actual make looked OK to me (sorry for the long lines):
bfin-elf-gcc -O0 -ffixed-P5 -D__KERNEL__ -DTEXT_BASE=0x20000000

(quoted diff) +0 -2
-I/home/rgetz/u-boot/u-boot_1.1.1/include -fno-built in -ffreestanding
-nostdinc -isystem

/home/rgetz/uClinux/toolchainoutput/lib/gcc-lib/bfin-elf/3.3.3/include -pipe -D_
_BLACKFIN__ -mno-underscore -DCONFIG_blackfin -D__blackfin__ -I/home/rgetz/u-boot/u-boot_1.1.1 -Wall -Wstrict-prototyp es -c -o

Quoted 2 lines
hello_world.o hello_world.c bfin-elf-ld -g  -Ttext 0x1000 \
         -o hello_world -e hello_world hello_world.o libstubs.a \
                          ^^^^^^^^^^^^^^
                               here
Quoted 2 lines

-L/home/rgetz/uClinux/toolchainoutput/lib/gcc-lib/bfin-elf/3.3.3
-lgcc

The -e option (see info(ld)) is generated in the Makefile from the object file name so probably the function in your object file was still called 'hello_world'....

Cheers
Detlev

Signature · 2 lines
Zivilisation ist der Zaubertrick, der uns unsere wahre Natur verbirgt.
                                            -- Salman Rushdie