public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Ilko Iliev <iliev@ronetix.at>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] at91: board specific lowlevel_init.S
Date: Thu, 06 Nov 2008 16:07:34 +0100	[thread overview]
Message-ID: <49130836.9070400@ronetix.at> (raw)
In-Reply-To: <20081105173728.GB5323@game.jcrosoft.org>

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

      parent reply	other threads:[~2008-11-06 15:07 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-21 13:41 [U-Boot] [PATCH] at91: board specific lowlevel_init.S Ilko Iliev
2008-10-21 13:58 ` Wolfgang Denk
2008-10-21 16:00   ` Ilko Iliev
2008-10-21 16:43     ` Jean-Christophe PLAGNIOL-VILLARD
2008-10-21 19:08     ` Wolfgang Denk
2008-10-22 11:12       ` Ilko Iliev
2008-10-22 12:41         ` Jean-Christophe PLAGNIOL-VILLARD
2008-10-22 13:07           ` Ilko Iliev
2008-10-22 13:22             ` Jean-Christophe PLAGNIOL-VILLARD
2008-10-22 14:01               ` Ilko Iliev
2008-10-22 15:06                 ` Jean-Christophe PLAGNIOL-VILLARD
2008-10-22 15:49                   ` Ilko Iliev
2008-10-27 15:52                   ` Ilko Iliev
2008-10-27 16:27                     ` Ben Warren
2008-10-27 16:43                       ` Jean-Christophe PLAGNIOL-VILLARD
2008-10-27 17:44                         ` Ilko Iliev
2008-10-27 21:27                           ` Wolfgang Denk
2008-10-27 21:20                         ` Wolfgang Denk
2008-10-28  6:24                           ` Jean-Christophe PLAGNIOL-VILLARD
2008-10-28 11:45                             ` Ilko Iliev
2008-10-30 20:47                               ` Jean-Christophe PLAGNIOL-VILLARD
2008-11-05 17:29                                 ` Ilko Iliev
2008-11-05 17:37                                   ` Jean-Christophe PLAGNIOL-VILLARD
2008-11-05 21:33                                     ` Wolfgang Denk
2008-11-06 15:03                                     ` Ilko Iliev
2008-11-06 15:07                                     ` Ilko Iliev [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49130836.9070400@ronetix.at \
    --to=iliev@ronetix.at \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox