This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linker error while compiling SPL



Hi,

We have beaglebone black based custom board,

I want to add u-boot's command support(specifically for tftpput) inside SPL code,(it may seem wierd but i have a thing to try there)
I want to use do_tftpput command in spl.c file.

I changed my SPL file as follows,
But i am getting following linker errors


cd /home/still-image/ebridge/may13_tms/timesys_factory/build_armv7l-timesys-linux-gnueabi/u-boot-2013.07/u-boot-2013.07/spl/ && armv7l-timesys-linux-gnueabi-ld.bfd  -T /home/still-image/ebridge/may13_tms/timesys_factory/build_armv7l-timesys-linux-gnueabi/u-boot-2013.07/u-boot-2013.07/spl/u-boot-spl.lds --gc-sections --gc-sections -Bstatic -Ttext 0x402F0400 arch/arm/cpu/armv7/start.o --start-group arch/arm/cpu/armv7/am33xx/libam33xx.o arch/arm/cpu/armv7/libarmv7.o arch/arm/cpu/armv7/omap-common/libomap-common.o arch/arm/lib/libarm.o board/lutron/eb/libeb.o common/libcommon.o common/spl/libspl.o disk/libdisk.o drivers/gpio/libgpio.o drivers/mtd/nand/libnand.o drivers/net/libnet.o drivers/net/phy/libphy.o drivers/serial/libserial.o drivers/spi/libspi.o drivers/usb/musb-new/libusb_musb-new.o lib/libgeneric.o net/libnet.o --end-group /home/still-image/ebridge/may13_tms/timesys_factory/build_armv7l-timesys-linux-gnueabi/u-boot-2013.07/u-boot-2013.07/spl/arch/arm/lib/eabi_compat.o -L /home/still-image/ebridge/may13_tms/timesys_factory/build_armv7l-timesys-linux-gnueabi/toolchain/bin/../lib/gcc/armv7l-timesys-linux-gnueabi/4.7.3 -lgcc -Map u-boot-spl.map -o u-boot-spl
common/spl/libspl.o: In function `sendramlog':
/home/still-image/ebridge/may13_tms/timesys_factory/build_armv7l-timesys-linux-gnueabi/u-boot-2013.07/u-boot-2013.07/common/spl/spl.c:280: undefined reference to `find_cmd'
/home/still-image/ebridge/may13_tms/timesys_factory/build_armv7l-timesys-linux-gnueabi/u-boot-2013.07/u-boot-2013.07/common/spl/spl.c:286: undefined reference to `do_tftpput'

I changed the spl makefile as follows,


include $(TOPDIR)/config.mk

LIB     = $(obj)libspl.o
LIB     += $(TOPDIR)/common/libcommon.o
LIB     += $(TOPDIR)/common/stdio.o

ifdef CONFIG_SPL_BUILD
COBJS-$(CONFIG_SPL_FRAMEWORK) += spl.o
COBJS-$(CONFIG_SPL_NOR_SUPPORT) += spl_nor.o
COBJS-$(CONFIG_SPL_YMODEM_SUPPORT) += spl_ymodem.o
COBJS-$(CONFIG_SPL_NAND_SUPPORT) += spl_nand.o
COBJS-$(CONFIG_SPL_ONENAND_SUPPORT) += spl_onenand.o
COBJS-$(CONFIG_SPL_NET_SUPPORT) += spl_net.o
COBJS-$(CONFIG_SPL_MMC_SUPPORT) += spl_mmc.o
COBJS-$(CONFIG_SPL_EOL_DDR_TEST_SUPPORT) += spl_memTest.o
endif

COBJS   := $(sort $(COBJS-y))
SRCS    := $(COBJS:.o=.c)
OBJS    := $(addprefix $(obj),$(COBJS-y))

all:    $(obj).depend $(LIB)

$(LIB): $(OBJS)
        $(call cmd_link_o_target, $(OBJS))

#########################################################################

# defines $(obj).depend target
include $(SRCTREE)/rules.mk

sinclude $(obj).depend



But i think, i am missing something,

Any help higly appreciated,

Thank you,




  • There are two libcommon.o files, one for U-Boot and one for SPL:

    ./spl/common/libcommon.o
    ./common/libcommon.o

    Your SPL build is using the ./spl/common/libcommon.o library which doesn't have symbols for these commands. Try to use the U-Boot libcommon.o, although I'm not sure if this will link successfully.

    Best regards,
    Miroslav