public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] at91: board specific lowlevel_init.S
@ 2008-10-21 13:41 Ilko Iliev
  2008-10-21 13:58 ` Wolfgang Denk
  0 siblings, 1 reply; 26+ messages in thread
From: Ilko Iliev @ 2008-10-21 13:41 UTC (permalink / raw)
  To: u-boot

This patch allows to have an at91 board specific lowlevel_init.S

Signed-off-by: Ilko Iliev <iliev@ronetix.at>

index ec6ad5d..7882e89 100644
--- a/cpu/arm926ejs/at91/lowlevel_init.S
+++ b/cpu/arm926ejs/at91/lowlevel_init.S
@@ -27,7 +27,7 @@
 #include <config.h>
 #include <version.h>

-#ifndef CONFIG_SKIP_LOWLEVEL_INIT
+#if !defined(CONFIG_SKIP_LOWLEVEL_INIT) && 
!defined(CONFIG_USER_LOWLEVEL_INIT)

 .globl lowlevel_init
 lowlevel_init:
@@ -39,5 +39,5 @@ lowlevel_init:
        mov     pc, lr

        .ltorg
-
-#endif /* CONFIG_SKIP_LOWLEVEL_INIT */
+
+#endif /* !CONFIG_SKIP_LOWLEVEL_INIT && !CONFIG_USER_LOWLEVEL_INIT */

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [U-Boot] [PATCH] at91: board specific lowlevel_init.S
  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
  0 siblings, 1 reply; 26+ messages in thread
From: Wolfgang Denk @ 2008-10-21 13:58 UTC (permalink / raw)
  To: u-boot

Dear Ilko Iliev,

In message <48FDDC1C.2080808@ronetix.at> you wrote:
> This patch allows to have an at91 board specific lowlevel_init.S
> 
> Signed-off-by: Ilko Iliev <iliev@ronetix.at>
> 
> index ec6ad5d..7882e89 100644
> --- a/cpu/arm926ejs/at91/lowlevel_init.S
> +++ b/cpu/arm926ejs/at91/lowlevel_init.S
> @@ -27,7 +27,7 @@
>  #include <config.h>
>  #include <version.h>
> 
> -#ifndef CONFIG_SKIP_LOWLEVEL_INIT
> +#if !defined(CONFIG_SKIP_LOWLEVEL_INIT) && 
> !defined(CONFIG_USER_LOWLEVEL_INIT)
> 
>  .globl lowlevel_init
>  lowlevel_init:
> @@ -39,5 +39,5 @@ lowlevel_init:
>         mov     pc, lr
> 
>         .ltorg
> -
> -#endif /* CONFIG_SKIP_LOWLEVEL_INIT */
> +
> +#endif /* !CONFIG_SKIP_LOWLEVEL_INIT && !CONFIG_USER_LOWLEVEL_INIT */

Maybe instead of adding mor #ifdef'ery here, we can turn
lowlevel_init() into a "weak" function that can be redefined by board
specific code?

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Karl's version of Parkinson's Law: Work expands to  exceed  the  time
alloted it.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [U-Boot] [PATCH] at91: board specific lowlevel_init.S
  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
  0 siblings, 2 replies; 26+ messages in thread
From: Ilko Iliev @ 2008-10-21 16:00 UTC (permalink / raw)
  To: u-boot

Wolfgang Denk wrote:
> Dear Ilko Iliev,
>
> In message <48FDDC1C.2080808@ronetix.at> you wrote:
>   
>> This patch allows to have an at91 board specific lowlevel_init.S
>>
>> Signed-off-by: Ilko Iliev <iliev@ronetix.at>
>>
>> index ec6ad5d..7882e89 100644
>> --- a/cpu/arm926ejs/at91/lowlevel_init.S
>> +++ b/cpu/arm926ejs/at91/lowlevel_init.S
>> @@ -27,7 +27,7 @@
>>  #include <config.h>
>>  #include <version.h>
>>
>> -#ifndef CONFIG_SKIP_LOWLEVEL_INIT
>> +#if !defined(CONFIG_SKIP_LOWLEVEL_INIT) && 
>> !defined(CONFIG_USER_LOWLEVEL_INIT)
>>
>>  .globl lowlevel_init
>>  lowlevel_init:
>> @@ -39,5 +39,5 @@ lowlevel_init:
>>         mov     pc, lr
>>
>>         .ltorg
>> -
>> -#endif /* CONFIG_SKIP_LOWLEVEL_INIT */
>> +
>> +#endif /* !CONFIG_SKIP_LOWLEVEL_INIT && !CONFIG_USER_LOWLEVEL_INIT */
>>     
>
> Maybe instead of adding mor #ifdef'ery here, we can turn
> lowlevel_init() into a "weak" function that can be redefined by board
> specific code?
The lowlevel_init() is an assembler function called from another 
assembler function and the attribute .weak doesn't work.
There are no assembler file in the U-BOOT tree which use weak functions.
Do you know how can I make an assembler function weak?

best regards,
Ilko Iilev

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [U-Boot] [PATCH] at91: board specific lowlevel_init.S
  2008-10-21 16:00   ` Ilko Iliev
@ 2008-10-21 16:43     ` Jean-Christophe PLAGNIOL-VILLARD
  2008-10-21 19:08     ` Wolfgang Denk
  1 sibling, 0 replies; 26+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2008-10-21 16:43 UTC (permalink / raw)
  To: u-boot

On 18:00 Tue 21 Oct     , Ilko Iliev wrote:
> Wolfgang Denk wrote:
> > Dear Ilko Iliev,
> >
> > In message <48FDDC1C.2080808@ronetix.at> you wrote:
> >   
> >> This patch allows to have an at91 board specific lowlevel_init.S
> >>
> >> Signed-off-by: Ilko Iliev <iliev@ronetix.at>
> >>
> >> index ec6ad5d..7882e89 100644
> >> --- a/cpu/arm926ejs/at91/lowlevel_init.S
> >> +++ b/cpu/arm926ejs/at91/lowlevel_init.S
> >> @@ -27,7 +27,7 @@
> >>  #include <config.h>
> >>  #include <version.h>
> >>
> >> -#ifndef CONFIG_SKIP_LOWLEVEL_INIT
> >> +#if !defined(CONFIG_SKIP_LOWLEVEL_INIT) && 
> >> !defined(CONFIG_USER_LOWLEVEL_INIT)
> >>
> >>  .globl lowlevel_init
> >>  lowlevel_init:
> >> @@ -39,5 +39,5 @@ lowlevel_init:
> >>         mov     pc, lr
> >>
> >>         .ltorg
> >> -
> >> -#endif /* CONFIG_SKIP_LOWLEVEL_INIT */
> >> +
> >> +#endif /* !CONFIG_SKIP_LOWLEVEL_INIT && !CONFIG_USER_LOWLEVEL_INIT */
> >>     
> >
> > Maybe instead of adding mor #ifdef'ery here, we can turn
> > lowlevel_init() into a "weak" function that can be redefined by board
> > specific code?
> The lowlevel_init() is an assembler function called from another 
> assembler function and the attribute .weak doesn't work.
> There are no assembler file in the U-BOOT tree which use weak functions.
> Do you know how can I make an assembler function weak?
IIRC .weak fct1 = fct2 should work

.weakref not

Best Regards,
J.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [U-Boot] [PATCH] at91: board specific lowlevel_init.S
  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
  1 sibling, 1 reply; 26+ messages in thread
From: Wolfgang Denk @ 2008-10-21 19:08 UTC (permalink / raw)
  To: u-boot

Dear Ilko Iliev,

In message <48FDFCA0.4090608@ronetix.at> you wrote:
>
> > Maybe instead of adding mor #ifdef'ery here, we can turn
> > lowlevel_init() into a "weak" function that can be redefined by board
> > specific code?
> The lowlevel_init() is an assembler function called from another 
> assembler function and the attribute .weak doesn't work.

What do you mean by "attribute .weak doesn't work" ?

> There are no assembler file in the U-BOOT tree which use weak functions.
> Do you know how can I make an assembler function weak?

Well, if you don't know, then don't ask me, ask your compiler - he
knows how to do this.

For example, common/cmd_boot.c has this code snippet right at the
beginning:

 30
 31 /* Allow ports to override the default behavior */
 32 __attribute__((weak))
 33 unsigned long do_go_exec (ulong (*entry)(int, char *[]), int argc, char *argv[])
 34 {
 35         return entry (argc, argv);
 36 }

Compile this with -S option, and you get this:

 12 .Ltext0:
 13         .align 2
 14         .weak   do_go_exec
 15         .type   do_go_exec, @function
 16 do_go_exec:
 17 .LFB87:
 18         .file 1 "cmd_boot.c"
 19         .loc 1 34 0
 20 .LVL0:
 21         mflr 0
 22 .LCFI0:
 23         stwu 1,-16(1)
...


So to me it seems as if the attribute .weak is supposed to work just fine.

What exactly is not working for you?

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"You shouldn't make my toaster angry." - Household security explained
in "Johnny Quest"

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [U-Boot] [PATCH] at91: board specific lowlevel_init.S
  2008-10-21 19:08     ` Wolfgang Denk
@ 2008-10-22 11:12       ` Ilko Iliev
  2008-10-22 12:41         ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 26+ messages in thread
From: Ilko Iliev @ 2008-10-22 11:12 UTC (permalink / raw)
  To: u-boot

Dear Mr. Denk,

> Dear Ilko Iliev,
>
> In message <48FDFCA0.4090608@ronetix.at> you wrote:
>   
>>> Maybe instead of adding mor #ifdef'ery here, we can turn
>>> lowlevel_init() into a "weak" function that can be redefined by board
>>> specific code?
>>>       
>> The lowlevel_init() is an assembler function called from another 
>> assembler function and the attribute .weak doesn't work.
>>     
>
> What do you mean by "attribute .weak doesn't work" ?
>
>   
>> There are no assembler file in the U-BOOT tree which use weak functions.
>> Do you know how can I make an assembler function weak?
>>     
>
> Well, if you don't know, then don't ask me, ask your compiler - he
> knows how to do this.
>
> For example, common/cmd_boot.c has this code snippet right at the
> beginning:
>
>  30
>  31 /* Allow ports to override the default behavior */
>  32 __attribute__((weak))
>  33 unsigned long do_go_exec (ulong (*entry)(int, char *[]), int argc, char *argv[])
>  34 {
>  35         return entry (argc, argv);
>  36 }
>
> Compile this with -S option, and you get this:
>
>  12 .Ltext0:
>  13         .align 2
>  14         .weak   do_go_exec
>  15         .type   do_go_exec, @function
>  16 do_go_exec:
>  17 .LFB87:
>  18         .file 1 "cmd_boot.c"
>  19         .loc 1 34 0
>  20 .LVL0:
>  21         mflr 0
>  22 .LCFI0:
>  23         stwu 1,-16(1)
> ...
>
>
> So to me it seems as if the attribute .weak is supposed to work just fine.
>
> What exactly is not working for you?
>
>   
With ".weak lowlevel_init" the function is marked as weak (I can see 
this in the ELF file) but it is not overwritten from the another 
lowlevel_init().


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

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [U-Boot] [PATCH] at91: board specific lowlevel_init.S
  2008-10-22 11:12       ` Ilko Iliev
@ 2008-10-22 12:41         ` Jean-Christophe PLAGNIOL-VILLARD
  2008-10-22 13:07           ` Ilko Iliev
  0 siblings, 1 reply; 26+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2008-10-22 12:41 UTC (permalink / raw)
  To: u-boot

On 13:12 Wed 22 Oct     , Ilko Iliev wrote:
> Dear Mr. Denk,
> 
> > Dear Ilko Iliev,
> >
> > In message <48FDFCA0.4090608@ronetix.at> you wrote:
> >   
> >>> Maybe instead of adding mor #ifdef'ery here, we can turn
> >>> lowlevel_init() into a "weak" function that can be redefined by board
> >>> specific code?
> >>>       
> >> The lowlevel_init() is an assembler function called from another 
> >> assembler function and the attribute .weak doesn't work.
> >>     
> >
> > What do you mean by "attribute .weak doesn't work" ?
> >
> >   
> >> There are no assembler file in the U-BOOT tree which use weak functions.
> >> Do you know how can I make an assembler function weak?
> >>     
> >
> > Well, if you don't know, then don't ask me, ask your compiler - he
> > knows how to do this.
> >
> > For example, common/cmd_boot.c has this code snippet right at the
> > beginning:
> >
> >  30
> >  31 /* Allow ports to override the default behavior */
> >  32 __attribute__((weak))
> >  33 unsigned long do_go_exec (ulong (*entry)(int, char *[]), int argc, char *argv[])
> >  34 {
> >  35         return entry (argc, argv);
> >  36 }
> >
> > Compile this with -S option, and you get this:
> >
> >  12 .Ltext0:
> >  13         .align 2
> >  14         .weak   do_go_exec
> >  15         .type   do_go_exec, @function
> >  16 do_go_exec:
> >  17 .LFB87:
> >  18         .file 1 "cmd_boot.c"
> >  19         .loc 1 34 0
> >  20 .LVL0:
> >  21         mflr 0
> >  22 .LCFI0:
> >  23         stwu 1,-16(1)
> > ...
> >
> >
> > So to me it seems as if the attribute .weak is supposed to work just fine.
> >
> > What exactly is not working for you?
> >
> >   
> With ".weak lowlevel_init" the function is marked as weak (I can see 
> this in the ELF file) but it is not overwritten from the another 
> lowlevel_init().
try
.weak __default_lowlevel_init = lowlevel_init

IIRC

Best Regards,
J.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [U-Boot] [PATCH] at91: board specific lowlevel_init.S
  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
  0 siblings, 1 reply; 26+ messages in thread
From: Ilko Iliev @ 2008-10-22 13:07 UTC (permalink / raw)
  To: u-boot

Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 13:12 Wed 22 Oct     , Ilko Iliev wrote:
>   
>> Dear Mr. Denk,
>>
>>     
>>> Dear Ilko Iliev,
>>>
>>> In message <48FDFCA0.4090608@ronetix.at> you wrote:
>>>   
>>>       
>>>>> Maybe instead of adding mor #ifdef'ery here, we can turn
>>>>> lowlevel_init() into a "weak" function that can be redefined by board
>>>>> specific code?
>>>>>       
>>>>>           
>>>> The lowlevel_init() is an assembler function called from another 
>>>> assembler function and the attribute .weak doesn't work.
>>>>     
>>>>         
>>> What do you mean by "attribute .weak doesn't work" ?
>>>
>>>   
>>>       
>>>> There are no assembler file in the U-BOOT tree which use weak functions.
>>>> Do you know how can I make an assembler function weak?
>>>>     
>>>>         
>>> Well, if you don't know, then don't ask me, ask your compiler - he
>>> knows how to do this.
>>>
>>> For example, common/cmd_boot.c has this code snippet right at the
>>> beginning:
>>>
>>>  30
>>>  31 /* Allow ports to override the default behavior */
>>>  32 __attribute__((weak))
>>>  33 unsigned long do_go_exec (ulong (*entry)(int, char *[]), int argc, char *argv[])
>>>  34 {
>>>  35         return entry (argc, argv);
>>>  36 }
>>>
>>> Compile this with -S option, and you get this:
>>>
>>>  12 .Ltext0:
>>>  13         .align 2
>>>  14         .weak   do_go_exec
>>>  15         .type   do_go_exec, @function
>>>  16 do_go_exec:
>>>  17 .LFB87:
>>>  18         .file 1 "cmd_boot.c"
>>>  19         .loc 1 34 0
>>>  20 .LVL0:
>>>  21         mflr 0
>>>  22 .LCFI0:
>>>  23         stwu 1,-16(1)
>>> ...
>>>
>>>
>>> So to me it seems as if the attribute .weak is supposed to work just fine.
>>>
>>> What exactly is not working for you?
>>>
>>>   
>>>       
>> With ".weak lowlevel_init" the function is marked as weak (I can see 
>> this in the ELF file) but it is not overwritten from the another 
>> lowlevel_init().
>>     
> try
> .weak __default_lowlevel_init = lowlevel_init
>
>   
I tried and the result is:
lowlevel_init.S:32: Error: junk at end of line, first unrecognized 
character is `='

I' using arm-elf-gcc 4.1.1


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

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [U-Boot] [PATCH] at91: board specific lowlevel_init.S
  2008-10-22 13:07           ` Ilko Iliev
@ 2008-10-22 13:22             ` Jean-Christophe PLAGNIOL-VILLARD
  2008-10-22 14:01               ` Ilko Iliev
  0 siblings, 1 reply; 26+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2008-10-22 13:22 UTC (permalink / raw)
  To: u-boot

On 15:07 Wed 22 Oct     , Ilko Iliev wrote:
> Jean-Christophe PLAGNIOL-VILLARD wrote:
>> On 13:12 Wed 22 Oct     , Ilko Iliev wrote:
>>   
>>> Dear Mr. Denk,
>>>
>>>     
>>>> Dear Ilko Iliev,
>>>>
>>>> In message <48FDFCA0.4090608@ronetix.at> you wrote:
>>>>         
>>>>>> Maybe instead of adding mor #ifdef'ery here, we can turn
>>>>>> lowlevel_init() into a "weak" function that can be redefined by board
>>>>>> specific code?
>>>>>>                 
>>>>> The lowlevel_init() is an assembler function called from another  
>>>>> assembler function and the attribute .weak doesn't work.
>>>>>             
>>>> What do you mean by "attribute .weak doesn't work" ?
>>>>
>>>>         
>>>>> There are no assembler file in the U-BOOT tree which use weak functions.
>>>>> Do you know how can I make an assembler function weak?
>>>>>             
>>>> Well, if you don't know, then don't ask me, ask your compiler - he
>>>> knows how to do this.
>>>>
>>>> For example, common/cmd_boot.c has this code snippet right at the
>>>> beginning:
>>>>
>>>>  30
>>>>  31 /* Allow ports to override the default behavior */
>>>>  32 __attribute__((weak))
>>>>  33 unsigned long do_go_exec (ulong (*entry)(int, char *[]), int argc, char *argv[])
>>>>  34 {
>>>>  35         return entry (argc, argv);
>>>>  36 }
>>>>
>>>> Compile this with -S option, and you get this:
>>>>
>>>>  12 .Ltext0:
>>>>  13         .align 2
>>>>  14         .weak   do_go_exec
>>>>  15         .type   do_go_exec, @function
>>>>  16 do_go_exec:
>>>>  17 .LFB87:
>>>>  18         .file 1 "cmd_boot.c"
>>>>  19         .loc 1 34 0
>>>>  20 .LVL0:
>>>>  21         mflr 0
>>>>  22 .LCFI0:
>>>>  23         stwu 1,-16(1)
>>>> ...
>>>>
>>>>
>>>> So to me it seems as if the attribute .weak is supposed to work just fine.
>>>>
>>>> What exactly is not working for you?
>>>>
>>>>         
>>> With ".weak lowlevel_init" the function is marked as weak (I can see  
>>> this in the ELF file) but it is not overwritten from the another  
>>> lowlevel_init().
>>>     
>> try

>>   
> I tried and the result is:
> lowlevel_init.S:32: Error: junk at end of line, first unrecognized  
> character is `='
>
	sorry try this

	.global __default_lowlevel_init
		.....
	.weak	lowlevel_init
	.set	lowlevel_init,__default_lowlevel_init

	after in the other asm
	.global lowlevel_init
		.......

Best Regards,
J.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [U-Boot] [PATCH] at91: board specific lowlevel_init.S
  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
  0 siblings, 1 reply; 26+ messages in thread
From: Ilko Iliev @ 2008-10-22 14:01 UTC (permalink / raw)
  To: u-boot

Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 15:07 Wed 22 Oct     , Ilko Iliev wrote:
>   
>> Jean-Christophe PLAGNIOL-VILLARD wrote:
>>     
>>> On 13:12 Wed 22 Oct     , Ilko Iliev wrote:
>>>   
>>>       
>>>> Dear Mr. Denk,
>>>>
>>>>     
>>>>         
>>>>> Dear Ilko Iliev,
>>>>>
>>>>> In message <48FDFCA0.4090608@ronetix.at> you wrote:
>>>>>         
>>>>>           
>>>>>>> Maybe instead of adding mor #ifdef'ery here, we can turn
>>>>>>> lowlevel_init() into a "weak" function that can be redefined by board
>>>>>>> specific code?
>>>>>>>                 
>>>>>>>               
>>>>>> The lowlevel_init() is an assembler function called from another  
>>>>>> assembler function and the attribute .weak doesn't work.
>>>>>>             
>>>>>>             
>>>>> What do you mean by "attribute .weak doesn't work" ?
>>>>>
>>>>>         
>>>>>           
>>>>>> There are no assembler file in the U-BOOT tree which use weak functions.
>>>>>> Do you know how can I make an assembler function weak?
>>>>>>             
>>>>>>             
>>>>> Well, if you don't know, then don't ask me, ask your compiler - he
>>>>> knows how to do this.
>>>>>
>>>>> For example, common/cmd_boot.c has this code snippet right at the
>>>>> beginning:
>>>>>
>>>>>  30
>>>>>  31 /* Allow ports to override the default behavior */
>>>>>  32 __attribute__((weak))
>>>>>  33 unsigned long do_go_exec (ulong (*entry)(int, char *[]), int argc, char *argv[])
>>>>>  34 {
>>>>>  35         return entry (argc, argv);
>>>>>  36 }
>>>>>
>>>>> Compile this with -S option, and you get this:
>>>>>
>>>>>  12 .Ltext0:
>>>>>  13         .align 2
>>>>>  14         .weak   do_go_exec
>>>>>  15         .type   do_go_exec, @function
>>>>>  16 do_go_exec:
>>>>>  17 .LFB87:
>>>>>  18         .file 1 "cmd_boot.c"
>>>>>  19         .loc 1 34 0
>>>>>  20 .LVL0:
>>>>>  21         mflr 0
>>>>>  22 .LCFI0:
>>>>>  23         stwu 1,-16(1)
>>>>> ...
>>>>>
>>>>>
>>>>> So to me it seems as if the attribute .weak is supposed to work just fine.
>>>>>
>>>>> What exactly is not working for you?
>>>>>
>>>>>         
>>>>>           
>>>> With ".weak lowlevel_init" the function is marked as weak (I can see  
>>>> this in the ELF file) but it is not overwritten from the another  
>>>> lowlevel_init().
>>>>     
>>>>         
>>> try
>>>       
>
>   
>>>   
>>>       
>> I tried and the result is:
>> lowlevel_init.S:32: Error: junk at end of line, first unrecognized  
>> character is `='
>>
>>     
> 	sorry try this
>
> 	.global __default_lowlevel_init
> 		.....
> 	.weak	lowlevel_init
> 	.set	lowlevel_init,__default_lowlevel_init
>
> 	after in the other asm
> 	.global lowlevel_init
> 		.......
>
> Best Regards,
> J.
>   
Still doesn't work - the lowlevel_init is weak, but not overwritten.

It works only if the second (strong) function is in the same archive.
Maybe this is a bug of the linker.


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

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [U-Boot] [PATCH] at91: board specific lowlevel_init.S
  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
  0 siblings, 2 replies; 26+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2008-10-22 15:06 UTC (permalink / raw)
  To: u-boot

On 16:01 Wed 22 Oct     , Ilko Iliev wrote:
> Jean-Christophe PLAGNIOL-VILLARD wrote:
> > On 15:07 Wed 22 Oct     , Ilko Iliev wrote:
> >   
> >> Jean-Christophe PLAGNIOL-VILLARD wrote:
> >>     
> >>> On 13:12 Wed 22 Oct     , Ilko Iliev wrote:
> >>>   
> >>>       
> >>>> Dear Mr. Denk,
> >>>>
> >>>>     
> >>>>         
> >>>>> Dear Ilko Iliev,
> >>>>>
> >>>>> In message <48FDFCA0.4090608@ronetix.at> you wrote:
> >>>>>         
> >>>>>           
> >>>>>>> Maybe instead of adding mor #ifdef'ery here, we can turn
> >>>>>>> lowlevel_init() into a "weak" function that can be redefined by board
> >>>>>>> specific code?
> >>>>>>>                 
> >>>>>>>               
> >>>>>> The lowlevel_init() is an assembler function called from another  
> >>>>>> assembler function and the attribute .weak doesn't work.
> >>>>>>             
> >>>>>>             
> >>>>> What do you mean by "attribute .weak doesn't work" ?
> >>>>>
> >>>>>         
> >>>>>           
> >>>>>> There are no assembler file in the U-BOOT tree which use weak functions.
> >>>>>> Do you know how can I make an assembler function weak?
> >>>>>>             
> >>>>>>             
> >>>>> Well, if you don't know, then don't ask me, ask your compiler - he
> >>>>> knows how to do this.
> >>>>>
> >>>>> For example, common/cmd_boot.c has this code snippet right at the
> >>>>> beginning:
> >>>>>
> >>>>>  30
> >>>>>  31 /* Allow ports to override the default behavior */
> >>>>>  32 __attribute__((weak))
> >>>>>  33 unsigned long do_go_exec (ulong (*entry)(int, char *[]), int argc, char *argv[])
> >>>>>  34 {
> >>>>>  35         return entry (argc, argv);
> >>>>>  36 }
> >>>>>
> >>>>> Compile this with -S option, and you get this:
> >>>>>
> >>>>>  12 .Ltext0:
> >>>>>  13         .align 2
> >>>>>  14         .weak   do_go_exec
> >>>>>  15         .type   do_go_exec, @function
> >>>>>  16 do_go_exec:
> >>>>>  17 .LFB87:
> >>>>>  18         .file 1 "cmd_boot.c"
> >>>>>  19         .loc 1 34 0
> >>>>>  20 .LVL0:
> >>>>>  21         mflr 0
> >>>>>  22 .LCFI0:
> >>>>>  23         stwu 1,-16(1)
> >>>>> ...
> >>>>>
> >>>>>
> >>>>> So to me it seems as if the attribute .weak is supposed to work just fine.
> >>>>>
> >>>>> What exactly is not working for you?
> >>>>>
> >>>>>         
> >>>>>           
> >>>> With ".weak lowlevel_init" the function is marked as weak (I can see  
> >>>> this in the ELF file) but it is not overwritten from the another  
> >>>> lowlevel_init().
> >>>>     
> >>>>         
> >>> try
> >>>       
> >
> >   
> >>>   
> >>>       
> >> I tried and the result is:
> >> lowlevel_init.S:32: Error: junk at end of line, first unrecognized  
> >> character is `='
> >>
> >>     
> > 	sorry try this
> >
> > 	.global __default_lowlevel_init
> > 		.....
> > 	.weak	lowlevel_init
> > 	.set	lowlevel_init,__default_lowlevel_init
> >
> > 	after in the other asm
> > 	.global lowlevel_init
> > 		.......
> >
> > Best Regards,
> > J.
> >   
> Still doesn't work - the lowlevel_init is weak, but not overwritten.
> 
> It works only if the second (strong) function is in the same archive.
> Maybe this is a bug of the linker.
> 
Do you specify that the 2 is type "func"

Best Regards,
J.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [U-Boot] [PATCH] at91: board specific lowlevel_init.S
  2008-10-22 15:06                 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2008-10-22 15:49                   ` Ilko Iliev
  2008-10-27 15:52                   ` Ilko Iliev
  1 sibling, 0 replies; 26+ messages in thread
