Skip to contentSkip to conversation

at91: board specific lowlevel_init.S

PATCH New Ilko Iliev 4 participants 26 messages Oct 21, 2008 – Nov 6, 2008

Subsystems (3)
lore
Share & tools
lore

Ilko Iliev

author
#0 lore raw

PATCH 1/1 at91: board specific lowlevel_init.S

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

index ec6ad5d..7882e89 100644

cpu/arm926ejs/at91/lowlevel_init.S +1 -1
@@ -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 */

#1 lore raw

PATCH 1/1 at91: board specific lowlevel_init.S

Dear Ilko Iliev,

Quoted 18 lines · In message <[email protected]> you wrote:

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

index ec6ad5d..7882e89 100644

cpu/arm926ejs/at91/lowlevel_init.S +1 -1
@@ -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:

cpu/arm926ejs/at91/lowlevel_init.S lowlevel_init: · line 43

Quoted 7 lines
cpu/arm926ejs/at91/lowlevel_init.S +2 -2
@@ -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

Signature · 5 lines
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.
author
#2 lore raw

PATCH 1/1 at91: board specific lowlevel_init.S

Quoted 24 lines · Wolfgang Denk

Dear Ilko Iliev,

Quoted 20 lines · In message <[email protected]> you wrote:

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

index ec6ad5d..7882e89 100644

cpu/arm926ejs/at91/lowlevel_init.S +1 -1
@@ -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:

cpu/arm926ejs/at91/lowlevel_init.S +0 -0
@@ -39,5 +39,5 @@ lowlevel_init:
        mov     pc, lr
 
Quoted 10 lines

cpu/arm926ejs/at91/lowlevel_init.S lowlevel_init: · line 43

Quoted 6 lines
cpu/arm926ejs/at91/lowlevel_init.S +2 -2
        .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

#3 lore raw

PATCH 1/1 at91: board specific lowlevel_init.S

Quoted 35 lines · Ilko Iliev
Quoted 24 lines · Wolfgang Denk

Dear Ilko Iliev,

Quoted 20 lines · In message <[email protected]> you wrote:

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

index ec6ad5d..7882e89 100644

cpu/arm926ejs/at91/lowlevel_init.S +1 -1
@@ -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:

cpu/arm926ejs/at91/lowlevel_init.S +0 -0
@@ -39,5 +39,5 @@ lowlevel_init:
        mov     pc, lr
 
Quoted 10 lines

cpu/arm926ejs/at91/lowlevel_init.S lowlevel_init: · line 43

Quoted 6 lines
cpu/arm926ejs/at91/lowlevel_init.S +2 -2
        .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?

Quoted 4 lines

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.

#4 lore raw

PATCH 1/1 at91: board specific lowlevel_init.S

In reply to Ilko Iliev

Dear Ilko Iliev,

Quoted 6 lines · In message <[email protected]> you wrote:
Quoted 4 lines

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

Quoted 2 lines

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

Signature · 5 lines
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"
author
#5 lore raw

PATCH 1/1 at91: board specific lowlevel_init.S

Dear Mr. Denk,

Quoted 50 lines

Dear Ilko Iliev,

Quoted 7 lines · In message <[email protected]> you wrote:
Quoted 4 lines

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

Quoted 3 lines

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

Quoted 5 lines

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().

Signature · 6 lines
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
#6 lore raw

PATCH 1/1 at91: board specific lowlevel_init.S

Quoted 52 lines · Ilko Iliev

Dear Mr. Denk,

Quoted 50 lines

Dear Ilko Iliev,

Quoted 7 lines · In message <[email protected]> you wrote:
Quoted 4 lines

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

Quoted 3 lines

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

Quoted 8 lines
Quoted 5 lines

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.

author
#7 lore raw

PATCH 1/1 at91: board specific lowlevel_init.S

Quoted 64 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 62 lines · Ilko Iliev

Dear Mr. Denk,

Quoted 59 lines

