From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ilko Iliev Date: Thu, 06 Nov 2008 16:07:34 +0100 Subject: [U-Boot] [PATCH] at91: board specific lowlevel_init.S In-Reply-To: <20081105173728.GB5323@game.jcrosoft.org> References: <48FF3240.3080703@ronetix.at> <20081022150656.GC15487@game.jcrosoft.org> <4905E3B6.2060007@ronetix.at> <4905EBF0.7020400@gmail.com> <20081027164336.GA1778@game.jcrosoft.org> <20081027212029.481D7832E40A@gemini.denx.de> <20081028062444.GB6417@game.jcrosoft.org> <4906FB6D.4000204@ronetix.at> <20081030204715.GB23324@game.jcrosoft.org> <4911D7EA.5060609@ronetix.at> <20081105173728.GB5323@game.jcrosoft.org> Message-ID: <49130836.9070400@ronetix.at> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Jean, Jean-Christophe PLAGNIOL-VILLARD wrote: > On 18:29 Wed 05 Nov , Ilko Iliev wrote: > >> Dear Jean, >> >> Jean-Christophe PLAGNIOL-VILLARD wrote: >> >>> On 12:45 Tue 28 Oct , Ilko Iliev wrote: >>> >>> >>>> Dear Jean-Christophe, >>>> >>>> Jean-Christophe PLAGNIOL-VILLARD wrote: >>>> >>>> >>>>> On 22:20 Mon 27 Oct , Wolfgang Denk wrote: >>>>> >>>>> >>>>> >>>>>> Dear Jean-Christophe PLAGNIOL-VILLARD, >>>>>> >>>>>> In message <20081027164336.GA1778@game.jcrosoft.org> you wrote: >>>>>> >>>>>> >>>>>> >>>>>>>> I've found that weak functions are only overwritten if the overwriting >>>>>>>> function is in a file (not archive) that has strongly-linked symbols. >>>>>>>> Admittedly, I've only done this with C code but expect that the assembly >>>>>>>> equivalent works the same way. The idea of using weak functions seems >>>>>>>> great, but suffers from some pretty cumbersome weaknesses :) >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> I've found a solution but it's need to update the all u-boot linking method. >>>>>>> >>>>>>> Move from AR to LD. >>>>>>> >>>>>>> >>>>>>> >>>>>> Well, that is exactly what Ben just described. >>>>>> >>>>>> >>>>>> >>>>>> >>>>>>> Which need some work to fit on all boards. >>>>>>> >>>>>>> >>>>>>> >>>>>> Well, actually only the file lowlevel_init.o needs to be treated that >>>>>> way, so the needed hcanges look not too complicated to me. >>>>>> >>>>>> >>>>>> >>>>> I'll send a patch to move cpu/at91 to it only and an example to use it with >>>>> board dir >>>>> >>>>> >>>>> >>> Could you try this >>> >>> >>> diff --git a/config.mk b/config.mk >>> index 5a9334c..0d81ab3 100644 >>> --- a/config.mk >>> +++ b/config.mk >>> @@ -80,6 +80,9 @@ STRIP = $(CROSS_COMPILE)strip >>> OBJCOPY = $(CROSS_COMPILE)objcopy >>> OBJDUMP = $(CROSS_COMPILE)objdump >>> RANLIB = $(CROSS_COMPILE)RANLIB >>> +cmd_link_o_target = $(if $(strip $(2)),\ >>> + $(LD) $(PLATFORM_LDFLAGS) -r -o $(1) $(2) ,\ >>> + rm -f $@; $(AR) rcs $(1)) >>> >>> ######################################################################### >>> >>> diff --git a/cpu/arm926ejs/at91/Makefile b/cpu/arm926ejs/at91/Makefile >>> index 2d2a888..662657c 100644 >>> --- a/cpu/arm926ejs/at91/Makefile >>> +++ b/cpu/arm926ejs/at91/Makefile >>> @@ -36,7 +36,7 @@ OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS-y)) >>> all: $(obj).depend $(LIB) >>> >>> $(LIB): $(OBJS) >>> - $(AR) $(ARFLAGS) $@ $(OBJS) >>> + $(call cmd_link_o_target, $@, $(OBJS)) >>> >>> ######################################################################### >>> >>> >>> and modify your board lib build by >>> - $(AR) $(ARFLAGS) $@ $(OBJS) >>> + $(call cmd_link_o_target, $@, $(OBJS)) >>> >>> Best Regards, >>> J. >>> >>> >> Your patch doesn't resolve the problem - the lowlevel_init.o is still a >> part of libat91.s: >> arm-elf-ld -r -o libat91.a lowlevel_init.o timer.o spi.o usb.o >> make[1]: Leaving directory >> `/home/develop/u-boot-last/u-boot/u-boot-2008-11-03/u-boot/cpu/arm926ejs/at91' >> >> The attribute ".weak" works only if the file where is the weak function >> is not in a library. >> > This method of build will not generate a library evenif it's still called > libat91.a, it will generate a pre-built object. > I forgot to tell you that it is enough to define the lowlevel_init() in arm926ej/at91/lowlevel_init.S as weak by the following way: .globl lowlevel_init .weak lowlevel_init lowlevel_init: /* * Clocks/SDRAM initialization is handled by at91bootstrap, * no need to do it here... */ mov pc, lr -- With best regards, Ilko Iliev Ronetix Development Tools GmbH CPU Modules, JTAG/BDM Emulators and Flash Programmers Waidhausenstrasse 13/5, 1140 Vienna, Austria E-Mail: iliev at ronetix.at; Web: www.ronetix.at