From: Ilko Iliev @ 2008-10-22 15:49 UTC (permalink / raw)
  To: u-boot

Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 16:01 Wed 22 Oct     , Ilko Iliev wrote:
>   
>> Jean-Christophe PLAGNIOL-VILLARD wrote:
>>     
>>> On 15:07 Wed 22 Oct     , Ilko Iliev wrote:
>>>   
>>>       
>>>> Jean-Christophe PLAGNIOL-VILLARD wrote:
>>>>     
>>>>         
>>>>> On 13:12 Wed 22 Oct     , Ilko Iliev wrote:
>>>>>   
>>>>>       
>>>>>           
>>>>>> Dear Mr. Denk,
>>>>>>
>>>>>>     
>>>>>>         
>>>>>>             
>>>>>>> Dear Ilko Iliev,
>>>>>>>
>>>>>>> In message <48FDFCA0.4090608@ronetix.at> you wrote:
>>>>>>>         
>>>>>>>           
>>>>>>>               
>>>>>>>>> Maybe instead of adding mor #ifdef'ery here, we can turn
>>>>>>>>> lowlevel_init() into a "weak" function that can be redefined by board
>>>>>>>>> specific code?
>>>>>>>>>                 
>>>>>>>>>               
>>>>>>>>>                   
>>>>>>>> The lowlevel_init() is an assembler function called from another  
>>>>>>>> assembler function and the attribute .weak doesn't work.
>>>>>>>>             
>>>>>>>>             
>>>>>>>>                 
>>>>>>> What do you mean by "attribute .weak doesn't work" ?
>>>>>>>
>>>>>>>         
>>>>>>>           
>>>>>>>               
>>>>>>>> There are no assembler file in the U-BOOT tree which use weak functions.
>>>>>>>> Do you know how can I make an assembler function weak?
>>>>>>>>             
>>>>>>>>             
>>>>>>>>                 
>>>>>>> Well, if you don't know, then don't ask me, ask your compiler - he
>>>>>>> knows how to do this.
>>>>>>>
>>>>>>> For example, common/cmd_boot.c has this code snippet right at the
>>>>>>> beginning:
>>>>>>>
>>>>>>>  30
>>>>>>>  31 /* Allow ports to override the default behavior */
>>>>>>>  32 __attribute__((weak))
>>>>>>>  33 unsigned long do_go_exec (ulong (*entry)(int, char *[]), int argc, char *argv[])
>>>>>>>  34 {
>>>>>>>  35         return entry (argc, argv);
>>>>>>>  36 }
>>>>>>>
>>>>>>> Compile this with -S option, and you get this:
>>>>>>>
>>>>>>>  12 .Ltext0:
>>>>>>>  13         .align 2
>>>>>>>  14         .weak   do_go_exec
>>>>>>>  15         .type   do_go_exec, @function
>>>>>>>  16 do_go_exec:
>>>>>>>  17 .LFB87:
>>>>>>>  18         .file 1 "cmd_boot.c"
>>>>>>>  19         .loc 1 34 0
>>>>>>>  20 .LVL0:
>>>>>>>  21         mflr 0
>>>>>>>  22 .LCFI0:
>>>>>>>  23         stwu 1,-16(1)
>>>>>>> ...
>>>>>>>
>>>>>>>
>>>>>>> So to me it seems as if the attribute .weak is supposed to work just fine.
>>>>>>>
>>>>>>> What exactly is not working for you?
>>>>>>>
>>>>>>>         
>>>>>>>           
>>>>>>>               
>>>>>> With ".weak lowlevel_init" the function is marked as weak (I can see  
>>>>>> this in the ELF file) but it is not overwritten from the another  
>>>>>> lowlevel_init().
>>>>>>     
>>>>>>         
>>>>>>             
>>>>> try
>>>>>       
>>>>>           
>>>   
>>>       
>>>>>   
>>>>>       
>>>>>           
>>>> I tried and the result is:
>>>> lowlevel_init.S:32: Error: junk at end of line, first unrecognized  
>>>> character is `='
>>>>
>>>>     
>>>>         
>>> 	sorry try this
>>>
>>> 	.global __default_lowlevel_init
>>> 		.....
>>> 	.weak	lowlevel_init
>>> 	.set	lowlevel_init,__default_lowlevel_init
>>>
>>> 	after in the other asm
>>> 	.global lowlevel_init
>>> 		.......
>>>
>>> Best Regards,
>>> J.
>>>   
>>>       
>> Still doesn't work - the lowlevel_init is weak, but not overwritten.
>>
>> It works only if the second (strong) function is in the same archive.
>> Maybe this is a bug of the linker.
>>
>>     
> Do you specify that the 2 is type "func"
>   
The following variants don't work:

Variant A:
.globl lowlevel_init
.weak  lowlevel_init
.type  lowlevel_init,function
lowlevel_init:
   .......

Variant B:
.globl __default_lowlevel_init
.weak    lowlevel_init
.set    lowlevel_init,__default_lowlevel_init
.type   __default_lowlevel_init,function
lowlevel_init:
   .......


-- 
Mit freundlichen Gr??en/With best regards,
Ilko Iliev
Ronetix Development Tools GmbH
Waidhausenstrasse 13/5
1140 Vienna, Austria
Tel: +43 1 956 3138 
Tel: +43 720 500 315
Fax: +43 1 8174 955 3464 
E-Mail: iliev at ronetix.at
Web: www.ronetix.at
VAT: ATU63916016
Ronetix GmbH - 1140 Vienna - Gesch?ftsf?hrer: Ilko Iliev
Registergericht: HG Vienna, FN 304979z

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [U-Boot] [PATCH] at91: board specific lowlevel_init.S
  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
  1 sibling, 1 reply; 26+ messages in thread
From: Ilko Iliev @ 2008-10-27 15:52 UTC (permalink / raw)
  To: u-boot

Dear Jean-Christophe,

Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 16:01 Wed 22 Oct     , Ilko Iliev wrote:
>   
>> Jean-Christophe PLAGNIOL-VILLARD wrote:
>>     
>>> On 15:07 Wed 22 Oct     , Ilko Iliev wrote:
>>>   
>>>       
>>>> Jean-Christophe PLAGNIOL-VILLARD wrote:
>>>>     
>>>>         
>>>>> On 13:12 Wed 22 Oct     , Ilko Iliev wrote:
>>>>>   
>>>>>       
>>>>>           
>>>>>> Dear Mr. Denk,
>>>>>>
>>>>>>     
>>>>>>         
>>>>>>             
>>>>>>> Dear Ilko Iliev,
>>>>>>>
>>>>>>> In message <48FDFCA0.4090608@ronetix.at> you wrote:
>>>>>>>         
>>>>>>>           
>>>>>>>               
>>>>>>>>> Maybe instead of adding mor #ifdef'ery here, we can turn
>>>>>>>>> lowlevel_init() into a "weak" function that can be redefined by board
>>>>>>>>> specific code?
>>>>>>>>>                 
>>>>>>>>>               
>>>>>>>>>                   
>>>>>>>> The lowlevel_init() is an assembler function called from another  
>>>>>>>> assembler function and the attribute .weak doesn't work.
>>>>>>>>             
>>>>>>>>             
>>>>>>>>                 
>>>>>>> What do you mean by "attribute .weak doesn't work" ?
>>>>>>>
>>>>>>>         
>>>>>>>           
>>>>>>>               
>>>>>>>> There are no assembler file in the U-BOOT tree which use weak functions.
>>>>>>>> Do you know how can I make an assembler function weak?
>>>>>>>>             
>>>>>>>>             
>>>>>>>>                 
>>>>>>> Well, if you don't know, then don't ask me, ask your compiler - he
>>>>>>> knows how to do this.
>>>>>>>
>>>>>>> For example, common/cmd_boot.c has this code snippet right at the
>>>>>>> beginning:
>>>>>>>
>>>>>>>  30
>>>>>>>  31 /* Allow ports to override the default behavior */
>>>>>>>  32 __attribute__((weak))
>>>>>>>  33 unsigned long do_go_exec (ulong (*entry)(int, char *[]), int argc, char *argv[])
>>>>>>>  34 {
>>>>>>>  35         return entry (argc, argv);
>>>>>>>  36 }
>>>>>>>
>>>>>>> Compile this with -S option, and you get this:
>>>>>>>
>>>>>>>  12 .Ltext0:
>>>>>>>  13         .align 2
>>>>>>>  14         .weak   do_go_exec
>>>>>>>  15         .type   do_go_exec, @function
>>>>>>>  16 do_go_exec:
>>>>>>>  17 .LFB87:
>>>>>>>  18         .file 1 "cmd_boot.c"
>>>>>>>  19         .loc 1 34 0
>>>>>>>  20 .LVL0:
>>>>>>>  21         mflr 0
>>>>>>>  22 .LCFI0:
>>>>>>>  23         stwu 1,-16(1)
>>>>>>> ...
>>>>>>>
>>>>>>>
>>>>>>> So to me it seems as if the attribute .weak is supposed to work just fine.
>>>>>>>
>>>>>>> What exactly is not working for you?
>>>>>>>
>>>>>>>         
>>>>>>>           
>>>>>>>               
>>>>>> With ".weak lowlevel_init" the function is marked as weak (I can see  
>>>>>> this in the ELF file) but it is not overwritten from the another  
>>>>>> lowlevel_init().
>>>>>>     
>>>>>>         
>>>>>>             
>>>>> try
>>>>>       
>>>>>           
>>>   
>>>       
>>>>>   
>>>>>       
>>>>>           
>>>> I tried and the result is:
>>>> lowlevel_init.S:32: Error: junk at end of line, first unrecognized  
>>>> character is `='
>>>>
>>>>     
>>>>         
>>> 	sorry try this
>>>
>>> 	.global __default_lowlevel_init
>>> 		.....
>>> 	.weak	lowlevel_init
>>> 	.set	lowlevel_init,__default_lowlevel_init
>>>
>>> 	after in the other asm
>>> 	.global lowlevel_init
>>> 		.......
>>>
>>> Best Regards,
>>> J.
>>>   
>>>       
>> Still doesn't work - the lowlevel_init is weak, but not overwritten.
>>
>> It works only if the second (strong) function is in the same archive.
>> Maybe this is a bug of the linker.
>>
>>     
> Do you specify that the 2 is type "func"
>
> Best Regards,
> J.
>   