Dear Ilko Iliev,

Quoted 9 lines · In message <[email protected]> you wrote:
Quoted 5 lines

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

Quoted 4 lines

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?

Quoted 8 lines
Quoted 4 lines

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

Signature · 6 lines
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
#8 lore raw

PATCH 1/1 at91: board specific lowlevel_init.S

Quoted 63 lines · Ilko Iliev
Quoted 62 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 60 lines · Ilko Iliev

Dear Mr. Denk,

Quoted 48 lines

Dear Ilko Iliev,

Quoted 7 lines · In message <[email protected]> you wrote:
Quoted 4 lines

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

Quoted 3 lines

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

Quoted 5 lines

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().

Quoted 7 lines
Quoted 3 lines

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.

author
#9 lore raw

PATCH 1/1 at91: board specific lowlevel_init.S

Quoted 97 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 79 lines · Ilko Iliev
Quoted 66 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 63 lines · Ilko Iliev

Dear Mr. Denk,

Quoted 59 lines

Dear Ilko Iliev,

Quoted 9 lines · In message <[email protected]> you wrote:
Quoted 5 lines

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

Quoted 4 lines

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?

Quoted 11 lines
Quoted 5 lines

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

Quoted 5 lines

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
		.......
Quoted 3 lines

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.

Signature · 6 lines
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
#10 lore raw

PATCH 1/1 at91: board specific lowlevel_init.S

Quoted 98 lines · Ilko Iliev
Quoted 97 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 79 lines · Ilko Iliev
Quoted 66 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 63 lines · Ilko Iliev

Dear Mr. Denk,

Quoted 59 lines

Dear Ilko Iliev,

Quoted 9 lines · In message <[email protected]> you wrote:
Quoted 5 lines

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

Quoted 4 lines

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?

Quoted 11 lines
Quoted 5 lines

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

Quoted 5 lines

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
		.......
Quoted 8 lines
Quoted 3 lines

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.

author
#11 lore raw

PATCH 1/1 at91: board specific lowlevel_init.S

Quoted 119 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 117 lines · Ilko Iliev
Quoted 115 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 91 lines · Ilko Iliev
Quoted 74 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 70 lines · Ilko Iliev

Dear Mr. Denk,

Quoted 65 lines

Dear Ilko Iliev,

Quoted 11 lines · In message <[email protected]> you wrote:
Quoted 6 lines

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

Quoted 5 lines

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?

Quoted 14 lines
Quoted 6 lines

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

Quoted 6 lines

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.

Quoted 8 lines
Quoted 6 lines

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

Signature · 13 lines
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
author
#12 lore raw

PATCH 1/1 at91: board specific lowlevel_init.S

In reply to Jean-Christophe PLAGNIOL-VILLARD

Dear Jean-Christophe,

Quoted 121 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 119 lines · Ilko Iliev
Quoted 111 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 91 lines · Ilko Iliev
Quoted 74 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 70 lines · Ilko Iliev

Dear Mr. Denk,

Quoted 65 lines

Dear Ilko Iliev,

Quoted 11 lines · In message <[email protected]> you wrote:
Quoted 6 lines

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

Quoted 5 lines

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?

Quoted 14 lines
Quoted 6 lines

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

Quoted 6 lines

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
		.......
Quoted 4 lines

Best Regards,
J.

Still doesn't work - the lowlevel_init is weak, but not overwritten.

Quoted 9 lines
Quoted 4 lines

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.

Signature · 6 lines
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
#13 lore raw

PATCH 1/1 at91: board specific lowlevel_init.S

Hi Ilko,

Ilko Iliev wrote:
<snip>

Quoted 6 lines

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

#14 lore raw

PATCH 1/1 at91: board specific lowlevel_init.S

Quoted 10 lines · Ben Warren

Hi Ilko,

Ilko Iliev wrote:
<snip>

Quoted 6 lines

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.

Quoted 5 lines

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.

