[U-Boot] [PATCH] at91: board specific lowlevel_init.S

Ilko Iliev iliev at ronetix.at
Tue Oct 28 12:45:49 CET 2008


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 at 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
>   

Please take a look at the following patch:

diff --git a/Makefile b/Makefile
index d6abb4d..b1c07ae 100644
--- a/Makefile
+++ b/Makefile
@@ -199,6 +199,11 @@ endif
 ifeq ($(CPU),mpc85xx)
 OBJS += cpu/$(CPU)/resetvec.o
 endif
+ifeq ($(SOC),at91)
+OBJS += cpu/$(CPU)/$(SOC)/lowlevel_init.o $(shell \
+       if [ -f  board/$(VENDOR)/$(BOARD)/$(BOARD)_lowlevel_init.S ]; 
then echo \
+       "board/$(VENDOR)/$(BOARD)/$(BOARD)_lowlevel_init.o"; fi)
+endif

 OBJS := $(addprefix $(obj),$(OBJS))

@@ -337,7 +342,8 @@ $(obj)u-boot:               depend $(SUBDIRS) 
$(OBJS) $(LIBBOARD) $(LIBS) $(LDSCRIPT)
                        -Map u-boot.map -o u-boot

 $(OBJS):       depend $(obj)include/autoconf.mk
-               $(MAKE) -C cpu/$(CPU) $(if $(REMOTE_BUILD),$@,$(notdir $@))
+               $(MAKE) -C cpu/$(CPU)
+#              $(MAKE) -C cpu/$(CPU) $(if $(REMOTE_BUILD),$@,$(notdir $@))

 $(LIBS):       depend $(obj)include/autoconf.mk
                $(MAKE) -C $(dir $(subst $(obj),,$@))
diff --git a/cpu/arm926ejs/at91/Makefile b/cpu/arm926ejs/at91/Makefile
index 2d2a888..d0dcf9b 100644
--- a/cpu/arm926ejs/at91/Makefile
+++ b/cpu/arm926ejs/at91/Makefile
@@ -28,12 +28,13 @@ LIB = $(obj)lib$(SOC).a
 COBJS-y        += timer.o
 COBJS-$(CONFIG_HAS_DATAFLASH) +=spi.o
 COBJS-y        += usb.o
-SOBJS  = lowlevel_init.o
+LOWLEVEL_INIT = lowlevel_init.o

-SRCS    := $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
+SRCS    := $(LOWLEVEL_INIT:.o=.S) $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
 OBJS    := $(addprefix $(obj),$(SOBJS) $(COBJS-y))
+LOWLEVEL_INIT  := $(addprefix $(obj),$(LOWLEVEL_INIT))

-all:   $(obj).depend $(LIB)
+all:   $(obj).depend $(LIB) $(LOWLEVEL_INIT)

 $(LIB):        $(OBJS)
        $(AR) $(ARFLAGS) $@ $(OBJS)
diff --git a/cpu/arm926ejs/at91/lowlevel_init.S 
b/cpu/arm926ejs/at91/lowlevel_init.S
index ec6ad5d..4fea4a6 100644
--- a/cpu/arm926ejs/at91/lowlevel_init.S
+++ b/cpu/arm926ejs/at91/lowlevel_init.S
@@ -30,6 +30,8 @@
 #ifndef CONFIG_SKIP_LOWLEVEL_INIT

 .globl lowlevel_init
+.weak lowlevel_init
+.set   lowlevel_init,function
 lowlevel_init:

        /*


I think that this part is not good, but I don't know how to make it better:
-               $(MAKE) -C cpu/$(CPU) $(if $(REMOTE_BUILD),$@,$(notdir $@))
+               $(MAKE) -C cpu/$(CPU)
+#              $(MAKE) -C cpu/$(CPU) $(if $(REMOTE_BUILD),$@,$(notdir $@))


-- 
Mit freundlichen Grüßen/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



More information about the U-Boot mailing list