I tried several variants to make the function lowlevel_init() weak but 
without success.
If there is no other solution for the problem could you commit my patch.
Without this patch I can't post the patch for our PM9261 and PM9263 boards.

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

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [U-Boot] [PATCH] at91: board specific lowlevel_init.S
  2008-10-27 15:52                   ` Ilko Iliev
@ 2008-10-27 16:27                     ` Ben Warren
  2008-10-27 16:43                       ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 26+ messages in thread
From: Ben Warren @ 2008-10-27 16:27 UTC (permalink / raw)
  To: u-boot

Hi Ilko,

Ilko Iliev wrote:
<snip>
> I tried several variants to make the function lowlevel_init() weak but 
> without success.
> If there is no other solution for the problem could you commit my patch.
> Without this patch I can't post the patch for our PM9261 and PM9263 boards.
>
>   
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 :)

cheers,
Ben

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [U-Boot] [PATCH] at91: board specific lowlevel_init.S
  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:20                         ` Wolfgang Denk
  0 siblings, 2 replies; 26+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2008-10-27 16:43 UTC (permalink / raw)
  To: u-boot

On 09:27 Mon 27 Oct     , Ben Warren wrote:
> Hi Ilko,
> 
> Ilko Iliev wrote:
> <snip>
> > I tried several variants to make the function lowlevel_init() weak but 
> > without success.
> > If there is no other solution for the problem could you commit my patch.
> > Without this patch I can't post the patch for our PM9261 and PM9263 boards.
> >
> >   
> 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.

Which need some work to fit on all boards.

Best Regards,
J.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [U-Boot] [PATCH] at91: board specific lowlevel_init.S
  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
  1 sibling, 1 reply; 26+ messages in thread
From: Ilko Iliev @ 2008-10-27 17:44 UTC (permalink / raw)
  To: u-boot

Dear Jean-Christophe,

Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 09:27 Mon 27 Oct     , Ben Warren wrote:
>   
>> Hi Ilko,
>>
>> Ilko Iliev wrote:
>> <snip>
>>     
>>> I tried several variants to make the function lowlevel_init() weak but 
>>> without success.
>>> If there is no other solution for the problem could you commit my patch.
>>> Without this patch I can't post the patch for our PM9261 and PM9263 boards.
>>>
>>>   
>>>       
>> 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.
>
> Which need some work to fit on all boards.
>
> Best Regards,
> J.
>   
Could be possible to commit my patch (I need it for the PM9261/PM9263 
patches) because the moving from AR to LD will take a lot of time.
When the moving from AR to LD is done, I will correct my board's patches.

Otherwise I must wait a lot of time and must change my patches every 
time when there is an correction in the at91 platform.

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

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [U-Boot] [PATCH] at91: board specific lowlevel_init.S
  2008-10-27 16:43                       ` Jean-Christophe PLAGNIOL-VILLARD
  2008-10-27 17:44                         ` Ilko Iliev
@ 2008-10-27 21:20                         ` Wolfgang Denk
  2008-10-28  6:24                           ` Jean-Christophe PLAGNIOL-VILLARD
  1 sibling, 1 reply; 26+ messages in thread
From: Wolfgang Denk @ 2008-10-27 21:20 UTC (permalink / raw)
  To: u-boot

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.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Unix: Some say the learning curve is steep,  but  you  only  have  to
climb it once.                                      - Karl Lehenbauer

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [U-Boot] [PATCH] at91: board specific lowlevel_init.S
  2008-10-27 17:44                         ` Ilko Iliev