author
#15 lore raw

PATCH 1/1 at91: board specific lowlevel_init.S

Dear Jean-Christophe,

Quoted 20 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 12 lines · Ben Warren

Hi Ilko,

Ilko Iliev wrote:
<snip>

Quoted 7 lines

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.

Quoted 6 lines

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

Quoted 9 lines

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.

Signature · 6 lines
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
#16 lore raw

PATCH 1/1 at91: board specific lowlevel_init.S

Dear Ilko,

Quoted 2 lines · In message <[email protected]> you wrote:
Quoted 2 lines · Ben Warren

...

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

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

...

Quoted 2 lines

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.

Quoted 2 lines

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.

Quoted 2 lines

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

Signature · 5 lines
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
#17 lore raw

PATCH 1/1 at91: board specific lowlevel_init.S

In reply to Jean-Christophe PLAGNIOL-VILLARD

Dear Jean-Christophe PLAGNIOL-VILLARD,

Quoted 9 lines · In message <[email protected]> you wrote:
Quoted 6 lines

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.

Quoted 1 line

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

Signature · 5 lines
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
#18 lore raw

PATCH 1/1 at91: board specific lowlevel_init.S

Quoted 11 lines · Wolfgang Denk

Dear Jean-Christophe PLAGNIOL-VILLARD,

Quoted 8 lines · In message <[email protected]> you wrote:
Quoted 6 lines

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.

Quoted 8 lines
Quoted 1 line

Move from AR to LD.

Well, that is exactly what Ben just described.

Quoted 1 line

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.

author
#19 lore raw

PATCH 1/1 at91: board specific lowlevel_init.S

Dear Jean-Christophe,

Quoted 19 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 17 lines · Wolfgang Denk

Dear Jean-Christophe PLAGNIOL-VILLARD,

Quoted 10 lines · In message <[email protected]> you wrote:
Quoted 6 lines

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.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

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:

Makefile +3 -0
index d6abb4d..b1c07ae 100644
@@ -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),,$@))
cpu/arm926ejs/at91/Makefile +4 -3
index 2d2a888..d0dcf9b 100644
@@ -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)
(quoted diff) +0 -0

b/cpu/arm926ejs/at91/lowlevel_init.S
index ec6ad5d..4fea4a6 100644

cpu/arm926ejs/at91/lowlevel_init.S +2 -0
@@ -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 $@))
Signature · 6 lines
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
#20 lore raw

PATCH 1/1 at91: board specific lowlevel_init.S

Quoted 30 lines · Ilko Iliev

Dear Jean-Christophe,

Quoted 27 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 14 lines · Wolfgang Denk

Dear Jean-Christophe PLAGNIOL-VILLARD,

Quoted 10 lines · In message <[email protected]> you wrote:
Quoted 6 lines

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.

Quoted 8 lines

Well, that is exactly what Ben just described.

Quoted 2 lines

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

config.mk +3 -0
index 5a9334c..0d81ab3 100644
@@ -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))
 
 #########################################################################
 
cpu/arm926ejs/at91/Makefile +1 -1
index 2d2a888..662657c 100644
@@ -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.

author
#21 lore raw

PATCH 1/1 at91: board specific lowlevel_init.S

Dear Jean,

Quoted 76 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 39 lines · Ilko Iliev

Dear Jean-Christophe,

Quoted 35 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 21 lines · Wolfgang Denk

Dear Jean-Christophe PLAGNIOL-VILLARD,

Quoted 7 lines · In message <[email protected]> you wrote:
Quoted 7 lines

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

Quoted 5 lines

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.

Quoted 7 lines
Quoted 3 lines

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

config.mk +3 -0
index 5a9334c..0d81ab3 100644
@@ -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))
 
 #########################################################################
 
cpu/arm926ejs/at91/Makefile +1 -1
index 2d2a888..662657c 100644
@@ -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

cpu/arm926ejs/at91/Makefile +1 -1
-	$(AR) $(ARFLAGS) $@ $(OBJS)
+	$(call cmd_link_o_target, $@, $(OBJS))
Quoted 3 lines

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

Signature · 6 lines
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
#22 lore raw

PATCH 1/1 at91: board specific lowlevel_init.S

Quoted 89 lines · Ilko Iliev

Dear Jean,

Quoted 76 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 39 lines · Ilko Iliev

Dear Jean-Christophe,

Quoted 35 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 21 lines · Wolfgang Denk

Dear Jean-Christophe PLAGNIOL-VILLARD,

Quoted 7 lines · In message <[email protected]> you wrote:
Quoted 7 lines

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

Quoted 5 lines

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.

Quoted 7 lines
Quoted 3 lines

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

config.mk +3 -0
index 5a9334c..0d81ab3 100644
@@ -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))
 
 #########################################################################
 
cpu/arm926ejs/at91/Makefile +1 -1
index 2d2a888..662657c 100644
@@ -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

cpu/arm926ejs/at91/Makefile +1 -1
-	$(AR) $(ARFLAGS) $@ $(OBJS)
+	$(call cmd_link_o_target, $@, $(OBJS))
Quoted 3 lines

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'

Quoted 2 lines

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.

#23 lore raw

PATCH 1/1 at91: board specific lowlevel_init.S

Dear Jean-Christophe PLAGNIOL-VILLARD,

Quoted 5 lines · In message <[email protected]> you wrote:
Quoted 3 lines

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

Signature · 9 lines
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
author
#24 lore raw

PATCH 1/1 at91: board specific lowlevel_init.S

In reply to Jean-Christophe PLAGNIOL-VILLARD

Dear Jean,

Quoted 102 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 100 lines · Ilko Iliev

Dear Jean,

Quoted 86 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 48 lines · Ilko Iliev

Dear Jean-Christophe,

Quoted 43 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 25 lines · Wolfgang Denk

Dear Jean-Christophe PLAGNIOL-VILLARD,

Quoted 8 lines · In message <[email protected]> you wrote:
Quoted 8 lines

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

Quoted 6 lines

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.

Quoted 9 lines
Quoted 4 lines

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

config.mk +3 -0
index 5a9334c..0d81ab3 100644
@@ -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))
 
 #########################################################################
 
cpu/arm926ejs/at91/Makefile +1 -1
index 2d2a888..662657c 100644
@@ -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

cpu/arm926ejs/at91/Makefile +1 -1
-	$(AR) $(ARFLAGS) $@ $(OBJS)
+	$(call cmd_link_o_target, $@, $(OBJS))
Quoted 4 lines

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'

Quoted 6 lines
Quoted 3 lines

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.

Signature · 6 lines
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
author
#25 lore raw

PATCH 1/1 at91: board specific lowlevel_init.S

In reply to Jean-Christophe PLAGNIOL-VILLARD

Dear Jean,

Quoted 102 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 100 lines · Ilko Iliev

Dear Jean,

Quoted 86 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 48 lines · Ilko Iliev

Dear Jean-Christophe,

Quoted 43 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 25 lines · Wolfgang Denk

Dear Jean-Christophe PLAGNIOL-VILLARD,

Quoted 8 lines · In message <[email protected]> you wrote:
Quoted 8 lines

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

Quoted 6 lines

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.

Quoted 9 lines
Quoted 4 lines

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

config.mk +3 -0
index 5a9334c..0d81ab3 100644
@@ -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))
 
 #########################################################################
 
cpu/arm926ejs/at91/Makefile +1 -1
index 2d2a888..662657c 100644
@@ -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

cpu/arm926ejs/at91/Makefile +1 -1
-	$(AR) $(ARFLAGS) $@ $(OBJS)
+	$(call cmd_link_o_target, $@, $(OBJS))
Quoted 4 lines

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'

Quoted 6 lines
Quoted 3 lines

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

Signature · 6 lines
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