@ 2008-10-27 21:27                           ` Wolfgang Denk
  0 siblings, 0 replies; 26+ messages in thread
From: Wolfgang Denk @ 2008-10-27 21:27 UTC (permalink / raw)
  To: u-boot

Dear Ilko,

In message <4905FE17.4040001@ronetix.at> you wrote:
> 
> > On 09:27 Mon 27 Oct     , Ben Warren 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 :)
...
>
> Could be possible to commit my patch (I need it for the PM9261/PM9263

I don't think this makes sense. If Ben is right (and  I  don't  doubt
that),  than  all  that  needs  to  be  done  is  to  link  your own,
board-specific lowlevel_init.o file separately, i. e. not as part  of
the lib$(BOARD).a archive.

This seems to be easy to do.

> patches) because the moving from AR to LD will take a lot of time.
> When the moving from AR to LD is done, I will correct my board's patches.

Argh. May we please try and get the terms  right.  I  know  that  you
didn't  phrase  the words "moving from AR to LD", but repeating these
makes no sense either. We've been using the  linker  ("ld")  all  the
time and will continue to use it, no matter if we're liking libraries
or object files. And note that we already now use a mix of both.

> Otherwise I must wait a lot of time and must change my patches every
> time when there is an correction in the at91 platform.

Right. So let's do it right now. Please use the weak approach as
described.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"I think trash is the most important manifestation of culture we have
in my lifetime."                                      - Johnny Legend

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [U-Boot] [PATCH] at91: board specific lowlevel_init.S
  2008-10-27 21:20                         ` Wolfgang Denk
@ 2008-10-28  6:24                           ` Jean-Christophe PLAGNIOL-VILLARD
  2008-10-28 11:45                             ` Ilko Iliev
  0 siblings, 1 reply; 26+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2008-10-28  6:24 UTC (permalink / raw)
  To: u-boot

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

Best Regards,
J.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [U-Boot] [PATCH] at91: board specific lowlevel_init.S
  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
  0 siblings, 1 reply; 26+ messages in thread
From: Ilko Iliev @ 2008-10-28 11:45 UTC (permalink / raw)
  To: u-boot

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
>   

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

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [U-Boot] [PATCH] at91: board specific lowlevel_init.S
  2008-10-28 11:45                             ` Ilko Iliev
@ 2008-10-30 20:47                               ` Jean-Christophe PLAGNIOL-VILLARD
  2008-11-05 17:29                                 ` Ilko Iliev
  0 siblings, 1 reply; 26+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2008-10-30 20:47 UTC (permalink / raw)
  To: u-boot

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.

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [U-Boot] [PATCH] at91: board specific lowlevel_init.S
  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
  0 siblings, 1 reply; 26+ messages in thread
From: Ilko Iliev @ 2008-11-05 17:29 UTC (permalink / raw)
  To: u-boot

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.
I'm not familiar with the makefile scripting, but I can't see a
possibility to link both lowlevel_init.o files into the u-boot.elf
without to change the main Makefile.

I think my last patch is a possible solution, but I don't know if the
following is a potential problem:

-               $(MAKE) -C cpu/$(CPU) $(if $(REMOTE_BUILD),$@,$(notdir $@))
+               $(MAKE) -C cpu/$(CPU)

I haven't the possibility to compile U-BOOT for all targets - maybe
someone can test all targets with my last patch (email from 28.10.2008).

-- 
Mit freundlichen Gruessen/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

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [U-Boot] [PATCH] at91: board specific lowlevel_init.S
  2008-11-05 17:29                                 ` Ilko Iliev
@ 2008-11-05 17:37                                   ` Jean-Christophe PLAGNIOL-VILLARD
  2008-11-05 21:33                                     ` Wolfgang Denk
                                                       ` (2 more replies)
  0 siblings, 3 replies; 26+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2008-11-05 17:37 UTC (permalink / raw)
  To: u-boot

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.

Best Regards,
J.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [U-Boot] [PATCH] at91: board specific lowlevel_init.S
  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
  2 siblings, 0 replies; 26+ messages in thread
From: Wolfgang Denk @ 2008-11-05 21:33 UTC (permalink / raw)
  To: u-boot

Dear Jean-Christophe PLAGNIOL-VILLARD,

In message <20081105173728.GB5323@game.jcrosoft.org> you wrote:
>
> > 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.

Then we probably should avoid a .a suffix ?

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"IBM uses what I like to call the 'hole-in-the-ground  technique'  to
destroy  the  competition.....  IBM digs a big HOLE in the ground and
covers it with leaves. It then puts a big POT OF GOLD nearby. Then it
gives the call, 'Hey, look at all this gold, get over here fast.'  As
soon  as  the competitor approaches the pot, he falls into the pit"
                                                     - John C. Dvorak

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [U-Boot] [PATCH] at91: board specific lowlevel_init.S
  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
  2 siblings, 0 replies; 26+ messages in thread
From: Ilko Iliev @ 2008-11-06 15:03 UTC (permalink / raw)
  To: u-boot

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 can confirm that your patch works - thank you!
Please commit the patch into the mainline.

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

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [U-Boot] [PATCH] at91: board specific lowlevel_init.S
  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
  2 siblings, 0 replies; 26+ messages in thread
From: Ilko Iliev @ 2008-11-06 15:07 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2008-11-06 15:07 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox